From 5244c9b05086a5a15890908d2f3eeaf467a79ebf Mon Sep 17 00:00:00 2001 From: mgambrell Date: Wed, 5 Nov 2008 20:23:40 +0000 Subject: [PATCH] initial checkin plus a bunch of gnu junk --- ABOUT-NLS | 768 ++ AUTHORS | 14 + COPYING | 340 + ChangeLog | 74 + INSTALL | 266 + Makefile.am | 13 + Makefile.in | 559 ++ NEWS | 636 ++ README | 479 ++ README-win.txt | 242 + VERSION | 1 + acinclude.m4 | 802 ++ aclocal.m4 | 4337 +++++++++++ compile | 107 + config.guess | 1298 ++++ config.rpath | 548 ++ config.sub | 1375 ++++ configure | 9306 +++++++++++++++++++++++ configure.in | 181 + depcomp | 479 ++ install-sh | 251 + m4/ChangeLog | 32 + m4/Makefile.am | 29 + m4/Makefile.in | 322 + m4/codeset.m4 | 23 + m4/gettext.m4 | 487 ++ m4/glibc21.m4 | 32 + m4/iconv.m4 | 103 + m4/intdiv0.m4 | 72 + m4/intmax.m4 | 32 + m4/inttypes-pri.m4 | 32 + m4/inttypes.m4 | 27 + m4/inttypes_h.m4 | 28 + m4/isc-posix.m4 | 26 + m4/lcmessage.m4 | 32 + m4/lib-ld.m4 | 112 + m4/lib-link.m4 | 551 ++ m4/lib-prefix.m4 | 155 + m4/longdouble.m4 | 30 + m4/longlong.m4 | 25 + m4/nls.m4 | 49 + m4/po.m4 | 426 ++ m4/printf-posix.m4 | 46 + m4/progtest.m4 | 91 + m4/signed.m4 | 19 + m4/size_max.m4 | 61 + m4/stdint_h.m4 | 28 + m4/uintmax_t.m4 | 32 + m4/ulonglong.m4 | 25 + m4/wchar_t.m4 | 22 + m4/wint_t.m4 | 22 + m4/xsize.m4 | 14 + missing | 336 + mkinstalldirs | 111 + po/ChangeLog | 11 + po/Makefile.in.in | 368 + po/Makevars | 41 + po/POTFILES.in | 18 + po/Rules-quot | 47 + po/boldquot.sed | 10 + po/en@boldquot.header | 25 + po/en@quot.header | 22 + po/fr.gmo | Bin 0 -> 14712 bytes po/fr.po | 1114 +++ po/insert-header.sin | 23 + po/quot.sed | 6 + po/remove-potcdate.sin | 19 + po/stamp-po | 1 + po/vba-1.7.2.pot | 1096 +++ src/2xSaI.cpp | 1274 ++++ src/AutoBuild.h | 31 + src/CheatSearch.cpp | 329 + src/CheatSearch.h | 73 + src/Cheats.cpp | 1674 ++++ src/Cheats.h | 54 + src/EEprom.cpp | 206 + src/EEprom.h | 39 + src/Flash.cpp | 258 + src/Flash.h | 34 + src/GBA.cpp | 4282 +++++++++++ src/GBA.h | 175 + src/GBAinline.h | 427 ++ src/Gfx.cpp | 52 + src/Gfx.h | 1579 ++++ src/Globals.cpp | 136 + src/Globals.h | 150 + src/Makefile.am | 19 + src/Makefile.in | 483 ++ src/Mode0.cpp | 552 ++ src/Mode1.cpp | 513 ++ src/Mode2.cpp | 478 ++ src/Mode3.cpp | 405 + src/Mode4.cpp | 402 + src/Mode5.cpp | 405 + src/NLS.h | 62 + src/Port.h | 75 + src/RTC.cpp | 237 + src/RTC.h | 31 + src/Sound.cpp | 1348 ++++ src/Sound.h | 82 + src/Sram.cpp | 32 + src/Sram.h | 26 + src/System.h | 131 + src/Text.cpp | 273 + src/Text.h | 24 + src/Util.cpp | 1111 +++ src/Util.h | 66 + src/VisualBoyAdvance.cfg | 213 + src/admame.cpp | 1010 +++ src/agbprint.cpp | 99 + src/agbprint.h | 27 + src/arm-new.h | 7164 +++++++++++++++++ src/armdis.cpp | 742 ++ src/armdis.h | 33 + src/bilinear.cpp | 420 + src/bios.cpp | 1158 +++ src/bios.h | 46 + src/elf.cpp | 2997 ++++++++ src/elf.h | 283 + src/expr-lex.cpp | 1590 ++++ src/expr.cpp | 998 +++ src/expr.cpp.h | 13 + src/expr.l | 71 + src/expr.y | 77 + src/exprNode.cpp | 411 + src/exprNode.h | 68 + src/gb/GB.cpp | 3805 +++++++++ src/gb/GB.h | 64 + src/gb/Makefile.am | 21 + src/gb/Makefile.in | 442 ++ src/gb/gbCheats.cpp | 462 ++ src/gb/gbCheats.h | 58 + src/gb/gbCodes.h | 1407 ++++ src/gb/gbCodesCB.h | 1288 ++++ src/gb/gbDis.cpp | 249 + src/gb/gbGfx.cpp | 490 ++ src/gb/gbGlobals.cpp | 54 + src/gb/gbGlobals.h | 68 + src/gb/gbMemory.cpp | 979 +++ src/gb/gbMemory.h | 149 + src/gb/gbPrinter.cpp | 229 + src/gb/gbPrinter.h | 20 + src/gb/gbSGB.cpp | 919 +++ src/gb/gbSGB.h | 39 + src/gb/gbSound.cpp | 973 +++ src/gb/gbSound.h | 59 + src/getopt.c | 1060 +++ src/getopt.h | 141 + src/getopt1.c | 190 + src/gtk/Makefile.am | 110 + src/gtk/Makefile.in | 1798 +++++ src/gtk/configfile.cpp | 262 + src/gtk/configfile.h | 204 + src/gtk/filters.cpp | 59 + src/gtk/filters.h | 106 + src/gtk/images/Makefile.am | 22 + src/gtk/images/Makefile.in | 339 + src/gtk/images/stock-vba-wm-16.png | Bin 0 -> 727 bytes src/gtk/images/stock-vba-wm-32.png | Bin 0 -> 1810 bytes src/gtk/images/stock-vba-wm-48.png | Bin 0 -> 3360 bytes src/gtk/images/stock-vba-wm-64.png | Bin 0 -> 5702 bytes src/gtk/images/vba-64.png | Bin 0 -> 5702 bytes src/gtk/input.cpp | 53 + src/gtk/input.h | 92 + src/gtk/intl.h | 42 + src/gtk/joypadconfig.cpp | 276 + src/gtk/joypadconfig.h | 88 + src/gtk/main.cpp | 177 + src/gtk/menuitem.h | 80 + src/gtk/screenarea.cpp | 293 + src/gtk/screenarea.h | 81 + src/gtk/sigccompat.h | 55 + src/gtk/system.cpp | 343 + src/gtk/tools.cpp | 65 + src/gtk/tools.h | 42 + src/gtk/vba.glade | 3597 +++++++++ src/gtk/window.cpp | 1942 +++++ src/gtk/window.h | 322 + src/gtk/windowcallbacks.cpp | 1579 ++++ src/hq2x.cpp | 920 +++ src/hq2x.h | 1824 +++++ src/hq3x32.cpp | 462 ++ src/hq3x32.h | 3692 +++++++++ src/hq_shared32.cpp | 414 + src/hq_shared32.h | 41 + src/i386/2xSaImmx.asm | 2109 +++++ src/i386/Makefile.am | 8 + src/i386/Makefile.in | 327 + src/inputGlobal.h | 39 + src/interframe.cpp | 620 ++ src/interp.h | 351 + src/lq2x.h | 1284 ++++ src/memgzio.c | 681 ++ src/memgzio.h | 21 + src/motionblur.cpp | 192 + src/movie.cpp | 1409 ++++ src/movie.h | 169 + src/nesvideos-piece.cpp | 515 ++ src/nesvideos-piece.h | 48 + src/pixel.cpp | 150 + src/prof/Makefile.am | 7 + src/prof/Makefile.in | 414 + src/prof/gmon.h | 148 + src/prof/gmon_out.h | 45 + src/prof/prof.cpp | 403 + src/prof/prof.h | 34 + src/remote.cpp | 698 ++ src/scanline.cpp | 230 + src/sdl/Makefile.am | 159 + src/sdl/Makefile.in | 1538 ++++ src/sdl/SDL.cpp | 3516 +++++++++ src/sdl/TestEmu.cpp | 448 ++ src/sdl/debugger.cpp | 1454 ++++ src/sdl/debugger.h | 20 + src/simple2x.cpp | 106 + src/thumb.h | 2474 ++++++ src/unzip.cpp | 1270 ++++ src/unzip.h | 294 + src/win32/.cvsignore | 1 + src/win32/AVIWrite.cpp | 187 + src/win32/AVIWrite.h | 49 + src/win32/AboutDialog.cpp | 83 + src/win32/AboutDialog.h | 73 + src/win32/AccelEditor.cpp | 363 + src/win32/AccelEditor.h | 81 + src/win32/AcceleratorManager.cpp | 801 ++ src/win32/AcceleratorManager.h | 144 + src/win32/Associate.cpp | 128 + src/win32/Associate.h | 73 + src/win32/BitmapControl.cpp | 287 + src/win32/BitmapControl.h | 96 + src/win32/BugReport.cpp | 249 + src/win32/BugReport.h | 68 + src/win32/CmdAccelOb.cpp | 558 ++ src/win32/CmdAccelOb.h | 113 + src/win32/ColorButton.cpp | 120 + src/win32/ColorButton.h | 74 + src/win32/ColorControl.cpp | 103 + src/win32/ColorControl.h | 74 + src/win32/Commands.cpp | 315 + src/win32/Direct3D.cpp | 816 ++ src/win32/DirectDraw.cpp | 980 +++ src/win32/DirectInput.cpp | 1093 +++ src/win32/DirectSound.cpp | 474 ++ src/win32/Directories.cpp | 257 + src/win32/Directories.h | 83 + src/win32/Disassemble.cpp | 349 + src/win32/Disassemble.h | 94 + src/win32/Display.h | 44 + src/win32/ExportGSASnapshot.cpp | 117 + src/win32/ExportGSASnapshot.h | 70 + src/win32/FileDlg.cpp | 200 + src/win32/FileDlg.h | 66 + src/win32/GBACheats.cpp | 1247 +++ src/win32/GBACheats.h | 294 + src/win32/GBCheatsDlg.cpp | 1080 +++ src/win32/GBCheatsDlg.h | 220 + src/win32/GBColorDlg.cpp | 261 + src/win32/GBColorDlg.h | 81 + src/win32/GBDisassemble.cpp | 262 + src/win32/GBDisassemble.h | 89 + src/win32/GBMapView.cpp | 577 ++ src/win32/GBMapView.h | 102 + src/win32/GBMemoryViewerDlg.cpp | 442 ++ src/win32/GBMemoryViewerDlg.h | 96 + src/win32/GBOamView.cpp | 599 ++ src/win32/GBOamView.h | 103 + src/win32/GBPaletteView.cpp | 243 + src/win32/GBPaletteView.h | 90 + src/win32/GBPrinterDlg.cpp | 494 ++ src/win32/GBPrinterDlg.h | 81 + src/win32/GBTileView.cpp | 524 ++ src/win32/GBTileView.h | 104 + src/win32/GDBConnection.cpp | 261 + src/win32/GDBConnection.h | 114 + src/win32/GDIDisplay.cpp | 490 ++ src/win32/GSACodeSelect.cpp | 120 + src/win32/GSACodeSelect.h | 69 + src/win32/Hyperlink.cpp | 118 + src/win32/Hyperlink.h | 75 + src/win32/IOViewer.cpp | 201 + src/win32/IOViewer.h | 78 + src/win32/IOViewerRegs.h | 2087 +++++ src/win32/IUpdate.h | 27 + src/win32/Input.h | 47 + src/win32/Joypad.cpp | 435 ++ src/win32/Joypad.h | 168 + src/win32/KeyboardEdit.cpp | 172 + src/win32/KeyboardEdit.h | 87 + src/win32/LangSelect.cpp | 97 + src/win32/LangSelect.h | 68 + src/win32/Logging.cpp | 287 + src/win32/Logging.h | 98 + src/win32/MainWnd.cpp | 1345 ++++ src/win32/MainWnd.h | 497 ++ src/win32/MainWndCheats.cpp | 209 + src/win32/MainWndFile.cpp | 1133 +++ src/win32/MainWndHelp.cpp | 46 + src/win32/MainWndOptions.cpp | 2219 ++++++ src/win32/MainWndTools.cpp | 673 ++ src/win32/MapView.cpp | 1026 +++ src/win32/MapView.h | 122 + src/win32/MaxScale.cpp | 89 + src/win32/MaxScale.h | 67 + src/win32/MemoryViewer.cpp | 653 ++ src/win32/MemoryViewer.h | 116 + src/win32/MemoryViewerAddressSize.cpp | 137 + src/win32/MemoryViewerAddressSize.h | 75 + src/win32/MemoryViewerDlg.cpp | 447 ++ src/win32/MemoryViewerDlg.h | 96 + src/win32/ModeConfirm.cpp | 113 + src/win32/ModeConfirm.h | 71 + src/win32/MovieCreate.cpp | 418 + src/win32/MovieCreate.h | 48 + src/win32/MovieOpen.cpp | 522 ++ src/win32/MovieOpen.h | 46 + src/win32/OamView.cpp | 669 ++ src/win32/OamView.h | 100 + src/win32/OpenGL.cpp | 638 ++ src/win32/PaletteView.cpp | 240 + src/win32/PaletteView.h | 90 + src/win32/PaletteViewControl.cpp | 409 + src/win32/PaletteViewControl.h | 90 + src/win32/PerfTimer.cpp | 35 + src/win32/PerfTimer.h | 403 + src/win32/Reg.cpp | 369 + src/win32/Reg.h | 37 + src/win32/ResizeDlg.cpp | 561 ++ src/win32/ResizeDlg.h | 59 + src/win32/RewindInterval.cpp | 119 + src/win32/RewindInterval.h | 70 + src/win32/RomInfo.cpp | 575 ++ src/win32/RomInfo.h | 101 + src/win32/Sound.h | 37 + src/win32/StringTokenizer.cpp | 69 + src/win32/StringTokenizer.h | 44 + src/win32/TextOptions.cpp | 80 + src/win32/TextOptions.h | 28 + src/win32/Throttle.cpp | 87 + src/win32/Throttle.h | 67 + src/win32/TileView.cpp | 587 ++ src/win32/TileView.h | 109 + src/win32/VBA.clw | 1715 +++++ src/win32/VBA.cpp | 2707 +++++++ src/win32/VBA.h | 292 + src/win32/VideoMode.cpp | 368 + src/win32/VideoMode.h | 102 + src/win32/VisualBoyAdvance.exe.manifest | 23 + src/win32/WavWriter.cpp | 117 + src/win32/WavWriter.h | 52 + src/win32/WinHelper.h | 232 + src/win32/WinResUtil.cpp | 109 + src/win32/WinResUtil.h | 31 + src/win32/ZoomControl.cpp | 190 + src/win32/ZoomControl.h | 78 + src/win32/gbadvance.ico | Bin 0 -> 4710 bytes src/win32/resource.h | 908 +++ src/win32/skin.cpp | 588 ++ src/win32/skin.h | 162 + src/win32/skinButton.cpp | 328 + src/win32/skinButton.h | 93 + src/win32/stdafx.cpp | 26 + src/win32/stdafx.h | 68 + src/win32/vba.aps | Bin 0 -> 187720 bytes src/win32/vba.rc | 2748 +++++++ src/win32/vba.rc2 | 50 + win32/GBA.vcproj | 1419 ++++ win32/Makefile.am | 9 + win32/Makefile.in | 311 + win32/directx/d3d8.h | 1279 ++++ win32/directx/d3d8.lib | Bin 0 -> 2466 bytes win32/directx/d3d8caps.h | 364 + win32/directx/d3d8types.h | 1684 ++++ win32/directx/d3dx8.h | 45 + win32/directx/d3dx8.lib | Bin 0 -> 2151212 bytes win32/directx/d3dx8core.h | 563 ++ win32/directx/d3dx8effect.h | 226 + win32/directx/d3dx8math.h | 1215 +++ win32/directx/d3dx8math.inl | 1757 +++++ win32/directx/d3dx8mesh.h | 760 ++ win32/directx/d3dx8shape.h | 220 + win32/directx/d3dx8tex.h | 1592 ++++ win32/directx/ddraw.h | 5792 ++++++++++++++ win32/directx/ddraw.lib | Bin 0 -> 4540 bytes win32/directx/dinput.h | 4417 +++++++++++ win32/directx/dinput.lib | Bin 0 -> 17790 bytes win32/directx/dsound.h | 2358 ++++++ win32/directx/dsound.lib | Bin 0 -> 4042 bytes win32/directx/dxfile.h | 240 + win32/directx/dxguid.lib | Bin 0 -> 107734 bytes win32/gba.sln | 22 + win32/include/cximage/xfile.h | 64 + win32/include/cximage/ximabmp.h | 94 + win32/include/cximage/ximadefs.h | 165 + win32/include/cximage/ximage.h | 547 ++ win32/include/cximage/ximagif.h | 262 + win32/include/cximage/ximaico.h | 71 + win32/include/cximage/ximaiter.h | 252 + win32/include/cximage/ximaj2k.h | 62 + win32/include/cximage/ximajas.h | 79 + win32/include/cximage/ximajbg.h | 60 + win32/include/cximage/ximajpg.h | 321 + win32/include/cximage/ximamng.h | 102 + win32/include/cximage/ximapcx.h | 80 + win32/include/cximage/ximapng.h | 90 + win32/include/cximage/ximatga.h | 77 + win32/include/cximage/ximatif.h | 85 + win32/include/cximage/ximawbmp.h | 60 + win32/include/cximage/ximawmf.h | 154 + win32/include/cximage/xiofile.h | 112 + win32/include/cximage/xmemfile.h | 69 + win32/include/png/png.h | 3156 ++++++++ win32/include/png/pngasmrd.h | 11 + win32/include/png/pngconf.h | 1322 ++++ win32/include/zlib/zconf.h | 279 + win32/include/zlib/zlib.h | 893 +++ win32/include/zlib/zutil.h | 220 + win32/lib/win32/CxImage.lib | Bin 0 -> 905508 bytes win32/lib/win32/jpeg.lib | Bin 0 -> 230704 bytes win32/lib/win32/libpng.lib | Bin 0 -> 179288 bytes win32/lib/win32/libpngMD.lib | Bin 0 -> 179684 bytes win32/lib/win32/zlib.lib | Bin 0 -> 61702 bytes win32/lib/win32/zlibMD.lib | Bin 0 -> 61960 bytes win32/nasm.exe | Bin 0 -> 551424 bytes 424 files changed, 197543 insertions(+) create mode 100644 ABOUT-NLS create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README-win.txt create mode 100644 VERSION create mode 100644 acinclude.m4 create mode 100644 aclocal.m4 create mode 100644 compile create mode 100644 config.guess create mode 100644 config.rpath create mode 100644 config.sub create mode 100644 configure create mode 100644 configure.in create mode 100644 depcomp create mode 100644 install-sh create mode 100644 m4/ChangeLog create mode 100644 m4/Makefile.am create mode 100644 m4/Makefile.in create mode 100644 m4/codeset.m4 create mode 100644 m4/gettext.m4 create mode 100644 m4/glibc21.m4 create mode 100644 m4/iconv.m4 create mode 100644 m4/intdiv0.m4 create mode 100644 m4/intmax.m4 create mode 100644 m4/inttypes-pri.m4 create mode 100644 m4/inttypes.m4 create mode 100644 m4/inttypes_h.m4 create mode 100644 m4/isc-posix.m4 create mode 100644 m4/lcmessage.m4 create mode 100644 m4/lib-ld.m4 create mode 100644 m4/lib-link.m4 create mode 100644 m4/lib-prefix.m4 create mode 100644 m4/longdouble.m4 create mode 100644 m4/longlong.m4 create mode 100644 m4/nls.m4 create mode 100644 m4/po.m4 create mode 100644 m4/printf-posix.m4 create mode 100644 m4/progtest.m4 create mode 100644 m4/signed.m4 create mode 100644 m4/size_max.m4 create mode 100644 m4/stdint_h.m4 create mode 100644 m4/uintmax_t.m4 create mode 100644 m4/ulonglong.m4 create mode 100644 m4/wchar_t.m4 create mode 100644 m4/wint_t.m4 create mode 100644 m4/xsize.m4 create mode 100644 missing create mode 100644 mkinstalldirs create mode 100644 po/ChangeLog create mode 100644 po/Makefile.in.in create mode 100644 po/Makevars create mode 100644 po/POTFILES.in create mode 100644 po/Rules-quot create mode 100644 po/boldquot.sed create mode 100644 po/en@boldquot.header create mode 100644 po/en@quot.header create mode 100644 po/fr.gmo create mode 100644 po/fr.po create mode 100644 po/insert-header.sin create mode 100644 po/quot.sed create mode 100644 po/remove-potcdate.sin create mode 100644 po/stamp-po create mode 100644 po/vba-1.7.2.pot create mode 100644 src/2xSaI.cpp create mode 100644 src/AutoBuild.h create mode 100644 src/CheatSearch.cpp create mode 100644 src/CheatSearch.h create mode 100644 src/Cheats.cpp create mode 100644 src/Cheats.h create mode 100644 src/EEprom.cpp create mode 100644 src/EEprom.h create mode 100644 src/Flash.cpp create mode 100644 src/Flash.h create mode 100644 src/GBA.cpp create mode 100644 src/GBA.h create mode 100644 src/GBAinline.h create mode 100644 src/Gfx.cpp create mode 100644 src/Gfx.h create mode 100644 src/Globals.cpp create mode 100644 src/Globals.h create mode 100644 src/Makefile.am create mode 100644 src/Makefile.in create mode 100644 src/Mode0.cpp create mode 100644 src/Mode1.cpp create mode 100644 src/Mode2.cpp create mode 100644 src/Mode3.cpp create mode 100644 src/Mode4.cpp create mode 100644 src/Mode5.cpp create mode 100644 src/NLS.h create mode 100644 src/Port.h create mode 100644 src/RTC.cpp create mode 100644 src/RTC.h create mode 100644 src/Sound.cpp create mode 100644 src/Sound.h create mode 100644 src/Sram.cpp create mode 100644 src/Sram.h create mode 100644 src/System.h create mode 100644 src/Text.cpp create mode 100644 src/Text.h create mode 100644 src/Util.cpp create mode 100644 src/Util.h create mode 100644 src/VisualBoyAdvance.cfg create mode 100644 src/admame.cpp create mode 100644 src/agbprint.cpp create mode 100644 src/agbprint.h create mode 100644 src/arm-new.h create mode 100644 src/armdis.cpp create mode 100644 src/armdis.h create mode 100644 src/bilinear.cpp create mode 100644 src/bios.cpp create mode 100644 src/bios.h create mode 100644 src/elf.cpp create mode 100644 src/elf.h create mode 100644 src/expr-lex.cpp create mode 100644 src/expr.cpp create mode 100644 src/expr.cpp.h create mode 100644 src/expr.l create mode 100644 src/expr.y create mode 100644 src/exprNode.cpp create mode 100644 src/exprNode.h create mode 100644 src/gb/GB.cpp create mode 100644 src/gb/GB.h create mode 100644 src/gb/Makefile.am create mode 100644 src/gb/Makefile.in create mode 100644 src/gb/gbCheats.cpp create mode 100644 src/gb/gbCheats.h create mode 100644 src/gb/gbCodes.h create mode 100644 src/gb/gbCodesCB.h create mode 100644 src/gb/gbDis.cpp create mode 100644 src/gb/gbGfx.cpp create mode 100644 src/gb/gbGlobals.cpp create mode 100644 src/gb/gbGlobals.h create mode 100644 src/gb/gbMemory.cpp create mode 100644 src/gb/gbMemory.h create mode 100644 src/gb/gbPrinter.cpp create mode 100644 src/gb/gbPrinter.h create mode 100644 src/gb/gbSGB.cpp create mode 100644 src/gb/gbSGB.h create mode 100644 src/gb/gbSound.cpp create mode 100644 src/gb/gbSound.h create mode 100644 src/getopt.c create mode 100644 src/getopt.h create mode 100644 src/getopt1.c create mode 100644 src/gtk/Makefile.am create mode 100644 src/gtk/Makefile.in create mode 100644 src/gtk/configfile.cpp create mode 100644 src/gtk/configfile.h create mode 100644 src/gtk/filters.cpp create mode 100644 src/gtk/filters.h create mode 100644 src/gtk/images/Makefile.am create mode 100644 src/gtk/images/Makefile.in create mode 100644 src/gtk/images/stock-vba-wm-16.png create mode 100644 src/gtk/images/stock-vba-wm-32.png create mode 100644 src/gtk/images/stock-vba-wm-48.png create mode 100644 src/gtk/images/stock-vba-wm-64.png create mode 100644 src/gtk/images/vba-64.png create mode 100644 src/gtk/input.cpp create mode 100644 src/gtk/input.h create mode 100644 src/gtk/intl.h create mode 100644 src/gtk/joypadconfig.cpp create mode 100644 src/gtk/joypadconfig.h create mode 100644 src/gtk/main.cpp create mode 100644 src/gtk/menuitem.h create mode 100644 src/gtk/screenarea.cpp create mode 100644 src/gtk/screenarea.h create mode 100644 src/gtk/sigccompat.h create mode 100644 src/gtk/system.cpp create mode 100644 src/gtk/tools.cpp create mode 100644 src/gtk/tools.h create mode 100644 src/gtk/vba.glade create mode 100644 src/gtk/window.cpp create mode 100644 src/gtk/window.h create mode 100644 src/gtk/windowcallbacks.cpp create mode 100644 src/hq2x.cpp create mode 100644 src/hq2x.h create mode 100644 src/hq3x32.cpp create mode 100644 src/hq3x32.h create mode 100644 src/hq_shared32.cpp create mode 100644 src/hq_shared32.h create mode 100644 src/i386/2xSaImmx.asm create mode 100644 src/i386/Makefile.am create mode 100644 src/i386/Makefile.in create mode 100644 src/inputGlobal.h create mode 100644 src/interframe.cpp create mode 100644 src/interp.h create mode 100644 src/lq2x.h create mode 100644 src/memgzio.c create mode 100644 src/memgzio.h create mode 100644 src/motionblur.cpp create mode 100644 src/movie.cpp create mode 100644 src/movie.h create mode 100644 src/nesvideos-piece.cpp create mode 100644 src/nesvideos-piece.h create mode 100644 src/pixel.cpp create mode 100644 src/prof/Makefile.am create mode 100644 src/prof/Makefile.in create mode 100644 src/prof/gmon.h create mode 100644 src/prof/gmon_out.h create mode 100644 src/prof/prof.cpp create mode 100644 src/prof/prof.h create mode 100644 src/remote.cpp create mode 100644 src/scanline.cpp create mode 100644 src/sdl/Makefile.am create mode 100644 src/sdl/Makefile.in create mode 100644 src/sdl/SDL.cpp create mode 100644 src/sdl/TestEmu.cpp create mode 100644 src/sdl/debugger.cpp create mode 100644 src/sdl/debugger.h create mode 100644 src/simple2x.cpp create mode 100644 src/thumb.h create mode 100644 src/unzip.cpp create mode 100644 src/unzip.h create mode 100644 src/win32/.cvsignore create mode 100644 src/win32/AVIWrite.cpp create mode 100644 src/win32/AVIWrite.h create mode 100644 src/win32/AboutDialog.cpp create mode 100644 src/win32/AboutDialog.h create mode 100644 src/win32/AccelEditor.cpp create mode 100644 src/win32/AccelEditor.h create mode 100644 src/win32/AcceleratorManager.cpp create mode 100644 src/win32/AcceleratorManager.h create mode 100644 src/win32/Associate.cpp create mode 100644 src/win32/Associate.h create mode 100644 src/win32/BitmapControl.cpp create mode 100644 src/win32/BitmapControl.h create mode 100644 src/win32/BugReport.cpp create mode 100644 src/win32/BugReport.h create mode 100644 src/win32/CmdAccelOb.cpp create mode 100644 src/win32/CmdAccelOb.h create mode 100644 src/win32/ColorButton.cpp create mode 100644 src/win32/ColorButton.h create mode 100644 src/win32/ColorControl.cpp create mode 100644 src/win32/ColorControl.h create mode 100644 src/win32/Commands.cpp create mode 100644 src/win32/Direct3D.cpp create mode 100644 src/win32/DirectDraw.cpp create mode 100644 src/win32/DirectInput.cpp create mode 100644 src/win32/DirectSound.cpp create mode 100644 src/win32/Directories.cpp create mode 100644 src/win32/Directories.h create mode 100644 src/win32/Disassemble.cpp create mode 100644 src/win32/Disassemble.h create mode 100644 src/win32/Display.h create mode 100644 src/win32/ExportGSASnapshot.cpp create mode 100644 src/win32/ExportGSASnapshot.h create mode 100644 src/win32/FileDlg.cpp create mode 100644 src/win32/FileDlg.h create mode 100644 src/win32/GBACheats.cpp create mode 100644 src/win32/GBACheats.h create mode 100644 src/win32/GBCheatsDlg.cpp create mode 100644 src/win32/GBCheatsDlg.h create mode 100644 src/win32/GBColorDlg.cpp create mode 100644 src/win32/GBColorDlg.h create mode 100644 src/win32/GBDisassemble.cpp create mode 100644 src/win32/GBDisassemble.h create mode 100644 src/win32/GBMapView.cpp create mode 100644 src/win32/GBMapView.h create mode 100644 src/win32/GBMemoryViewerDlg.cpp create mode 100644 src/win32/GBMemoryViewerDlg.h create mode 100644 src/win32/GBOamView.cpp create mode 100644 src/win32/GBOamView.h create mode 100644 src/win32/GBPaletteView.cpp create mode 100644 src/win32/GBPaletteView.h create mode 100644 src/win32/GBPrinterDlg.cpp create mode 100644 src/win32/GBPrinterDlg.h create mode 100644 src/win32/GBTileView.cpp create mode 100644 src/win32/GBTileView.h create mode 100644 src/win32/GDBConnection.cpp create mode 100644 src/win32/GDBConnection.h create mode 100644 src/win32/GDIDisplay.cpp create mode 100644 src/win32/GSACodeSelect.cpp create mode 100644 src/win32/GSACodeSelect.h create mode 100644 src/win32/Hyperlink.cpp create mode 100644 src/win32/Hyperlink.h create mode 100644 src/win32/IOViewer.cpp create mode 100644 src/win32/IOViewer.h create mode 100644 src/win32/IOViewerRegs.h create mode 100644 src/win32/IUpdate.h create mode 100644 src/win32/Input.h create mode 100644 src/win32/Joypad.cpp create mode 100644 src/win32/Joypad.h create mode 100644 src/win32/KeyboardEdit.cpp create mode 100644 src/win32/KeyboardEdit.h create mode 100644 src/win32/LangSelect.cpp create mode 100644 src/win32/LangSelect.h create mode 100644 src/win32/Logging.cpp create mode 100644 src/win32/Logging.h create mode 100644 src/win32/MainWnd.cpp create mode 100644 src/win32/MainWnd.h create mode 100644 src/win32/MainWndCheats.cpp create mode 100644 src/win32/MainWndFile.cpp create mode 100644 src/win32/MainWndHelp.cpp create mode 100644 src/win32/MainWndOptions.cpp create mode 100644 src/win32/MainWndTools.cpp create mode 100644 src/win32/MapView.cpp create mode 100644 src/win32/MapView.h create mode 100644 src/win32/MaxScale.cpp create mode 100644 src/win32/MaxScale.h create mode 100644 src/win32/MemoryViewer.cpp create mode 100644 src/win32/MemoryViewer.h create mode 100644 src/win32/MemoryViewerAddressSize.cpp create mode 100644 src/win32/MemoryViewerAddressSize.h create mode 100644 src/win32/MemoryViewerDlg.cpp create mode 100644 src/win32/MemoryViewerDlg.h create mode 100644 src/win32/ModeConfirm.cpp create mode 100644 src/win32/ModeConfirm.h create mode 100644 src/win32/MovieCreate.cpp create mode 100644 src/win32/MovieCreate.h create mode 100644 src/win32/MovieOpen.cpp create mode 100644 src/win32/MovieOpen.h create mode 100644 src/win32/OamView.cpp create mode 100644 src/win32/OamView.h create mode 100644 src/win32/OpenGL.cpp create mode 100644 src/win32/PaletteView.cpp create mode 100644 src/win32/PaletteView.h create mode 100644 src/win32/PaletteViewControl.cpp create mode 100644 src/win32/PaletteViewControl.h create mode 100644 src/win32/PerfTimer.cpp create mode 100644 src/win32/PerfTimer.h create mode 100644 src/win32/Reg.cpp create mode 100644 src/win32/Reg.h create mode 100644 src/win32/ResizeDlg.cpp create mode 100644 src/win32/ResizeDlg.h create mode 100644 src/win32/RewindInterval.cpp create mode 100644 src/win32/RewindInterval.h create mode 100644 src/win32/RomInfo.cpp create mode 100644 src/win32/RomInfo.h create mode 100644 src/win32/Sound.h create mode 100644 src/win32/StringTokenizer.cpp create mode 100644 src/win32/StringTokenizer.h create mode 100644 src/win32/TextOptions.cpp create mode 100644 src/win32/TextOptions.h create mode 100644 src/win32/Throttle.cpp create mode 100644 src/win32/Throttle.h create mode 100644 src/win32/TileView.cpp create mode 100644 src/win32/TileView.h create mode 100644 src/win32/VBA.clw create mode 100644 src/win32/VBA.cpp create mode 100644 src/win32/VBA.h create mode 100644 src/win32/VideoMode.cpp create mode 100644 src/win32/VideoMode.h create mode 100644 src/win32/VisualBoyAdvance.exe.manifest create mode 100644 src/win32/WavWriter.cpp create mode 100644 src/win32/WavWriter.h create mode 100644 src/win32/WinHelper.h create mode 100644 src/win32/WinResUtil.cpp create mode 100644 src/win32/WinResUtil.h create mode 100644 src/win32/ZoomControl.cpp create mode 100644 src/win32/ZoomControl.h create mode 100644 src/win32/gbadvance.ico create mode 100644 src/win32/resource.h create mode 100644 src/win32/skin.cpp create mode 100644 src/win32/skin.h create mode 100644 src/win32/skinButton.cpp create mode 100644 src/win32/skinButton.h create mode 100644 src/win32/stdafx.cpp create mode 100644 src/win32/stdafx.h create mode 100644 src/win32/vba.aps create mode 100644 src/win32/vba.rc create mode 100644 src/win32/vba.rc2 create mode 100644 win32/GBA.vcproj create mode 100644 win32/Makefile.am create mode 100644 win32/Makefile.in create mode 100644 win32/directx/d3d8.h create mode 100644 win32/directx/d3d8.lib create mode 100644 win32/directx/d3d8caps.h create mode 100644 win32/directx/d3d8types.h create mode 100644 win32/directx/d3dx8.h create mode 100644 win32/directx/d3dx8.lib create mode 100644 win32/directx/d3dx8core.h create mode 100644 win32/directx/d3dx8effect.h create mode 100644 win32/directx/d3dx8math.h create mode 100644 win32/directx/d3dx8math.inl create mode 100644 win32/directx/d3dx8mesh.h create mode 100644 win32/directx/d3dx8shape.h create mode 100644 win32/directx/d3dx8tex.h create mode 100644 win32/directx/ddraw.h create mode 100644 win32/directx/ddraw.lib create mode 100644 win32/directx/dinput.h create mode 100644 win32/directx/dinput.lib create mode 100644 win32/directx/dsound.h create mode 100644 win32/directx/dsound.lib create mode 100644 win32/directx/dxfile.h create mode 100644 win32/directx/dxguid.lib create mode 100644 win32/gba.sln create mode 100644 win32/include/cximage/xfile.h create mode 100644 win32/include/cximage/ximabmp.h create mode 100644 win32/include/cximage/ximadefs.h create mode 100644 win32/include/cximage/ximage.h create mode 100644 win32/include/cximage/ximagif.h create mode 100644 win32/include/cximage/ximaico.h create mode 100644 win32/include/cximage/ximaiter.h create mode 100644 win32/include/cximage/ximaj2k.h create mode 100644 win32/include/cximage/ximajas.h create mode 100644 win32/include/cximage/ximajbg.h create mode 100644 win32/include/cximage/ximajpg.h create mode 100644 win32/include/cximage/ximamng.h create mode 100644 win32/include/cximage/ximapcx.h create mode 100644 win32/include/cximage/ximapng.h create mode 100644 win32/include/cximage/ximatga.h create mode 100644 win32/include/cximage/ximatif.h create mode 100644 win32/include/cximage/ximawbmp.h create mode 100644 win32/include/cximage/ximawmf.h create mode 100644 win32/include/cximage/xiofile.h create mode 100644 win32/include/cximage/xmemfile.h create mode 100644 win32/include/png/png.h create mode 100644 win32/include/png/pngasmrd.h create mode 100644 win32/include/png/pngconf.h create mode 100644 win32/include/zlib/zconf.h create mode 100644 win32/include/zlib/zlib.h create mode 100644 win32/include/zlib/zutil.h create mode 100644 win32/lib/win32/CxImage.lib create mode 100644 win32/lib/win32/jpeg.lib create mode 100644 win32/lib/win32/libpng.lib create mode 100644 win32/lib/win32/libpngMD.lib create mode 100644 win32/lib/win32/zlib.lib create mode 100644 win32/lib/win32/zlibMD.lib create mode 100644 win32/nasm.exe diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..2f50c66 --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,768 @@ +Notes on the Free Translation Project +************************************* + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that will gradually become able to speak many languages. +A few packages already provide translations for their messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work at translations should contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +Quick configuration advice +========================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +INSTALL Matters +=============== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the GNU `gettext' own +library will be used. This library is wholly contained within this +package, usually in the `intl/' subdirectory, so prior installation of +the GNU `gettext' package is _not_ required. Installers may use +special options at configuration time for changing the default +behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will respectively bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might be not what is desirable. You +should use the more recent version of the GNU `gettext' library. I.e. +if the file `intl/VERSION' shows that the library which comes with this +package is more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages have usually many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +Using This Package +================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +Translating Teams +================= + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +Available Packages +================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of January +2004. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs da de el en en_GB eo es + +----------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | | + ap-utils | | + aspell | [] | + bash | [] [] [] [] | + batchelor | | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bluez-pin | [] [] [] | + clisp | | + clisp | [] [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + darkstat | [] () [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] () [] [] [] [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] [] [] | + flex | [] [] [] [] | + fslint | | + gas | [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] [] | + gettext | [] [] [] [] [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] [] [] [] | + gliv | | + glunarclock | [] [] | + gnubiff | [] | + gnucash | [] () [] [] | + gnucash-glossary | [] () [] | + gnupg | [] () [] [] [] [] | + gpe-aerial | [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] [] | + gpe-edit | [] | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] | + gpsdrive | () () () | + gramadoir | [] | + grep | [] [] [] [] [] [] | + gretl | [] | + gtick | [] () | + hello | [] [] [] [] [] [] | + id-utils | [] [] | + indent | [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] | + iso_639 | | + jpilot | [] [] [] | + jtag | | + jwhois | [] | + kbd | [] [] [] [] [] | + latrine | () | + ld | [] [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] | + libiconv | [] [] [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lingoteach_lessons | () () | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] | + man-db | [] () [] [] () | + minicom | [] [] [] | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] | + nano_1_0 | [] () [] [] [] | + opcodes | [] | + parted | [] [] [] [] [] | + ptx | [] [] [] [] [] | + python | | + radius | [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] | + sed | [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | | + sharutils | [] [] [] [] [] [] | + silky | () | + skencil | [] () [] | + sketch | [] () [] | + soundtracker | [] [] [] | + sp | [] | + tar | [] [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] [] | + tin | () () | + tp-robot | | + tuxpaint | [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] [] [] [] | + xchat | [] [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs da de el en en_GB eo es + 4 0 0 1 9 4 1 40 41 60 78 17 1 5 13 68 + + et eu fa fi fr ga gl he hr hu id is it ja ko lg + +-------------------------------------------------+ + a2ps | [] [] [] () () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] | + aspell | [] [] | + bash | [] [] | + batchelor | [] [] | + bfd | [] | + binutils | [] [] | + bison | [] [] [] [] | + bluez-pin | [] [] [] [] [] | + clisp | | + clisp | [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] [] | + darkstat | () [] [] [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext | [] [] [] | + gettext-examples | [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gliv | () | + glunarclock | [] [] [] [] | + gnubiff | [] | + gnucash | () [] | + gnucash-glossary | [] | + gnupg | [] [] [] [] [] [] [] | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] [] [] | + gpe-clock | [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] [] | + gpe-sketchbook | [] | + gpe-su | [] | + gpe-taskmanager | [] | + gpe-timesheet | [] [] [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] | + gprof | [] [] | + gpsdrive | () () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] | + gtick | [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + indent | [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | | + iso_4217 | [] [] [] [] [] [] | + iso_639 | | + jpilot | [] () | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] | + latrine | [] | + ld | [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] [] [] | + libiconv | [] [] [] [] [] [] [] [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] | + lingoteach_lessons | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] [] [] [] [] | + man-db | () () | + minicom | [] [] [] [] | + mysecretdiary | [] [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] | + sharutils | [] [] [] [] [] | + silky | () [] () () | + skencil | [] | + sketch | [] | + soundtracker | [] [] | + sp | [] () | + tar | [] [] [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] [] [] | + tin | [] () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] () [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] | + xchat | [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] [] | + +-------------------------------------------------+ + et eu fa fi fr ga gl he hr hu id is it ja ko lg + 22 2 1 26 106 28 24 8 10 41 33 1 26 33 12 0 + + lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru + +-----------------------------------------------------+ + a2ps | [] [] () () [] [] [] | + aegis | () () () | + ant-phone | [] [] | + anubis | [] [] [] [] [] [] | + ap-utils | [] () [] | + aspell | [] | + bash | [] [] [] | + batchelor | [] | + bfd | [] | + binutils | [] | + bison | [] [] [] [] [] | + bluez-pin | [] [] [] | + clisp | | + clisp | [] | + console-tools | [] | + coreutils | [] [] | + cpio | [] [] [] [] [] | + darkstat | [] [] [] [] | + diffutils | [] [] [] [] [] [] | + e2fsprogs | [] | + enscript | [] [] [] [] | + error | [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] | + fslint | [] [] | + gas | | + gawk | [] [] [] | + gbiff | [] [] | + gcal | | + gcc | | + gettext | [] [] [] | + gettext-examples | [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] | + gliv | [] [] [] | + glunarclock | [] [] [] [] | + gnubiff | [] | + gnucash | [] [] () [] | + gnucash-glossary | [] [] | + gnupg | [] | + gpe-aerial | [] [] [] [] | + gpe-beam | [] [] [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] [] [] [] | + gpe-contacts | [] [] [] [] | + gpe-edit | [] [] [] [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] [] | + gpe-ownerinfo | [] [] [] [] | + gpe-sketchbook | [] [] [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] | + gprof | [] [] | + gpsdrive | () () [] | + gramadoir | () [] | + grep | [] [] [] [] [] | + gretl | | + gtick | [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + indent | [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] [] [] [] [] | + iso_639 | [] | + jpilot | () () | + jtag | | + jwhois | [] [] [] [] () | + kbd | [] [] [] | + latrine | [] | + ld | | + libc | [] [] [] [] | + libgpewidget | [] [] [] | + libiconv | [] [] [] [] [] | + lifelines | | + lilypond | | + lingoteach | | + lingoteach_lessons | | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] | + make | [] [] [] [] | + man-db | [] | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] [] [] [] [] | + nano_1_0 | [] [] [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + ptx | [] [] [] [] [] [] [] [] | + python | | + radius | [] [] | + recode | [] [] [] [] | + rpm | [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] | + sharutils | [] [] | + silky | () | + skencil | [] [] | + sketch | [] [] | + soundtracker | | + sp | | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] | + vorbis-tools | [] [] [] | + wastesedge | | + wdiff | [] [] [] [] [] | + wget | [] [] [] | + xchat | [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] [] | + +-----------------------------------------------------+ + lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru + 1 2 0 3 12 0 10 69 6 7 1 40 26 36 76 63 + + sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu + +-----------------------------------------------------+ + a2ps | [] [] [] [] | 16 + aegis | | 0 + ant-phone | | 3 + anubis | [] [] | 9 + ap-utils | () | 3 + aspell | | 4 + bash | | 9 + batchelor | | 3 + bfd | [] [] | 6 + binutils | [] [] [] | 8 + bison | [] [] | 14 + bluez-pin | [] [] [] | 14 + clisp | | 0 + clisp | | 5 + console-tools | | 3 + coreutils | [] [] [] [] | 16 + cpio | [] [] | 14 + darkstat | [] [] [] () () | 12 + diffutils | [] [] [] | 23 + e2fsprogs | [] [] | 6 + enscript | [] [] | 12 + error | [] [] [] | 15 + fetchmail | [] [] | 11 + fileutils | [] [] [] [] [] | 17 + findutils | [] [] [] [] [] [] | 29 + flex | [] [] | 13 + fslint | | 3 + gas | [] | 3 + gawk | [] [] | 12 + gbiff | | 4 + gcal | [] [] | 4 + gcc | [] | 4 + gettext | [] [] [] [] [] | 16 + gettext-examples | [] [] [] [] [] | 14 + gettext-runtime | [] [] [] [] [] [] [] [] | 22 + gettext-tools | [] [] [] [] [] [] | 14 + gimp-print | [] [] | 10 + gliv | | 3 + glunarclock | [] [] [] | 13 + gnubiff | | 3 + gnucash | [] [] | 9 + gnucash-glossary | [] [] [] | 8 + gnupg | [] [] [] [] | 17 + gpe-aerial | [] | 7 + gpe-beam | [] | 8 + gpe-calendar | [] [] [] [] | 13 + gpe-clock | [] [] [] | 10 + gpe-conf | [] [] | 9 + gpe-contacts | [] [] [] | 11 + gpe-edit | [] [] [] [] [] | 12 + gpe-go | | 5 + gpe-login | [] [] [] [] [] | 13 + gpe-ownerinfo | [] [] [] [] | 13 + gpe-sketchbook | [] [] | 9 + gpe-su | [] [] [] | 10 + gpe-taskmanager | [] [] [] | 10 + gpe-timesheet | [] [] [] [] | 12 + gpe-today | [] [] [] [] [] | 13 + gpe-todo | [] [] [] [] | 12 + gphoto2 | [] [] [] | 11 + gprof | [] [] | 9 + gpsdrive | [] [] | 3 + gramadoir | [] | 5 + grep | [] [] [] [] | 26 + gretl | | 3 + gtick | | 7 + hello | [] [] [] [] [] | 34 + id-utils | [] [] | 12 + indent | [] [] [] [] | 21 + iso_3166 | [] [] [] [] [] [] [] | 27 + iso_3166_1 | [] [] [] | 16 + iso_3166_2 | | 0 + iso_3166_3 | | 2 + iso_4217 | [] [] [] [] [] [] | 24 + iso_639 | | 1 + jpilot | [] [] [] [] [] | 9 + jtag | [] | 2 + jwhois | () [] [] | 11 + kbd | [] [] | 11 + latrine | | 2 + ld | [] [] | 5 + libc | [] [] [] [] | 20 + libgpewidget | [] [] [] [] | 13 + libiconv | [] [] [] [] [] [] [] [] | 27 + lifelines | [] | 2 + lilypond | [] | 3 + lingoteach | | 2 + lingoteach_lessons | () | 0 + lynx | [] [] [] | 14 + m4 | [] [] | 15 + mailutils | | 5 + make | [] [] [] | 16 + man-db | [] | 5 + minicom | | 11 + mysecretdiary | [] [] | 10 + nano | [] [] [] [] | 17 + nano_1_0 | [] [] [] | 17 + opcodes | [] [] | 6 + parted | [] [] [] | 15 + ptx | [] [] | 22 + python | | 0 + radius | | 4 + recode | [] [] [] | 20 + rpm | [] [] | 9 + screem | [] [] | 2 + scrollkeeper | [] [] [] | 15 + sed | [] [] [] [] [] [] | 24 + sh-utils | [] [] | 14 + shared-mime-info | [] [] | 7 + sharutils | [] [] [] [] | 17 + silky | () | 3 + skencil | [] | 6 + sketch | [] | 6 + soundtracker | [] [] | 7 + sp | [] | 3 + tar | [] [] [] [] [] | 24 + texinfo | [] [] [] | 14 + textutils | [] [] [] [] | 16 + tin | | 1 + tp-robot | | 2 + tuxpaint | [] [] [] [] [] | 29 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] | 15 + vorbis-tools | | 8 + wastesedge | | 0 + wdiff | [] [] [] | 18 + wget | [] [] [] [] [] [] [] [] | 24 + xchat | [] [] [] [] [] | 15 + xfree86_xkb_xml | [] [] [] [] [] | 11 + xpad | | 5 + +-----------------------------------------------------+ + 63 teams sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu + 131 domains 47 19 28 83 0 0 59 13 1 1 11 0 22 22 0 1373 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If January 2004 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +Using `gettext' in new packages +=============================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e39faea --- /dev/null +++ b/AUTHORS @@ -0,0 +1,14 @@ +VisualBoy and VisualBoyAdvance original development: + +- Forgotten (see the Contact section in the README) + +Current maintainer: + +- Sébastien Guignot aka kxu + +Contributions: + +- Costis : object mosaic, GP32 +- KVA: ARM/THUMB disassembler +- kxu: GTK+ interface +- Yann Parmentier aka kohai: new icons diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..abe1017 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,74 @@ +2004-05-20 kxu + + * src/sdl/SDL.cpp (sdlPollEvents): added SDL_QUIT event support + +2004-05-15 kxu + + * finalized the first release of the GTK+ interface + +2004-05-03 kxu + + * src/elf.cpp (elfCleanUp): fix a missing nullify, causing crashes + +2004-05-01 kxu + + * added gtkmm 2.4 support + +2004-04-25 kxu + + * src/win32/skinButton.cpp: fix skin bugs (patch from Forgotten) + +2004-04-19 kxu + + * src/remote.cpp: added support for z2 (delete break on write) so that gdb can use break on write (patch from Ryan Brown) + +2004-04-18 kxu + + * fix custom controls to use CS_GLOBALCLASS style and fix the GB map view flickering (patch from Forgotten) + +2004-03-30 kxu + + * added the GTK+ interface draft + +2004-03-20 Forgotten + + * src/GBA.cpp: improved memory timing + +2004-03-11 Forgotten + + * src/win32/MainWndFile.cpp: changed import/export battery file to default to battery directory + +2004-03-10 Forgotten + + * src/win32/DirectSound.cpp (class DirectSound): make destructor virtual to avoid problems when deleting + * src/win32/Sound.h (class ISound ): make destructor virtual to avoid problems when changing sound quality + +2004-03-09 Forgotten + + * src/elf.cpp (elfCleanUp): fix corruption on ELF clean up + +2004-03-08 Forgotten + + * src/win32/MapView.cpp (enableButtons): fix radio button bug using keyboard + * src/win32/GBMapView.cpp (OnInitDialog): fix radio button bug using keyboard + * src/win32/MapView.cpp (GetClickAddress): fixes for rot. bgs + +2004-02-29 Forgotten + + * src/win32/skin.cpp (GetSkinData): allow for JPEG and PNG images to also be loaded + +2004-02-24 Forgotten + + * src/admame.cpp: sync code with Scale2x 2.0 + * src/Cheats.cpp (cheatsCheckKeys): improve CodeBreaker 0xDxxxxxxx code support + +2004-02-17 Forgotten + + * src/win32/skinButton.cpp (OnPaint): fix GDI problems with selected bitmap being deleted + * src/win32/ZoomControl.cpp (OnPaint): fix GDI problems with selected bitmap being deleted + * src/win32/PaletteViewControl.cpp (OnPaint): fix GDI problems with selected bitmap being deleted + * src/win32/MemoryViewer.cpp (OnPaint): fix GDI problems with selected bitmap being deleted + * src/win32/BitmapControl.cpp (OnDraw): fix GDI problems with selected bitmap being deleted + * src/win32/VBA.cpp (winSetLanguageOption): patch for searching for base language dll + * elf.cpp (elfRead): fix problem caused by previous memory leak fix + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..4a45a84 --- /dev/null +++ b/INSTALL @@ -0,0 +1,266 @@ +What is this? +------------- + +VisualBoyAdvance is a Nintendo (TM) Gameboy and GameboyAdvance emulator with +debugging capabilities. + +How to compile the source +------------------------- + +1. Unix +------- + +ATTENTION: if you extracted the code from CVS, see the README.CVS first or +your build may fail! + +The following software is needed in order to compile: + +- libpng: http://www.libpng.org/pub/png/libpng.html +- zlib: http://www.gzip.org/zlib/ +- libSDL: http://www.libsdl.org +- nasm (optional for x86 MMX support): http://nasm.sourceforge.net/ +- GCC 3.x: in order to compile VBA, you will GCC 3.x or greater because of + a really bad bug in GCC 2.95 where it allocates an immense amount of + memory in order to compile GBA.cpp. If you really want to test it with + GCC 2.95, try exporting CXXFLAGS=-g to avoid optimizations (or try + different levels of optimization like -O1 or -O0) + +Extra software needed to compile the GTK+ GUI: + +- gtkmm (>= 2.0): http://www.gtkmm.org/ +- libglademm (>= 2.1): http://www.gtkmm.org/ + +Unpack the sources from the tar.gz file, then run the configure script. +The following extra options may be used to configure the generated executables: + + --enable-c-core enable C core (default is no on x86 targets) + --enable-profiling enable profiling (default is yes) + --enable-dev enable development features (default is yes) + --with-mmx use MMX (default is yes on x86 targets) + +GUI selection options: + + --enable-sdl build the SDL interface (default is yes) + --enable-gtk build the GTK+ interface (default is no) + --enable-gtk=2.4 build the GTK+ interface with gtkmm 2.4 + +More options: + + --help display all options + +After configure completes, just issue the make command. If it all goes well, +you will have the emulator compiled in the src directory. Issuing the +make install command will install the executables into the /usr/local/bin +directory (subject to change). + +The emulator code should work in both big and little endian computers. + +See the section after the Windows one for more information on the configure +script. + +The binaries are called this way: +- the SDL interface: VisualBoyAdvance +- the GTK+ interface: gvba + +2. Windows +---------- + +Needed software: +- nasm: see above for URL. Install it in the default directory +- Microsoft Visual C++ 6.0 or greater: to compile + +The win32 directory contains Microsoft Visual Studio workspace files needed +to compile the project with Microsoft Visual C++ 6.0 or greater. + +The gba.dsp workspace compiles the full Windows version and gba_sdl.dsp +compiles the Windows SDL version. + +Solutions for Visual C++ .NET are also available: gba.sln and gba_sdl.sln + +The Windows version contains three possible configurations: +- Debug: full debugging of the emulator is possible +- Release: optimized version for GBA developers +- ReleaseNoDev: optimized version without development features + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6b94fb8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,13 @@ +AUTOMAKE_OPTIONS = gnu dist-zip + +CORE_SUBDIRS = m4 src win32 + +EXTRA_SUBDIRS = po + +SUBDIRS = $(CORE_SUBDIRS) @VBA_EXTRA@ + +DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS) + +EXTRA_DIST = config.rpath README-win.txt README.CVS VERSION + +ACLOCAL_AMFLAGS = -I m4 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..d2a7f22 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,559 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +AUTOMAKE_OPTIONS = gnu dist-zip + +CORE_SUBDIRS = m4 src win32 + +EXTRA_SUBDIRS = po + +SUBDIRS = $(CORE_SUBDIRS) @VBA_EXTRA@ + +DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS) + +EXTRA_DIST = config.rpath README-win.txt README.CVS VERSION + +ACLOCAL_AMFLAGS = -I m4 +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure \ + ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL Makefile.am NEWS \ + acinclude.m4 aclocal.m4 compile config.guess config.rpath \ + config.sub configure configure.in depcomp install-sh missing \ + mkinstalldirs +all: all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in acinclude.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/intdiv0.m4 m4/intmax.m4 m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longdouble.m4 m4/longlong.m4 m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/progtest.m4 m4/signed.m4 m4/size_max.m4 m4/stdint_h.m4 m4/uintmax_t.m4 m4/ulonglong.m4 m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/po + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-recursive ctags ctags-recursive dist \ + dist-all dist-gzip dist-zip distcheck distclean \ + distclean-generic distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ + ps-recursive tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..ed0c2ad --- /dev/null +++ b/NEWS @@ -0,0 +1,636 @@ +Version 1.7.2: +Core changes: +- fixed bugs on ELF clean up +- improved CodeBreaker 0xDxxxxxxx code support +- updated Scale2x filter to version 2.0 +- improved memory timing +- added support for z2 (delete break on write) so that gdb can use break on write + +Windows: +- added search for base language dll +- fixed GDI problems with selected bitmap being deleted +- added JPEG and PNG support for skins +- changed import/export battery file to default to battery directory +- fixed the translation bug with viewers +- fixed the GB map view flickering +- fixed skin bugs + +SDL versions: +- now it exits when closing the window + +Other: +- added a new interface using GTK+, which implements a first part of the Windows version + +Version 1.7.1: +Core changes: +- added SWI call (0xf9 in thumb mode) to exit emulator in SDL version +- avoid crash when loading an invalid ELF file +- avoid turning sound on if soundOffFlag is true +- disabled remove intros option +- fixed memory leak in ELF support code +- fixed memory corruption if loading a bigger file than the memory to hold it +- fixed some compile warnings in the profiling code +- merged some big endian fixes into the code +- update battery files more often (a bit after the save memory is last updated) + +Gameboy: +- fixed bug with window support introduced in version 1.7 +- fixed HALT bug when no matching bits for interrupt + +Windows: +- added cartridge save strings to bug report +- changed default button on disassembly views to Go instead of Close +- changed power management/screen saver disabling code again to avoid problems +- fixed compilation problems on VC 7 +- fixed multi-monitor support +- fixed bug loading memory dumps +- fixed crash onb map/oam/tile viewers +- fixed problem 320x240 mode open/save dialogs +- fixed bug where user selected Gameboy colors were reset and not stored +- fixed bug rendering the translator URL +- fixed memory leak in OpenGL code which caused nasty problems +- store throttle value between restarts of the emulator +- updated FAQ and URL links to the new site + +Version 1.7: +Core changes: +- added fixes to video filters done by Flea for Mac OS X +- added/fixed ArcTan/ArcTan2 emulation +- added sound volume .25 and.50 +- added hq2x/lq2x filters +- aded global cheat disable +- some code clean up +- fixed some CBA cheat support +- fixed ARM/Thumb instruction timing, including memory access +- fixed minor bugs in STMDx ARM instructions +- fixed ARM LDRx instructions when base equals dest + +Gameboy: +- added support for 8M roms +- (re)added support for 2-4 playes in SGB mode +- added sprite limit emulation (thanks Ricky of KiGB) +- cancel pending EI when imediately followed by DI +- implemented DI/HALT bug +- implemented STAT write bug during VBLANK or HBLANK when in GB mode +- implemented GDMA delay in GBC mode (thanks TM of GEST) +- fixed priority between OBJ and Window +- fixed some SGB border problems +- fixed window rendering problems in some cases +- fixed CGB initial background palette to white +- fixed initial save memory value to 0xFF instead of 0x00 (thanks TM of GEST) +- fixed LCD interrupts to only occur once per line +- fixed incorrect display when BG is off +- modified interrut delay to 6 clock ticks instead of 2 +- moved scanline update to beginning of HBLANK + + +Windows: +- added predefined Gameboy palettes (thanks Kojote) +- added GBA IO Viewer to view/modify GBA hardware registers +- added menu entry to load most recent save state +- added menu entry to save state into oldest slot +- added option to auto load the most recent save state upon loading +- added fullscreen max scale option +- chnaged the bug report option to be a little more friendly +- enhanced save state submenus to show date/time of when save was made +- enhanced logging window to capture data even if not being displayed +- fixed Direct3D/OpenGL "green" bug with Motion Blur Interframe Blending +- fixed Direct3D full screen with Gameboy roms +- fixed minor bugs when saving images in the different viewers +- fixed power management disabling: should avoid monitor turning off now +- improved cheat input to be more flexible and easy to enter +- migrated whole GUI code to MFC + +Version 1.6a: +Core changes: +- fixed bug introduced in previous fix to CpuFastSet/CpuSet +- fixed slowdown caused by attempt to speed up emulation + +Windows: +- fixed bug when selecting the same render type + +Version 1.6: +Core changes: +- added rewind support (initially disabled) +- added support for slowdown codes +- added emulation of sprite priority bug (thanks PokemonHacker) +- added simple emulation for BIOS call 0x2a +- added enhanced save type detection option (default) +- added DMA hack for an obscure case +- improved loading speed +- fixed sleep/stop state support +- fixed bug caused by rendering optimizations +- fixed crash while debugging startup routines +- fixed DMA emulation +- fixed priority between OBJ Window and regular windows +- fixed thumb disassembly bug +- fixed sound envelope bug when set to 0 to mute sound (thanks PokemonHacker) +- fixed CpuFastSet/CpuSet bugs (thanks PokemonHacker) +- fixed warning message when using AGBPrint +- fixed DMA timings + +Windows: +- added movie recording/playback (joypad movement recording) +- added support for automatic SGB border display +- added option to auto hide menu in full screen mode +- added rewind support +- added bug report menu to provide needed information for solving problems +- added FAQ optin to take to the VBA website FAQ +- menu toggle can now have a customizable accelerator instead of ESC +- fixed bug on GBA cheats showing the wrong enable state (checkbox was ok) +- fixed bug enabling/disabling BG layers (introduced in version 1.5.1) +- fixed export settings to also export viewers settings +- fixed bug saving keyboard settings in INI file +- fixed map viewer click address in some cases +- fixed map viewer rendering for 512x512 screens +- fixed tile viewer click address and tile number in 256 color mode +- allow customize to run in fullscreen mode (exception of 320x240 mode) + +SDL versions: +- added support to turn sound off and change channel enable +- added support for automatic SGB border display +- added rewind support (CTRL+B) +- fixed bug enabling/disabling BG layers (introduced in version 1.5.1) +- fixed typo on pause-when-inactive option which made it not recognized + +Version 1.5.1: + +Core changes: +- minor rendering optimization +- added support for AR codes (thanks parasytic and pokemonhacker) +- no longer allow L+R or U+D to be reported as pressed +- fixed RTC problem on last day of the month +- fixed bug with some cheat codes that caused an invalid ROM patch +- fixed sound mixing problem with DS ratio + +Windows: +- added skin button support +- added AVI sound support (thanks to phaeron) +- all accelerators can now be customized or removed +- fixed full screen problem in OpenGL mode +- fixed some problems with stretch to fit +- main skin region is now optional for pure rectangular skins + +SDL version: +- changed default separator on config file to a equal sign +- changed pause when inactive default to false to fix problems debugging + +Porting: +- added PowerPC assembly code (thanks Jeffrey Lim) + +Version 1.5a: + +Windows: +- fixed skin problems on Win 95/98/Me/2000 +- fixed right-click problem on Win 95/98/Me/2000 +- fixed problem when Gameboy Printer was enabled +- fixed problem on Flash size menu not showing correct setting + +Version 1.5: + +Core changes: +- added AGBPrint support (for developers only) +- added RTC support +- added scanlines filter +- added support for gzip files +- added support for compressed bios files (zip, gzip) +- fixes Flash 1M support + +Gameboy: +- added SGB2 support + +Windows: +- added Gameboy tools (Disassembly, Memory Viewer, Tile Viewer, OAM Viewer, + Map Viewer and Palette Viewer) +- added fullscreen mode confirmation for DirectDraw to avoid problems +- added GDI, Direct3D and OpenGL rendering options +- added skin support (see readme for information on creating skins) +- added support for per game configuration of some settings (see readme for + details) +- changed INI support to use emulator directory instead of Windows directory + +SDL version: +- added support for per game configuration of some settings (see readme for + details) + +Version 1.4: + +Core changes: +- added bilinear and bilinear plus filters +- added interframe blending support +- added support to show speed in fullscreen mode (transparent or opaque) +- added detailed speed display +- added autoframeskip support +- added support for ELF DW_FORM_strp (used by newer GCC versions) +- added support to enable/disable GB/GBC video layers +- fixed crash when loading a second ELF file +- fixed missing EMMS instruction in ADVANCEMAME Scale 2x MMX version +- fixed some timer settings problems (bad copy paste of code) + +Windows version: +- allows AMD CPUs to take advantage of MMX code +- added support to select video mode for fullscreen mode +- added fullscreen triple buffering support +- added support for multiple joypad configuration +- added support to store settings to INI +- added export settings from Registry to INI +- added throttle support (between 5% and 1000%) +- fixed problem displaying error messages in fullscreen mode +- fixed tile viewer to display all tiles in 256 mode +- fixed Visual Studio project files so that they work on other computers +- fixed problem with disable SFX not being read when program starts +- fixed (minimized) screen corruption problem when filter is active in + fullscreen mode and emulator is minimized + +Version 1.3.1: + +Core changes: +- fixed reversed Flash identification for 64k Flash + +Version 1.3: + +Core changes: +- added support for Flash 128K (thanks DesktopMan) +- added checks for out of memory condition +- added sound volume option +- fixed message when failed to write battery file (previously always saying + failure to open file NULL) +- fixed sound mixing ratios specified in 0x4000082 (thanks Damian) +- simulating memory behaviour when no cartridge present (32-bits still + incorrect) +Windows version: +- automatically apply IPS patch if it exists (configurable) +- added save/load support in the memory viewer +- added support for filters in 32-bit mode for all filters +- added AVI writing support (no sound yet) +- can now pause emulator before loading any file +- memory viewer now displays current edit address +- removed some test code introduced at version 1.1 that slows down the emulator +- exporting GSA snapshot defaults title to internal name +- fixed missing check marks on layers menu +- fixed bug showing maker code/name from some old games +SDL version: +- added support for long options +- added support for passing configuration file name +- added profiling support (GMON format - see README) +- added support for filters in 32-bit mode for all filters +- automatically apply IPS patch if it exists +- improved search for configuration file: current directory, user directory, + executable directory (in order) are searched +- fixed configuration problem with saveType and removeIntros +Porting: +- fixed big endian problems in SGB code +- fixed big endian problems with rotated sprites +- fixed big endian sound endianess + +Version 1.2: + +Core changes: +- added MidiKey2Freq bios call (thanks Chris Moeller) +- added AdvanceMAME Scale2x and Simple 2x filters +- added support for higher frameskip (up to 9) +- added C core for portability +- added big endian support +- added support for movement sensor (thanks Parasyte) +- added support for selecting save type available +- fixed another value for the bios protection +- fixed sound envelope reload bug (thanks jaymzj) +- fixed timer counter (not changing the value of the counter unless the timer + overflows or is restarted) +- fixed problem on big endian when setting IO memory reable positions +- fixed reset LCD after disabling forced blank +- speed up now uses frameskip 9 (6 FPS) +- improved message when BIOS function cannot be emulated +Windows changes: +- added freeze recent list option +- added 800x600 support +- support to export GamesharkAdvance save games +- fixed bug when changing directories in the Directories... dialog +SDL version: +- added emulation for motion sensor +- fixed crash when printing void * variables +- fixed crash when -b specified incorrectly +- fixed warning when reading configuration file about disableMMX if compiled + without MMX support +- fixed crash when trying open file that does not exist + +Version 1.1: + +Core changes: +- added DMA logging +- added GBA intro remover +- fixed an ARM bug for opcodes like OP Rd,Rb,Rm ROR Rs where Rs > 0 + and Rs % 32 == 0 +- fixed some minor inconsistencies on the THUMB core (no actual bug reported) +- fixed bug with windows and alpha-bleding the wrong layer +- fixed sound channel 3 volume +- fixed the EEPROM battery save bug +Windows changes: +- added reset buttons to the directories dialog +- added Logging console (for internal GBA logging and console output) +- enhanced Map Viewer with more information about map and clicked spot +- enhanced Tile Viewer with more information about tiles and clicked spot +- added speed up toggle +- fixed a bug configuring hotkeys for some menu options +- fixed a bug where the joypad configuration dialog had strange colors +- fixed a crash when opening the Disassemble window when emulating a GB program + +Version 1.0a: + +Core changes: +- corrected sound mixing to be more like in version 0.9.1 +Windows changes: +- fixed battery file load/save when directory not set +- fixed crashes when directories not set +- fixed crash when passing image from command line in same directory +- updated company list for rom information dialogs + +Version 1.0: + +Core changes: +- semi-transparent objects are now processed correctly when windows enabled +- battery files now written even after resetting +- 16-bit sound rendering +- fixed some LDM/STM instructions when running in user/system mode +- added missing LDM/STM instruction formats +- Div/DivARM BIOS calls work correctly when dividing by 0 +- added sound echo effect +- added sound low pass filter +- added reverse stereo support +Gameboy changes: +- can now edit palette for mono games +Windows changes: +- added option for not stretching viewing data +- added automatic update option for all viewers (every frame) +- added tile viewer +- added disassembler +- added accelerator editor: user can configure almost all menu items hotkeys +- added GDB support (will be improved in the next version) +- memory viewer can now edit memory +- fixed autofire for L/R buttons which was inverted +- fixed dialog keyboard navigation +- fixed bug in map viewer when viewing mode 2 map +- files should now be saved to the correct directory when directories not set +SDL changes: +- fixed autofire for L/R buttons (was not working before) +- added support for sound quality selection + +Version 0.9.1: + +Core changes: +- fixed BG2CNT corruption in some cases +- fixed rendering of sprites with invalid OBJ Mode +- fixed 32-bit access to some IO registers +- fixed some unknown messages when loading ELF files +- fixed small error when doing a 16-bit write to palette RAM +- fixed minor bug in CpuFastSet emulation +- fixed some crashes loading GCC 3.0.4 ELF files +- fixed minor problem with CPSR (to be consistent with documentation) +- added single frame stepping (pauses after drawing the next frame) +- BMP screen capture option +Windows changes: +- fixed add cheat dialog disabled buttons +- fixed bug with 32-bit cheats (Gameshark/Internal) +- multiple selection on cheat list dialogs now supported +- easier enable/disable of cheats +- cheat search dialog shows previous search results +- cheat lists now restore enabled/disabled status correctly +- added some new companies to information dialogs +- Map viewer +- Palette viewer +- Memory viewer +- Sprite viewer +SDL changes: +- added development logging option (bios usage, illegal read, illegal writes) +- call stack information (GCC 3+ (ARM mode only) or ARM SDT) + +Version 0.9a: + +Core changes: +- fixed rotation screen bug introduced in version 0.9 +- fixed some memory write corruption +Windows changes: +- fixed small bug in 320x240 mode +- fixed open dialog when in 640x480 mode + +Version 0.9: + +Core changes: +- support for enabling/disabling graphical layers +- correct sound channel 4 emulation +- support for multiboot files (.MB) +- support for ELF files +- fixed some memory leaks +- fixed LDM/STM instructions (missing formats and wrong behaviour - littleos now works) +- fixed PUSH/POP instructions +- fixed misaligned half word reads +- fixed invalid memory reads +- fixed IO memory readability and register writing +- fixed HuffUnComp missing last bytes bug +- fixed a small DMA bug +- fixed bug in rotation screens (hoffset demo works again) +Gameboy changes: +- correct sound channel 4 emulation +- fixed bug reading joypad when LCD is off +- fixed small bug in SGB code +- fixed bug in SGB Block command +Windows changes: +- can now save GB Printer output as well as print +- 320x240 mode support +- support for more joystick axes and HAT(POV) +- separate directory for GB roms +- option to use old sound synchronization code (to avoid crackle problem) +- fixed add internal code dialog bug when entering multiple codes +- fixed closing dialogs by clicking on X +- fixed handling of root directory for saving +SDL changes: +- GDB remote debugging support (see Readme of SDL version for details) +- YUV support (courtesy of Niels Wagenaar) +- improvements to embedded debugger (locals, break, print, symbols commands) +- console output support (Mappy style and a new one) +- partial ELF support in the internal debugger +- support for HAT buttons + +Version 0.8: + +Core changes: +- correctly initializing IO registers when running without BIOS(Gollum/Costis) +- support for GSA ROM patching codes and button codes +- support for CodeBreakerAdvance codes +- support for separate frameskip for GBA and GB roms +- reworked the cheat system internal (should improve speed a bit) +- added a small interrupt latency to avoid interrupt loop +- fixed 16-bit DMA transfers with decrement options +- fixed semi-transparent OBJ bug +- fixed Gameshark Advance snapshot import +- fixed crash when passing filename without a path on command line +- fixed ARM LDR/STR with ASR shifted register instructions +- fixed some disassembly bugs +- fixed sound mixing (reversed sound) +- fixed misaligned 16-bit reads +Gameboy changes: +- fixed sound mixing (reversed sound) +- fixed vertical scrolling bug (Kefren bars demo) +- fixed speed up bug changing sound quality during emulation +Windows changes: +- disable screen saver when emulating +- added option to pause the emulator when window not active +- added keyboard shortcut for recent files +- added support for more keyboard keys when configuring controls +- added sound recording to a wave file +- fixed Add code dialogs to allow multiple codes entered at once +- fixed DDraw clipping bug (should work when window partially offscreen) +SDL changes: +- added command line flag for frameskip +- added command line support for bios file +- fixed configuration file comments on control configuration + +Version 0.7.1: + +Core changes: +- sound scratch problem fixed +- sound mixing improved +- sound channel 3 new function added +- Gameshark code support fixed for some codes +- all cheat codes are validated for wrong characters +- 64k EEPROM support +- added BIOS calls protection for BIOS memory area +- fixed problem with stop mode and loading a save state +- fixed window behaviour on some undocumented cases (thanks mrquackers) +Windows version: +- added new filters to the menu +- maker name added to ROM information dialogs (thanks to /Fredrik) +- fixed start up x4 problem +- fixed GBA cheat search display problem when showing hex numbers +- added cheat search for GB roms +SDL version: +- fixed debugger disassembled line when on breakpoint +- fixed loading a state with a different sound quality (quality doesn't change) + +Version 0.7a: + +- fixed slowdown/graphic sync problem +- fixed x4 problem +- enabled experimental graphic filters: pixelate and motion blur + (need to use regedit to change filter to 5 or 6 respectively) +- added BIOS calls Stop, IntrWait and SoundBiasReset (missing from 0.7 changes) + +Version 0.7: + +Core GBA emulation: +- emulating GBA windows correctly when they wrap around the screen +- fixed some minor THUMB flag bugs +- fixed blended sprites priority bug +- fixed unimplemented ARM LDM opcode +- not applying SFX to semi-transparent sprites +- completed mode 5 emulation +- disable sfx now takes effect immediately +- screen capture sets the correct extension when name typed +- MOSAIC support in all video modes and sprites +- fixes to several of the reported black screen, hangs and missing opcode +- Gameshark code support +- import function for battery files, code files and game saves +- export function for battery files +Core GB emulation: +- fixed window priority bug (sprites on top of window) +- screen capture now being taken before status message is displayed +- import function for battery files, code files and game saves +- export function for battery files (no RTC saved in this case) +SDL versions: +- fixed some small disassembler bugs +- fixed keyboard shortcuts with modifier keys (Ctrl, Alt, Shift) +- added MMX support (default is off) +- configuration file now in DOS format for the Windows version +- added break on write support for IRAM and WRAM +Linux version specific: +- fixed some bad opcodes + +Version 0.6.0.1: + +- fixed bug with Japanese and Chinese translations +- fixed bug with 8-bit or 16-bit freeze cheat codes +- fixed a small VRAM bug + +Version 0.6: + +- fixed bug with images patched to save into FlashAdvance instead of EEprom +- fixed bug reporting register P1 +- fixed DMA loop bug and timing +- reworked the cheat engine for Gameboy (faster now) +- GB Pocket Printer support +- GB MBC7 support (motion sensor) +- added ROM information dialogs +- now centering dialog boxes +- automatically hiding of mouse in full screen +- Cheat list dialog improved with description for a code +- screen shot menu option +- reset recent list option +- option to disable status messages +- option to automatically save/load cheat list +- menu to save/load cheat list +- using new dialog controls under Windows XP +- language selectable from menu and easy translation + +Version 0.51: + +- fixed bugs introduced in version 0.5 (BIOS access) +- fixed small DMA problem +- fixed Gameboy frame skip bug (caused missing sprites) +- fixed bug in MBC 3 code (boy/girl problem in Pokemon Crystal) +- fixed crash loading more than 3 games without restart +- added MMX version of the graphic filters (exception of TV Mode) +- added status message to some actions (load/save state, reset, screen capture) +- tried to improve message when DirectX missing + +Version 0.5: + +- fixed bug accessing the BIOS (caused apparent hang in some cases) +- reverted the ARM to previous version (sound distortion fixed) +- fixed a bug in the 16-bit and 32-bit cheat search +- fixed a slowdown on GB emulation +- fixed screen capture to only take one shot while the button is pressed +- fixed problem of not saving battery file when using recent menu +- fixed problem starting from double-click on binary image (association) +- fixed missing GB filters when selecting files to open +- removed unimplemented opcode for SWP opcodes +- added auto-fire option for buttons A, B, L and R +- added full screen mode (640x480 only - 320x240 will be enabled later) +- added DirectDraw option for Emulation only (removes filtering problem) and + use video memory (may speed up some machines) +- added graphic filters: TV Mode, 2xSaI, Super 2xSaI and Super Eagle + (adapted from Snex9x code). Note: fast machine needed. +- full screen option to stretch to fit image +- added option to associate emulator with GB and GBA files +- added priority option to avoid problems on some machines +- added dialog with cheats in use +- added option to freeze memory location: infinite money, lives, etc... + +Version 0.4: + +- can now play Gameboy and GameboyAdvance games +- recent menu with 10 recent loaded roms +- save state slots (like Snes9x) +- fixed 24-bit screen capture +- fixed sprite corruption +- added 3 missing BIOS calls (DiffXbitUnfilter calls) +- fixed freeze loading VisualBoy 1.4.10 save game +- fixed reset problems on some CGB games +- fixed a timing issue that caused blinking sprites + +Version 0.3: + +- fixed window bug (vertical lines or missing column) +- fixed some sound mixing problems +- some speed improvements +- cheat search engine (based on Snes9x) +- battery saves are now supported +- save game loading fixed (crash or no sound problem are gone) +- disable special effects option (can speedup some machines) + +Version 0.21: + +- fix to 24-bit mode dark screen problem +- sound on left speaker problem fixed +- some ARM opcodes have been corrected (DarkFader's demos now work) +- rotation bug fix +- mode 3 backdrop color fix diff --git a/README b/README new file mode 100644 index 0000000..83362e2 --- /dev/null +++ b/README @@ -0,0 +1,479 @@ +Welcome to version 1.7.2 of VisualBoyAdvance [SDL]. +This is a GB/GBC/GBA emulator for Windows, Linux, MacOS X and BeOS. + +Features +-------- + +- configurable GB/GBA keys, including joystick support +- option to use BIOS file +- zip/gzip file support +- directory selection for save state, battery and screen capture +- fullscreen mode (selectable resolution) +- video sizes 1x, 2x, 3x and 4x +- graphic filters Normal, TV Mode, 2xSaI, Super 2xSaI and more +- interframe blending support +- same emulation core as VisualBoyAdvance: GB and GBA emulation +- built-in ARM/THUMB assembly debugger +- 10 save states accesible through keyboard +- automatic battery file load/save +- auto-fire support +- pause, reset through keyboard +- 16, 24 and 32 bit desktop support +- GDB remote debugging (see below for information) +- auto frameskipping and throttle +- AGBPrint support for development +- RTC support + +Compiling the sources +--------------------- + +See the INSTALL file for compiling instructions. Please note the following +requisites to compile: + +- GCC must be 3.x or greater in order to compile GBA.cpp with -O2. Earlier + versions have a problem during optimization that requires an absurd + ammount of memory and usually ends up crashing the compiler/computer +- On Windows, Microsoft Visual C++ 6 or later is needed. Please note that + some of the source code will not compile with the shipped header files. + You will need to install the most recent Platform SDK from Microsoft. + +Installing +---------- + +The easiest installation is to place all files in the distribution in the +same directory. + +Per game settings +----------------- + +Version 1.5 introduced the support for per game settings for GBA games. You +can defined the following settings on a per game basis by using an INI file +called vba-over.ini in the same directory as the emulator: + +rtcEnabled=<0 for false, anything else for true> +flashSize=<65536 or 131072> +saveType=<0 for automatic, 1 for EEPROM, 2 for SRAM, 3 for Flash or 4 for +EEPROM+Sensor> + +Use the 4 letter game code to separate settings for each game. Example: + +[ABCD] +rtcEnabled=0 +flashSize=65536 +saveType=0 + +[ABC2] +rtcEnabled=1 +flashSize=131072 +saveType=0 + +Support +------- + +Please support VisualBoyAdvance by making a donation. You can donate money +using PayPal (www.paypal.com). Use the contact form to find how you can +send donations. Also, it is recommended that you use the VisualBoyAdvance +forum on www.ngemu.com message board. + +FAQ +--- + +See online FAQ for more information: http://vba.ngemu.com/faq.shtml + +Please don't email about what you think it is problem before consulting +the FAQ. + +System requirements +------------------- + +Windows: PIII 500Mhz machine for GBA emulation. GB emulation requires far less. + +Linux, MacOS X, BeOS: + SDL (>= 1.2.2) runtime library must be installed prior to running the + program. You can download it from http://www.libsdl.org + +Key combinations during emulation +--------------------------------- + +- F1...F10: load save state 1...10 +- Shift+F1...F10: save state 1...10 +- Alt+1...4: auto-fire A,B,L,R +- Ctrl+1...8: enable/disable graphical layers (BG0, BG1, BG2, BG3, OBJ, WIN0, + WIN1, OBJWIN) +- Ctrl+N: pause on next frame +- Ctrl+R: reset +- Ctrl+P: pause +- Ctrl+B: rewind (if enabled and available) +- F11: enter built-in debugger +- ESC: exit emulator + +Emulation key settings +---------------------- + +- Movement: arrow keys +- Button A: Z +- Button B: X +- Button L: A +- Button R: S +- Button Start: ENTER +- Button Select: BACKSPACE +- Speed up: SPACE +- Screen capture: F12 +- Motion Left: NUMPAD 4 +- Motion Right: NUMPAD 6 +- Motion Up: NUMPAD 8 +- Motion Down: NUMPAD 2 + + +GDB support +----------- + +VisualBoyAdvance now provides GDB remote debugging support. This gives +developers the full power of GDB to debug GBA applications. + +In order to use this, you will need a cross-compiled GDB for either the arm-elf +or arm-thumb-elf target (used for the --target= option of GDB configure +script). + +You can also use GDB frontends like DDD, CodeMedic, etc... or even GDB/Insight +for GUI debugger (if using anything other than GDB/Insight, please make sure +to point to the right GDB executable). + +The emulator provides two transport protocols for remote debugging: + +- TCP: allows debugging through TCP using port 55555 (or any specified) port. + The advantage of using TCP is that it allows true remote debugging but it is + slower compared to the pipe method (pipe method does not work on Windows - + probably a restriction imposed by the CYGWIN port of GDB). +- PIPE: allows debugging through a PIPE between the emulator and GDB. This is a + lot faster than TCP and recommened on Unix systems. + +Using TCP transport +------------------- + +To use the TCP transport, use the flag -Gtcp[:portnum] where portnum is an +optional port number to be used instead of 55555. VBA will wait for a GDB +connection on the specified port (printed on screen). Start GDB by passing the +.elf file, then connect to the emulator by using the command: + +target remote : + +where hostname is the host where the emulator is running and port number is the +printed port number. + +Using PIPE transport +-------------------- + +To use the PIPE transport, start GDB with the .elf file to be debugged. Connect +to the emulator by using the command: + +target remote |/VisualBoyAdvance -Gpipe + +Debugging with GDB +------------------ + +Once you connected to the emulator, you can set breakpoints and debug the +application. But before doing that, you will need to issue the loda command on +GDB to load the code into the emulator. Optionally, you can pass the ELF file +on the emulator's command line (along with the -N option to not parse the debug +information in the emulator) instead of issuing the load command. + +After connecting and optionally loading the file into the debugger, you can +start debugging: add breakpoints, step, etc... + +While using GDB, any console output (see below) will show up in GDB's console. + +If you want to break into the GDB, press F11 and it will give you full command +in GDB again. Pressing ESC will terminate emulation. + +You can also detach GDB from the emulator. + + +Console Output +-------------- + +There are two forms of console output in this version: + +- Mappy style dprint: use the following code (from Mappy's documentation) + to get output: + +- VBA style: use the following code to get output: + // THUMB code + void print(char *s) + { + asm volatile("mov r0, %0;" + "swi 0xff;" + : // no ouput + : "r" (s) + : "r0"); + } + // ARM code + void print(char *s) + { + asm volatile("mov r0, %0;" + "swi 0xff0000;" + : // no ouput + : "r" (s) + : "r0"); + } + +When using GDB, the output will show up in GDB's console. When using the +built-in debugger, output will go to standard out. + +Built-in debugger enhancements +------------------------------ + +The built-in debugger has the following enhancements (need debug enabled ELF +file): +- ELF file support: both multiple and regular. Please report any messages or + problems reading ELF files. C++ classes and some miscellaneous features are + not supported yet. Also, method names may be mangled in C++ code. +- break command: add a breakpoint on a function, line number of file:line + number +- locals command: print the local variables on the current function +- print command: prints the value of a given expression. Valid expression + include *this, ptr->member, var.member, array[0], sizeof(expression), etc... +- symbols command: list information known about a symbol (or symbols that start + with the given name) +- radix command: sets the output radix to eithe decimal, octal or hex. +- file and line number when stopped: the debugger will show the file and line + number (if available) for the current address +- fixes to some breakpoint handling problems +- fixes to break on write function + +Profiling +--------- + +VisualBoyAdvance has profiling support. It produces output in the format +supported by GPROF. You need a cross-compiled binary of GPROF (binutils +GNU package) compiled with --target=arm-thumb-elf (or similar). + +The output will always contain the histogram of PC positions at the specified +frequency even if the code is not compiled with call graph support. + +In order to enable profiling, you need to add a call inside your code +to start it (download vba.s for a ready to use file for GCC): + +void monstartup(u32 lowPC, 32 highPC) + +This will start profiling for the given address region. If the code was also +compiled with -pg, call graphs will be recorded. + +Other calls for fine grain control: + +// control profiling +// 0 - stops profiling +// anyother value starts it +void moncontrol(int mode) + +// stop profiling and output gmon.out file +void moncleanup() + +// record call graph (used by GCC) +// r12 contains previous caller +// r14 contains function that was called +void mcount() + +GCC bugs +-------- + +All versions of GCC previous to the working version 3.3 have bugs when +generating profiling for thumb functions. + +The errors are: +- mov\tip,lr not a valid instruction (typo in gcc/config/arm/arm.h) +- LPxx undefined when linking (missing . before LP causes the problem) + +You can fix these problems by either recompiling GCC (recommended) or by +modifying cc1.exe to fix the problems. + +In the first option, find the given code in gcc/config/arm/arm.h and fix +the typos (remove the extra blackslash from the mov ip,lr instruction and +add the missing dot before LP%d) or change THUMB_FUNCTION_PROFILER to call +ARM_FUNCTION_PROFILER (the recent changes that were performed in CVS). + +If you don't want to compile your own GCC, then you can use an hex editor +to fix the problems. Locate cc1.exe under /lib/gcc-lib// +and find the mov\tip,lr instruction. Change the extra backslash to a space. +Locate the .LP string just before the mov instruction and change it to +.P instead (make sure to place 0 after the P). Then find the text .word +LP%d and change it to .word .P%d. + +Histograms will be output even if the code is not compiled with call graph +support. + +Options configuration +--------------------- + +All configurable options are accessible from the configuration file +VisualBoyAdvance.cfg. + +This file is searched in this order: + +- current directory +- user home directory (defined by HOME environment variable) +- user profile directory (Windows only defined by USERPROFILE directory) +- executable directory (either relative or defined by PATH variable) + +All options are documented in the file supplied with this distribution. + +Command line options (override settings in configuration file) +-------------------------------------------------------------- + + -1, --video-1x 1x + -2, --video-2x 2x + -3, --video-3x 3x + -4, --video-4x 4x + -F, --fullscreen Full screen + -G, --gdb=PROTOCOL GNU Remote Stub mode: + tcp - use TCP at port 55555 + tcp:PORT - use TCP at port PORT + pipe - use pipe transport + -N, --no-debug Don't parse debug information + -S, --flash-size=SIZE Set the Flash size + --flash-64k 0 - 64K Flash + --flash-128k 1 - 128K Flash + -T, --throttle=THROTTLE Set the desired throttle (5...1000) + -Y, --yuv=TYPE Use YUV overlay for drawing: + 0 - YV12 + 1 - UYVY + 2 - YVYU + 3 - YUY2 + 4 - IYUV + -b, --bios=BIOS Use given bios file + -c, --config=FILE Read the given configuration file + -d, --debug Enter debugger + -f, --filter=FILTER Select filter: + --filter-normal 0 - normal mode + --filter-tv-mode 1 - TV Mode + --filter-2xsai 2 - 2xSaI + --filter-super-2xsai 3 - Super 2xSaI + --filter-super-eagle 4 - Super Eagle + --filter-pixelate 5 - Pixelate + --filter-motion-blur 6 - Motion Blur + --filter-advmame 7 - AdvanceMAME Scale2x + --filter-simple2x 8 - Simple2x + --filter-bilinear 9 - Bilinear + --filter-bilinear+ 10 - Bilinear Plus + --filter-scanlines 11 - Scanlines + --filter-hq2x 12 - hq2x + --filter-lq2x 13 - lq2x + -h, --help Print this help + -i, --ips=PATCH Apply given IPS patch + -p, --profile=[HERTZ] Enable profiling + -s, --frameskip=FRAMESKIP Set frame skip (0...9) + -t, --save-type=TYPE Set the available save type + --save-auto 0 - Automatic (EEPROM, SRAM, FLASH) + --save-eeprom 1 - EEPROM + --save-sram 2 - SRAM + --save-flash 3 - FLASH + --save-sensor 4 - EEPROM+Sensor + --save-none 5 - NONE + -v, --verbose=VERBOSE Set verbose logging (trace.log) + 1 - SWI + 2 - Unaligned memory access + 4 - Illegal memory write + 8 - Illegal memory read + 16 - DMA 0 + 32 - DMA 1 + 64 - DMA 2 + 128 - DMA 3 + 256 - Undefined instruction + 512 - AGBPrint messages + +Long options only: + --agb-print Enable AGBPrint support + --auto-frameskip Enable auto frameskipping + --ifb-none No interframe blending + --ifb-motion-blur Interframe motion blur + --ifb-smart Smart interframe blending + --no-agb-print Disable AGBPrint support + --no-auto-frameskip Disable auto frameskipping + --no-ips Do not apply IPS patch + --no-mmx Disable MMX support + --no-pause-when-inactive Don't pause when inactive + --no-rtc Disable RTC support + --no-show-speed Don't show emulation speed + --no-throttle Disable thrrotle + --pause-when-inactive Pause when inactive + --rtc Enable RTC support + --show-speed-normal Show emulation speed + --show-speed-detailed Show detailed speed data + +Known bugs +---------- + +- loading a save state that uses a different sound quality may hang the + emulator. Please only use the 22Khz sound quality save states from the + Windows version with this release +- built-in debugger still has a few bugs +- disassembler contains a few errors. Please report anything wrong you find + +LICENSE +------- + + VisualBoyAdvance - a Gameboy and GameboyAdvance emulator + Copyright (C) 1999-2003 Forgotten + Copyright (C) 2004 Forgotten and the VBA development team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +This program also contains code developed by the University of +California and is subject to the extra conditions: + +Copyright (c) 1991, 1998 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. [rescinded 22 July 1999] +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +Contact +------- + +Please don't email unless you found some bug. Requests will be ignored and +deleted. Also, be descriptive when emailing. You have to tell me what version +of the emulator you are writing about and a good description of the problem. +Remember, there are several interfaces (Windows, SDL and GTK+) and +several systems (Windows, Linux, MacOS X and BeOS). + +Also, there are still people writing about the old VisualBoy which is no longer +supported. Also remember I am not paid to work on VisualBoyAdvance. This is +just a hobby. + +Forgotten (http://vba.ngemu.com/contact.shtml) +kxu + +http://vba.ngemu.com +http://sourceforge.net/projects/vba + +Special Thanks +-------------- + +PokemonHacker for all his help improving the emulator. +Costis for his help fixing some of the graphics bugs. +Snes9x developers for the great emulator and source code. +Kreed for his great graphic filters. +SDL team for this amazing library. +And all users who kindly reported problems. diff --git a/README-win.txt b/README-win.txt new file mode 100644 index 0000000..559edb8 --- /dev/null +++ b/README-win.txt @@ -0,0 +1,242 @@ +Welcome to VisualBoyAdvance version 1.7.2. + +Compiling the sources +--------------------- + +See the INSTALL file for compiling instructions. Please note the following +requisites to compile: + +- GCC must be 3.x or greater in order to compile GBA.cpp with -O2. Earlier + versions have a problem during optimization that requires an absurd + ammount of memory and usually ends up crashing the compiler/computer +- On Windows, Microsoft Visual C++ 6 or later is needed. Please note that + some of the source code will not compile with the shipped header files. + You will need to install the most recent Platform SDK from Microsoft. + +Support +------- + +Please support VisualBoyAdvance by making a donation. You can donate money +using PayPal (www.paypal.com). Use the contact form to find how you can +send donations. Also, it is recommended that you use the VisualBoyAdvance +forum on www.ngemu.com message board. + +Default keys (can be edited in the Options menu) +------------------------------------------------ + +Arrow keys - direction +Z - Button A +X - Button B +A - Button L +S - Button R +Enter - Start +Backspace - Select +Speedup - Space +Capture - F12 + +You can change the configuration above to use a joystick. Go to +Options->Joypad->Configure... menu. + +The 1 thorugh 4 joypads allow you to have different settings which can be +easily switched. + +System requirements +------------------- + +Fast computer (Pentium III 500 Mhz recommended) and Microsoft DirectX 7 or +greater. + +Translations +------------ + +Translations can be done as long as you have Microsoft Visual VC++ on +your computer. + +If you just want to use a translation, place the translation .DLL on +the same directory as the emulator. From the Options->Language menu, +select Other... and type the three letter (or two) language name from +.DLL. For example, VBA_PTB.DLL: type PTB on the dialog. + +These translation files are only for VisualBoyAdvance GUI and messages. +Games will not be translated and cannot be translated by the emulator. + +Skins +----- + +Skins consist of a bitmap (.bmp), a region file (.rgn), a draw rectangle +on the region and an INI file. + +Once you have the bitmap, you the region creator which can be found at +the downloads section of emulator website along with a sample skin. +This allows for irregular skins with holes or any shape. + +Create the INI file like this: +[skin] +image= +region= +draw= +buttons= (optional) + +Then, for each button with n starting a 0: + +[button-] +normal= +down= +over= (optional) +id= +region= (optional) + +The id member can be one of the values found under Tools->Customize to have an +action button. + +If the intended use for the button is to open a menu, it can be one of the +following values: + +MENUFILE - The File Menu +MENUOPTIONS - The Options Menu +MENUCHEAT - The Cheat Menu +MENUTOOLS - The Tools Menu +MENUHELP - The Help Menu + +If the intended use for the button is to provide a joypad button, then the +it can be one of the following values: + +A - A button +B - B button +SEL - SELECT button +START - START button +R - right +L - left +U - up +D - down +BR - RIGHT button (shoulder) +BL - LEFT button (shoulder) +SPEED - speed up button (emulator) +CAPTURE - screen capture (emulator) +GS - GS/AR button (cheating) +UR - up and right combination +UL - up and left combination +DR - down and right combination +DL - down and left combination + +Example: + +[skin] +image=gbc.bmp +regions=gbc.rgn +draw=20,20,144,160 + +Skins are only supported in DirectDraw and GDI modes and are also not supported +in fullscreen mode. + +To avoid scaling problems, please not the following: + +GBA screen size: 240x160 +GBC screen size without border: 160x144 +GBC screen size with border: 256x224 + +Not using multiples to these values will cause distortion on the image drawn +by the emulator. This is not a BUG on the emulator and rather a problem of +the skin size. + +Per game settings +----------------- + +Version 1.5 introduced the support for per game settings for GBA games. You +can defined the following settings on a per game basis by using an INI file +called vba-over.ini in the same directory as the emulator: + +rtcEnabled=<0 for false, anything else for true> +flashSize=<65536 or 131072> +saveType=<0 for automatic, 1 for EEPROM, 2 for SRAM, 3 for Flash or 4 for +EEPROM+Sensor> + +Use the 4 letter game code to separate settings for each game. Example: + +[ABCD] +rtcEnabled=0 +flashSize=65536 +saveType=0 + +[ABC2] +rtcEnabled=1 +flashSize=131072 +saveType=0 + +FAQ +--- + +See online FAQ for more information: http://vba.ngemu.com/faq.shtml + +Please don't email about what you think it is problem before consulting +the FAQ. + +Reporting a crash +----------------- + +If VisualBoyAdvance crashes, please do the following: + +1. Win 95/98/ME: start DrWatson (drwatson.exe) and reproduce the crash. +DrWatson will capture the crash information in a log file (.wlg) file that +needs to be sent to me. Please also open the .wlg file on your machine by +double-clicking and copy the details section into the email. Microsoft +made life harder when you migrate to WinXP (or NT or 2000) by not allowing +DrWatson to read its old file format. + +2. Win NT/2000/XP: make sure DrWatson is the default debugger by executing +drwtsn32.exe -i and then recreate the crash. DrWatson will generate a log file +that needs to be sent to me (usually in c:\Documents and Settings\All Users\ +Documents\DrWatson). Depending on your system configuration, you may be asked +if you want to generate a log file. If so, please click on yes. + +LICENSE +------- + + VisualBoyAdvance - a Gameboy and GameboyAdvance emulator + Copyright (C) 1999-2003 Forgotten + Copyright (C) 2004 Forgotten and the VBA development team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Special Thanks +-------------- + +PokemonHacker for all his help improving the emulator. +Costis for his help fixing some of the graphics bugs. +Snes9x developers for the great emulator and source code. +Gollum for some help and tips. +Kreed for his great graphic filters. +And all users who kindly reported problems. + +Contact +------- + +Please don't email unless you found some bug. Requests will be ignored and +deleted. Also, be descriptive when emailing. You have to tell me what version +of the emulator you are writing about and a good description of the problem. +Remember, there are several interfaces (Windows, SDL and GTK+) and +several systems (Windows, Linux, MacOS X and BeOS). + +Also, there are still people writing about the old VisualBoy which is no longer +supported. Also remember I am not paid to work on VisualBoyAdvance. + +This is just a hobby. + +Forgotten (http://vba.ngemu.com/contact.shtml) +kxu + +http://vba.ngemu.com +http://sourceforge.net/projects/vba diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..07c515e --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +VisualBoyAdvance 1.7.2 diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..b8da802 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,802 @@ +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN(AM_PATH_SDL, +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + AC_REQUIRE([AC_CANONICAL_TARGET]) + AC_PATH_PROG(SDL_CONFIG, sdl-config, no) + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) +# Configure paths for SMPEG +# Nicolas Vignal 11/19/2000 +# stolen from Sam Lantinga +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SMPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, +ACTION-IF-NOT-FOUND]]]) +dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS +dnl +AC_DEFUN(AM_PATH_SMPEG, +[dnl +dnl Get the cflags and libraries from the smpeg-config script +dnl +AC_ARG_WITH(smpeg-prefix,[ --with-smpeg-prefix=PFX Prefix where SMPEG is +installed (optional)], + smpeg_prefix="$withval", smpeg_prefix="") +AC_ARG_WITH(smpeg-exec-prefix,[ --with-smpeg-exec-prefix=PFX Exec prefix +where SMPEG is installed (optional)], + smpeg_exec_prefix="$withval", smpeg_exec_prefix="") +AC_ARG_ENABLE(smpegtest, [ --disable-smpegtest Do not try to compile +and run a test SMPEG program], + , enable_smpegtest=yes) + + if test x$smpeg_exec_prefix != x ; then + smpeg_args="$smpeg_args --exec-prefix=$smpeg_exec_prefix" + if test x${SMPEG_CONFIG+set} != xset ; then + SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg-config + fi + fi + if test x$smpeg_prefix != x ; then + smpeg_args="$smpeg_args --prefix=$smpeg_prefix" + if test x${SMPEG_CONFIG+set} != xset ; then + SMPEG_CONFIG=$smpeg_prefix/bin/smpeg-config + fi + fi + + AC_PATH_PROG(SMPEG_CONFIG, smpeg-config, no) + min_smpeg_version=ifelse([$1], ,0.2.7,$1) + AC_MSG_CHECKING(for SMPEG - version >= $min_smpeg_version) + no_smpeg="" + if test "$SMPEG_CONFIG" = "no" ; then + no_smpeg=yes + else + SMPEG_CFLAGS=`$SMPEG_CONFIG $smpegconf_args --cflags` + SMPEG_LIBS=`$SMPEG_CONFIG $smpegconf_args --libs` + + smpeg_major_version=`$SMPEG_CONFIG $smpeg_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + smpeg_minor_version=`$SMPEG_CONFIG $smpeg_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_smpegtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SMPEG is sufficiently new. (Also sanity +dnl checks the results of smpeg-config to some extent +dnl + rm -f conf.smpegtest + AC_TRY_RUN([ +#include +#include +#include +#include "smpeg.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.smpegtest"); + */ + { FILE *fp = fopen("conf.smpegtest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_smpeg_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_smpeg_version"); + exit(1); + } + + if (($smpeg_major_version > major) || + (($smpeg_major_version == major) && ($smpeg_minor_version > minor)) || + (($smpeg_major_version == major) && ($smpeg_minor_version == minor) +&& ($smpeg_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'smpeg-config --version' returned %d.%d.%d, but the +minimum version\n", $smpeg_major_version, $smpeg_minor_version, +$smpeg_micro_version); + printf("*** of SMPEG required is %d.%d.%d. If smpeg-config is +correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If smpeg-config was wrong, set the environment variable +SMPEG_CONFIG\n"); + printf("*** to point to the correct copy of smpeg-config, and remove +the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_smpeg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_smpeg" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SMPEG_CONFIG" = "no" ; then + echo "*** The smpeg-config script installed by SMPEG could not be +found" + echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is +in" + echo "*** your path, or set the SMPEG_CONFIG environment variable to +the" + echo "*** full path to smpeg-config." + else + if test -f conf.smpegtest ; then + : + else + echo "*** Could not run SMPEG test program, checking why..." + CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "smpeg.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This +usually means" + echo "*** that the run-time linker is not finding SMPEG or +finding the wrong" + echo "*** version of SMPEG. If it is not finding SMPEG, you'll +need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit +/etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run +ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to +remove it, although" + echo "*** you may also be able to get things to work by modifying +LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the +file config.log for the" + echo "*** exact error that occured. This usually means SMPEG was +incorrectly installed" + echo "*** or that you have moved SMPEG since it was installed. In +the latter case, you" + echo "*** may want to edit the smpeg-config script: +$SMPEG_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SMPEG_CFLAGS="" + SMPEG_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SMPEG_CFLAGS) + AC_SUBST(SMPEG_LIBS) + rm -f conf.smpegtest +]) +## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- +## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..f8bdf88 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,4337 @@ +# generated automatically by aclocal 1.7.9 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN(AM_PATH_SDL, +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + AC_REQUIRE([AC_CANONICAL_TARGET]) + AC_PATH_PROG(SDL_CONFIG, sdl-config, no) + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) +# Configure paths for SMPEG +# Nicolas Vignal 11/19/2000 +# stolen from Sam Lantinga +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SMPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, +ACTION-IF-NOT-FOUND]]]) +dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS +dnl +AC_DEFUN(AM_PATH_SMPEG, +[dnl +dnl Get the cflags and libraries from the smpeg-config script +dnl +AC_ARG_WITH(smpeg-prefix,[ --with-smpeg-prefix=PFX Prefix where SMPEG is +installed (optional)], + smpeg_prefix="$withval", smpeg_prefix="") +AC_ARG_WITH(smpeg-exec-prefix,[ --with-smpeg-exec-prefix=PFX Exec prefix +where SMPEG is installed (optional)], + smpeg_exec_prefix="$withval", smpeg_exec_prefix="") +AC_ARG_ENABLE(smpegtest, [ --disable-smpegtest Do not try to compile +and run a test SMPEG program], + , enable_smpegtest=yes) + + if test x$smpeg_exec_prefix != x ; then + smpeg_args="$smpeg_args --exec-prefix=$smpeg_exec_prefix" + if test x${SMPEG_CONFIG+set} != xset ; then + SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg-config + fi + fi + if test x$smpeg_prefix != x ; then + smpeg_args="$smpeg_args --prefix=$smpeg_prefix" + if test x${SMPEG_CONFIG+set} != xset ; then + SMPEG_CONFIG=$smpeg_prefix/bin/smpeg-config + fi + fi + + AC_PATH_PROG(SMPEG_CONFIG, smpeg-config, no) + min_smpeg_version=ifelse([$1], ,0.2.7,$1) + AC_MSG_CHECKING(for SMPEG - version >= $min_smpeg_version) + no_smpeg="" + if test "$SMPEG_CONFIG" = "no" ; then + no_smpeg=yes + else + SMPEG_CFLAGS=`$SMPEG_CONFIG $smpegconf_args --cflags` + SMPEG_LIBS=`$SMPEG_CONFIG $smpegconf_args --libs` + + smpeg_major_version=`$SMPEG_CONFIG $smpeg_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + smpeg_minor_version=`$SMPEG_CONFIG $smpeg_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_smpegtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SMPEG is sufficiently new. (Also sanity +dnl checks the results of smpeg-config to some extent +dnl + rm -f conf.smpegtest + AC_TRY_RUN([ +#include +#include +#include +#include "smpeg.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.smpegtest"); + */ + { FILE *fp = fopen("conf.smpegtest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_smpeg_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_smpeg_version"); + exit(1); + } + + if (($smpeg_major_version > major) || + (($smpeg_major_version == major) && ($smpeg_minor_version > minor)) || + (($smpeg_major_version == major) && ($smpeg_minor_version == minor) +&& ($smpeg_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'smpeg-config --version' returned %d.%d.%d, but the +minimum version\n", $smpeg_major_version, $smpeg_minor_version, +$smpeg_micro_version); + printf("*** of SMPEG required is %d.%d.%d. If smpeg-config is +correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If smpeg-config was wrong, set the environment variable +SMPEG_CONFIG\n"); + printf("*** to point to the correct copy of smpeg-config, and remove +the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_smpeg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_smpeg" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SMPEG_CONFIG" = "no" ; then + echo "*** The smpeg-config script installed by SMPEG could not be +found" + echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is +in" + echo "*** your path, or set the SMPEG_CONFIG environment variable to +the" + echo "*** full path to smpeg-config." + else + if test -f conf.smpegtest ; then + : + else + echo "*** Could not run SMPEG test program, checking why..." + CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "smpeg.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This +usually means" + echo "*** that the run-time linker is not finding SMPEG or +finding the wrong" + echo "*** version of SMPEG. If it is not finding SMPEG, you'll +need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit +/etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run +ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to +remove it, although" + echo "*** you may also be able to get things to work by modifying +LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the +file config.log for the" + echo "*** exact error that occured. This usually means SMPEG was +incorrectly installed" + echo "*** or that you have moved SMPEG since it was installed. In +the latter case, you" + echo "*** may want to edit the smpeg-config script: +$SMPEG_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SMPEG_CFLAGS="" + SMPEG_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SMPEG_CFLAGS) + AC_SUBST(SMPEG_LIBS) + rm -f conf.smpegtest +]) + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 10 + +AC_PREREQ([2.54]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.7.9])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# serial 5 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + + +# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +AC_PREREQ(2.50) + +# AM_PROG_LEX +# ----------- +# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a +# "missing" invocation, for better error output. +AC_DEFUN([AM_PROG_LEX], +[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl +AC_REQUIRE([AC_PROG_LEX])dnl +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi]) + +# gettext.m4 serial 28 (gettext-0.13) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Set USE_NLS. + AM_NLS + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + dnl Add a version number to the cache macros. + define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([bh_C_SIGNED])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl + AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl + AC_REQUIRE([gt_TYPE_WCHAR_T])dnl + AC_REQUIRE([gt_TYPE_WINT_T])dnl + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_REQUIRE([gt_TYPE_INTMAX_T]) + AC_REQUIRE([gt_PRINTF_POSIX]) + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + AC_REQUIRE([gt_INTDIV0])dnl + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl + AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl + AC_REQUIRE([gt_INTTYPES_PRI])dnl + AC_REQUIRE([gl_XSIZE])dnl + + AC_CHECK_TYPE([ptrdiff_t], , + [AC_DEFINE([ptrdiff_t], [long], + [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) + ]) + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ +mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ +strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ +__fsetlocking]) + + dnl Use the _snprintf function only if it is declared (because on NetBSD it + dnl is defined as a weak alias of snprintf; we prefer to use the latter). + gt_CHECK_DECL(_snprintf, [#include ]) + gt_CHECK_DECL(_snwprintf, [#include ]) + + dnl Use the *_unlocked functions only if they are declared. + dnl (because some of them were defined without being declared in Solaris + dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built + dnl on Solaris 2.5.1 to run on Solaris 2.6). + dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. + gt_CHECK_DECL(feof_unlocked, [#include ]) + gt_CHECK_DECL(fgets_unlocked, [#include ]) + gt_CHECK_DECL(getc_unlocked, [#include ]) + + case $gt_cv_func_printf_posix in + *yes) HAVE_POSIX_PRINTF=1 ;; + *) HAVE_POSIX_PRINTF=0 ;; + esac + AC_SUBST([HAVE_POSIX_PRINTF]) + if test "$ac_cv_func_asprintf" = yes; then + HAVE_ASPRINTF=1 + else + HAVE_ASPRINTF=0 + fi + AC_SUBST([HAVE_ASPRINTF]) + if test "$ac_cv_func_snprintf" = yes; then + HAVE_SNPRINTF=1 + else + HAVE_SNPRINTF=0 + fi + AC_SUBST([HAVE_SNPRINTF]) + if test "$ac_cv_func_wprintf" = yes; then + HAVE_WPRINTF=1 + else + HAVE_WPRINTF=0 + fi + AC_SUBST([HAVE_WPRINTF]) + + AM_ICONV + AM_LANGINFO_CODESET + if test $ac_cv_header_locale_h = yes; then + AM_LC_MESSAGES + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +dnl gt_CHECK_DECL(FUNC, INCLUDES) +dnl Check whether a function is declared. +AC_DEFUN([gt_CHECK_DECL], +[ + AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, + [AC_TRY_COMPILE([$2], [ +#ifndef $1 + char *p = (char *) $1; +#endif +], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) + if test $ac_cv_have_decl_$1 = yes; then + gt_value=1 + else + gt_value=0 + fi + AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], + [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + +# po.m4 serial 3 (gettext-0.14) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AM_NLS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) + +AC_DEFUN([AM_MKINSTALLDIRS], +[ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate it. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) + +# progtest.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1996. + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# lib-prefix.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +# lib-link.m4 serial 4 (gettext-0.12) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +# lib-ld.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) + +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) + +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + +# signed.m4 serial 1 (gettext-0.10.40) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([bh_C_SIGNED], +[ + AC_CACHE_CHECK([for signed], bh_cv_c_signed, + [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) + if test $bh_cv_c_signed = no; then + AC_DEFINE(signed, , + [Define to empty if the C compiler doesn't support this keyword.]) + fi +]) + +# longlong.m4 serial 4 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_LONG_LONG if 'long long' works. + +AC_DEFUN([jm_AC_TYPE_LONG_LONG], +[ + AC_CACHE_CHECK([for long long], ac_cv_type_long_long, + [AC_TRY_LINK([long long ll = 1LL; int i = 63;], + [long long llmax = (long long) -1; + return ll << i | ll >> i | llmax / ll | llmax % ll;], + ac_cv_type_long_long=yes, + ac_cv_type_long_long=no)]) + if test $ac_cv_type_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, + [Define if you have the 'long long' type.]) + fi +]) + +# longdouble.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the compiler supports the 'long double' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_LONGDOUBLE], +[ + AC_CACHE_CHECK([for long double], gt_cv_c_long_double, + [if test "$GCC" = yes; then + gt_cv_c_long_double=yes + else + AC_TRY_COMPILE([ + /* The Stardent Vistra knows sizeof(long double), but does not support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + int array [2*(sizeof(long double) >= sizeof(double)) - 1]; + ], , + gt_cv_c_long_double=yes, gt_cv_c_long_double=no) + fi]) + if test $gt_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) + fi +]) + +# wchar_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wchar_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WCHAR_T], +[ + AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, + [AC_TRY_COMPILE([#include + wchar_t foo = (wchar_t)'\0';], , + gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) + if test $gt_cv_c_wchar_t = yes; then + AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) + fi +]) + +# wint_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + [AC_TRY_COMPILE([#include + wint_t foo = (wchar_t)'\0';], , + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + fi +]) + +# inttypes_h.m4 serial 5 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) + +# stdint_h.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) + +# intmax.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the system has the 'intmax_t' type, but don't attempt to +dnl find a replacement if it is lacking. + +AC_DEFUN([gt_TYPE_INTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, + [AC_TRY_COMPILE([ +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif +], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) + if test $gt_cv_c_intmax_t = yes; then + AC_DEFINE(HAVE_INTMAX_T, 1, + [Define if you have the 'intmax_t' type in or .]) + fi +]) + +# printf-posix.m4 serial 2 (gettext-0.13.1) +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the printf() function supports POSIX/XSI format strings with +dnl positions. + +AC_DEFUN([gt_PRINTF_POSIX], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], + gt_cv_func_printf_posix, + [ + AC_TRY_RUN([ +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, + [ + AC_EGREP_CPP(notposix, [ +#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ + notposix +#endif + ], gt_cv_func_printf_posix="guessing no", + gt_cv_func_printf_posix="guessing yes") + ]) + ]) + case $gt_cv_func_printf_posix in + *yes) + AC_DEFINE(HAVE_POSIX_PRINTF, 1, + [Define if your printf() function supports format strings with positions.]) + ;; + esac +]) + +# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) + +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gt_INTDIV0], +[ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ +#include +#include + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) + +# uintmax_t.m4 serial 7 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to 'unsigned long' or 'unsigned long long' +# if it is not already defined in or . + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if and don't define.]) + else + AC_DEFINE(HAVE_UINTMAX_T, 1, + [Define if you have the 'uintmax_t' type in or .]) + fi +]) + +# ulonglong.m4 serial 3 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the 'unsigned long long' type.]) + fi +]) + +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists and doesn't clash with +# . + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include +#include ], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if exists and doesn't clash with .]) + fi +]) + +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if exists and defines unusable PRI* macros.]) + fi +]) + +# xsize.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +AC_DEFUN([gl_XSIZE], +[ + dnl Prerequisites of lib/xsize.h. + AC_REQUIRE([gl_SIZE_MAX]) + AC_CHECK_HEADERS(stdint.h) +]) + +# size_max.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gl_SIZE_MAX], +[ + AC_CHECK_HEADERS(stdint.h) + dnl First test whether the system already has SIZE_MAX. + AC_MSG_CHECKING([for SIZE_MAX]) + result= + AC_EGREP_CPP([Found it], [ +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif +], result=yes) + if test -z "$result"; then + dnl Define it ourselves. Here we assume that the type 'size_t' is not wider + dnl than the type 'unsigned long'. + dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', + dnl which is guaranteed to work from LONG_MIN to LONG_MAX. + _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, + [#include ], result=?) + _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, + [#include ], result=?) + _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, + [#include ], result=?) + if test "$fits_in_uint" = 1; then + dnl Even though SIZE_MAX fits in an unsigned int, it must be of type + dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. + AC_TRY_COMPILE([#include + extern size_t foo; + extern unsigned long foo; + ], [], fits_in_uint=0) + fi + if test -z "$result"; then + if test "$fits_in_uint" = 1; then + result="$res_hi$res_lo"U + else + result="$res_hi$res_lo"UL + fi + else + dnl Shouldn't happen, but who knows... + result='~(size_t)0' + fi + fi + AC_MSG_RESULT([$result]) + if test "$result" != yes; then + AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], + [Define as the maximum value of type 'size_t', if the system doesn't define it.]) + fi +]) + +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) + +# lcmessage.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995. + +# Check whether LC_MESSAGES is available in . + +AC_DEFUN([AM_LC_MESSAGES], +[ + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + diff --git a/compile b/compile new file mode 100644 index 0000000..ac07cc5 --- /dev/null +++ b/compile @@ -0,0 +1,107 @@ +#! /bin/sh + +# Wrapper for compilers which do not understand `-c -o'. + +# Copyright 1999, 2000 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# compile PROGRAM [ARGS]... +# `-o FOO.o' is removed from the args passed to the actual compile. + +# Usage statement added by Billy Biggs . +if [ -z $1 ]; then + echo "Wrapper for compilers which do not understand '-c -o'." + echo "usage: compile PROGRAM [ARGS]..." + echo "'-o FOO.o' is removed from the args passed to the actual compile." + exit 1 +fi + +prog=$1 +shift + +ofile= +cfile= +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args +fi + +# Name of file we expect compiler to create. +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir $lockdir; exit 1" 1 2 15 + +# Run the compile. +"$prog" $args +status=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +fi + +rmdir $lockdir +exit $status diff --git a/config.guess b/config.guess new file mode 100644 index 0000000..6012b39 --- /dev/null +++ b/config.guess @@ -0,0 +1,1298 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-07-12' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + eval $set_cc_for_build + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev67 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +eval $set_cc_for_build +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.rpath b/config.rpath new file mode 100644 index 0000000..4db13e5 --- /dev/null +++ b/config.rpath @@ -0,0 +1,548 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2003 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux*) + case $CC in + icc|ecc) + wl='-Wl,' + ;; + ccc) + wl='-Wl,' + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + sco3.2v5*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = yes; then + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + hardcode_direct=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10* | hpux11*) + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + sco3.2v5*) + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4.2uw2*) + hardcode_direct=yes + hardcode_minus_L=no + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + ;; + sysv5*) + hardcode_libdir_flag_spec= + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +libname_spec='lib$name' +case "$host_os" in + aix3*) + ;; + aix4* | aix5*) + ;; + amigaos*) + ;; + beos*) + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + ;; + darwin* | rhapsody*) + shrext=.dylib + ;; + dgux*) + ;; + freebsd1*) + ;; + freebsd*) + ;; + gnu*) + ;; + hpux9* | hpux10* | hpux11*) + case "$host_cpu" in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux*) + ;; + netbsd*) + ;; + newsos6) + ;; + nto-qnx) + ;; + openbsd*) + ;; + os2*) + libname_spec='$name' + shrext=.dll + ;; + osf3* | osf4* | osf5*) + ;; + sco3.2v5*) + ;; + solaris*) + ;; + sunos4*) + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + ;; + sysv4*MP*) + ;; + uts4*) + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ + | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500 | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ + | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ + | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100644 index 0000000..cdd07e1 --- /dev/null +++ b/configure @@ -0,0 +1,9306 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="src/armdis.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE YACC LEX LEXLIB LEX_OUTPUT_ROOT CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE RANLIB ac_ct_RANLIB NASM CPP EGREP SDL_CONFIG SDL_CFLAGS SDL_LIBS MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB GETTEXT_PACKAGE PKG_CONFIG GTKMM_CFLAGS GTKMM_LIBS GTKMM_CPPFLAGS VBA_EXTRA VBA_SRC_EXTRA VBA_LIBS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-c-core enable C core (default is no on x86 targets) + --enable-profiling enable profiling (default is yes) + --enable-sdl build the SDL interface (default is yes) + --enable-gtk=[VERSION] build the GTK+ interface (default is no) + --enable-dev enable development features (default is yes) + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --disable-sdltest Do not try to compile and run a test SDL program + --disable-nls do not use Native Language Support + --disable-rpath do not hardcode runtime library paths + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-mmx use MMX (default is yes on x86 targets) + --with-x use the X Window System + --with-sdl-prefix=PFX Prefix where SDL is installed (optional) + --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +case "$target" in + i?86-*-*) + VBA_USE_C_CORE=no + VBA_USE_MMX=yes + ;; + *) + VBA_USE_C_CORE=yes + VBA_USE_MMX=no + ;; +esac + +am__api_version="1.7" +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=VisualBoyAdvance + VERSION=1.7.2 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +# Check whether --enable-c-core or --disable-c-core was given. +if test "${enable_c_core+set}" = set; then + enableval="$enable_c_core" + +else + enable_c_core=$VBA_USE_C_CORE +fi; + +# Check whether --enable-profiling or --disable-profiling was given. +if test "${enable_profiling+set}" = set; then + enableval="$enable_profiling" + +else + enable_profiling=yes +fi; + + +# Check whether --with-mmx or --without-mmx was given. +if test "${with_mmx+set}" = set; then + withval="$with_mmx" + +else + with_mmx=$VBA_USE_MMX +fi; + +# Check whether --enable-sdl or --disable-sdl was given. +if test "${enable_sdl+set}" = set; then + enableval="$enable_sdl" + +else + enable_sdl=yes +fi; + +# Check whether --enable-gtk or --disable-gtk was given. +if test "${enable_gtk+set}" = set; then + enableval="$enable_gtk" + +if test "x$enable_gtk" != xno; then + enable_gtk=yes + if test "x$enableval" = xyes; then + gtk_version=2.0 + else + gtk_version=$enableval + fi +fi + +else + +enable_gtk=no + +fi; + +# Check whether --enable-dev or --disable-dev was given. +if test "${enable_dev+set}" = set; then + enableval="$enable_dev" + +else + enable_dev=yes +fi; + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + echo "$as_me:$LINENO: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + + +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + echo "$as_me:$LINENO: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test -z "$LEXLIB" +then + echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 +echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 +if test "${ac_cv_lib_fl_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fl_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fl_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 +if test $ac_cv_lib_fl_yywrap = yes; then + LEXLIB="-lfl" +else + echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 +echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 +if test "${ac_cv_lib_l_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_l_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_l_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 +if test $ac_cv_lib_l_yywrap = yes; then + LEXLIB="-ll" +fi + +fi + +fi + +if test "x$LEX" != "x:"; then + echo "$as_me:$LINENO: checking lex output file root" >&5 +echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_root+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +cat >conftest.l <<_ACEOF +%% +%% +_ACEOF +{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 + (eval $LEX conftest.l) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 +rm -f conftest.l +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS=$LIBS +LIBS="$LIBS $LEXLIB" +cat >conftest.$ac_ext <<_ACEOF +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_lex_yytext_pointer=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYTEXT_POINTER 1 +_ACEOF + +fi + +fi +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Extract the first word of "nasm", so it can be a program name with args. +set dummy nasm; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_NASM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $NASM in + [\\/]* | ?:[\\/]*) + ac_cv_path_NASM="$NASM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_NASM="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +NASM=$ac_cv_path_NASM + +if test -n "$NASM"; then + echo "$as_me:$LINENO: result: $NASM" >&5 +echo "${ECHO_T}$NASM" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 +echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_gzopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gzopen (); +int +main () +{ +gzopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_gzopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_z_gzopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6 +if test $ac_cv_lib_z_gzopen = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +else + { { echo "$as_me:$LINENO: error: *** Cannot compile without zlib." >&5 +echo "$as_me: error: *** Cannot compile without zlib." >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking for png_create_write_struct in -lpng" >&5 +echo $ECHO_N "checking for png_create_write_struct in -lpng... $ECHO_C" >&6 +if test "${ac_cv_lib_png_png_create_write_struct+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpng -lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char png_create_write_struct (); +int +main () +{ +png_create_write_struct (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_png_png_create_write_struct=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_png_png_create_write_struct=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_create_write_struct" >&5 +echo "${ECHO_T}$ac_cv_lib_png_png_create_write_struct" >&6 +if test $ac_cv_lib_png_png_create_write_struct = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPNG 1 +_ACEOF + + LIBS="-lpng $LIBS" + +else + { { echo "$as_me:$LINENO: error: *** Cannot compile without libpng." >&5 +echo "$as_me: error: *** Cannot compile without libpng." >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking for pthread_yield in -lpthread" >&5 +echo $ECHO_N "checking for pthread_yield in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_yield+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_yield (); +int +main () +{ +pthread_yield (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_yield=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_yield=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_yield" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_yield" >&6 +if test $ac_cv_lib_pthread_pthread_yield = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for X" >&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 + + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + +fi; +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'_ACEOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +_ACEOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/libXt.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$as_me:$LINENO: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 +fi + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + +for ac_header in malloc.h strings.h unistd.h arpa/inet.h netinet/in.h zutil.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +struct tm *tp; tp->tm_sec; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_tm=time.h +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_struct_tm=sys/time.h +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\_ACEOF +#define TM_IN_SYS_TIME 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +socklen_t x; + +int +main () +{ + + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +int accept (int, struct sockaddr *, size_t *); + +int +main () +{ + + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +echo "$as_me:$LINENO: result: size_t" >&5 +echo "${ECHO_T}size_t" >&6 +cat >>confdefs.h <<\_ACEOF +#define socklen_t size_t +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +echo "$as_me:$LINENO: result: int" >&5 +echo "${ECHO_T}int" >&6 +cat >>confdefs.h <<\_ACEOF +#define socklen_t int +_ACEOF + + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +VBA_LIBS="../gb/libgb.a" + +if test "x$enable_c_core" = xyes; then + CXXFLAGS="$CXXFLAGS -DC_CORE" +fi + +if test "x$enable_profiling" = xyes; then + CXXFLAGS="$CXXFLAGS -DPROFILING" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA prof" + VBA_LIBS="$VBA_LIBS ../prof/libprof.a" +fi + +if test "x$with_mmx" = xyes; then + if test "x$NASM" = x; then + { { echo "$as_me:$LINENO: error: *** Couldn't find nasm program." >&5 +echo "$as_me: error: *** Couldn't find nasm program." >&2;} + { (exit 1); exit 1; }; } + fi + CXXFLAGS="$CXXFLAGS -DMMX" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA i386" + VBA_LIBS="$VBA_LIBS ../i386/lib386.a" +fi + +if test "x$enable_sdl" = xyes || test "x$enable_gtk" = xyes; then + SDL_VERSION=1.2.2 + +# Check whether --with-sdl-prefix or --without-sdl-prefix was given. +if test "${with_sdl_prefix+set}" = set; then + withval="$with_sdl_prefix" + sdl_prefix="$withval" +else + sdl_prefix="" +fi; + +# Check whether --with-sdl-exec-prefix or --without-sdl-exec-prefix was given. +if test "${with_sdl_exec_prefix+set}" = set; then + withval="$with_sdl_exec_prefix" + sdl_exec_prefix="$withval" +else + sdl_exec_prefix="" +fi; +# Check whether --enable-sdltest or --disable-sdltest was given. +if test "${enable_sdltest+set}" = set; then + enableval="$enable_sdltest" + +else + enable_sdltest=yes +fi; + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + + # Extract the first word of "sdl-config", so it can be a program name with args. +set dummy sdl-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_SDL_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SDL_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" + ;; +esac +fi +SDL_CONFIG=$ac_cv_path_SDL_CONFIG + +if test -n "$SDL_CONFIG"; then + echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 +echo "${ECHO_T}$SDL_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_sdl_version=$SDL_VERSION + echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 +echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6 + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + rm -f conf.sdltest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_sdl=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main + +int +main () +{ + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + + { { echo "$as_me:$LINENO: error: *** Couldn't find SDL library (version >= $SDL_VERSION)." >&5 +echo "$as_me: error: *** Couldn't find SDL library (version >= $SDL_VERSION)." >&2;} + { (exit 1); exit 1; }; } + + fi + + + rm -f conf.sdltest + +fi + +if test "x$enable_sdl" = xyes; then + VBA_SRC_EXTRA="$VBA_SRC_EXTRA sdl" +fi + +if test "x$enable_gtk" = xyes; then + ALL_LINGUAS="fr" + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + rm -f messages.po + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGMERGE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + + ac_config_commands="$ac_config_commands default-1" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${acl_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${acl_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 +if test "${acl_cv_rpath+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +echo "${ECHO_T}$acl_cv_rpath" >&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + : +else + enable_rpath=yes +fi; + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + + + + + echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext1_libc=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 + + if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 + if test "$am_cv_func_iconv" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + fi + if test "$am_cv_lib_iconv" = yes; then + echo "$as_me:$LINENO: checking how to link with libiconv" >&5 +echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBICONV" >&5 +echo "${ECHO_T}$LIBICONV" >&6 + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix or --without-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then + withval="$with_libintl_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBINTL= + LTLIBINTL= + INCINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libintl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext1_libintl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext1_libintl=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 + fi + + if test "$gt_cv_func_gnugettext1_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + else + USE_NLS=no + fi + fi + + echo "$as_me:$LINENO: checking whether to use NLS" >&5 +echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + if test "$USE_NLS" = "yes"; then + echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 +echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6 + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + echo "$as_me:$LINENO: result: $gt_source" >&5 +echo "${ECHO_T}$gt_source" >&6 + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + echo "$as_me:$LINENO: checking how to link with libintl" >&5 +echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBINTL" >&5 +echo "${ECHO_T}$LIBINTL" >&6 + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + +for ac_header in libintl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + GETTEXT_PACKAGE=vba-1.7.2 + + + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0" >&5 +echo $ECHO_N "checking for gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking GTKMM_CFLAGS" >&5 +echo $ECHO_N "checking GTKMM_CFLAGS... $ECHO_C" >&6 + GTKMM_CFLAGS=`$PKG_CONFIG --cflags "gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0"` + echo "$as_me:$LINENO: result: $GTKMM_CFLAGS" >&5 +echo "${ECHO_T}$GTKMM_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking GTKMM_LIBS" >&5 +echo $ECHO_N "checking GTKMM_LIBS... $ECHO_C" >&6 + GTKMM_LIBS=`$PKG_CONFIG --libs "gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0"` + echo "$as_me:$LINENO: result: $GTKMM_LIBS" >&5 +echo "${ECHO_T}$GTKMM_LIBS" >&6 + else + GTKMM_CFLAGS="" + GTKMM_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GTKMM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0"` + echo $GTKMM_PKG_ERRORS + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + { { echo "$as_me:$LINENO: error: Library requirements (gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 +echo "$as_me: error: Library requirements (gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + { (exit 1); exit 1; }; } + fi + + + + if test "x$gtk_version" = x2.0; then + GTKMM_CPPFLAGS="-DGTKMM20" + fi + + VBA_EXTRA="$VBA_EXTRA po" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA gtk" +fi + +if test "x$enable_dev" = xyes; then + CXXFLAGS="$CXXFLAGS -DDEV_VERSION" +fi + +if test "x$enable_sdl" != xyes && test "x$enable_gtk" != xyes; then + { echo "$as_me:$LINENO: WARNING: *** You have chosen not to build any frontend." >&5 +echo "$as_me: WARNING: *** You have chosen not to build any frontend." >&2;} +fi + + + + + + ac_config_files="$ac_config_files Makefile m4/Makefile po/Makefile.in src/Makefile src/gb/Makefile src/gtk/Makefile src/gtk/images/Makefile src/i386/Makefile src/prof/Makefile src/sdl/Makefile win32/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/gb/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gb/Makefile" ;; + "src/gtk/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gtk/Makefile" ;; + "src/gtk/images/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gtk/images/Makefile" ;; + "src/i386/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/i386/Makefile" ;; + "src/prof/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/prof/Makefile" ;; + "src/sdl/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/sdl/Makefile" ;; + "win32/Makefile" ) CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@YACC@,$YACC,;t t +s,@LEX@,$LEX,;t t +s,@LEXLIB@,$LEXLIB,;t t +s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@NASM@,$NASM,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@SDL_CONFIG@,$SDL_CONFIG,;t t +s,@SDL_CFLAGS@,$SDL_CFLAGS,;t t +s,@SDL_LIBS@,$SDL_LIBS,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@MSGMERGE@,$MSGMERGE,;t t +s,@LIBICONV@,$LIBICONV,;t t +s,@LTLIBICONV@,$LTLIBICONV,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@LIBINTL@,$LIBINTL,;t t +s,@LTLIBINTL@,$LTLIBINTL,;t t +s,@POSUB@,$POSUB,;t t +s,@GETTEXT_PACKAGE@,$GETTEXT_PACKAGE,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@GTKMM_CFLAGS@,$GTKMM_CFLAGS,;t t +s,@GTKMM_LIBS@,$GTKMM_LIBS,;t t +s,@GTKMM_CPPFLAGS@,$GTKMM_CPPFLAGS,;t t +s,@VBA_EXTRA@,$VBA_EXTRA,;t t +s,@VBA_SRC_EXTRA@,$VBA_SRC_EXTRA,;t t +s,@VBA_LIBS@,$VBA_LIBS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + default-1 ) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..07ea25e --- /dev/null +++ b/configure.in @@ -0,0 +1,181 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(src/armdis.h) + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +case "$target" in + i?86-*-*) + VBA_USE_C_CORE=no + VBA_USE_MMX=yes + ;; + *) + VBA_USE_C_CORE=yes + VBA_USE_MMX=no + ;; +esac + +AM_INIT_AUTOMAKE(VisualBoyAdvance, 1.7.2) + +AC_ARG_ENABLE(c-core, + AC_HELP_STRING([--enable-c-core],[enable C core (default is no on x86 targets)]), + , enable_c_core=$VBA_USE_C_CORE) + +AC_ARG_ENABLE(profiling, + AC_HELP_STRING([--enable-profiling],[enable profiling (default is yes)]), + , enable_profiling=yes) + +AC_ARG_WITH(mmx, + AC_HELP_STRING([--with-mmx],[use MMX (default is yes on x86 targets)]), + , with_mmx=$VBA_USE_MMX) + +AC_ARG_ENABLE(sdl, + AC_HELP_STRING([--enable-sdl],[build the SDL interface (default is yes)]), + , enable_sdl=yes) + +AC_ARG_ENABLE(gtk, +[ --enable-gtk=[[VERSION]] build the GTK+ interface (default is no)],[ +if test "x$enable_gtk" != xno; then + enable_gtk=yes + if test "x$enableval" = xyes; then + gtk_version=2.0 + else + gtk_version=$enableval + fi +fi +],[ +enable_gtk=no +]) + +AC_ARG_ENABLE(dev, + AC_HELP_STRING([--enable-dev],[enable development features (default is yes)]), + , enable_dev=yes) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_YACC +AM_PROG_LEX +AC_PROG_CXX +AC_PROG_RANLIB +AC_PATH_PROG(NASM, nasm) + +dnl Checks for libraries. +AC_CHECK_LIB(z, gzopen, + , AC_MSG_ERROR([*** Cannot compile without zlib.])) +AC_CHECK_LIB(png, png_create_write_struct, + , AC_MSG_ERROR([*** Cannot compile without libpng.]), [-lz]) +AC_CHECK_LIB(pthread, pthread_yield) + +dnl Checks for header files. +AC_PATH_X +AC_HEADER_STDC +AC_CHECK_HEADERS(malloc.h strings.h unistd.h arpa/inet.h netinet/in.h zutil.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_STRUCT_TM +AC_MSG_CHECKING(for socklen_t) +AC_TRY_COMPILE([ +#include +socklen_t x; +],[ +],[ +AC_MSG_RESULT(yes) +],[ +AC_TRY_COMPILE([ +#include +int accept (int, struct sockaddr *, size_t *); +],[ +],[ +AC_MSG_RESULT(size_t) +AC_DEFINE(socklen_t,size_t) +],[ +AC_MSG_RESULT(int) +AC_DEFINE(socklen_t,int) +]) +]) + +AC_C_BIGENDIAN + +VBA_LIBS="../gb/libgb.a" + +if test "x$enable_c_core" = xyes; then + CXXFLAGS="$CXXFLAGS -DC_CORE" +fi + +if test "x$enable_profiling" = xyes; then + CXXFLAGS="$CXXFLAGS -DPROFILING" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA prof" + VBA_LIBS="$VBA_LIBS ../prof/libprof.a" +fi + +if test "x$with_mmx" = xyes; then + if test "x$NASM" = x; then + AC_MSG_ERROR([*** Couldn't find nasm program.]) + fi + CXXFLAGS="$CXXFLAGS -DMMX" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA i386" + VBA_LIBS="$VBA_LIBS ../i386/lib386.a" +fi + +if test "x$enable_sdl" = xyes || test "x$enable_gtk" = xyes; then + SDL_VERSION=1.2.2 + AM_PATH_SDL($SDL_VERSION,[ + ],[ + AC_MSG_ERROR([*** Couldn't find SDL library (version >= $SDL_VERSION).]) + ]) +fi + +if test "x$enable_sdl" = xyes; then + VBA_SRC_EXTRA="$VBA_SRC_EXTRA sdl" +fi + +if test "x$enable_gtk" = xyes; then + dnl Internationalisation support. + ALL_LINGUAS="fr" + AM_GNU_GETTEXT(external) + AC_CHECK_HEADERS(libintl.h) + GETTEXT_PACKAGE=vba-1.7.2 + AC_SUBST(GETTEXT_PACKAGE) + + PKG_CHECK_MODULES(GTKMM, gtkmm-$gtk_version >= 2.0.0 libglademm-$gtk_version >= 2.1.0) + AC_SUBST(GTKMM_CFLAGS) + AC_SUBST(GTKMM_LIBS) + if test "x$gtk_version" = x2.0; then + GTKMM_CPPFLAGS="-DGTKMM20" + fi + AC_SUBST(GTKMM_CPPFLAGS) + VBA_EXTRA="$VBA_EXTRA po" + VBA_SRC_EXTRA="$VBA_SRC_EXTRA gtk" +fi + +if test "x$enable_dev" = xyes; then + CXXFLAGS="$CXXFLAGS -DDEV_VERSION" +fi + +if test "x$enable_sdl" != xyes && test "x$enable_gtk" != xyes; then + AC_MSG_WARN([*** You have chosen not to build any frontend.]) +fi + +AC_SUBST(VBA_EXTRA) +AC_SUBST(VBA_SRC_EXTRA) +AC_SUBST(VBA_LIBS) + +dnl Generated files. +AC_CONFIG_FILES([ +Makefile +m4/Makefile +po/Makefile.in +src/Makefile +src/gb/Makefile +src/gtk/Makefile +src/gtk/images/Makefile +src/i386/Makefile +src/prof/Makefile +src/sdl/Makefile +win32/Makefile +]) +AC_OUTPUT diff --git a/depcomp b/depcomp new file mode 100644 index 0000000..edb5d38 --- /dev/null +++ b/depcomp @@ -0,0 +1,479 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/install-sh b/install-sh new file mode 100644 index 0000000..398a88e --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + : + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/m4/ChangeLog b/m4/ChangeLog new file mode 100644 index 0000000..bea0f7a --- /dev/null +++ b/m4/ChangeLog @@ -0,0 +1,32 @@ +2004-03-29 gettextize + + * codeset.m4: New file, from gettext-0.14.1. + * gettext.m4: New file, from gettext-0.14.1. + * glibc21.m4: New file, from gettext-0.14.1. + * iconv.m4: New file, from gettext-0.14.1. + * intdiv0.m4: New file, from gettext-0.14.1. + * intmax.m4: New file, from gettext-0.14.1. + * inttypes.m4: New file, from gettext-0.14.1. + * inttypes_h.m4: New file, from gettext-0.14.1. + * inttypes-pri.m4: New file, from gettext-0.14.1. + * isc-posix.m4: New file, from gettext-0.14.1. + * lcmessage.m4: New file, from gettext-0.14.1. + * lib-ld.m4: New file, from gettext-0.14.1. + * lib-link.m4: New file, from gettext-0.14.1. + * lib-prefix.m4: New file, from gettext-0.14.1. + * longdouble.m4: New file, from gettext-0.14.1. + * longlong.m4: New file, from gettext-0.14.1. + * nls.m4: New file, from gettext-0.14.1. + * po.m4: New file, from gettext-0.14.1. + * printf-posix.m4: New file, from gettext-0.14.1. + * progtest.m4: New file, from gettext-0.14.1. + * signed.m4: New file, from gettext-0.14.1. + * size_max.m4: New file, from gettext-0.14.1. + * stdint_h.m4: New file, from gettext-0.14.1. + * uintmax_t.m4: New file, from gettext-0.14.1. + * ulonglong.m4: New file, from gettext-0.14.1. + * wchar_t.m4: New file, from gettext-0.14.1. + * wint_t.m4: New file, from gettext-0.14.1. + * xsize.m4: New file, from gettext-0.14.1. + * Makefile.am: New file. + diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..797d0cf --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,29 @@ +EXTRA_DIST = \ + codeset.m4 \ + gettext.m4 \ + glibc21.m4 \ + iconv.m4 \ + intdiv0.m4 \ + intmax.m4 \ + inttypes_h.m4 \ + inttypes.m4 \ + inttypes-pri.m4 \ + isc-posix.m4 \ + lcmessage.m4 \ + lib-ld.m4 \ + lib-link.m4 \ + lib-prefix.m4 \ + longdouble.m4 \ + longlong.m4 \ + nls.m4 \ + po.m4 \ + printf-posix.m4 \ + progtest.m4 \ + signed.m4 \ + size_max.m4 \ + stdint_h.m4 \ + uintmax_t.m4 \ + ulonglong.m4 \ + wchar_t.m4 \ + wint_t.m4 \ + xsize.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..631db0e --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,322 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +EXTRA_DIST = \ + codeset.m4 \ + gettext.m4 \ + glibc21.m4 \ + iconv.m4 \ + intdiv0.m4 \ + intmax.m4 \ + inttypes_h.m4 \ + inttypes.m4 \ + inttypes-pri.m4 \ + isc-posix.m4 \ + lcmessage.m4 \ + lib-ld.m4 \ + lib-link.m4 \ + lib-prefix.m4 \ + longdouble.m4 \ + longlong.m4 \ + nls.m4 \ + po.m4 \ + printf-posix.m4 \ + progtest.m4 \ + signed.m4 \ + size_max.m4 \ + stdint_h.m4 \ + uintmax_t.m4 \ + ulonglong.m4 \ + wchar_t.m4 \ + wint_t.m4 \ + xsize.m4 + +subdir = m4 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = $(srcdir)/Makefile.in ChangeLog Makefile.am +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu m4/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/m4/codeset.m4 b/m4/codeset.m4 new file mode 100644 index 0000000..59535eb --- /dev/null +++ b/m4/codeset.m4 @@ -0,0 +1,23 @@ +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..a374f03 --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,487 @@ +# gettext.m4 serial 28 (gettext-0.13) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Set USE_NLS. + AM_NLS + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + dnl Add a version number to the cache macros. + define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +]ifelse([$2], [need-formatstring-macros], +[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +], [])[extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl Checks for all prerequisites of the intl subdirectory, +dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, +dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. +AC_DEFUN([AM_INTL_SUBDIR], +[ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([bh_C_SIGNED])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl + AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl + AC_REQUIRE([gt_TYPE_WCHAR_T])dnl + AC_REQUIRE([gt_TYPE_WINT_T])dnl + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_REQUIRE([gt_TYPE_INTMAX_T]) + AC_REQUIRE([gt_PRINTF_POSIX]) + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + AC_REQUIRE([gt_INTDIV0])dnl + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl + AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl + AC_REQUIRE([gt_INTTYPES_PRI])dnl + AC_REQUIRE([gl_XSIZE])dnl + + AC_CHECK_TYPE([ptrdiff_t], , + [AC_DEFINE([ptrdiff_t], [long], + [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) + ]) + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ +mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ +strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ +__fsetlocking]) + + dnl Use the _snprintf function only if it is declared (because on NetBSD it + dnl is defined as a weak alias of snprintf; we prefer to use the latter). + gt_CHECK_DECL(_snprintf, [#include ]) + gt_CHECK_DECL(_snwprintf, [#include ]) + + dnl Use the *_unlocked functions only if they are declared. + dnl (because some of them were defined without being declared in Solaris + dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built + dnl on Solaris 2.5.1 to run on Solaris 2.6). + dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. + gt_CHECK_DECL(feof_unlocked, [#include ]) + gt_CHECK_DECL(fgets_unlocked, [#include ]) + gt_CHECK_DECL(getc_unlocked, [#include ]) + + case $gt_cv_func_printf_posix in + *yes) HAVE_POSIX_PRINTF=1 ;; + *) HAVE_POSIX_PRINTF=0 ;; + esac + AC_SUBST([HAVE_POSIX_PRINTF]) + if test "$ac_cv_func_asprintf" = yes; then + HAVE_ASPRINTF=1 + else + HAVE_ASPRINTF=0 + fi + AC_SUBST([HAVE_ASPRINTF]) + if test "$ac_cv_func_snprintf" = yes; then + HAVE_SNPRINTF=1 + else + HAVE_SNPRINTF=0 + fi + AC_SUBST([HAVE_SNPRINTF]) + if test "$ac_cv_func_wprintf" = yes; then + HAVE_WPRINTF=1 + else + HAVE_WPRINTF=0 + fi + AC_SUBST([HAVE_WPRINTF]) + + AM_ICONV + AM_LANGINFO_CODESET + if test $ac_cv_header_locale_h = yes; then + AM_LC_MESSAGES + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi +]) + + +dnl gt_CHECK_DECL(FUNC, INCLUDES) +dnl Check whether a function is declared. +AC_DEFUN([gt_CHECK_DECL], +[ + AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, + [AC_TRY_COMPILE([$2], [ +#ifndef $1 + char *p = (char *) $1; +#endif +], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) + if test $ac_cv_have_decl_$1 = yes; then + gt_value=1 + else + gt_value=0 + fi + AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], + [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 new file mode 100644 index 0000000..9c9f3db --- /dev/null +++ b/m4/glibc21.m4 @@ -0,0 +1,32 @@ +# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..c5f3579 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,103 @@ +# iconv.m4 serial AM4 (gettext-0.11.3) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 new file mode 100644 index 0000000..55dddcf --- /dev/null +++ b/m4/intdiv0.m4 @@ -0,0 +1,72 @@ +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gt_INTDIV0], +[ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ +#include +#include + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) diff --git a/m4/intmax.m4 b/m4/intmax.m4 new file mode 100644 index 0000000..dfb08cc --- /dev/null +++ b/m4/intmax.m4 @@ -0,0 +1,32 @@ +# intmax.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the system has the 'intmax_t' type, but don't attempt to +dnl find a replacement if it is lacking. + +AC_DEFUN([gt_TYPE_INTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, + [AC_TRY_COMPILE([ +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif +], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) + if test $gt_cv_c_intmax_t = yes; then + AC_DEFINE(HAVE_INTMAX_T, 1, + [Define if you have the 'intmax_t' type in or .]) + fi +]) diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 new file mode 100644 index 0000000..fd007c3 --- /dev/null +++ b/m4/inttypes-pri.m4 @@ -0,0 +1,32 @@ +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if exists and defines unusable PRI* macros.]) + fi +]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 new file mode 100644 index 0000000..ab370ff --- /dev/null +++ b/m4/inttypes.m4 @@ -0,0 +1,27 @@ +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists and doesn't clash with +# . + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include +#include ], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if exists and doesn't clash with .]) + fi +]) diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 new file mode 100644 index 0000000..f342eba --- /dev/null +++ b/m4/inttypes_h.m4 @@ -0,0 +1,28 @@ +# inttypes_h.m4 serial 5 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 new file mode 100644 index 0000000..1319dd1 --- /dev/null +++ b/m4/isc-posix.m4 @@ -0,0 +1,26 @@ +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 new file mode 100644 index 0000000..ffd4008 --- /dev/null +++ b/m4/lcmessage.m4 @@ -0,0 +1,32 @@ +# lcmessage.m4 serial 3 (gettext-0.11.3) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995. + +# Check whether LC_MESSAGES is available in . + +AC_DEFUN([AM_LC_MESSAGES], +[ + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..38aeaec --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,112 @@ +# lib-ld.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..eeb200d --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,551 @@ +# lib-link.m4 serial 4 (gettext-0.12) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..8aff5a9 --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,155 @@ +# lib-prefix.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) diff --git a/m4/longdouble.m4 b/m4/longdouble.m4 new file mode 100644 index 0000000..1333d2f --- /dev/null +++ b/m4/longdouble.m4 @@ -0,0 +1,30 @@ +# longdouble.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the compiler supports the 'long double' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_LONGDOUBLE], +[ + AC_CACHE_CHECK([for long double], gt_cv_c_long_double, + [if test "$GCC" = yes; then + gt_cv_c_long_double=yes + else + AC_TRY_COMPILE([ + /* The Stardent Vistra knows sizeof(long double), but does not support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + int array [2*(sizeof(long double) >= sizeof(double)) - 1]; + ], , + gt_cv_c_long_double=yes, gt_cv_c_long_double=no) + fi]) + if test $gt_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) + fi +]) diff --git a/m4/longlong.m4 b/m4/longlong.m4 new file mode 100644 index 0000000..d7d7350 --- /dev/null +++ b/m4/longlong.m4 @@ -0,0 +1,25 @@ +# longlong.m4 serial 4 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_LONG_LONG if 'long long' works. + +AC_DEFUN([jm_AC_TYPE_LONG_LONG], +[ + AC_CACHE_CHECK([for long long], ac_cv_type_long_long, + [AC_TRY_LINK([long long ll = 1LL; int i = 63;], + [long long llmax = (long long) -1; + return ll << i | ll >> i | llmax / ll | llmax % ll;], + ac_cv_type_long_long=yes, + ac_cv_type_long_long=no)]) + if test $ac_cv_type_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, + [Define if you have the 'long long' type.]) + fi +]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 0000000..36bc493 --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,49 @@ +# nls.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) + +AC_DEFUN([AM_MKINSTALLDIRS], +[ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate it. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 0000000..e161998 --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,426 @@ +# po.m4 serial 3 (gettext-0.14) +dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AM_NLS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" < +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, + [ + AC_EGREP_CPP(notposix, [ +#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ + notposix +#endif + ], gt_cv_func_printf_posix="guessing no", + gt_cv_func_printf_posix="guessing yes") + ]) + ]) + case $gt_cv_func_printf_posix in + *yes) + AC_DEFINE(HAVE_POSIX_PRINTF, 1, + [Define if your printf() function supports format strings with positions.]) + ;; + esac +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 new file mode 100644 index 0000000..8fe527c --- /dev/null +++ b/m4/progtest.m4 @@ -0,0 +1,91 @@ +# progtest.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1996. + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/m4/signed.m4 b/m4/signed.m4 new file mode 100644 index 0000000..dc1f54f --- /dev/null +++ b/m4/signed.m4 @@ -0,0 +1,19 @@ +# signed.m4 serial 1 (gettext-0.10.40) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([bh_C_SIGNED], +[ + AC_CACHE_CHECK([for signed], bh_cv_c_signed, + [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) + if test $bh_cv_c_signed = no; then + AC_DEFINE(signed, , + [Define to empty if the C compiler doesn't support this keyword.]) + fi +]) diff --git a/m4/size_max.m4 b/m4/size_max.m4 new file mode 100644 index 0000000..5762fc3 --- /dev/null +++ b/m4/size_max.m4 @@ -0,0 +1,61 @@ +# size_max.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gl_SIZE_MAX], +[ + AC_CHECK_HEADERS(stdint.h) + dnl First test whether the system already has SIZE_MAX. + AC_MSG_CHECKING([for SIZE_MAX]) + result= + AC_EGREP_CPP([Found it], [ +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif +], result=yes) + if test -z "$result"; then + dnl Define it ourselves. Here we assume that the type 'size_t' is not wider + dnl than the type 'unsigned long'. + dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', + dnl which is guaranteed to work from LONG_MIN to LONG_MAX. + _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, + [#include ], result=?) + _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, + [#include ], result=?) + _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, + [#include ], result=?) + if test "$fits_in_uint" = 1; then + dnl Even though SIZE_MAX fits in an unsigned int, it must be of type + dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. + AC_TRY_COMPILE([#include + extern size_t foo; + extern unsigned long foo; + ], [], fits_in_uint=0) + fi + if test -z "$result"; then + if test "$fits_in_uint" = 1; then + result="$res_hi$res_lo"U + else + result="$res_hi$res_lo"UL + fi + else + dnl Shouldn't happen, but who knows... + result='~(size_t)0' + fi + fi + AC_MSG_RESULT([$result]) + if test "$result" != yes; then + AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], + [Define as the maximum value of type 'size_t', if the system doesn't define it.]) + fi +]) diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 new file mode 100644 index 0000000..32ba7ae --- /dev/null +++ b/m4/stdint_h.m4 @@ -0,0 +1,28 @@ +# stdint_h.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, + [Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 new file mode 100644 index 0000000..b5f28d4 --- /dev/null +++ b/m4/uintmax_t.m4 @@ -0,0 +1,32 @@ +# uintmax_t.m4 serial 7 (gettext-0.12) +dnl Copyright (C) 1997-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to 'unsigned long' or 'unsigned long long' +# if it is not already defined in or . + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if and don't define.]) + else + AC_DEFINE(HAVE_UINTMAX_T, 1, + [Define if you have the 'uintmax_t' type in or .]) + fi +]) diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 new file mode 100644 index 0000000..1da8b80 --- /dev/null +++ b/m4/ulonglong.m4 @@ -0,0 +1,25 @@ +# ulonglong.m4 serial 3 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the 'unsigned long long' type.]) + fi +]) diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 new file mode 100644 index 0000000..d8fd1ec --- /dev/null +++ b/m4/wchar_t.m4 @@ -0,0 +1,22 @@ +# wchar_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wchar_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WCHAR_T], +[ + AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, + [AC_TRY_COMPILE([#include + wchar_t foo = (wchar_t)'\0';], , + gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) + if test $gt_cv_c_wchar_t = yes; then + AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) + fi +]) diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 0000000..3d8d215 --- /dev/null +++ b/m4/wint_t.m4 @@ -0,0 +1,22 @@ +# wint_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + [AC_TRY_COMPILE([#include + wint_t foo = (wchar_t)'\0';], , + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + fi +]) diff --git a/m4/xsize.m4 b/m4/xsize.m4 new file mode 100644 index 0000000..9b7cf9b --- /dev/null +++ b/m4/xsize.m4 @@ -0,0 +1,14 @@ +# xsize.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +AC_DEFUN([gl_XSIZE], +[ + dnl Prerequisites of lib/xsize.h. + AC_REQUIRE([gl_SIZE_MAX]) + AC_CHECK_HEADERS(stdint.h) +]) diff --git a/missing b/missing new file mode 100644 index 0000000..6a37006 --- /dev/null +++ b/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100644 index 0000000..d2d5f21 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,111 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..ec8abef --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,11 @@ +2004-03-29 gettextize + + * Makefile.in.in: New file, from gettext-0.14.1. + * boldquot.sed: New file, from gettext-0.14.1. + * en@boldquot.header: New file, from gettext-0.14.1. + * en@quot.header: New file, from gettext-0.14.1. + * insert-header.sin: New file, from gettext-0.14.1. + * quot.sed: New file, from gettext-0.14.1. + * remove-potcdate.sin: New file, from gettext-0.14.1. + * Rules-quot: New file, from gettext-0.14.1. + diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..319a834 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,368 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. +# +# Origin: gettext-0.14 + +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = @datadir@ +localedir = $(datadir)/locale +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +mkinstalldirs = $(SHELL) $(MKINSTALLDIRS) + +GMSGFMT = @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @echo "touch stamp-po" + @echo timestamp > stamp-poT + @mv stamp-poT stamp-po + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + $(mkinstalldirs) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkinstalldirs) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + $(mkinstalldirs) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkinstalldirs) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir); \ + else \ + cp -p $(srcdir)/$$file $(distdir); \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..b06efa4 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,41 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(GETTEXT_PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = VBA development team + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = undefined + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..e080cd3 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,18 @@ +# List of source files which containing translatable strings. + +src/Cheats.cpp +src/elf.cpp +src/GBA.cpp +src/RTC.cpp +src/Util.cpp +src/gb/gbCheats.cpp +src/gb/gbCodesCB.h +src/gb/gbCodes.h +src/gb/GB.cpp +src/gtk/joypadconfig.cpp +src/gtk/main.cpp +src/gtk/system.cpp +src/gtk/vba.glade +src/gtk/windowcallbacks.cpp +src/gtk/window.cpp +src/prof/prof.cpp diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..9c2a995 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g +s/“/“/g +s/â€/â€/g +s/‘/‘/g +s/’/’/g diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000000000000000000000000000000000000..fd5a0ad937f2fc6561859cd584d8982c95e60d7a GIT binary patch literal 14712 zcmcJV3w&HvoyQMQLBdlW3W9J2Lt7xzByFL@Qb^J?txcMkq~-19Hgl6)Ix}~eJJTk( zuq-NC6%iE#@d3Vz3an2+*ma2@xT1mzf&vO6;)1%OvY@d0{hfPeGI0-I03HbMck!p; zV&cz3x?oyfleW|CxYn`HaS*DWlc0tgz}?~5j_0}j_rN_#zZ9xJpLV?7@n*+6U<>&_ zhMLEn4=`o{JRE9%dSC-Q6RMs~F22R_0>_ISFL(Tux{AfEwRja3T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TpGaDFEC-Ky9*;jnS`7?@p#GrL#}xwC1)ixvGT&-&-qPhEQK zo7!Fl?VuzHYFCR^5E=2#<(x#={h*|*(|d>t;gX@y;1ev&3>_} z>vGsx<#9%KX36>%UaBl>Ry$7R&6{KT>PzrfvN=o4+J&>mUHj0fx%p74X)|M1^A#n9 z+`h-pUWJ|0Z)!tN&9<96wA^`3tCQ)zp3$^9yngMvMMrEwyRvQeDx-5(4#2$rTvhf` z1FZePEl2wWeW14(W!+yI*5pVIxs6lQo}K)K#wn&Ogi{t=}TM{ z^1mhUrB!b@3fB%|<~sE#vW-(Wm$Iim?2Z3sZu{03=Nf*wzQuO@G*#cC>a6oFc3Mk^ z^DXrUU`zQM7>yLT%h|EGbQ_-GXOu6{UOqy52k{H0-Phl=uxx&MGq7(}U5)L&bj~Kt z?P}!0&TSC;O=kzDdmHOcQd_~SGpcHpWen32RSzUy&$<1N)zhS};&al=|Ck>5(>}uO dIWAWuw~#4cWV@Rod)KgwHO_fz+pTj+{vSY37W)7I literal 0 HcmV?d00001 diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..855a341 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,1114 @@ +# French translation for VBA. +# +# Copyright (C) 2004 VBA development team +# This file is distributed under the same license as the VisualBoyAdvance package. +# +# Sébastien Guignot , 2004. +# +msgid "" +msgstr "" +"Project-Id-Version: VisualBoyAdvance 1.7.2\n" +"Report-Msgid-Bugs-To: undefined\n" +"POT-Creation-Date: 2004-05-21 18:02+0200\n" +"PO-Revision-Date: 2004-05-21 18:03+0200\n" +"Last-Translator: Sébastien Guignot \n" +"Language-Team: French <@>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/Cheats.cpp:653 src/Cheats.cpp:658 src/Cheats.cpp:667 src/Cheats.cpp:675 +#, c-format +msgid "Invalid cheat code '%s'" +msgstr "Cheat code incorrect '%s'" + +#: src/Cheats.cpp:694 +#, c-format +msgid "Invalid cheat code address: %08x" +msgstr "Adresse de cheat code incorrecte : %08x" + +#: src/Cheats.cpp:738 src/Cheats.cpp:747 +msgid "Invalid GSA code. Format is XXXXXXXXYYYYYYYY" +msgstr "Code GSA incorrect. Le format est XXXXXXXXYYYYYYYY" + +#: src/Cheats.cpp:773 +#, c-format +msgid "" +"Warning: cheats are for game %s. Current game is %s.\n" +"Codes may not work correctly." +msgstr "" +"Avertissement : les cheats sont pour le jeu %s. Le jeu courant est %s.\n" +"Les codes peuvent ne pas fonctionner correctement." + +#: src/Cheats.cpp:1307 src/Cheats.cpp:1316 src/Cheats.cpp:1323 +#: src/Cheats.cpp:1331 +msgid "Invalid CBA code. Format is XXXXXXXX YYYY." +msgstr "Code CBA incorrect. Le format est XXXXXXXX YYYY." + +#: src/Cheats.cpp:1385 +msgid "" +"Warning: Codes seem to be for a different game.\n" +"Codes may not work correctly." +msgstr "" +"Avertissement : les codes semblent être faits pour un autre jeu.\n" +"Ils peuvent ne pas fonctionner correctement." + +#: src/Cheats.cpp:1545 src/gb/gbCheats.cpp:130 +#, c-format +msgid "Unsupported cheat list version %d" +msgstr "Version de liste de cheats %d non supportée" + +#: src/Cheats.cpp:1558 src/gb/gbCheats.cpp:143 +#, c-format +msgid "Unsupported cheat list type %d" +msgstr "Type de liste de cheats %d non supporté" + +#: src/elf.cpp:2814 +#, c-format +msgid "Not a valid ELF file %s" +msgstr "%s n'est pas un fichier ELF correct" + +#: src/GBA.cpp:664 src/GBA.cpp:849 src/GBA.cpp:887 src/Util.cpp:61 +#: src/Util.cpp:270 src/gb/GB.cpp:1662 src/gb/GB.cpp:1679 src/gb/GB.cpp:1696 +#: src/gb/GB.cpp:1719 src/gb/GB.cpp:1736 +#, c-format +msgid "Error creating file %s" +msgstr "Erreur lors de la création du fichier %s" + +#: src/GBA.cpp:701 +#, c-format +msgid "Unsupported VisualBoyAdvance save game version %d" +msgstr "Version de sauvegarde VisualBoyAdvance %d non supportée" + +#: src/GBA.cpp:715 +#, c-format +msgid "Cannot load save game for %s" +msgstr "Impossible de charger la sauvegarde pour %s" + +#: src/GBA.cpp:724 +msgid "Save game is not using the BIOS files" +msgstr "La sauvegarde n'utilise pas de fichier BIOS" + +#: src/GBA.cpp:727 +msgid "Save game is using the BIOS file" +msgstr "La sauvegarde utilise le fichier BIOS" + +#: src/GBA.cpp:807 +#, c-format +msgid "Unsupported save type %d" +msgstr "Type de sauvegarde %d non supporté" + +#: src/GBA.cpp:922 src/GBA.cpp:989 src/Util.cpp:588 src/Util.cpp:700 +#: src/gb/gbCheats.cpp:400 src/gb/GB.cpp:1977 +#, c-format +msgid "Cannot open file %s" +msgstr "Impossible d'ouvrir le fichier %s" + +#: src/GBA.cpp:957 src/gb/GB.cpp:1991 +#, c-format +msgid "Cannot import snapshot for %s. Current game is %s" +msgstr "Impossible d'importer le snapshot pour %s. Le jeu courant est %s" + +#: src/GBA.cpp:971 src/gb/GB.cpp:2018 +#, c-format +msgid "Unsupported snapshot file %s" +msgstr "Fichier snapshot %s non supporté" + +#: src/GBA.cpp:1274 src/GBA.cpp:1280 src/GBA.cpp:1329 src/GBA.cpp:1336 +#: src/GBA.cpp:1343 src/GBA.cpp:1350 src/GBA.cpp:1357 src/GBA.cpp:1364 +#: src/GBA.cpp:1371 src/Util.cpp:767 src/Util.cpp:825 src/Util.cpp:933 +#, c-format +msgid "Failed to allocate memory for %s" +msgstr "Échec de l'allocation de mémoire pour : %s" + +#: src/GBA.cpp:1292 src/Util.cpp:756 src/Util.cpp:802 src/Util.cpp:816 +#: src/Util.cpp:920 +#, c-format +msgid "Error opening image %s" +msgstr "Erreur lors de l'ouverture de l'image %s" + +#: src/GBA.cpp:1606 +#, c-format +msgid "Unsupported ARM mode %02x" +msgstr "Mode ARM %02x non supporté" + +#: src/GBA.cpp:1839 +#, c-format +msgid "" +"Unsupported BIOS function %02x called from %08x. A BIOS file is needed in " +"order to get correct behaviour." +msgstr "" +"Fonction du BIOS %02x non supportée appelée depuis %08x. Un fichier BIOS est " +"nécessaire pour obtenir un comportement correct." + +#: src/GBA.cpp:2947 +msgid "Invalid BIOS file size" +msgstr "Taille de fichier BIOS incorrecte" + +#: src/RTC.cpp:157 +#, c-format +msgid "Unknown RTC command %02x" +msgstr "Commande RTC %02x inconnue" + +#: src/Util.cpp:596 src/Util.cpp:616 src/Util.cpp:707 src/Util.cpp:727 +#, c-format +msgid "Bad ZIP file %s" +msgstr "Fichier ZIP incorrect : %s" + +#: src/Util.cpp:639 src/Util.cpp:745 +#, c-format +msgid "No image found on ZIP file %s" +msgstr "Pas d'image trouvée dans le fichier ZIP %s" + +#: src/Util.cpp:783 src/Util.cpp:838 src/Util.cpp:877 src/Util.cpp:946 +#, c-format +msgid "Error reading image %s" +msgstr "Erreur lors de la lecture de l'image %s" + +#: src/Util.cpp:889 +#, c-format +msgid "No image found on RAR file %s" +msgstr "Pas d'image trouvée dans le fichier RAR %s" + +#: src/gb/gbCheats.cpp:194 src/gb/gbCheats.cpp:304 +msgid "Maximum number of cheats reached." +msgstr "Le nombre maximum de cheats a été atteint." + +#: src/gb/gbCheats.cpp:200 +#, c-format +msgid "Invalid GameShark code: %s" +msgstr "Code GameShark incorrect : %s" + +#: src/gb/gbCheats.cpp:310 +#, c-format +msgid "Invalid GameGenie code: %s" +msgstr "Code GameGenie incorrect : %s" + +#: src/gb/gbCheats.cpp:355 +#, c-format +msgid "Invalid cheat to remove %d" +msgstr "Cheat à supprimer %d incorrect" + +#: src/gb/gbCodesCB.h:1285 src/gb/gbCodes.h:1404 +#, c-format +msgid "Unknown opcode %02x at %04x" +msgstr "Opcode %02x inconnu à %04x" + +#: src/gb/GB.cpp:1761 src/gb/GB.cpp:1785 src/gb/GB.cpp:1810 src/gb/GB.cpp:1842 +#: src/gb/GB.cpp:1866 +#, c-format +msgid "Failed to read complete save game %s (%d)" +msgstr "La lecture de la sauvegarde %s complète a échouée (%d)" + +#: src/gb/GB.cpp:1818 +#, c-format +msgid "Failed to read RTC from save game %s (continuing)" +msgstr "" +"La lecture de la RTC de la sauvegarde %s a échoué (le chargement se poursuit)" + +#: src/gb/GB.cpp:2195 +#, c-format +msgid "Unsupported VisualBoy save game version %d" +msgstr "Version de sauvegarde VisualBoy %d non supportée" + +#: src/gb/GB.cpp:2205 +#, c-format +msgid "Cannot load save game for %s. Playing %s" +msgstr "" +"Impossible de charger la sauvegarde pour le jeu %s. Le jeu %s est en cours." + +#: src/gb/GB.cpp:2464 +#, c-format +msgid "Unsupported rom size %02x" +msgstr "Taille de rom %02x non supportée" + +#: src/gb/GB.cpp:2476 +#, c-format +msgid "Unsupported ram size %02x" +msgstr "Taille de ram %02x non supportée" + +#: src/gb/GB.cpp:2552 +#, c-format +msgid "Unknown cartridge type %02x" +msgstr "Type de cartouche %02x inconnu" + +#: src/gtk/joypadconfig.cpp:202 src/gtk/joypadconfig.cpp:239 +#: src/gtk/joypadconfig.cpp:257 +msgid "" +msgstr "" + +#: src/gtk/main.cpp:61 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Pour en savoir davantage, faites: `%s --help'.\n" + +#: src/gtk/main.cpp:65 +#, c-format +msgid "Usage: %s [option ...] [file]\n" +msgstr "Usage: %s [option ...] [fichier]\n" + +#: src/gtk/main.cpp:66 +msgid "" +"\n" +"Options:\n" +" --help Output this help.\n" +" -V, --version Output version information.\n" +msgstr "" +"\n" +"Options:\n" +" --help Affiche cette aide.\n" +" -V, --version Affiche la version.\n" + +#: src/gtk/main.cpp:130 +#, c-format +msgid "VisualBoyAdvance version %s [GTK+]\n" +msgstr "VisualBoyAdvance version %s [GTK+]\n" + +#: src/gtk/vba.glade:7 +msgid "VBA" +msgstr "VBA" + +#: src/gtk/vba.glade:37 +msgid "_File" +msgstr "_Fichier" + +#: src/gtk/vba.glade:46 +msgid "_Open..." +msgstr "_Ouvrir..." + +#: src/gtk/vba.glade:73 +msgid "_Load..." +msgstr "_Charger..." + +#: src/gtk/vba.glade:82 +msgid "_Save..." +msgstr "_Enregistrer..." + +#: src/gtk/vba.glade:91 +msgid "Loa_d game" +msgstr "C_harger une partie" + +#: src/gtk/vba.glade:100 +msgid "Most recent" +msgstr "La plus récente" + +#: src/gtk/vba.glade:108 +msgid "Auto load most recent" +msgstr "Chargement automatique de la plus récente" + +#: src/gtk/vba.glade:123 src/gtk/vba.glade:240 +msgid "Slot1" +msgstr "Slot1" + +#: src/gtk/vba.glade:132 src/gtk/vba.glade:249 +msgid "Slot2" +msgstr "Slot2" + +#: src/gtk/vba.glade:141 src/gtk/vba.glade:258 +msgid "Slot3" +msgstr "Slot3" + +#: src/gtk/vba.glade:150 src/gtk/vba.glade:267 +msgid "Slot4" +msgstr "Slot4" + +#: src/gtk/vba.glade:159 src/gtk/vba.glade:276 +msgid "Slot5" +msgstr "Slot5" + +#: src/gtk/vba.glade:168 src/gtk/vba.glade:285 +msgid "Slot6" +msgstr "Slot6" + +#: src/gtk/vba.glade:177 src/gtk/vba.glade:294 +msgid "Slot7" +msgstr "Slot7" + +#: src/gtk/vba.glade:186 src/gtk/vba.glade:303 +msgid "Slot8" +msgstr "Slot8" + +#: src/gtk/vba.glade:195 src/gtk/vba.glade:312 +msgid "Slot9" +msgstr "Slot9" + +#: src/gtk/vba.glade:204 src/gtk/vba.glade:321 +msgid "Slot10" +msgstr "Slot10" + +#: src/gtk/vba.glade:217 +msgid "S_ave game" +msgstr "E_nregistrer une partie" + +#: src/gtk/vba.glade:226 +msgid "Oldest slot" +msgstr "La plus ancienne" + +#: src/gtk/vba.glade:340 +msgid "_Pause" +msgstr "_Pause" + +#: src/gtk/vba.glade:350 src/gtk/vba.glade:374 +msgid "_Reset" +msgstr "_Reset" + +#: src/gtk/vba.glade:365 +msgid "Rece_nt" +msgstr "Récemmen_t ouverts" + +#: src/gtk/vba.glade:382 +msgid "_Freeze" +msgstr "_Freeze" + +#: src/gtk/vba.glade:407 +msgid "_Import" +msgstr "_Importer" + +#: src/gtk/vba.glade:416 src/gtk/vba.glade:437 +msgid "_Battery file..." +msgstr "_Fichier de batterie..." + +#: src/gtk/vba.glade:428 +msgid "E_xport" +msgstr "E_xporter" + +#: src/gtk/vba.glade:455 +msgid "Screen capt_ure..." +msgstr "Capt_ure d'écran..." + +#: src/gtk/vba.glade:469 +msgid "_Close" +msgstr "_Fermer" + +#: src/gtk/vba.glade:489 +msgid "_Exit" +msgstr "_Quitter" + +#: src/gtk/vba.glade:514 +msgid "_Options" +msgstr "_Options" + +#: src/gtk/vba.glade:523 +msgid "_Frameskip" +msgstr "_Frameskip" + +#: src/gtk/vba.glade:532 +msgid "_Throttle" +msgstr "_Vitesse" + +#: src/gtk/vba.glade:541 +msgid "_No throttle" +msgstr "_Aucune" + +#: src/gtk/vba.glade:550 src/gtk/vba.glade:1315 +msgid "25%" +msgstr "25%" + +#: src/gtk/vba.glade:560 src/gtk/vba.glade:1324 +msgid "50%" +msgstr "50%" + +#: src/gtk/vba.glade:570 src/gtk/vba.glade:1334 +msgid "100%" +msgstr "100%" + +#: src/gtk/vba.glade:580 +msgid "150%" +msgstr "150%" + +#: src/gtk/vba.glade:590 src/gtk/vba.glade:1344 +msgid "200%" +msgstr "200%" + +#: src/gtk/vba.glade:600 +msgid "_Other..." +msgstr "A_utre..." + +#: src/gtk/vba.glade:620 src/gtk/vba.glade:981 src/gtk/vba.glade:1415 +msgid "_Automatic" +msgstr "_Automatique" + +#: src/gtk/vba.glade:629 +msgid "_0" +msgstr "_0" + +#: src/gtk/vba.glade:639 src/gtk/vba.glade:1753 +msgid "_1" +msgstr "_1" + +#: src/gtk/vba.glade:649 src/gtk/vba.glade:1762 +msgid "_2" +msgstr "_2" + +#: src/gtk/vba.glade:659 src/gtk/vba.glade:1772 +msgid "_3" +msgstr "_3" + +#: src/gtk/vba.glade:669 src/gtk/vba.glade:1782 +msgid "_4" +msgstr "_4" + +#: src/gtk/vba.glade:679 +msgid "_5" +msgstr "_5" + +#: src/gtk/vba.glade:689 +msgid "_6" +msgstr "_6" + +#: src/gtk/vba.glade:699 +msgid "_7" +msgstr "_7" + +#: src/gtk/vba.glade:709 +msgid "_8" +msgstr "_8" + +#: src/gtk/vba.glade:719 +msgid "_9" +msgstr "_9" + +#: src/gtk/vba.glade:733 +msgid "_Video" +msgstr "_Vidéo" + +#: src/gtk/vba.glade:742 +msgid "_1x" +msgstr "_1x" + +#: src/gtk/vba.glade:751 +msgid "_2x" +msgstr "_2x" + +#: src/gtk/vba.glade:761 +msgid "_3x" +msgstr "_3x" + +#: src/gtk/vba.glade:771 +msgid "_4x" +msgstr "_4x" + +#: src/gtk/vba.glade:781 +msgid "_5x" +msgstr "_5x" + +#: src/gtk/vba.glade:791 +msgid "_6x" +msgstr "_6x" + +#: src/gtk/vba.glade:807 +msgid "_Layers" +msgstr "_Couches" + +#: src/gtk/vba.glade:816 +msgid "BG0" +msgstr "BG0" + +#: src/gtk/vba.glade:826 +msgid "BG1" +msgstr "BG1" + +#: src/gtk/vba.glade:836 +msgid "BG2" +msgstr "BG2" + +#: src/gtk/vba.glade:846 +msgid "BG3" +msgstr "BG3" + +#: src/gtk/vba.glade:856 +msgid "OBJ" +msgstr "OBJ" + +#: src/gtk/vba.glade:866 +msgid "WIN0" +msgstr "WIN0" + +#: src/gtk/vba.glade:876 +msgid "WIN1" +msgstr "WIN1" + +#: src/gtk/vba.glade:886 +msgid "OBJWIN" +msgstr "OBJWIN" + +#: src/gtk/vba.glade:904 +msgid "_Emulator" +msgstr "_Émulateur" + +#: src/gtk/vba.glade:913 +msgid "Directories..." +msgstr "Répertoires..." + +#: src/gtk/vba.glade:921 +msgid "Pause when inactive window" +msgstr "Pause lorsque la fenêtre est inactive" + +#: src/gtk/vba.glade:930 +msgid "Show speed" +msgstr "Affichage de la vitesse" + +#: src/gtk/vba.glade:939 src/gtk/vba.glade:1030 +msgid "None" +msgstr "Aucun" + +#: src/gtk/vba.glade:948 +msgid "Percentage" +msgstr "Pourcentage" + +#: src/gtk/vba.glade:958 +msgid "Detailed" +msgstr "Détaillé" + +#: src/gtk/vba.glade:972 +msgid "Save type" +msgstr "Type de sauvegarde" + +#: src/gtk/vba.glade:990 +msgid "EEPROM" +msgstr "EEPROM" + +#: src/gtk/vba.glade:1000 +msgid "SRAM" +msgstr "SRAM" + +#: src/gtk/vba.glade:1010 +msgid "Flash" +msgstr "Flash" + +#: src/gtk/vba.glade:1020 +msgid "EEPROM+Sensor" +msgstr "EEPROM+Sensor" + +#: src/gtk/vba.glade:1046 +msgid "Flash 64K" +msgstr "Flash 64K" + +#: src/gtk/vba.glade:1055 +msgid "Flash 128K" +msgstr "Flash 128K" + +#: src/gtk/vba.glade:1075 +msgid "_Select BIOS file..." +msgstr "_Sélectionner un fichier BIOS..." + +#: src/gtk/vba.glade:1083 +msgid "_Use BIOS file" +msgstr "_Utiliser le fichier BIOS" + +#: src/gtk/vba.glade:1098 +msgid "Screenshot format" +msgstr "Format des captures d'écran" + +#: src/gtk/vba.glade:1107 +msgid "_PNG" +msgstr "_PNG" + +#: src/gtk/vba.glade:1116 +msgid "_BMP" +msgstr "_BMP" + +#: src/gtk/vba.glade:1134 +msgid "_Sound" +msgstr "_Son" + +#: src/gtk/vba.glade:1143 +msgid "O_ff" +msgstr "_Désactivé" + +#: src/gtk/vba.glade:1152 +msgid "_Mute" +msgstr "_Muet" + +#: src/gtk/vba.glade:1162 +msgid "_On" +msgstr "A_ctivé" + +#: src/gtk/vba.glade:1178 +msgid "Echo" +msgstr "Écho" + +#: src/gtk/vba.glade:1187 +msgid "Low pass filter" +msgstr "Filtre passe-bas" + +#: src/gtk/vba.glade:1196 +msgid "Reverse stereo" +msgstr "Stéréo inversée" + +#: src/gtk/vba.glade:1211 +msgid "Channel _1" +msgstr "Canal _1" + +#: src/gtk/vba.glade:1220 +msgid "Channel _2" +msgstr "Canal _2" + +#: src/gtk/vba.glade:1229 +msgid "Channel _3" +msgstr "Canal _3" + +#: src/gtk/vba.glade:1238 +msgid "Channel _4" +msgstr "Canal _4" + +#: src/gtk/vba.glade:1247 +msgid "Channel _A" +msgstr "Canal _A" + +#: src/gtk/vba.glade:1256 +msgid "Channel _B" +msgstr "Canal _B" + +#: src/gtk/vba.glade:1271 +msgid "11 _Khz" +msgstr "11 _Khz" + +#: src/gtk/vba.glade:1280 +msgid "22 K_hz" +msgstr "22 K_hz" + +#: src/gtk/vba.glade:1290 +msgid "44 Kh_z" +msgstr "44 Kh_z" + +#: src/gtk/vba.glade:1306 +msgid "_Volume" +msgstr "_Volume" + +#: src/gtk/vba.glade:1354 +msgid "300%" +msgstr "300%" + +#: src/gtk/vba.glade:1364 +msgid "400%" +msgstr "400%" + +#: src/gtk/vba.glade:1382 +msgid "_Gameboy" +msgstr "_Gameboy" + +#: src/gtk/vba.glade:1391 +msgid "_Border" +msgstr "_Bordure" + +#: src/gtk/vba.glade:1400 +msgid "_Printer" +msgstr "_Imprimante" + +#: src/gtk/vba.glade:1424 +msgid "_GBA" +msgstr "_GBA" + +#: src/gtk/vba.glade:1434 +msgid "_CGB/GBC" +msgstr "_CGB/GBC" + +#: src/gtk/vba.glade:1444 +msgid "_SGB" +msgstr "_SGB" + +#: src/gtk/vba.glade:1454 +msgid "SGB_2" +msgstr "SGB_2" + +#: src/gtk/vba.glade:1464 +msgid "G_B" +msgstr "G_B" + +#: src/gtk/vba.glade:1478 +msgid "F_ilter" +msgstr "_Filtre" + +#: src/gtk/vba.glade:1487 +msgid "Interframe _blending" +msgstr "Interframe _blending" + +#: src/gtk/vba.glade:1496 src/gtk/vba.glade:1535 +msgid "_None" +msgstr "Aucu_n" + +#: src/gtk/vba.glade:1505 +msgid "_Smart" +msgstr "_Smart" + +#: src/gtk/vba.glade:1515 src/gtk/vba.glade:1594 +msgid "_Motion Blur" +msgstr "_Motion Blur" + +#: src/gtk/vba.glade:1544 +msgid "_TV Mode" +msgstr "_TV Mode" + +#: src/gtk/vba.glade:1554 +msgid "_2xSaI" +msgstr "_2xSaI" + +#: src/gtk/vba.glade:1564 +msgid "_Super 2xSaI" +msgstr "_Super 2xSaI" + +#: src/gtk/vba.glade:1574 +msgid "Super _Eagle" +msgstr "Super _Eagle" + +#: src/gtk/vba.glade:1584 +msgid "_Pixelate" +msgstr "_Pixelate" + +#: src/gtk/vba.glade:1604 +msgid "_AdvanceMAME 2x" +msgstr "_AdvanceMAME 2x" + +#: src/gtk/vba.glade:1614 +msgid "S_imple 2x" +msgstr "S_imple 2x" + +#: src/gtk/vba.glade:1624 +msgid "Bilinea_r" +msgstr "Bilinea_r" + +#: src/gtk/vba.glade:1634 +msgid "Bilinear Pl_us" +msgstr "Bilinear Pl_us" + +#: src/gtk/vba.glade:1644 +msgid "S_canlines" +msgstr "S_canlines" + +#: src/gtk/vba.glade:1654 +msgid "h_q2x" +msgstr "h_q2x" + +#: src/gtk/vba.glade:1664 +msgid "_lq2x" +msgstr "_lq2x" + +#: src/gtk/vba.glade:1680 +msgid "_Disable MMX" +msgstr "_Désactiver MMX" + +#: src/gtk/vba.glade:1693 +msgid "_Joypad" +msgstr "_Joypad" + +#: src/gtk/vba.glade:1702 +msgid "_Configure" +msgstr "_Configurer" + +#: src/gtk/vba.glade:1711 +msgid "_1..." +msgstr "_1..." + +#: src/gtk/vba.glade:1719 +msgid "_2..." +msgstr "_2..." + +#: src/gtk/vba.glade:1727 +msgid "_3..." +msgstr "_3..." + +#: src/gtk/vba.glade:1735 +msgid "_4..." +msgstr "_4..." + +#: src/gtk/vba.glade:1798 +msgid "_Autofire" +msgstr "_Autofire" + +#: src/gtk/vba.glade:1807 +msgid "_A" +msgstr "_A" + +#: src/gtk/vba.glade:1817 +msgid "_B" +msgstr "_B" + +#: src/gtk/vba.glade:1827 +msgid "_L" +msgstr "_L" + +#: src/gtk/vba.glade:1837 +msgid "_R" +msgstr "_R" + +#: src/gtk/vba.glade:1859 +msgid "_Tools" +msgstr "Ou_tils" + +#: src/gtk/vba.glade:1868 +msgid "_GDB" +msgstr "_GDB" + +#: src/gtk/vba.glade:1877 +msgid "_Wait connection..." +msgstr "_Attendre une connexion..." + +#: src/gtk/vba.glade:1885 +msgid "_Load and wait..." +msgstr "_Charger et attendre..." + +#: src/gtk/vba.glade:1893 +msgid "_Break" +msgstr "_Break" + +#: src/gtk/vba.glade:1901 +msgid "_Disconnect" +msgstr "_Déconnecter" + +#: src/gtk/vba.glade:1917 +msgid "_Help" +msgstr "_Aide" + +#: src/gtk/vba.glade:1926 +msgid "_About" +msgstr "À _propos" + +#: src/gtk/vba.glade:1967 +msgid "About VBA" +msgstr "À propos de VBA" + +#: src/gtk/vba.glade:2054 +msgid "An emulator for Gameboy(TM) and GameboyAdvance(TM)." +msgstr "Émulateur pour Gameboyâ„¢ et GameboyAdvanceâ„¢." + +#: src/gtk/vba.glade:2076 +msgid "Special thanks to Yann Parmentier aka \"kohai\" for the icons." +msgstr "" +"Remerciements spéciaux à Yann Parmentier aka \"kohai\" pour les icônes." + +#: src/gtk/vba.glade:2098 +msgid "" +"Copyright (C) 2004 Forgotten and the VBA development team" +msgstr "" +"Copyright © 2004 Forgotten et l'équipe de développement de VBA" + +#: src/gtk/vba.glade:2120 +msgid "Throttle" +msgstr "Vitesse" + +#: src/gtk/vba.glade:2191 +msgid "Throttle : " +msgstr "Vitesse : " + +#: src/gtk/vba.glade:2231 +msgid " %" +msgstr " %" + +#: src/gtk/vba.glade:2262 +msgid "Directories" +msgstr "Répertoires" + +#: src/gtk/vba.glade:2328 +msgid "GBA roms : " +msgstr "Roms GBA : " + +#: src/gtk/vba.glade:2358 src/gtk/vba.glade:2511 src/gtk/vba.glade:2612 +#: src/gtk/vba.glade:2713 src/gtk/vba.glade:2790 src/gtk/vba.glade:2921 +#: src/gtk/vba.glade:3207 src/gtk/vba.glade:3229 src/gtk/vba.glade:3251 +#: src/gtk/vba.glade:3273 src/gtk/vba.glade:3295 src/gtk/vba.glade:3317 +#: src/gtk/vba.glade:3339 src/gtk/vba.glade:3361 src/gtk/vba.glade:3383 +#: src/gtk/vba.glade:3405 src/gtk/vba.glade:3427 +msgid "*" +msgstr "*" + +#: src/gtk/vba.glade:2429 +msgid "GB roms : " +msgstr "Roms GB : " + +#: src/gtk/vba.glade:2481 +msgid "Batteries : " +msgstr "Batteries : " + +#: src/gtk/vba.glade:2582 +msgid "Saves : " +msgstr "Sauvegardes : " + +#: src/gtk/vba.glade:2683 +msgid "Captures : " +msgstr "Captures : " + +#: src/gtk/vba.glade:2841 +msgid "Joypad config" +msgstr "Configuration du joypad" + +#: src/gtk/vba.glade:2937 +msgid "Down : " +msgstr "Bas : " + +#: src/gtk/vba.glade:2961 +msgid "Left : " +msgstr "Gauche : " + +#: src/gtk/vba.glade:2985 +msgid "Right : " +msgstr "Droite : " + +#: src/gtk/vba.glade:3009 +msgid "Button A : " +msgstr "Bouton A : " + +#: src/gtk/vba.glade:3033 +msgid "Button B : " +msgstr "Bouton B : " + +#: src/gtk/vba.glade:3057 +msgid "Button L : " +msgstr "Bouton L : " + +#: src/gtk/vba.glade:3081 +msgid "Button R : " +msgstr "Bouton R : " + +#: src/gtk/vba.glade:3105 +msgid "Select : " +msgstr "Select : " + +#: src/gtk/vba.glade:3129 +msgid "Start : " +msgstr "Start : " + +#: src/gtk/vba.glade:3153 +msgid "Speed : " +msgstr "Speed : " + +#: src/gtk/vba.glade:3177 +msgid "Capture : " +msgstr "Capture : " + +#: src/gtk/vba.glade:3443 +msgid "Up : " +msgstr "Haut : " + +#: src/gtk/vba.glade:3477 +msgid "TCP port" +msgstr "Port TCP" + +#: src/gtk/vba.glade:3548 +msgid "Port : " +msgstr "Port : " + +#: src/gtk/windowcallbacks.cpp:80 src/gtk/windowcallbacks.cpp:94 +msgid "Load game" +msgstr "Charger une partie" + +#: src/gtk/windowcallbacks.cpp:109 src/gtk/windowcallbacks.cpp:163 +msgid "VisualBoyAdvance save game" +msgstr "Sauvegarde VisualBoyAdvance" + +#: src/gtk/windowcallbacks.cpp:131 src/gtk/windowcallbacks.cpp:146 +msgid "Save game" +msgstr "Enregistrer une partie" + +#: src/gtk/windowcallbacks.cpp:181 src/gtk/windowcallbacks.cpp:466 +#: src/gtk/windowcallbacks.cpp:585 +msgid "File already exists. Overwrite it?" +msgstr "Le fichier existe déjà. Voulez-vous l'écraser ?" + +#: src/gtk/windowcallbacks.cpp:318 src/gtk/windowcallbacks.cpp:332 +msgid "Import battery file" +msgstr "Importer un fichier de batterie" + +#: src/gtk/windowcallbacks.cpp:347 src/gtk/windowcallbacks.cpp:424 +msgid "Battery file" +msgstr "Fichier de batterie" + +#: src/gtk/windowcallbacks.cpp:351 src/gtk/windowcallbacks.cpp:428 +msgid "Flash save" +msgstr "Sauvegarde de flash" + +#: src/gtk/windowcallbacks.cpp:362 +msgid "" +"Importing a battery file will erase any saved games and reset the emulator. " +"Do you want to continue?" +msgstr "" +"Importer un fichier de batterie va effacer les parties sauvegardées dans le " +"jeu et redémarrer le jeu. Voulez-vous continuer ?" + +#: src/gtk/windowcallbacks.cpp:380 +#, c-format +msgid "Failed to import battery file %s." +msgstr "L'importation du fichier de batterie %s a échoué" + +#: src/gtk/windowcallbacks.cpp:392 src/gtk/windowcallbacks.cpp:407 +msgid "Export battery file" +msgstr "Exporter un fichier de batterie" + +#: src/gtk/windowcallbacks.cpp:494 +#, c-format +msgid "Failed to export battery file %s." +msgstr "L'exportation du fichier de batterie %s a échoué" + +#: src/gtk/windowcallbacks.cpp:506 src/gtk/windowcallbacks.cpp:521 +msgid "Save screenshot" +msgstr "Enregistrer la capture d'écran" + +#: src/gtk/windowcallbacks.cpp:538 +msgid "PNG image" +msgstr "Image PNG" + +#: src/gtk/windowcallbacks.cpp:542 +msgid "BMP image" +msgstr "Image BMP" + +#: src/gtk/windowcallbacks.cpp:824 src/gtk/windowcallbacks.cpp:844 +msgid "Select directory" +msgstr "Sélectionner un répertoire" + +#: src/gtk/windowcallbacks.cpp:872 src/gtk/windowcallbacks.cpp:882 +msgid "Select BIOS file" +msgstr "_Sélectionner un fichier BIOS..." + +#: src/gtk/windowcallbacks.cpp:898 +msgid "All files" +msgstr "Tous les fichiers" + +#: src/gtk/windowcallbacks.cpp:902 +msgid "Gameboy Advance BIOS" +msgstr "BIOS Gameboy Advance" + +#: src/gtk/windowcallbacks.cpp:1336 +msgid "Only GBA images are supported." +msgstr "Seules les images GBA sont supportées." + +#: src/gtk/window.cpp:1427 +#, c-format +msgid "Unknown file type %s" +msgstr "Type de fichier inconnu %s" + +#: src/gtk/window.cpp:1708 src/gtk/window.cpp:1722 +msgid "Open" +msgstr "Ouvrir" + +#: src/gtk/window.cpp:1749 +msgid "All Gameboy Advance files" +msgstr "Tous les fichiers Gameboy Advance" + +#: src/gtk/window.cpp:1756 +msgid "Gameboy Advance files" +msgstr "Fichiers Gameboy Advance" + +#: src/gtk/window.cpp:1763 +msgid "Gameboy files" +msgstr "Fichiers Gameboy" + +#: src/gtk/window.cpp:1793 +msgid "Loaded battery" +msgstr "Batterie chargée" + +#: src/gtk/window.cpp:1812 +msgid "Saved battery" +msgstr "Batterie enregistrée" + +#: src/gtk/window.cpp:1870 src/gtk/window.cpp:1917 +msgid "----/--/-- --:--:--" +msgstr "--/--/---- --:--:--" + +#: src/gtk/window.cpp:1902 +msgid "%Y/%m/%d %H:%M:%S" +msgstr "%d/%m/%Y %H:%M:%S" + +#: src/prof/prof.cpp:143 +msgid "No space for profiling buffer(s)\n" +msgstr "Pas de place pour le(s) tampon(s) de profil\n" diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/po/vba-1.7.2.pot b/po/vba-1.7.2.pot new file mode 100644 index 0000000..dbea162 --- /dev/null +++ b/po/vba-1.7.2.pot @@ -0,0 +1,1096 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR VBA development team +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: undefined\n" +"POT-Creation-Date: 2004-05-21 18:02+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/Cheats.cpp:653 src/Cheats.cpp:658 src/Cheats.cpp:667 src/Cheats.cpp:675 +#, c-format +msgid "Invalid cheat code '%s'" +msgstr "" + +#: src/Cheats.cpp:694 +#, c-format +msgid "Invalid cheat code address: %08x" +msgstr "" + +#: src/Cheats.cpp:738 src/Cheats.cpp:747 +msgid "Invalid GSA code. Format is XXXXXXXXYYYYYYYY" +msgstr "" + +#: src/Cheats.cpp:773 +#, c-format +msgid "" +"Warning: cheats are for game %s. Current game is %s.\n" +"Codes may not work correctly." +msgstr "" + +#: src/Cheats.cpp:1307 src/Cheats.cpp:1316 src/Cheats.cpp:1323 +#: src/Cheats.cpp:1331 +msgid "Invalid CBA code. Format is XXXXXXXX YYYY." +msgstr "" + +#: src/Cheats.cpp:1385 +msgid "" +"Warning: Codes seem to be for a different game.\n" +"Codes may not work correctly." +msgstr "" + +#: src/Cheats.cpp:1545 src/gb/gbCheats.cpp:130 +#, c-format +msgid "Unsupported cheat list version %d" +msgstr "" + +#: src/Cheats.cpp:1558 src/gb/gbCheats.cpp:143 +#, c-format +msgid "Unsupported cheat list type %d" +msgstr "" + +#: src/elf.cpp:2814 +#, c-format +msgid "Not a valid ELF file %s" +msgstr "" + +#: src/GBA.cpp:664 src/GBA.cpp:849 src/GBA.cpp:887 src/Util.cpp:61 +#: src/Util.cpp:270 src/gb/GB.cpp:1662 src/gb/GB.cpp:1679 src/gb/GB.cpp:1696 +#: src/gb/GB.cpp:1719 src/gb/GB.cpp:1736 +#, c-format +msgid "Error creating file %s" +msgstr "" + +#: src/GBA.cpp:701 +#, c-format +msgid "Unsupported VisualBoyAdvance save game version %d" +msgstr "" + +#: src/GBA.cpp:715 +#, c-format +msgid "Cannot load save game for %s" +msgstr "" + +#: src/GBA.cpp:724 +msgid "Save game is not using the BIOS files" +msgstr "" + +#: src/GBA.cpp:727 +msgid "Save game is using the BIOS file" +msgstr "" + +#: src/GBA.cpp:807 +#, c-format +msgid "Unsupported save type %d" +msgstr "" + +#: src/GBA.cpp:922 src/GBA.cpp:989 src/Util.cpp:588 src/Util.cpp:700 +#: src/gb/gbCheats.cpp:400 src/gb/GB.cpp:1977 +#, c-format +msgid "Cannot open file %s" +msgstr "" + +#: src/GBA.cpp:957 src/gb/GB.cpp:1991 +#, c-format +msgid "Cannot import snapshot for %s. Current game is %s" +msgstr "" + +#: src/GBA.cpp:971 src/gb/GB.cpp:2018 +#, c-format +msgid "Unsupported snapshot file %s" +msgstr "" + +#: src/GBA.cpp:1274 src/GBA.cpp:1280 src/GBA.cpp:1329 src/GBA.cpp:1336 +#: src/GBA.cpp:1343 src/GBA.cpp:1350 src/GBA.cpp:1357 src/GBA.cpp:1364 +#: src/GBA.cpp:1371 src/Util.cpp:767 src/Util.cpp:825 src/Util.cpp:933 +#, c-format +msgid "Failed to allocate memory for %s" +msgstr "" + +#: src/GBA.cpp:1292 src/Util.cpp:756 src/Util.cpp:802 src/Util.cpp:816 +#: src/Util.cpp:920 +#, c-format +msgid "Error opening image %s" +msgstr "" + +#: src/GBA.cpp:1606 +#, c-format +msgid "Unsupported ARM mode %02x" +msgstr "" + +#: src/GBA.cpp:1839 +#, c-format +msgid "" +"Unsupported BIOS function %02x called from %08x. A BIOS file is needed in " +"order to get correct behaviour." +msgstr "" + +#: src/GBA.cpp:2947 +msgid "Invalid BIOS file size" +msgstr "" + +#: src/RTC.cpp:157 +#, c-format +msgid "Unknown RTC command %02x" +msgstr "" + +#: src/Util.cpp:596 src/Util.cpp:616 src/Util.cpp:707 src/Util.cpp:727 +#, c-format +msgid "Bad ZIP file %s" +msgstr "" + +#: src/Util.cpp:639 src/Util.cpp:745 +#, c-format +msgid "No image found on ZIP file %s" +msgstr "" + +#: src/Util.cpp:783 src/Util.cpp:838 src/Util.cpp:877 src/Util.cpp:946 +#, c-format +msgid "Error reading image %s" +msgstr "" + +#: src/Util.cpp:889 +#, c-format +msgid "No image found on RAR file %s" +msgstr "" + +#: src/gb/gbCheats.cpp:194 src/gb/gbCheats.cpp:304 +msgid "Maximum number of cheats reached." +msgstr "" + +#: src/gb/gbCheats.cpp:200 +#, c-format +msgid "Invalid GameShark code: %s" +msgstr "" + +#: src/gb/gbCheats.cpp:310 +#, c-format +msgid "Invalid GameGenie code: %s" +msgstr "" + +#: src/gb/gbCheats.cpp:355 +#, c-format +msgid "Invalid cheat to remove %d" +msgstr "" + +#: src/gb/gbCodesCB.h:1285 src/gb/gbCodes.h:1404 +#, c-format +msgid "Unknown opcode %02x at %04x" +msgstr "" + +#: src/gb/GB.cpp:1761 src/gb/GB.cpp:1785 src/gb/GB.cpp:1810 src/gb/GB.cpp:1842 +#: src/gb/GB.cpp:1866 +#, c-format +msgid "Failed to read complete save game %s (%d)" +msgstr "" + +#: src/gb/GB.cpp:1818 +#, c-format +msgid "Failed to read RTC from save game %s (continuing)" +msgstr "" + +#: src/gb/GB.cpp:2195 +#, c-format +msgid "Unsupported VisualBoy save game version %d" +msgstr "" + +#: src/gb/GB.cpp:2205 +#, c-format +msgid "Cannot load save game for %s. Playing %s" +msgstr "" + +#: src/gb/GB.cpp:2464 +#, c-format +msgid "Unsupported rom size %02x" +msgstr "" + +#: src/gb/GB.cpp:2476 +#, c-format +msgid "Unsupported ram size %02x" +msgstr "" + +#: src/gb/GB.cpp:2552 +#, c-format +msgid "Unknown cartridge type %02x" +msgstr "" + +#: src/gtk/joypadconfig.cpp:202 src/gtk/joypadconfig.cpp:239 +#: src/gtk/joypadconfig.cpp:257 +msgid "" +msgstr "" + +#: src/gtk/main.cpp:61 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "" + +#: src/gtk/main.cpp:65 +#, c-format +msgid "Usage: %s [option ...] [file]\n" +msgstr "" + +#: src/gtk/main.cpp:66 +msgid "" +"\n" +"Options:\n" +" --help Output this help.\n" +" -V, --version Output version information.\n" +msgstr "" + +#: src/gtk/main.cpp:130 +#, c-format +msgid "VisualBoyAdvance version %s [GTK+]\n" +msgstr "" + +#: src/gtk/vba.glade:7 +msgid "VBA" +msgstr "" + +#: src/gtk/vba.glade:37 +msgid "_File" +msgstr "" + +#: src/gtk/vba.glade:46 +msgid "_Open..." +msgstr "" + +#: src/gtk/vba.glade:73 +msgid "_Load..." +msgstr "" + +#: src/gtk/vba.glade:82 +msgid "_Save..." +msgstr "" + +#: src/gtk/vba.glade:91 +msgid "Loa_d game" +msgstr "" + +#: src/gtk/vba.glade:100 +msgid "Most recent" +msgstr "" + +#: src/gtk/vba.glade:108 +msgid "Auto load most recent" +msgstr "" + +#: src/gtk/vba.glade:123 src/gtk/vba.glade:240 +msgid "Slot1" +msgstr "" + +#: src/gtk/vba.glade:132 src/gtk/vba.glade:249 +msgid "Slot2" +msgstr "" + +#: src/gtk/vba.glade:141 src/gtk/vba.glade:258 +msgid "Slot3" +msgstr "" + +#: src/gtk/vba.glade:150 src/gtk/vba.glade:267 +msgid "Slot4" +msgstr "" + +#: src/gtk/vba.glade:159 src/gtk/vba.glade:276 +msgid "Slot5" +msgstr "" + +#: src/gtk/vba.glade:168 src/gtk/vba.glade:285 +msgid "Slot6" +msgstr "" + +#: src/gtk/vba.glade:177 src/gtk/vba.glade:294 +msgid "Slot7" +msgstr "" + +#: src/gtk/vba.glade:186 src/gtk/vba.glade:303 +msgid "Slot8" +msgstr "" + +#: src/gtk/vba.glade:195 src/gtk/vba.glade:312 +msgid "Slot9" +msgstr "" + +#: src/gtk/vba.glade:204 src/gtk/vba.glade:321 +msgid "Slot10" +msgstr "" + +#: src/gtk/vba.glade:217 +msgid "S_ave game" +msgstr "" + +#: src/gtk/vba.glade:226 +msgid "Oldest slot" +msgstr "" + +#: src/gtk/vba.glade:340 +msgid "_Pause" +msgstr "" + +#: src/gtk/vba.glade:350 src/gtk/vba.glade:374 +msgid "_Reset" +msgstr "" + +#: src/gtk/vba.glade:365 +msgid "Rece_nt" +msgstr "" + +#: src/gtk/vba.glade:382 +msgid "_Freeze" +msgstr "" + +#: src/gtk/vba.glade:407 +msgid "_Import" +msgstr "" + +#: src/gtk/vba.glade:416 src/gtk/vba.glade:437 +msgid "_Battery file..." +msgstr "" + +#: src/gtk/vba.glade:428 +msgid "E_xport" +msgstr "" + +#: src/gtk/vba.glade:455 +msgid "Screen capt_ure..." +msgstr "" + +#: src/gtk/vba.glade:469 +msgid "_Close" +msgstr "" + +#: src/gtk/vba.glade:489 +msgid "_Exit" +msgstr "" + +#: src/gtk/vba.glade:514 +msgid "_Options" +msgstr "" + +#: src/gtk/vba.glade:523 +msgid "_Frameskip" +msgstr "" + +#: src/gtk/vba.glade:532 +msgid "_Throttle" +msgstr "" + +#: src/gtk/vba.glade:541 +msgid "_No throttle" +msgstr "" + +#: src/gtk/vba.glade:550 src/gtk/vba.glade:1315 +msgid "25%" +msgstr "" + +#: src/gtk/vba.glade:560 src/gtk/vba.glade:1324 +msgid "50%" +msgstr "" + +#: src/gtk/vba.glade:570 src/gtk/vba.glade:1334 +msgid "100%" +msgstr "" + +#: src/gtk/vba.glade:580 +msgid "150%" +msgstr "" + +#: src/gtk/vba.glade:590 src/gtk/vba.glade:1344 +msgid "200%" +msgstr "" + +#: src/gtk/vba.glade:600 +msgid "_Other..." +msgstr "" + +#: src/gtk/vba.glade:620 src/gtk/vba.glade:981 src/gtk/vba.glade:1415 +msgid "_Automatic" +msgstr "" + +#: src/gtk/vba.glade:629 +msgid "_0" +msgstr "" + +#: src/gtk/vba.glade:639 src/gtk/vba.glade:1753 +msgid "_1" +msgstr "" + +#: src/gtk/vba.glade:649 src/gtk/vba.glade:1762 +msgid "_2" +msgstr "" + +#: src/gtk/vba.glade:659 src/gtk/vba.glade:1772 +msgid "_3" +msgstr "" + +#: src/gtk/vba.glade:669 src/gtk/vba.glade:1782 +msgid "_4" +msgstr "" + +#: src/gtk/vba.glade:679 +msgid "_5" +msgstr "" + +#: src/gtk/vba.glade:689 +msgid "_6" +msgstr "" + +#: src/gtk/vba.glade:699 +msgid "_7" +msgstr "" + +#: src/gtk/vba.glade:709 +msgid "_8" +msgstr "" + +#: src/gtk/vba.glade:719 +msgid "_9" +msgstr "" + +#: src/gtk/vba.glade:733 +msgid "_Video" +msgstr "" + +#: src/gtk/vba.glade:742 +msgid "_1x" +msgstr "" + +#: src/gtk/vba.glade:751 +msgid "_2x" +msgstr "" + +#: src/gtk/vba.glade:761 +msgid "_3x" +msgstr "" + +#: src/gtk/vba.glade:771 +msgid "_4x" +msgstr "" + +#: src/gtk/vba.glade:781 +msgid "_5x" +msgstr "" + +#: src/gtk/vba.glade:791 +msgid "_6x" +msgstr "" + +#: src/gtk/vba.glade:807 +msgid "_Layers" +msgstr "" + +#: src/gtk/vba.glade:816 +msgid "BG0" +msgstr "" + +#: src/gtk/vba.glade:826 +msgid "BG1" +msgstr "" + +#: src/gtk/vba.glade:836 +msgid "BG2" +msgstr "" + +#: src/gtk/vba.glade:846 +msgid "BG3" +msgstr "" + +#: src/gtk/vba.glade:856 +msgid "OBJ" +msgstr "" + +#: src/gtk/vba.glade:866 +msgid "WIN0" +msgstr "" + +#: src/gtk/vba.glade:876 +msgid "WIN1" +msgstr "" + +#: src/gtk/vba.glade:886 +msgid "OBJWIN" +msgstr "" + +#: src/gtk/vba.glade:904 +msgid "_Emulator" +msgstr "" + +#: src/gtk/vba.glade:913 +msgid "Directories..." +msgstr "" + +#: src/gtk/vba.glade:921 +msgid "Pause when inactive window" +msgstr "" + +#: src/gtk/vba.glade:930 +msgid "Show speed" +msgstr "" + +#: src/gtk/vba.glade:939 src/gtk/vba.glade:1030 +msgid "None" +msgstr "" + +#: src/gtk/vba.glade:948 +msgid "Percentage" +msgstr "" + +#: src/gtk/vba.glade:958 +msgid "Detailed" +msgstr "" + +#: src/gtk/vba.glade:972 +msgid "Save type" +msgstr "" + +#: src/gtk/vba.glade:990 +msgid "EEPROM" +msgstr "" + +#: src/gtk/vba.glade:1000 +msgid "SRAM" +msgstr "" + +#: src/gtk/vba.glade:1010 +msgid "Flash" +msgstr "" + +#: src/gtk/vba.glade:1020 +msgid "EEPROM+Sensor" +msgstr "" + +#: src/gtk/vba.glade:1046 +msgid "Flash 64K" +msgstr "" + +#: src/gtk/vba.glade:1055 +msgid "Flash 128K" +msgstr "" + +#: src/gtk/vba.glade:1075 +msgid "_Select BIOS file..." +msgstr "" + +#: src/gtk/vba.glade:1083 +msgid "_Use BIOS file" +msgstr "" + +#: src/gtk/vba.glade:1098 +msgid "Screenshot format" +msgstr "" + +#: src/gtk/vba.glade:1107 +msgid "_PNG" +msgstr "" + +#: src/gtk/vba.glade:1116 +msgid "_BMP" +msgstr "" + +#: src/gtk/vba.glade:1134 +msgid "_Sound" +msgstr "" + +#: src/gtk/vba.glade:1143 +msgid "O_ff" +msgstr "" + +#: src/gtk/vba.glade:1152 +msgid "_Mute" +msgstr "" + +#: src/gtk/vba.glade:1162 +msgid "_On" +msgstr "" + +#: src/gtk/vba.glade:1178 +msgid "Echo" +msgstr "" + +#: src/gtk/vba.glade:1187 +msgid "Low pass filter" +msgstr "" + +#: src/gtk/vba.glade:1196 +msgid "Reverse stereo" +msgstr "" + +#: src/gtk/vba.glade:1211 +msgid "Channel _1" +msgstr "" + +#: src/gtk/vba.glade:1220 +msgid "Channel _2" +msgstr "" + +#: src/gtk/vba.glade:1229 +msgid "Channel _3" +msgstr "" + +#: src/gtk/vba.glade:1238 +msgid "Channel _4" +msgstr "" + +#: src/gtk/vba.glade:1247 +msgid "Channel _A" +msgstr "" + +#: src/gtk/vba.glade:1256 +msgid "Channel _B" +msgstr "" + +#: src/gtk/vba.glade:1271 +msgid "11 _Khz" +msgstr "" + +#: src/gtk/vba.glade:1280 +msgid "22 K_hz" +msgstr "" + +#: src/gtk/vba.glade:1290 +msgid "44 Kh_z" +msgstr "" + +#: src/gtk/vba.glade:1306 +msgid "_Volume" +msgstr "" + +#: src/gtk/vba.glade:1354 +msgid "300%" +msgstr "" + +#: src/gtk/vba.glade:1364 +msgid "400%" +msgstr "" + +#: src/gtk/vba.glade:1382 +msgid "_Gameboy" +msgstr "" + +#: src/gtk/vba.glade:1391 +msgid "_Border" +msgstr "" + +#: src/gtk/vba.glade:1400 +msgid "_Printer" +msgstr "" + +#: src/gtk/vba.glade:1424 +msgid "_GBA" +msgstr "" + +#: src/gtk/vba.glade:1434 +msgid "_CGB/GBC" +msgstr "" + +#: src/gtk/vba.glade:1444 +msgid "_SGB" +msgstr "" + +#: src/gtk/vba.glade:1454 +msgid "SGB_2" +msgstr "" + +#: src/gtk/vba.glade:1464 +msgid "G_B" +msgstr "" + +#: src/gtk/vba.glade:1478 +msgid "F_ilter" +msgstr "" + +#: src/gtk/vba.glade:1487 +msgid "Interframe _blending" +msgstr "" + +#: src/gtk/vba.glade:1496 src/gtk/vba.glade:1535 +msgid "_None" +msgstr "" + +#: src/gtk/vba.glade:1505 +msgid "_Smart" +msgstr "" + +#: src/gtk/vba.glade:1515 src/gtk/vba.glade:1594 +msgid "_Motion Blur" +msgstr "" + +#: src/gtk/vba.glade:1544 +msgid "_TV Mode" +msgstr "" + +#: src/gtk/vba.glade:1554 +msgid "_2xSaI" +msgstr "" + +#: src/gtk/vba.glade:1564 +msgid "_Super 2xSaI" +msgstr "" + +#: src/gtk/vba.glade:1574 +msgid "Super _Eagle" +msgstr "" + +#: src/gtk/vba.glade:1584 +msgid "_Pixelate" +msgstr "" + +#: src/gtk/vba.glade:1604 +msgid "_AdvanceMAME 2x" +msgstr "" + +#: src/gtk/vba.glade:1614 +msgid "S_imple 2x" +msgstr "" + +#: src/gtk/vba.glade:1624 +msgid "Bilinea_r" +msgstr "" + +#: src/gtk/vba.glade:1634 +msgid "Bilinear Pl_us" +msgstr "" + +#: src/gtk/vba.glade:1644 +msgid "S_canlines" +msgstr "" + +#: src/gtk/vba.glade:1654 +msgid "h_q2x" +msgstr "" + +#: src/gtk/vba.glade:1664 +msgid "_lq2x" +msgstr "" + +#: src/gtk/vba.glade:1680 +msgid "_Disable MMX" +msgstr "" + +#: src/gtk/vba.glade:1693 +msgid "_Joypad" +msgstr "" + +#: src/gtk/vba.glade:1702 +msgid "_Configure" +msgstr "" + +#: src/gtk/vba.glade:1711 +msgid "_1..." +msgstr "" + +#: src/gtk/vba.glade:1719 +msgid "_2..." +msgstr "" + +#: src/gtk/vba.glade:1727 +msgid "_3..." +msgstr "" + +#: src/gtk/vba.glade:1735 +msgid "_4..." +msgstr "" + +#: src/gtk/vba.glade:1798 +msgid "_Autofire" +msgstr "" + +#: src/gtk/vba.glade:1807 +msgid "_A" +msgstr "" + +#: src/gtk/vba.glade:1817 +msgid "_B" +msgstr "" + +#: src/gtk/vba.glade:1827 +msgid "_L" +msgstr "" + +#: src/gtk/vba.glade:1837 +msgid "_R" +msgstr "" + +#: src/gtk/vba.glade:1859 +msgid "_Tools" +msgstr "" + +#: src/gtk/vba.glade:1868 +msgid "_GDB" +msgstr "" + +#: src/gtk/vba.glade:1877 +msgid "_Wait connection..." +msgstr "" + +#: src/gtk/vba.glade:1885 +msgid "_Load and wait..." +msgstr "" + +#: src/gtk/vba.glade:1893 +msgid "_Break" +msgstr "" + +#: src/gtk/vba.glade:1901 +msgid "_Disconnect" +msgstr "" + +#: src/gtk/vba.glade:1917 +msgid "_Help" +msgstr "" + +#: src/gtk/vba.glade:1926 +msgid "_About" +msgstr "" + +#: src/gtk/vba.glade:1967 +msgid "About VBA" +msgstr "" + +#: src/gtk/vba.glade:2054 +msgid "An emulator for Gameboy(TM) and GameboyAdvance(TM)." +msgstr "" + +#: src/gtk/vba.glade:2076 +msgid "Special thanks to Yann Parmentier aka \"kohai\" for the icons." +msgstr "" + +#: src/gtk/vba.glade:2098 +msgid "" +"Copyright (C) 2004 Forgotten and the VBA development team" +msgstr "" + +#: src/gtk/vba.glade:2120 +msgid "Throttle" +msgstr "" + +#: src/gtk/vba.glade:2191 +msgid "Throttle : " +msgstr "" + +#: src/gtk/vba.glade:2231 +msgid " %" +msgstr "" + +#: src/gtk/vba.glade:2262 +msgid "Directories" +msgstr "" + +#: src/gtk/vba.glade:2328 +msgid "GBA roms : " +msgstr "" + +#: src/gtk/vba.glade:2358 src/gtk/vba.glade:2511 src/gtk/vba.glade:2612 +#: src/gtk/vba.glade:2713 src/gtk/vba.glade:2790 src/gtk/vba.glade:2921 +#: src/gtk/vba.glade:3207 src/gtk/vba.glade:3229 src/gtk/vba.glade:3251 +#: src/gtk/vba.glade:3273 src/gtk/vba.glade:3295 src/gtk/vba.glade:3317 +#: src/gtk/vba.glade:3339 src/gtk/vba.glade:3361 src/gtk/vba.glade:3383 +#: src/gtk/vba.glade:3405 src/gtk/vba.glade:3427 +msgid "*" +msgstr "" + +#: src/gtk/vba.glade:2429 +msgid "GB roms : " +msgstr "" + +#: src/gtk/vba.glade:2481 +msgid "Batteries : " +msgstr "" + +#: src/gtk/vba.glade:2582 +msgid "Saves : " +msgstr "" + +#: src/gtk/vba.glade:2683 +msgid "Captures : " +msgstr "" + +#: src/gtk/vba.glade:2841 +msgid "Joypad config" +msgstr "" + +#: src/gtk/vba.glade:2937 +msgid "Down : " +msgstr "" + +#: src/gtk/vba.glade:2961 +msgid "Left : " +msgstr "" + +#: src/gtk/vba.glade:2985 +msgid "Right : " +msgstr "" + +#: src/gtk/vba.glade:3009 +msgid "Button A : " +msgstr "" + +#: src/gtk/vba.glade:3033 +msgid "Button B : " +msgstr "" + +#: src/gtk/vba.glade:3057 +msgid "Button L : " +msgstr "" + +#: src/gtk/vba.glade:3081 +msgid "Button R : " +msgstr "" + +#: src/gtk/vba.glade:3105 +msgid "Select : " +msgstr "" + +#: src/gtk/vba.glade:3129 +msgid "Start : " +msgstr "" + +#: src/gtk/vba.glade:3153 +msgid "Speed : " +msgstr "" + +#: src/gtk/vba.glade:3177 +msgid "Capture : " +msgstr "" + +#: src/gtk/vba.glade:3443 +msgid "Up : " +msgstr "" + +#: src/gtk/vba.glade:3477 +msgid "TCP port" +msgstr "" + +#: src/gtk/vba.glade:3548 +msgid "Port : " +msgstr "" + +#: src/gtk/windowcallbacks.cpp:80 src/gtk/windowcallbacks.cpp:94 +msgid "Load game" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:109 src/gtk/windowcallbacks.cpp:163 +msgid "VisualBoyAdvance save game" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:131 src/gtk/windowcallbacks.cpp:146 +msgid "Save game" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:181 src/gtk/windowcallbacks.cpp:466 +#: src/gtk/windowcallbacks.cpp:585 +msgid "File already exists. Overwrite it?" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:318 src/gtk/windowcallbacks.cpp:332 +msgid "Import battery file" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:347 src/gtk/windowcallbacks.cpp:424 +msgid "Battery file" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:351 src/gtk/windowcallbacks.cpp:428 +msgid "Flash save" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:362 +msgid "" +"Importing a battery file will erase any saved games and reset the emulator. " +"Do you want to continue?" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:380 +#, c-format +msgid "Failed to import battery file %s." +msgstr "" + +#: src/gtk/windowcallbacks.cpp:392 src/gtk/windowcallbacks.cpp:407 +msgid "Export battery file" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:494 +#, c-format +msgid "Failed to export battery file %s." +msgstr "" + +#: src/gtk/windowcallbacks.cpp:506 src/gtk/windowcallbacks.cpp:521 +msgid "Save screenshot" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:538 +msgid "PNG image" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:542 +msgid "BMP image" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:824 src/gtk/windowcallbacks.cpp:844 +msgid "Select directory" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:872 src/gtk/windowcallbacks.cpp:882 +msgid "Select BIOS file" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:898 +msgid "All files" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:902 +msgid "Gameboy Advance BIOS" +msgstr "" + +#: src/gtk/windowcallbacks.cpp:1336 +msgid "Only GBA images are supported." +msgstr "" + +#: src/gtk/window.cpp:1427 +#, c-format +msgid "Unknown file type %s" +msgstr "" + +#: src/gtk/window.cpp:1708 src/gtk/window.cpp:1722 +msgid "Open" +msgstr "" + +#: src/gtk/window.cpp:1749 +msgid "All Gameboy Advance files" +msgstr "" + +#: src/gtk/window.cpp:1756 +msgid "Gameboy Advance files" +msgstr "" + +#: src/gtk/window.cpp:1763 +msgid "Gameboy files" +msgstr "" + +#: src/gtk/window.cpp:1793 +msgid "Loaded battery" +msgstr "" + +#: src/gtk/window.cpp:1812 +msgid "Saved battery" +msgstr "" + +#: src/gtk/window.cpp:1870 src/gtk/window.cpp:1917 +msgid "----/--/-- --:--:--" +msgstr "" + +#: src/gtk/window.cpp:1902 +msgid "%Y/%m/%d %H:%M:%S" +msgstr "" + +#: src/prof/prof.cpp:143 +msgid "No space for profiling buffer(s)\n" +msgstr "" diff --git a/src/2xSaI.cpp b/src/2xSaI.cpp new file mode 100644 index 0000000..61eb116 --- /dev/null +++ b/src/2xSaI.cpp @@ -0,0 +1,1274 @@ +#include "System.h" +#include "Port.h" + +extern "C" +{ + +#ifdef MMX + void _2xSaILine (u8 *srcPtr, u8 *deltaPtr, u32 srcPitch, + u32 width, u8 *dstPtr, u32 dstPitch); + void _2xSaISuperEagleLine (u8 *srcPtr, u8 *deltaPtr, + u32 srcPitch, u32 width, + u8 *dstPtr, u32 dstPitch); + void _2xSaISuper2xSaILine (u8 *srcPtr, u8 *deltaPtr, + u32 srcPitch, u32 width, + u8 *dstPtr, u32 dstPitch); + void Init_2xSaIMMX (u32 BitFormat); + void BilinearMMX (u16 * A, u16 * B, u16 * C, u16 * D, + u16 * dx, u16 * dy, u8 *dP); + void BilinearMMXGrid0 (u16 * A, u16 * B, u16 * C, u16 * D, + u16 * dx, u16 * dy, u8 *dP); + void BilinearMMXGrid1 (u16 * A, u16 * B, u16 * C, u16 * D, + u16 * dx, u16 * dy, u8 *dP); + void EndMMX (); + + bool cpu_mmx = 1; +#endif +} +static u32 colorMask = 0xF7DEF7DE; +static u32 lowPixelMask = 0x08210821; +static u32 qcolorMask = 0xE79CE79C; +static u32 qlowpixelMask = 0x18631863; +static u32 redblueMask = 0xF81F; +static u32 greenMask = 0x7E0; + +u32 qRGB_COLOR_MASK[2] = { 0xF7DEF7DE, 0xF7DEF7DE }; + +extern void hq2x_init(unsigned); + +int Init_2xSaI(u32 BitFormat) +{ + if(systemColorDepth == 16) { + if (BitFormat == 565) { + colorMask = 0xF7DEF7DE; + lowPixelMask = 0x08210821; + qcolorMask = 0xE79CE79C; + qlowpixelMask = 0x18631863; + redblueMask = 0xF81F; + greenMask = 0x7E0; + qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xF7DEF7DE; + hq2x_init(16); + } else if (BitFormat == 555) { + colorMask = 0x7BDE7BDE; + lowPixelMask = 0x04210421; + qcolorMask = 0x739C739C; + qlowpixelMask = 0x0C630C63; + redblueMask = 0x7C1F; + greenMask = 0x3E0; + qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0x7BDE7BDE; + hq2x_init(15); + } else { + return 0; + } + } else if(systemColorDepth == 32) { + colorMask = 0xfefefe; + lowPixelMask = 0x010101; + qcolorMask = 0xfcfcfc; + qlowpixelMask = 0x030303; + qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xfefefe; + hq2x_init(32); + } else + return 0; + +#ifdef MMX + Init_2xSaIMMX (BitFormat); +#endif + + return 1; +} + +static inline int GetResult1 (u32 A, u32 B, u32 C, u32 D, + u32 /* E */) +{ + int x = 0; + int y = 0; + int r = 0; + + if (A == C) + x += 1; + else if (B == C) + y += 1; + if (A == D) + x += 1; + else if (B == D) + y += 1; + if (x <= 1) + r += 1; + if (y <= 1) + r -= 1; + return r; +} + +static inline int GetResult2 (u32 A, u32 B, u32 C, u32 D, + u32 /* E */) +{ + int x = 0; + int y = 0; + int r = 0; + + if (A == C) + x += 1; + else if (B == C) + y += 1; + if (A == D) + x += 1; + else if (B == D) + y += 1; + if (x <= 1) + r -= 1; + if (y <= 1) + r += 1; + return r; +} + +static inline int GetResult (u32 A, u32 B, u32 C, u32 D) +{ + int x = 0; + int y = 0; + int r = 0; + + if (A == C) + x += 1; + else if (B == C) + y += 1; + if (A == D) + x += 1; + else if (B == D) + y += 1; + if (x <= 1) + r += 1; + if (y <= 1) + r -= 1; + return r; +} + +static inline u32 INTERPOLATE (u32 A, u32 B) +{ + if (A != B) { + return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + + (A & B & lowPixelMask)); + } else + return A; +} + +static inline u32 Q_INTERPOLATE (u32 A, u32 B, u32 C, u32 D) +{ + register u32 x = ((A & qcolorMask) >> 2) + + ((B & qcolorMask) >> 2) + + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); + register u32 y = (A & qlowpixelMask) + + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); + + y = (y >> 2) & qlowpixelMask; + return x + y; +} + +static inline int GetResult1_32 (u32 A, u32 B, u32 C, u32 D, + u32 /* E */) +{ + int x = 0; + int y = 0; + int r = 0; + + if (A == C) + x += 1; + else if (B == C) + y += 1; + if (A == D) + x += 1; + else if (B == D) + y += 1; + if (x <= 1) + r += 1; + if (y <= 1) + r -= 1; + return r; +} + +static inline int GetResult2_32 (u32 A, u32 B, u32 C, u32 D, + u32 /* E */) +{ + int x = 0; + int y = 0; + int r = 0; + + if (A == C) + x += 1; + else if (B == C) + y += 1; + if (A == D) + x += 1; + else if (B == D) + y += 1; + if (x <= 1) + r -= 1; + if (y <= 1) + r += 1; + return r; +} + +#define BLUE_MASK565 0x001F001F +#define RED_MASK565 0xF800F800 +#define GREEN_MASK565 0x07E007E0 + +#define BLUE_MASK555 0x001F001F +#define RED_MASK555 0x7C007C00 +#define GREEN_MASK555 0x03E003E0 + +void Super2xSaI (u8 *srcPtr, u32 srcPitch, + u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, + int width, int height) +{ + u16 *bP; + u8 *dP; + u32 inc_bP; + u32 Nextline = srcPitch >> 1; +#ifdef MMX + if (cpu_mmx) { + for (; height; height--) { + _2xSaISuper2xSaILine (srcPtr, deltaPtr, srcPitch, width, + dstPtr, dstPitch); + srcPtr += srcPitch; + dstPtr += dstPitch * 2; + deltaPtr += srcPitch; + } + } else +#endif + { + inc_bP = 1; + + for (; height; height--) { + bP = (u16 *) srcPtr; + dP = (u8 *) dstPtr; + + for (u32 finish = width; finish; finish -= inc_bP) { + u32 color4, color5, color6; + u32 color1, color2, color3; + u32 colorA0, colorA1, colorA2, colorA3, + colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; + u32 product1a, product1b, product2a, product2b; + + //--------------------------------------- B1 B2 + // 4 5 6 S2 + // 1 2 3 S1 + // A1 A2 + + colorB0 = *(bP - Nextline - 1); + colorB1 = *(bP - Nextline); + colorB2 = *(bP - Nextline + 1); + colorB3 = *(bP - Nextline + 2); + + color4 = *(bP - 1); + color5 = *(bP); + color6 = *(bP + 1); + colorS2 = *(bP + 2); + + color1 = *(bP + Nextline - 1); + color2 = *(bP + Nextline); + color3 = *(bP + Nextline + 1); + colorS1 = *(bP + Nextline + 2); + + colorA0 = *(bP + Nextline + Nextline - 1); + colorA1 = *(bP + Nextline + Nextline); + colorA2 = *(bP + Nextline + Nextline + 1); + colorA3 = *(bP + Nextline + Nextline + 2); + + //-------------------------------------- + if (color2 == color6 && color5 != color3) { + product2b = product1b = color2; + } else if (color5 == color3 && color2 != color6) { + product2b = product1b = color5; + } else if (color5 == color3 && color2 == color6) { + register int r = 0; + + r += GetResult (color6, color5, color1, colorA1); + r += GetResult (color6, color5, color4, colorB1); + r += GetResult (color6, color5, colorA2, colorS1); + r += GetResult (color6, color5, colorB2, colorS2); + + if (r > 0) + product2b = product1b = color6; + else if (r < 0) + product2b = product1b = color5; + else { + product2b = product1b = INTERPOLATE (color5, color6); + } + } else { + if (color6 == color3 && color3 == colorA1 + && color2 != colorA2 && color3 != colorA0) + product2b = + Q_INTERPOLATE (color3, color3, color3, color2); + else if (color5 == color2 && color2 == colorA2 + && colorA1 != color3 && color2 != colorA3) + product2b = + Q_INTERPOLATE (color2, color2, color2, color3); + else + product2b = INTERPOLATE (color2, color3); + + if (color6 == color3 && color6 == colorB1 + && color5 != colorB2 && color6 != colorB0) + product1b = + Q_INTERPOLATE (color6, color6, color6, color5); + else if (color5 == color2 && color5 == colorB2 + && colorB1 != color6 && color5 != colorB3) + product1b = + Q_INTERPOLATE (color6, color5, color5, color5); + else + product1b = INTERPOLATE (color5, color6); + } + + if (color5 == color3 && color2 != color6 && color4 == color5 + && color5 != colorA2) + product2a = INTERPOLATE (color2, color5); + else + if (color5 == color1 && color6 == color5 + && color4 != color2 && color5 != colorA0) + product2a = INTERPOLATE (color2, color5); + else + product2a = color2; + + if (color2 == color6 && color5 != color3 && color1 == color2 + && color2 != colorB2) + product1a = INTERPOLATE (color2, color5); + else + if (color4 == color2 && color3 == color2 + && color1 != color5 && color2 != colorB0) + product1a = INTERPOLATE (color2, color5); + else + product1a = color5; + +#ifdef WORDS_BIGENDIAN + product1a = (product1a << 16) | product1b; + product2a = (product2a << 16) | product2b; +#else + product1a = product1a | (product1b << 16); + product2a = product2a | (product2b << 16); +#endif + + *((u32 *) dP) = product1a; + *((u32 *) (dP + dstPitch)) = product2a; + + bP += inc_bP; + dP += sizeof (u32); + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + deltaPtr += srcPitch; + } // endof: for (; height; height--) + } +} + +void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, + u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, + int width, int height) +{ + u32 *bP; + u32 *dP; + u32 inc_bP; + u32 Nextline = srcPitch >> 2; + inc_bP = 1; + + for (; height; height--) { + bP = (u32 *) srcPtr; + dP = (u32 *) dstPtr; + + for (u32 finish = width; finish; finish -= inc_bP) { + u32 color4, color5, color6; + u32 color1, color2, color3; + u32 colorA0, colorA1, colorA2, colorA3, + colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; + u32 product1a, product1b, product2a, product2b; + + //--------------------------------------- B1 B2 + // 4 5 6 S2 + // 1 2 3 S1 + // A1 A2 + + colorB0 = *(bP - Nextline - 1); + colorB1 = *(bP - Nextline); + colorB2 = *(bP - Nextline + 1); + colorB3 = *(bP - Nextline + 2); + + color4 = *(bP - 1); + color5 = *(bP); + color6 = *(bP + 1); + colorS2 = *(bP + 2); + + color1 = *(bP + Nextline - 1); + color2 = *(bP + Nextline); + color3 = *(bP + Nextline + 1); + colorS1 = *(bP + Nextline + 2); + + colorA0 = *(bP + Nextline + Nextline - 1); + colorA1 = *(bP + Nextline + Nextline); + colorA2 = *(bP + Nextline + Nextline + 1); + colorA3 = *(bP + Nextline + Nextline + 2); + + //-------------------------------------- + if (color2 == color6 && color5 != color3) { + product2b = product1b = color2; + } else if (color5 == color3 && color2 != color6) { + product2b = product1b = color5; + } else if (color5 == color3 && color2 == color6) { + register int r = 0; + + r += GetResult (color6, color5, color1, colorA1); + r += GetResult (color6, color5, color4, colorB1); + r += GetResult (color6, color5, colorA2, colorS1); + r += GetResult (color6, color5, colorB2, colorS2); + + if (r > 0) + product2b = product1b = color6; + else if (r < 0) + product2b = product1b = color5; + else { + product2b = product1b = INTERPOLATE (color5, color6); + } + } else { + if (color6 == color3 && color3 == colorA1 + && color2 != colorA2 && color3 != colorA0) + product2b = + Q_INTERPOLATE (color3, color3, color3, color2); + else if (color5 == color2 && color2 == colorA2 + && colorA1 != color3 && color2 != colorA3) + product2b = + Q_INTERPOLATE (color2, color2, color2, color3); + else + product2b = INTERPOLATE (color2, color3); + + if (color6 == color3 && color6 == colorB1 + && color5 != colorB2 && color6 != colorB0) + product1b = + Q_INTERPOLATE (color6, color6, color6, color5); + else if (color5 == color2 && color5 == colorB2 + && colorB1 != color6 && color5 != colorB3) + product1b = + Q_INTERPOLATE (color6, color5, color5, color5); + else + product1b = INTERPOLATE (color5, color6); + } + + if (color5 == color3 && color2 != color6 && color4 == color5 + && color5 != colorA2) + product2a = INTERPOLATE (color2, color5); + else + if (color5 == color1 && color6 == color5 + && color4 != color2 && color5 != colorA0) + product2a = INTERPOLATE (color2, color5); + else + product2a = color2; + + if (color2 == color6 && color5 != color3 && color1 == color2 + && color2 != colorB2) + product1a = INTERPOLATE (color2, color5); + else + if (color4 == color2 && color3 == color2 + && color1 != color5 && color2 != colorB0) + product1a = INTERPOLATE (color2, color5); + else + product1a = color5; + *(dP) = product1a; + *(dP+1) = product1b; + *(dP + (dstPitch >> 2)) = product2a; + *(dP + (dstPitch >> 2) + 1) = product2b; + + bP += inc_bP; + dP += 2; + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + // deltaPtr += srcPitch; + } // endof: for (; height; height--) +} + +void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *dP; + u16 *bP; + u16 *xP; + u32 inc_bP; + +#ifdef MMX + if (cpu_mmx) { + for (; height; height--) { + _2xSaISuperEagleLine (srcPtr, deltaPtr, srcPitch, width, + dstPtr, dstPitch); + srcPtr += srcPitch; + dstPtr += dstPitch * 2; + deltaPtr += srcPitch; + } + } else +#endif + { + inc_bP = 1; + + u32 Nextline = srcPitch >> 1; + + for (; height; height--) { + bP = (u16 *) srcPtr; + xP = (u16 *) deltaPtr; + dP = dstPtr; + for (u32 finish = width; finish; finish -= inc_bP) { + u32 color4, color5, color6; + u32 color1, color2, color3; + u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; + u32 product1a, product1b, product2a, product2b; + + colorB1 = *(bP - Nextline); + colorB2 = *(bP - Nextline + 1); + + color4 = *(bP - 1); + color5 = *(bP); + color6 = *(bP + 1); + colorS2 = *(bP + 2); + + color1 = *(bP + Nextline - 1); + color2 = *(bP + Nextline); + color3 = *(bP + Nextline + 1); + colorS1 = *(bP + Nextline + 2); + + colorA1 = *(bP + Nextline + Nextline); + colorA2 = *(bP + Nextline + Nextline + 1); + + // -------------------------------------- + if (color2 == color6 && color5 != color3) { + product1b = product2a = color2; + if ((color1 == color2) || (color6 == colorB2)) { + product1a = INTERPOLATE (color2, color5); + product1a = INTERPOLATE (color2, product1a); + // product1a = color2; + } else { + product1a = INTERPOLATE (color5, color6); + } + + if ((color6 == colorS2) || (color2 == colorA1)) { + product2b = INTERPOLATE (color2, color3); + product2b = INTERPOLATE (color2, product2b); + // product2b = color2; + } else { + product2b = INTERPOLATE (color2, color3); + } + } else if (color5 == color3 && color2 != color6) { + product2b = product1a = color5; + + if ((colorB1 == color5) || (color3 == colorS1)) { + product1b = INTERPOLATE (color5, color6); + product1b = INTERPOLATE (color5, product1b); + // product1b = color5; + } else { + product1b = INTERPOLATE (color5, color6); + } + + if ((color3 == colorA2) || (color4 == color5)) { + product2a = INTERPOLATE (color5, color2); + product2a = INTERPOLATE (color5, product2a); + // product2a = color5; + } else { + product2a = INTERPOLATE (color2, color3); + } + + } else if (color5 == color3 && color2 == color6) { + register int r = 0; + + r += GetResult (color6, color5, color1, colorA1); + r += GetResult (color6, color5, color4, colorB1); + r += GetResult (color6, color5, colorA2, colorS1); + r += GetResult (color6, color5, colorB2, colorS2); + + if (r > 0) { + product1b = product2a = color2; + product1a = product2b = INTERPOLATE (color5, color6); + } else if (r < 0) { + product2b = product1a = color5; + product1b = product2a = INTERPOLATE (color5, color6); + } else { + product2b = product1a = color5; + product1b = product2a = color2; + } + } else { + product2b = product1a = INTERPOLATE (color2, color6); + product2b = + Q_INTERPOLATE (color3, color3, color3, product2b); + product1a = + Q_INTERPOLATE (color5, color5, color5, product1a); + + product2a = product1b = INTERPOLATE (color5, color3); + product2a = + Q_INTERPOLATE (color2, color2, color2, product2a); + product1b = + Q_INTERPOLATE (color6, color6, color6, product1b); + + // product1a = color5; + // product1b = color6; + // product2a = color2; + // product2b = color3; + } +#ifdef WORDS_BIGENDIAN + product1a = (product1a << 16) | product1b; + product2a = (product2a << 16) | product2b; +#else + product1a = product1a | (product1b << 16); + product2a = product2a | (product2b << 16); +#endif + + *((u32 *) dP) = product1a; + *((u32 *) (dP + dstPitch)) = product2a; + *xP = color5; + + bP += inc_bP; + xP += inc_bP; + dP += sizeof (u32); + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + deltaPtr += srcPitch; + } // endof: for (height; height; height--) + } +} + +void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dP; + u32 *bP; + u32 *xP; + u32 inc_bP; + + inc_bP = 1; + + u32 Nextline = srcPitch >> 2; + + for (; height; height--) { + bP = (u32 *) srcPtr; + xP = (u32 *) deltaPtr; + dP = (u32 *)dstPtr; + for (u32 finish = width; finish; finish -= inc_bP) { + u32 color4, color5, color6; + u32 color1, color2, color3; + u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2; + u32 product1a, product1b, product2a, product2b; + + colorB1 = *(bP - Nextline); + colorB2 = *(bP - Nextline + 1); + + color4 = *(bP - 1); + color5 = *(bP); + color6 = *(bP + 1); + colorS2 = *(bP + 2); + + color1 = *(bP + Nextline - 1); + color2 = *(bP + Nextline); + color3 = *(bP + Nextline + 1); + colorS1 = *(bP + Nextline + 2); + + colorA1 = *(bP + Nextline + Nextline); + colorA2 = *(bP + Nextline + Nextline + 1); + + // -------------------------------------- + if (color2 == color6 && color5 != color3) { + product1b = product2a = color2; + if ((color1 == color2) || (color6 == colorB2)) { + product1a = INTERPOLATE (color2, color5); + product1a = INTERPOLATE (color2, product1a); + // product1a = color2; + } else { + product1a = INTERPOLATE (color5, color6); + } + + if ((color6 == colorS2) || (color2 == colorA1)) { + product2b = INTERPOLATE (color2, color3); + product2b = INTERPOLATE (color2, product2b); + // product2b = color2; + } else { + product2b = INTERPOLATE (color2, color3); + } + } else if (color5 == color3 && color2 != color6) { + product2b = product1a = color5; + + if ((colorB1 == color5) || (color3 == colorS1)) { + product1b = INTERPOLATE (color5, color6); + product1b = INTERPOLATE (color5, product1b); + // product1b = color5; + } else { + product1b = INTERPOLATE (color5, color6); + } + + if ((color3 == colorA2) || (color4 == color5)) { + product2a = INTERPOLATE (color5, color2); + product2a = INTERPOLATE (color5, product2a); + // product2a = color5; + } else { + product2a = INTERPOLATE (color2, color3); + } + + } else if (color5 == color3 && color2 == color6) { + register int r = 0; + + r += GetResult (color6, color5, color1, colorA1); + r += GetResult (color6, color5, color4, colorB1); + r += GetResult (color6, color5, colorA2, colorS1); + r += GetResult (color6, color5, colorB2, colorS2); + + if (r > 0) { + product1b = product2a = color2; + product1a = product2b = INTERPOLATE (color5, color6); + } else if (r < 0) { + product2b = product1a = color5; + product1b = product2a = INTERPOLATE (color5, color6); + } else { + product2b = product1a = color5; + product1b = product2a = color2; + } + } else { + product2b = product1a = INTERPOLATE (color2, color6); + product2b = + Q_INTERPOLATE (color3, color3, color3, product2b); + product1a = + Q_INTERPOLATE (color5, color5, color5, product1a); + + product2a = product1b = INTERPOLATE (color5, color3); + product2a = + Q_INTERPOLATE (color2, color2, color2, product2a); + product1b = + Q_INTERPOLATE (color6, color6, color6, product1b); + + // product1a = color5; + // product1b = color6; + // product2a = color2; + // product2b = color3; + } + *(dP) = product1a; + *(dP+1) = product1b; + *(dP + (dstPitch >> 2)) = product2a; + *(dP + (dstPitch >> 2) +1) = product2b; + *xP = color5; + + bP += inc_bP; + xP += inc_bP; + dP += 2; + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + deltaPtr += srcPitch; + } // endof: for (height; height; height--) +} + +void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *dP; + u16 *bP; + u32 inc_bP; + +#ifdef MMX + if (cpu_mmx) { + for (; height; height -= 1) { + _2xSaILine (srcPtr, deltaPtr, srcPitch, width, dstPtr, dstPitch); + srcPtr += srcPitch; + dstPtr += dstPitch * 2; + deltaPtr += srcPitch; + } + } else +#endif + { + inc_bP = 1; + + u32 Nextline = srcPitch >> 1; + + for (; height; height--) { + bP = (u16 *) srcPtr; + dP = dstPtr; + + for (u32 finish = width; finish; finish -= inc_bP) { + + register u32 colorA, colorB; + u32 colorC, colorD, + colorE, colorF, colorG, colorH, + colorI, colorJ, colorK, colorL, + + colorM, colorN, colorO, colorP; + u32 product, product1, product2; + + //--------------------------------------- + // Map of the pixels: I|E F|J + // G|A B|K + // H|C D|L + // M|N O|P + colorI = *(bP - Nextline - 1); + colorE = *(bP - Nextline); + colorF = *(bP - Nextline + 1); + colorJ = *(bP - Nextline + 2); + + colorG = *(bP - 1); + colorA = *(bP); + colorB = *(bP + 1); + colorK = *(bP + 2); + + colorH = *(bP + Nextline - 1); + colorC = *(bP + Nextline); + colorD = *(bP + Nextline + 1); + colorL = *(bP + Nextline + 2); + + colorM = *(bP + Nextline + Nextline - 1); + colorN = *(bP + Nextline + Nextline); + colorO = *(bP + Nextline + Nextline + 1); + colorP = *(bP + Nextline + Nextline + 2); + + if ((colorA == colorD) && (colorB != colorC)) { + if (((colorA == colorE) && (colorB == colorL)) || + ((colorA == colorC) && (colorA == colorF) + && (colorB != colorE) && (colorB == colorJ))) { + product = colorA; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if (((colorA == colorG) && (colorC == colorO)) || + ((colorA == colorB) && (colorA == colorH) + && (colorG != colorC) && (colorC == colorM))) { + product1 = colorA; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + product2 = colorA; + } else if ((colorB == colorC) && (colorA != colorD)) { + if (((colorB == colorF) && (colorA == colorH)) || + ((colorB == colorE) && (colorB == colorD) + && (colorA != colorF) && (colorA == colorI))) { + product = colorB; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if (((colorC == colorH) && (colorA == colorF)) || + ((colorC == colorG) && (colorC == colorD) + && (colorA != colorH) && (colorA == colorI))) { + product1 = colorC; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + product2 = colorB; + } else if ((colorA == colorD) && (colorB == colorC)) { + if (colorA == colorB) { + product = colorA; + product1 = colorA; + product2 = colorA; + } else { + register int r = 0; + + product1 = INTERPOLATE (colorA, colorC); + product = INTERPOLATE (colorA, colorB); + + r += + GetResult1 (colorA, colorB, colorG, colorE, + colorI); + r += + GetResult2 (colorB, colorA, colorK, colorF, + colorJ); + r += + GetResult2 (colorB, colorA, colorH, colorN, + colorM); + r += + GetResult1 (colorA, colorB, colorL, colorO, + colorP); + + if (r > 0) + product2 = colorA; + else if (r < 0) + product2 = colorB; + else { + product2 = + Q_INTERPOLATE (colorA, colorB, colorC, + colorD); + } + } + } else { + product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD); + + if ((colorA == colorC) && (colorA == colorF) + && (colorB != colorE) && (colorB == colorJ)) { + product = colorA; + } else if ((colorB == colorE) && (colorB == colorD) + && (colorA != colorF) && (colorA == colorI)) { + product = colorB; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if ((colorA == colorB) && (colorA == colorH) + && (colorG != colorC) && (colorC == colorM)) { + product1 = colorA; + } else if ((colorC == colorG) && (colorC == colorD) + && (colorA != colorH) && (colorA == colorI)) { + product1 = colorC; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + } + +#ifdef WORDS_BIGENDIAN + product = (colorA << 16) | product ; + product1 = (product1 << 16) | product2 ; +#else + product = colorA | (product << 16); + product1 = product1 | (product2 << 16); +#endif + *((s32 *) dP) = product; + *((u32 *) (dP + dstPitch)) = product1; + + bP += inc_bP; + dP += sizeof (u32); + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + deltaPtr += srcPitch; + } // endof: for (height; height; height--) + } +} + +void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dP; + u32 *bP; + u32 inc_bP = 1; + + u32 Nextline = srcPitch >> 2; + + for (; height; height--) { + bP = (u32 *) srcPtr; + dP = (u32 *) dstPtr; + + for (u32 finish = width; finish; finish -= inc_bP) { + register u32 colorA, colorB; + u32 colorC, colorD, + colorE, colorF, colorG, colorH, + colorI, colorJ, colorK, colorL, + + colorM, colorN, colorO, colorP; + u32 product, product1, product2; + + //--------------------------------------- + // Map of the pixels: I|E F|J + // G|A B|K + // H|C D|L + // M|N O|P + colorI = *(bP - Nextline - 1); + colorE = *(bP - Nextline); + colorF = *(bP - Nextline + 1); + colorJ = *(bP - Nextline + 2); + + colorG = *(bP - 1); + colorA = *(bP); + colorB = *(bP + 1); + colorK = *(bP + 2); + + colorH = *(bP + Nextline - 1); + colorC = *(bP + Nextline); + colorD = *(bP + Nextline + 1); + colorL = *(bP + Nextline + 2); + + colorM = *(bP + Nextline + Nextline - 1); + colorN = *(bP + Nextline + Nextline); + colorO = *(bP + Nextline + Nextline + 1); + colorP = *(bP + Nextline + Nextline + 2); + + if ((colorA == colorD) && (colorB != colorC)) { + if (((colorA == colorE) && (colorB == colorL)) || + ((colorA == colorC) && (colorA == colorF) + && (colorB != colorE) && (colorB == colorJ))) { + product = colorA; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if (((colorA == colorG) && (colorC == colorO)) || + ((colorA == colorB) && (colorA == colorH) + && (colorG != colorC) && (colorC == colorM))) { + product1 = colorA; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + product2 = colorA; + } else if ((colorB == colorC) && (colorA != colorD)) { + if (((colorB == colorF) && (colorA == colorH)) || + ((colorB == colorE) && (colorB == colorD) + && (colorA != colorF) && (colorA == colorI))) { + product = colorB; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if (((colorC == colorH) && (colorA == colorF)) || + ((colorC == colorG) && (colorC == colorD) + && (colorA != colorH) && (colorA == colorI))) { + product1 = colorC; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + product2 = colorB; + } else if ((colorA == colorD) && (colorB == colorC)) { + if (colorA == colorB) { + product = colorA; + product1 = colorA; + product2 = colorA; + } else { + register int r = 0; + + product1 = INTERPOLATE (colorA, colorC); + product = INTERPOLATE (colorA, colorB); + + r += + GetResult1 (colorA, colorB, colorG, colorE, + colorI); + r += + GetResult2 (colorB, colorA, colorK, colorF, + colorJ); + r += + GetResult2 (colorB, colorA, colorH, colorN, + colorM); + r += + GetResult1 (colorA, colorB, colorL, colorO, + colorP); + + if (r > 0) + product2 = colorA; + else if (r < 0) + product2 = colorB; + else { + product2 = + Q_INTERPOLATE (colorA, colorB, colorC, + colorD); + } + } + } else { + product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD); + + if ((colorA == colorC) && (colorA == colorF) + && (colorB != colorE) && (colorB == colorJ)) { + product = colorA; + } else if ((colorB == colorE) && (colorB == colorD) + && (colorA != colorF) && (colorA == colorI)) { + product = colorB; + } else { + product = INTERPOLATE (colorA, colorB); + } + + if ((colorA == colorB) && (colorA == colorH) + && (colorG != colorC) && (colorC == colorM)) { + product1 = colorA; + } else if ((colorC == colorG) && (colorC == colorD) + && (colorA != colorH) && (colorA == colorI)) { + product1 = colorC; + } else { + product1 = INTERPOLATE (colorA, colorC); + } + } + *(dP) = colorA; + *(dP + 1) = product; + *(dP + (dstPitch >> 2)) = product1; + *(dP + (dstPitch >> 2) + 1) = product2; + + bP += inc_bP; + dP += 2; + } // end of for ( finish= width etc..) + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + // deltaPtr += srcPitch; + } // endof: for (height; height; height--) +} + +static u32 Bilinear (u32 A, u32 B, u32 x) +{ + unsigned long areaA, areaB; + unsigned long result; + + if (A == B) + return A; + + areaB = (x >> 11) & 0x1f; // reduce 16 bit fraction to 5 bits + areaA = 0x20 - areaB; + + A = (A & redblueMask) | ((A & greenMask) << 16); + B = (B & redblueMask) | ((B & greenMask) << 16); + + result = ((areaA * A) + (areaB * B)) >> 5; + + return (result & redblueMask) | ((result >> 16) & greenMask); +} + +static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x, + u32 y) +{ + unsigned long areaA, areaB, areaC, areaD; + unsigned long result, xy; + + x = (x >> 11) & 0x1f; + y = (y >> 11) & 0x1f; + xy = (x * y) >> 5; + + A = (A & redblueMask) | ((A & greenMask) << 16); + B = (B & redblueMask) | ((B & greenMask) << 16); + C = (C & redblueMask) | ((C & greenMask) << 16); + D = (D & redblueMask) | ((D & greenMask) << 16); + + areaA = 0x20 + xy - x - y; + areaB = x - xy; + areaC = y - xy; + areaD = xy; + + result = ((areaA * A) + (areaB * B) + (areaC * C) + (areaD * D)) >> 5; + + return (result & redblueMask) | ((result >> 16) & greenMask); +} + +void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, + u32 dstWidth, u32 dstHeight, int width, int height) +{ + u8 *dP; + u16 *bP; + + u32 w; + u32 h; + u32 dw; + u32 dh; + u32 hfinish; + u32 wfinish; + + u32 Nextline = srcPitch >> 1; + + wfinish = (width - 1) << 16; // convert to fixed point + dw = wfinish / (dstWidth - 1); + hfinish = (height - 1) << 16; // convert to fixed point + dh = hfinish / (dstHeight - 1); + + for (h = 0; h < hfinish; h += dh) { + u32 y1, y2; + + y1 = h & 0xffff; // fraction part of fixed point + bP = (u16 *) (srcPtr + ((h >> 16) * srcPitch)); + dP = dstPtr; + y2 = 0x10000 - y1; + + w = 0; + + for (; w < wfinish;) { + u32 A, B, C, D; + u32 E, F, G, H; + u32 I, J, K, L; + u32 x1, x2, a1, f1, f2; + u32 position, product1; + + position = w >> 16; + A = bP[position]; // current pixel + B = bP[position + 1]; // next pixel + C = bP[position + Nextline]; + D = bP[position + Nextline + 1]; + E = bP[position - Nextline]; + F = bP[position - Nextline + 1]; + G = bP[position - 1]; + H = bP[position + Nextline - 1]; + I = bP[position + 2]; + J = bP[position + Nextline + 2]; + K = bP[position + Nextline + Nextline]; + L = bP[position + Nextline + Nextline + 1]; + + x1 = w & 0xffff; // fraction part of fixed point + x2 = 0x10000 - x1; + + /*0*/ + if (A == B && C == D && A == C) + product1 = A; + else /*1*/ if (A == D && B != C) { + f1 = (x1 >> 1) + (0x10000 >> 2); + f2 = (y1 >> 1) + (0x10000 >> 2); + if (y1 <= f1 && A == J && A != E) // close to B + { + a1 = f1 - y1; + product1 = Bilinear (A, B, a1); + } else if (y1 >= f1 && A == G && A != L) // close to C + { + a1 = y1 - f1; + product1 = Bilinear (A, C, a1); + } + else if (x1 >= f2 && A == E && A != J) // close to B + { + a1 = x1 - f2; + product1 = Bilinear (A, B, a1); + } + else if (x1 <= f2 && A == L && A != G) // close to C + { + a1 = f2 - x1; + product1 = Bilinear (A, C, a1); + } + else if (y1 >= x1) // close to C + { + a1 = y1 - x1; + product1 = Bilinear (A, C, a1); + } + else if (y1 <= x1) // close to B + { + a1 = x1 - y1; + product1 = Bilinear (A, B, a1); + } + } + else + /*2*/ + if (B == C && A != D) + { + f1 = (x1 >> 1) + (0x10000 >> 2); + f2 = (y1 >> 1) + (0x10000 >> 2); + if (y2 >= f1 && B == H && B != F) // close to A + { + a1 = y2 - f1; + product1 = Bilinear (B, A, a1); + } + else if (y2 <= f1 && B == I && B != K) // close to D + { + a1 = f1 - y2; + product1 = Bilinear (B, D, a1); + } + else if (x2 >= f2 && B == F && B != H) // close to A + { + a1 = x2 - f2; + product1 = Bilinear (B, A, a1); + } + else if (x2 <= f2 && B == K && B != I) // close to D + { + a1 = f2 - x2; + product1 = Bilinear (B, D, a1); + } + else if (y2 >= x1) // close to A + { + a1 = y2 - x1; + product1 = Bilinear (B, A, a1); + } + else if (y2 <= x1) // close to D + { + a1 = x1 - y2; + product1 = Bilinear (B, D, a1); + } + } + /*3*/ + else + { + product1 = Bilinear4 (A, B, C, D, x1, y1); + } + + //end First Pixel + *(u32 *) dP = product1; + dP += 2; + w += dw; + } + dstPtr += dstPitch; + } +} + diff --git a/src/AutoBuild.h b/src/AutoBuild.h new file mode 100644 index 0000000..33d813b --- /dev/null +++ b/src/AutoBuild.h @@ -0,0 +1,31 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __AUTOBUILD_H__ +#define __AUTOBUILD_H__ +#ifndef VERSION +#define VERSION "1.7.2 re-recording v19.4" +#endif +//change the FALSE to TRUE for autoincrement of build number +#define INCREMENT_VERSION FALSE +#define FILEVER 1,7,2,560 +#define PRODUCTVER 1,7,2,560 +#define STRFILEVER "1, 7, 2, 560\0" +#define STRPRODUCTVER "1, 7, 2, 560\0" +#endif //__AUTOBUILD_H__ diff --git a/src/CheatSearch.cpp b/src/CheatSearch.cpp new file mode 100644 index 0000000..ca344ab --- /dev/null +++ b/src/CheatSearch.cpp @@ -0,0 +1,329 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include + +#include "CheatSearch.h" + +CheatSearchBlock cheatSearchBlocks[4]; + +CheatSearchData cheatSearchData = { + 0, + cheatSearchBlocks +}; + +static bool cheatSearchEQ(u32 a, u32 b) +{ + return a == b; +} + +static bool cheatSearchNE(u32 a, u32 b) +{ + return a != b; +} + +static bool cheatSearchLT(u32 a, u32 b) +{ + return a < b; +} + +static bool cheatSearchLE(u32 a, u32 b) +{ + return a <= b; +} + +static bool cheatSearchGT(u32 a, u32 b) +{ + return a > b; +} + +static bool cheatSearchGE(u32 a, u32 b) +{ + return a >= b; +} + +static bool cheatSearchSignedEQ(s32 a, s32 b) +{ + return a == b; +} + +static bool cheatSearchSignedNE(s32 a, s32 b) +{ + return a != b; +} + +static bool cheatSearchSignedLT(s32 a, s32 b) +{ + return a < b; +} + +static bool cheatSearchSignedLE(s32 a, s32 b) +{ + return a <= b; +} + +static bool cheatSearchSignedGT(s32 a, s32 b) +{ + return a > b; +} + +static bool cheatSearchSignedGE(s32 a, s32 b) +{ + return a >= b; +} + +static bool (*cheatSearchFunc[])(u32,u32) = { + cheatSearchEQ, + cheatSearchNE, + cheatSearchLT, + cheatSearchLE, + cheatSearchGT, + cheatSearchGE +}; + +static bool (*cheatSearchSignedFunc[])(s32,s32) = { + cheatSearchSignedEQ, + cheatSearchSignedNE, + cheatSearchSignedLT, + cheatSearchSignedLE, + cheatSearchSignedGT, + cheatSearchSignedGE +}; + +void cheatSearchCleanup(CheatSearchData *cs) +{ + int count = cs->count; + + for(int i = 0; i < count; i++) { + free(cs->blocks[i].saved); + free(cs->blocks[i].bits); + } + cs->count = 0; +} + +void cheatSearchStart(const CheatSearchData *cs) +{ + int count = cs->count; + + for(int i = 0; i < count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + + memset(block->bits, 0xff, block->size >> 3); + memcpy(block->saved, block->data, block->size); + } +} + +s32 cheatSearchSignedRead(u8 *data, int off, int size) +{ + u32 res = data[off++]; + + switch(size) { + case BITS_8: + res <<= 24; + return ((s32)res) >> 24; + case BITS_16: + res |= ((u32)data[off++])<<8; + res <<= 16; + return ((s32)res) >> 16; + case BITS_32: + res |= ((u32)data[off++])<<8; + res |= ((u32)data[off++])<<16; + res |= ((u32)data[off++])<<24; + return (s32)res; + } + return (s32)res; +} + +u32 cheatSearchRead(u8 *data, int off, int size) +{ + u32 res = data[off++]; + if(size == BITS_16) + res |= ((u32)data[off++])<<8; + else if(size == BITS_32) { + res |= ((u32)data[off++])<<8; + res |= ((u32)data[off++])<<16; + res |= ((u32)data[off++])<<24; + } + return res; +} + +void cheatSearch(const CheatSearchData *cs, int compare, int size, + bool isSigned) +{ + if(compare < 0 || compare > SEARCH_GE) + return; + int inc = 1; + if(size == BITS_16) + inc = 2; + else if(size == BITS_32) + inc = 4; + + if(isSigned) { + bool (*func)(s32,s32) = cheatSearchSignedFunc[compare]; + + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + int size2 = block->size; + u8 *bits = block->bits; + u8 *data = block->data; + u8 *saved = block->saved; + + for(int j = 0; j < size2; j += inc) { + if(IS_BIT_SET(bits, j)) { + s32 a = cheatSearchSignedRead(data, j, size); + s32 b = cheatSearchSignedRead(saved,j, size); + + if(!func(a, b)) { + CLEAR_BIT(bits, j); + if(size == BITS_16) + CLEAR_BIT(bits, j+1); + if(size == BITS_32) { + CLEAR_BIT(bits, j+2); + CLEAR_BIT(bits, j+3); + } + } + } + } + } + } else { + bool (*func)(u32,u32) = cheatSearchFunc[compare]; + + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + int size2 = block->size; + u8 *bits = block->bits; + u8 *data = block->data; + u8 *saved = block->saved; + + for(int j = 0; j < size2; j += inc) { + if(IS_BIT_SET(bits, j)) { + u32 a = cheatSearchRead(data, j, size); + u32 b = cheatSearchRead(saved,j, size); + + if(!func(a, b)) { + CLEAR_BIT(bits, j); + if(size == BITS_16) + CLEAR_BIT(bits, j+1); + if(size == BITS_32) { + CLEAR_BIT(bits, j+2); + CLEAR_BIT(bits, j+3); + } + } + } + } + } + } +} + +void cheatSearchValue(const CheatSearchData *cs, int compare, int size, + bool isSigned, u32 value) +{ + if(compare < 0 || compare > SEARCH_GE) + return; + int inc = 1; + if(size == BITS_16) + inc = 2; + else if(size == BITS_32) + inc = 4; + + if(isSigned) { + bool (*func)(s32,s32) = cheatSearchSignedFunc[compare]; + + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + int size2 = block->size; + u8 *bits = block->bits; + u8 *data = block->data; + + for(int j = 0; j < size2; j += inc) { + if(IS_BIT_SET(bits, j)) { + s32 a = cheatSearchSignedRead(data, j, size); + s32 b = (s32)value; + + if(!func(a, b)) { + CLEAR_BIT(bits, j); + if(size == BITS_16) + CLEAR_BIT(bits, j+1); + if(size == BITS_32) { + CLEAR_BIT(bits, j+2); + CLEAR_BIT(bits, j+3); + } + } + } + } + } + } else { + bool (*func)(u32,u32) = cheatSearchFunc[compare]; + + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + int size2 = block->size; + u8 *bits = block->bits; + u8 *data = block->data; + + for(int j = 0; j < size2; j += inc) { + if(IS_BIT_SET(bits, j)) { + u32 a = cheatSearchRead(data, j, size); + + if(!func(a, value)) { + CLEAR_BIT(bits, j); + if(size == BITS_16) + CLEAR_BIT(bits, j+1); + if(size == BITS_32) { + CLEAR_BIT(bits, j+2); + CLEAR_BIT(bits, j+3); + } + } + } + } + } + } +} + +int cheatSearchGetCount(const CheatSearchData *cs, int size) +{ + int res = 0; + int inc = 1; + if(size == BITS_16) + inc = 2; + else if(size == BITS_32) + inc = 4; + + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + + int size2 = block->size; + u8 *bits = block->bits; + for(int j = 0; j < size2; j += inc) { + if(IS_BIT_SET(bits, j)) + res++; + } + } + return res; +} + +void cheatSearchUpdateValues(const CheatSearchData *cs) +{ + for(int i = 0; i < cs->count; i++) { + CheatSearchBlock *block = &cs->blocks[i]; + + memcpy(block->saved, block->data, block->size); + } +} + diff --git a/src/CheatSearch.h b/src/CheatSearch.h new file mode 100644 index 0000000..10db35d --- /dev/null +++ b/src/CheatSearch.h @@ -0,0 +1,73 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_CHEATSEARCH_H +#define VBA_CHEATSEARCH_H + +#include "System.h" + +struct CheatSearchBlock { + int size; + u32 offset; + u8 *bits; + u8 *data; + u8 *saved; +}; + +struct CheatSearchData { + int count; + CheatSearchBlock *blocks; +}; + +enum { + SEARCH_EQ, + SEARCH_NE, + SEARCH_LT, + SEARCH_LE, + SEARCH_GT, + SEARCH_GE +}; + +enum { + BITS_8, + BITS_16, + BITS_32 +}; + +#define SET_BIT(bits,off) \ + (bits)[(off) >> 3] |= (1 << ((off) & 7)) + +#define CLEAR_BIT(bits, off) \ + (bits)[(off) >> 3] &= ~(1 << ((off) & 7)) + +#define IS_BIT_SET(bits, off) \ + (bits)[(off) >> 3] & (1 << ((off) & 7)) + +extern CheatSearchData cheatSearchData; +extern void cheatSearchCleanup(CheatSearchData *cs); +extern void cheatSearchStart(const CheatSearchData *cs); +extern void cheatSearch(const CheatSearchData *cs, int compare, int size, + bool isSigned); +extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size, + bool isSigned, u32 value); +extern int cheatSearchGetCount(const CheatSearchData *cs, int size); +extern void cheatSearchUpdateValues(const CheatSearchData *cs); +extern s32 cheatSearchSignedRead(u8 *data, int off, int size); +extern u32 cheatSearchRead(u8 *data, int off, int size); +#endif diff --git a/src/Cheats.cpp b/src/Cheats.cpp new file mode 100644 index 0000000..49d0f92 --- /dev/null +++ b/src/Cheats.cpp @@ -0,0 +1,1674 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include + +#include "GBA.h" +#include "GBAinline.h" +#include "Cheats.h" +#include "Globals.h" +#include "NLS.h" +#include "Util.h" + +/** + * Gameshark code types: + * + * NNNNNNNN 001DC0DE - ID code for the game (game 4 character name) from ROM + * DEADFACE XXXXXXXX - changes decryption seeds + * 0AAAAAAA 000000YY - 8-bit constant write + * 1AAAAAAA 0000YYYY - 16-bit constant write + * 2AAAAAAA YYYYYYYY - 32-bit constant write + * 3AAAAAAA YYYYYYYY - ?? + * 6AAAAAAA 0000YYYY - 16-bit ROM Patch (address >> 1) + * 6AAAAAAA 1000YYYY - 16-bit ROM Patch ? (address >> 1) + * 6AAAAAAA 2000YYYY - 16-bit ROM Patch ? (address >> 1) + * 8A1AAAAA 000000YY - 8-bit button write + * 8A2AAAAA 0000YYYY - 16-bit button write + * 8A3AAAAA YYYYYYYY - 32-bit button write + * 80F00000 0000YYYY - button slow motion + * DAAAAAAA 0000YYYY - if address contains 16-bit value enable next code + * FAAAAAAA 0000YYYY - Master code function + * + * CodeBreaker codes types: + * + * 0000AAAA 000Y - Game CRC (Y are flags: 8 - CRC, 2 - DI) + * 1AAAAAAA YYYY - Master Code function (store address at ((YYYY << 0x16) + * + 0x08000100)) + * 2AAAAAAA YYYY - 16-bit or + * 3AAAAAAA YYYY - 8-bit constant write + * 4AAAAAAA YYYY - Slide code + * XXXXCCCC IIII (C is count and I is address increment, X is value incr.) + * 5AAAAAAA CCCC - Super code (Write bytes to address, CCCC is count) + * BBBBBBBB BBBB + * 6AAAAAAA YYYY - 16-bit and + * 7AAAAAAA YYYY - if address contains 16-bit value enable next code + * 8AAAAAAA YYYY - 16-bit constant write + * 9AAAAAAA YYYY - change decryption (when first code only?) + * AAAAAAAA YYYY - if address does not contain 16-bit value enable next code + * BAAAAAAA YYYY - if 16-bit < YYYY + * CAAAAAAA YYYY - if 16-bit > YYYY + * D0000020 YYYY - if button keys equal value enable next code + * EAAAAAAA YYYY - increase value stored in address + */ +#define UNKNOWN_CODE -1 +#define INT_8_BIT_WRITE 0 +#define INT_16_BIT_WRITE 1 +#define INT_32_BIT_WRITE 2 +#define GSA_16_BIT_ROM_PATCH 3 +#define GSA_8_BIT_GS_WRITE 4 +#define GSA_16_BIT_GS_WRITE 5 +#define GSA_32_BIT_GS_WRITE 6 +#define CBA_IF_KEYS_PRESSED 7 +#define CBA_IF_TRUE 8 +#define CBA_SLIDE_CODE 9 +#define CBA_IF_FALSE 10 +#define CBA_AND 11 +#define GSA_8_BIT_GS_WRITE2 12 +#define GSA_16_BIT_GS_WRITE2 13 +#define GSA_32_BIT_GS_WRITE2 14 +#define GSA_16_BIT_ROM_PATCH2 15 +#define GSA_8_BIT_SLIDE 16 +#define GSA_16_BIT_SLIDE 17 +#define GSA_32_BIT_SLIDE 18 +#define GSA_8_BIT_IF_TRUE 19 +#define GSA_32_BIT_IF_TRUE 20 +#define GSA_8_BIT_IF_FALSE 21 +#define GSA_32_BIT_IF_FALSE 22 +#define GSA_8_BIT_FILL 23 +#define GSA_16_BIT_FILL 24 +#define GSA_8_BIT_IF_TRUE2 25 +#define GSA_16_BIT_IF_TRUE2 26 +#define GSA_32_BIT_IF_TRUE2 27 +#define GSA_8_BIT_IF_FALSE2 28 +#define GSA_16_BIT_IF_FALSE2 29 +#define GSA_32_BIT_IF_FALSE2 30 +#define GSA_SLOWDOWN 31 +#define CBA_ADD 32 +#define CBA_OR 33 +#define CBA_LT 34 +#define CBA_GT 35 +#define CBA_SUPER 36 + +CheatsData cheatsList[100]; +int cheatsNumber = 0; + +u8 cheatsCBASeedBuffer[0x30]; +u32 cheatsCBASeed[4]; +u32 cheatsCBATemporaryValue = 0; +u16 cheatsCBATable[256]; +bool cheatsCBATableGenerated = false; + +u8 cheatsCBACurrentSeed[12] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; + +#define CHEAT_IS_HEX(a) ( ((a)>='A' && (a) <='F') || ((a) >='0' && (a) <= '9')) + +#define CHEAT_PATCH_ROM_16BIT(a,v) \ + WRITE16LE(((u16 *)&rom[(a) & 0x1ffffff]), v); + +static bool isMultilineWithData(int i) +{ + // we consider it a multiline code if it has more than one line of data + // otherwise, it can still be considered a single code + if(i < cheatsNumber && i >= 0) + switch(cheatsList[i].size) { + case INT_8_BIT_WRITE: + case INT_16_BIT_WRITE: + case INT_32_BIT_WRITE: + case GSA_16_BIT_ROM_PATCH: + case GSA_8_BIT_GS_WRITE: + case GSA_16_BIT_GS_WRITE: + case GSA_32_BIT_GS_WRITE: + case CBA_AND: + case CBA_IF_KEYS_PRESSED: + case CBA_IF_TRUE: + case CBA_IF_FALSE: + case GSA_8_BIT_IF_TRUE: + case GSA_32_BIT_IF_TRUE: + case GSA_8_BIT_IF_FALSE: + case GSA_32_BIT_IF_FALSE: + case GSA_8_BIT_FILL: + case GSA_16_BIT_FILL: + case GSA_8_BIT_IF_TRUE2: + case GSA_16_BIT_IF_TRUE2: + case GSA_32_BIT_IF_TRUE2: + case GSA_8_BIT_IF_FALSE2: + case GSA_16_BIT_IF_FALSE2: + case GSA_32_BIT_IF_FALSE2: + case GSA_SLOWDOWN: + case CBA_ADD: + case CBA_OR: + return false; + // the codes below have two lines of data + case CBA_SLIDE_CODE: + case GSA_8_BIT_GS_WRITE2: + case GSA_16_BIT_GS_WRITE2: + case GSA_32_BIT_GS_WRITE2: + case GSA_16_BIT_ROM_PATCH2: + case GSA_8_BIT_SLIDE: + case GSA_16_BIT_SLIDE: + case GSA_32_BIT_SLIDE: + case CBA_LT: + case CBA_GT: + case CBA_SUPER: + return true; + } + return false; +} + +static int getCodeLength(int num) +{ + if(num >= cheatsNumber || num < 0) + return 1; + + // this is for all the codes that are true multiline + switch(cheatsList[num].size) { + case INT_8_BIT_WRITE: + case INT_16_BIT_WRITE: + case INT_32_BIT_WRITE: + case GSA_16_BIT_ROM_PATCH: + case GSA_8_BIT_GS_WRITE: + case GSA_16_BIT_GS_WRITE: + case GSA_32_BIT_GS_WRITE: + case CBA_AND: + case GSA_8_BIT_FILL: + case GSA_16_BIT_FILL: + case GSA_SLOWDOWN: + case CBA_ADD: + case CBA_OR: + return 1; + case CBA_IF_KEYS_PRESSED: + case CBA_IF_TRUE: + case CBA_IF_FALSE: + case CBA_SLIDE_CODE: + case GSA_8_BIT_GS_WRITE2: + case GSA_16_BIT_GS_WRITE2: + case GSA_32_BIT_GS_WRITE2: + case GSA_16_BIT_ROM_PATCH2: + case GSA_8_BIT_SLIDE: + case GSA_16_BIT_SLIDE: + case GSA_32_BIT_SLIDE: + case GSA_8_BIT_IF_TRUE: + case GSA_32_BIT_IF_TRUE: + case GSA_8_BIT_IF_FALSE: + case GSA_32_BIT_IF_FALSE: + case CBA_LT: + case CBA_GT: + return 2; + case GSA_8_BIT_IF_TRUE2: + case GSA_16_BIT_IF_TRUE2: + case GSA_32_BIT_IF_TRUE2: + case GSA_8_BIT_IF_FALSE2: + case GSA_16_BIT_IF_FALSE2: + case GSA_32_BIT_IF_FALSE2: + return 3; + case CBA_SUPER: + return (cheatsList[num].value+5)/6; + } + return 1; +} + +int cheatsCheckKeys(u32 keys, u32 extended) +{ + int ticks = 0; + for(int i = 0; i < cheatsNumber; i++) { + if(!cheatsList[i].enabled) { + // make sure we skip other lines in this code + i += getCodeLength(i)-1; + continue; + } + switch(cheatsList[i].size) { + case INT_8_BIT_WRITE: + CPUWriteByte(cheatsList[i].address, cheatsList[i].value); + break; + case INT_16_BIT_WRITE: + CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value); + break; + case INT_32_BIT_WRITE: + CPUWriteMemory(cheatsList[i].address, cheatsList[i].value); + break; + case GSA_16_BIT_ROM_PATCH: + if((cheatsList[i].status & 1) == 0) { + if(CPUReadHalfWord(cheatsList[i].address) != cheatsList[i].value) { + cheatsList[i].oldValue = CPUReadHalfWord(cheatsList[i].address); + cheatsList[i].status |= 1; + CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, cheatsList[i].value); + } + } + break; + case GSA_8_BIT_GS_WRITE: + if(extended & 4) { + CPUWriteByte(cheatsList[i].address, cheatsList[i].value); + } + break; + case GSA_16_BIT_GS_WRITE: + if(extended & 4) { + CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value); + } + break; + case GSA_32_BIT_GS_WRITE: + if(extended & 4) { + CPUWriteMemory(cheatsList[i].address, cheatsList[i].value); + } + break; + case CBA_IF_KEYS_PRESSED: + { + u16 value = cheatsList[i].value; + u32 addr = cheatsList[i].address; + if((addr & 0x30) == 0x20) { + if((keys & value) != value) { + i++; + } + } else if((addr & 0x30) == 0x10) { + if((keys & value) == value) { + i++; + } + } + } + break; + case CBA_IF_TRUE: + if(CPUReadHalfWord(cheatsList[i].address) != cheatsList[i].value) { + i++; + } + break; + case CBA_SLIDE_CODE: + { + u32 address = cheatsList[i].address; + u16 value = cheatsList[i].value; + i++; + if(i < cheatsNumber) { + int count = (cheatsList[i].address & 0xFFFF); + u16 vinc = (cheatsList[i].address >> 16) & 0xFFFF; + int inc = cheatsList[i].value; + + for(int x = 0; x < count; x++) { + CPUWriteHalfWord(address, value); + address += inc; + value += vinc; + } + } + } + break; + case CBA_IF_FALSE: + if(CPUReadHalfWord(cheatsList[i].address) == cheatsList[i].value) { + i++; + } + break; + case CBA_AND: + CPUWriteHalfWord(cheatsList[i].address, + CPUReadHalfWord(cheatsList[i].address) & + cheatsList[i].value); + break; + case GSA_8_BIT_GS_WRITE2: + i++; + if(i < cheatsNumber) { + if(extended & 4) { + CPUWriteByte(cheatsList[i-1].value, cheatsList[i].address); + } + } + break; + case GSA_16_BIT_GS_WRITE2: + i++; + if(i < cheatsNumber) { + if(extended & 4) { + CPUWriteHalfWord(cheatsList[i-1].value, cheatsList[i].address); + } + } + break; + case GSA_32_BIT_GS_WRITE2: + i++; + if(i < cheatsNumber) { + if(extended & 4) { + CPUWriteMemory(cheatsList[i-1].value, cheatsList[i].address); + } + } + break; + case GSA_16_BIT_ROM_PATCH2: + i++; + if(i < cheatsNumber) { + if((cheatsList[i-1].status & 1) == 0) { + u32 addr = ((cheatsList[i-1].value & 0x00FFFFFF) << 1) + 0x8000000; + if(CPUReadHalfWord(addr) != (cheatsList[i].address & 0xFFFF)) { + cheatsList[i-1].oldValue = CPUReadHalfWord(addr); + cheatsList[i-1].status |= 1; + CHEAT_PATCH_ROM_16BIT(addr,cheatsList[i].address & 0xFFFF); + } + } + } + break; + case GSA_8_BIT_SLIDE: + i++; + if(i < cheatsNumber) { + u32 addr = cheatsList[i-1].value; + u8 value = cheatsList[i].address; + int vinc = (cheatsList[i].value >> 24) & 255; + int count = (cheatsList[i].value >> 16) & 255; + int ainc = (cheatsList[i].value & 0xffff); + while(count > 0) { + CPUWriteByte(addr, value); + value += vinc; + addr += ainc; + count--; + } + } + break; + case GSA_16_BIT_SLIDE: + i++; + if(i < cheatsNumber) { + u32 addr = cheatsList[i-1].value; + u16 value = cheatsList[i].address; + int vinc = (cheatsList[i].value >> 24) & 255; + int count = (cheatsList[i].value >> 16) & 255; + int ainc = (cheatsList[i].value & 0xffff)*2; + while(count > 0) { + CPUWriteHalfWord(addr, value); + value += vinc; + addr += ainc; + count--; + } + } + break; + case GSA_32_BIT_SLIDE: + i++; + if(i < cheatsNumber) { + u32 addr = cheatsList[i-1].value; + u32 value = cheatsList[i].address; + int vinc = (cheatsList[i].value >> 24) & 255; + int count = (cheatsList[i].value >> 16) & 255; + int ainc = (cheatsList[i].value & 0xffff)*4; + while(count > 0) { + CPUWriteMemory(addr, value); + value += vinc; + addr += ainc; + count--; + } + } + break; + case GSA_8_BIT_IF_TRUE: + if(CPUReadByte(cheatsList[i].address) != cheatsList[i].value) { + i++; + } + break; + case GSA_32_BIT_IF_TRUE: + if(CPUReadMemory(cheatsList[i].address) != cheatsList[i].value) { + i++; + } + break; + case GSA_8_BIT_IF_FALSE: + if(CPUReadByte(cheatsList[i].address) == cheatsList[i].value) { + i++; + } + break; + case GSA_32_BIT_IF_FALSE: + if(CPUReadMemory(cheatsList[i].address) == cheatsList[i].value) { + i++; + } + break; + case GSA_8_BIT_FILL: + { + u32 addr = cheatsList[i].address; + u8 v = cheatsList[i].value & 0xff; + u32 end = addr + (cheatsList[i].value >> 8); + do { + CPUWriteByte(addr, v); + addr++; + } while (addr <= end); + } + break; + case GSA_16_BIT_FILL: + { + u32 addr = cheatsList[i].address; + u16 v = cheatsList[i].value & 0xffff; + u32 end = addr + ((cheatsList[i].value >> 16) << 1); + do { + CPUWriteHalfWord(addr, v); + addr+=2; + } while (addr <= end); + } + break; + case GSA_8_BIT_IF_TRUE2: + if(CPUReadByte(cheatsList[i].address) != cheatsList[i].value) { + i+=2; + } + break; + case GSA_16_BIT_IF_TRUE2: + if(CPUReadHalfWord(cheatsList[i].address) != cheatsList[i].value) { + i+=2; + } + break; + case GSA_32_BIT_IF_TRUE2: + if(CPUReadMemory(cheatsList[i].address) != cheatsList[i].value) { + i+=2; + } + break; + case GSA_8_BIT_IF_FALSE2: + if(CPUReadByte(cheatsList[i].address) == cheatsList[i].value) { + i+=2; + } + break; + case GSA_16_BIT_IF_FALSE2: + if(CPUReadHalfWord(cheatsList[i].address) == cheatsList[i].value) { + i+=2; + } + break; + case GSA_32_BIT_IF_FALSE2: + if(CPUReadMemory(cheatsList[i].address) == cheatsList[i].value) { + i+=2; + } + break; + case GSA_SLOWDOWN: + // check if button was pressed and released, if so toggle our state + if((cheatsList[i].status & 4) && !(extended & 4)) + cheatsList[i].status ^= 1; + if(extended & 4) + cheatsList[i].status |= 4; + else + cheatsList[i].status &= ~4; + + if(cheatsList[i].status & 1) + ticks += 2*256*((cheatsList[i].value >> 8) & 255); + break; + case CBA_ADD: + CPUWriteHalfWord(cheatsList[i].address, + CPUReadHalfWord(cheatsList[i].address) + + (u16)cheatsList[i].value); + break; + case CBA_OR: + CPUWriteHalfWord(cheatsList[i].address, + CPUReadHalfWord(cheatsList[i].address) | + cheatsList[i].value); + break; + case CBA_LT: + if(CPUReadHalfWord(cheatsList[i].address) >= cheatsList[i].value) + i++; + break; + case CBA_GT: + if(CPUReadHalfWord(cheatsList[i].address) <= cheatsList[i].value) + i++; + break; + case CBA_SUPER: + { + int count = 2*cheatsList[i].value; + u32 address = cheatsList[i].address; + for(int x = 0; x < count; x++) { + u8 b; + int res = x % 6; + if(res < 4) + b = (cheatsList[i].address >> (24-8*res)) & 0xFF; + else + b = (cheatsList[i].value >> (8 - 8*(res-4))) & 0x0FF; + CPUWriteByte(address, b); + address++; + if(x && !res) + i++; + } + if(count % 6) + i++; + } + break; + } + } + return ticks; +} + +void cheatsAdd(const char *codeStr, + const char *desc, + u32 address, + u32 value, + int code, + int size) +{ + if(cheatsNumber < 100) { + int x = cheatsNumber; + cheatsList[x].code = code; + cheatsList[x].size = size; + cheatsList[x].address = address; + cheatsList[x].value = value; + strcpy(cheatsList[x].codestring, codeStr); + strcpy(cheatsList[x].desc, desc); + cheatsList[x].enabled = true; + cheatsList[x].status = 0; + + // we only store the old value for this simple codes. ROM patching + // is taken care when it actually patches the ROM + switch(cheatsList[x].size) { + case INT_8_BIT_WRITE: + cheatsList[x].oldValue = CPUReadByte(address); + break; + case INT_16_BIT_WRITE: + cheatsList[x].oldValue = CPUReadHalfWord(address); + break; + case INT_32_BIT_WRITE: + cheatsList[x].oldValue = CPUReadMemory(address); + break; + } + cheatsNumber++; + } +} + +void cheatsDelete(int number, bool restore) +{ + if(number < cheatsNumber && number >= 0) { + int x = number; + + if(restore) { + switch(cheatsList[x].size) { + case INT_8_BIT_WRITE: + CPUWriteByte(cheatsList[x].address, (u8)cheatsList[x].oldValue); + break; + case INT_16_BIT_WRITE: + CPUWriteHalfWord(cheatsList[x].address, (u16)cheatsList[x].oldValue); + break; + case INT_32_BIT_WRITE: + CPUWriteMemory(cheatsList[x].address, cheatsList[x].oldValue); + break; + case GSA_16_BIT_ROM_PATCH: + if(cheatsList[x].status & 1) { + cheatsList[x].status &= ~1; + CHEAT_PATCH_ROM_16BIT(cheatsList[x].address, + cheatsList[x].oldValue); + } + break; + case GSA_16_BIT_ROM_PATCH2: + if(cheatsList[x].status & 1) { + cheatsList[x].status &= ~1; + CHEAT_PATCH_ROM_16BIT(((cheatsList[x].value & 0x00FFFFFF) << 1)+ + 0x8000000, + cheatsList[x].oldValue); + } + break; + } + } + if((x+1) < cheatsNumber) { + memcpy(&cheatsList[x], &cheatsList[x+1], sizeof(CheatsData)* + (cheatsNumber-x-1)); + } + cheatsNumber--; + } +} + +void cheatsDeleteAll(bool restore) +{ + for(int i = cheatsNumber-1; i >= 0; i--) { + cheatsDelete(i, restore); + } +} + +void cheatsEnable(int i) +{ + if(i >= 0 && i < cheatsNumber) { + cheatsList[i].enabled = true; + } +} + +void cheatsDisable(int i) +{ + if(i >= 0 && i < cheatsNumber) { + switch(cheatsList[i].size) { + case GSA_16_BIT_ROM_PATCH: + if(cheatsList[i].status & 1) { + cheatsList[i].status &= ~1; + CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, + cheatsList[i].oldValue); + } + break; + case GSA_16_BIT_ROM_PATCH2: + if(cheatsList[i].status & 1) { + cheatsList[i].status &= ~1; + CHEAT_PATCH_ROM_16BIT(((cheatsList[i].value & 0x00FFFFFF) << 1)+ + 0x8000000, + cheatsList[i].oldValue); + } + break; + } + cheatsList[i].enabled = false; + } +} + +bool cheatsVerifyCheatCode(const char *code, const char *desc) +{ + int len = strlen(code); + if(len != 11 && len != 13 && len != 17) { + systemMessage(MSG_INVALID_CHEAT_CODE, N_("Invalid cheat code '%s'"), code); + return false; + } + + if(code[8] != ':') { + systemMessage(MSG_INVALID_CHEAT_CODE, N_("Invalid cheat code '%s'"), code); + return false; + } + + int i; + for(i = 0; i < 8; i++) { + if(!CHEAT_IS_HEX(code[i])) { + // wrong cheat + systemMessage(MSG_INVALID_CHEAT_CODE, + N_("Invalid cheat code '%s'"), code); + return false; + } + } + for(i = 9; i < len; i++) { + if(!CHEAT_IS_HEX(code[i])) { + // wrong cheat + systemMessage(MSG_INVALID_CHEAT_CODE, + N_("Invalid cheat code '%s'"), code); + return false; + } + } + + u32 address = 0; + u32 value = 0; + + char buffer[10]; + strncpy(buffer, code, 8); + buffer[8] = 0; + sscanf(buffer, "%x", &address); + + switch(address >> 24) { + case 2: + case 3: + break; + default: + systemMessage(MSG_INVALID_CHEAT_CODE_ADDRESS, + N_("Invalid cheat code address: %08x"), + address); + return false; + } + + strncpy(buffer, &code[9], 8); + sscanf(buffer, "%x", &value); + int type = 0; + if(len == 13) + type = 1; + if(len == 17) + type = 2; + cheatsAdd(code, desc, address, value, type, type); + return true; +} + +void cheatsAddCheatCode(const char *code, const char *desc) +{ + cheatsVerifyCheatCode(code, desc); +} + +void cheatsDecryptGSACode(u32& address, u32& value, bool v3) +{ + u32 rollingseed = 0xC6EF3720; + u32 seeds_v1[] = { 0x09F4FBBD, 0x9681884A, 0x352027E9, 0xF3DEE5A7 }; + u32 seeds_v3[] = { 0x7AA9648F, 0x7FAE6994, 0xC0EFAAD5, 0x42712C57 }; + u32 *seeds = v3 ? seeds_v3 : seeds_v1; + + int bitsleft = 32; + while (bitsleft > 0) { + value -= ((((address << 4) + seeds[2]) ^ (address + rollingseed)) ^ + ((address >> 5) + seeds[3])); + address -= ((((value << 4) + seeds[0]) ^ (value + rollingseed)) ^ + ((value >> 5) + seeds[1])); + rollingseed -= 0x9E3779B9; + bitsleft--; + } +} + +void cheatsAddGSACode(const char *code, const char *desc, bool v3) +{ + if(strlen(code) != 16) { + // wrong cheat + systemMessage(MSG_INVALID_GSA_CODE, + N_("Invalid GSA code. Format is XXXXXXXXYYYYYYYY")); + return; + } + + int i; + for(i = 0; i < 16; i++) { + if(!CHEAT_IS_HEX(code[i])) { + // wrong cheat + systemMessage(MSG_INVALID_GSA_CODE, + N_("Invalid GSA code. Format is XXXXXXXXYYYYYYYY")); + return; + } + } + + char buffer[10]; + strncpy(buffer, code, 8); + buffer[8] = 0; + u32 address; + sscanf(buffer, "%x", &address); + strncpy(buffer, &code[8], 8); + buffer[8] = 0; + u32 value; + sscanf(buffer, "%x", &value); + + cheatsDecryptGSACode(address, value, v3); + + if(value == 0x1DC0DE) { + u32 gamecode = READ32LE(((u32 *)&rom[0xac])); + if(gamecode != address) { + char buffer[5]; + *((u32 *)buffer) = address; + buffer[4] = 0; + char buffer2[5]; + *((u32 *)buffer2) = READ32LE(((u32 *)&rom[0xac])); + buffer2[4] = 0; + systemMessage(MSG_GBA_CODE_WARNING, N_("Warning: cheats are for game %s. Current game is %s.\nCodes may not work correctly."), + buffer, buffer2); + } + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, v3 ? 257 : 256, + UNKNOWN_CODE); + return; + } + if(isMultilineWithData(cheatsNumber-1)) { + cheatsAdd(code, desc, address, value, v3 ? 257 : 256, UNKNOWN_CODE); + return; + } + if(v3) { + int type = (address >> 25) & 127; + u32 addr = (address & 0x00F00000) << 4 | (address & 0x0003FFFF); + switch(type) { + case 0x00: + if(address == 0) { + type = (value >> 25) & 127; + addr = (value & 0x00F00000) << 4 | (value & 0x0003FFFF); + switch(type) { + case 0x04: + cheatsAdd(code, desc, 0, value & 0x00FFFFFF, 257, GSA_SLOWDOWN); + break; + case 0x08: + cheatsAdd(code, desc, 0, addr, 257, GSA_8_BIT_GS_WRITE2); + break; + case 0x09: + cheatsAdd(code, desc, 0, addr, 257, GSA_16_BIT_GS_WRITE2); + break; + case 0x0a: + cheatsAdd(code, desc, 0, addr, 257, GSA_32_BIT_GS_WRITE2); + break; + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + cheatsAdd(code, desc, 0, value & 0x00FFFFFF, 257, GSA_16_BIT_ROM_PATCH2); + break; + case 0x40: + cheatsAdd(code, desc, 0, addr, 257, GSA_8_BIT_SLIDE); + break; + case 0x41: + cheatsAdd(code, desc, 0, addr, 257, GSA_16_BIT_SLIDE); + break; + case 0x42: + cheatsAdd(code, desc, 0, addr, 257, GSA_32_BIT_SLIDE); + break; + default: + cheatsAdd(code, desc, address, value, 257, UNKNOWN_CODE); + break; + } + } else + cheatsAdd(code, desc, addr, value, 257, GSA_8_BIT_FILL); + break; + case 0x01: + cheatsAdd(code, desc, addr, value, 257, GSA_16_BIT_FILL); + break; + case 0x02: + cheatsAdd(code, desc, addr, value, 257, INT_32_BIT_WRITE); + break; + case 0x04: + cheatsAdd(code, desc, addr, value, 257, GSA_8_BIT_IF_TRUE); + break; + case 0x05: + cheatsAdd(code, desc, addr, value, 257, CBA_IF_TRUE); + break; + case 0x06: + cheatsAdd(code, desc, addr, value, 257, GSA_32_BIT_IF_TRUE); + break; + case 0x08: + cheatsAdd(code, desc, addr, value, 257, GSA_8_BIT_IF_FALSE); + break; + case 0x09: + cheatsAdd(code, desc, addr, value, 257, CBA_IF_FALSE); + break; + case 0x0a: + cheatsAdd(code, desc, addr, value, 257, GSA_32_BIT_IF_FALSE); + break; + case 0x24: + cheatsAdd(code, desc, addr, value, 257, GSA_8_BIT_IF_TRUE2); + break; + case 0x25: + cheatsAdd(code, desc, addr, value, 257, GSA_16_BIT_IF_TRUE2); + break; + case 0x26: + cheatsAdd(code, desc, addr, value, 257, GSA_32_BIT_IF_TRUE2); + break; + case 0x28: + cheatsAdd(code, desc, addr, value, 257, GSA_8_BIT_IF_FALSE2); + break; + case 0x29: + cheatsAdd(code, desc, addr, value, 257, GSA_16_BIT_IF_FALSE2); + break; + case 0x2a: + cheatsAdd(code, desc, addr, value, 257, GSA_32_BIT_IF_FALSE2); + break; + default: + cheatsAdd(code, desc, address, value, 257, UNKNOWN_CODE); + break; + } + } else { + int type = (address >> 28) & 15; + switch(type) { + case 0: + case 1: + case 2: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256, type); + break; + case 6: + address <<= 1; + type = (address >> 28) & 15; + if(type == 0x0c) { + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256, + GSA_16_BIT_ROM_PATCH); + break; + } + // unsupported code + cheatsAdd(code, desc, address, value, 256, + UNKNOWN_CODE); + break; + case 8: + switch((address >> 20) & 15) { + case 1: + cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256, + GSA_8_BIT_GS_WRITE); + break; + case 2: + cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256, + GSA_16_BIT_GS_WRITE); + break; + case 3: + cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256, + GSA_32_BIT_GS_WRITE); + case 15: + cheatsAdd(code, desc, 0, value & 0xFF00, 256, GSA_SLOWDOWN); + break; + default: + // unsupported code + cheatsAdd(code, desc, address, value, 256, + UNKNOWN_CODE); + break; + } + break; + case 0x0d: + if(address != 0xDEADFACE) { + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256, + CBA_IF_TRUE); + } else + cheatsAdd(code, desc, address, value, 256, + UNKNOWN_CODE); + break; + default: + // unsupported code + cheatsAdd(code, desc, address, value, 256, + UNKNOWN_CODE); + break; + } + } +} + +bool cheatsImportGSACodeFile(const char *name, int game, bool v3) +{ + FILE *f = fopen(name, "rb"); + if(!f) + return false; + + int games = 0; + int len = 0; + fseek(f, 0x1e, SEEK_CUR); + fread(&games, 1, 4, f); + bool found = false; + int g = 0; + while(games > 0) { + if(g == game) { + found = true; + break; + } + fread(&len, 1, 4, f); + fseek(f,len,SEEK_CUR); + int codes = 0; + fread(&codes, 1, 4, f); + while(codes > 0) { + fread(&len, 1, 4, f); + fseek(f, len, SEEK_CUR); + fseek(f, 8, SEEK_CUR); + fread(&len, 1, 4, f); + fseek(f, len*12, SEEK_CUR); + codes--; + } + games--; + g++; + } + if(found) { + char desc[256]; + char code[17]; + fread(&len, 1, 4, f); + fseek(f, len, SEEK_CUR); + int codes = 0; + fread(&codes, 1, 4, f); + while(codes > 0) { + fread(&len, 1, 4, f); + fread(desc, 1, len, f); + desc[len] =0; + desc[31] = 0; + fread(&len, 1, 4, f); + fseek(f, len, SEEK_CUR); + fseek(f, 4, SEEK_CUR); + fread(&len, 1, 4, f); + while(len) { + fseek(f, 4, SEEK_CUR); + fread(code, 1, 8, f); + fseek(f, 4, SEEK_CUR); + fread(&code[8], 1, 8, f); + code[16] = 0; + cheatsAddGSACode(code, desc, v3); + len -= 2; + } + codes--; + } + } + fclose(f); + return false; +} + +void cheatsCBAReverseArray(u8 *array, u8 *dest) +{ + dest[0] = array[3]; + dest[1] = array[2]; + dest[2] = array[1]; + dest[3] = array[0]; + dest[4] = array[5]; + dest[5] = array[4]; +} + +void chatsCBAScramble(u8 *array, int count, u8 b) +{ + u8 *x = array + (count >> 3); + u8 *y = array + (b >> 3); + u32 z = *x & (1 << (count & 7)); + u32 x0 = (*x & (~(1 << (count & 7)))); + if (z != 0) + z = 1; + if ((*y & (1 << (b & 7))) != 0) + x0 |= (1 << (count & 7)); + *x = x0; + u32 temp = *y & (~(1 << (b & 7))); + if (z != 0) + temp |= (1 << (b & 7)); + *y = temp; +} + +u32 cheatsCBAGetValue(u8 *array) +{ + return array[0] | array[1]<<8 | array[2] << 16 | array[3]<<24; +} + +u16 cheatsCBAGetData(u8 *array) +{ + return array[4] | array[5]<<8; +} + +void cheatsCBAArrayToValue(u8 *array, u8 *dest) +{ + dest[0] = array[3]; + dest[1] = array[2]; + dest[2] = array[1]; + dest[3] = array[0]; + dest[4] = array[5]; + dest[5] = array[4]; +} + +void cheatsCBAParseSeedCode(u32 address, u32 value, u32 *array) +{ + array[0] = 1; + array[1] = value & 0xFF; + array[2] = (address >> 0x10) & 0xFF; + array[3] = (value >> 8) & 0xFF; + array[4] = (address >> 0x18) & 0x0F; + array[5] = address & 0xFFFF; + array[6] = address; + array[7] = value; +} + +u32 cheatsCBAEncWorker() +{ + u32 x = (cheatsCBATemporaryValue * 0x41c64e6d) + 0x3039; + u32 y = (x * 0x41c64e6d) + 0x3039; + u32 z = x >> 0x10; + x = ((y >> 0x10) & 0x7fff) << 0x0f; + z = (z << 0x1e) | x; + x = (y * 0x41c64e6d) + 0x3039; + cheatsCBATemporaryValue = x; + return z | ((x >> 0x10) & 0x7fff); +} + +#define ROR(v, s) \ + (((v) >> (s)) | (((v) & ((1 << (s))-1)) << (32 - (s)))) + +u32 cheatsCBACalcIndex(u32 x, u32 y) +{ + if(y != 0) { + if(y == 1) + x = 0; + else if(x == y) + x = 0; + if(y < 1) + return x; + else if(x < y) + return x; + u32 x0 = 1; + + while(y < 0x10000000) { + if(y < x) { + y = y << 4; + x0 = x0 << 4; + } else break; + } + + while(y < 0x80000000) { + if(y < x) { + y = y << 1; + x0 = x0 << 1; + } else break; + } + + loop: + u32 z = 0; + if(x >= y) + x -= y; + if(x >= (y >> 1)) { + x -= (y >> 1); + z |= ROR(x0, 1); + } + if(x >= (y >> 2)) { + x -= (y >> 2); + z |= ROR(x0, 2); + } + if(x >= (y >> 3)) { + x -= (y >> 3); + z |= ROR(x0, 3); + } + + u32 temp = x0; + + if(x != 0) { + x0 = x0 >> 4; + if(x0 != 0) { + y = y >> 4; + goto loop; + } + } + + z = z & 0xe0000000; + + if(z != 0) { + if((temp & 7) == 0) + return x; + } else + return x; + + if((z & ROR(temp, 3)) != 0) + x += y >> 3; + if((z & ROR(temp, 2)) != 0) + x += y >> 2; + if((z & ROR(temp, 1)) != 0) + x += y >> 1; + return x; + } else { + } + // should not happen in the current code + return 0; +} + +void cheatsCBAUpdateSeedBuffer(u32 a, u8 *buffer, int count) +{ + int i; + for(i = 0; i < count; i++) + buffer[i] = i; + for(i = 0; (u32)i < a; i++) { + u32 a = cheatsCBACalcIndex(cheatsCBAEncWorker(), count); + u32 b = cheatsCBACalcIndex(cheatsCBAEncWorker(), count); + u32 t = buffer[a]; + buffer[a] = buffer[b]; + buffer[b] = t; + } +} + +void cheatsCBAChangeEncryption(u32 *seed) +{ + int i; + + cheatsCBATemporaryValue = (seed[1] ^ 0x1111); + cheatsCBAUpdateSeedBuffer(0x50, cheatsCBASeedBuffer, 0x30); + cheatsCBATemporaryValue = 0x4efad1c3; + + for(i = 0; (u32)i < seed[4]; i++) { + cheatsCBATemporaryValue = cheatsCBAEncWorker(); + } + cheatsCBASeed[2] = cheatsCBAEncWorker(); + cheatsCBASeed[3] = cheatsCBAEncWorker(); + + cheatsCBATemporaryValue = seed[3] ^ 0xf254; + + for(i = 0; (u32)i < seed[3]; i++) { + cheatsCBATemporaryValue = cheatsCBAEncWorker(); + } + + cheatsCBASeed[0] = cheatsCBAEncWorker(); + cheatsCBASeed[1] = cheatsCBAEncWorker(); + + *((u32 *)&cheatsCBACurrentSeed[0]) = seed[6]; + *((u32 *)&cheatsCBACurrentSeed[4]) = seed[7]; + *((u32 *)&cheatsCBACurrentSeed[8]) = 0; +} + +u16 cheatsCBAGenValue(u32 x, u32 y, u32 z) +{ + y <<= 0x10; + z <<= 0x10; + x <<= 0x18; + u32 x0 = (int)y >> 0x10; + z = (int)z >> 0x10; + x = (int)x >> 0x10; + for(int i = 0; i < 8; i++) { + u32 temp = z ^ x; + if ((int)temp >= 0) { + temp = z << 0x11; + } + else { + temp = z << 0x01; + temp ^= x0; + temp = temp << 0x10; + } + z = (int)temp >> 0x10; + temp = x << 0x11; + x = (int)temp >> 0x10; + } + return z & 0xffff; +} + +void cheatsCBAGenTable() { + for (int i = 0; i < 0x100; i++) { + cheatsCBATable[i] = cheatsCBAGenValue(i, 0x1021, 0); + } + cheatsCBATableGenerated = true; +} + +u16 cheatsCBACalcCRC(u8 *rom, int count) +{ + u32 crc = 0xffffffff; + + if (count & 3) { + // 0x08000EAE + } else { + count = (count >> 2) - 1; + if(count != -1) { + while(count != -1) { + crc = (((crc << 0x08) ^ cheatsCBATable[(((u32)crc << 0x10) >> 0x18) + ^ *rom++]) << 0x10) >> 0x10; + crc = (((crc << 0x08) ^ cheatsCBATable[(((u32)crc << 0x10) >> 0x18) + ^ *rom++]) << 0x10) >> 0x10; + crc = (((crc << 0x08) ^ cheatsCBATable[(((u32)crc << 0x10) >> 0x18) + ^ *rom++]) << 0x10) >> 0x10; + crc = (((crc << 0x08) ^ cheatsCBATable[(((u32)crc << 0x10) >> 0x18) + ^ *rom++]) << 0x10) >> 0x10; + count--; + } + } + } + return crc & 0xffff; +} + +void cheatsCBADecrypt(u8 *decrypt) +{ + u8 buffer[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + u8 *array = &buffer[1]; + + cheatsCBAReverseArray(decrypt, array); + + for(int count = 0x2f; count >= 0; count--) { + chatsCBAScramble(array, count, cheatsCBASeedBuffer[count]); + } + cheatsCBAArrayToValue(array, decrypt); + *((u32 *)decrypt) = cheatsCBAGetValue(decrypt) ^ + cheatsCBASeed[0]; + *((u16 *)(decrypt+4)) = (cheatsCBAGetData(decrypt) ^ + cheatsCBASeed[1]) & 0xffff; + + cheatsCBAReverseArray(decrypt, array); + + u32 cs = cheatsCBAGetValue(cheatsCBACurrentSeed); + for(int i = 0; i <= 4; i++) { + array[i] = ((cs >> 8) ^ array[i+1]) ^ array[i] ; + } + + array[5] = (cs >> 8) ^ array[5]; + + for(int j = 5; j >=0; j--) { + array[j] = (cs ^ array[j-1]) ^ array[j]; + } + + cheatsCBAArrayToValue(array, decrypt); + + *((u32 *)decrypt) = cheatsCBAGetValue(decrypt) + ^ cheatsCBASeed[2]; + *((u16 *)(decrypt+4)) = (cheatsCBAGetData(decrypt) + ^ cheatsCBASeed[3]) & 0xffff; +} + +int cheatsCBAGetCount() +{ + int count = 0; + for(int i = 0; i < cheatsNumber; i++) { + if(cheatsList[i].code == 512) + count++; + } + return count; +} + +bool cheatsCBAShouldDecrypt() +{ + for(int i = 0; i < cheatsNumber; i++) { + if(cheatsList[i].code == 512) { + return (cheatsList[i].codestring[0] == '9'); + } + } + return false; +} + +void cheatsAddCBACode(const char *code, const char *desc) +{ + if(strlen(code) != 13) { + // wrong cheat + systemMessage(MSG_INVALID_CBA_CODE, + N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); + return; + } + + int i; + for(i = 0; i < 8; i++) { + if(!CHEAT_IS_HEX(code[i])) { + // wrong cheat + systemMessage(MSG_INVALID_CBA_CODE, + N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); + return; + } + } + + if(code[8] != ' ') { + systemMessage(MSG_INVALID_CBA_CODE, + N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); + return; + } + + for(i = 9; i < 13; i++) { + if(!CHEAT_IS_HEX(code[i])) { + // wrong cheat + systemMessage(MSG_INVALID_CBA_CODE, + N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); + return; + } + } + + char buffer[10]; + strncpy(buffer, code, 8); + buffer[8] = 0; + u32 address; + sscanf(buffer, "%x", &address); + strncpy(buffer, &code[9], 4); + buffer[4] = 0; + u32 value; + sscanf(buffer, "%x", &value); + + u8 array[8] = { + address & 255, + (address >> 8) & 255, + (address >> 16) & 255, + (address >> 24) & 255, + (value & 255), + (value >> 8) & 255, + 0, + 0 + }; + + if(cheatsCBAGetCount() == 0 && + (address >> 28) == 9) { + u32 seed[8]; + cheatsCBAParseSeedCode(address, value, seed); + cheatsCBAChangeEncryption(seed); + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, UNKNOWN_CODE); + } else { + if(cheatsCBAShouldDecrypt()) + cheatsCBADecrypt(array); + + address = READ32LE(((u32 *)array)); + value = READ16LE(((u16 *)&array[4])); + + int type = (address >> 28) & 15; + + if(isMultilineWithData(cheatsNumber-1)) { + cheatsAdd(code, desc, address, value, 512, UNKNOWN_CODE); + return; + } + + switch(type) { + case 0x00: + { + if(!cheatsCBATableGenerated) + cheatsCBAGenTable(); + u32 crc = cheatsCBACalcCRC(rom, 0x10000); + if(crc != address) { + systemMessage(MSG_CBA_CODE_WARNING, + N_("Warning: Codes seem to be for a different game.\nCodes may not work correctly.")); + } + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + UNKNOWN_CODE); + } + break; + case 0x02: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_OR); + break; + case 0x03: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + INT_8_BIT_WRITE); + break; + case 0x04: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_SLIDE_CODE); + break; + case 0x05: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_SUPER); + break; + case 0x06: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_AND); + break; + case 0x07: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_IF_TRUE); + break; + case 0x08: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + INT_16_BIT_WRITE); + break; + case 0x0a: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_IF_FALSE); + break; + case 0x0b: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_LT); + break; + case 0x0c: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_GT); + break; + case 0x0d: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_IF_KEYS_PRESSED); + break; + case 0x0e: + cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 512, + CBA_ADD); + break; + default: + // unsupported code + cheatsAdd(code, desc, address & 0xFFFFFFFF, value, 512, + UNKNOWN_CODE); + break; + } + } +} + +void cheatsSaveGame(gzFile file) +{ + utilWriteInt(file, cheatsNumber); + + utilGzWrite(file, cheatsList, sizeof(cheatsList)); +} + +void cheatsReadGame(gzFile file) +{ + cheatsNumber = 0; + + cheatsNumber = utilReadInt(file); + + utilGzRead(file, cheatsList, sizeof(cheatsList)); + + bool firstCodeBreaker = true; + + for(int i = 0; i < cheatsNumber; i++) { + cheatsList[i].status = 0; + if(!cheatsList[i].codestring[0]) { + switch(cheatsList[i].size) { + case 0: + sprintf(cheatsList[i].codestring, "%08x:%02x", cheatsList[i].address, + cheatsList[i].value); + break; + case 1: + sprintf(cheatsList[i].codestring, "%08x:%04x", cheatsList[i].address, + cheatsList[i].value); + break; + case 2: + sprintf(cheatsList[i].codestring, "%08x:%08x", cheatsList[i].address, + cheatsList[i].value); + break; + } + } + + if(cheatsList[i].enabled) { + cheatsEnable(i); + } + + if(cheatsList[i].code == 512 && firstCodeBreaker) { + firstCodeBreaker = false; + char buffer[10]; + strncpy(buffer, cheatsList[i].codestring, 8); + buffer[8] = 0; + u32 address; + sscanf(buffer, "%x", &address); + if((address >> 28) == 9) { + strncpy(buffer, &cheatsList[i].codestring[9], 4); + buffer[4] = 0; + u32 value; + sscanf(buffer, "%x", &value); + + u32 seed[8]; + cheatsCBAParseSeedCode(address, value, seed); + cheatsCBAChangeEncryption(seed); + } + } + } +} + +void cheatsSaveCheatList(const char *file) +{ + if(cheatsNumber == 0) + return; + FILE *f = fopen(file, "wb"); + if(f == NULL) + return; + int version = 1; + fwrite(&version, 1, sizeof(version), f); + int type = 0; + fwrite(&type, 1, sizeof(type), f); + fwrite(&cheatsNumber, 1, sizeof(cheatsNumber), f); + fwrite(cheatsList, 1, sizeof(cheatsList), f); + fclose(f); +} + +bool cheatsLoadCheatList(const char *file) +{ + cheatsNumber = 0; + + int count = 0; + + FILE *f = fopen(file, "rb"); + + if(f == NULL) + return false; + + int version = 0; + + if(fread(&version, 1, sizeof(version), f) != sizeof(version)) { + fclose(f); + return false; + } + + if(version != 1) { + systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_VERSION, + N_("Unsupported cheat list version %d"), version); + fclose(f); + return false; + } + + int type = 0; + if(fread(&type, 1, sizeof(type), f) != sizeof(type)) { + fclose(f); + return false; + } + + if(type != 0) { + systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_TYPE, + N_("Unsupported cheat list type %d"), type); + fclose(f); + return false; + } + + if(fread(&count, 1, sizeof(count), f) != sizeof(count)) { + fclose(f); + return false; + } + + if(fread(cheatsList, 1, sizeof(cheatsList), f) != sizeof(cheatsList)) { + fclose(f); + return false; + } + + bool firstCodeBreaker = true; + + for(int i = 0; i < count; i++) { + cheatsList[i].status = 0; // remove old status as it is not used + if(!cheatsList[i].codestring[0]) { + switch(cheatsList[i].size) { + case 0: + sprintf(cheatsList[i].codestring, "%08x:%02x", cheatsList[i].address, + cheatsList[i].value); + break; + case 1: + sprintf(cheatsList[i].codestring, "%08x:%04x", cheatsList[i].address, + cheatsList[i].value); + break; + case 2: + sprintf(cheatsList[i].codestring, "%08x:%08x", cheatsList[i].address, + cheatsList[i].value); + break; + } + } + + if(cheatsList[i].code == 512 && firstCodeBreaker) { + firstCodeBreaker = false; + char buffer[10]; + strncpy(buffer, cheatsList[i].codestring, 8); + buffer[8] = 0; + u32 address; + sscanf(buffer, "%x", &address); + if((address >> 28) == 9) { + strncpy(buffer, &cheatsList[i].codestring[9], 4); + buffer[4] = 0; + u32 value; + sscanf(buffer, "%x", &value); + + u32 seed[8]; + cheatsCBAParseSeedCode(address, value, seed); + cheatsCBAChangeEncryption(seed); + } + } + } + cheatsNumber = count; + fclose(f); + return true; +} + +extern int *extCpuLoopTicks; +extern int *extClockTicks; +extern int *extTicks; +extern int cpuSavedTicks; + +extern void debuggerBreakOnWrite(u32 *, u32, u32, int); + +#define CPU_BREAK_LOOP \ + cpuSavedTicks = cpuSavedTicks - *extCpuLoopTicks;\ + *extCpuLoopTicks = *extClockTicks;\ + *extTicks = *extClockTicks; + +void cheatsWriteMemory(u32 *address, u32 value, u32 mask) +{ +#ifdef BKPT_SUPPORT +#ifdef SDL + if(cheatsNumber == 0) { + debuggerBreakOnWrite(address, *address, value, 2); + CPU_BREAK_LOOP; + *address = value; + return; + } +#endif +#endif +} + +void cheatsWriteHalfWord(u16 *address, u16 value, u16 mask) +{ +#ifdef BKPT_SUPPORT +#ifdef SDL + if(cheatsNumber == 0) { + debuggerBreakOnWrite((u32 *)address, *address, value, 1); + CPU_BREAK_LOOP; + *address = value; + return; + } +#endif +#endif +} + +#if defined BKPT_SUPPORT && defined SDL +void cheatsWriteByte(u8 *address, u8 value) +#else +void cheatsWriteByte(u8 *, u8) +#endif +{ +#ifdef BKPT_SUPPORT +#ifdef SDL + if(cheatsNumber == 0) { + debuggerBreakOnWrite((u32 *)address, *address, value, 0); + CPU_BREAK_LOOP; + *address = value; + return; + } +#endif +#endif +} diff --git a/src/Cheats.h b/src/Cheats.h new file mode 100644 index 0000000..f689349 --- /dev/null +++ b/src/Cheats.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef GBA_CHEATS_H +#define GBA_CHEATS_H + +struct CheatsData { + int code; + int size; + int status; + bool enabled; + u32 address; + u32 value; + u32 oldValue; + char codestring[20]; + char desc[32]; +}; + +extern void cheatsAdd(const char *,const char *,u32,u32,int,int); +extern void cheatsAddCheatCode(const char *code, const char *desc); +extern void cheatsAddGSACode(const char *code, const char *desc, bool v3); +extern void cheatsAddCBACode(const char *code, const char *desc); +extern bool cheatsImportGSACodeFile(const char *name, int game, bool v3); +extern void cheatsDelete(int number, bool restore); +extern void cheatsDeleteAll(bool restore); +extern void cheatsEnable(int number); +extern void cheatsDisable(int number); +extern void cheatsSaveGame(gzFile file); +extern void cheatsReadGame(gzFile file); +extern void cheatsSaveCheatList(const char *file); +extern bool cheatsLoadCheatList(const char *file); +extern void cheatsWriteMemory(u32 *, u32, u32); +extern void cheatsWriteHalfWord(u16 *, u16, u16); +extern void cheatsWriteByte(u8 *, u8); +extern int cheatsCheckKeys(u32,u32); +extern int cheatsNumber; +extern CheatsData cheatsList[100]; +#endif // GBA_CHEATS_H diff --git a/src/EEprom.cpp b/src/EEprom.cpp new file mode 100644 index 0000000..f002956 --- /dev/null +++ b/src/EEprom.cpp @@ -0,0 +1,206 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "EEprom.h" +#include "Util.h" +#include + +extern int cpuDmaCount; + +int eepromMode = EEPROM_IDLE; +int eepromByte = 0; +int eepromBits = 0; +int eepromAddress = 0; +u8 eepromData[0x2000]; +u8 eepromBuffer[16]; +bool eepromInUse = false; +int eepromSize = 512; + +variable_desc eepromSaveData[] = { + { &eepromMode, sizeof(int) }, + { &eepromByte, sizeof(int) }, + { &eepromBits , sizeof(int) }, + { &eepromAddress , sizeof(int) }, + { &eepromInUse, sizeof(bool) }, + { &eepromData[0], 512 }, + { &eepromBuffer[0], 16 }, + { NULL, 0 } +}; + +void eepromReset() +{ + eepromMode = EEPROM_IDLE; + eepromByte = 0; + eepromBits = 0; + eepromAddress = 0; + eepromInUse = false; + eepromSize = 512; +} + +void eepromErase() +{ + memset(eepromData, 0, 0x2000*sizeof(u8)); + eepromMode = EEPROM_IDLE; + eepromByte = 0; + eepromBits = 0; + eepromAddress = 0; + eepromData[0x2000]; + memset(eepromBuffer, 0, 16*sizeof(u8)); + eepromInUse = false; + eepromSize = 512; + +} + +void eepromSaveGame(gzFile gzFile) +{ + utilWriteData(gzFile, eepromSaveData); + utilWriteInt(gzFile, eepromSize); + utilGzWrite(gzFile, eepromData, 0x2000); +} + +void eepromReadGame(gzFile gzFile, int version) +{ + utilReadData(gzFile, eepromSaveData); + if(version >= SAVE_GAME_VERSION_3) { + eepromSize = utilReadInt(gzFile); + utilGzRead(gzFile, eepromData, 0x2000); + } else { + // prior to 0.7.1, only 4K EEPROM was supported + eepromSize = 512; + } +} + + +int eepromRead(u32 /* address */) +{ + switch(eepromMode) { + case EEPROM_IDLE: + case EEPROM_READADDRESS: + case EEPROM_WRITEDATA: + return 1; + case EEPROM_READDATA: + { + eepromBits++; + if(eepromBits == 4) { + eepromMode = EEPROM_READDATA2; + eepromBits = 0; + eepromByte = 0; + } + return 0; + } + case EEPROM_READDATA2: + { + int data = 0; + int address = eepromAddress << 3; + int mask = 1 << (7 - (eepromBits & 7)); + data = (eepromData[address+eepromByte] & mask) ? 1 : 0; + eepromBits++; + if((eepromBits & 7) == 0) + eepromByte++; + if(eepromBits == 0x40) + eepromMode = EEPROM_IDLE; + return data; + } + default: + return 0; + } + return 1; +} + +void eepromWrite(u32 /* address */, u8 value) +{ + if(cpuDmaCount == 0) + return; + int bit = value & 1; + switch(eepromMode) { + case EEPROM_IDLE: + eepromByte = 0; + eepromBits = 1; + eepromBuffer[eepromByte] = bit; + eepromMode = EEPROM_READADDRESS; + break; + case EEPROM_READADDRESS: + eepromBuffer[eepromByte] <<= 1; + eepromBuffer[eepromByte] |= bit; + eepromBits++; + if((eepromBits & 7) == 0) { + eepromByte++; + } + if(cpuDmaCount == 0x11 || cpuDmaCount == 0x51) { + if(eepromBits == 0x11) { + eepromInUse = true; + eepromSize = 0x2000; + eepromAddress = ((eepromBuffer[0] & 0x3F) << 8) | + ((eepromBuffer[1] & 0xFF)); + if(!(eepromBuffer[0] & 0x40)) { + eepromBuffer[0] = bit; + eepromBits = 1; + eepromByte = 0; + eepromMode = EEPROM_WRITEDATA; + } else { + eepromMode = EEPROM_READDATA; + eepromByte = 0; + eepromBits = 0; + } + } + } else { + if(eepromBits == 9) { + eepromInUse = true; + eepromAddress = (eepromBuffer[0] & 0x3F); + if(!(eepromBuffer[0] & 0x40)) { + eepromBuffer[0] = bit; + eepromBits = 1; + eepromByte = 0; + eepromMode = EEPROM_WRITEDATA; + } else { + eepromMode = EEPROM_READDATA; + eepromByte = 0; + eepromBits = 0; + } + } + } + break; + case EEPROM_READDATA: + case EEPROM_READDATA2: + // should we reset here? + eepromMode = EEPROM_IDLE; + break; + case EEPROM_WRITEDATA: + eepromBuffer[eepromByte] <<= 1; + eepromBuffer[eepromByte] |= bit; + eepromBits++; + if((eepromBits & 7) == 0) { + eepromByte++; + } + if(eepromBits == 0x40) { + eepromInUse = true; + // write data; + for(int i = 0; i < 8; i++) { + eepromData[(eepromAddress << 3) + i] = eepromBuffer[i]; + } + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } else if(eepromBits == 0x41) { + eepromMode = EEPROM_IDLE; + eepromByte = 0; + eepromBits = 0; + } + break; + } +} + diff --git a/src/EEprom.h b/src/EEprom.h new file mode 100644 index 0000000..d6c414c --- /dev/null +++ b/src/EEprom.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_EEPROM_H +#define VBA_EEPROM_H + +extern void eepromSaveGame(gzFile gzFile); +extern void eepromReadGame(gzFile gzFile, int version); +extern int eepromRead(u32 address); +extern void eepromWrite(u32 address, u8 value); +extern void eepromReset(); +extern void eepromErase(); +extern u8 eepromData[0x2000]; +extern bool eepromInUse; +extern int eepromSize; + +#define EEPROM_IDLE 0 +#define EEPROM_READADDRESS 1 +#define EEPROM_READDATA 2 +#define EEPROM_READDATA2 3 +#define EEPROM_WRITEDATA 4 + +#endif // VBA_EEPROM_H diff --git a/src/Flash.cpp b/src/Flash.cpp new file mode 100644 index 0000000..4ec23ee --- /dev/null +++ b/src/Flash.cpp @@ -0,0 +1,258 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include "GBA.h" +#include "Globals.h" +#include "Flash.h" +#include "Sram.h" +#include "Util.h" + +#define FLASH_READ_ARRAY 0 +#define FLASH_CMD_1 1 +#define FLASH_CMD_2 2 +#define FLASH_AUTOSELECT 3 +#define FLASH_CMD_3 4 +#define FLASH_CMD_4 5 +#define FLASH_CMD_5 6 +#define FLASH_ERASE_COMPLETE 7 +#define FLASH_PROGRAM 8 +#define FLASH_SETBANK 9 + +u8 flashSaveMemory[0x20000]; +int flashState = FLASH_READ_ARRAY; +int flashReadState = FLASH_READ_ARRAY; +int flashSize = 0x10000; +int flashDeviceID = 0x1b; +int flashManufacturerID = 0x32; +int flashBank = 0; + +static variable_desc flashSaveData[] = { + { &flashState, sizeof(int) }, + { &flashReadState, sizeof(int) }, + { &flashSaveMemory[0], 0x10000 }, + { NULL, 0 } +}; + +static variable_desc flashSaveData2[] = { + { &flashState, sizeof(int) }, + { &flashReadState, sizeof(int) }, + { &flashSize, sizeof(int) }, + { &flashSaveMemory[0], 0x20000 }, + { NULL, 0 } +}; + +static variable_desc flashSaveData3[] = { + { &flashState, sizeof(int) }, + { &flashReadState, sizeof(int) }, + { &flashSize, sizeof(int) }, + { &flashBank, sizeof(int) }, + { &flashSaveMemory[0], 0x20000 }, + { NULL, 0 } +}; + +void flashReset() +{ + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + flashBank = 0; +} + +void flashErase() +{ + memset(flashSaveMemory, 0, 0x20000*sizeof(u8)); + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + flashSize = 0x10000; + flashDeviceID = 0x1b; + flashManufacturerID = 0x32; + flashBank = 0; +} + +void flashSaveGame(gzFile gzFile) +{ + utilWriteData(gzFile, flashSaveData3); +} + +void flashReadGame(gzFile gzFile, int version) +{ + if(version < SAVE_GAME_VERSION_5) + utilReadData(gzFile, flashSaveData); + else if(version < SAVE_GAME_VERSION_7) { + utilReadData(gzFile, flashSaveData2); + flashBank = 0; + flashSetSize(flashSize); + } else { + utilReadData(gzFile, flashSaveData3); + } +} + +void flashSetSize(int size) +{ + // log("Setting flash size to %d\n", size); + flashSize = size; + if(size == 0x10000) { + flashDeviceID = 0x1b; + flashManufacturerID = 0x32; + } else { + flashDeviceID = 0x13; //0x09; + flashManufacturerID = 0x62; //0xc2; + } +} + +u8 flashRead(u32 address) +{ + // log("Reading %08x from %08x\n", address, reg[15].I); + // log("Current read state is %d\n", flashReadState); + address &= 0xFFFF; + + switch(flashReadState) { + case FLASH_READ_ARRAY: + return flashSaveMemory[(flashBank << 16) + address]; + case FLASH_AUTOSELECT: + switch(address & 0xFF) { + case 0: + // manufacturer ID + return flashManufacturerID; + case 1: + // device ID + return flashDeviceID; + } + break; + case FLASH_ERASE_COMPLETE: + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + return 0xFF; + }; + return 0; +} + +void flashSaveDecide(u32 address, u8 byte) +{ + // log("Deciding save type %08x\n", address); + if(address == 0x0e005555) { + saveType = 2; + cpuSaveGameFunc = flashWrite; + } else { + saveType = 1; + cpuSaveGameFunc = sramWrite; + } + + (*cpuSaveGameFunc)(address, byte); +} + +void flashWrite(u32 address, u8 byte) +{ + // log("Writing %02x at %08x\n", byte, address); + // log("Current state is %d\n", flashState); + address &= 0xFFFF; + switch(flashState) { + case FLASH_READ_ARRAY: + if(address == 0x5555 && byte == 0xAA) + flashState = FLASH_CMD_1; + break; + case FLASH_CMD_1: + if(address == 0x2AAA && byte == 0x55) + flashState = FLASH_CMD_2; + else + flashState = FLASH_READ_ARRAY; + break; + case FLASH_CMD_2: + if(address == 0x5555) { + if(byte == 0x90) { + flashState = FLASH_AUTOSELECT; + flashReadState = FLASH_AUTOSELECT; + } else if(byte == 0x80) { + flashState = FLASH_CMD_3; + } else if(byte == 0xF0) { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } else if(byte == 0xA0) { + flashState = FLASH_PROGRAM; + } else if(byte == 0xB0 && flashSize == 0x20000) { + flashState = FLASH_SETBANK; + } else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + } else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + break; + case FLASH_CMD_3: + if(address == 0x5555 && byte == 0xAA) { + flashState = FLASH_CMD_4; + } else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + break; + case FLASH_CMD_4: + if(address == 0x2AAA && byte == 0x55) { + flashState = FLASH_CMD_5; + } else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + break; + case FLASH_CMD_5: + if(byte == 0x30) { + // SECTOR ERASE + memset(&flashSaveMemory[(flashBank << 16) + (address & 0xF000)], + 0, + 0x1000); + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + flashReadState = FLASH_ERASE_COMPLETE; + } else if(byte == 0x10) { + // CHIP ERASE + memset(flashSaveMemory, 0, flashSize); + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + flashReadState = FLASH_ERASE_COMPLETE; + } else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + break; + case FLASH_AUTOSELECT: + if(byte == 0xF0) { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } else if(address == 0x5555 && byte == 0xAA) + flashState = FLASH_CMD_1; + else { + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + } + break; + case FLASH_PROGRAM: + flashSaveMemory[(flashBank<<16)+address] = byte; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + break; + case FLASH_SETBANK: + if(address == 0) { + flashBank = (byte & 1); + } + flashState = FLASH_READ_ARRAY; + flashReadState = FLASH_READ_ARRAY; + break; + } +} diff --git a/src/Flash.h b/src/Flash.h new file mode 100644 index 0000000..b6a4108 --- /dev/null +++ b/src/Flash.h @@ -0,0 +1,34 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_FLASH_H +#define VBA_FLASH_H + +extern void flashSaveGame(gzFile gzFile); +extern void flashReadGame(gzFile gzFile, int version); +extern u8 flashRead(u32 address); +extern void flashWrite(u32 address, u8 byte); +extern u8 flashSaveMemory[0x20000]; +extern void flashSaveDecide(u32 address, u8 byte); +extern void flashReset(); +extern void flashErase(); +extern void flashSetSize(int size); + +extern int flashSize; +#endif // VBA_FLASH_H diff --git a/src/GBA.cpp b/src/GBA.cpp new file mode 100644 index 0000000..765ef81 --- /dev/null +++ b/src/GBA.cpp @@ -0,0 +1,4282 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if (defined(WIN32) && !defined(SDL)) +# include "win32/stdafx.h" +# include "win32/vba.h" +#endif + +#include +#include +#include +#include +#include + +#include "GBA.h" +#include "GBAinline.h" +#include "Globals.h" +#include "Gfx.h" +#include "EEprom.h" +#include "Flash.h" +#include "Sound.h" +#include "Sram.h" +#include "bios.h" +#include "unzip.h" +#include "Cheats.h" +#include "NLS.h" +#include "elf.h" +#include "Util.h" +#include "Port.h" +#include "agbprint.h" +#ifdef PROFILING +#include "prof/prof.h" +#endif +#include "movie.h" + +#define UPDATE_REG(address, value) WRITE16LE(((u16 *)&ioMem[address]),value) + +#ifdef __GNUC__ +#define _stricmp strcasecmp +#endif + +#define CPU_BREAK_LOOP \ + cpuSavedTicks = cpuSavedTicks - *extCpuLoopTicks;\ + *extCpuLoopTicks = *extClockTicks; + +#define CPU_BREAK_LOOP_2 \ + cpuSavedTicks = cpuSavedTicks - *extCpuLoopTicks;\ + *extCpuLoopTicks = *extClockTicks;\ + *extTicks = *extClockTicks; + +extern int emulating; + +int cpuDmaTicksToUpdate = 0; +int cpuDmaCount = 0; +bool cpuDmaHack = 0; +u32 cpuDmaLast = 0; +int dummyAddress = 0; + +int *extCpuLoopTicks = NULL; +int *extClockTicks = NULL; +int *extTicks = NULL; + +#if (defined(WIN32) && !defined(SDL)) +HANDLE mapROM; // shared memory handles +HANDLE mapWORKRAM; +HANDLE mapBIOS; +HANDLE mapIRAM; +HANDLE mapPALETTERAM; +HANDLE mapVRAM; +HANDLE mapOAM; +HANDLE mapPIX; +HANDLE mapIOMEM; +#endif + +int gbaSaveType = 0; // used to remember the save type on reset +bool intState = false; +bool stopState = false; +bool holdState = false; +int holdType = 0; +bool cpuSramEnabled = true; +bool cpuFlashEnabled = true; +bool cpuEEPROMEnabled = true; +bool cpuEEPROMSensorEnabled = false; + +#ifdef PROFILING +int profilingTicks = 0; +int profilingTicksReload = 0; +static char *profilBuffer = NULL; +static int profilSize = 0; +static u32 profilLowPC = 0; +static int profilScale = 0; +#endif +bool freezeWorkRAM[0x40000]; +bool freezeInternalRAM[0x8000]; +int lcdTicks = 960; +bool timer0On = false; +int timer0Ticks = 0; +int timer0Reload = 0; +int timer0ClockReload = 0; +bool timer1On = false; +int timer1Ticks = 0; +int timer1Reload = 0; +int timer1ClockReload = 0; +bool timer2On = false; +int timer2Ticks = 0; +int timer2Reload = 0; +int timer2ClockReload = 0; +bool timer3On = false; +int timer3Ticks = 0; +int timer3Reload = 0; +int timer3ClockReload = 0; +u32 dma0Source = 0; +u32 dma0Dest = 0; +u32 dma1Source = 0; +u32 dma1Dest = 0; +u32 dma2Source = 0; +u32 dma2Dest = 0; +u32 dma3Source = 0; +u32 dma3Dest = 0; +void (*cpuSaveGameFunc)(u32,u8) = flashSaveDecide; +void (*renderLine)() = mode0RenderLine; +bool fxOn = false; +bool windowOn = false; +int frameCount = 0; +char buffer[1024]; +FILE *out = NULL; +u32 lastTime = 0; +int count = 0; +bool prefetchActive = false, prefetchPrevActive = false, prefetchApplies = false; + +static bool pauseAfterFrameAdvance = false; + +int capture = 0; +int capturePrevious = 0; +int captureNumber = 0; + +const int TIMER_TICKS[4] = { + 1, + 64, + 256, + 1024 +}; + +const int thumbCycles[] = { +// 0 1 2 3 4 5 6 7 8 9 a b c d e f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 4 + 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 5 + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, // 6 + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, // 7 + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, // 8 + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, // 9 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // a + 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, // b + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // c + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, // d + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // e + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // f +}; + +const int gamepakRamWaitState[4] = { 4, 3, 2, 8 }; +const int gamepakWaitState[8] = { 4, 3, 2, 8, 4, 3, 2, 8 }; +const int gamepakWaitState0[8] = { 2, 2, 2, 2, 1, 1, 1, 1 }; +const int gamepakWaitState1[8] = { 4, 4, 4, 4, 1, 1, 1, 1 }; +const int gamepakWaitState2[8] = { 8, 8, 8, 8, 1, 1, 1, 1 }; + +int memoryWait[16] = + { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; +int memoryWait32[16] = + { 0, 0, 9, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 0 }; +int memoryWaitSeq[16] = + { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; +int memoryWaitSeq32[16] = + { 2, 0, 3, 0, 0, 2, 2, 0, 4, 4, 8, 8, 16, 16, 8, 0 }; +int memoryWaitFetch[16] = + { 3, 0, 3, 0, 0, 1, 1, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; +int memoryWaitFetch32[16] = + { 6, 0, 6, 0, 0, 2, 2, 0, 8, 8, 8, 8, 8, 8, 8, 0 }; + +const int cpuMemoryWait[16] = { + 0, 0, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 0, 0 +}; +const int cpuMemoryWait32[16] = { + 0, 0, 3, 0, 0, 0, 0, 0, + 3, 3, 3, 3, 3, 3, 0, 0 +}; + +const bool memory32[16] = + { true, false, false, true, true, false, false, true, false, false, false, false, false, false, true, false}; + +u8 biosProtected[4]; + +#ifdef WORDS_BIGENDIAN +bool cpuBiosSwapped = false; +#endif + +u32 myROM[] = { +0xEA000006, +0xEA000093, +0xEA000006, +0x00000000, +0x00000000, +0x00000000, +0xEA000088, +0x00000000, +0xE3A00302, +0xE1A0F000, +0xE92D5800, +0xE55EC002, +0xE28FB03C, +0xE79BC10C, +0xE14FB000, +0xE92D0800, +0xE20BB080, +0xE38BB01F, +0xE129F00B, +0xE92D4004, +0xE1A0E00F, +0xE12FFF1C, +0xE8BD4004, +0xE3A0C0D3, +0xE129F00C, +0xE8BD0800, +0xE169F00B, +0xE8BD5800, +0xE1B0F00E, +0x0000009C, +0x0000009C, +0x0000009C, +0x0000009C, +0x000001F8, +0x000001F0, +0x000000AC, +0x000000A0, +0x000000FC, +0x00000168, +0xE12FFF1E, +0xE1A03000, +0xE1A00001, +0xE1A01003, +0xE2113102, +0x42611000, +0xE033C040, +0x22600000, +0xE1B02001, +0xE15200A0, +0x91A02082, +0x3AFFFFFC, +0xE1500002, +0xE0A33003, +0x20400002, +0xE1320001, +0x11A020A2, +0x1AFFFFF9, +0xE1A01000, +0xE1A00003, +0xE1B0C08C, +0x22600000, +0x42611000, +0xE12FFF1E, +0xE92D0010, +0xE1A0C000, +0xE3A01001, +0xE1500001, +0x81A000A0, +0x81A01081, +0x8AFFFFFB, +0xE1A0000C, +0xE1A04001, +0xE3A03000, +0xE1A02001, +0xE15200A0, +0x91A02082, +0x3AFFFFFC, +0xE1500002, +0xE0A33003, +0x20400002, +0xE1320001, +0x11A020A2, +0x1AFFFFF9, +0xE0811003, +0xE1B010A1, +0xE1510004, +0x3AFFFFEE, +0xE1A00004, +0xE8BD0010, +0xE12FFF1E, +0xE0010090, +0xE1A01741, +0xE2611000, +0xE3A030A9, +0xE0030391, +0xE1A03743, +0xE2833E39, +0xE0030391, +0xE1A03743, +0xE2833C09, +0xE283301C, +0xE0030391, +0xE1A03743, +0xE2833C0F, +0xE28330B6, +0xE0030391, +0xE1A03743, +0xE2833C16, +0xE28330AA, +0xE0030391, +0xE1A03743, +0xE2833A02, +0xE2833081, +0xE0030391, +0xE1A03743, +0xE2833C36, +0xE2833051, +0xE0030391, +0xE1A03743, +0xE2833CA2, +0xE28330F9, +0xE0000093, +0xE1A00840, +0xE12FFF1E, +0xE3A00001, +0xE3A01001, +0xE92D4010, +0xE3A0C301, +0xE3A03000, +0xE3A04001, +0xE3500000, +0x1B000004, +0xE5CC3301, +0xEB000002, +0x0AFFFFFC, +0xE8BD4010, +0xE12FFF1E, +0xE5CC3208, +0xE15C20B8, +0xE0110002, +0x10200002, +0x114C00B8, +0xE5CC4208, +0xE12FFF1E, +0xE92D500F, +0xE3A00301, +0xE1A0E00F, +0xE510F004, +0xE8BD500F, +0xE25EF004, +0xE59FD044, +0xE92D5000, +0xE14FC000, +0xE10FE000, +0xE92D5000, +0xE3A0C302, +0xE5DCE09C, +0xE35E00A5, +0x1A000004, +0x05DCE0B4, +0x021EE080, +0xE28FE004, +0x159FF018, +0x059FF018, +0xE59FD018, +0xE8BD5000, +0xE169F00C, +0xE8BD5000, +0xE25EF004, +0x03007FF0, +0x09FE2000, +0x09FFC000, +0x03007FE0 +}; + +variable_desc saveGameStruct[] = { + { &DISPCNT , sizeof(u16) }, + { &DISPSTAT , sizeof(u16) }, + { &VCOUNT , sizeof(u16) }, + { &BG0CNT , sizeof(u16) }, + { &BG1CNT , sizeof(u16) }, + { &BG2CNT , sizeof(u16) }, + { &BG3CNT , sizeof(u16) }, + { &BG0HOFS , sizeof(u16) }, + { &BG0VOFS , sizeof(u16) }, + { &BG1HOFS , sizeof(u16) }, + { &BG1VOFS , sizeof(u16) }, + { &BG2HOFS , sizeof(u16) }, + { &BG2VOFS , sizeof(u16) }, + { &BG3HOFS , sizeof(u16) }, + { &BG3VOFS , sizeof(u16) }, + { &BG2PA , sizeof(u16) }, + { &BG2PB , sizeof(u16) }, + { &BG2PC , sizeof(u16) }, + { &BG2PD , sizeof(u16) }, + { &BG2X_L , sizeof(u16) }, + { &BG2X_H , sizeof(u16) }, + { &BG2Y_L , sizeof(u16) }, + { &BG2Y_H , sizeof(u16) }, + { &BG3PA , sizeof(u16) }, + { &BG3PB , sizeof(u16) }, + { &BG3PC , sizeof(u16) }, + { &BG3PD , sizeof(u16) }, + { &BG3X_L , sizeof(u16) }, + { &BG3X_H , sizeof(u16) }, + { &BG3Y_L , sizeof(u16) }, + { &BG3Y_H , sizeof(u16) }, + { &WIN0H , sizeof(u16) }, + { &WIN1H , sizeof(u16) }, + { &WIN0V , sizeof(u16) }, + { &WIN1V , sizeof(u16) }, + { &WININ , sizeof(u16) }, + { &WINOUT , sizeof(u16) }, + { &MOSAIC , sizeof(u16) }, + { &BLDMOD , sizeof(u16) }, + { &COLEV , sizeof(u16) }, + { &COLY , sizeof(u16) }, + { &DM0SAD_L , sizeof(u16) }, + { &DM0SAD_H , sizeof(u16) }, + { &DM0DAD_L , sizeof(u16) }, + { &DM0DAD_H , sizeof(u16) }, + { &DM0CNT_L , sizeof(u16) }, + { &DM0CNT_H , sizeof(u16) }, + { &DM1SAD_L , sizeof(u16) }, + { &DM1SAD_H , sizeof(u16) }, + { &DM1DAD_L , sizeof(u16) }, + { &DM1DAD_H , sizeof(u16) }, + { &DM1CNT_L , sizeof(u16) }, + { &DM1CNT_H , sizeof(u16) }, + { &DM2SAD_L , sizeof(u16) }, + { &DM2SAD_H , sizeof(u16) }, + { &DM2DAD_L , sizeof(u16) }, + { &DM2DAD_H , sizeof(u16) }, + { &DM2CNT_L , sizeof(u16) }, + { &DM2CNT_H , sizeof(u16) }, + { &DM3SAD_L , sizeof(u16) }, + { &DM3SAD_H , sizeof(u16) }, + { &DM3DAD_L , sizeof(u16) }, + { &DM3DAD_H , sizeof(u16) }, + { &DM3CNT_L , sizeof(u16) }, + { &DM3CNT_H , sizeof(u16) }, + { &TM0D , sizeof(u16) }, + { &TM0CNT , sizeof(u16) }, + { &TM1D , sizeof(u16) }, + { &TM1CNT , sizeof(u16) }, + { &TM2D , sizeof(u16) }, + { &TM2CNT , sizeof(u16) }, + { &TM3D , sizeof(u16) }, + { &TM3CNT , sizeof(u16) }, + { &P1 , sizeof(u16) }, + { &IE , sizeof(u16) }, + { &IF , sizeof(u16) }, + { &IME , sizeof(u16) }, + { &holdState, sizeof(bool) }, + { &holdType, sizeof(int) }, + { &lcdTicks, sizeof(int) }, + { &timer0On , sizeof(bool) }, + { &timer0Ticks , sizeof(int) }, + { &timer0Reload , sizeof(int) }, + { &timer0ClockReload , sizeof(int) }, + { &timer1On , sizeof(bool) }, + { &timer1Ticks , sizeof(int) }, + { &timer1Reload , sizeof(int) }, + { &timer1ClockReload , sizeof(int) }, + { &timer2On , sizeof(bool) }, + { &timer2Ticks , sizeof(int) }, + { &timer2Reload , sizeof(int) }, + { &timer2ClockReload , sizeof(int) }, + { &timer3On , sizeof(bool) }, + { &timer3Ticks , sizeof(int) }, + { &timer3Reload , sizeof(int) }, + { &timer3ClockReload , sizeof(int) }, + { &dma0Source , sizeof(u32) }, + { &dma0Dest , sizeof(u32) }, + { &dma1Source , sizeof(u32) }, + { &dma1Dest , sizeof(u32) }, + { &dma2Source , sizeof(u32) }, + { &dma2Dest , sizeof(u32) }, + { &dma3Source , sizeof(u32) }, + { &dma3Dest , sizeof(u32) }, + { &fxOn, sizeof(bool) }, + { &windowOn, sizeof(bool) }, + { &N_FLAG , sizeof(bool) }, + { &C_FLAG , sizeof(bool) }, + { &Z_FLAG , sizeof(bool) }, + { &V_FLAG , sizeof(bool) }, + { &armState , sizeof(bool) }, + { &armIrqEnable , sizeof(bool) }, + { &armNextPC , sizeof(u32) }, + { &armMode , sizeof(int) }, + { &saveType , sizeof(int) }, + { NULL, 0 } +}; + +//int cpuLoopTicks = 0; +int cpuSavedTicks = 0; + +#ifdef PROFILING +void cpuProfil(char *buf, int size, u32 lowPC, int scale) +{ + profilBuffer = buf; + profilSize = size; + profilLowPC = lowPC; + profilScale = scale; +} + +void cpuEnableProfiling(int hz) +{ + if(hz == 0) + hz = 100; + profilingTicks = profilingTicksReload = 16777216 / hz; + profSetHertz(hz); +} +#endif + +inline int CPUUpdateTicksAccess32(u32 address) +{ + return memoryWait32[(address>>24)&15]; +} + +inline int CPUUpdateTicksAccess16(u32 address) +{ + return memoryWait[(address>>24)&15]; +} + +inline int CPUUpdateTicksAccessSeq32(u32 address) +{ + return memoryWaitSeq32[(address>>24)&15]; +} + +inline int CPUUpdateTicksAccessSeq16(u32 address) +{ + return memoryWaitSeq[(address>>24)&15]; +} + +inline int CPUUpdateTicks() +{ + int cpuLoopTicks = lcdTicks; + + if(soundTicks < cpuLoopTicks) + cpuLoopTicks = soundTicks; + + if(timer0On && !(TM0CNT & 4) && (timer0Ticks < cpuLoopTicks)) { + cpuLoopTicks = timer0Ticks; + } + if(timer1On && !(TM1CNT & 4) && (timer1Ticks < cpuLoopTicks)) { + cpuLoopTicks = timer1Ticks; + } + if(timer2On && !(TM2CNT & 4) && (timer2Ticks < cpuLoopTicks)) { + cpuLoopTicks = timer2Ticks; + } + if(timer3On && !(TM3CNT & 4) && (timer3Ticks < cpuLoopTicks)) { + cpuLoopTicks = timer3Ticks; + } +#ifdef PROFILING + if(profilingTicksReload != 0) { + if(profilingTicks < cpuLoopTicks) { + cpuLoopTicks = profilingTicks; + } + } +#endif + cpuSavedTicks = cpuLoopTicks; + return cpuLoopTicks; +} + +void CPUUpdateWindow0() +{ + int x00 = WIN0H>>8; + int x01 = WIN0H & 255; + + if(x00 <= x01) { + for(int i = 0; i < 240; i++) { + gfxInWin0[i] = (i >= x00 && i < x01); + } + } else { + for(int i = 0; i < 240; i++) { + gfxInWin0[i] = (i >= x00 || i < x01); + } + } +} + +void CPUUpdateWindow1() +{ + int x00 = WIN1H>>8; + int x01 = WIN1H & 255; + + if(x00 <= x01) { + for(int i = 0; i < 240; i++) { + gfxInWin1[i] = (i >= x00 && i < x01); + } + } else { + for(int i = 0; i < 240; i++) { + gfxInWin1[i] = (i >= x00 || i < x01); + } + } +} + +extern u32 line0[240]; +extern u32 line1[240]; +extern u32 line2[240]; +extern u32 line3[240]; + +#define CLEAR_ARRAY(a) \ + {\ + u32 *array = (a);\ + for(int i = 0; i < 240; i++) {\ + *array++ = 0x80000000;\ + }\ + }\ + +void CPUUpdateRenderBuffers(bool force) +{ + if(!(layerEnable & 0x0100) || force) { + CLEAR_ARRAY(line0); + } + if(!(layerEnable & 0x0200) || force) { + CLEAR_ARRAY(line1); + } + if(!(layerEnable & 0x0400) || force) { + CLEAR_ARRAY(line2); + } + if(!(layerEnable & 0x0800) || force) { + CLEAR_ARRAY(line3); + } +} + +bool CPUWriteStateToStream(gzFile gzFile) +{ + utilWriteInt(gzFile, SAVE_GAME_VERSION); + + utilGzWrite(gzFile, &rom[0xa0], 16); + + utilWriteInt(gzFile, useBios); + + utilGzWrite(gzFile, ®[0], sizeof(reg)); + + utilWriteData(gzFile, saveGameStruct); + + // new to version 0.7.1 + utilWriteInt(gzFile, stopState); + // new to version 0.8 + utilWriteInt(gzFile, intState); + + utilGzWrite(gzFile, internalRAM, 0x8000); + utilGzWrite(gzFile, paletteRAM, 0x400); + utilGzWrite(gzFile, workRAM, 0x40000); + utilGzWrite(gzFile, vram, 0x20000); + utilGzWrite(gzFile, oam, 0x400); + utilGzWrite(gzFile, pix, 4*241*162); + utilGzWrite(gzFile, ioMem, 0x400); + + eepromSaveGame(gzFile); + flashSaveGame(gzFile); + soundSaveGame(gzFile); + + cheatsSaveGame(gzFile); + + // version 1.5 + rtcSaveGame(gzFile); + + + // SAVE_GAME_VERSION_9 (new to re-recording version which is based on 1.72) + { +#if (defined(WIN32) && !defined(SDL)) + utilGzWrite(gzFile, &theApp.sensorX, sizeof(theApp.sensorX)); + utilGzWrite(gzFile, &theApp.sensorY, sizeof(theApp.sensorY)); +#else + extern int sensorX, sensorY; // from SDL.cpp + utilGzWrite(gzFile, &sensorX, sizeof(sensorX)); + utilGzWrite(gzFile, &sensorY, sizeof(sensorY)); +#endif + bool8 movieActive = VBAMovieActive(); + utilGzWrite(gzFile, &movieActive, sizeof(movieActive)); + if(movieActive) + { + uint8* movie_freeze_buf = NULL; + uint32 movie_freeze_size = 0; + + VBAMovieFreeze(&movie_freeze_buf, &movie_freeze_size); + if(movie_freeze_buf) + { + utilGzWrite(gzFile, &movie_freeze_size, sizeof(movie_freeze_size)); + utilGzWrite(gzFile, movie_freeze_buf, movie_freeze_size); + delete [] movie_freeze_buf; + } + else + { + systemMessage(0, N_("Failed to save movie snapshot.")); + return false; + } + } +#if (defined(WIN32) && !defined(SDL)) + utilGzWrite(gzFile, &theApp.globalFrameCount, sizeof(theApp.globalFrameCount)); +#else + int dummy = 0; + utilGzWrite(gzFile, &dummy, sizeof(dummy)); +#endif + } + + // SAVE_GAME_VERSION_10 + { + utilGzWrite(gzFile, memoryWait, 16*sizeof(int)); + utilGzWrite(gzFile, memoryWait32, 16*sizeof(int)); + utilGzWrite(gzFile, memoryWaitSeq, 16*sizeof(int)); + utilGzWrite(gzFile, memoryWaitSeq32, 16*sizeof(int)); + utilGzWrite(gzFile, memoryWaitFetch, 16*sizeof(int)); + utilGzWrite(gzFile, memoryWaitFetch32, 16*sizeof(int)); + } + + // SAVE_GAME_VERSION_11 + { + utilGzWrite(gzFile, &prefetchActive, sizeof(bool)); + utilGzWrite(gzFile, &prefetchPrevActive, sizeof(bool)); + utilGzWrite(gzFile, &prefetchApplies, sizeof(bool)); + } + + // SAVE_GAME_VERSION_12 + { + utilGzWrite(gzFile, &memLagTempEnabled, sizeof(bool)); // necessary + utilGzWrite(gzFile, &speedHack, sizeof(bool)); // just in case it's ever used... + } + + + return true; +} + +bool CPUWriteState(const char *file) +{ + gzFile gzFile = utilGzOpen(file, "wb"); + + if(gzFile == NULL) { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), file); + return false; + } + + bool res = CPUWriteStateToStream(gzFile); + + utilGzClose(gzFile); + + return res; +} + +bool CPUWriteMemState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "w"); + + if(gzFile == NULL) { + return false; + } + + bool res = CPUWriteStateToStream(gzFile); + + long pos = utilGzMemTell(gzFile)+8; + + if(pos >= (available)) + res = false; + + utilGzClose(gzFile); + + return res; +} + +static int tempStateID = 0; +static int tempFailCount = 0; +static bool backupSafe = true; + +bool CPUReadStateFromStream(gzFile gzFile) +{ + bool ub; + char tempBackupName [128]; + if(backupSafe) + { + sprintf(tempBackupName, "gbatempsave%d.sav", tempStateID++); + CPUWriteState(tempBackupName); + } + + int version = utilReadInt(gzFile); + + if(version > SAVE_GAME_VERSION || version < SAVE_GAME_VERSION_1) { + systemMessage(MSG_UNSUPPORTED_VBA_SGM, + N_("Unsupported VisualBoyAdvance save game version %d"), + version); + goto failedLoad; + } + + u8 romname[17]; + + utilGzRead(gzFile, romname, 16); + + if(memcmp(&rom[0xa0], romname, 16) != 0) { + romname[16]=0; + for(int i = 0; i < 16; i++) + if(romname[i] < 32) + romname[i] = 32; + systemMessage(MSG_CANNOT_LOAD_SGM, N_("Cannot load save game for %s"), romname); + goto failedLoad; + } + + ub = utilReadInt(gzFile) ? true : false; + + if(ub != useBios) { + if(useBios) + systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS, + N_("Save game is not using the BIOS files")); + else + systemMessage(MSG_SAVE_GAME_USING_BIOS, + N_("Save game is using the BIOS file")); + goto failedLoad; + } + + utilGzRead(gzFile, ®[0], sizeof(reg)); + + utilReadData(gzFile, saveGameStruct); + + if(version < SAVE_GAME_VERSION_3) + stopState = false; + else + stopState = utilReadInt(gzFile) ? true : false; + + if(version < SAVE_GAME_VERSION_4) + intState = false; + else + intState = utilReadInt(gzFile) ? true : false; + + utilGzRead(gzFile, internalRAM, 0x8000); + utilGzRead(gzFile, paletteRAM, 0x400); + utilGzRead(gzFile, workRAM, 0x40000); + utilGzRead(gzFile, vram, 0x20000); + utilGzRead(gzFile, oam, 0x400); + if(version < SAVE_GAME_VERSION_6) + utilGzRead(gzFile, pix, 4*240*160); + else + utilGzRead(gzFile, pix, 4*241*162); + utilGzRead(gzFile, ioMem, 0x400); + + eepromReadGame(gzFile, version); + flashReadGame(gzFile, version); + soundReadGame(gzFile, version); + + if(version > SAVE_GAME_VERSION_1) { + cheatsReadGame(gzFile); + } + if(version > SAVE_GAME_VERSION_6) { + rtcReadGame(gzFile); + } + + if(version <= SAVE_GAME_VERSION_7) { + u32 temp; +#define SWAP(a,b,c) \ + temp = (a);\ + (a) = (b)<<16|(c);\ + (b) = (temp) >> 16;\ + (c) = (temp) & 0xFFFF; + + SWAP(dma0Source, DM0SAD_H, DM0SAD_L); + SWAP(dma0Dest, DM0DAD_H, DM0DAD_L); + SWAP(dma1Source, DM1SAD_H, DM1SAD_L); + SWAP(dma1Dest, DM1DAD_H, DM1DAD_L); + SWAP(dma2Source, DM2SAD_H, DM2SAD_L); + SWAP(dma2Dest, DM2DAD_H, DM2DAD_L); + SWAP(dma3Source, DM3SAD_H, DM3SAD_L); + SWAP(dma3Dest, DM3DAD_H, DM3DAD_L); + } + + // set pointers! + layerEnable = layerSettings & DISPCNT; + + CPUUpdateRender(); + CPUUpdateRenderBuffers(true); + CPUUpdateWindow0(); + CPUUpdateWindow1(); + gbaSaveType = 0; + switch(saveType) { + case 0: + cpuSaveGameFunc = flashSaveDecide; + break; + case 1: + cpuSaveGameFunc = sramWrite; + gbaSaveType = 1; + break; + case 2: + cpuSaveGameFunc = flashWrite; + gbaSaveType = 2; + break; + default: + systemMessage(MSG_UNSUPPORTED_SAVE_TYPE, + N_("Unsupported save type %d"), saveType); + break; + } + if(eepromInUse) + gbaSaveType = 3; + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + if(version >= SAVE_GAME_VERSION_9) // new to re-recording version: + { +#if (defined(WIN32) && !defined(SDL)) + utilGzRead(gzFile, &theApp.sensorX, sizeof(theApp.sensorX)); + utilGzRead(gzFile, &theApp.sensorY, sizeof(theApp.sensorY)); +#else + extern int sensorX, sensorY; // from SDL.cpp + utilGzRead(gzFile, &sensorX, sizeof(sensorX)); + utilGzRead(gzFile, &sensorY, sizeof(sensorY)); +#endif + bool8 movieSnapshot; + utilGzRead(gzFile, &movieSnapshot, sizeof(movieSnapshot)); + if(VBAMovieActive() && !movieSnapshot) + { + systemMessage(0, N_("Can't load a non-movie snapshot while a movie is active.")); + goto failedLoad; + } +#if (defined(WIN32) && !defined(SDL)) + extern bool8 loadedMovieSnapshot; + loadedMovieSnapshot = movieSnapshot; +#endif + if(movieSnapshot) // even if a movie isn't active we still want to parse through this in case other stuff is added later on in the save format + { + uint32 movieInputDataSize = 0; + utilGzRead(gzFile, &movieInputDataSize, sizeof(movieInputDataSize)); + uint8* local_movie_data = new uint8 [movieInputDataSize]; + int readBytes = utilGzRead(gzFile, local_movie_data, movieInputDataSize); + if(readBytes != movieInputDataSize) + { + systemMessage(0, N_("Corrupt movie snapshot.")); + if(local_movie_data) delete [] local_movie_data; + goto failedLoad; + } + int code = VBAMovieUnfreeze(local_movie_data, movieInputDataSize); + if(local_movie_data) delete [] local_movie_data; + if(code != SUCCESS && VBAMovieActive()) + { + char errStr [1024]; + strcpy(errStr, "Failed to load movie snapshot"); + switch(code) + { + case NOT_FROM_THIS_MOVIE: strcat(errStr, ";\nSnapshot not from this movie"); break; + case NOT_FROM_A_MOVIE: strcat(errStr, ";\nNot a movie snapshot"); break;// shouldn't get here... + case INVALID_FRAME: strcat(errStr, ";\nInvalid frame number"); break; + case WRONG_FORMAT: strcat(errStr, ";\nWrong format"); break; + } + strcat(errStr, "."); + systemMessage(0, N_(errStr)); + goto failedLoad; + } + } +#if (defined(WIN32) && !defined(SDL)) + utilGzRead(gzFile, &theApp.globalFrameCount, sizeof(theApp.globalFrameCount)); +#else + int dummy; + utilGzRead(gzFile, &dummy, sizeof(dummy)); +#endif + } + if(version >= SAVE_GAME_VERSION_10) + { + utilGzRead(gzFile, memoryWait, 16*sizeof(int)); + utilGzRead(gzFile, memoryWait32, 16*sizeof(int)); + utilGzRead(gzFile, memoryWaitSeq, 16*sizeof(int)); + utilGzRead(gzFile, memoryWaitSeq32, 16*sizeof(int)); + utilGzRead(gzFile, memoryWaitFetch, 16*sizeof(int)); + utilGzRead(gzFile, memoryWaitFetch32, 16*sizeof(int)); + } + if(version >= SAVE_GAME_VERSION_11) + { + utilGzRead(gzFile, &prefetchActive, sizeof(bool)); + //if(prefetchActive && !prefetchPrevActive) systemScreenMessage("pre-fetch enabled",3,600); + //if(!prefetchActive && prefetchPrevActive) systemScreenMessage("pre-fetch disabled",3,600); + utilGzRead(gzFile, &prefetchPrevActive, sizeof(bool)); + utilGzRead(gzFile, &prefetchApplies, sizeof(bool)); + } + if(version >= SAVE_GAME_VERSION_12) + { + utilGzRead(gzFile, &memLagTempEnabled, sizeof(bool)); // necessary + utilGzRead(gzFile, &speedHack, sizeof(bool)); // just in case it's ever used... + } + + + if(backupSafe) + { + remove(tempBackupName); + tempFailCount = 0; + } + VBAUpdateFrameCountDisplay(); + return true; + +failedLoad: + if(backupSafe) + { + tempFailCount++; + if(tempFailCount < 3) // fail no more than 2 times in a row + CPUReadState(tempBackupName); + remove(tempBackupName); + } + return false; +} + +bool CPUReadMemState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "r"); + + backupSafe = false; + bool res = CPUReadStateFromStream(gzFile); + backupSafe = true; + + utilGzClose(gzFile); + + return res; +} + +bool CPUReadState(const char * file) +{ + gzFile gzFile = utilGzOpen(file, "rb"); + + if(gzFile == NULL) + return false; + + bool res = CPUReadStateFromStream(gzFile); + + utilGzClose(gzFile); + + return res; +} + +bool CPUExportEepromFile(const char *fileName) +{ + if(eepromInUse) { + FILE *file = fopen(fileName, "wb"); + + if(!file) { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), + fileName); + return false; + } + + for(int i = 0; i < eepromSize;) { + for(int j = 0; j < 8; j++) { + if(fwrite(&eepromData[i+7-j], 1, 1, file) != 1) { + fclose(file); + return false; + } + } + i += 8; + } + fclose(file); + } + return true; +} + +bool CPUWriteBatteryToStream(gzFile gzFile) +{ + if(!gzFile) + return false; + + utilWriteInt(gzFile, SAVE_GAME_VERSION); + + // for simplicity, we put both types of battery files should be in the stream, even if one's empty + eepromSaveGame(gzFile); + flashSaveGame(gzFile); + + return true; +} + +bool CPUWriteBatteryFile(const char *fileName) +{ + if(gbaSaveType == 0) { + if(eepromInUse) + gbaSaveType = 3; + else switch(saveType) { + case 1: + gbaSaveType = 1; + break; + case 2: + gbaSaveType = 2; + break; + } + } + + if(gbaSaveType) { + FILE *file = fopen(fileName, "wb"); + + if(!file) { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), + fileName); + return false; + } + + // only save if Flash/Sram in use or EEprom in use + if(gbaSaveType != 3) { + if(gbaSaveType == 2) { + if(fwrite(flashSaveMemory, 1, flashSize, file) != (size_t)flashSize) { + fclose(file); + return false; + } + } else { + if(fwrite(flashSaveMemory, 1, 0x10000, file) != 0x10000) { + fclose(file); + return false; + } + } + } else { + if(fwrite(eepromData, 1, eepromSize, file) != (size_t)eepromSize) { + fclose(file); + return false; + } + } + fclose(file); + } + + return true; +} + +bool CPUReadGSASnapshot(const char *fileName) +{ + int i; + FILE *file = fopen(fileName, "rb"); + + if(!file) { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); + return false; + } + + // check file size to know what we should read + fseek(file, 0, SEEK_END); + + // long size = ftell(file); + fseek(file, 0x0, SEEK_SET); + fread(&i, 1, 4, file); + fseek(file, i, SEEK_CUR); // Skip SharkPortSave + fseek(file, 4, SEEK_CUR); // skip some sort of flag + fread(&i, 1, 4, file); // name length + fseek(file, i, SEEK_CUR); // skip name + fread(&i, 1, 4, file); // desc length + fseek(file, i, SEEK_CUR); // skip desc + fread(&i, 1, 4, file); // notes length + fseek(file, i, SEEK_CUR); // skip notes + int saveSize; + fread(&saveSize, 1, 4, file); // read length + saveSize -= 0x1c; // remove header size + char buffer[17]; + char buffer2[17]; + fread(buffer, 1, 16, file); + buffer[16] = 0; + for(i = 0; i < 16; i++) + if(buffer[i] < 32) + buffer[i] = 32; + memcpy(buffer2, &rom[0xa0], 16); + buffer2[16] = 0; + for(i = 0; i < 16; i++) + if(buffer2[i] < 32) + buffer2[i] = 32; + if(memcmp(buffer, buffer2, 16)) { + systemMessage(MSG_CANNOT_IMPORT_SNAPSHOT_FOR, + N_("Cannot import snapshot for %s. Current game is %s"), + buffer, + buffer2); + fclose(file); + return false; + } + fseek(file, 12, SEEK_CUR); // skip some flags + if(saveSize >= 65536) { + if(fread(flashSaveMemory, 1, saveSize, file) != (size_t)saveSize) { + fclose(file); + return false; + } + } else { + systemMessage(MSG_UNSUPPORTED_SNAPSHOT_FILE, + N_("Unsupported snapshot file %s"), + fileName); + fclose(file); + return false; + } + fclose(file); + CPUReset(); + return true; +} + +bool CPUWriteGSASnapshot(const char *fileName, + const char *title, + const char *desc, + const char *notes) +{ + FILE *file = fopen(fileName, "wb"); + + if(!file) { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); + return false; + } + + u8 buffer[17]; + + utilPutDword(buffer, 0x0d); // SharkPortSave length + fwrite(buffer, 1, 4, file); + fwrite("SharkPortSave", 1, 0x0d, file); + utilPutDword(buffer, 0x000f0000); + fwrite(buffer, 1, 4, file); // save type 0x000f0000 = GBA save + utilPutDword(buffer, strlen(title)); + fwrite(buffer, 1, 4, file); // title length + fwrite(title, 1, strlen(title), file); + utilPutDword(buffer, strlen(desc)); + fwrite(buffer, 1, 4, file); // desc length + fwrite(desc, 1, strlen(desc), file); + utilPutDword(buffer, strlen(notes)); + fwrite(buffer, 1, 4, file); // notes length + fwrite(notes, 1, strlen(notes), file); + int saveSize = 0x10000; + if(gbaSaveType == 2) + saveSize = flashSize; + int totalSize = saveSize + 0x1c; + + utilPutDword(buffer, totalSize); // length of remainder of save - CRC + fwrite(buffer, 1, 4, file); + + char temp[0x2001c]; + memset(temp, 0, 28); + memcpy(temp, &rom[0xa0], 16); // copy internal name + temp[0x10] = rom[0xbe]; // reserved area (old checksum) + temp[0x11] = rom[0xbf]; // reserved area (old checksum) + temp[0x12] = rom[0xbd]; // complement check + temp[0x13] = rom[0xb0]; // maker + temp[0x14] = 1; // 1 save ? + memcpy(&temp[0x1c], flashSaveMemory, saveSize); // copy save + fwrite(temp, 1, totalSize, file); // write save + header + u32 crc = 0; + + for(int i = 0; i < totalSize; i++) { + crc += ((u32)temp[i] << (crc % 0x18)); + } + + utilPutDword(buffer, crc); + fwrite(buffer, 1, 4, file); // CRC? + + fclose(file); + return true; +} + +bool CPUImportEepromFile(const char *fileName) +{ + FILE *file = fopen(fileName, "rb"); + + if(!file) + return false; + + // check file size to know what we should read + fseek(file, 0, SEEK_END); + + long size = ftell(file); + fseek(file, 0, SEEK_SET); + if(size == 512 || size == 0x2000) { + if(fread(eepromData, 1, size, file) != (size_t)size) { + fclose(file); + return false; + } + for(int i = 0; i < size;) { + u8 tmp = eepromData[i]; + eepromData[i] = eepromData[7-i]; + eepromData[7-i] = tmp; + i++; + tmp = eepromData[i]; + eepromData[i] = eepromData[7-i]; + eepromData[7-i] = tmp; + i++; + tmp = eepromData[i]; + eepromData[i] = eepromData[7-i]; + eepromData[7-i] = tmp; + i++; + tmp = eepromData[i]; + eepromData[i] = eepromData[7-i]; + eepromData[7-i] = tmp; + i++; + i += 4; + } + } else + return false; + fclose(file); + return true; +} + +bool CPUReadBatteryFromStream(gzFile gzFile) +{ + if(!gzFile) + return false; + + int version = utilReadInt(gzFile); + + // for simplicity, we put both types of battery files should be in the stream, even if one's empty + eepromReadGame(gzFile, version); + flashReadGame(gzFile, version); + + return true; +} + +bool CPUReadBatteryFile(const char *fileName) +{ + FILE *file = fopen(fileName, "rb"); + + if(!file) + return false; + + // check file size to know what we should read + fseek(file, 0, SEEK_END); + + long size = ftell(file); + fseek(file, 0, SEEK_SET); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + if(size == 512 || size == 0x2000) { + if(fread(eepromData, 1, size, file) != (size_t)size) { + fclose(file); + return false; + } + } else { + if(size == 0x20000) { + if(fread(flashSaveMemory, 1, 0x20000, file) != 0x20000) { + fclose(file); + return false; + } + flashSetSize(0x20000); + } else { + if(fread(flashSaveMemory, 1, 0x10000, file) != 0x10000) { + fclose(file); + return false; + } + flashSetSize(0x10000); + } + } + fclose(file); + return true; +} + +bool CPUWritePNGFile(const char *fileName) +{ + return utilWritePNGFile(fileName, 240, 160, pix); +} + +bool CPUWriteBMPFile(const char *fileName) +{ + return utilWriteBMPFile(fileName, 240, 160, pix); +} + +bool CPUIsZipFile(const char * file) +{ + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".zip") == 0) + return true; + } + } + + return false; +} + +bool CPUIsGBAImage(const char * file) +{ + cpuIsMultiBoot = false; + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".gba") == 0) + return true; + if(_stricmp(p, ".agb") == 0) + return true; + if(_stricmp(p, ".bin") == 0) + return true; + if(_stricmp(p, ".elf") == 0) + return true; + if(_stricmp(p, ".mb") == 0) { + cpuIsMultiBoot = true; + return true; + } + } + } + + return false; +} + +bool CPUIsGBABios(const char * file) +{ + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".gba") == 0) + return true; + if(_stricmp(p, ".agb") == 0) + return true; + if(_stricmp(p, ".bin") == 0) + return true; + if(_stricmp(p, ".bios") == 0) + return true; + } + } + + return false; +} + +bool CPUIsELF(const char *file) +{ + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".elf") == 0) + return true; + } + } + return false; +} + +void CPUCleanUp() +{ +#if (defined(WIN32) && !defined(SDL)) + theApp.globalFrameCount = 0; +#endif + +#ifdef PROFILING + if(profilingTicksReload) { + profCleanup(); + } +#endif + +#if (defined(WIN32) && !defined(SDL)) + #define FreeMappedMem(name,mapName,offset) \ + if(name != NULL) { \ + UnmapViewOfFile((name) - (offset)); \ + name = NULL; \ + CloseHandle(mapName); \ + } +#else + #define FreeMappedMem(name,mapName,offset) \ + if(name != NULL) { \ + free(name); \ + name = NULL; \ + } +#endif + + FreeMappedMem(rom, mapROM, 0); + FreeMappedMem(vram, mapVRAM, 0); + FreeMappedMem(paletteRAM, mapPALETTERAM, 0); + FreeMappedMem(internalRAM, mapIRAM, 0); + FreeMappedMem(workRAM, mapWORKRAM, 0); + FreeMappedMem(bios, mapBIOS, 0); + FreeMappedMem(pix, mapPIX, 4); + FreeMappedMem(oam, mapOAM, 0); + FreeMappedMem(ioMem, mapIOMEM, 0); + + eepromErase(); + flashErase(); + + elfCleanUp(); + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + emulating = 0; +} + +int CPULoadRom(const char *szFile) +{ + int size = 0x2000000; + + if(rom != NULL) { + CPUCleanUp(); + } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + +#if (defined(WIN32) && !defined(SDL)) + #define AllocMappedMem(name,mapName,nameStr,size,useCalloc,offset) \ + mapName = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (size)+(offset), nameStr); \ + if((mapName) && GetLastError() == ERROR_ALREADY_EXISTS) { \ + CloseHandle(mapName); \ + mapName = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (size)+(offset), NULL); \ + } \ + name = (u8 *)MapViewOfFile(mapName, FILE_MAP_WRITE, 0, 0, 0) + (offset); \ + if((name) == NULL) { \ + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), nameStr); \ + CPUCleanUp(); \ + return 0; \ + } \ + memset(name, 0, size); +#else + #define AllocMappedMem(name,mapName,nameStr,size,useCalloc,offset) \ + name = (u8 *)(useCalloc ? calloc(1,size) : malloc(size)); \ + if((name) == NULL) { \ + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), nameStr); \ + CPUCleanUp(); \ + return 0; \ + } \ + memset(name, 0, size); +#endif + + AllocMappedMem(rom,mapROM,"vbaROM",0x2000000,false,0); + + AllocMappedMem(workRAM,mapWORKRAM,"vbaWORKRAM",0x40000,true,0); + + u8 *whereToLoad = rom; + if(cpuIsMultiBoot) + whereToLoad = workRAM; + + if(CPUIsELF(szFile)) { + FILE *f = fopen(szFile, "rb"); + if(!f) { + systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), + szFile); + free(rom); + rom = NULL; + free(workRAM); + workRAM = NULL; + return 0; + } + bool res = elfRead(szFile, size, f); + if(!res || size == 0) { + free(rom); + rom = NULL; + free(workRAM); + workRAM = NULL; + elfCleanUp(); + return 0; + } + } else if(!utilLoad(szFile, + utilIsGBAImage, + whereToLoad, + size)) { + free(rom); + rom = NULL; + free(workRAM); + workRAM = NULL; + return 0; + } + + u16 *temp = (u16 *)(rom+((size+1)&~1)); + int i; + for(i = (size+1)&~1; i < 0x2000000; i+=2) { + WRITE16LE(temp, (i >> 1) & 0xFFFF); + temp++; + } + + AllocMappedMem(bios,mapBIOS,"vbaBIOS",0x4000,true,0); + + AllocMappedMem(internalRAM,mapIRAM,"vbaIRAM",0x8000,true,0); + + AllocMappedMem(paletteRAM,mapPALETTERAM,"vbaPALETTERAM",0x400,true,0); + + AllocMappedMem(vram,mapVRAM,"vbaVRAM",0x20000,true,0); + + AllocMappedMem(oam,mapOAM,"vbaOAM",0x400,true,0); + + // HACK: +4 at start to accomodate the 2xSaI filter reading out of bounds of the leftmost pixel + AllocMappedMem(pix,mapPIX,"vbaPIX",4 * 241 * 162,true,4); + + AllocMappedMem(ioMem,mapIOMEM,"vbaIOMEM",0x400,true,0); + + CPUUpdateRenderBuffers(true); + + return size; +} + +void CPUUpdateRender() +{ + switch(DISPCNT & 7) { + case 0: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode0RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode0RenderLineNoWindow; + else + renderLine = mode0RenderLineAll; + break; + case 1: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode1RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode1RenderLineNoWindow; + else + renderLine = mode1RenderLineAll; + break; + case 2: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode2RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode2RenderLineNoWindow; + else + renderLine = mode2RenderLineAll; + break; + case 3: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode3RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode3RenderLineNoWindow; + else + renderLine = mode3RenderLineAll; + break; + case 4: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode4RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode4RenderLineNoWindow; + else + renderLine = mode4RenderLineAll; + break; + case 5: + if((!fxOn && !windowOn && !(layerEnable & 0x8000)) || + cpuDisableSfx) + renderLine = mode5RenderLine; + else if(fxOn && !windowOn && !(layerEnable & 0x8000)) + renderLine = mode5RenderLineNoWindow; + else + renderLine = mode5RenderLineAll; + default: + break; + } +} + +void CPUUpdateCPSR() +{ + u32 CPSR = reg[16].I & 0x40; + if(N_FLAG) + CPSR |= 0x80000000; + if(Z_FLAG) + CPSR |= 0x40000000; + if(C_FLAG) + CPSR |= 0x20000000; + if(V_FLAG) + CPSR |= 0x10000000; + if(!armState) + CPSR |= 0x00000020; + if(!armIrqEnable) + CPSR |= 0x80; + CPSR |= (armMode & 0x1F); + reg[16].I = CPSR; +} + +void CPUUpdateFlags(bool breakLoop) +{ + u32 CPSR = reg[16].I; + + N_FLAG = (CPSR & 0x80000000) ? true: false; + Z_FLAG = (CPSR & 0x40000000) ? true: false; + C_FLAG = (CPSR & 0x20000000) ? true: false; + V_FLAG = (CPSR & 0x10000000) ? true: false; + armState = (CPSR & 0x20) ? false : true; + armIrqEnable = (CPSR & 0x80) ? false : true; + if(breakLoop) { + if(armIrqEnable && (IF & IE) && (IME & 1)) { + CPU_BREAK_LOOP_2; + } + } +} + +void CPUUpdateFlags() +{ + CPUUpdateFlags(true); +} + +#ifdef WORDS_BIGENDIAN +static void CPUSwap(volatile u32 *a, volatile u32 *b) +{ + volatile u32 c = *b; + *b = *a; + *a = c; +} +#else +static void CPUSwap(u32 *a, u32 *b) +{ + u32 c = *b; + *b = *a; + *a = c; +} +#endif + +void CPUSwitchMode(int mode, bool saveState, bool breakLoop) +{ + // if(armMode == mode) + // return; + + CPUUpdateCPSR(); + + switch(armMode) { + case 0x10: + case 0x1F: + reg[R13_USR].I = reg[13].I; + reg[R14_USR].I = reg[14].I; + reg[17].I = reg[16].I; + break; + case 0x11: + CPUSwap(®[R8_FIQ].I, ®[8].I); + CPUSwap(®[R9_FIQ].I, ®[9].I); + CPUSwap(®[R10_FIQ].I, ®[10].I); + CPUSwap(®[R11_FIQ].I, ®[11].I); + CPUSwap(®[R12_FIQ].I, ®[12].I); + reg[R13_FIQ].I = reg[13].I; + reg[R14_FIQ].I = reg[14].I; + reg[SPSR_FIQ].I = reg[17].I; + break; + case 0x12: + reg[R13_IRQ].I = reg[13].I; + reg[R14_IRQ].I = reg[14].I; + reg[SPSR_IRQ].I = reg[17].I; + break; + case 0x13: + reg[R13_SVC].I = reg[13].I; + reg[R14_SVC].I = reg[14].I; + reg[SPSR_SVC].I = reg[17].I; + break; + case 0x17: + reg[R13_ABT].I = reg[13].I; + reg[R14_ABT].I = reg[14].I; + reg[SPSR_ABT].I = reg[17].I; + break; + case 0x1b: + reg[R13_UND].I = reg[13].I; + reg[R14_UND].I = reg[14].I; + reg[SPSR_UND].I = reg[17].I; + break; + } + + u32 CPSR = reg[16].I; + u32 SPSR = reg[17].I; + + switch(mode) { + case 0x10: + case 0x1F: + reg[13].I = reg[R13_USR].I; + reg[14].I = reg[R14_USR].I; + reg[16].I = SPSR; + break; + case 0x11: + CPUSwap(®[8].I, ®[R8_FIQ].I); + CPUSwap(®[9].I, ®[R9_FIQ].I); + CPUSwap(®[10].I, ®[R10_FIQ].I); + CPUSwap(®[11].I, ®[R11_FIQ].I); + CPUSwap(®[12].I, ®[R12_FIQ].I); + reg[13].I = reg[R13_FIQ].I; + reg[14].I = reg[R14_FIQ].I; + if(saveState) + reg[17].I = CPSR; + else + reg[17].I = reg[SPSR_FIQ].I; + break; + case 0x12: + reg[13].I = reg[R13_IRQ].I; + reg[14].I = reg[R14_IRQ].I; + reg[16].I = SPSR; + if(saveState) + reg[17].I = CPSR; + else + reg[17].I = reg[SPSR_IRQ].I; + break; + case 0x13: + reg[13].I = reg[R13_SVC].I; + reg[14].I = reg[R14_SVC].I; + reg[16].I = SPSR; + if(saveState) + reg[17].I = CPSR; + else + reg[17].I = reg[SPSR_SVC].I; + break; + case 0x17: + reg[13].I = reg[R13_ABT].I; + reg[14].I = reg[R14_ABT].I; + reg[16].I = SPSR; + if(saveState) + reg[17].I = CPSR; + else + reg[17].I = reg[SPSR_ABT].I; + break; + case 0x1b: + reg[13].I = reg[R13_UND].I; + reg[14].I = reg[R14_UND].I; + reg[16].I = SPSR; + if(saveState) + reg[17].I = CPSR; + else + reg[17].I = reg[SPSR_UND].I; + break; + default: + systemMessage(MSG_UNSUPPORTED_ARM_MODE, N_("Unsupported ARM mode %02x"), mode); + break; + } + armMode = mode; + CPUUpdateFlags(breakLoop); + CPUUpdateCPSR(); +} + +void CPUSwitchMode(int mode, bool saveState) +{ + CPUSwitchMode(mode, saveState, true); +} + +void CPUUndefinedException() +{ + u32 PC = reg[15].I; + bool savedArmState = armState; + CPUSwitchMode(0x1b, true, false); + reg[14].I = PC - (savedArmState ? 4 : 2); + reg[15].I = 0x04; + armState = true; + armIrqEnable = false; + armNextPC = 0x04; + reg[15].I += 4; +} + +void CPUSoftwareInterrupt() +{ + u32 PC = reg[15].I; + bool savedArmState = armState; + CPUSwitchMode(0x13, true, false); + reg[14].I = PC - (savedArmState ? 4 : 2); + reg[15].I = 0x08; + armState = true; + armIrqEnable = false; + armNextPC = 0x08; + reg[15].I += 4; +} + +void CPUSoftwareInterrupt(int comment) +{ + static bool disableMessage = false; + if(armState) comment >>= 16; +#ifdef BKPT_SUPPORT + if(comment == 0xff) { + extern void (*dbgOutput)(char *, u32); + dbgOutput(NULL, reg[0].I); + return; + } +#endif +#ifdef PROFILING + if(comment == 0xfe) { + profStartup(reg[0].I, reg[1].I); + return; + } + if(comment == 0xfd) { + profControl(reg[0].I); + return; + } + if(comment == 0xfc) { + profCleanup(); + return; + } + if(comment == 0xfb) { + profCount(); + return; + } +#endif + if(comment == 0xfa) { + agbPrintFlush(); + return; + } +#ifdef SDL + if(comment == 0xf9) { + emulating = 0; + CPU_BREAK_LOOP_2; + return; + } +#endif + if(useBios) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment, + armState ? armNextPC - 4: armNextPC -2, + reg[0].I, + reg[1].I, + reg[2].I, + VCOUNT); + } +#endif + CPUSoftwareInterrupt(); + return; + } + // This would be correct, but it causes problems if uncommented + // else { + // biosProtected = 0xe3a02004; + // } + + switch(comment) { + case 0x00: + BIOS_SoftReset(); + break; + case 0x01: + BIOS_RegisterRamReset(); + break; + case 0x02: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Halt: (VCOUNT = %2d)\n", + VCOUNT); + } +#endif + holdState = true; + holdType = -1; + break; + case 0x03: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Stop: (VCOUNT = %2d)\n", + VCOUNT); + } +#endif + holdState = true; + holdType = -1; + stopState = true; + break; + case 0x04: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("IntrWait: 0x%08x,0x%08x (VCOUNT = %2d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + CPUSoftwareInterrupt(); + break; + case 0x05: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("VBlankIntrWait: (VCOUNT = %2d)\n", + VCOUNT); + } +#endif + CPUSoftwareInterrupt(); + break; + case 0x06: + CPUSoftwareInterrupt(); + break; + case 0x07: + CPUSoftwareInterrupt(); + break; + case 0x08: + BIOS_Sqrt(); + break; + case 0x09: + BIOS_ArcTan(); + break; + case 0x0A: + BIOS_ArcTan2(); + break; + case 0x0B: + BIOS_CpuSet(); + break; + case 0x0C: + BIOS_CpuFastSet(); + break; + case 0x0E: + BIOS_BgAffineSet(); + break; + case 0x0F: + BIOS_ObjAffineSet(); + break; + case 0x10: + BIOS_BitUnPack(); + break; + case 0x11: + BIOS_LZ77UnCompWram(); + break; + case 0x12: + BIOS_LZ77UnCompVram(); + break; + case 0x13: + BIOS_HuffUnComp(); + break; + case 0x14: + BIOS_RLUnCompWram(); + break; + case 0x15: + BIOS_RLUnCompVram(); + break; + case 0x16: + BIOS_Diff8bitUnFilterWram(); + break; + case 0x17: + BIOS_Diff8bitUnFilterVram(); + break; + case 0x18: + BIOS_Diff16bitUnFilter(); + break; + case 0x19: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("SoundBiasSet: 0x%08x (VCOUNT = %2d)\n", + reg[0].I, + VCOUNT); + } +#endif + if(reg[0].I) + systemSoundPause(); + else + { +#if (defined(WIN32) && !defined(SDL)) + if(!theApp.frameAdvanceMuteNow) +#endif + systemSoundResume(); + } + break; + case 0x1F: + BIOS_MidiKey2Freq(); + break; + case 0x2A: + BIOS_SndDriverJmpTableCopy(); + // let it go, because we don't really emulate this function // FIXME (?) + default: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("SWI: %08x at %08x (0x%08x,0x%08x,0x%08x,VCOUNT = %2d)\n", comment, + armState ? armNextPC - 4: armNextPC -2, + reg[0].I, + reg[1].I, + reg[2].I, + VCOUNT); + } +#endif + + if(!disableMessage) { + systemMessage(MSG_UNSUPPORTED_BIOS_FUNCTION, + N_("Unsupported BIOS function %02x called from %08x. A BIOS file is needed in order to get correct behaviour."), + comment, + armMode ? armNextPC - 4: armNextPC - 2); + disableMessage = true; + } + break; + } +} + +void CPUCompareVCOUNT() +{ + if(VCOUNT == (DISPSTAT >> 8)) { + DISPSTAT |= 4; + UPDATE_REG(0x04, DISPSTAT); + + if(DISPSTAT & 0x20) { + IF |= 4; + UPDATE_REG(0x202, IF); + } + } else { + DISPSTAT &= 0xFFFB; + UPDATE_REG(0x4, DISPSTAT); + } +} + +void doDMA(u32 &s, u32 &d, u32 si, u32 di, u32 c, int transfer32) +{ + int sm = s >> 24; + int dm = d >> 24; + + int sc = c; + + cpuDmaCount = c; + + if(transfer32) { + s &= 0xFFFFFFFC; + if(s < 0x02000000 && (reg[15].I >> 24)) { + while(c != 0) { + CPUWriteMemory(d, 0); + d += di; + c--; + } + } else { + while(c != 0) { + CPUWriteMemory(d, CPUReadMemory(s)); + d += di; + s += si; + c--; + } + } + } else { + s &= 0xFFFFFFFE; + si = (int)si >> 1; + di = (int)di >> 1; + if(s < 0x02000000 && (reg[15].I >> 24)) { + while(c != 0) { + CPUWriteHalfWord(d, 0); + d += di; + c--; + } + } else { + while(c != 0) { + cpuDmaLast = CPUReadHalfWord(s); + CPUWriteHalfWord(d, cpuDmaLast); + d += di; + s += si; + c--; + } + } + } + + cpuDmaCount = 0; + + int sw = 1+memoryWaitSeq[sm & 15]; + int dw = 1+memoryWaitSeq[dm & 15]; + + int totalTicks = 0; + + if(transfer32) { + if(!memory32[sm & 15]) + sw <<= 1; + if(!memory32[dm & 15]) + dw <<= 1; + } + + totalTicks = (sw+dw)*sc; + + cpuDmaTicksToUpdate += totalTicks; + + if(*extCpuLoopTicks >= 0) { + CPU_BREAK_LOOP; + } +} + +void CPUCheckDMA(int reason, int dmamask) +{ + cpuDmaHack = 0; + // DMA 0 + if((DM0CNT_H & 0x8000) && (dmamask & 1)) { + if(((DM0CNT_H >> 12) & 3) == reason) { + u32 sourceIncrement = 4; + u32 destIncrement = 4; + switch((DM0CNT_H >> 7) & 3) { + case 0: + break; + case 1: + sourceIncrement = (u32)-4; + break; + case 2: + sourceIncrement = 0; + break; + } + switch((DM0CNT_H >> 5) & 3) { + case 0: + break; + case 1: + destIncrement = (u32)-4; + break; + case 2: + destIncrement = 0; + break; + } +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA0) { + int count = (DM0CNT_L ? DM0CNT_L : 0x4000) << 1; + if(DM0CNT_H & 0x0400) + count <<= 1; + log("DMA0: s=%08x d=%08x c=%04x count=%08x\n", dma0Source, dma0Dest, + DM0CNT_H, + count); + } +#endif + doDMA(dma0Source, dma0Dest, sourceIncrement, destIncrement, + DM0CNT_L ? DM0CNT_L : 0x4000, + DM0CNT_H & 0x0400); + cpuDmaHack = 1; + if(DM0CNT_H & 0x4000) { + IF |= 0x0100; + UPDATE_REG(0x202, IF); + } + + if(((DM0CNT_H >> 5) & 3) == 3) { + dma0Dest = DM0DAD_L | (DM0DAD_H << 16); + } + + if(!(DM0CNT_H & 0x0200) || (reason == 0)) { + DM0CNT_H &= 0x7FFF; + UPDATE_REG(0xBA, DM0CNT_H); + } + } + } + + // DMA 1 + if((DM1CNT_H & 0x8000) && (dmamask & 2)) { + if(((DM1CNT_H >> 12) & 3) == reason) { + u32 sourceIncrement = 4; + u32 destIncrement = 4; + switch((DM1CNT_H >> 7) & 3) { + case 0: + break; + case 1: + sourceIncrement = (u32)-4; + break; + case 2: + sourceIncrement = 0; + break; + } + switch((DM1CNT_H >> 5) & 3) { + case 0: + break; + case 1: + destIncrement = (u32)-4; + break; + case 2: + destIncrement = 0; + break; + } + if(reason == 3) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA1) { + log("DMA1: s=%08x d=%08x c=%04x count=%08x\n", dma1Source, dma1Dest, + DM1CNT_H, + 16); + } +#endif + doDMA(dma1Source, dma1Dest, sourceIncrement, 0, 4, + 0x0400); + } else { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA1) { + int count = (DM1CNT_L ? DM1CNT_L : 0x4000) << 1; + if(DM1CNT_H & 0x0400) + count <<= 1; + log("DMA1: s=%08x d=%08x c=%04x count=%08x\n", dma1Source, dma1Dest, + DM1CNT_H, + count); + } +#endif + doDMA(dma1Source, dma1Dest, sourceIncrement, destIncrement, + DM1CNT_L ? DM1CNT_L : 0x4000, + DM1CNT_H & 0x0400); + } + cpuDmaHack = 1; + + if(DM1CNT_H & 0x4000) { + IF |= 0x0200; + UPDATE_REG(0x202, IF); + } + + if(((DM1CNT_H >> 5) & 3) == 3) { + dma1Dest = DM1DAD_L | (DM1DAD_H << 16); + } + + if(!(DM1CNT_H & 0x0200) || (reason == 0)) { + DM1CNT_H &= 0x7FFF; + UPDATE_REG(0xC6, DM1CNT_H); + } + } + } + + // DMA 2 + if((DM2CNT_H & 0x8000) && (dmamask & 4)) { + if(((DM2CNT_H >> 12) & 3) == reason) { + u32 sourceIncrement = 4; + u32 destIncrement = 4; + switch((DM2CNT_H >> 7) & 3) { + case 0: + break; + case 1: + sourceIncrement = (u32)-4; + break; + case 2: + sourceIncrement = 0; + break; + } + switch((DM2CNT_H >> 5) & 3) { + case 0: + break; + case 1: + destIncrement = (u32)-4; + break; + case 2: + destIncrement = 0; + break; + } + if(reason == 3) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA2) { + int count = (4) << 2; + log("DMA2: s=%08x d=%08x c=%04x count=%08x\n", dma2Source, dma2Dest, + DM2CNT_H, + count); + } +#endif + doDMA(dma2Source, dma2Dest, sourceIncrement, 0, 4, + 0x0400); + } else { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA2) { + int count = (DM2CNT_L ? DM2CNT_L : 0x4000) << 1; + if(DM2CNT_H & 0x0400) + count <<= 1; + log("DMA2: s=%08x d=%08x c=%04x count=%08x\n", dma2Source, dma2Dest, + DM2CNT_H, + count); + } +#endif + doDMA(dma2Source, dma2Dest, sourceIncrement, destIncrement, + DM2CNT_L ? DM2CNT_L : 0x4000, + DM2CNT_H & 0x0400); + } + cpuDmaHack = 1; + if(DM2CNT_H & 0x4000) { + IF |= 0x0400; + UPDATE_REG(0x202, IF); + } + + if(((DM2CNT_H >> 5) & 3) == 3) { + dma2Dest = DM2DAD_L | (DM2DAD_H << 16); + } + + if(!(DM2CNT_H & 0x0200) || (reason == 0)) { + DM2CNT_H &= 0x7FFF; + UPDATE_REG(0xD2, DM2CNT_H); + } + } + } + + // DMA 3 + if((DM3CNT_H & 0x8000) && (dmamask & 8)) { + if(((DM3CNT_H >> 12) & 3) == reason) { + u32 sourceIncrement = 4; + u32 destIncrement = 4; + switch((DM3CNT_H >> 7) & 3) { + case 0: + break; + case 1: + sourceIncrement = (u32)-4; + break; + case 2: + sourceIncrement = 0; + break; + } + switch((DM3CNT_H >> 5) & 3) { + case 0: + break; + case 1: + destIncrement = (u32)-4; + break; + case 2: + destIncrement = 0; + break; + } +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_DMA3) { + int count = (DM3CNT_L ? DM3CNT_L : 0x10000) << 1; + if(DM3CNT_H & 0x0400) + count <<= 1; + log("DMA3: s=%08x d=%08x c=%04x count=%08x\n", dma3Source, dma3Dest, + DM3CNT_H, + count); + } +#endif + doDMA(dma3Source, dma3Dest, sourceIncrement, destIncrement, + DM3CNT_L ? DM3CNT_L : 0x10000, + DM3CNT_H & 0x0400); + if(DM3CNT_H & 0x4000) { + IF |= 0x0800; + UPDATE_REG(0x202, IF); + } + + if(((DM3CNT_H >> 5) & 3) == 3) { + dma3Dest = DM3DAD_L | (DM3DAD_H << 16); + } + + if(!(DM3CNT_H & 0x0200) || (reason == 0)) { + DM3CNT_H &= 0x7FFF; + UPDATE_REG(0xDE, DM3CNT_H); + } + } + } + cpuDmaHack = 0; +} + +void CPUUpdateRegister(u32 address, u16 value) +{ + switch(address) { + case 0x00: + { + bool change = ((DISPCNT ^ value) & 0x80) ? true : false; + bool changeBG = ((DISPCNT ^ value) & 0x0F00) ? true : false; + DISPCNT = (value & 0xFFF7); + UPDATE_REG(0x00, DISPCNT); + layerEnable = layerSettings & value; + windowOn = (layerEnable & 0x6000) ? true : false; + if(change && !((value & 0x80))) { + if(!(DISPSTAT & 1)) { + lcdTicks = 960; + // VCOUNT = 0; + // UPDATE_REG(0x06, VCOUNT); + DISPSTAT &= 0xFFFC; + UPDATE_REG(0x04, DISPSTAT); + CPUCompareVCOUNT(); + } + // (*renderLine)(); + } + CPUUpdateRender(); + // we only care about changes in BG0-BG3 + if(changeBG) + CPUUpdateRenderBuffers(false); + // CPUUpdateTicks(); + } + break; + case 0x04: + DISPSTAT = (value & 0xFF38) | (DISPSTAT & 7); + UPDATE_REG(0x04, DISPSTAT); + break; + case 0x06: + // not writable + break; + case 0x08: + BG0CNT = (value & 0xDFCF); + UPDATE_REG(0x08, BG0CNT); + break; + case 0x0A: + BG1CNT = (value & 0xDFCF); + UPDATE_REG(0x0A, BG1CNT); + break; + case 0x0C: + BG2CNT = (value & 0xFFCF); + UPDATE_REG(0x0C, BG2CNT); + break; + case 0x0E: + BG3CNT = (value & 0xFFCF); + UPDATE_REG(0x0E, BG3CNT); + break; + case 0x10: + BG0HOFS = value & 511; + UPDATE_REG(0x10, BG0HOFS); + break; + case 0x12: + BG0VOFS = value & 511; + UPDATE_REG(0x12, BG0VOFS); + break; + case 0x14: + BG1HOFS = value & 511; + UPDATE_REG(0x14, BG1HOFS); + break; + case 0x16: + BG1VOFS = value & 511; + UPDATE_REG(0x16, BG1VOFS); + break; + case 0x18: + BG2HOFS = value & 511; + UPDATE_REG(0x18, BG2HOFS); + break; + case 0x1A: + BG2VOFS = value & 511; + UPDATE_REG(0x1A, BG2VOFS); + break; + case 0x1C: + BG3HOFS = value & 511; + UPDATE_REG(0x1C, BG3HOFS); + break; + case 0x1E: + BG3VOFS = value & 511; + UPDATE_REG(0x1E, BG3VOFS); + break; + case 0x20: + BG2PA = value; + UPDATE_REG(0x20, BG2PA); + break; + case 0x22: + BG2PB = value; + UPDATE_REG(0x22, BG2PB); + break; + case 0x24: + BG2PC = value; + UPDATE_REG(0x24, BG2PC); + break; + case 0x26: + BG2PD = value; + UPDATE_REG(0x26, BG2PD); + break; + case 0x28: + BG2X_L = value; + UPDATE_REG(0x28, BG2X_L); + gfxBG2Changed |= 1; + break; + case 0x2A: + BG2X_H = (value & 0xFFF); + UPDATE_REG(0x2A, BG2X_H); + gfxBG2Changed |= 1; + break; + case 0x2C: + BG2Y_L = value; + UPDATE_REG(0x2C, BG2Y_L); + gfxBG2Changed |= 2; + break; + case 0x2E: + BG2Y_H = value & 0xFFF; + UPDATE_REG(0x2E, BG2Y_H); + gfxBG2Changed |= 2; + break; + case 0x30: + BG3PA = value; + UPDATE_REG(0x30, BG3PA); + break; + case 0x32: + BG3PB = value; + UPDATE_REG(0x32, BG3PB); + break; + case 0x34: + BG3PC = value; + UPDATE_REG(0x34, BG3PC); + break; + case 0x36: + BG3PD = value; + UPDATE_REG(0x36, BG3PD); + break; + case 0x38: + BG3X_L = value; + UPDATE_REG(0x38, BG3X_L); + gfxBG3Changed |= 1; + break; + case 0x3A: + BG3X_H = value & 0xFFF; + UPDATE_REG(0x3A, BG3X_H); + gfxBG3Changed |= 1; + break; + case 0x3C: + BG3Y_L = value; + UPDATE_REG(0x3C, BG3Y_L); + gfxBG3Changed |= 2; + break; + case 0x3E: + BG3Y_H = value & 0xFFF; + UPDATE_REG(0x3E, BG3Y_H); + gfxBG3Changed |= 2; + break; + case 0x40: + WIN0H = value; + UPDATE_REG(0x40, WIN0H); + CPUUpdateWindow0(); + break; + case 0x42: + WIN1H = value; + UPDATE_REG(0x42, WIN1H); + CPUUpdateWindow1(); + break; + case 0x44: + WIN0V = value; + UPDATE_REG(0x44, WIN0V); + break; + case 0x46: + WIN1V = value; + UPDATE_REG(0x46, WIN1V); + break; + case 0x48: + WININ = value & 0x3F3F; + UPDATE_REG(0x48, WININ); + break; + case 0x4A: + WINOUT = value & 0x3F3F; + UPDATE_REG(0x4A, WINOUT); + break; + case 0x4C: + MOSAIC = value; + UPDATE_REG(0x4C, MOSAIC); + break; + case 0x50: + BLDMOD = value & 0x3FFF; + UPDATE_REG(0x50, BLDMOD); + fxOn = ((BLDMOD>>6)&3) != 0; + CPUUpdateRender(); + break; + case 0x52: + COLEV = value & 0x1F1F; + UPDATE_REG(0x52, COLEV); + break; + case 0x54: + COLY = value & 0x1F; + UPDATE_REG(0x54, COLY); + break; + case 0x60: + case 0x62: + case 0x64: + case 0x68: + case 0x6c: + case 0x70: + case 0x72: + case 0x74: + case 0x78: + case 0x7c: + case 0x80: + case 0x84: + soundEvent(address&0xFF, (u8)(value & 0xFF)); + soundEvent((address&0xFF)+1, (u8)(value>>8)); + break; + case 0x82: + case 0x88: + case 0xa0: + case 0xa2: + case 0xa4: + case 0xa6: + case 0x90: + case 0x92: + case 0x94: + case 0x96: + case 0x98: + case 0x9a: + case 0x9c: + case 0x9e: + soundEvent(address&0xFF, value); + break; + case 0xB0: + DM0SAD_L = value; + UPDATE_REG(0xB0, DM0SAD_L); + break; + case 0xB2: + DM0SAD_H = value & 0x07FF; + UPDATE_REG(0xB2, DM0SAD_H); + break; + case 0xB4: + DM0DAD_L = value; + UPDATE_REG(0xB4, DM0DAD_L); + break; + case 0xB6: + DM0DAD_H = value & 0x07FF; + UPDATE_REG(0xB6, DM0DAD_H); + break; + case 0xB8: + DM0CNT_L = value & 0x3FFF; + UPDATE_REG(0xB8, 0); + break; + case 0xBA: + { + bool start = ((DM0CNT_H ^ value) & 0x8000) ? true : false; + value &= 0xF7E0; + + DM0CNT_H = value; + UPDATE_REG(0xBA, DM0CNT_H); + + if(start && (value & 0x8000)) { + dma0Source = DM0SAD_L | (DM0SAD_H << 16); + dma0Dest = DM0DAD_L | (DM0DAD_H << 16); + CPUCheckDMA(0, 1); + } + } + break; + case 0xBC: + DM1SAD_L = value; + UPDATE_REG(0xBC, DM1SAD_L); + break; + case 0xBE: + DM1SAD_H = value & 0x0FFF; + UPDATE_REG(0xBE, DM1SAD_H); + break; + case 0xC0: + DM1DAD_L = value; + UPDATE_REG(0xC0, DM1DAD_L); + break; + case 0xC2: + DM1DAD_H = value & 0x07FF; + UPDATE_REG(0xC2, DM1DAD_H); + break; + case 0xC4: + DM1CNT_L = value & 0x3FFF; + UPDATE_REG(0xC4, 0); + break; + case 0xC6: + { + bool start = ((DM1CNT_H ^ value) & 0x8000) ? true : false; + value &= 0xF7E0; + + DM1CNT_H = value; + UPDATE_REG(0xC6, DM1CNT_H); + + if(start && (value & 0x8000)) { + dma1Source = DM1SAD_L | (DM1SAD_H << 16); + dma1Dest = DM1DAD_L | (DM1DAD_H << 16); + CPUCheckDMA(0, 2); + } + } + break; + case 0xC8: + DM2SAD_L = value; + UPDATE_REG(0xC8, DM2SAD_L); + break; + case 0xCA: + DM2SAD_H = value & 0x0FFF; + UPDATE_REG(0xCA, DM2SAD_H); + break; + case 0xCC: + DM2DAD_L = value; + UPDATE_REG(0xCC, DM2DAD_L); + break; + case 0xCE: + DM2DAD_H = value & 0x07FF; + UPDATE_REG(0xCE, DM2DAD_H); + break; + case 0xD0: + DM2CNT_L = value & 0x3FFF; + UPDATE_REG(0xD0, 0); + break; + case 0xD2: + { + bool start = ((DM2CNT_H ^ value) & 0x8000) ? true : false; + + value &= 0xF7E0; + + DM2CNT_H = value; + UPDATE_REG(0xD2, DM2CNT_H); + + if(start && (value & 0x8000)) { + dma2Source = DM2SAD_L | (DM2SAD_H << 16); + dma2Dest = DM2DAD_L | (DM2DAD_H << 16); + + CPUCheckDMA(0, 4); + } + } + break; + case 0xD4: + DM3SAD_L = value; + UPDATE_REG(0xD4, DM3SAD_L); + break; + case 0xD6: + DM3SAD_H = value & 0x0FFF; + UPDATE_REG(0xD6, DM3SAD_H); + break; + case 0xD8: + DM3DAD_L = value; + UPDATE_REG(0xD8, DM3DAD_L); + break; + case 0xDA: + DM3DAD_H = value & 0x0FFF; + UPDATE_REG(0xDA, DM3DAD_H); + break; + case 0xDC: + DM3CNT_L = value; + UPDATE_REG(0xDC, 0); + break; + case 0xDE: + { + bool start = ((DM3CNT_H ^ value) & 0x8000) ? true : false; + + value &= 0xFFE0; + + DM3CNT_H = value; + UPDATE_REG(0xDE, DM3CNT_H); + + if(start && (value & 0x8000)) { + dma3Source = DM3SAD_L | (DM3SAD_H << 16); + dma3Dest = DM3DAD_L | (DM3DAD_H << 16); + CPUCheckDMA(0,8); + } + } + break; + case 0x100: + timer0Reload = value; + break; + case 0x102: + timer0Ticks = timer0ClockReload = TIMER_TICKS[value & 3]; + if(!timer0On && (value & 0x80)) { + // reload the counter + TM0D = timer0Reload; + if(timer0ClockReload == 1) + timer0Ticks = 0x10000 - TM0D; + UPDATE_REG(0x100, TM0D); + } + timer0On = value & 0x80 ? true : false; + TM0CNT = value & 0xC7; + UPDATE_REG(0x102, TM0CNT); + // CPUUpdateTicks(); + break; + case 0x104: + timer1Reload = value; + break; + case 0x106: + timer1Ticks = timer1ClockReload = TIMER_TICKS[value & 3]; + if(!timer1On && (value & 0x80)) { + // reload the counter + TM1D = timer1Reload; + if(timer1ClockReload == 1) + timer1Ticks = 0x10000 - TM1D; + UPDATE_REG(0x104, TM1D); + } + timer1On = value & 0x80 ? true : false; + TM1CNT = value & 0xC7; + UPDATE_REG(0x106, TM1CNT); + break; + case 0x108: + timer2Reload = value; + break; + case 0x10A: + timer2Ticks = timer2ClockReload = TIMER_TICKS[value & 3]; + if(!timer2On && (value & 0x80)) { + // reload the counter + TM2D = timer2Reload; + if(timer2ClockReload == 1) + timer2Ticks = 0x10000 - TM2D; + UPDATE_REG(0x108, TM2D); + } + timer2On = value & 0x80 ? true : false; + TM2CNT = value & 0xC7; + UPDATE_REG(0x10A, TM2CNT); + break; + case 0x10C: + timer3Reload = value; + break; + case 0x10E: + timer3Ticks = timer3ClockReload = TIMER_TICKS[value & 3]; + if(!timer3On && (value & 0x80)) { + // reload the counter + TM3D = timer3Reload; + if(timer3ClockReload == 1) + timer3Ticks = 0x10000 - TM3D; + UPDATE_REG(0x10C, TM3D); + } + timer3On = value & 0x80 ? true : false; + TM3CNT = value & 0xC7; + UPDATE_REG(0x10E, TM3CNT); + break; + case 0x128: + if(value & 0x80) { + value &= 0xff7f; + if(value & 1 && (value & 0x4000)) { + UPDATE_REG(0x12a, 0xFF); + IF |= 0x80; + UPDATE_REG(0x202, IF); + value &= 0x7f7f; + } + } + UPDATE_REG(0x128, value); + break; + case 0x130: + P1 |= (value & 0x3FF); + UPDATE_REG(0x130, P1); + break; + case 0x132: + UPDATE_REG(0x132, value & 0xC3FF); + break; + case 0x200: + IE = value & 0x3FFF; + UPDATE_REG(0x200, IE); + if((IME & 1) && (IF & IE) && armIrqEnable) { + CPU_BREAK_LOOP_2; + } + break; + case 0x202: + IF ^= (value & IF); + UPDATE_REG(0x202, IF); + break; + case 0x204: + { + int i; + memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; + + if(!speedHack) { + memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 7]; + memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = + gamepakWaitState0[(value >> 2) & 7]; + + memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 7]; + memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = + gamepakWaitState1[(value >> 5) & 7]; + + memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 7]; + memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = + gamepakWaitState2[(value >> 8) & 7]; + } else { + memoryWait[0x08] = memoryWait[0x09] = 4; + memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 2; + + memoryWait[0x0a] = memoryWait[0x0b] = 4; + memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 4; + + memoryWait[0x0c] = memoryWait[0x0d] = 4; + memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 8; + } + for(i = 0; i < 16; i++) { + memoryWaitFetch32[i] = memoryWait32[i] = memoryWait[i] * + (memory32[i] ? 1 : 2); + memoryWaitFetch[i] = memoryWait[i]; + } + memoryWaitFetch32[3] += 1; + memoryWaitFetch32[2] += 3; + + prefetchActive = false; + prefetchApplies = false; + if(value & 0x4000) { + for(i = 8; i < 16; i++) { + memoryWaitFetch32[i] = 2*cpuMemoryWait[i]; + memoryWaitFetch[i] = cpuMemoryWait[i]; + } + if(((value & 3) == 3)) + { + if(!memLagTempEnabled) + { + memoryWaitFetch[8]--; // hack to prevent inaccurately extreme lag at some points of many games (possibly from no pre-fetch emulation) + /// FIXME: how correct is this? Should it set the fetch to 0 or change fetch32 or anything else? + + prefetchActive = true; + } + prefetchApplies = true; + } + } + //if(prefetchActive && !prefetchPrevActive) systemScreenMessage("pre-fetch enabled",3,600); + //if(!prefetchActive && prefetchPrevActive) systemScreenMessage("pre-fetch disabled",3,600); + prefetchPrevActive = prefetchActive; + + UPDATE_REG(0x204, value); + } + break; + case 0x208: + IME = value & 1; + UPDATE_REG(0x208, IME); + if((IME & 1) && (IF & IE) && armIrqEnable) { + CPU_BREAK_LOOP_2; + } + break; + case 0x300: + if(value != 0) + value &= 0xFFFE; + UPDATE_REG(0x300, value); + break; + default: + UPDATE_REG(address&0x3FE, value); + break; + } +} + +void CPUWriteHalfWord(u32 address, u16 value) +{ +#ifdef DEV_VERSION + if(address & 1) { + if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { + log("Unaligned halfword write: %04x to %08x from %08x\n", + value, + address, + armMode ? armNextPC - 4 : armNextPC - 2); + } + } +#endif + + switch(address >> 24) { + case 2: +#ifdef SDL + if(*((u16 *)&freezeWorkRAM[address & 0x3FFFE])) + cheatsWriteHalfWord((u16 *)&workRAM[address & 0x3FFFE], + value, + *((u16 *)&freezeWorkRAM[address & 0x3FFFE])); + else +#endif + WRITE16LE(((u16 *)&workRAM[address & 0x3FFFE]),value); + break; + case 3: +#ifdef SDL + if(*((u16 *)&freezeInternalRAM[address & 0x7ffe])) + cheatsWriteHalfWord((u16 *)&internalRAM[address & 0x7ffe], + value, + *((u16 *)&freezeInternalRAM[address & 0x7ffe])); + else +#endif + WRITE16LE(((u16 *)&internalRAM[address & 0x7ffe]), value); + break; + case 4: + CPUUpdateRegister(address & 0x3fe, value); + break; + case 5: + WRITE16LE(((u16 *)&paletteRAM[address & 0x3fe]), value); + break; + case 6: + if(address & 0x10000) + WRITE16LE(((u16 *)&vram[address & 0x17ffe]), value); + else + WRITE16LE(((u16 *)&vram[address & 0x1fffe]), value); + break; + case 7: + WRITE16LE(((u16 *)&oam[address & 0x3fe]), value); + break; + case 8: + case 9: + if(address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8) { + if(!rtcWrite(address, value)) + goto unwritable; + } else if(!agbPrintWrite(address, value)) goto unwritable; + break; + case 13: + if(cpuEEPROMEnabled) { + eepromWrite(address, (u8)value); + break; + } + goto unwritable; + case 14: + if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) { + (*cpuSaveGameFunc)(address, (u8)value); + break; + } + goto unwritable; + default: + unwritable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_WRITE) { + log("Illegal halfword write: %04x to %08x from %08x\n", + value, + address, + armMode ? armNextPC - 4 : armNextPC - 2); + } +#endif + break; + } +} + +void CPUWriteByte(u32 address, u8 b) +{ + switch(address >> 24) { + case 2: +#ifdef SDL + if(freezeWorkRAM[address & 0x3FFFF]) + cheatsWriteByte(&workRAM[address & 0x3FFFF], b); + else +#endif + workRAM[address & 0x3FFFF] = b; + break; + case 3: +#ifdef SDL + if(freezeInternalRAM[address & 0x7fff]) + cheatsWriteByte(&internalRAM[address & 0x7fff], b); + else +#endif + internalRAM[address & 0x7fff] = b; + break; + case 4: + switch(address & 0x3FF) { + case 0x301: + if(b == 0x80) + stopState = true; + holdState = 1; + holdType = -1; + break; + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x68: + case 0x69: + case 0x6c: + case 0x6d: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x78: + case 0x79: + case 0x7c: + case 0x7d: + case 0x80: + case 0x81: + case 0x84: + case 0x85: + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + case 0x98: + case 0x99: + case 0x9a: + case 0x9b: + case 0x9c: + case 0x9d: + case 0x9e: + case 0x9f: + soundEvent(address&0xFF, b); + break; + default: + // if(address & 1) { + // CPUWriteHalfWord(address-1, (CPUReadHalfWord(address-1)&0x00FF)|((int)b<<8)); + // } else + if(address & 1) + CPUUpdateRegister(address & 0x3fe, + ((READ16LE(((u16 *)&ioMem[address & 0x3fe]))) + & 0x00FF) | + b<<8); + else + CPUUpdateRegister(address & 0x3fe, + ((READ16LE(((u16 *)&ioMem[address & 0x3fe])) & 0xFF00) | b)); + } + break; + case 5: + // no need to switch + *((u16 *)&paletteRAM[address & 0x3FE]) = (b << 8) | b; + break; + case 6: + // no need to switch + if(address & 0x10000) + *((u16 *)&vram[address & 0x17FFE]) = (b << 8) | b; + else + *((u16 *)&vram[address & 0x1FFFE]) = (b << 8) | b; + break; + case 7: + // no need to switch + *((u16 *)&oam[address & 0x3FE]) = (b << 8) | b; + break; + case 13: + if(cpuEEPROMEnabled) { + eepromWrite(address, b); + break; + } + goto unwritable; + case 14: + if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) { + (*cpuSaveGameFunc)(address, b); + break; + } + // default + default: + unwritable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_WRITE) { + log("Illegal byte write: %02x to %08x from %08x\n", + b, + address, + armMode ? armNextPC - 4 : armNextPC -2 ); + } +#endif + break; + } +} + +u8 cpuBitsSet[256]; +u8 cpuLowestBitSet[256]; + +void CPUInit(const char *biosFileName, bool useBiosFile) +{ +#ifdef WORDS_BIGENDIAN + if(!cpuBiosSwapped) { + for(unsigned int i = 0; i < sizeof(myROM)/4; i++) { + WRITE32LE(&myROM[i], myROM[i]); + } + cpuBiosSwapped = true; + } +#endif + gbaSaveType = 0; + eepromInUse = 0; + saveType = 0; + useBios = false; + + if(useBiosFile) { + int size = 0x4000; + if(utilLoad(biosFileName, + CPUIsGBABios, + bios, + size)) { + if(size == 0x4000) + useBios = true; + else + systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BIOS file size")); + } + } + + if(!useBios) { + memcpy(bios, myROM, sizeof(myROM)); + } + + int i = 0; + + biosProtected[0] = 0x00; + biosProtected[1] = 0xf0; + biosProtected[2] = 0x29; + biosProtected[3] = 0xe1; + + for(i = 0; i < 256; i++) { + int count = 0; + int j; + for(j = 0; j < 8; j++) + if(i & (1 << j)) + count++; + cpuBitsSet[i] = count; + + for(j = 0; j < 8; j++) + if(i & (1 << j)) + break; + cpuLowestBitSet[i] = j; + } + + for(i = 0; i < 0x400; i++) + ioReadable[i] = true; + for(i = 0x10; i < 0x48; i++) + ioReadable[i] = false; + for(i = 0x4c; i < 0x50; i++) + ioReadable[i] = false; + for(i = 0x54; i < 0x60; i++) + ioReadable[i] = false; + for(i = 0x8c; i < 0x90; i++) + ioReadable[i] = false; + for(i = 0xa0; i < 0xb8; i++) + ioReadable[i] = false; + for(i = 0xbc; i < 0xc4; i++) + ioReadable[i] = false; + for(i = 0xc8; i < 0xd0; i++) + ioReadable[i] = false; + for(i = 0xd4; i < 0xdc; i++) + ioReadable[i] = false; + for(i = 0xe0; i < 0x100; i++) + ioReadable[i] = false; + for(i = 0x110; i < 0x120; i++) + ioReadable[i] = false; + for(i = 0x12c; i < 0x130; i++) + ioReadable[i] = false; + for(i = 0x138; i < 0x140; i++) + ioReadable[i] = false; + for(i = 0x144; i < 0x150; i++) + ioReadable[i] = false; + for(i = 0x15c; i < 0x200; i++) + ioReadable[i] = false; + for(i = 0x20c; i < 0x300; i++) + ioReadable[i] = false; + for(i = 0x304; i < 0x400; i++) + ioReadable[i] = false; + + *((u16 *)&rom[0x1fe209c]) = 0xdffa; // SWI 0xFA + *((u16 *)&rom[0x1fe209e]) = 0x4770; // BX LR + + { + int origMemoryWaitFetch[16] = { 3, 0, 3, 0, 0, 1, 1, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; + int origMemoryWaitFetch32[16] = { 6, 0, 6, 0, 0, 2, 2, 0, 8, 8, 8, 8, 8, 8, 8, 0 }; + memcpy(memoryWaitFetch, origMemoryWaitFetch, 16*sizeof(int)); + memcpy(memoryWaitFetch32, origMemoryWaitFetch32, 16*sizeof(int)); + } + +} + +void CPUReset() +{ +#if (defined(WIN32) && !defined(SDL)) + theApp.globalFrameCount = 0; +#endif + VBAMovieSignalReset(); + + if(gbaSaveType == 0) { + if(eepromInUse) + gbaSaveType = 3; + else + switch(saveType) { + case 1: + gbaSaveType = 1; + break; + case 2: + gbaSaveType = 2; + break; + } + } + + rtcReset(); + // clean registers + memset(®[0], 0, sizeof(reg)); + // clean OAM + memset(oam, 0, 0x400); + // clean palette + memset(paletteRAM, 0, 0x400); + // clean picture + memset(pix, 0, 4*160*240); + // clean vram + memset(vram, 0, 0x20000); + // clean io memory + memset(ioMem, 0, 0x400); + // clean RAM + memset(internalRAM, 0, 0x8000); /// FIXME: is it unsafe to erase ALL of this? Even the init code doesn't. + memset(workRAM, 0, 0x40000); /// ditto + + DISPCNT = 0x0080; + DISPSTAT = 0x0000; + VCOUNT = 0x0000; + BG0CNT = 0x0000; + BG1CNT = 0x0000; + BG2CNT = 0x0000; + BG3CNT = 0x0000; + BG0HOFS = 0x0000; + BG0VOFS = 0x0000; + BG1HOFS = 0x0000; + BG1VOFS = 0x0000; + BG2HOFS = 0x0000; + BG2VOFS = 0x0000; + BG3HOFS = 0x0000; + BG3VOFS = 0x0000; + BG2PA = 0x0100; + BG2PB = 0x0000; + BG2PC = 0x0000; + BG2PD = 0x0100; + BG2X_L = 0x0000; + BG2X_H = 0x0000; + BG2Y_L = 0x0000; + BG2Y_H = 0x0000; + BG3PA = 0x0100; + BG3PB = 0x0000; + BG3PC = 0x0000; + BG3PD = 0x0100; + BG3X_L = 0x0000; + BG3X_H = 0x0000; + BG3Y_L = 0x0000; + BG3Y_H = 0x0000; + WIN0H = 0x0000; + WIN1H = 0x0000; + WIN0V = 0x0000; + WIN1V = 0x0000; + WININ = 0x0000; + WINOUT = 0x0000; + MOSAIC = 0x0000; + BLDMOD = 0x0000; + COLEV = 0x0000; + COLY = 0x0000; + DM0SAD_L = 0x0000; + DM0SAD_H = 0x0000; + DM0DAD_L = 0x0000; + DM0DAD_H = 0x0000; + DM0CNT_L = 0x0000; + DM0CNT_H = 0x0000; + DM1SAD_L = 0x0000; + DM1SAD_H = 0x0000; + DM1DAD_L = 0x0000; + DM1DAD_H = 0x0000; + DM1CNT_L = 0x0000; + DM1CNT_H = 0x0000; + DM2SAD_L = 0x0000; + DM2SAD_H = 0x0000; + DM2DAD_L = 0x0000; + DM2DAD_H = 0x0000; + DM2CNT_L = 0x0000; + DM2CNT_H = 0x0000; + DM3SAD_L = 0x0000; + DM3SAD_H = 0x0000; + DM3DAD_L = 0x0000; + DM3DAD_H = 0x0000; + DM3CNT_L = 0x0000; + DM3CNT_H = 0x0000; + TM0D = 0x0000; + TM0CNT = 0x0000; + TM1D = 0x0000; + TM1CNT = 0x0000; + TM2D = 0x0000; + TM2CNT = 0x0000; + TM3D = 0x0000; + TM3CNT = 0x0000; + P1 = 0x03FF; + IE = 0x0000; + IF = 0x0000; + IME = 0x0000; + + armMode = 0x1F; + + if(cpuIsMultiBoot) { + reg[13].I = 0x03007F00; + reg[15].I = 0x02000000; + reg[16].I = 0x00000000; + reg[R13_IRQ].I = 0x03007FA0; + reg[R13_SVC].I = 0x03007FE0; + armIrqEnable = true; + } else { + if(useBios && !skipBios) { + reg[15].I = 0x00000000; + armMode = 0x13; + armIrqEnable = false; + } else { + reg[13].I = 0x03007F00; + reg[15].I = 0x08000000; + reg[16].I = 0x00000000; + reg[R13_IRQ].I = 0x03007FA0; + reg[R13_SVC].I = 0x03007FE0; + armIrqEnable = true; + } + } + armState = true; + C_FLAG = V_FLAG = N_FLAG = Z_FLAG = false; + UPDATE_REG(0x00, DISPCNT); + UPDATE_REG(0x20, BG2PA); + UPDATE_REG(0x26, BG2PD); + UPDATE_REG(0x30, BG3PA); + UPDATE_REG(0x36, BG3PD); + UPDATE_REG(0x130, P1); + UPDATE_REG(0x88, 0x200); + + // disable FIQ + reg[16].I |= 0x40; + + CPUUpdateCPSR(); + + armNextPC = reg[15].I; + reg[15].I += 4; + + // reset internal state + holdState = false; + holdType = 0; + + biosProtected[0] = 0x00; + biosProtected[1] = 0xf0; + biosProtected[2] = 0x29; + biosProtected[3] = 0xe1; + + BIOS_RegisterRamReset(); + + lcdTicks = 960; + timer0On = false; + timer0Ticks = 0; + timer0Reload = 0; + timer0ClockReload = 0; + timer1On = false; + timer1Ticks = 0; + timer1Reload = 0; + timer1ClockReload = 0; + timer2On = false; + timer2Ticks = 0; + timer2Reload = 0; + timer2ClockReload = 0; + timer3On = false; + timer3Ticks = 0; + timer3Reload = 0; + timer3ClockReload = 0; + dma0Source = 0; + dma0Dest = 0; + dma1Source = 0; + dma1Dest = 0; + dma2Source = 0; + dma2Dest = 0; + dma3Source = 0; + dma3Dest = 0; + cpuSaveGameFunc = flashSaveDecide; + renderLine = mode0RenderLine; + fxOn = false; + windowOn = false; + frameCount = 0; + saveType = 0; + layerEnable = DISPCNT & layerSettings; + + CPUUpdateRenderBuffers(true); + + for(int i = 0; i < 256; i++) { + map[i].address = (u8 *)&dummyAddress; + map[i].mask = 0; + } + + map[0].address = bios; + map[0].mask = 0x3FFF; + map[2].address = workRAM; + map[2].mask = 0x3FFFF; + map[3].address = internalRAM; + map[3].mask = 0x7FFF; + map[4].address = ioMem; + map[4].mask = 0x3FF; + map[5].address = paletteRAM; + map[5].mask = 0x3FF; + map[6].address = vram; + map[6].mask = 0x1FFFF; + map[7].address = oam; + map[7].mask = 0x3FF; + map[8].address = rom; + map[8].mask = 0x1FFFFFF; + map[9].address = rom; + map[9].mask = 0x1FFFFFF; + map[10].address = rom; + map[10].mask = 0x1FFFFFF; + map[12].address = rom; + map[12].mask = 0x1FFFFFF; + map[14].address = flashSaveMemory; + map[14].mask = 0xFFFF; + + eepromReset(); + flashReset(); + + soundReset(); + + CPUUpdateWindow0(); + CPUUpdateWindow1(); + + // make sure registers are correctly initialized if not using BIOS + if(!useBios) { + if(cpuIsMultiBoot) + BIOS_RegisterRamReset(0xfe); + else + BIOS_RegisterRamReset(0xff); + } else { + if(cpuIsMultiBoot) + BIOS_RegisterRamReset(0xfe); + } + + switch(cpuSaveType) { + case 0: // automatic + cpuSramEnabled = true; + cpuFlashEnabled = true; + cpuEEPROMEnabled = true; + cpuEEPROMSensorEnabled = false; + break; + case 1: // EEPROM + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = true; + cpuEEPROMSensorEnabled = false; + break; + case 2: // SRAM + cpuSramEnabled = true; + cpuFlashEnabled = false; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + cpuSaveGameFunc = sramWrite; + break; + case 3: // FLASH + cpuSramEnabled = false; + cpuFlashEnabled = true; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + cpuSaveGameFunc = flashWrite; + break; + case 4: // EEPROM+Sensor + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = true; + cpuEEPROMSensorEnabled = true; + break; + case 5: // NONE + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + break; + } + +#if (defined(WIN32) && !defined(SDL)) + theApp.sensorX = theApp.sensorY = 2047; +#else + extern int sensorX, sensorY; // from SDL.cpp + sensorX = sensorY = 2047; +#endif + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + lastTime = systemGetClock(); +} + +void CPUInterrupt() +{ + u32 PC = reg[15].I; + bool savedState = armState; + CPUSwitchMode(0x12, true, false); + reg[14].I = PC; + if(!savedState) + reg[14].I += 2; + reg[15].I = 0x18; + armState = true; + armIrqEnable = false; + + armNextPC = reg[15].I; + reg[15].I += 4; + + // if(!holdState) + biosProtected[0] = 0x02; + biosProtected[1] = 0xc0; + biosProtected[2] = 0x5e; + biosProtected[3] = 0xe5; +} + +void TogglePrefetchHack() +{ + memLagTempEnabled = !memLagTempEnabled; + + if(emulating) + { + extern bool prefetchActive, prefetchPrevActive, prefetchApplies; + if(prefetchApplies && prefetchActive == memLagTempEnabled) + { + prefetchActive = !prefetchActive; + //if(prefetchActive && !prefetchPrevActive) systemScreenMessage("pre-fetch enabled",3,600); + //if(!prefetchActive && prefetchPrevActive) systemScreenMessage("pre-fetch disabled",3,600); + extern int memoryWaitFetch [16]; + if(prefetchActive) memoryWaitFetch[8]--; + else memoryWaitFetch[8]++; + prefetchPrevActive = prefetchActive; + } + } +} + +void SetPrefetchHack(bool set) +{ + if(memLagTempEnabled == set) + TogglePrefetchHack(); +} + +#ifdef SDL +void log(const char *defaultMsg, ...) +{ + char buffer[2048]; + va_list valist; + + va_start(valist, defaultMsg); + vsprintf(buffer, defaultMsg, valist); + + if(out == NULL) { + out = fopen("trace.log","w"); + } + + fputs(buffer, out); + + va_end(valist); +} +#else +extern void winlog(const char *, ...); +#endif + +static bool frameBoundary = false; + +void CPULoop(int ticks) +{ + int clockTicks; + int cpuLoopTicks = 0; + int timerOverflow = 0; + // variables used by the CPU core + + extCpuLoopTicks = &cpuLoopTicks; + extClockTicks = &clockTicks; + extTicks = &ticks; + + cpuLoopTicks = CPUUpdateTicks(); + if(cpuLoopTicks > ticks) { + cpuLoopTicks = ticks; + cpuSavedTicks = ticks; + } + + if(intState) { + cpuLoopTicks = 5; + cpuSavedTicks = 5; + } + + for(;;) { +#ifndef FINAL_VERSION + if(systemDebug) { + if(systemDebug >= 10 && !holdState) { + CPUUpdateCPSR(); + sprintf(buffer, "R00=%08x R01=%08x R02=%08x R03=%08x R04=%08x R05=%08x R06=%08x R07=%08x R08=%08x R09=%08x R10=%08x R11=%08x R12=%08x R13=%08x R14=%08x R15=%08x R16=%08x R17=%08x\n", + reg[0].I, reg[1].I, reg[2].I, reg[3].I, reg[4].I, reg[5].I, + reg[6].I, reg[7].I, reg[8].I, reg[9].I, reg[10].I, reg[11].I, + reg[12].I, reg[13].I, reg[14].I, reg[15].I, reg[16].I, + reg[17].I); +#ifdef SDL + log(buffer); +#else + winlog(buffer); +#endif + } else if(!holdState) { + sprintf(buffer, "PC=%08x\n", armNextPC); +#ifdef SDL + log(buffer); +#else + winlog(buffer); +#endif + } + } +#endif + + if(!holdState) { + if(armState) { +#include "arm-new.h" + } else { +#include "thumb.h" + } + } else { + clockTicks = lcdTicks; + + if(soundTicks < clockTicks) + clockTicks = soundTicks; + + if(timer0On && (timer0Ticks < clockTicks)) { + clockTicks = timer0Ticks; + } + if(timer1On && (timer1Ticks < clockTicks)) { + clockTicks = timer1Ticks; + } + if(timer2On && (timer2Ticks < clockTicks)) { + clockTicks = timer2Ticks; + } + if(timer3On && (timer3Ticks < clockTicks)) { + clockTicks = timer3Ticks; + } +#ifdef PROFILING + if(profilingTicksReload != 0) { + if(profilingTicks < clockTicks) { + clockTicks = profilingTicks; + } + } +#endif + } + + cpuLoopTicks -= clockTicks; + if((cpuLoopTicks <= 0)) { + if(cpuSavedTicks) { + clockTicks = cpuSavedTicks;// + cpuLoopTicks; + } + cpuDmaTicksToUpdate = -cpuLoopTicks; + + updateLoop: + lcdTicks -= clockTicks; + + if(lcdTicks <= 0) { + if(DISPSTAT & 1) { // V-BLANK + // if in V-Blank mode, keep computing... + if(DISPSTAT & 2) { + lcdTicks += 960; + VCOUNT++; + UPDATE_REG(0x06, VCOUNT); + DISPSTAT &= 0xFFFD; + UPDATE_REG(0x04, DISPSTAT); + CPUCompareVCOUNT(); + } else { + lcdTicks += 272; + DISPSTAT |= 2; + UPDATE_REG(0x04, DISPSTAT); + if(DISPSTAT & 16) { + IF |= 2; + UPDATE_REG(0x202, IF); + } + } + + if(VCOUNT >= 228) { + DISPSTAT &= 0xFFFC; + UPDATE_REG(0x04, DISPSTAT); + VCOUNT = 0; + UPDATE_REG(0x06, VCOUNT); + CPUCompareVCOUNT(); + } + } else { + bool fastForward = speedup; + int framesToSkip = systemFrameSkip; + #if (defined(WIN32) && !defined(SDL)) + int throttle = theApp.throttle; + if(theApp.frameSearching && throttle < 100) + throttle = 100; + fastForward |= theApp.frameSearchSkipping; + #else + extern int throttle; + #endif + + if(fastForward) + framesToSkip = 9; // try 6 FPS during speedup + else if(throttle != 100) + framesToSkip = (framesToSkip * throttle) / 100; // change frame skip to match up with the throttle's adjusted speed (so 6 frame skip becomes 3 frames at 50% speed) + + if(DISPSTAT & 2) { + // if in H-Blank, leave it and move to drawing mode + VCOUNT++; + UPDATE_REG(0x06, VCOUNT); + + lcdTicks += (960); + DISPSTAT &= 0xFFFD; + if(VCOUNT == 160) { + count++; + systemFrame(60); + + if(count == 60) { + u32 time = systemGetClock(); + if(time != lastTime) { + u32 t = 100000/(time - lastTime); + systemShowSpeed(t); + } else + systemShowSpeed(0); + lastTime = time; + count = 0; + } + u32 joy = 0; + + // update joystick information + if(systemReadJoypads()) + // read default joystick + joy = systemReadJoypad(-1,cpuEEPROMSensorEnabled); + + frameBoundary = true; + + + P1 = 0x03FF ^ (joy & 0x3FF); + + UPDATE_REG(0x130, P1); + u16 P1CNT = READ16LE(((u16 *)&ioMem[0x132])); + // this seems wrong, but there are cases where the game + // can enter the stop state without requesting an IRQ from + // the joypad. + if((P1CNT & 0x4000) || stopState) { + u16 p1 = (0x3FF ^ P1) & 0x3FF; + if(P1CNT & 0x8000) { + if(p1 == (P1CNT & 0x3FF)) { + IF |= 0x1000; + UPDATE_REG(0x202, IF); + } + } else { + if(p1 & P1CNT) { + IF |= 0x1000; + UPDATE_REG(0x202, IF); + } + } + } + + u32 ext = (joy >> 10); + int cheatTicks = 0; + if(cheatsEnabled) + cheatsCheckKeys(P1^0x3FF, ext); + cpuDmaTicksToUpdate += cheatTicks; + speedup = (ext & 1) ? true : false; + capture = (ext & 2) ? true : false; + + if(capture && !capturePrevious) { + captureNumber++; + systemScreenCapture(captureNumber); + } + capturePrevious = capture; + + DISPSTAT |= 1; + DISPSTAT &= 0xFFFD; + UPDATE_REG(0x04, DISPSTAT); + if(DISPSTAT & 0x0008) { + IF |= 1; + UPDATE_REG(0x202, IF); + } + CPUCheckDMA(1, 0x0f); + + pauseAfterFrameAdvance = systemPauseOnFrame(); + + if(frameCount >= framesToSkip || pauseAfterFrameAdvance) { + systemDrawScreen(); + frameCount = 0; + } else + frameCount++; +/// if(systemPauseOnFrame()) +/// ticks = 0; + if(pauseAfterFrameAdvance) + { + #if (defined(WIN32) && !defined(SDL)) + if(theApp.muteFrameAdvance) + theApp.frameAdvanceMuteNow = true; + theApp.paused = true; + if(theApp.sound) + theApp.sound->pause(); // prevents the sound from looping annoyingly after a frame advance in GBA games + #else + extern bool paused; // from SDL.cpp + paused = true; + systemSoundPause(); + #endif + } + else + { + #if (defined(WIN32) && !defined(SDL)) + theApp.frameAdvanceMuteNow = false; + #endif + } + } + + UPDATE_REG(0x04, DISPSTAT); + + CPUCompareVCOUNT(); + } else { + if(frameCount >= framesToSkip || pauseAfterFrameAdvance) { + (*renderLine)(); + + switch(systemColorDepth) { + case 16: + { + u16 *dest = (u16 *)pix + 242 * (VCOUNT+1); + for(int x = 0; x < 240;) { + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + *dest++ = systemColorMap16[lineMix[x++]&0xFFFF]; + } + // for filters that read past the screen + *dest++ = 0; + } + break; + case 24: + { + u8 *dest = (u8 *)pix + 240 * VCOUNT * 3; + for(int x = 0; x < 240;) { + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + *((u32 *)dest) = systemColorMap32[lineMix[x++] & 0xFFFF]; + dest += 3; + } + } + break; + case 32: + { + u32 *dest = (u32 *)pix + 241 * (VCOUNT+1); + for(int x = 0; x < 240; ) { + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + *dest++ = systemColorMap32[lineMix[x++] & 0xFFFF]; + } + } + break; + } + } + // entering H-Blank + DISPSTAT |= 2; + UPDATE_REG(0x04, DISPSTAT); + lcdTicks += 272; + CPUCheckDMA(2, 0x0f); + if(DISPSTAT & 16) { + IF |= 2; + UPDATE_REG(0x202, IF); + } + } + } + } + + if(!stopState) { + if(timer0On) { + if(timer0ClockReload == 1) { + u32 tm0d = TM0D + clockTicks; + if(tm0d > 0xffff) { + tm0d += timer0Reload; + timerOverflow |= 1; + soundTimerOverflow(0); + if(TM0CNT & 0x40) { + IF |= 0x08; + UPDATE_REG(0x202, IF); + } + } + TM0D = tm0d; + timer0Ticks = 0x10000 - TM0D; + UPDATE_REG(0x100, TM0D); + } else { + timer0Ticks -= clockTicks; + if(timer0Ticks <= 0) { + timer0Ticks += timer0ClockReload; + TM0D++; + if(TM0D == 0) { + TM0D = timer0Reload; + timerOverflow |= 1; + soundTimerOverflow(0); + if(TM0CNT & 0x40) { + IF |= 0x08; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x100, TM0D); + } + } + } + + if(timer1On) { + if(TM1CNT & 4) { + if(timerOverflow & 1) { + TM1D++; + if(TM1D == 0) { + TM1D += timer1Reload; + timerOverflow |= 2; + soundTimerOverflow(1); + if(TM1CNT & 0x40) { + IF |= 0x10; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x104, TM1D); + } + } else { + if(timer1ClockReload == 1) { + u32 tm1d = TM1D + clockTicks; + if(tm1d > 0xffff) { + tm1d += timer1Reload; + timerOverflow |= 2; + soundTimerOverflow(1); + if(TM1CNT & 0x40) { + IF |= 0x10; + UPDATE_REG(0x202, IF); + } + } + TM1D = tm1d; + timer1Ticks = 0x10000 - TM1D; + UPDATE_REG(0x104, TM1D); + } else { + timer1Ticks -= clockTicks; + if(timer1Ticks <= 0) { + timer1Ticks += timer1ClockReload; + TM1D++; + + if(TM1D == 0) { + TM1D = timer1Reload; + timerOverflow |= 2; + soundTimerOverflow(1); + if(TM1CNT & 0x40) { + IF |= 0x10; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x104, TM1D); + } + } + } + } + + if(timer2On) { + if(TM2CNT & 4) { + if(timerOverflow & 2) { + TM2D++; + if(TM2D == 0) { + TM2D += timer2Reload; + timerOverflow |= 4; + if(TM2CNT & 0x40) { + IF |= 0x20; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x108, TM2D); + } + } else { + if(timer2ClockReload == 1) { + u32 tm2d = TM2D + clockTicks; + if(tm2d > 0xffff) { + tm2d += timer2Reload; + timerOverflow |= 4; + if(TM2CNT & 0x40) { + IF |= 0x20; + UPDATE_REG(0x202, IF); + } + } + TM2D = tm2d; + timer2Ticks = 0x10000 - TM2D; + UPDATE_REG(0x108, TM2D); + } else { + timer2Ticks -= clockTicks; + if(timer2Ticks <= 0) { + timer2Ticks += timer2ClockReload; + TM2D++; + + if(TM2D == 0) { + TM2D = timer2Reload; + timerOverflow |= 4; + if(TM2CNT & 0x40) { + IF |= 0x20; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x108, TM2D); + } + } + } + } + + if(timer3On) { + if(TM3CNT & 4) { + if(timerOverflow & 4) { + TM3D++; + if(TM3D == 0) { + TM3D += timer3Reload; + if(TM3CNT & 0x40) { + IF |= 0x40; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x10c, TM3D); + } + } else { + if(timer3ClockReload == 1) { + u32 tm3d = TM3D + clockTicks; + if(tm3d > 0xffff) { + tm3d += timer3Reload; + if(TM3CNT & 0x40) { + IF |= 0x40; + UPDATE_REG(0x202, IF); + } + } + TM3D = tm3d; + timer3Ticks = 0x10000 - TM3D; + UPDATE_REG(0x10C, TM3D); + } else { + timer3Ticks -= clockTicks; + if(timer3Ticks <= 0) { + timer3Ticks += timer3ClockReload; + TM3D++; + + if(TM3D == 0) { + TM3D = timer3Reload; + if(TM3CNT & 0x40) { + IF |= 0x40; + UPDATE_REG(0x202, IF); + } + } + UPDATE_REG(0x10C, TM3D); + } + } + } + } + } + // we shouldn't be doing sound in stop state, but we lose synchronization + // if sound is disabled, so in stop state, soundTick will just produce + // mute sound + soundTicks -= clockTicks; + if(soundTicks <= 0) { + soundTick(); + soundTicks += SOUND_CLOCK_TICKS; + } + timerOverflow = 0; + +#ifdef PROFILING + profilingTicks -= clockTicks; + if(profilingTicks <= 0) { + profilingTicks += profilingTicksReload; + if(profilBuffer && profilSize) { + u16 *b = (u16 *)profilBuffer; + int pc = ((reg[15].I - profilLowPC) * profilScale)/0x10000; + if(pc >= 0 && pc < profilSize) { + b[pc]++; + } + } + } +#endif + + ticks -= clockTicks; + + cpuLoopTicks = CPUUpdateTicks(); + + if(cpuDmaTicksToUpdate > 0) { + clockTicks = cpuSavedTicks; + if(clockTicks > cpuDmaTicksToUpdate) + clockTicks = cpuDmaTicksToUpdate; + cpuDmaTicksToUpdate -= clockTicks; + if(cpuDmaTicksToUpdate < 0) + cpuDmaTicksToUpdate = 0; + goto updateLoop; + } + + if(IF && (IME & 1) && armIrqEnable) { + int res = IF & IE; + if(stopState) + res &= 0x3080; + if(res) { + if(intState) { + CPUInterrupt(); + intState = false; + if(holdState) { + holdState = false; + stopState = false; + } + } else { + if(!holdState) { + intState = true; + cpuLoopTicks = 5; + cpuSavedTicks = 5; + } else { + CPUInterrupt(); + if(holdState) { + holdState = false; + stopState = false; + } + } + } + } + } + + #if (defined(WIN32) && !defined(SDL)) + if(theApp.useOldGBTiming) + #else + if(false) /// SDL FIXME + #endif + { + if(ticks <= 0) + break; + } + else + { + if(frameBoundary) + { + frameBoundary = false; + return; + } + } + } + } +} + +struct EmulatedSystem GBASystem = { + // emuMain + CPULoop, + // emuReset + CPUReset, + // emuCleanUp + CPUCleanUp, + // emuReadBattery + CPUReadBatteryFile, + // emuWriteBattery + CPUWriteBatteryFile, + // emuReadBatteryFromStream + CPUReadBatteryFromStream, + // emuWriteBatteryToStream + CPUWriteBatteryToStream, + // emuReadState + CPUReadState, + // emuWriteState + CPUWriteState, + // emuReadStateFromStream + CPUReadStateFromStream, + // emuWriteStateToStream + CPUWriteStateToStream, + // emuReadMemState + CPUReadMemState, + // emuWriteMemState + CPUWriteMemState, + // emuWritePNG + CPUWritePNGFile, + // emuWriteBMP + CPUWriteBMPFile, + // emuUpdateCPSR + CPUUpdateCPSR, + // emuHasDebugger + true, + // emuCount +#ifdef FINAL_VERSION + 250000 +#else + 5000 +#endif +}; diff --git a/src/GBA.h b/src/GBA.h new file mode 100644 index 0000000..43f12d6 --- /dev/null +++ b/src/GBA.h @@ -0,0 +1,175 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_GBA_H +#define VBA_GBA_H + +#include "System.h" + +#if (defined(WIN32) && !defined(SDL)) +#include // for HANDLE +// NOTE: if you get this error: +// #error WINDOWS.H already included. MFC apps must not #include +// it is probably because stdafx.h is getting included at the wrong place +// (i.e. after anything else) in a file, or your precompiled headers are otherwise wrong +#endif + +#define SAVE_GAME_VERSION_1 1 +#define SAVE_GAME_VERSION_2 2 +#define SAVE_GAME_VERSION_3 3 +#define SAVE_GAME_VERSION_4 4 +#define SAVE_GAME_VERSION_5 5 +#define SAVE_GAME_VERSION_6 6 +#define SAVE_GAME_VERSION_7 7 +#define SAVE_GAME_VERSION_8 8 +#define SAVE_GAME_VERSION_9 9 +#define SAVE_GAME_VERSION_10 10 +#define SAVE_GAME_VERSION_11 11 +#define SAVE_GAME_VERSION_12 12 +#define SAVE_GAME_VERSION SAVE_GAME_VERSION_12 + +typedef struct { + u8 *address; + u32 mask; +} memoryMap; + +typedef union { + struct { +#ifdef WORDS_BIGENDIAN + u8 B3; + u8 B2; + u8 B1; + u8 B0; +#else + u8 B0; + u8 B1; + u8 B2; + u8 B3; +#endif + } B; + struct { +#ifdef WORDS_BIGENDIAN + u16 W1; + u16 W0; +#else + u16 W0; + u16 W1; +#endif + } W; +#ifdef WORDS_BIGENDIAN + volatile u32 I; +#else + u32 I; +#endif +} reg_pair; + +#ifndef NO_GBA_MAP +extern memoryMap map[256]; +#endif + +#if (defined(WIN32) && !defined(SDL)) +extern HANDLE mapROM; // shared memory handles +extern HANDLE mapWORKRAM; +extern HANDLE mapBIOS; +extern HANDLE mapIRAM; +extern HANDLE mapPALETTERAM; +extern HANDLE mapVRAM; +extern HANDLE mapOAM; +extern HANDLE mapPIX; +extern HANDLE mapIOMEM; +#endif + +extern reg_pair reg[45]; +extern u8 biosProtected[4]; + +extern bool N_FLAG; +extern bool Z_FLAG; +extern bool C_FLAG; +extern bool V_FLAG; +extern bool armIrqEnable; +extern bool armState; +extern int armMode; +extern void (*cpuSaveGameFunc)(u32,u8); + +extern bool freezeWorkRAM[0x40000]; +extern bool freezeInternalRAM[0x8000]; +extern bool CPUReadGSASnapshot(const char *); +extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *); +extern bool CPUWriteBatteryFile(const char *); +extern bool CPUReadBatteryFile(const char *); +extern bool CPUWriteBatteryToStream(gzFile); +extern bool CPUReadBatteryFromStream(gzFile); +extern bool CPUExportEepromFile(const char *); +extern bool CPUImportEepromFile(const char *); +extern bool CPUWritePNGFile(const char *); +extern bool CPUWriteBMPFile(const char *); +extern void CPUCleanUp(); +extern void CPUUpdateRender(); +extern bool CPUReadMemState(char *, int); +extern bool CPUReadState(const char *); +extern bool CPUWriteMemState(char *, int); +extern bool CPUWriteState(const char *); +extern bool CPUReadStateFromStream(gzFile); +extern bool CPUWriteStateToStream(gzFile); +extern int CPULoadRom(const char *); +extern void CPUUpdateRegister(u32, u16); +extern void CPUWriteHalfWord(u32, u16); +extern void CPUWriteByte(u32, u8); +extern void CPUInit(const char *,bool); +extern void CPUReset(); +extern void CPULoop(int); +extern void CPUCheckDMA(int,int); +extern bool CPUIsGBAImage(const char *); +extern bool CPUIsZipFile(const char *); +#ifdef PROFILING +extern void cpuProfil(char *buffer, int, u32, int); +extern void cpuEnableProfiling(int hz); +#endif + +extern struct EmulatedSystem GBASystem; + +#define R13_IRQ 18 +#define R14_IRQ 19 +#define SPSR_IRQ 20 +#define R13_USR 26 +#define R14_USR 27 +#define R13_SVC 28 +#define R14_SVC 29 +#define SPSR_SVC 30 +#define R13_ABT 31 +#define R14_ABT 32 +#define SPSR_ABT 33 +#define R13_UND 34 +#define R14_UND 35 +#define SPSR_UND 36 +#define R8_FIQ 37 +#define R9_FIQ 38 +#define R10_FIQ 39 +#define R11_FIQ 40 +#define R12_FIQ 41 +#define R13_FIQ 42 +#define R14_FIQ 43 +#define SPSR_FIQ 44 + +#include "Cheats.h" +#include "Globals.h" +#include "EEprom.h" +#include "Flash.h" + +#endif //VBA_GBA_H diff --git a/src/GBAinline.h b/src/GBAinline.h new file mode 100644 index 0000000..d9cf020 --- /dev/null +++ b/src/GBAinline.h @@ -0,0 +1,427 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_GBAinline_H +#define VBA_GBAinline_H + +#include "System.h" +#include "Port.h" +#include "RTC.h" + +extern bool cpuSramEnabled; +extern bool cpuFlashEnabled; +extern bool cpuEEPROMEnabled; +extern bool cpuEEPROMSensorEnabled; + +#define CPUReadByteQuick(addr) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] + +#define CPUReadHalfWordQuick(addr) \ + READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define CPUReadMemoryQuick(addr) \ + READ32LE(((u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +//inline u32 CPUReadMemoryQuick(u32 addr) +//{ +// u32 addrShift = (addr)>>24; +// u32 rt = (addr) & map[addrShift].mask; +// return READ32LE(((u32*)&map[addrShift].address[rt])); +//} + +inline u32 CPUReadMemory(u32 address) +{ + +#ifdef DEV_VERSION + if(address & 3) { + if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { + log("Unaligned word read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } + } +#endif + + u32 value; + switch(address >> 24) { + case 0: + if(reg[15].I >> 24) { + if(address < 0x4000) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal word read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + + value = READ32LE(((u32 *)&biosProtected)); + } + else goto unreadable; + } else + value = READ32LE(((u32 *)&bios[address & 0x3FFC])); + break; + case 2: + value = READ32LE(((u32 *)&workRAM[address & 0x3FFFC])); + break; + case 3: + value = READ32LE(((u32 *)&internalRAM[address & 0x7ffC])); + break; + case 4: + if((address < 0x4000400) && ioReadable[address & 0x3fc]) { + if(ioReadable[(address & 0x3fc) + 2]) + value = READ32LE(((u32 *)&ioMem[address & 0x3fC])); + else + value = READ16LE(((u16 *)&ioMem[address & 0x3fc])); + } else goto unreadable; + break; + case 5: + value = READ32LE(((u32 *)&paletteRAM[address & 0x3fC])); + break; + case 6: + value = READ32LE(((u32 *)&vram[address & 0x1fffc])); + break; + case 7: + value = READ32LE(((u32 *)&oam[address & 0x3FC])); + break; + case 8: + case 9: + case 10: + case 11: + case 12: + value = READ32LE(((u32 *)&rom[address&0x1FFFFFC])); + break; + case 13: + if(cpuEEPROMEnabled) + // no need to swap this + return eepromRead(address); + goto unreadable; + case 14: + if(cpuFlashEnabled | cpuSramEnabled) + // no need to swap this + return flashRead(address); + // default + default: + unreadable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal word read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + + // if(ioMem[0x205] & 0x40) { + if(armState) { + value = CPUReadMemoryQuick(reg[15].I); + } else { + value = CPUReadHalfWordQuick(reg[15].I) | + CPUReadHalfWordQuick(reg[15].I) << 16; + } + // } else { + // value = *((u32 *)&bios[address & 0x3ffc]); + // } + // return 0xFFFFFFFF; + } + + if(address & 3) { +#ifdef C_CORE + int shift = (address & 3) << 3; + value = (value >> shift) | (value << (32 - shift)); +#else +#ifdef __GNUC__ + asm("and $3, %%ecx;" + "shl $3 ,%%ecx;" + "ror %%cl, %0" + : "=r" (value) + : "r" (value), "c" (address)); +#else + __asm { + mov ecx, address; + and ecx, 3; + shl ecx, 3; + ror [dword ptr value], cl; + } +#endif +#endif + } + return value; +} + +extern u32 myROM[]; + +inline u32 CPUReadHalfWord(u32 address) +{ +#ifdef DEV_VERSION + if(address & 1) { + if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { + log("Unaligned halfword read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } + } +#endif + + u32 value; + + switch(address >> 24) { + case 0: + if (reg[15].I >> 24) { + if(address < 0x4000) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal halfword read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + value = READ16LE(((u16 *)&biosProtected[address&2])); + } else goto unreadable; + } else + value = READ16LE(((u16 *)&bios[address & 0x3FFE])); + break; + case 2: + value = READ16LE(((u16 *)&workRAM[address & 0x3FFFE])); + break; + case 3: + value = READ16LE(((u16 *)&internalRAM[address & 0x7ffe])); + break; + case 4: + if((address < 0x4000400) && ioReadable[address & 0x3fe]) + value = READ16LE(((u16 *)&ioMem[address & 0x3fe])); + else goto unreadable; + break; + case 5: + value = READ16LE(((u16 *)&paletteRAM[address & 0x3fe])); + break; + case 6: + value = READ16LE(((u16 *)&vram[address & 0x1fffe])); + break; + case 7: + value = READ16LE(((u16 *)&oam[address & 0x3fe])); + break; + case 8: + case 9: + case 10: + case 11: + case 12: + if(address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8) + value = rtcRead(address); + else + value = READ16LE(((u16 *)&rom[address & 0x1FFFFFE])); + break; + case 13: + if(cpuEEPROMEnabled) + // no need to swap this + return eepromRead(address); + goto unreadable; + case 14: + if(cpuFlashEnabled | cpuSramEnabled) + // no need to swap this + return flashRead(address); + // default + default: + unreadable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal halfword read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + extern bool cpuDmaHack; + extern u32 cpuDmaLast; + extern int cpuDmaCount; + if(cpuDmaHack && cpuDmaCount) { + value = (u16)cpuDmaLast; + } else { + if(armState) { + value = CPUReadHalfWordQuick(reg[15].I + (address & 2)); + } else { + value = CPUReadHalfWordQuick(reg[15].I); + } + } + // return value; + // if(address & 1) + // value = (value >> 8) | ((value & 0xFF) << 24); + // return 0xFFFF; + break; + } + + if(address & 1) { + value = (value >> 8) | (value << 24); + } + + return value; +} + +inline u16 CPUReadHalfWordSigned(u32 address) +{ + u16 value = CPUReadHalfWord(address); + if((address & 1)) + value = (s8)value; + return value; +} + +inline u8 CPUReadByte(u32 address) +{ + switch(address >> 24) { + case 0: + if (reg[15].I >> 24) { + if(address < 0x4000) { +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal byte read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + return biosProtected[address & 3]; + } else goto unreadable; + } + return bios[address & 0x3FFF]; + case 2: + return workRAM[address & 0x3FFFF]; + case 3: + return internalRAM[address & 0x7fff]; + case 4: + if((address < 0x4000400) && ioReadable[address & 0x3ff]) + return ioMem[address & 0x3ff]; + else goto unreadable; + case 5: + return paletteRAM[address & 0x3ff]; + case 6: + return vram[address & 0x1ffff]; + case 7: + return oam[address & 0x3ff]; + case 8: + case 9: + case 10: + case 11: + case 12: + return rom[address & 0x1FFFFFF]; + case 13: + if(cpuEEPROMEnabled) + return eepromRead(address); + goto unreadable; + case 14: + if(cpuSramEnabled | cpuFlashEnabled) + return flashRead(address); + if(cpuEEPROMSensorEnabled) { + switch(address & 0x00008f00) { + case 0x8200: + return systemGetSensorX() & 255; + case 0x8300: + return (systemGetSensorX() >> 8)|0x80; + case 0x8400: + return systemGetSensorY() & 255; + case 0x8500: + return systemGetSensorY() >> 8; + } + } + // default + default: + unreadable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_READ) { + log("Illegal byte read: %08x at %08x\n", address, armMode ? + armNextPC - 4 : armNextPC - 2); + } +#endif + + if(armState) { + return CPUReadByteQuick(reg[15].I+(address & 3)); + } else { + return CPUReadByteQuick(reg[15].I+(address & 1)); + } + // return 0xFF; + break; + } +} + +inline void CPUWriteMemory(u32 address, u32 value) +{ +#ifdef DEV_VERSION + if(address & 3) { + if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { + log("Unaliagned word write: %08x to %08x from %08x\n", + value, + address, + armMode ? armNextPC - 4 : armNextPC - 2); + } + } +#endif + + switch(address >> 24) { + case 0x02: +#ifdef SDL + if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC])) + cheatsWriteMemory((u32 *)&workRAM[address & 0x3FFFC], + value, + *((u32 *)&freezeWorkRAM[address & 0x3FFFC])); + else +#endif + WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value); + break; + case 0x03: +#ifdef SDL + if(*((u32 *)&freezeInternalRAM[address & 0x7ffc])) + cheatsWriteMemory((u32 *)&internalRAM[address & 0x7FFC], + value, + *((u32 *)&freezeInternalRAM[address & 0x7ffc])); + else +#endif + WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value); + break; + case 0x04: + CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); + CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16)); + break; + case 0x05: + WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value); + break; + case 0x06: + if(address & 0x10000) + WRITE32LE(((u32 *)&vram[address & 0x17ffc]), value); + else + WRITE32LE(((u32 *)&vram[address & 0x1fffc]), value); + break; + case 0x07: + WRITE32LE(((u32 *)&oam[address & 0x3fc]), value); + break; + case 0x0D: + if(cpuEEPROMEnabled) { + eepromWrite(address, value); + break; + } + goto unwritable; + case 0x0E: + if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) { + (*cpuSaveGameFunc)(address, (u8)value); + break; + } + // default + default: + unwritable: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_ILLEGAL_WRITE) { + log("Illegal word write: %08x to %08x from %08x\n", + value, + address, + armMode ? armNextPC - 4 : armNextPC - 2); + } +#endif + break; + } +} + +#endif //VBA_GBAinline_H diff --git a/src/Gfx.cpp b/src/Gfx.cpp new file mode 100644 index 0000000..aff031b --- /dev/null +++ b/src/Gfx.cpp @@ -0,0 +1,52 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" + +int coeff[32] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; + +// some of the rendering code in gfx.h (such as mode 0 line 1298) +// renders outside the given buffer (past 239) which corrupts other memory, +// so rather than find all places in that code that need to be fixed, +// just give it enough extra scratch space to use +#define LINE_BUFFER_OVERFLOW_LEEWAY (512-240) + +u32 line0[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 line1[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 line2[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 line3[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 lineOBJ[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 lineOBJWin[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +u32 lineMix[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +bool gfxInWin0[240+LINE_BUFFER_OVERFLOW_LEEWAY]; +bool gfxInWin1[240+LINE_BUFFER_OVERFLOW_LEEWAY]; + +int gfxBG2Changed = 0; +int gfxBG3Changed = 0; + +int gfxBG2X = 0; +int gfxBG2Y = 0; +int gfxBG2LastX = 0; +int gfxBG2LastY = 0; +int gfxBG3X = 0; +int gfxBG3Y = 0; +int gfxBG3LastX = 0; +int gfxBG3LastY = 0; +int gfxLastVCOUNT = 0; diff --git a/src/Gfx.h b/src/Gfx.h new file mode 100644 index 0000000..33a4105 --- /dev/null +++ b/src/Gfx.h @@ -0,0 +1,1579 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_GFX_H +#define VBA_GFX_H + +#include "GBA.h" +#include "Gfx.h" +#include "Globals.h" + +#include "Port.h" + +//#define SPRITE_DEBUG + +void gfxDrawTextScreen(u16, u16, u16, u32 *); +void gfxDrawRotScreen(u16, + u16, u16, + u16, u16, + u16, u16, + u16, u16, + int&, int&, + int, + u32*); +void gfxDrawRotScreen16Bit(u16, + u16, u16, + u16, u16, + u16, u16, + u16, u16, + int&, int&, + int, + u32*); +void gfxDrawRotScreen256(u16, + u16, u16, + u16, u16, + u16, u16, + u16, u16, + int&, int&, + int, + u32*); +void gfxDrawRotScreen16Bit160(u16, + u16, u16, + u16, u16, + u16, u16, + u16, u16, + int&, int&, + int, + u32*); +void gfxDrawSprites(u32 *); +void gfxIncreaseBrightness(u32 *line, int coeff); +void gfxDecreaseBrightness(u32 *line, int coeff); +void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb); + +void mode0RenderLine(); +void mode0RenderLineNoWindow(); +void mode0RenderLineAll(); + +void mode1RenderLine(); +void mode1RenderLineNoWindow(); +void mode1RenderLineAll(); + +void mode2RenderLine(); +void mode2RenderLineNoWindow(); +void mode2RenderLineAll(); + +void mode3RenderLine(); +void mode3RenderLineNoWindow(); +void mode3RenderLineAll(); + +void mode4RenderLine(); +void mode4RenderLineNoWindow(); +void mode4RenderLineAll(); + +void mode5RenderLine(); +void mode5RenderLineNoWindow(); +void mode5RenderLineAll(); + +extern int coeff[32]; +extern u32 line0[240]; +extern u32 line1[240]; +extern u32 line2[240]; +extern u32 line3[240]; +extern u32 lineOBJ[240]; +extern u32 lineOBJWin[240]; +extern u32 lineMix[240]; +extern bool gfxInWin0[240]; +extern bool gfxInWin1[240]; + +extern int gfxBG2Changed; +extern int gfxBG3Changed; + +extern int gfxBG2X; +extern int gfxBG2Y; +extern int gfxBG2LastX; +extern int gfxBG2LastY; +extern int gfxBG3X; +extern int gfxBG3Y; +extern int gfxBG3LastX; +extern int gfxBG3LastY; +extern int gfxLastVCOUNT; + +inline void gfxClearArray(u32 *array) +{ + for(int i = 0; i < 240; i++) { + *array++ = 0x80000000; + } +} + +inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, + u32 *line) +{ + u16 *palette = (u16 *)paletteRAM; + u8 *charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + u16 *screenBase = (u16 *)&vram[((control >> 8) & 0x1f) * 0x800]; + u32 prio = ((control & 3)<<25) + 0x1000000; + int sizeX = 256; + int sizeY = 256; + switch((control >> 14) & 3) { + case 0: + break; + case 1: + sizeX = 512; + break; + case 2: + sizeY = 512; + break; + case 3: + sizeX = 512; + sizeY = 512; + break; + } + + int maskX = sizeX-1; + int maskY = sizeY-1; + + bool mosaicOn = (control & 0x40) ? true : false; + + int xxx = hofs & maskX; + int yyy = (vofs + VCOUNT) & maskY; + int mosaicX = (MOSAIC & 0x000F)+1; + int mosaicY = ((MOSAIC & 0x00F0)>>4)+1; + + if(mosaicOn) { + if((VCOUNT % mosaicY) != 0) { + mosaicY = (VCOUNT / mosaicY) * mosaicY; + yyy = (vofs + mosaicY) & maskY; + } + } + + if(yyy > 255 && sizeY > 256) { + yyy &= 255; + screenBase += 0x400; + if(sizeX > 256) + screenBase += 0x400; + } + + int yshift = ((yyy>>3)<<5); + if((control) & 0x80) { + u16 *screenSource = screenBase + 0x400 * (xxx>>8) + ((xxx & 255)>>3) + yshift; + for(int x = 0; x < 240; x++) { + u16 data = READ16LE(screenSource); + + int tile = data & 0x3FF; + int tileX = (xxx & 7); + int tileY = yyy & 7; + + if(data & 0x0400) + tileX = 7 - tileX; + if(data & 0x0800) + tileY = 7 - tileY; + + u8 color = charBase[tile * 64 + tileY * 8 + tileX]; + + line[x] = color ? (READ16LE(&palette[color]) | prio): 0x80000000; + + if(data & 0x0400) { + if(tileX == 0) + screenSource++; + } else if(tileX == 7) + screenSource++; + xxx++; + if(xxx == 256) { + if(sizeX > 256) + screenSource = screenBase + 0x400 + yshift; + else { + screenSource = screenBase + yshift; + xxx = 0; + } + } else if(xxx >= sizeX) { + xxx = 0; + screenSource = screenBase + yshift; + } + } + } else { + u16 *screenSource = screenBase + 0x400*(xxx>>8)+((xxx&255)>>3) + + yshift; + for(int x = 0; x < 240; x++) { + u16 data = READ16LE(screenSource); + + int tile = data & 0x3FF; + int tileX = (xxx & 7); + int tileY = yyy & 7; + + if(data & 0x0400) + tileX = 7 - tileX; + if(data & 0x0800) + tileY = 7 - tileY; + + u8 color = charBase[(tile<<5) + (tileY<<2) + (tileX>>1)]; + + if(tileX & 1) { + color = (color >> 4); + } else { + color &= 0x0F; + } + + int pal = (READ16LE(screenSource)>>8) & 0xF0; + line[x] = color ? (READ16LE(&palette[pal + color])|prio): 0x80000000; + + if(data & 0x0400) { + if(tileX == 0) + screenSource++; + } else if(tileX == 7) + screenSource++; + xxx++; + if(xxx == 256) { + if(sizeX > 256) + screenSource = screenBase + 0x400 + yshift; + else { + screenSource = screenBase + yshift; + xxx = 0; + } + } else if(xxx >= sizeX) { + xxx = 0; + screenSource = screenBase + yshift; + } + } + } + if(mosaicOn) { + if(mosaicX > 1) { + int m = 1; + for(int i = 0; i < 239; i++) { + line[i+1] = line[i]; + m++; + if(m == mosaicX) { + m = 1; + i++; + } + } + } + } +} + +inline void gfxDrawRotScreen(u16 control, + u16 x_l, u16 x_h, + u16 y_l, u16 y_h, + u16 pa, u16 pb, + u16 pc, u16 pd, + int& currentX, int& currentY, + int changed, + u32 *line) +{ + u16 *palette = (u16 *)paletteRAM; + u8 *charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + u8 *screenBase = (u8 *)&vram[((control >> 8) & 0x1f) * 0x800]; + int prio = ((control & 3) << 25) + 0x1000000; + + int sizeX = 128; + int sizeY = 128; + switch((control >> 14) & 3) { + case 0: + break; + case 1: + sizeX = sizeY = 256; + break; + case 2: + sizeX = sizeY = 512; + break; + case 3: + sizeX = sizeY = 1024; + break; + } + + int dx = pa & 0x7FFF; + if(pa & 0x8000) + dx |= 0xFFFF8000; + int dmx = pb & 0x7FFF; + if(pb & 0x8000) + dmx |= 0xFFFF8000; + int dy = pc & 0x7FFF; + if(pc & 0x8000) + dy |= 0xFFFF8000; + int dmy = pd & 0x7FFFF; + if(pd & 0x8000) + dmy |= 0xFFFF8000; + + if(VCOUNT == 0) + changed = 3; + + if(changed & 1) { + currentX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + currentX |= 0xF8000000; + } else { + currentX += dmx; + } + + if(changed & 2) { + currentY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + currentY |= 0xF8000000; + } else { + currentY += dmy; + } + + int realX = currentX; + int realY = currentY; + + if(control & 0x40) { + int mosaicY = ((MOSAIC & 0xF0)>>4) + 1; + int y = (VCOUNT % mosaicY); + realX -= y*dmx; + realY -= y*dmy; + } + + int xxx = (realX >> 8); + int yyy = (realY >> 8); + + if(control & 0x2000) { + xxx %= sizeX; + yyy %= sizeY; + if(xxx < 0) + xxx += sizeX; + if(yyy < 0) + yyy += sizeY; + } + + if(control & 0x80) { + for(int x = 0; x < 240; x++) { + if(xxx < 0 || + yyy < 0 || + xxx >= sizeX || + yyy >= sizeY) { + line[x] = 0x80000000; + } else { + int tile = screenBase[(xxx>>3) + (yyy>>3)*(sizeX>>3)]; + + int tileX = (xxx & 7); + int tileY = yyy & 7; + + u8 color = charBase[(tile<<6) + (tileY<<3) + tileX]; + + line[x] = color ? (READ16LE(&palette[color])|prio): 0x80000000; + } + realX += dx; + realY += dy; + + xxx = (realX >> 8); + yyy = (realY >> 8); + + if(control & 0x2000) { + xxx %= sizeX; + yyy %= sizeY; + if(xxx < 0) + xxx += sizeX; + if(yyy < 0) + yyy += sizeY; + } + } + } else { + for(int x = 0; x < 240; x++) { + if(xxx < 0 || + yyy < 0 || + xxx >= sizeX || + yyy >= sizeY) { + line[x] = 0x80000000; + } else { + int tile = screenBase[(xxx>>3) + (yyy>>3)*(sizeX>>3)]; + + int tileX = (xxx & 7); + int tileY = yyy & 7; + + u8 color = charBase[(tile<<6) + (tileY<<3) + tileX]; + + line[x] = color ? (READ16LE(&palette[color])|prio): 0x80000000; + } + realX += dx; + realY += dy; + + xxx = (realX >> 8); + yyy = (realY >> 8); + + if(control & 0x2000) { + xxx %= sizeX; + yyy %= sizeY; + if(xxx < 0) + xxx += sizeX; + if(yyy < 0) + yyy += sizeY; + } + } + } + + if(control & 0x40) { + int mosaicX = (MOSAIC & 0xF) + 1; + if(mosaicX > 1) { + int m = 1; + for(int i = 0; i < 239; i++) { + line[i+1] = line[i]; + m++; + if(m == mosaicX) { + m = 1; + i++; + } + } + } + } +} + +inline void gfxDrawRotScreen16Bit(u16 control, + u16 x_l, u16 x_h, + u16 y_l, u16 y_h, + u16 pa, u16 pb, + u16 pc, u16 pd, + int& currentX, int& currentY, + int changed, + u32 *line) +{ + u16 *screenBase = (u16 *)&vram[0]; + int prio = ((control & 3) << 25) + 0x1000000; + int sizeX = 240; + int sizeY = 160; + + int startX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + startX |= 0xF8000000; + int startY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + startY |= 0xF8000000; + + int dx = pa & 0x7FFF; + if(pa & 0x8000) + dx |= 0xFFFF8000; + int dmx = pb & 0x7FFF; + if(pb & 0x8000) + dmx |= 0xFFFF8000; + int dy = pc & 0x7FFF; + if(pc & 0x8000) + dy |= 0xFFFF8000; + int dmy = pd & 0x7FFFF; + if(pd & 0x8000) + dmy |= 0xFFFF8000; + + if(VCOUNT == 0) + changed = 3; + + if(changed & 1) { + currentX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + currentX |= 0xF8000000; + } else + currentX += dmx; + + if(changed & 2) { + currentY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + currentY |= 0xF8000000; + } else { + currentY += dmy; + } + + int realX = currentX; + int realY = currentY; + + if(control & 0x40) { + int mosaicY = ((MOSAIC & 0xF0)>>4) + 1; + int y = (VCOUNT % mosaicY); + realX -= y*dmx; + realY -= y*dmy; + } + + int xxx = (realX >> 8); + int yyy = (realY >> 8); + + for(int x = 0; x < 240; x++) { + if(xxx < 0 || + yyy < 0 || + xxx >= sizeX || + yyy >= sizeY) { + line[x] = 0x80000000; + } else { + line[x] = (READ16LE(&screenBase[yyy * sizeX + xxx]) | prio); + } + realX += dx; + realY += dy; + + xxx = (realX >> 8); + yyy = (realY >> 8); + } + + if(control & 0x40) { + int mosaicX = (MOSAIC & 0xF) + 1; + if(mosaicX > 1) { + int m = 1; + for(int i = 0; i < 239; i++) { + line[i+1] = line[i]; + m++; + if(m == mosaicX) { + m = 1; + i++; + } + } + } + } +} + +inline void gfxDrawRotScreen256(u16 control, + u16 x_l, u16 x_h, + u16 y_l, u16 y_h, + u16 pa, u16 pb, + u16 pc, u16 pd, + int ¤tX, int& currentY, + int changed, + u32 *line) +{ + u16 *palette = (u16 *)paletteRAM; + u8 *screenBase = (DISPCNT & 0x0010) ? &vram[0xA000] : &vram[0x0000]; + int prio = ((control & 3) << 25) + 0x1000000; + int sizeX = 240; + int sizeY = 160; + + int startX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + startX |= 0xF8000000; + int startY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + startY |= 0xF8000000; + + int dx = pa & 0x7FFF; + if(pa & 0x8000) + dx |= 0xFFFF8000; + int dmx = pb & 0x7FFF; + if(pb & 0x8000) + dmx |= 0xFFFF8000; + int dy = pc & 0x7FFF; + if(pc & 0x8000) + dy |= 0xFFFF8000; + int dmy = pd & 0x7FFFF; + if(pd & 0x8000) + dmy |= 0xFFFF8000; + + if(VCOUNT == 0) + changed = 3; + + if(changed & 1) { + currentX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + currentX |= 0xF8000000; + } else { + currentX += dmx; + } + + if(changed & 2) { + currentY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + currentY |= 0xF8000000; + } else { + currentY += dmy; + } + + int realX = currentX; + int realY = currentY; + + if(control & 0x40) { + int mosaicY = ((MOSAIC & 0xF0)>>4) + 1; + int y = (VCOUNT / mosaicY) * mosaicY; + realX = startX + y*dmx; + realY = startY + y*dmy; + } + + int xxx = (realX >> 8); + int yyy = (realY >> 8); + + for(int x = 0; x < 240; x++) { + if(xxx < 0 || + yyy < 0 || + xxx >= sizeX || + yyy >= sizeY) { + line[x] = 0x80000000; + } else { + u8 color = screenBase[yyy * 240 + xxx]; + + line[x] = color ? (READ16LE(&palette[color])|prio): 0x80000000; + } + realX += dx; + realY += dy; + + xxx = (realX >> 8); + yyy = (realY >> 8); + } + + if(control & 0x40) { + int mosaicX = (MOSAIC & 0xF) + 1; + if(mosaicX > 1) { + int m = 1; + for(int i = 0; i < 239; i++) { + line[i+1] = line[i]; + m++; + if(m == mosaicX) { + m = 1; + i++; + } + } + } + } +} + +inline void gfxDrawRotScreen16Bit160(u16 control, + u16 x_l, u16 x_h, + u16 y_l, u16 y_h, + u16 pa, u16 pb, + u16 pc, u16 pd, + int& currentX, int& currentY, + int changed, + u32 *line) +{ + u16 *screenBase = (DISPCNT & 0x0010) ? (u16 *)&vram[0xa000] : + (u16 *)&vram[0]; + int prio = ((control & 3) << 25) + 0x1000000; + int sizeX = 160; + int sizeY = 128; + + int startX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + startX |= 0xF8000000; + int startY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + startY |= 0xF8000000; + + int dx = pa & 0x7FFF; + if(pa & 0x8000) + dx |= 0xFFFF8000; + int dmx = pb & 0x7FFF; + if(pb & 0x8000) + dmx |= 0xFFFF8000; + int dy = pc & 0x7FFF; + if(pc & 0x8000) + dy |= 0xFFFF8000; + int dmy = pd & 0x7FFFF; + if(pd & 0x8000) + dmy |= 0xFFFF8000; + + if(VCOUNT == 0) + changed = 3; + + if(changed & 1) { + currentX = (x_l) | ((x_h & 0x07FF)<<16); + if(x_h & 0x0800) + currentX |= 0xF8000000; + } else { + currentX += dmx; + } + + if(changed & 2) { + currentY = (y_l) | ((y_h & 0x07FF)<<16); + if(y_h & 0x0800) + currentY |= 0xF8000000; + } else { + currentY += dmy; + } + + int realX = currentX; + int realY = currentY; + + if(control & 0x40) { + int mosaicY = ((MOSAIC & 0xF0)>>4) + 1; + int y = (VCOUNT / mosaicY) * mosaicY; + realX = startX + y*dmx; + realY = startY + y*dmy; + } + + int xxx = (realX >> 8); + int yyy = (realY >> 8); + + for(int x = 0; x < 240; x++) { + if(xxx < 0 || + yyy < 0 || + xxx >= sizeX || + yyy >= sizeY) { + line[x] = 0x80000000; + } else { + line[x] = (READ16LE(&screenBase[yyy * sizeX + xxx]) | prio); + } + realX += dx; + realY += dy; + + xxx = (realX >> 8); + yyy = (realY >> 8); + } + + if(control & 0x40) { + int mosaicX = (MOSAIC & 0xF) + 1; + if(mosaicX > 1) { + int m = 1; + for(int i = 0; i < 239; i++) { + line[i+1] = line[i]; + m++; + if(m == mosaicX) { + m = 1; + i++; + } + } + } + } +} + +inline void gfxDrawSprites(u32 *lineOBJ) +{ + int m=0; + gfxClearArray(lineOBJ); + if(layerEnable & 0x1000) { + u16 *sprites = (u16 *)oam; + u16 *spritePalette = &((u16 *)paletteRAM)[256]; + int mosaicY = ((MOSAIC & 0xF000)>>12) + 1; + int mosaicX = ((MOSAIC & 0xF00)>>8) + 1; + for(int x = 0; x < 128 ; x++) { + u16 a0 = READ16LE(sprites++); + u16 a1 = READ16LE(sprites++); + u16 a2 = READ16LE(sprites++); + sprites++; + + // ignore OBJ-WIN + if((a0 & 0x0c00) == 0x0800) + continue; + + int sizeY = 8; + int sizeX = 8; + + switch(((a0 >>12) & 0x0c)|(a1>>14)) { + case 0: + break; + case 1: + sizeX = sizeY = 16; + break; + case 2: + sizeX = sizeY = 32; + break; + case 3: + sizeX = sizeY = 64; + break; + case 4: + sizeX = 16; + break; + case 5: + sizeX = 32; + break; + case 6: + sizeX = 32; + sizeY = 16; + break; + case 7: + sizeX = 64; + sizeY = 32; + break; + case 8: + sizeY = 16; + break; + case 9: + sizeY = 32; + break; + case 10: + sizeX = 16; + sizeY = 32; + break; + case 11: + sizeX = 32; + sizeY = 64; + break; + default: + continue; + } + +#ifdef SPRITE_DEBUG + int maskX = sizeX-1; + int maskY = sizeY-1; +#endif + + int sy = (a0 & 255); + + if(sy > 160) + sy -= 256; + + if(a0 & 0x0100) { + int fieldX = sizeX; + int fieldY = sizeY; + if(a0 & 0x0200) { + fieldX <<= 1; + fieldY <<= 1; + } + + int t = VCOUNT - sy; + if((t >= 0) && (t < fieldY)) { + int sx = (a1 & 0x1FF); + if((sx < 240) || (((sx + fieldX) & 511) < 240)) { + // int t2 = t - (fieldY >> 1); + int rot = (a1 >> 9) & 0x1F; + u16 *OAM = (u16 *)oam; + int dx = READ16LE(&OAM[3 + (rot << 4)]); + if(dx & 0x8000) + dx |= 0xFFFF8000; + int dmx = READ16LE(&OAM[7 + (rot << 4)]); + if(dmx & 0x8000) + dmx |= 0xFFFF8000; + int dy = READ16LE(&OAM[11 + (rot << 4)]); + if(dy & 0x8000) + dy |= 0xFFFF8000; + int dmy = READ16LE(&OAM[15 + (rot << 4)]); + if(dmy & 0x8000) + dmy |= 0xFFFF8000; + + if(a0 & 0x1000) { + t -= (t % mosaicY); + } + + int realX = ((sizeX) << 7) - (fieldX >> 1)*dx - (fieldY>>1)*dmx + + t * dmx; + int realY = ((sizeY) << 7) - (fieldX >> 1)*dy - (fieldY>>1)*dmy + + t * dmy; + + u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + + if(a0 & 0x2000) { + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 2; + else + c &= 0x3FE; + for(int x = 0; x < fieldX; x++) { + int xxx = realX >> 8; + int yyy = realY >> 8; + + if(xxx < 0 || xxx >= sizeX || + yyy < 0 || yyy >= sizeY || + sx >= 240); + else { + u32 color = vram[0x10000 + ((((c + (yyy>>3) * inc)<<5) + + ((yyy & 7)<<3) + ((xxx >> 3)<<6) + + (xxx & 7))&0x7FFF)]; + if ((color==0) && (((prio >> 25)&3) < + ((lineOBJ[sx]>>25)&3))) { + lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { + lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } + + if (a0 & 0x1000) { + m++; + if (m==mosaicX) + m=0; + } +#ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || x == 0 || x == maskX) + lineOBJ[sx] = 0x001F; +#endif + } + sx = (sx+1)&511;; + realX += dx; + realY += dy; + } + } else { + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 3; + int palette = (a2 >> 8) & 0xF0; + for(int x = 0; x < fieldX; x++) { + int xxx = realX >> 8; + int yyy = realY >> 8; + if(xxx < 0 || xxx >= sizeX || + yyy < 0 || yyy >= sizeY || + sx >= 240); + else { + u32 color = vram[0x10000 + ((((c + (yyy>>3) * inc)<<5) + + ((yyy & 7)<<2) + ((xxx >> 3)<<5) + + ((xxx & 7)>>1))&0x7FFF)]; + if(xxx & 1) + color >>= 4; + else + color &= 0x0F; + + if ((color==0) && (((prio >> 25)&3) < + ((lineOBJ[sx]>>25)&3))) { + lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { + lineOBJ[sx] = READ16LE(&spritePalette[palette+color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } + } + if((a0 & 0x1000) && m) { + m++; + if (m==mosaicX) + m=0; + } + +#ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || x == 0 || x == maskX) + lineOBJ[sx] = 0x001F; +#endif + sx = (sx+1)&511;; + realX += dx; + realY += dy; + + } + } + } + } + } else { + int t = VCOUNT - sy; + if((t >= 0) && (t < sizeY)) { + int sx = (a1 & 0x1FF); + if(((sx < 240)||(((sx+sizeX)&511)<240)) && !(a0 & 0x0200)) { + if(a0 & 0x2000) { + if(a1 & 0x2000) + t = sizeY - t - 1; + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) { + inc = sizeX >> 2; + } else { + c &= 0x3FE; + } + int xxx = 0; + if(a1 & 0x1000) + xxx = sizeX-1; + + if(a0 & 0x1000) { + t -= (t % mosaicY); + } + + int address = 0x10000 + ((((c+ (t>>3) * inc) << 5) + + ((t & 7) << 3) + ((xxx>>3)<<6) + (xxx & 7)) & 0x7FFF); + + if(a1 & 0x1000) + xxx = 7; + u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + + for(int xx = 0; xx < sizeX; xx++) { + if(sx < 240) { + u8 color = vram[address]; + if ((color==0) && (((prio >> 25)&3) < + ((lineOBJ[sx]>>25)&3))) { + lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { + lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } + + if (a0 & 0x1000) { + m++; + if (m==mosaicX) + m=0; + } + +#ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; +#endif + } + + sx = (sx+1) & 511; + if(a1 & 0x1000) { + xxx--; + address--; + if(xxx == -1) { + address -= 56; + xxx = 7; + } + if(address < 0x10000) + address += 0x8000; + } else { + xxx++; + address++; + if(xxx == 8) { + address += 56; + xxx = 0; + } + if(address > 0x17fff) + address -= 0x8000; + } + } + } else { + if(a1 & 0x2000) + t = sizeY - t - 1; + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) { + inc = sizeX >> 3; + } + int xxx = 0; + if(a1 & 0x1000) + xxx = sizeX - 1; + + if(a0 & 0x1000) { + t -= (t % mosaicY); + } + + int address = 0x10000 + ((((c + (t>>3) * inc)<<5) + + ((t & 7)<<2) + ((xxx>>3)<<5) + ((xxx & 7) >> 1))&0x7FFF); + u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + int palette = (a2 >> 8) & 0xF0; + if(a1 & 0x1000) { + xxx = 7; + for(int xx = sizeX - 1; xx >= 0; xx--) { + if(sx < 240) { + u8 color = vram[address]; + if(xx & 1) { + color = (color >> 4); + } else + color &= 0x0F; + + if ((color==0) && (((prio >> 25)&3) < + ((lineOBJ[sx]>>25)&3))) { + lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { + lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } + } + if (a0 & 0x1000) { + m++; + if (m==mosaicX) + m=0; + } +#ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; +#endif + sx = (sx+1) & 511; + xxx--; + if(!(xx & 1)) + address--; + if(xxx == -1) { + xxx = 7; + address -= 28; + } + if(address < 0x10000) + address += 0x8000; + } + } else { + for(int xx = 0; xx < sizeX; xx++) { + if(sx < 240) { + u8 color = vram[address]; + if(xx & 1) { + color = (color >> 4); + } else + color &= 0x0F; + + if ((color==0) && (((prio >> 25)&3) < + ((lineOBJ[sx]>>25)&3))) { + lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { + lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + + } + } + if (a0 & 0x1000) { + m++; + if (m==mosaicX) + m=0; + } +#ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; +#endif + sx = (sx+1) & 511; + xxx++; + if(xx & 1) + address++; + if(xxx == 8) { + address += 28; + xxx = 0; + } + if(address > 0x17fff) + address -= 0x8000; + } + } + } + } + } + } + } + } +} + +inline void gfxDrawOBJWin(u32 *lineOBJWin) +{ + gfxClearArray(lineOBJWin); + if(layerEnable & 0x8000) { + u16 *sprites = (u16 *)oam; + // u16 *spritePalette = &((u16 *)paletteRAM)[256]; + for(int x = 0; x < 128 ; x++) { + u16 a0 = READ16LE(sprites++); + u16 a1 = READ16LE(sprites++); + u16 a2 = READ16LE(sprites++); + sprites++; + + // ignore non OBJ-WIN + if((a0 & 0x0c00) != 0x0800) + continue; + + int sizeY = 8; + int sizeX = 8; + + switch(((a0 >>12) & 0x0c)|(a1>>14)) { + case 0: + break; + case 1: + sizeX = sizeY = 16; + break; + case 2: + sizeX = sizeY = 32; + break; + case 3: + sizeX = sizeY = 64; + break; + case 4: + sizeX = 16; + break; + case 5: + sizeX = 32; + break; + case 6: + sizeX = 32; + sizeY = 16; + break; + case 7: + sizeX = 64; + sizeY = 32; + break; + case 8: + sizeY = 16; + break; + case 9: + sizeY = 32; + break; + case 10: + sizeX = 16; + sizeY = 32; + break; + case 11: + sizeX = 32; + sizeY = 64; + break; + default: + continue; + } + + int sy = (a0 & 255); + + if(sy > 160) + sy -= 256; + + if(a0 & 0x0100) { + int fieldX = sizeX; + int fieldY = sizeY; + if(a0 & 0x0200) { + fieldX <<= 1; + fieldY <<= 1; + } + + int t = VCOUNT - sy; + if((t >= 0) && (t < fieldY)) { + int sx = (a1 & 0x1FF); + if((sx < 240) || (((sx + fieldX) & 511) < 240)) { + // int t2 = t - (fieldY >> 1); + int rot = (a1 >> 9) & 0x1F; + u16 *OAM = (u16 *)oam; + int dx = READ16LE(&OAM[3 + (rot << 4)]); + if(dx & 0x8000) + dx |= 0xFFFF8000; + int dmx = READ16LE(&OAM[7 + (rot << 4)]); + if(dmx & 0x8000) + dmx |= 0xFFFF8000; + int dy = READ16LE(&OAM[11 + (rot << 4)]); + if(dy & 0x8000) + dy |= 0xFFFF8000; + int dmy = READ16LE(&OAM[15 + (rot << 4)]); + if(dmy & 0x8000) + dmy |= 0xFFFF8000; + + int realX = ((sizeX) << 7) - (fieldX >> 1)*dx - (fieldY>>1)*dmx + + t * dmx; + int realY = ((sizeY) << 7) - (fieldX >> 1)*dy - (fieldY>>1)*dmy + + t * dmy; + + // u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + + if(a0 & 0x2000) { + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 2; + else + c &= 0x3FE; + for(int x = 0; x < fieldX; x++) { + int xxx = realX >> 8; + int yyy = realY >> 8; + + if(xxx < 0 || xxx >= sizeX || + yyy < 0 || yyy >= sizeY) { + } else { + u32 color = vram[0x10000 + ((((c + (yyy>>3) * inc)<<5) + + ((yyy & 7)<<3) + ((xxx >> 3)<<6) + + (xxx & 7))&0x7fff)]; + if(color) { + lineOBJWin[sx] = 1; + } + } + sx = (sx+1)&511;; + realX += dx; + realY += dy; + } + } else { + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 3; + // int palette = (a2 >> 8) & 0xF0; + for(int x = 0; x < fieldX; x++) { + int xxx = realX >> 8; + int yyy = realY >> 8; + + // if(x == 0 || x == (sizeX-1) || + // t == 0 || t == (sizeY-1)) { + // lineOBJ[sx] = 0x001F | prio; + // } else { + if(xxx < 0 || xxx >= sizeX || + yyy < 0 || yyy >= sizeY){ + } else { + u32 color = vram[0x10000 + ((((c + (yyy>>3) * inc)<<5) + + ((yyy & 7)<<2) + ((xxx >> 3)<<5) + + ((xxx & 7)>>1))&0x7fff)]; + if(xxx & 1) + color >>= 4; + else + color &= 0x0F; + + if(color) { + lineOBJWin[sx] = 1; + } + } + // } + sx = (sx+1)&511;; + realX += dx; + realY += dy; + } + } + } + } + } else { + int t = VCOUNT - sy; + if((t >= 0) && (t < sizeY)) { + int sx = (a1 & 0x1FF); + if(((sx < 240)||(((sx+sizeX)&511)<240)) && !(a0 & 0x0200)) { + if(a0 & 0x2000) { + if(a1 & 0x2000) + t = sizeY - t - 1; + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) { + inc = sizeX >> 2; + } else { + c &= 0x3FE; + } + int xxx = 0; + if(a1 & 0x1000) + xxx = sizeX-1; + int address = 0x10000 + ((((c+ (t>>3) * inc) << 5) + + ((t & 7) << 3) + ((xxx>>3)<<6) + (xxx & 7))&0x7fff); + if(a1 & 0x1000) + xxx = 7; + // u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + for(int xx = 0; xx < sizeX; xx++) { + if(sx < 240) { + u8 color = vram[address]; + if(color) { + lineOBJWin[sx] = 1; + } + } + + sx = (sx+1) & 511; + if(a1 & 0x1000) { + xxx--; + address--; + if(xxx == -1) { + address -= 56; + xxx = 7; + } + if(address < 0x10000) + address += 0x8000; + } else { + xxx++; + address++; + if(xxx == 8) { + address += 56; + xxx = 0; + } + if(address > 0x17fff) + address -= 0x8000; + } + } + } else { + if(a1 & 0x2000) + t = sizeY - t - 1; + int c = (a2 & 0x3FF); + if((DISPCNT & 7) > 2 && (c < 512)) + continue; + + int inc = 32; + if(DISPCNT & 0x40) { + inc = sizeX >> 3; + } + int xxx = 0; + if(a1 & 0x1000) + xxx = sizeX - 1; + int address = 0x10000 + ((((c + (t>>3) * inc)<<5) + + ((t & 7)<<2) + ((xxx>>3)<<5) + ((xxx & 7) >> 1))&0x7fff); + // u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); + // int palette = (a2 >> 8) & 0xF0; + if(a1 & 0x1000) { + xxx = 7; + for(int xx = sizeX - 1; xx >= 0; xx--) { + if(sx < 240) { + u8 color = vram[address]; + if(xx & 1) { + color = (color >> 4); + } else + color &= 0x0F; + + if(color) { + lineOBJWin[sx] = 1; + } + } + sx = (sx+1) & 511; + xxx--; + if(!(xx & 1)) + address--; + if(xxx == -1) { + xxx = 7; + address -= 28; + } + if(address < 0x10000) + address += 0x8000; + } + } else { + for(int xx = 0; xx < sizeX; xx++) { + if(sx < 240) { + u8 color = vram[address]; + if(xx & 1) { + color = (color >> 4); + } else + color &= 0x0F; + + if(color) { + lineOBJWin[sx] = 1; + } + } + sx = (sx+1) & 511; + xxx++; + if(xx & 1) + address++; + if(xxx == 8) { + address += 28; + xxx = 0; + } + if(address > 0x17fff) + address -= 0x8000; + } + } + } + } + } + } + } + } +} + +inline u32 gfxIncreaseBrightness(u32 color, int coeff) +{ + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + + r = r + (((31 - r) * coeff) >> 4); + g = g + (((31 - g) * coeff) >> 4); + b = b + (((31 - b) * coeff) >> 4); + if(r > 31) + r = 31; + if(g > 31) + g = 31; + if(b > 31) + b = 31; + color = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + return color; +} + +inline void gfxIncreaseBrightness(u32 *line, int coeff) +{ + for(int x = 0; x < 240; x++) { + u32 color = *line; + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + + r = r + (((31 - r) * coeff) >> 4); + g = g + (((31 - g) * coeff) >> 4); + b = b + (((31 - b) * coeff) >> 4); + if(r > 31) + r = 31; + if(g > 31) + g = 31; + if(b > 31) + b = 31; + *line++ = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + } +} + +inline u32 gfxDecreaseBrightness(u32 color, int coeff) +{ + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + + r = r - ((r * coeff) >> 4); + g = g - ((g * coeff) >> 4); + b = b - ((b * coeff) >> 4); + if(r < 0) + r = 0; + if(g < 0) + g = 0; + if(b < 0) + b = 0; + color = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + + return color; +} + +inline void gfxDecreaseBrightness(u32 *line, int coeff) +{ + for(int x = 0; x < 240; x++) { + u32 color = *line; + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + + r = r - ((r * coeff) >> 4); + g = g - ((g * coeff) >> 4); + b = b - ((b * coeff) >> 4); + if(r < 0) + r = 0; + if(g < 0) + g = 0; + if(b < 0) + b = 0; + *line++ = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + } +} + +inline u32 gfxAlphaBlend(u32 color, u32 color2, int ca, int cb) +{ + if(color < 0x80000000) { + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + int r0 = (color2 & 0x1F); + int g0 = ((color2 >> 5) & 0x1F); + int b0 = ((color2 >> 10) & 0x1F); + + r = ((r * ca) >> 4) + ((r0 * cb) >> 4); + g = ((g * ca) >> 4) + ((g0 * cb) >> 4); + b = ((b * ca) >> 4) + ((b0 * cb) >> 4); + + if(r > 31) + r = 31; + if(g > 31) + g = 31; + if(b > 31) + b = 31; + + return (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + } + return color; +} + +inline void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb) +{ + for(int x = 0; x < 240; x++) { + u32 color = *ta; + if(color < 0x80000000) { + int r = (color & 0x1F); + int g = ((color >> 5) & 0x1F); + int b = ((color >> 10) & 0x1F); + u32 color2 = (*tb++); + int r0 = (color2 & 0x1F); + int g0 = ((color2 >> 5) & 0x1F); + int b0 = ((color2 >> 10) & 0x1F); + + r = ((r * ca) >> 4) + ((r0 * cb) >> 4); + g = ((g * ca) >> 4) + ((g0 * cb) >> 4); + b = ((b * ca) >> 4) + ((b0 * cb) >> 4); + + if(r > 31) + r = 31; + if(g > 31) + g = 31; + if(b > 31) + b = 31; + + *ta++ = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; + } else { + ta++; + tb++; + } + } +} + +#endif // VBA_GFX_H diff --git a/src/Globals.cpp b/src/Globals.cpp new file mode 100644 index 0000000..35bd734 --- /dev/null +++ b/src/Globals.cpp @@ -0,0 +1,136 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" + +reg_pair reg[45]; +memoryMap map[256]; +bool ioReadable[0x400]; +bool N_FLAG = 0; +bool C_FLAG = 0; +bool Z_FLAG = 0; +bool V_FLAG = 0; +bool armState = true; +bool armIrqEnable = true; +u32 armNextPC = 0x00000000; +int armMode = 0x1f; +u32 stop = 0x08000568; +int saveType = 0; +bool useBios = false; +bool skipBios = false; +int frameSkip = 1; +bool speedup = false; +bool synchronize = true; +bool cpuDisableSfx = false; +bool cpuIsMultiBoot = false; +bool parseDebug = true; +int layerSettings = 0xff00; +int layerEnable = 0xff00; +bool speedHack = false; +bool memLagEnabled = false, memLagTempEnabled = false; +int cpuSaveType = 0; +bool cpuEnhancedDetection = true; +bool cheatsEnabled = true; + +u8 *bios = NULL; +u8 *rom = NULL; +u8 *internalRAM = NULL; +u8 *workRAM = NULL; +u8 *paletteRAM = NULL; +u8 *vram = NULL; +u8 *pix = NULL; +u8 *oam = NULL; +u8 *ioMem = NULL; + +u16 DISPCNT = 0x0080; +u16 DISPSTAT = 0x0000; +u16 VCOUNT = 0x0000; +u16 BG0CNT = 0x0000; +u16 BG1CNT = 0x0000; +u16 BG2CNT = 0x0000; +u16 BG3CNT = 0x0000; +u16 BG0HOFS = 0x0000; +u16 BG0VOFS = 0x0000; +u16 BG1HOFS = 0x0000; +u16 BG1VOFS = 0x0000; +u16 BG2HOFS = 0x0000; +u16 BG2VOFS = 0x0000; +u16 BG3HOFS = 0x0000; +u16 BG3VOFS = 0x0000; +u16 BG2PA = 0x0100; +u16 BG2PB = 0x0000; +u16 BG2PC = 0x0000; +u16 BG2PD = 0x0100; +u16 BG2X_L = 0x0000; +u16 BG2X_H = 0x0000; +u16 BG2Y_L = 0x0000; +u16 BG2Y_H = 0x0000; +u16 BG3PA = 0x0100; +u16 BG3PB = 0x0000; +u16 BG3PC = 0x0000; +u16 BG3PD = 0x0100; +u16 BG3X_L = 0x0000; +u16 BG3X_H = 0x0000; +u16 BG3Y_L = 0x0000; +u16 BG3Y_H = 0x0000; +u16 WIN0H = 0x0000; +u16 WIN1H = 0x0000; +u16 WIN0V = 0x0000; +u16 WIN1V = 0x0000; +u16 WININ = 0x0000; +u16 WINOUT = 0x0000; +u16 MOSAIC = 0x0000; +u16 BLDMOD = 0x0000; +u16 COLEV = 0x0000; +u16 COLY = 0x0000; +u16 DM0SAD_L = 0x0000; +u16 DM0SAD_H = 0x0000; +u16 DM0DAD_L = 0x0000; +u16 DM0DAD_H = 0x0000; +u16 DM0CNT_L = 0x0000; +u16 DM0CNT_H = 0x0000; +u16 DM1SAD_L = 0x0000; +u16 DM1SAD_H = 0x0000; +u16 DM1DAD_L = 0x0000; +u16 DM1DAD_H = 0x0000; +u16 DM1CNT_L = 0x0000; +u16 DM1CNT_H = 0x0000; +u16 DM2SAD_L = 0x0000; +u16 DM2SAD_H = 0x0000; +u16 DM2DAD_L = 0x0000; +u16 DM2DAD_H = 0x0000; +u16 DM2CNT_L = 0x0000; +u16 DM2CNT_H = 0x0000; +u16 DM3SAD_L = 0x0000; +u16 DM3SAD_H = 0x0000; +u16 DM3DAD_L = 0x0000; +u16 DM3DAD_H = 0x0000; +u16 DM3CNT_L = 0x0000; +u16 DM3CNT_H = 0x0000; +u16 TM0D = 0x0000; +u16 TM0CNT = 0x0000; +u16 TM1D = 0x0000; +u16 TM1CNT = 0x0000; +u16 TM2D = 0x0000; +u16 TM2CNT = 0x0000; +u16 TM3D = 0x0000; +u16 TM3CNT = 0x0000; +u16 P1 = 0xFFFF; +u16 IE = 0x0000; +u16 IF = 0x0000; +u16 IME = 0x0000; diff --git a/src/Globals.h b/src/Globals.h new file mode 100644 index 0000000..c35afaf --- /dev/null +++ b/src/Globals.h @@ -0,0 +1,150 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_GLOBALS_H +#define VBA_GLOBALS_H + +#define VERBOSE_SWI 1 +#define VERBOSE_UNALIGNED_MEMORY 2 +#define VERBOSE_ILLEGAL_WRITE 4 +#define VERBOSE_ILLEGAL_READ 8 +#define VERBOSE_DMA0 16 +#define VERBOSE_DMA1 32 +#define VERBOSE_DMA2 64 +#define VERBOSE_DMA3 128 +#define VERBOSE_UNDEFINED 256 +#define VERBOSE_AGBPRINT 512 + +extern reg_pair reg[45]; +extern bool ioReadable[0x400]; +extern bool N_FLAG; +extern bool C_FLAG; +extern bool Z_FLAG; +extern bool V_FLAG; +extern bool armState; +extern bool armIrqEnable; +extern u32 armNextPC; +extern int armMode; +extern u32 stop; +extern int saveType; +extern bool useBios; +extern bool skipBios; +extern int frameSkip; +extern bool speedup; +extern bool synchronize; +extern bool cpuDisableSfx; +extern bool cpuIsMultiBoot; +extern bool parseDebug; +extern int layerSettings; +extern int layerEnable; +extern bool speedHack; +extern bool memLagEnabled, memLagTempEnabled; +extern int cpuSaveType; +extern bool cpuEnhancedDetection; +extern bool cheatsEnabled; + +extern u8 *bios; +extern u8 *rom; +extern u8 *internalRAM; +extern u8 *workRAM; +extern u8 *paletteRAM; +extern u8 *vram; +extern u8 *pix; +extern u8 *oam; +extern u8 *ioMem; + +extern u16 DISPCNT; +extern u16 DISPSTAT; +extern u16 VCOUNT; +extern u16 BG0CNT; +extern u16 BG1CNT; +extern u16 BG2CNT; +extern u16 BG3CNT; +extern u16 BG0HOFS; +extern u16 BG0VOFS; +extern u16 BG1HOFS; +extern u16 BG1VOFS; +extern u16 BG2HOFS; +extern u16 BG2VOFS; +extern u16 BG3HOFS; +extern u16 BG3VOFS; +extern u16 BG2PA; +extern u16 BG2PB; +extern u16 BG2PC; +extern u16 BG2PD; +extern u16 BG2X_L; +extern u16 BG2X_H; +extern u16 BG2Y_L; +extern u16 BG2Y_H; +extern u16 BG3PA; +extern u16 BG3PB; +extern u16 BG3PC; +extern u16 BG3PD; +extern u16 BG3X_L; +extern u16 BG3X_H; +extern u16 BG3Y_L; +extern u16 BG3Y_H; +extern u16 WIN0H; +extern u16 WIN1H; +extern u16 WIN0V; +extern u16 WIN1V; +extern u16 WININ; +extern u16 WINOUT; +extern u16 MOSAIC; +extern u16 BLDMOD; +extern u16 COLEV; +extern u16 COLY; +extern u16 DM0SAD_L; +extern u16 DM0SAD_H; +extern u16 DM0DAD_L; +extern u16 DM0DAD_H; +extern u16 DM0CNT_L; +extern u16 DM0CNT_H; +extern u16 DM1SAD_L; +extern u16 DM1SAD_H; +extern u16 DM1DAD_L; +extern u16 DM1DAD_H; +extern u16 DM1CNT_L; +extern u16 DM1CNT_H; +extern u16 DM2SAD_L; +extern u16 DM2SAD_H; +extern u16 DM2DAD_L; +extern u16 DM2DAD_H; +extern u16 DM2CNT_L; +extern u16 DM2CNT_H; +extern u16 DM3SAD_L; +extern u16 DM3SAD_H; +extern u16 DM3DAD_L; +extern u16 DM3DAD_H; +extern u16 DM3CNT_L; +extern u16 DM3CNT_H; +extern u16 TM0D; +extern u16 TM0CNT; +extern u16 TM1D; +extern u16 TM1CNT; +extern u16 TM2D; +extern u16 TM2CNT; +extern u16 TM3D; +extern u16 TM3CNT; +extern u16 P1; +extern u16 IE; +extern u16 IF; +extern u16 IME; + +#endif // VBA_GLOBALS_H diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..f3a4bea --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,19 @@ +CORE_SUBDIRS = gb + +EXTRA_SUBDIRS = i386 prof sdl gtk + +SUBDIRS = $(CORE_SUBDIRS) @VBA_SRC_EXTRA@ + +DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS) + +dist_sysconf_DATA = VisualBoyAdvance.cfg + +EXTRA_DIST = \ + win32 \ + expr.l \ + expr.y \ + CheatSearch.cpp \ + CheatSearch.h + +dist-hook: + rm -rf `find $(distdir)/win32 -name CVS` diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..adf50e7 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,483 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +CORE_SUBDIRS = gb + +EXTRA_SUBDIRS = i386 prof sdl gtk + +SUBDIRS = $(CORE_SUBDIRS) @VBA_SRC_EXTRA@ + +DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS) + +dist_sysconf_DATA = VisualBoyAdvance.cfg + +EXTRA_DIST = \ + win32 \ + expr.l \ + expr.y \ + CheatSearch.cpp \ + CheatSearch.h + +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DATA = $(dist_sysconf_DATA) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = $(dist_sysconf_DATA) $(srcdir)/Makefile.in Makefile.am +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: +dist_sysconfDATA_INSTALL = $(INSTALL_DATA) +install-dist_sysconfDATA: $(dist_sysconf_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sysconfdir) + @list='$(dist_sysconf_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(dist_sysconfDATA_INSTALL) $$d$$p $(DESTDIR)$(sysconfdir)/$$f"; \ + $(dist_sysconfDATA_INSTALL) $$d$$p $(DESTDIR)$(sysconfdir)/$$f; \ + done + +uninstall-dist_sysconfDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_sysconf_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(sysconfdir)/$$f"; \ + rm -f $(DESTDIR)$(sysconfdir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(sysconfdir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-dist_sysconfDATA + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-dist_sysconfDATA uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-recursive ctags ctags-recursive distclean \ + distclean-generic distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-dist_sysconfDATA install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am \ + pdf-recursive ps ps-am ps-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-dist_sysconfDATA \ + uninstall-info-am uninstall-info-recursive uninstall-recursive + + +dist-hook: + rm -rf `find $(distdir)/win32 -name CVS` +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Mode0.cpp b/src/Mode0.cpp new file mode 100644 index 0000000..5d30d7f --- /dev/null +++ b/src/Mode0.cpp @@ -0,0 +1,552 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Globals.h" +#include "Gfx.h" + +void mode0RenderLine() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + return; + } + + if(layerEnable & 0x0100) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + if(layerEnable & 0x0200) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if(layerEnable & 0x0400) { + gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); + } + + if(layerEnable & 0x0800) { + gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line0[x] < color) { + color = line0[x]; + top = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(color >> 24)) { + color = line1[x]; + top = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(color >> 24)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(color >> 24)) { + color = line3[x]; + top = 0x08; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line0[x]>>24) < (u8)(back >> 24)) { + back = line0[x]; + top2 = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(back >> 24)) { + back = line1[x]; + top2 = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(back >> 24)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } +} + +void mode0RenderLineNoWindow() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + return; + } + + if(layerEnable & 0x0100) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + if(layerEnable & 0x0200) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if(layerEnable & 0x0400) { + gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); + } + + if(layerEnable & 0x0800) { + gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + int effect = (BLDMOD >> 6) & 3; + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line0[x] < color) { + color = line0[x]; + top = 0x01; + } + + if(line1[x] < (color & 0xFF000000)) { + color = line1[x]; + top = 0x02; + } + + if(line2[x] < (color & 0xFF000000)) { + color = line2[x]; + top = 0x04; + } + + if(line3[x] < (color & 0xFF000000)) { + color = line3[x]; + top = 0x08; + } + + if(lineOBJ[x] < (color & 0xFF000000)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch(effect) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + if(line0[x] < back) { + if(top != 0x01) { + back = line0[x]; + top2 = 0x01; + } + } + + if(line1[x] < (back & 0xFF000000)) { + if(top != 0x02) { + back = line1[x]; + top2 = 0x02; + } + } + + if(line2[x] < (back & 0xFF000000)) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if(line3[x] < (back & 0xFF000000)) { + if(top != 0x08) { + back = line3[x]; + top2 = 0x08; + } + } + + if(lineOBJ[x] < (back & 0xFF000000)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if(line0[x] < back) { + back = line0[x]; + top2 = 0x01; + } + + if(line1[x] < (back & 0xFF000000)) { + back = line1[x]; + top2 = 0x02; + } + + if(line2[x] < (back & 0xFF000000)) { + back = line2[x]; + top2 = 0x04; + } + + if(line3[x] < (back & 0xFF000000)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } +} + +void mode0RenderLineAll() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + return; + } + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + if((layerEnable & 0x0100)) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + if((layerEnable & 0x0200)) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if((layerEnable & 0x0400)) { + gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); + } + + if((layerEnable & 0x0800)) { + gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if((mask & 1) && (line0[x] < color)) { + color = line0[x]; + top = 0x01; + } + + if((mask & 2) && ((u8)(line1[x]>>24) < (u8)(color >> 24))) { + color = line1[x]; + top = 0x02; + } + + if((mask & 4) && ((u8)(line2[x]>>24) < (u8)(color >> 24))) { + color = line2[x]; + top = 0x04; + } + + if((mask & 8) && ((u8)(line3[x]>>24) < (u8)(color >> 24))) { + color = line3[x]; + top = 0x08; + } + + if((mask & 16) && ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24))) { + color = lineOBJ[x]; + top = 0x10; + } + + // special FX on in the window + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + if((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24)) { + if(top != 0x01) { + back = line0[x]; + top2 = 0x01; + } + } + + if((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24)) { + if(top != 0x02) { + back = line1[x]; + top2 = 0x02; + } + } + + if((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24)) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 8) && (u8)(line3[x]>>24) < (u8)(back >> 24)) { + if(top != 0x08) { + back = line3[x]; + top2 = 0x08; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 1) && ((u8)(line0[x]>>24) < (u8)(back >> 24))) { + back = line0[x]; + top2 = 0x01; + } + + if((mask & 2) && ((u8)(line1[x]>>24) < (u8)(back >> 24))) { + back = line1[x]; + top2 = 0x02; + } + + if((mask & 4) && ((u8)(line2[x]>>24) < (u8)(back >> 24))) { + back = line2[x]; + top2 = 0x04; + } + + if((mask & 8) && ((u8)(line3[x]>>24) < (u8)(back >> 24))) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 1) && ((u8)(line0[x]>>24) < (u8)(back >> 24))) { + back = line0[x]; + top2 = 0x01; + } + + if((mask & 2) && ((u8)(line1[x]>>24) < (u8)(back >> 24))) { + back = line1[x]; + top2 = 0x02; + } + + if((mask & 4) && ((u8)(line2[x]>>24) < (u8)(back >> 24))) { + back = line2[x]; + top2 = 0x04; + } + + if((mask & 8) && ((u8)(line3[x]>>24) < (u8)(back >> 24))) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } +} diff --git a/src/Mode1.cpp b/src/Mode1.cpp new file mode 100644 index 0000000..0349158 --- /dev/null +++ b/src/Mode1.cpp @@ -0,0 +1,513 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Globals.h" +#include "Gfx.h" + +void mode1RenderLine() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0100) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + if(layerEnable & 0x0200) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, line2); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line0[x] < color) { + color = line0[x]; + top = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(color >> 24)) { + color = line1[x]; + top = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(color >> 24)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line0[x]>>24) < (u8)(back >> 24)) { + back = line0[x]; + top2 = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(back >> 24)) { + back = line1[x]; + top2 = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode1RenderLineNoWindow() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0100) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + + if(layerEnable & 0x0200) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, line2); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line0[x] < color) { + color = line0[x]; + top = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(color >> 24)) { + color = line1[x]; + top = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(color >> 24)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + if((u8)(line0[x]>>24) < (u8)(back >> 24)) { + if(top != 0x01) { + back = line0[x]; + top2 = 0x01; + } + } + + if((u8)(line1[x]>>24) < (u8)(back >> 24)) { + if(top != 0x02) { + back = line1[x]; + top2 = 0x02; + } + } + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line0[x]>>24) < (u8)(back >> 24)) { + back = line0[x]; + top2 = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(back >> 24)) { + back = line1[x]; + top2 = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode1RenderLineAll() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + if(layerEnable & 0x0100) { + gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); + } + + if(layerEnable & 0x0200) { + gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, line2); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if(line0[x] < color && (mask & 1)) { + color = line0[x]; + top = 0x01; + } + + if((u8)(line1[x]>>24) < (u8)(color >> 24) && (mask & 2)) { + color = line1[x]; + top = 0x02; + } + + if((u8)(line2[x]>>24) < (u8)(color >> 24) && (mask & 4)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24) && (mask & 16)) { + color = lineOBJ[x]; + top = 0x10; + } + + // special FX on the window + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + if((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24)) { + if(top != 0x01) { + back = line0[x]; + top2 = 0x01; + } + } + + if((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24)) { + if(top != 0x02) { + back = line1[x]; + top2 = 0x02; + } + } + + if((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24)) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24)) { + back = line0[x]; + top2 = 0x01; + } + + if((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24)) { + back = line1[x]; + top2 = 0x02; + } + + if((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24)) { + back = line0[x]; + top2 = 0x01; + } + + if((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24)) { + back = line1[x]; + top2 = 0x02; + } + + if((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} diff --git a/src/Mode2.cpp b/src/Mode2.cpp new file mode 100644 index 0000000..462f2b0 --- /dev/null +++ b/src/Mode2.cpp @@ -0,0 +1,478 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Globals.h" +#include "Gfx.h" + +void mode2RenderLine() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y, + changed, line2); + } + + if(layerEnable & 0x0800) { + int changed = gfxBG3Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H, + BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y, + changed, line3); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + + if((u8)(line2[x]>>24) < (u8)(color >> 24)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(color >> 24)) { + color = line3[x]; + top = 0x08; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(back >> 24)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxBG3Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode2RenderLineNoWindow() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y, + changed, line2); + } + + if(layerEnable & 0x0800) { + int changed = gfxBG3Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H, + BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y, + changed, line3); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + + if((u8)(line2[x]>>24) < (u8)(color >> 24)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(color >> 24)) { + color = line3[x]; + top = 0x08; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((u8)(line3[x]>>24) < (u8)(back >> 24)) { + if(top != 0x08) { + back = line3[x]; + top2 = 0x08; + } + } + + if((u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((u8)(line2[x]>>24) < (u8)(back >> 24)) { + back = line2[x]; + top2 = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(back >> 24)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxBG3Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode2RenderLineAll() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y, + changed, line2); + } + + if(layerEnable & 0x0800) { + int changed = gfxBG3Changed; + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen(BG3CNT, BG3X_L, BG3X_H, BG3Y_L, BG3Y_H, + BG3PA, BG3PB, BG3PC, BG3PD, gfxBG3X, gfxBG3Y, + changed, line3); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if(line2[x] < color && (mask & 4)) { + color = line2[x]; + top = 0x04; + } + + if((u8)(line3[x]>>24) < (u8)(color >> 24) && (mask & 8)) { + color = line3[x]; + top = 0x08; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24) && (mask & 16)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 8) && (u8)(line3[x]>>24) < (u8)(back >> 24)) { + if(top != 0x08) { + back = line3[x]; + top2 = 0x08; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if((mask & 8) && (u8)(line3[x]>>24) < (u8)(back >> 24)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if((mask & 8) && (u8)(line3[x]>>24) < (u8)(back >> 24)) { + back = line3[x]; + top2 = 0x08; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxBG3Changed = 0; + gfxLastVCOUNT = VCOUNT; +} diff --git a/src/Mode3.cpp b/src/Mode3.cpp new file mode 100644 index 0000000..8a87308 --- /dev/null +++ b/src/Mode3.cpp @@ -0,0 +1,405 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Globals.h" +#include "Gfx.h" + +void mode3RenderLine() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 background = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >>24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode3RenderLineNoWindow() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 background = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >>24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode3RenderLineAll() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x80) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + u32 background = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if((mask & 4) && (line2[x] < color)) { + color = line2[x]; + top = 0x04; + } + + if((mask & 16) && ((u8)(lineOBJ[x]>>24) < (u8)(color >>24))) { + color = lineOBJ[x]; + top = 0x10; + } + + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} diff --git a/src/Mode4.cpp b/src/Mode4.cpp new file mode 100644 index 0000000..8e81523 --- /dev/null +++ b/src/Mode4.cpp @@ -0,0 +1,402 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Gfx.h" +#include "Globals.h" + +void mode4RenderLine() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode4RenderLineNoWindow() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + if(layerEnable & 0x400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + + if(line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode4RenderLineAll() +{ + u16 *palette = (u16 *)paletteRAM; + + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + if(layerEnable & 0x400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, + BG2PA, BG2PB, BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + for(int x = 0; x < 240; x++) { + u32 color = backdrop; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if((mask & 4) && (line2[x] < color)) { + color = line2[x]; + top = 0x04; + } + + if((mask & 16) && ((u8)(lineOBJ[x]>>24) < (u8)(color >>24))) { + color = lineOBJ[x]; + top = 0x10; + } + + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = backdrop; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} diff --git a/src/Mode5.cpp b/src/Mode5.cpp new file mode 100644 index 0000000..d3e9710 --- /dev/null +++ b/src/Mode5.cpp @@ -0,0 +1,405 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Globals.h" +#include "Gfx.h" + +void mode5RenderLine() +{ + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + u16 *palette = (u16 *)paletteRAM; + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 background = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >>24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if((top & 0x10) && (color & 0x00010000)) { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode5RenderLineNoWindow() +{ + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + u16 *palette = (u16 *)paletteRAM; + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + + u32 background = ( READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + + if(line2[x] < color) { + color = line2[x]; + top = 0x04; + } + + if((u8)(lineOBJ[x]>>24) < (u8)(color >>24)) { + color = lineOBJ[x]; + top = 0x10; + } + + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if(line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} + +void mode5RenderLineAll() +{ + if(DISPCNT & 0x0080) { + for(int x = 0; x < 240; x++) { + lineMix[x] = 0x7fff; + } + gfxLastVCOUNT = VCOUNT; + return; + } + + u16 *palette = (u16 *)paletteRAM; + + if(layerEnable & 0x0400) { + int changed = gfxBG2Changed; + + if(gfxLastVCOUNT > VCOUNT) + changed = 3; + + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, + BG2Y_L, BG2Y_H, BG2PA, BG2PB, + BG2PC, BG2PD, + gfxBG2X, gfxBG2Y, changed, + line2); + } + + gfxDrawSprites(lineOBJ); + gfxDrawOBJWin(lineOBJWin); + + bool inWindow0 = false; + bool inWindow1 = false; + + if(layerEnable & 0x2000) { + u8 v0 = WIN0V >> 8; + u8 v1 = WIN0V & 255; + inWindow0 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1); + } + if(layerEnable & 0x4000) { + u8 v0 = WIN1V >> 8; + u8 v1 = WIN1V & 255; + inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + if(v1 >= v0) + inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1); + else + inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1); + } + + u8 inWin0Mask = WININ & 0xFF; + u8 inWin1Mask = WININ >> 8; + u8 outMask = WINOUT & 0xFF; + + u32 background = (READ16LE(&palette[0]) | 0x30000000); + + for(int x = 0; x < 240; x++) { + u32 color = background; + u8 top = 0x20; + u8 mask = outMask; + + if(!(lineOBJWin[x] & 0x80000000)) { + mask = WINOUT >> 8; + } + + if(inWindow1) { + if(gfxInWin1[x]) + mask = inWin1Mask; + } + + if(inWindow0) { + if(gfxInWin0[x]) { + mask = inWin0Mask; + } + } + + if((mask & 4) && (line2[x] < color)) { + color = line2[x]; + top = 0x04; + } + + if((mask & 16) && ((u8)(lineOBJ[x]>>24) < (u8)(color >>24))) { + color = lineOBJ[x]; + top = 0x10; + } + + if(mask & 32) { + if(!(color & 0x00010000)) { + switch((BLDMOD >> 6) & 3) { + case 0: + break; + case 1: + { + if(top & BLDMOD) { + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + if(top != 0x04) { + back = line2[x]; + top2 = 0x04; + } + } + + if((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24)) { + if(top != 0x10) { + back = lineOBJ[x]; + top2 = 0x10; + } + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + + } + } + break; + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } else { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + } else if(color & 0x00010000) { + // semi-transparent OBJ + u32 back = background; + u8 top2 = 0x20; + + if((mask & 4) && line2[x] < back) { + back = line2[x]; + top2 = 0x04; + } + + if(top2 & (BLDMOD>>8)) + color = gfxAlphaBlend(color, back, + coeff[COLEV & 0x1F], + coeff[(COLEV >> 8) & 0x1F]); + else { + switch((BLDMOD >> 6) & 3) { + case 2: + if(BLDMOD & top) + color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]); + break; + case 3: + if(BLDMOD & top) + color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); + break; + } + } + } + + lineMix[x] = color; + } + gfxBG2Changed = 0; + gfxLastVCOUNT = VCOUNT; +} diff --git a/src/NLS.h b/src/NLS.h new file mode 100644 index 0000000..ca024de --- /dev/null +++ b/src/NLS.h @@ -0,0 +1,62 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#define N_(String) (String) + +#define MSG_UNSUPPORTED_VBA_SGM 1 +#define MSG_CANNOT_LOAD_SGM 2 +#define MSG_SAVE_GAME_NOT_USING_BIOS 3 +#define MSG_SAVE_GAME_USING_BIOS 4 +#define MSG_UNSUPPORTED_SAVE_TYPE 5 +#define MSG_CANNOT_OPEN_FILE 6 +#define MSG_BAD_ZIP_FILE 7 +#define MSG_NO_IMAGE_ON_ZIP 8 +#define MSG_ERROR_OPENING_IMAGE 9 +#define MSG_ERROR_READING_IMAGE 10 +#define MSG_UNSUPPORTED_BIOS_FUNCTION 11 +#define MSG_INVALID_BIOS_FILE_SIZE 12 +#define MSG_INVALID_CHEAT_CODE 13 +#define MSG_UNKNOWN_ARM_OPCODE 14 +#define MSG_UNKNOWN_THUMB_OPCODE 15 +#define MSG_ERROR_CREATING_FILE 16 +#define MSG_FAILED_TO_READ_SGM 17 +#define MSG_FAILED_TO_READ_RTC 18 +#define MSG_UNSUPPORTED_VB_SGM 19 +#define MSG_CANNOT_LOAD_SGM_FOR 20 +#define MSG_ERROR_OPENING_IMAGE_FROM 21 +#define MSG_ERROR_READING_IMAGE_FROM 22 +#define MSG_UNSUPPORTED_ROM_SIZE 23 +#define MSG_UNSUPPORTED_RAM_SIZE 24 +#define MSG_UNKNOWN_CARTRIDGE_TYPE 25 +#define MSG_MAXIMUM_NUMBER_OF_CHEATS 26 +#define MSG_INVALID_GAMESHARK_CODE 27 +#define MSG_INVALID_GAMEGENIE_CODE 28 +#define MSG_INVALID_CHEAT_TO_REMOVE 29 +#define MSG_INVALID_CHEAT_CODE_ADDRESS 30 +#define MSG_UNSUPPORTED_CHEAT_LIST_VERSION 31 +#define MSG_UNSUPPORTED_CHEAT_LIST_TYPE 32 +#define MSG_INVALID_GSA_CODE 33 +#define MSG_CANNOT_IMPORT_SNAPSHOT_FOR 34 +#define MSG_UNSUPPORTED_SNAPSHOT_FILE 35 +#define MSG_UNSUPPORTED_ARM_MODE 36 +#define MSG_UNSUPPORTED_CODE_FILE 37 +#define MSG_GBA_CODE_WARNING 38 +#define MSG_INVALID_CBA_CODE 39 +#define MSG_CBA_CODE_WARNING 40 +#define MSG_OUT_OF_MEMORY 41 diff --git a/src/Port.h b/src/Port.h new file mode 100644 index 0000000..3716bf9 --- /dev/null +++ b/src/Port.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_PORT_H +#define VBA_PORT_H + +// swaps a 16-bit value +static inline u16 swap16(u16 v) +{ + return (v<<8)|(v>>8); +} + +// swaps a 32-bit value +static inline u32 swap32(u32 v) +{ + return (v<<24)|((v<<8)&0xff0000)|((v>>8)&0xff00)|(v>>24); +} + +#ifdef WORDS_BIGENDIAN +#if defined(__GNUC__) && defined(__ppc__) + +#define READ16LE(base) \ + ({ unsigned short lhbrxResult; \ + __asm__ ("lhbrx %0, 0, %1" : "=r" (lhbrxResult) : "r" (base) : "memory"); \ + lhbrxResult; }) + +#define READ32LE(base) \ + ({ unsigned long lwbrxResult; \ + __asm__ ("lwbrx %0, 0, %1" : "=r" (lwbrxResult) : "r" (base) : "memory"); \ + lwbrxResult; }) + +#define WRITE16LE(base, value) \ + __asm__ ("sthbrx %0, 0, %1" : : "r" (value), "r" (base) : "memory") + +#define WRITE32LE(base, value) \ + __asm__ ("stwbrx %0, 0, %1" : : "r" (value), "r" (base) : "memory") + +#else +#define READ16LE(x) \ + swap16(*((u16 *)(x))) +#define READ32LE(x) \ + swap32(*((u32 *)(x))) +#define WRITE16LE(x,v) \ + *((u16 *)x) = swap16((v)) +#define WRITE32LE(x,v) \ + *((u32 *)x) = swap32((v)) +#endif +#else +#define READ16LE(x) \ + *((u16 *)x) +#define READ32LE(x) \ + *((u32 *)x) +#define WRITE16LE(x,v) \ + *((u16 *)x) = (v) +#define WRITE32LE(x,v) \ + *((u32 *)x) = (v) +#endif + +#endif diff --git a/src/RTC.cpp b/src/RTC.cpp new file mode 100644 index 0000000..72b57d8 --- /dev/null +++ b/src/RTC.cpp @@ -0,0 +1,237 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" +#include "GBA.h" +#include "Globals.h" +#include "Port.h" +#include "Util.h" +#include "NLS.h" +#include "movie.h" + +#include +#include + +enum RTCSTATE { IDLE, COMMAND, DATA, READDATA }; + +typedef struct { + u8 byte0; + u8 byte1; + u8 byte2; + u8 command; + int dataLen; + int bits; + RTCSTATE state; + u8 data[12]; + // reserved variables for future + u8 reserved[12]; + bool reserved2; + u32 reserved3; +} RTCCLOCKDATA; + +static RTCCLOCKDATA rtcClockData; +static bool rtcEnabled = false; + +void rtcEnable(bool e) +{ + rtcEnabled = e; +} + +bool rtcIsEnabled() +{ + return rtcEnabled; +} + +u16 rtcRead(u32 address) +{ + if(rtcEnabled) { + if(address == 0x80000c8) + return rtcClockData.byte2; + else if(address == 0x80000c6) + return rtcClockData.byte1; + else if(address == 0x80000c4) { + return rtcClockData.byte0; + } + } + + return READ16LE((&rom[address & 0x1FFFFFE])); +} + +static u8 toBCD(u8 value) +{ + value = value % 100; + int l = value % 10; + int h = value / 10; + return h * 16 + l; +} + +bool rtcWrite(u32 address, u16 value) +{ + if(!rtcEnabled) + return false; + + if(address == 0x80000c8) { + rtcClockData.byte2 = (u8)value; // enable ? + } else if(address == 0x80000c6) { + rtcClockData.byte1 = (u8)value; // read/write + } else if(address == 0x80000c4) { + if(rtcClockData.byte2 & 1) { + if(rtcClockData.state == IDLE && rtcClockData.byte0 == 1 && value == 5) { + rtcClockData.state = COMMAND; + rtcClockData.bits = 0; + rtcClockData.command = 0; + } else if(!(rtcClockData.byte0 & 1) && (value & 1)) { // bit transfer + rtcClockData.byte0 = (u8)value; + switch(rtcClockData.state) { + case COMMAND: + rtcClockData.command |= ((value & 2) >> 1) << (7-rtcClockData.bits); + rtcClockData.bits++; + if(rtcClockData.bits == 8) { + rtcClockData.bits = 0; + switch(rtcClockData.command) { + case 0x60: + // not sure what this command does but it doesn't take parameters + // maybe it is a reset or stop + rtcClockData.state = IDLE; + rtcClockData.bits = 0; + break; + case 0x62: + // this sets the control state but not sure what those values are + rtcClockData.state = READDATA; + rtcClockData.dataLen = 1; + break; + case 0x63: + rtcClockData.dataLen = 1; + rtcClockData.data[0] = 0x40; + rtcClockData.state = DATA; + break; + case 0x65: + { + struct tm *newtime; + time_t long_time; + + if(VBAMovieActive() || VBAMovieLoading()) + { + long_time = VBAMovieGetId() + VBAMovieGetFrameCounter()/60; + newtime = gmtime( &long_time ); + } + else + { + time( &long_time ); /* Get time as long integer. */ + newtime = localtime( &long_time ); /* Convert to local time. */ + } + + rtcClockData.dataLen = 7; + rtcClockData.data[0] = toBCD(newtime->tm_year); + rtcClockData.data[1] = toBCD(newtime->tm_mon+1); + rtcClockData.data[2] = toBCD(newtime->tm_mday); + rtcClockData.data[3] = 0; + rtcClockData.data[4] = toBCD(newtime->tm_hour); + rtcClockData.data[5] = toBCD(newtime->tm_min); + rtcClockData.data[6] = toBCD(newtime->tm_sec); + rtcClockData.state = DATA; + } + break; + case 0x67: + { + struct tm *newtime; + time_t long_time; + + if(VBAMovieActive() || VBAMovieLoading()) + { + long_time = VBAMovieGetId() + VBAMovieGetFrameCounter()/60; + newtime = gmtime( &long_time ); + } + else + { + time( &long_time ); /* Get time as long integer. */ + newtime = localtime( &long_time ); /* Convert to local time. */ + } + + rtcClockData.dataLen = 3; + rtcClockData.data[0] = toBCD(newtime->tm_hour); + rtcClockData.data[1] = toBCD(newtime->tm_min); + rtcClockData.data[2] = toBCD(newtime->tm_sec); + rtcClockData.state = DATA; + } + break; + default: + systemMessage(0, N_("Unknown RTC command %02x"), rtcClockData.command); + rtcClockData.state = IDLE; + break; + } + } + break; + case DATA: + if(rtcClockData.byte1 & 2) { + } else { + rtcClockData.byte0 = (rtcClockData.byte0 & ~2) | + ((rtcClockData.data[rtcClockData.bits >> 3] >> + (rtcClockData.bits & 7)) & 1)*2; + rtcClockData.bits++; + if(rtcClockData.bits == 8*rtcClockData.dataLen) { + rtcClockData.bits = 0; + rtcClockData.state = IDLE; + } + } + break; + case READDATA: + if(!(rtcClockData.byte1 & 2)) { + } else { + rtcClockData.data[rtcClockData.bits >> 3] = + (rtcClockData.data[rtcClockData.bits >> 3] >> 1) | + ((value << 6) & 128); + rtcClockData.bits++; + if(rtcClockData.bits == 8*rtcClockData.dataLen) { + rtcClockData.bits = 0; + rtcClockData.state = IDLE; + } + } + break; + default: + break; + } + } else + rtcClockData.byte0 = (u8)value; + } + } + return true; +} + +void rtcReset() +{ + memset(&rtcClockData, 0, sizeof(rtcClockData)); + + rtcClockData.byte0 = 0; + rtcClockData.byte1 = 0; + rtcClockData.byte2 = 0; + rtcClockData.command = 0; + rtcClockData.dataLen = 0; + rtcClockData.bits = 0; + rtcClockData.state = IDLE; +} + +void rtcSaveGame(gzFile gzFile) +{ + utilGzWrite(gzFile, &rtcClockData, sizeof(rtcClockData)); +} + +void rtcReadGame(gzFile gzFile) +{ + utilGzRead(gzFile, &rtcClockData, sizeof(rtcClockData)); +} diff --git a/src/RTC.h b/src/RTC.h new file mode 100644 index 0000000..acbd3f6 --- /dev/null +++ b/src/RTC.h @@ -0,0 +1,31 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_RTC_H +#define VBA_RTC_H +extern u16 rtcRead(u32 address); +extern bool rtcWrite(u32 address, u16 value); +extern void rtcEnable(bool); +extern bool rtcIsEnabled(); +extern void rtcReset(); + +extern void rtcReadGame(gzFile gzFile); +extern void rtcSaveGame(gzFile gzFile); + +#endif diff --git a/src/Sound.cpp b/src/Sound.cpp new file mode 100644 index 0000000..5368575 --- /dev/null +++ b/src/Sound.cpp @@ -0,0 +1,1348 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if (defined(WIN32) && !defined(SDL)) +# include "win32/stdafx.h" +# include "win32/VBA.h" +#endif + +#include + +#include "GBA.h" +#include "Globals.h" +#include "Sound.h" +#include "Util.h" + +#define USE_TICKS_AS 380 +#define SOUND_MAGIC 0x60000000 +#define SOUND_MAGIC_2 0x30000000 +#define NOISE_MAGIC 5 + +extern bool stopState; + +u8 soundWavePattern[4][32] = { + {0x01,0x01,0x01,0x01, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff}, + {0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff}, + {0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff}, + {0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01, + 0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff} +}; + +int soundFreqRatio[8] = { + 1048576, // 0 + 524288, // 1 + 262144, // 2 + 174763, // 3 + 131072, // 4 + 104858, // 5 + 87381, // 6 + 74898 // 7 +}; + +int soundShiftClock[16]= { + 2, // 0 + 4, // 1 + 8, // 2 + 16, // 3 + 32, // 4 + 64, // 5 + 128, // 6 + 256, // 7 + 512, // 8 + 1024, // 9 + 2048, // 10 + 4096, // 11 + 8192, // 12 + 16384, // 13 + 1, // 14 + 1 // 15 +}; + +int soundVolume = 0; + +u8 soundBuffer[6][735]; +u16 soundFinalWave[1470]; + +int soundBufferLen = 1470; +int soundBufferTotalLen = 14700; +int soundQuality = 2; +int soundPaused = 1; +int soundPlay = 0; +int soundTicks = soundQuality * USE_TICKS_AS; +int SOUND_CLOCK_TICKS = soundQuality * USE_TICKS_AS; +u32 soundNextPosition = 0; + +int soundLevel1 = 0; +int soundLevel2 = 0; +int soundBalance = 0; +int soundMasterOn = 0; +int soundIndex = 0; +int soundBufferIndex = 0; +int soundDebug = 0; +bool soundOffFlag = false; + +int sound1On = 0; +int sound1ATL = 0; +int sound1Skip = 0; +int sound1Index = 0; +int sound1Continue = 0; +int sound1EnvelopeVolume = 0; +int sound1EnvelopeATL = 0; +int sound1EnvelopeUpDown = 0; +int sound1EnvelopeATLReload = 0; +int sound1SweepATL = 0; +int sound1SweepATLReload = 0; +int sound1SweepSteps = 0; +int sound1SweepUpDown = 0; +int sound1SweepStep = 0; +u8 *sound1Wave = soundWavePattern[2]; + +int sound2On = 0; +int sound2ATL = 0; +int sound2Skip = 0; +int sound2Index = 0; +int sound2Continue = 0; +int sound2EnvelopeVolume = 0; +int sound2EnvelopeATL = 0; +int sound2EnvelopeUpDown = 0; +int sound2EnvelopeATLReload = 0; +u8 *sound2Wave = soundWavePattern[2]; + +int sound3On = 0; +int sound3ATL = 0; +int sound3Skip = 0; +int sound3Index = 0; +int sound3Continue = 0; +int sound3OutputLevel = 0; +int sound3Last = 0; +u8 sound3WaveRam[0x20]; +int sound3Bank = 0; +int sound3DataSize = 0; +int sound3ForcedOutput = 0; + +int sound4On = 0; +int sound4Clock = 0; +int sound4ATL = 0; +int sound4Skip = 0; +int sound4Index = 0; +int sound4ShiftRight = 0x7f; +int sound4ShiftSkip = 0; +int sound4ShiftIndex = 0; +int sound4NSteps = 0; +int sound4CountDown = 0; +int sound4Continue = 0; +int sound4EnvelopeVolume = 0; +int sound4EnvelopeATL = 0; +int sound4EnvelopeUpDown = 0; +int sound4EnvelopeATLReload = 0; + +int soundControl = 0; + +int soundDSFifoAIndex = 0; +int soundDSFifoACount = 0; +int soundDSFifoAWriteIndex = 0; +bool soundDSAEnabled = false; +int soundDSATimer = 0; +u8 soundDSFifoA[32]; +u8 soundDSAValue = 0; + +int soundDSFifoBIndex = 0; +int soundDSFifoBCount = 0; +int soundDSFifoBWriteIndex = 0; +bool soundDSBEnabled = false; +int soundDSBTimer = 0; +u8 soundDSFifoB[32]; +u8 soundDSBValue = 0; + +int soundEnableFlag = 0x3ff; + +s16 soundFilter[4000]; +s16 soundRight[5] = { 0, 0, 0, 0, 0 }; +s16 soundLeft[5] = { 0, 0, 0, 0, 0 }; +int soundEchoIndex = 0; +bool soundEcho = false; +bool soundLowPass = false; +bool soundReverse = false; + +variable_desc soundSaveStruct[] = { + { &soundPaused, sizeof(int) }, + { &soundPlay, sizeof(int) }, + { &soundTicks, sizeof(int) }, + { &SOUND_CLOCK_TICKS, sizeof(int) }, + { &soundLevel1, sizeof(int) }, + { &soundLevel2, sizeof(int) }, + { &soundBalance, sizeof(int) }, + { &soundMasterOn, sizeof(int) }, + { &soundIndex, sizeof(int) }, + { &sound1On, sizeof(int) }, + { &sound1ATL, sizeof(int) }, + { &sound1Skip, sizeof(int) }, + { &sound1Index, sizeof(int) }, + { &sound1Continue, sizeof(int) }, + { &sound1EnvelopeVolume, sizeof(int) }, + { &sound1EnvelopeATL, sizeof(int) }, + { &sound1EnvelopeATLReload, sizeof(int) }, + { &sound1EnvelopeUpDown, sizeof(int) }, + { &sound1SweepATL, sizeof(int) }, + { &sound1SweepATLReload, sizeof(int) }, + { &sound1SweepSteps, sizeof(int) }, + { &sound1SweepUpDown, sizeof(int) }, + { &sound1SweepStep, sizeof(int) }, + { &sound2On, sizeof(int) }, + { &sound2ATL, sizeof(int) }, + { &sound2Skip, sizeof(int) }, + { &sound2Index, sizeof(int) }, + { &sound2Continue, sizeof(int) }, + { &sound2EnvelopeVolume, sizeof(int) }, + { &sound2EnvelopeATL, sizeof(int) }, + { &sound2EnvelopeATLReload, sizeof(int) }, + { &sound2EnvelopeUpDown, sizeof(int) }, + { &sound3On, sizeof(int) }, + { &sound3ATL, sizeof(int) }, + { &sound3Skip, sizeof(int) }, + { &sound3Index, sizeof(int) }, + { &sound3Continue, sizeof(int) }, + { &sound3OutputLevel, sizeof(int) }, + { &sound4On, sizeof(int) }, + { &sound4ATL, sizeof(int) }, + { &sound4Skip, sizeof(int) }, + { &sound4Index, sizeof(int) }, + { &sound4Clock, sizeof(int) }, + { &sound4ShiftRight, sizeof(int) }, + { &sound4ShiftSkip, sizeof(int) }, + { &sound4ShiftIndex, sizeof(int) }, + { &sound4NSteps, sizeof(int) }, + { &sound4CountDown, sizeof(int) }, + { &sound4Continue, sizeof(int) }, + { &sound4EnvelopeVolume, sizeof(int) }, + { &sound4EnvelopeATL, sizeof(int) }, + { &sound4EnvelopeATLReload, sizeof(int) }, + { &sound4EnvelopeUpDown, sizeof(int) }, + { &soundEnableFlag, sizeof(int) }, + { &soundControl, sizeof(int) }, + { &soundDSFifoAIndex, sizeof(int) }, + { &soundDSFifoACount, sizeof(int) }, + { &soundDSFifoAWriteIndex, sizeof(int) }, + { &soundDSAEnabled, sizeof(bool) }, + { &soundDSATimer, sizeof(int) }, + { &soundDSFifoA[0], 32 }, + { &soundDSAValue, sizeof(u8) }, + { &soundDSFifoBIndex, sizeof(int) }, + { &soundDSFifoBCount, sizeof(int) }, + { &soundDSFifoBWriteIndex, sizeof(int) }, + { &soundDSBEnabled, sizeof(int) }, + { &soundDSBTimer, sizeof(int) }, + { &soundDSFifoB[0], 32 }, + { &soundDSBValue, sizeof(int) }, + { &soundBuffer[0][0], 6*735 }, + { &soundFinalWave[0], 2*735 }, + { NULL, 0 } +}; + +variable_desc soundSaveStructV2[] = { + { &sound3WaveRam[0], 0x20 }, + { &sound3Bank, sizeof(int) }, + { &sound3DataSize, sizeof(int) }, + { &sound3ForcedOutput, sizeof(int) }, + { NULL, 0 } +}; + +void soundEvent(u32 address, u8 data) +{ + int freq = 0; + + switch(address) { + case NR10: + data &= 0x7f; + sound1SweepATL = sound1SweepATLReload = 344 * ((data >> 4) & 7); + sound1SweepSteps = data & 7; + sound1SweepUpDown = data & 0x08; + sound1SweepStep = 0; + ioMem[address] = data; + break; + case NR11: + sound1Wave = soundWavePattern[data >> 6]; + sound1ATL = 172 * (64 - (data & 0x3f)); + ioMem[address] = data; + break; + case NR12: + sound1EnvelopeUpDown = data & 0x08; + sound1EnvelopeATLReload = 689 * (data & 7); + if((data & 0xF8) == 0) + sound1EnvelopeVolume = 0; + ioMem[address] = data; + break; + case NR13: + freq = (((int)(ioMem[NR14] & 7)) << 8) | data; + sound1ATL = 172 * (64 - (ioMem[NR11] & 0x3f)); + freq = 2048 - freq; + if(freq) { + sound1Skip = SOUND_MAGIC / freq; + } else + sound1Skip = 0; + ioMem[address] = data; + break; + case NR14: + data &= 0xC7; + freq = (((int)(data&7) << 8) | ioMem[NR13]); + freq = 2048 - freq; + sound1ATL = 172 * (64 - (ioMem[NR11] & 0x3f)); + sound1Continue = data & 0x40; + if(freq) { + sound1Skip = SOUND_MAGIC / freq; + } else + sound1Skip = 0; + if(data & 0x80) { + ioMem[NR52] |= 1; + sound1EnvelopeVolume = ioMem[NR12] >> 4; + sound1EnvelopeUpDown = ioMem[NR12] & 0x08; + sound1ATL = 172 * (64 - (ioMem[NR11] & 0x3f)); + sound1EnvelopeATLReload = sound1EnvelopeATL = 689 * (ioMem[NR12] & 7); + sound1SweepATL = sound1SweepATLReload = 344 * ((ioMem[NR10] >> 4) & 7); + sound1SweepSteps = ioMem[NR10] & 7; + sound1SweepUpDown = ioMem[NR10] & 0x08; + sound1SweepStep = 0; + + sound1Index = 0; + sound1On = 1; + } + ioMem[address] = data; + break; + case NR21: + sound2Wave = soundWavePattern[data >> 6]; + sound2ATL = 172 * (64 - (data & 0x3f)); + ioMem[address] = data; + break; + case NR22: + sound2EnvelopeUpDown = data & 0x08; + sound2EnvelopeATLReload = 689 * (data & 7); + if((data & 0xF8) == 0) + sound2EnvelopeVolume = 0; + ioMem[address] = data; + break; + case NR23: + freq = (((int)(ioMem[NR24] & 7)) << 8) | data; + sound2ATL = 172 * (64 - (ioMem[NR21] & 0x3f)); + freq = 2048 - freq; + if(freq) { + sound2Skip = SOUND_MAGIC / freq; + } else + sound2Skip = 0; + ioMem[address] = data; + break; + case NR24: + data &= 0xC7; + freq = (((int)(data&7) << 8) | ioMem[NR23]); + freq = 2048 - freq; + sound2ATL = 172 * (64 - (ioMem[NR21] & 0x3f)); + sound2Continue = data & 0x40; + if(freq) { + sound2Skip = SOUND_MAGIC / freq; + } else + sound2Skip = 0; + if(data & 0x80) { + ioMem[NR52] |= 2; + sound2EnvelopeVolume = ioMem[NR22] >> 4; + sound2EnvelopeUpDown = ioMem[NR22] & 0x08; + sound2ATL = 172 * (64 - (ioMem[NR21] & 0x3f)); + sound2EnvelopeATLReload = sound2EnvelopeATL = 689 * (ioMem[NR22] & 7); + + sound2Index = 0; + sound2On = 1; + } + break; + ioMem[address] = data; + case NR30: + data &= 0xe0; + if(!(data & 0x80)) { + ioMem[NR52] &= 0xfb; + sound3On = 0; + } + if(((data >> 6) & 1) != sound3Bank) + memcpy(&ioMem[0x90], &sound3WaveRam[(((data >> 6) & 1) * 0x10)^0x10], + 0x10); + sound3Bank = (data >> 6) & 1; + sound3DataSize = (data >> 5) & 1; + ioMem[address] = data; + break; + case NR31: + sound3ATL = 172 * (256-data); + ioMem[address] = data; + break; + case NR32: + data &= 0xe0; + sound3OutputLevel = (data >> 5) & 3; + sound3ForcedOutput = (data >> 7) & 1; + ioMem[address] = data; + break; + case NR33: + freq = 2048 - (((int)(ioMem[NR34]&7) << 8) | data); + if(freq) { + sound3Skip = SOUND_MAGIC_2 / freq; + } else + sound3Skip = 0; + ioMem[address] = data; + break; + case NR34: + data &= 0xc7; + freq = 2048 - (((data &7) << 8) | (int)ioMem[NR33]); + if(freq) { + sound3Skip = SOUND_MAGIC_2 / freq; + } else { + sound3Skip = 0; + } + sound3Continue = data & 0x40; + if((data & 0x80) && (ioMem[NR30] & 0x80)) { + ioMem[NR52] |= 4; + sound3ATL = 172 * (256 - ioMem[NR31]); + sound3Index = 0; + sound3On = 1; + } + ioMem[address] = data; + break; + case NR41: + data &= 0x3f; + sound4ATL = 172 * (64 - (data & 0x3f)); + ioMem[address] = data; + break; + case NR42: + sound4EnvelopeUpDown = data & 0x08; + sound4EnvelopeATLReload = 689 * (data & 7); + if((data & 0xF8) == 0) + sound4EnvelopeVolume = 0; + ioMem[address] = data; + break; + case NR43: + freq = soundFreqRatio[data & 7]; + sound4NSteps = data & 0x08; + + sound4Skip = (freq << 8) / NOISE_MAGIC; + + sound4Clock = data >> 4; + + freq = freq / soundShiftClock[sound4Clock]; + + sound4ShiftSkip = (freq << 8) / NOISE_MAGIC; + ioMem[address] = data; + break; + case NR44: + data &= 0xc0; + sound4Continue = data & 0x40; + if(data & 0x80) { + ioMem[NR52] |= 8; + sound4EnvelopeVolume = ioMem[NR42] >> 4; + sound4EnvelopeUpDown = ioMem[NR42] & 0x08; + sound4ATL = 172 * (64 - (ioMem[NR41] & 0x3f)); + sound4EnvelopeATLReload = sound4EnvelopeATL = 689 * (ioMem[NR42] & 7); + + sound4On = 1; + + sound4Index = 0; + sound4ShiftIndex = 0; + + freq = soundFreqRatio[ioMem[NR43] & 7]; + + sound4Skip = (freq << 8) / NOISE_MAGIC; + + sound4NSteps = ioMem[NR43] & 0x08; + + freq = freq / soundShiftClock[ioMem[NR43] >> 4]; + + sound4ShiftSkip = (freq << 8) / NOISE_MAGIC; + if(sound4NSteps) + sound4ShiftRight = 0x7fff; + else + sound4ShiftRight = 0x7f; + } + ioMem[address] = data; + break; + case NR50: + data &= 0x77; + soundLevel1 = data & 7; + soundLevel2 = (data >> 4) & 7; + ioMem[address] = data; + break; + case NR51: + soundBalance = (data & soundEnableFlag); + ioMem[address] = data; + break; + case NR52: + data &= 0x80; + data |= ioMem[NR52] & 15; + soundMasterOn = data & 0x80; + if(!(data & 0x80)) { + sound1On = 0; + sound2On = 0; + sound3On = 0; + sound4On = 0; + } + ioMem[address] = data; + break; + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + case 0x98: + case 0x99: + case 0x9a: + case 0x9b: + case 0x9c: + case 0x9d: + case 0x9e: + case 0x9f: + sound3WaveRam[(sound3Bank*0x10)^0x10+(address&15)] = data; + break; + } +} + +void soundEvent(u32 address, u16 data) +{ + switch(address) { + case SGCNT0_H: + data &= 0xFF0F; + soundControl = data & 0x770F;; + if(data & 0x0800) { + soundDSFifoAWriteIndex = 0; + soundDSFifoAIndex = 0; + soundDSFifoACount = 0; + soundDSAValue = 0; + memset(soundDSFifoA, 0, 32); + } + soundDSAEnabled = (data & 0x0300) ? true : false; + soundDSATimer = (data & 0x0400) ? 1 : 0; + if(data & 0x8000) { + soundDSFifoBWriteIndex = 0; + soundDSFifoBIndex = 0; + soundDSFifoBCount = 0; + soundDSBValue = 0; + memset(soundDSFifoB, 0, 32); + } + soundDSBEnabled = (data & 0x3000) ? true : false; + soundDSBTimer = (data & 0x4000) ? 1 : 0; + *((u16 *)&ioMem[address]) = data; + break; + case FIFOA_L: + case FIFOA_H: + soundDSFifoA[soundDSFifoAWriteIndex++] = data & 0xFF; + soundDSFifoA[soundDSFifoAWriteIndex++] = data >> 8; + soundDSFifoACount += 2; + soundDSFifoAWriteIndex &= 31; + *((u16 *)&ioMem[address]) = data; + break; + case FIFOB_L: + case FIFOB_H: + soundDSFifoB[soundDSFifoBWriteIndex++] = data & 0xFF; + soundDSFifoB[soundDSFifoBWriteIndex++] = data >> 8; + soundDSFifoBCount += 2; + soundDSFifoBWriteIndex &= 31; + *((u16 *)&ioMem[address]) = data; + break; + case 0x88: + data &= 0xC3FF; + *((u16 *)&ioMem[address]) = data; + break; + case 0x90: + case 0x92: + case 0x94: + case 0x96: + case 0x98: + case 0x9a: + case 0x9c: + case 0x9e: + *((u16 *)&sound3WaveRam[(sound3Bank*0x10)^0x10+(address&14)]) = data; + *((u16 *)&ioMem[address]) = data; + break; + } +} + +void soundChannel1() +{ + int vol = sound1EnvelopeVolume; + + int freq = 0; + int value = 0; + + if(sound1On && (sound1ATL || !sound1Continue)) { + sound1Index += soundQuality*sound1Skip; + sound1Index &= 0x1fffffff; + + value = ((s8)sound1Wave[sound1Index>>24]) * vol; + } + + soundBuffer[0][soundIndex] = value; + + + if(sound1On) { + if(sound1ATL) { + sound1ATL-=soundQuality; + + if(sound1ATL <=0 && sound1Continue) { + ioMem[NR52] &= 0xfe; + sound1On = 0; + } + } + + if(sound1EnvelopeATL) { + sound1EnvelopeATL-=soundQuality; + + if(sound1EnvelopeATL<=0) { + if(sound1EnvelopeUpDown) { + if(sound1EnvelopeVolume < 15) + sound1EnvelopeVolume++; + } else { + if(sound1EnvelopeVolume) + sound1EnvelopeVolume--; + } + + sound1EnvelopeATL += sound1EnvelopeATLReload; + } + } + + if(sound1SweepATL) { + sound1SweepATL-=soundQuality; + + if(sound1SweepATL<=0) { + freq = (((int)(ioMem[NR14]&7) << 8) | ioMem[NR13]); + + int updown = 1; + + if(sound1SweepUpDown) + updown = -1; + + int newfreq = 0; + if(sound1SweepSteps) { + newfreq = freq + updown * freq / (1 << sound1SweepSteps); + if(newfreq == freq) + newfreq = 0; + } else + newfreq = freq; + + if(newfreq < 0) { + sound1SweepATL += sound1SweepATLReload; + } else if(newfreq > 2047) { + sound1SweepATL = 0; + sound1On = 0; + ioMem[NR52] &= 0xfe; + } else { + sound1SweepATL += sound1SweepATLReload; + sound1Skip = SOUND_MAGIC/(2048 - newfreq); + + ioMem[NR13] = newfreq & 0xff; + ioMem[NR14] = (ioMem[NR14] & 0xf8) |((newfreq >> 8) & 7); + } + } + } + } +} + +void soundChannel2() +{ + // int freq = 0; + int vol = sound2EnvelopeVolume; + + int value = 0; + + if(sound2On && (sound2ATL || !sound2Continue)) { + sound2Index += soundQuality*sound2Skip; + sound2Index &= 0x1fffffff; + + value = ((s8)sound2Wave[sound2Index>>24]) * vol; + } + + soundBuffer[1][soundIndex] = value; + + if(sound2On) { + if(sound2ATL) { + sound2ATL-=soundQuality; + + if(sound2ATL <= 0 && sound2Continue) { + ioMem[NR52] &= 0xfd; + sound2On = 0; + } + } + + if(sound2EnvelopeATL) { + sound2EnvelopeATL-=soundQuality; + + if(sound2EnvelopeATL <= 0) { + if(sound2EnvelopeUpDown) { + if(sound2EnvelopeVolume < 15) + sound2EnvelopeVolume++; + } else { + if(sound2EnvelopeVolume) + sound2EnvelopeVolume--; + } + sound2EnvelopeATL += sound2EnvelopeATLReload; + } + } + } +} + +void soundChannel3() +{ + int value = sound3Last; + + if(sound3On && (sound3ATL || !sound3Continue)) { + sound3Index += soundQuality*sound3Skip; + if(sound3DataSize) { + sound3Index &= 0x3fffffff; + value = sound3WaveRam[sound3Index>>25]; + } else { + sound3Index &= 0x1fffffff; + value = sound3WaveRam[sound3Bank*0x10 + (sound3Index>>25)]; + } + + if( (sound3Index & 0x01000000)) { + value &= 0x0f; + } else { + value >>= 4; + } + + value -= 8; + value *= 2; + + if(sound3ForcedOutput) { + value = ((value >> 1) + value) >> 1; + } else { + switch(sound3OutputLevel) { + case 0: + value = 0; + break; + case 1: + break; + case 2: + value = (value >> 1); + break; + case 3: + value = (value >> 2); + break; + } + } + sound3Last = value; + } + + soundBuffer[2][soundIndex] = value; + + if(sound3On) { + if(sound3ATL) { + sound3ATL-=soundQuality; + + if(sound3ATL <= 0 && sound3Continue) { + ioMem[NR52] &= 0xfb; + sound3On = 0; + } + } + } +} + +void soundChannel4() +{ + int vol = sound4EnvelopeVolume; + + int value = 0; + + if(sound4Clock <= 0x0c) { + if(sound4On && (sound4ATL || !sound4Continue)) { + sound4Index += soundQuality*sound4Skip; + sound4ShiftIndex += soundQuality*sound4ShiftSkip; + + if(sound4NSteps) { + while(sound4ShiftIndex > 0x1fffff) { + sound4ShiftRight = (((sound4ShiftRight << 6) ^ + (sound4ShiftRight << 5)) & 0x40) | + (sound4ShiftRight >> 1); + sound4ShiftIndex -= 0x200000; + } + } else { + while(sound4ShiftIndex > 0x1fffff) { + sound4ShiftRight = (((sound4ShiftRight << 14) ^ + (sound4ShiftRight << 13)) & 0x4000) | + (sound4ShiftRight >> 1); + + sound4ShiftIndex -= 0x200000; + } + } + + sound4Index &= 0x1fffff; + sound4ShiftIndex &= 0x1fffff; + + value = ((sound4ShiftRight & 1)*2-1) * vol; + } else { + value = 0; + } + } + + soundBuffer[3][soundIndex] = value; + + if(sound4On) { + if(sound4ATL) { + sound4ATL-=soundQuality; + + if(sound4ATL <= 0 && sound4Continue) { + ioMem[NR52] &= 0xfd; + sound4On = 0; + } + } + + if(sound4EnvelopeATL) { + sound4EnvelopeATL-=soundQuality; + + if(sound4EnvelopeATL <= 0) { + if(sound4EnvelopeUpDown) { + if(sound4EnvelopeVolume < 15) + sound4EnvelopeVolume++; + } else { + if(sound4EnvelopeVolume) + sound4EnvelopeVolume--; + } + sound4EnvelopeATL += sound4EnvelopeATLReload; + } + } + } +} + +void soundDirectSoundA() +{ + soundBuffer[4][soundIndex] = soundDSAValue; +} + +void soundDirectSoundATimer() +{ + if(soundDSAEnabled) { + if(soundDSFifoACount <= 16) { + CPUCheckDMA(3, 2); + if(soundDSFifoACount <= 16) { + soundEvent(FIFOA_L, (u16)0); + soundEvent(FIFOA_H, (u16)0); + soundEvent(FIFOA_L, (u16)0); + soundEvent(FIFOA_H, (u16)0); + soundEvent(FIFOA_L, (u16)0); + soundEvent(FIFOA_H, (u16)0); + soundEvent(FIFOA_L, (u16)0); + soundEvent(FIFOA_H, (u16)0); + } + } + + soundDSAValue = (soundDSFifoA[soundDSFifoAIndex]); + soundDSFifoAIndex = (++soundDSFifoAIndex) & 31; + soundDSFifoACount--; + } else + soundDSAValue = 0; +} + +void soundDirectSoundB() +{ + soundBuffer[5][soundIndex] = soundDSBValue; +} + +void soundDirectSoundBTimer() +{ + if(soundDSBEnabled) { + if(soundDSFifoBCount <= 16) { + CPUCheckDMA(3, 4); + if(soundDSFifoBCount <= 16) { + soundEvent(FIFOB_L, (u16)0); + soundEvent(FIFOB_H, (u16)0); + soundEvent(FIFOB_L, (u16)0); + soundEvent(FIFOB_H, (u16)0); + soundEvent(FIFOB_L, (u16)0); + soundEvent(FIFOB_H, (u16)0); + soundEvent(FIFOB_L, (u16)0); + soundEvent(FIFOB_H, (u16)0); + } + } + + soundDSBValue = (soundDSFifoB[soundDSFifoBIndex]); + soundDSFifoBIndex = (++soundDSFifoBIndex) & 31; + soundDSFifoBCount--; + } else { + soundDSBValue = 0; + } +} + +void soundTimerOverflow(int timer) +{ + if(soundDSAEnabled && (soundDSATimer == timer)) { + soundDirectSoundATimer(); + } + if(soundDSBEnabled && (soundDSBTimer == timer)) { + soundDirectSoundBTimer(); + } +} + +#ifndef max +#define max(a,b) (a)<(b)?(b):(a) +#endif + +void soundMix() +{ + int res = 0; + int cgbRes = 0; + int ratio = ioMem[0x82] & 3; + int dsaRatio = ioMem[0x82] & 4; + int dsbRatio = ioMem[0x82] & 8; + + if(soundBalance & 16) { + cgbRes = ((s8)soundBuffer[0][soundIndex]); + } + if(soundBalance & 32) { + cgbRes += ((s8)soundBuffer[1][soundIndex]); + } + if(soundBalance & 64) { + cgbRes += ((s8)soundBuffer[2][soundIndex]); + } + if(soundBalance & 128) { + cgbRes += ((s8)soundBuffer[3][soundIndex]); + } + + if((soundControl & 0x0200) && (soundEnableFlag & 0x100)){ + if(!dsaRatio) + res = ((s8)soundBuffer[4][soundIndex])>>1; + else + res = ((s8)soundBuffer[4][soundIndex]); + } + + if((soundControl & 0x2000) && (soundEnableFlag & 0x200)){ + if(!dsbRatio) + res += ((s8)soundBuffer[5][soundIndex])>>1; + else + res += ((s8)soundBuffer[5][soundIndex]); + } + + res = (res * 170); + cgbRes = (cgbRes * 52 * soundLevel1); + + switch(ratio) { + case 0: + case 3: // prohibited, but 25% + cgbRes >>= 2; + break; + case 1: + cgbRes >>= 1; + break; + case 2: + break; + } + + res += cgbRes; + + if(soundEcho) { + res *= 2; + res += soundFilter[soundEchoIndex]; + res /= 2; + soundFilter[soundEchoIndex++] = res; + } + + if(soundLowPass) { + soundLeft[4] = soundLeft[3]; + soundLeft[3] = soundLeft[2]; + soundLeft[2] = soundLeft[1]; + soundLeft[1] = soundLeft[0]; + soundLeft[0] = res; + res = (soundLeft[4] + 2*soundLeft[3] + 8*soundLeft[2] + 2*soundLeft[1] + + soundLeft[0])/14; + } + + switch(soundVolume) { + case 0: + case 1: + case 2: + case 3: + res *= (soundVolume+1); + break; + case 4: + res >>= 2; + break; + case 5: + res >>= 1; + break; + } + + if(res > 32767) + res = 32767; + if(res < -32768) + res = -32768; + + if(soundReverse) + soundFinalWave[++soundBufferIndex] = res; + else + soundFinalWave[soundBufferIndex++] = res; + + res = 0; + cgbRes = 0; + + if(soundBalance & 1) { + cgbRes = ((s8)soundBuffer[0][soundIndex]); + } + if(soundBalance & 2) { + cgbRes += ((s8)soundBuffer[1][soundIndex]); + } + if(soundBalance & 4) { + cgbRes += ((s8)soundBuffer[2][soundIndex]); + } + if(soundBalance & 8) { + cgbRes += ((s8)soundBuffer[3][soundIndex]); + } + + if((soundControl & 0x0100) && (soundEnableFlag & 0x100)){ + if(!dsaRatio) + res = ((s8)soundBuffer[4][soundIndex])>>1; + else + res = ((s8)soundBuffer[4][soundIndex]); + } + + if((soundControl & 0x1000) && (soundEnableFlag & 0x200)){ + if(!dsbRatio) + res += ((s8)soundBuffer[5][soundIndex])>>1; + else + res += ((s8)soundBuffer[5][soundIndex]); + } + + res = (res * 170); + cgbRes = (cgbRes * 52 * soundLevel1); + + switch(ratio) { + case 0: + case 3: // prohibited, but 25% + cgbRes >>= 2; + break; + case 1: + cgbRes >>= 1; + break; + case 2: + break; + } + + res += cgbRes; + + if(soundEcho) { + res *= 2; + res += soundFilter[soundEchoIndex]; + res /= 2; + soundFilter[soundEchoIndex++] = res; + + if(soundEchoIndex >= 4000) + soundEchoIndex = 0; + } + + if(soundLowPass) { + soundRight[4] = soundRight[3]; + soundRight[3] = soundRight[2]; + soundRight[2] = soundRight[1]; + soundRight[1] = soundRight[0]; + soundRight[0] = res; + res = (soundRight[4] + 2*soundRight[3] + 8*soundRight[2] + 2*soundRight[1] + + soundRight[0])/14; + } + + switch(soundVolume) { + case 0: + case 1: + case 2: + case 3: + res *= (soundVolume+1); + break; + case 4: + res >>= 2; + break; + case 5: + res >>= 1; + break; + } + + if(res > 32767) + res = 32767; + if(res < -32768) + res = -32768; + + if(soundReverse) + soundFinalWave[-1+soundBufferIndex++] = res; + else + soundFinalWave[soundBufferIndex++] = res; +} + +void soundTick() +{ + if(systemSoundOn) { + if(soundMasterOn && !stopState +#if (defined(WIN32) && !defined(SDL)) + && !theApp.frameAdvanceMuteNow +#endif + ) { + soundChannel1(); + soundChannel2(); + soundChannel3(); + soundChannel4(); + soundDirectSoundA(); + soundDirectSoundB(); + soundMix(); + } else { + soundFinalWave[soundBufferIndex++] = 0; + soundFinalWave[soundBufferIndex++] = 0; + } + + soundIndex++; + + if(2*soundBufferIndex >= soundBufferLen) { + if(systemSoundOn) { + if(soundPaused) { + soundResume(); + } + + systemWriteDataToSoundBuffer(); + } + soundIndex = 0; + soundBufferIndex = 0; + } + } +} + +void soundShutdown() +{ + systemSoundShutdown(); +} + +void soundPause() +{ + systemSoundPause(); + soundPaused = 1; +} + +void soundResume() +{ + systemSoundResume(); + soundPaused = 0; +} + +void soundEnable(int channels) +{ + int c = channels & 0x0f; + + soundEnableFlag |= ((channels & 0x30f) |c | (c << 4)); + extern u8 *gbMemory; + if(ioMem) + soundBalance = (ioMem[NR51] & soundEnableFlag); + else if(gbMemory) + soundBalance = (gbMemory[0xff25] & soundEnableFlag); +} + +void soundDisable(int channels) +{ + int c = channels & 0x0f; + + soundEnableFlag &= (~((channels & 0x30f)|c|(c<<4))); + extern u8 *gbMemory; + if(ioMem) + soundBalance = (ioMem[NR51] & soundEnableFlag); + else if(gbMemory) + soundBalance = (gbMemory[0xff25] & soundEnableFlag); +} + +int soundGetEnable() +{ + return (soundEnableFlag & 0x30f); +} + +void soundReset() +{ + systemSoundReset(); + + soundPaused = 1; + soundPlay = 0; + SOUND_CLOCK_TICKS = soundQuality * USE_TICKS_AS; + soundTicks = SOUND_CLOCK_TICKS; + soundNextPosition = 0; + soundMasterOn = 1; + soundIndex = 0; + soundBufferIndex = 0; + soundLevel1 = 7; + soundLevel2 = 7; + + sound1On = 0; + sound1ATL = 0; + sound1Skip = 0; + sound1Index = 0; + sound1Continue = 0; + sound1EnvelopeVolume = 0; + sound1EnvelopeATL = 0; + sound1EnvelopeUpDown = 0; + sound1EnvelopeATLReload = 0; + sound1SweepATL = 0; + sound1SweepATLReload = 0; + sound1SweepSteps = 0; + sound1SweepUpDown = 0; + sound1SweepStep = 0; + sound1Wave = soundWavePattern[2]; + + sound2On = 0; + sound2ATL = 0; + sound2Skip = 0; + sound2Index = 0; + sound2Continue = 0; + sound2EnvelopeVolume = 0; + sound2EnvelopeATL = 0; + sound2EnvelopeUpDown = 0; + sound2EnvelopeATLReload = 0; + sound2Wave = soundWavePattern[2]; + + sound3On = 0; + sound3ATL = 0; + sound3Skip = 0; + sound3Index = 0; + sound3Continue = 0; + sound3OutputLevel = 0; + sound3Last = 0; + sound3Bank = 0; + sound3DataSize = 0; + sound3ForcedOutput = 0; + + sound4On = 0; + sound4Clock = 0; + sound4ATL = 0; + sound4Skip = 0; + sound4Index = 0; + sound4ShiftRight = 0x7f; + sound4NSteps = 0; + sound4CountDown = 0; + sound4Continue = 0; + sound4EnvelopeVolume = 0; + sound4EnvelopeATL = 0; + sound4EnvelopeUpDown = 0; + sound4EnvelopeATLReload = 0; + + sound1On = 0; + sound2On = 0; + sound3On = 0; + sound4On = 0; + + int addr = 0x90; + + while(addr < 0xA0) { + ioMem[addr++] = 0x00; + ioMem[addr++] = 0xff; + } + + addr = 0; + while(addr < 0x20) { + sound3WaveRam[addr++] = 0x00; + sound3WaveRam[addr++] = 0xff; + } + + memset(soundFinalWave, 0, soundBufferLen); + + memset(soundFilter, 0, sizeof(soundFilter)); + soundEchoIndex = 0; +} + +bool soundInit() +{ + if(systemSoundInit()) { + memset(soundBuffer[0], 0, 735*2); + memset(soundBuffer[1], 0, 735*2); + memset(soundBuffer[2], 0, 735*2); + memset(soundBuffer[3], 0, 735*2); + + memset(soundFinalWave, 0, soundBufferLen); + + soundPaused = true; + return true; + } + return false; +} + +void soundSetQuality(int quality) +{ + if(soundQuality != quality && systemCanChangeSoundQuality()) { + if(!soundOffFlag) + soundShutdown(); + soundQuality = quality; + soundNextPosition = 0; + if(!soundOffFlag) + soundInit(); + SOUND_CLOCK_TICKS = USE_TICKS_AS * soundQuality; + soundIndex = 0; + soundBufferIndex = 0; + } else if(soundQuality != quality) { + soundNextPosition = 0; + SOUND_CLOCK_TICKS = USE_TICKS_AS * soundQuality; + soundIndex = 0; + soundBufferIndex = 0; + } +} + +void soundSaveGame(gzFile gzFile) +{ + utilWriteData(gzFile, soundSaveStruct); + utilWriteData(gzFile, soundSaveStructV2); + + utilGzWrite(gzFile, &soundQuality, sizeof(int)); +} + +void soundReadGame(gzFile gzFile, int version) +{ + utilReadData(gzFile, soundSaveStruct); + if(version >= SAVE_GAME_VERSION_3) { + utilReadData(gzFile, soundSaveStructV2); + } else { + sound3Bank = (ioMem[NR30] >> 6) & 1; + sound3DataSize = (ioMem[NR30] >> 5) & 1; + sound3ForcedOutput = (ioMem[NR32] >> 7) & 1; + // nothing better to do here... + memcpy(&sound3WaveRam[0x00], &ioMem[0x90], 0x10); + memcpy(&sound3WaveRam[0x10], &ioMem[0x90], 0x10); + } + soundBufferIndex = soundIndex * 2; + + int quality = 1; + utilGzRead(gzFile, &quality, sizeof(int)); + soundSetQuality(quality); + + sound1Wave = soundWavePattern[ioMem[NR11] >> 6]; + sound2Wave = soundWavePattern[ioMem[NR21] >> 6]; +} diff --git a/src/Sound.h b/src/Sound.h new file mode 100644 index 0000000..4e1dac7 --- /dev/null +++ b/src/Sound.h @@ -0,0 +1,82 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_SOUND_H +#define VBA_SOUND_H + +#define NR10 0x60 +#define NR11 0x62 +#define NR12 0x63 +#define NR13 0x64 +#define NR14 0x65 +#define NR21 0x68 +#define NR22 0x69 +#define NR23 0x6c +#define NR24 0x6d +#define NR30 0x70 +#define NR31 0x72 +#define NR32 0x73 +#define NR33 0x74 +#define NR34 0x75 +#define NR41 0x78 +#define NR42 0x79 +#define NR43 0x7c +#define NR44 0x7d +#define NR50 0x80 +#define NR51 0x81 +#define NR52 0x84 +#define SGCNT0_H 0x82 +#define FIFOA_L 0xa0 +#define FIFOA_H 0xa2 +#define FIFOB_L 0xa4 +#define FIFOB_H 0xa6 + +extern void soundTick(); +extern void soundShutdown(); +extern bool soundInit(); +extern void soundPause(); +extern void soundResume(); +extern void soundEnable(int); +extern void soundDisable(int); +extern int soundGetEnable(); +extern void soundReset(); +extern void soundSaveGame(gzFile); +extern void soundReadGame(gzFile, int); +extern void soundEvent(u32, u8); +extern void soundEvent(u32, u16); +extern void soundTimerOverflow(int); +extern void soundSetQuality(int); + +//extern int SOUND_TICKS; +extern int SOUND_CLOCK_TICKS; +extern int soundTicks; +extern int soundPaused; +extern bool soundOffFlag; +extern int soundQuality; +extern int soundBufferLen; +extern int soundBufferTotalLen; +extern u32 soundNextPosition; +extern u16 soundFinalWave[1470]; +extern int soundVolume; + +extern bool soundEcho; +extern bool soundLowPass; +extern bool soundReverse; + +#endif // VBA_SOUND_H diff --git a/src/Sram.cpp b/src/Sram.cpp new file mode 100644 index 0000000..1a46097 --- /dev/null +++ b/src/Sram.cpp @@ -0,0 +1,32 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "GBA.h" +#include "Flash.h" +#include "Sram.h" + +u8 sramRead(u32 address) +{ + return flashSaveMemory[address & 0xFFFF]; +} + +void sramWrite(u32 address, u8 byte) +{ + flashSaveMemory[address & 0xFFFF] = byte; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; +} diff --git a/src/Sram.h b/src/Sram.h new file mode 100644 index 0000000..f33f4c8 --- /dev/null +++ b/src/Sram.h @@ -0,0 +1,26 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_SRAM_H +#define VBA_SRAM_H + +extern u8 sramRead(u32 address); +extern void sramWrite(u32 address, u8 byte); + +#endif // VBA_SRAM_H diff --git a/src/System.h b/src/System.h new file mode 100644 index 0000000..bcae330 --- /dev/null +++ b/src/System.h @@ -0,0 +1,131 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_SYSTEM_H +#define VBA_SYSTEM_H + +#include "unzip.h" + +#ifndef NULL +#define NULL 0 +#endif + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; + +#ifdef _MSC_VER +typedef unsigned __int64 u64; +#else +typedef unsigned long long u64; +#endif + +typedef signed char s8; +typedef signed short s16; +typedef signed int s32; + +#ifdef _MSC_VER +typedef signed __int64 s64; +#else +typedef signed long long s64; +#endif + +struct EmulatedSystem { + // main emulation function + void (*emuMain)(int); + // reset emulator + void (*emuReset)(); + // clean up memory + void (*emuCleanUp)(); + // load battery file + bool (*emuReadBattery)(const char *); + // write battery file + bool (*emuWriteBattery)(const char *); + // load battery file from stream + bool (*emuReadBatteryFromStream)(gzFile); + // write battery file to stream + bool (*emuWriteBatteryToStream)(gzFile); + // load state + bool (*emuReadState)(const char *); + // save state + bool (*emuWriteState)(const char *); + // load state from stream + bool (*emuReadStateFromStream)(gzFile); + // save state to stream + bool (*emuWriteStateToStream)(gzFile); + // load memory state (rewind) + bool (*emuReadMemState)(char *, int); + // write memory state (rewind) + bool (*emuWriteMemState)(char *, int); + // write PNG file + bool (*emuWritePNG)(const char *); + // write BMP file + bool (*emuWriteBMP)(const char *); + // emulator update CPSR (ARM only) + void (*emuUpdateCPSR)(); + // emulator has debugger + bool emuHasDebugger; + // clock ticks to emulate + int emuCount; +}; + +extern void log(const char *,...); + +extern bool systemPauseOnFrame(); +extern void systemGbPrint(u8 *,int,int,int,int); +extern void systemScreenCapture(int); +extern void systemDrawScreen(); +// updates the joystick data +extern bool systemReadJoypads(); +// return information about the given joystick, -1 for default joystick... the bool is for if motion sensor should be handled too +extern u32 systemReadJoypad(int,bool); +extern u32 systemGetClock(); +extern void systemMessage(int, const char *, ...); +extern void systemSetTitle(const char *); +extern void systemWriteDataToSoundBuffer(); +extern void systemSoundShutdown(); +extern void systemSoundPause(); +extern void systemSoundResume(); +extern void systemSoundReset(); +extern bool systemSoundInit(); +extern void systemScreenMessage(const char *msg, int slot=0, int duration=3000, const char *colorList=NULL); +extern int systemGetSensorX(); +extern int systemGetSensorY(); +extern bool systemCanChangeSoundQuality(); +extern void systemShowSpeed(int); +extern void systemFrame(int rate); +extern void systemGbBorderOn(); + +extern bool systemSoundOn; +extern u16 systemColorMap16[0x10000]; +extern u32 systemColorMap32[0x10000]; +extern u16 systemGbPalette[24]; +extern int systemRedShift; +extern int systemGreenShift; +extern int systemBlueShift; +extern int systemColorDepth; +extern int systemDebug; +extern int systemVerbose; +extern int systemFrameSkip; +extern int systemSaveUpdateCounter; + +#define SYSTEM_SAVE_UPDATED 30 +#define SYSTEM_SAVE_NOT_UPDATED 0 + +#endif //VBA_SYSTEM_H diff --git a/src/Text.cpp b/src/Text.cpp new file mode 100644 index 0000000..2896422 --- /dev/null +++ b/src/Text.cpp @@ -0,0 +1,273 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2002 Ben Parnell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Code originally from fceu/drawing.h file, adapted by Forgotten + */ +#include "System.h" + +bool outlinedText=true, transparentText=false; +int textColor=0, textMethod=1; + +extern int RGB_LOW_BITS_MASK; + +static const u8 fontdata2[2048] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xf0,0xe0,0xf0,0xbe,0x33,0x33,0x33,0x1e,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0xfc,0xcc,0xfc,0x0c,0x0c,0x0e,0x0f,0x07,0xfe,0xc6,0xfe,0xc6,0xc6,0xe6,0x67,0x03,0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99,0x01,0x07,0x1f,0x7f,0x1f,0x07,0x01,0x00,0x40,0x70,0x7c,0x7f,0x7c,0x70,0x40,0x00,0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0xfe,0xdb,0xdb,0xde,0xd8,0xd8,0xd8,0x00,0x7c,0xc6,0x1c,0x36,0x36,0x1c,0x33,0x1e,0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x18,0x30,0x7f,0x30,0x18,0x00,0x00,0x00,0x0c,0x06,0x7f,0x06,0x0c,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x7f,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x1e,0x1e,0x0c,0x0c,0x00,0x0c,0x00,0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x7f,0x36,0x7f,0x36,0x36,0x00,0x0c,0x3e,0x03,0x1e,0x30,0x1f,0x0c,0x00,0x00,0x63,0x33,0x18,0x0c,0x66,0x63,0x00,0x1c,0x36,0x1c,0x6e,0x3b,0x33,0x6e,0x00,0x06,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0x06,0x06,0x06,0x0c,0x18,0x00,0x06,0x0c,0x18,0x18,0x18,0x0c,0x06,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x06,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x00,0x60,0x30,0x18,0x0c,0x06,0x03,0x01,0x00,0x3e,0x63,0x73,0x7b,0x6f,0x67,0x3e,0x00,0x0c,0x0e,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x06,0x33,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x30,0x33,0x1e,0x00,0x38,0x3c,0x36,0x33,0x7f,0x30,0x78,0x00,0x3f,0x03,0x1f,0x30,0x30,0x33,0x1e,0x00,0x1c,0x06,0x03,0x1f,0x33,0x33,0x1e,0x00,0x3f,0x33,0x30,0x18,0x0c,0x0c,0x0c,0x00,0x1e,0x33,0x33,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x33,0x3e,0x30,0x18,0x0e,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x06,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x00,0x00,0x00,0x3f,0x00,0x00,0x3f,0x00,0x00,0x06,0x0c,0x18,0x30,0x18,0x0c,0x06,0x00,0x1e,0x33,0x30,0x18,0x0c,0x00,0x0c,0x00, + 0x3e,0x63,0x7b,0x7b,0x7b,0x03,0x1e,0x00,0x0c,0x1e,0x33,0x33,0x3f,0x33,0x33,0x00,0x3f,0x66,0x66,0x3e,0x66,0x66,0x3f,0x00,0x3c,0x66,0x03,0x03,0x03,0x66,0x3c,0x00,0x1f,0x36,0x66,0x66,0x66,0x36,0x1f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x46,0x7f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x06,0x0f,0x00,0x3c,0x66,0x03,0x03,0x73,0x66,0x7c,0x00,0x33,0x33,0x33,0x3f,0x33,0x33,0x33,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x78,0x30,0x30,0x30,0x33,0x33,0x1e,0x00,0x67,0x66,0x36,0x1e,0x36,0x66,0x67,0x00,0x0f,0x06,0x06,0x06,0x46,0x66,0x7f,0x00,0x63,0x77,0x7f,0x7f,0x6b,0x63,0x63,0x00,0x63,0x67,0x6f,0x7b,0x73,0x63,0x63,0x00,0x1c,0x36,0x63,0x63,0x63,0x36,0x1c,0x00,0x3f,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00,0x1e,0x33,0x33,0x33,0x3b,0x1e,0x38,0x00,0x3f,0x66,0x66,0x3e,0x36,0x66,0x67,0x00,0x1e,0x33,0x07,0x0e,0x38,0x33,0x1e,0x00,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x33,0x33,0x33,0x33,0x33,0x33,0x3f,0x00,0x33,0x33,0x33,0x33,0x33,0x1e,0x0c,0x00,0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x00,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x1e,0x00,0x7f,0x63,0x31,0x18,0x4c,0x66,0x7f,0x00,0x1e,0x06,0x06,0x06,0x06,0x06,0x1e,0x00,0x03,0x06,0x0c,0x18,0x30,0x60,0x40,0x00,0x1e,0x18,0x18,0x18,0x18,0x18,0x1e,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff, + 0x0c,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x30,0x3e,0x33,0x6e,0x00,0x07,0x06,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x1e,0x33,0x03,0x33,0x1e,0x00,0x38,0x30,0x30,0x3e,0x33,0x33,0x6e,0x00,0x00,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x1c,0x36,0x06,0x0f,0x06,0x06,0x0f,0x00,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x1f,0x07,0x06,0x36,0x6e,0x66,0x66,0x67,0x00,0x0c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x30,0x00,0x30,0x30,0x30,0x33,0x33,0x1e,0x07,0x06,0x66,0x36,0x1e,0x36,0x67,0x00,0x0e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x33,0x7f,0x7f,0x6b,0x63,0x00,0x00,0x00,0x1f,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x1e,0x33,0x33,0x33,0x1e,0x00,0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x0f,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x78,0x00,0x00,0x3b,0x6e,0x66,0x06,0x0f,0x00,0x00,0x00,0x3e,0x03,0x1e,0x30,0x1f,0x00,0x08,0x0c,0x3e,0x0c,0x0c,0x2c,0x18,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x6e,0x00,0x00,0x00,0x33,0x33,0x33,0x1e,0x0c,0x00,0x00,0x00,0x63,0x6b,0x7f,0x7f,0x36,0x00,0x00,0x00,0x63,0x36,0x1c,0x36,0x63,0x00,0x00,0x00,0x33,0x33,0x33,0x3e,0x30,0x1f,0x00,0x00,0x3f,0x19,0x0c,0x26,0x3f,0x00,0x38,0x0c,0x0c,0x07,0x0c,0x0c,0x38,0x00,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x07,0x0c,0x0c,0x38,0x0c,0x0c,0x07,0x00,0x6e,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00, + 0x1e,0x33,0x03,0x33,0x1e,0x18,0x30,0x1e,0x00,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x38,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x7e,0xc3,0x3c,0x60,0x7c,0x66,0xfc,0x00,0x33,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x07,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x0c,0x0c,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x00,0x00,0x1e,0x03,0x03,0x1e,0x30,0x1c,0x7e,0xc3,0x3c,0x66,0x7e,0x06,0x3c,0x00,0x33,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x07,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x33,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x3e,0x63,0x1c,0x18,0x18,0x18,0x3c,0x00,0x07,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x63,0x1c,0x36,0x63,0x7f,0x63,0x63,0x00,0x0c,0x0c,0x00,0x1e,0x33,0x3f,0x33,0x00,0x38,0x00,0x3f,0x06,0x1e,0x06,0x3f,0x00,0x00,0x00,0xfe,0x30,0xfe,0x33,0xfe,0x00,0x7c,0x36,0x33,0x7f,0x33,0x33,0x73,0x00,0x1e,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x07,0x00,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x07,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x33,0x00,0x33,0x33,0x3e,0x30,0x1f,0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00,0x33,0x00,0x33,0x33,0x33,0x33,0x1e,0x00,0x18,0x18,0x7e,0x03,0x03,0x7e,0x18,0x18,0x1c,0x36,0x26,0x0f,0x06,0x67,0x3f,0x00,0x33,0x33,0x1e,0x3f,0x0c,0x3f,0x0c,0x0c,0x1f,0x33,0x33,0x5f,0x63,0xf3,0x63,0xe3,0x70,0xd8,0x18,0x3c,0x18,0x18,0x1b,0x0e, + 0x38,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x1c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x38,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x38,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x1f,0x00,0x1f,0x33,0x33,0x33,0x00,0x3f,0x00,0x33,0x37,0x3f,0x3b,0x33,0x00,0x3c,0x36,0x36,0x7c,0x00,0x7e,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x3e,0x00,0x00,0x0c,0x00,0x0c,0x06,0x03,0x33,0x1e,0x00,0x00,0x00,0x00,0x3f,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x30,0x00,0x00,0xc3,0x63,0x33,0x7b,0xcc,0x66,0x33,0xf0,0xc3,0x63,0x33,0xdb,0xec,0xf6,0xf3,0xc0,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00,0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xdb,0xee,0xdb,0x77,0xdb,0xee,0xdb,0x77,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0x6f,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x7f,0x6c,0x6c,0x6c,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x7f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6f,0x60,0x7f,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0x7f,0x00,0x00,0x00,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xfc,0x00,0x00,0x00,0x00,0x00,0xfc,0x0c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xef,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xef,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xec,0x6c,0x6c,0x6c,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0xef,0x00,0xef,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xfc,0x00,0x00,0x00,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xfc,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xff,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, + 0x00,0x00,0x6e,0x3b,0x13,0x3b,0x6e,0x00,0x00,0x1e,0x33,0x1f,0x33,0x1f,0x03,0x03,0x00,0x3f,0x33,0x03,0x03,0x03,0x03,0x00,0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,0x3f,0x33,0x06,0x0c,0x06,0x33,0x3f,0x00,0x00,0x00,0x7e,0x1b,0x1b,0x1b,0x0e,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x06,0x03,0x00,0x6e,0x3b,0x18,0x18,0x18,0x18,0x00,0x3f,0x0c,0x1e,0x33,0x33,0x1e,0x0c,0x3f,0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x38,0x0c,0x18,0x3e,0x33,0x33,0x1e,0x00,0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,0x60,0x30,0x7e,0xdb,0xdb,0x7e,0x06,0x03,0x1c,0x06,0x03,0x1f,0x03,0x06,0x1c,0x00,0x1e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x3f,0x00,0x3f,0x00,0x3f,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x3f,0x00,0x06,0x0c,0x18,0x0c,0x06,0x00,0x3f,0x00,0x18,0x0c,0x06,0x0c,0x18,0x00,0x3f,0x00,0x70,0xd8,0xd8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x0e,0x0c,0x0c,0x00,0x3f,0x00,0x0c,0x0c,0x00,0x00,0x6e,0x3b,0x00,0x6e,0x3b,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xf0,0x30,0x30,0x30,0x37,0x36,0x3c,0x38,0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +static void calcColors(const int colorNum, int & lo, int & hi, int & out) +{ + int redLo, redHi, greenLo, greenHi, blueLo, blueHi; + + if(colorNum == 0 || colorNum == 1 || colorNum == 2 || colorNum == 6) // white, red, yellow, or magenta + redLo = (0xf) << systemRedShift, redHi = (0x1f) << systemRedShift; + else redLo = redHi = 0; + + if(colorNum == 0 || colorNum == 2 || colorNum == 3 || colorNum == 4) // white, yellow, green, or cyan + greenLo = (0xf) << systemGreenShift, greenHi = (0x1f) << systemGreenShift; + else greenLo = greenHi = 0; + + if(colorNum == 0 || colorNum == 4 || colorNum == 5 || colorNum == 6) // white, cyan, blue, or magenta + blueLo = (0xf) << systemBlueShift, blueHi = (0x1f) << systemBlueShift; + else blueLo = blueHi = 0; + + lo = redLo + greenLo + blueLo; + hi = redHi + greenHi + blueHi; + + if(colorNum == 7) // black + out = 0xffffffff; // white border + else out = 0; // black border +} + +int lastColID = 0; +static void progressColorList(const char*& colorList, int & lo, int & hi, int & out) +{ + if(*colorList) + { + if(*colorList != lastColID) + { + calcColors((int)(*colorList)-1, lo, hi, out); + lastColID = *colorList; + } + colorList++; + } + else + { + colorList = NULL; + } +} + + +static void drawTextInternal(u8 *screen, int pitch, int x, int y, + const char *string, bool trans, const char *colorList=NULL) +{ + if(colorList && !*colorList) + colorList = NULL; + + int loCol, hiCol, outCol; + calcColors(textColor, loCol, hiCol, outCol); + + lastColID = 0; + + const static int xd [8] = {-1,0,1,1,1,0,-1,-1}; + const static int yd [8] = {-1,-1,-1,0,1,1,1,0}; + + screen += y*pitch; + int inc = 2; + switch(systemColorDepth) { + case 24: + inc = 3; + break; + case 32: + inc = 4; + break; + } + screen += x*inc; + + int xpos = x; + switch(systemColorDepth) { + case 16: + { + while(*string) { + char c = *string++; + u8 *scr = screen; + + if(colorList) progressColorList(colorList, loCol, hiCol, outCol); + + u16 mask = ~RGB_LOW_BITS_MASK; + int h, w; + u16 *s = (u16 *)scr; + for (h = 0-1; h < 8+1; h++) { + for (w = 0-1; w < 8+1; w++, s++) { + int on = (h<0||w<0||h>=8||w>=8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; + + int border = 0; + if(outlinedText) + for(int i = 0 ; i < 8 ; i++) + { + int h2 = h+yd[i], w2 = w+xd[i]; + border = (h2<0||w2<0||h2>=8||w2>=8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; + if(border) break; + } + + if(trans) { + if(on) + *s = loCol + + ((*s & mask) >>1); + else if(border) + *s = outCol; + } else { + if(on) + *s = hiCol; + else if(border) + *s = outCol; + } + } + scr += pitch; + s = (u16 *)scr; + } + screen += inc*8; + + xpos += 8; + if(xpos+8 > pitch>>1) // cut off text at right boundary + break; + } + } + break; + case 24: // TODO: verify this code's correctness + { + while(*string) { + char c = *string++; + u8 *scr = screen; + + if(colorList) progressColorList(colorList, loCol, hiCol, outCol); + + int h, w; + u8 *s = (u8 *)scr; + for (h = 0-1; h < 8+1; h++) { + for (w = 0-1; w < 8+1; w++, s++) { + int on = (h<0||w<0||h>=8||w>=8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; + + int border = 0; + if(outlinedText) + for(int i = 0 ; i < 8 ; i++) + { + int h2 = h+yd[i], w2 = w+xd[i]; + border = (h2<0||w2<0||h2>=8||w2>=8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; + if(border) break; + } + + if(trans) { + if(on) { + u32 color = hiCol; + *s = ((color & 255)>>1)+(*s>>1); + *(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1); + *(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1); + } + else if(border) + *s = outCol; + } else { + if(on) { + u32 color = hiCol; + *s = (color & 255); + *(s+1) = (color >> 8) & 255; + *(s+2) = (color >> 16) & 255; + } + else if(border) + *s = outCol; + } + } + scr += pitch; + s = (u8 *)scr; + } + screen += inc*8; + + xpos += 8; + if(xpos+8 > pitch/3) // cut off text at right boundary + break; + } + } + break; + case 32: + { + while(*string) { + char c = *string++; + u8 *scr = screen; + + if(colorList) progressColorList(colorList, loCol, hiCol, outCol); + + int h, w; + u32 mask = 0xfefefe; + u32 *s = (u32 *)scr; + for (h = 0-1; h < 8+1; h++) { + for (w = 0-1; w < 8+1; w++, s++) { + int on = (h<0||w<0||h>=8||w>=8) ? 0 : (fontdata2[(c<<3)+h]>>w)&1; + + int border = 0; + if(outlinedText) + for(int i = 0 ; i < 8 ; i++) + { + int h2 = h+yd[i], w2 = w+xd[i]; + border = (h2<0||w2<0||h2>=8||w2>=8) ? 0 : (fontdata2[(c<<3)+h2]>>w2)&1; + if(border) break; + } + + if(trans) { + if(on) + *s = loCol + + ((*s & mask)>>1); + else if(border) + *s = outCol; + } else { + if(on) + *s = hiCol; + else if(border) + *s = outCol; + } + } + scr += pitch; + s = (u32 *)scr; + } + screen += inc*8; + + xpos += 8; + if(xpos+8 > pitch>>2) // cut off text at right boundary + break; + } + } + break; + } +} + +void drawText(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) +{ + drawTextInternal(screen, pitch, x, y, string, transparentText, colorList); +} + +void drawTextTransp(u8 *screen, int pitch, int x, int y, const char *string, const char *colorList) +{ + drawTextInternal(screen, pitch, x, y, string, true, colorList); +} diff --git a/src/Text.h b/src/Text.h new file mode 100644 index 0000000..0b5bfff --- /dev/null +++ b/src/Text.h @@ -0,0 +1,24 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +extern void drawText(u8 *, int, int, int, const char *, const char*cl=NULL); +extern void drawTextTransp(u8 *, int, int, int, const char *, const char*cl=NULL); + +extern bool outlinedText, transparentText; +extern int textColor, textMethod; diff --git a/src/Util.cpp b/src/Util.cpp new file mode 100644 index 0000000..362603d --- /dev/null +++ b/src/Util.cpp @@ -0,0 +1,1111 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include + +extern "C" { +#include +} + +#if 0 +#include "unrarlib.h" +#endif + +#include "System.h" +#include "NLS.h" +#include "Util.h" +#include "Flash.h" +#include "GBA.h" +#include "Globals.h" +#include "RTC.h" +#include "Port.h" + + +extern "C" { +#include "memgzio.h" +} + +#ifndef _MSC_VER +#define _stricmp strcasecmp +#endif // ! _MSC_VER + +extern int systemColorDepth; +extern int systemRedShift; +extern int systemGreenShift; +extern int systemBlueShift; + +extern u16 systemColorMap16[0x10000]; +extern u32 systemColorMap32[0x10000]; + +static int (ZEXPORT *utilGzWriteFunc)(gzFile, const voidp, unsigned int) = NULL; +static int (ZEXPORT *utilGzReadFunc)(gzFile, voidp, unsigned int) = NULL; +static int (ZEXPORT *utilGzCloseFunc)(gzFile) = NULL; + +bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) +{ + u8 writeBuffer[512 * 3]; + + FILE *fp = fopen(fileName,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName); + return false; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return false; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return false; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return false; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + switch(systemColorDepth) { + case 16: + { + u16 *p = (u16 *)(pix+(w+2)*2); // skip first black line + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u16 v = *p++; + + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B + } + p++; // skip black pixel for filters + p++; // skip black pixel for filters + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + } + break; + case 24: + { + u8 *pixU8 = (u8 *)pix; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + if(systemRedShift < systemBlueShift) { + *b++ = *pixU8++; // R + *b++ = *pixU8++; // G + *b++ = *pixU8++; // B + } else { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + } + break; + case 32: + { + u32 *pixU32 = (u32 *)(pix+4*(w+1)); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u32 v = *pixU32++; + + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B + } + pixU32++; + + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + } + break; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); + + return true; +} + +void utilPutDword(u8 *p, u32 value) +{ + *p++ = value & 255; + *p++ = (value >> 8) & 255; + *p++ = (value >> 16) & 255; + *p = (value >> 24) & 255; +} + +void utilPutWord(u8 *p, u16 value) +{ + *p++ = value & 255; + *p = (value >> 8) & 255; +} + +void utilWriteBMP(char *buf, int w, int h, int dstDepth, u8 *pix) +{ + u8 *b = (u8 *)buf; + + int sizeX = w; + int sizeY = h; + + switch(dstDepth>0 ? dstDepth : systemColorDepth) { + case 16: + { + u16 *p = (u16 *)(pix+(w+2)*(h)*2); // skip first black line + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u16 v = *p++; + + *b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + } + p++; // skip black pixel for filters + p++; // skip black pixel for filters + p -= 2*(w+2); + } + } + break; + case 24: + { + u8 *pixU8 = (u8 *)pix+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + if(systemRedShift > systemBlueShift) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } else { + int red = *pixU8++; + int green = *pixU8++; + int blue = *pixU8++; + + *b++ = blue; + *b++ = green; + *b++ = red; + } + } + pixU8 -= 2*3*w; + } + } + break; + case 32: + { + u32 *pixU32 = (u32 *)(pix+4*(w+1)*(h)); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u32 v = *pixU32++; + + *b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + } + pixU32++; + pixU32 -= 2*(w+1); + } + } + break; + } +} + +bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) +{ + u8 writeBuffer[512 * 3]; + + FILE *fp = fopen(fileName,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName); + return false; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + // u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x36); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + switch(systemColorDepth) { + case 16: + { + u16 *p = (u16 *)(pix+(w+2)*(h)*2); // skip first black line + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u16 v = *p++; + + *b++ = ((v >> systemBlueShift) & 0x01f) << 3; // B + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + } + p++; // skip black pixel for filters + p++; // skip black pixel for filters + p -= 2*(w+2); + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + } + break; + case 24: + { + u8 *pixU8 = (u8 *)pix+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + if(systemRedShift > systemBlueShift) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } else { + int red = *pixU8++; + int green = *pixU8++; + int blue = *pixU8++; + + *b++ = blue; + *b++ = green; + *b++ = red; + } + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + } + break; + case 32: + { + u32 *pixU32 = (u32 *)(pix+4*(w+1)*(h)); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u32 v = *pixU32++; + + *b++ = ((v >> systemBlueShift) & 0x001f) << 3; // B + *b++ = ((v >> systemGreenShift) & 0x001f) << 3; // G + *b++ = ((v >> systemRedShift) & 0x001f) << 3; // R + } + pixU32++; + pixU32 -= 2*(w+1); + + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + } + break; + } + + fclose(fp); + + return true; +} + +static int utilReadInt2(FILE *f) +{ + int res = 0; + int c = fgetc(f); + if(c == EOF) + return -1; + res = c; + c = fgetc(f); + if(c == EOF) + return -1; + return c + (res<<8); +} + +static int utilReadInt3(FILE *f) +{ + int res = 0; + int c = fgetc(f); + if(c == EOF) + return -1; + res = c; + c = fgetc(f); + if(c == EOF) + return -1; + res = c + (res<<8); + c = fgetc(f); + if(c == EOF) + return -1; + return c + (res<<8); +} + +void utilApplyIPS(const char *ips, u8 **r, int *s) +{ + // from the IPS spec at http://zerosoft.zophar.net/ips.htm + FILE *f = fopen(ips, "rb"); + if(!f) + return; + u8 *rom = *r; + int size = *s; + if(fgetc(f) == 'P' && + fgetc(f) == 'A' && + fgetc(f) == 'T' && + fgetc(f) == 'C' && + fgetc(f) == 'H') { + int b; + int offset; + int len; + for(;;) { + // read offset + offset = utilReadInt3(f); + // if offset == EOF, end of patch + if(offset == 0x454f46) + break; + // read length + len = utilReadInt2(f); + if(!len) { + // len == 0, RLE block + len = utilReadInt2(f); + // byte to fill + int c = fgetc(f); + if(c == -1) + break; + b = (u8)c; + } else + b= -1; + // check if we need to reallocate our ROM + if((offset + len) >= size) { + size *= 2; + rom = (u8 *)realloc(rom, size); + *r = rom; + *s = size; + } + if(b == -1) { + // normal block, just read the data + if(fread(&rom[offset], 1, len, f) != (size_t)len) + break; + } else { + // fill the region with the given byte + while(len--) { + rom[offset++] = b; + } + } + } + } + // close the file + fclose(f); +} + +extern bool cpuIsMultiBoot; + +bool utilIsGBAImage(const char * file) +{ + cpuIsMultiBoot = false; + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".gba") == 0) + return true; + if(_stricmp(p, ".agb") == 0) + return true; + if(_stricmp(p, ".bin") == 0) + return true; + if(_stricmp(p, ".elf") == 0) + return true; + if(_stricmp(p, ".mb") == 0) { + cpuIsMultiBoot = true; + return true; + } + } + } + + return false; +} + +bool utilIsGBImage(const char * file) +{ + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".gb") == 0) + return true; + if(_stricmp(p, ".gbc") == 0) + return true; + if(_stricmp(p, ".cgb") == 0) + return true; + if(_stricmp(p, ".sgb") == 0) + return true; + } + } + + return false; +} + +bool utilIsZipFile(const char *file) +{ + if(strlen(file) > 4) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".zip") == 0) + return true; + } + } + + return false; +} + +#if 0 +bool utilIsRarFile(const char *file) +{ + if(strlen(file) > 4) { + char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".rar") == 0) + return true; + } + } + + return false; +} +#endif + +bool utilIsGzipFile(const char *file) +{ + if(strlen(file) > 3) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".gz") == 0) + return true; + if(_stricmp(p, ".z") == 0) + return true; + } + } + + return false; +} + +void utilGetBaseName(const char *file, char *buffer) +{ + strcpy(buffer, file); + + if(utilIsGzipFile(file)) { + char *p = strrchr(buffer, '.'); + + if(p) + *p = 0; + } +} + +IMAGE_TYPE utilFindType(const char *file) +{ + char buffer[2048]; + + if(utilIsZipFile(file)) { + unzFile unz = unzOpen(file); + + if(unz == NULL) { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); + return IMAGE_UNKNOWN; + } + + int r = unzGoToFirstFile(unz); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad ZIP file %s"), file); + return IMAGE_UNKNOWN; + } + + IMAGE_TYPE found = IMAGE_UNKNOWN; + + unz_file_info info; + + while(true) { + r = unzGetCurrentFileInfo(unz, + &info, + buffer, + sizeof(buffer), + NULL, + 0, + NULL, + 0); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad ZIP file %s"), file); + return IMAGE_UNKNOWN; + } + + if(utilIsGBAImage(buffer)) { + found = IMAGE_GBA; + break; + } + + if(utilIsGBImage(buffer)) { + found = IMAGE_GB; + break; + } + + r = unzGoToNextFile(unz); + + if(r != UNZ_OK) + break; + } + unzClose(unz); + + if(found == IMAGE_UNKNOWN) { + systemMessage(MSG_NO_IMAGE_ON_ZIP, + N_("No image found on ZIP file %s"), file); + return found; + } + return found; +#if 0 + } else if(utilIsRarFile(file)) { + IMAGE_TYPE found = IMAGE_UNKNOWN; + + ArchiveList_struct *rarList = NULL; + if(urarlib_list((void *)file, (ArchiveList_struct *)&rarList)) { + ArchiveList_struct *p = rarList; + + while(p) { + if(utilIsGBAImage(p->item.Name)) { + found = IMAGE_GBA; + break; + } + + if(utilIsGBImage(p->item.Name)) { + found = IMAGE_GB; + break; + } + p = p->next; + } + + urarlib_freelist(rarList); + } + return found; +#endif + } else { + if(utilIsGzipFile(file)) + utilGetBaseName(file, buffer); + else + strcpy(buffer, file); + + if(utilIsGBAImage(buffer)) + return IMAGE_GBA; + if(utilIsGBImage(buffer)) + return IMAGE_GB; + } + return IMAGE_UNKNOWN; +} + +static int utilGetSize(int size) +{ + int res = 1; + while(res < size) + res <<= 1; + return res; +} + +static u8 *utilLoadFromZip(const char *file, + bool (*accept)(const char *), + u8 *data, + int &size) +{ + char buffer[2048]; + + unzFile unz = unzOpen(file); + + if(unz == NULL) { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); + return NULL; + } + int r = unzGoToFirstFile(unz); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad ZIP file %s"), file); + return NULL; + } + + bool found = false; + + unz_file_info info; + + while(true) { + r = unzGetCurrentFileInfo(unz, + &info, + buffer, + sizeof(buffer), + NULL, + 0, + NULL, + 0); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad ZIP file %s"), file); + return NULL; + } + + if(accept(buffer)) { + found = true; + break; + } + + r = unzGoToNextFile(unz); + + if(r != UNZ_OK) + break; + } + + if(!found) { + unzClose(unz); + systemMessage(MSG_NO_IMAGE_ON_ZIP, + N_("No image found on ZIP file %s"), file); + return NULL; + } + + int fileSize = info.uncompressed_size; + if(size == 0) + size = fileSize; + r = unzOpenCurrentFile(unz); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), buffer); + return NULL; + } + + u8 *image = data; + + if(image == NULL) { + image = (u8 *)malloc(utilGetSize(size)); + if(image == NULL) { + unzCloseCurrentFile(unz); + unzClose(unz); + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "data"); + return NULL; + } + size = fileSize; + } + int read = fileSize <= size ? fileSize : size; + r = unzReadCurrentFile(unz, + image, + read); + + unzCloseCurrentFile(unz); + unzClose(unz); + + if(r != (int)read) { + systemMessage(MSG_ERROR_READING_IMAGE, + N_("Error reading image %s"), buffer); + if(data == NULL) + free(image); + return NULL; + } + + size = fileSize; + + return image; +} + +static u8 *utilLoadGzipFile(const char *file, + bool (*accept)(const char *), + u8 *data, + int &size) +{ + FILE *f = fopen(file, "rb"); + + if(f == NULL) { + systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), file); + return NULL; + } + + fseek(f, -4, SEEK_END); + int fileSize = fgetc(f) | (fgetc(f) << 8) | (fgetc(f) << 16) | (fgetc(f) << 24); + fclose(f); + if(size == 0) + size = fileSize; + + gzFile gz = gzopen(file, "rb"); + + if(gz == NULL) { + // should not happen, but who knows? + systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), file); + return NULL; + } + + u8 *image = data; + + if(image == NULL) { + image = (u8 *)malloc(utilGetSize(size)); + if(image == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "data"); + fclose(f); + return NULL; + } + size = fileSize; + } + int read = fileSize <= size ? fileSize : size; + int r = gzread(gz, image, read); + gzclose(gz); + + if(r != (int)read) { + systemMessage(MSG_ERROR_READING_IMAGE, + N_("Error reading image %s"), file); + if(data == NULL) + free(image); + return NULL; + } + + size = fileSize; + + return image; +} + +#if 0 +static u8 *utilLoadRarFile(const char *file, + bool (*accept)(const char *), + u8 *data, + int &size) +{ + char buffer[2048]; + + ArchiveList_struct *rarList = NULL; + if(urarlib_list((void *)file, (ArchiveList_struct *)&rarList)) { + ArchiveList_struct *p = rarList; + + bool found = false; + while(p) { + if(accept(p->item.Name)) { + strcpy(buffer, p->item.Name); + found = true; + break; + } + p = p->next; + } + if(found) { + void *memory = NULL; + unsigned long lsize = 0; + size = p->item.UnpSize; + int r = urarlib_get((void *)&memory, &lsize, buffer, (void *)file, ""); + if(!r) { + systemMessage(MSG_ERROR_READING_IMAGE, + N_("Error reading image %s"), buffer); + urarlib_freelist(rarList); + return NULL; + } + u8 *image = (u8 *)memory; + if(data != NULL) { + memcpy(image, data, size); + } + urarlib_freelist(rarList); + return image; + } + systemMessage(MSG_NO_IMAGE_ON_ZIP, + N_("No image found on RAR file %s"), file); + urarlib_freelist(rarList); + return NULL; + } + // nothing found + return NULL; +} +#endif + +u8 *utilLoad(const char *file, + bool (*accept)(const char *), + u8 *data, + int &size) +{ + if(utilIsZipFile(file)) { + return utilLoadFromZip(file, accept, data, size); + } + if(utilIsGzipFile(file)) { + return utilLoadGzipFile(file, accept, data, size); + } +#if 0 + if(utilIsRarFile(file)) { + return utilLoadRarFile(file, accept, data, size); + } +#endif + + u8 *image = data; + + FILE *f = fopen(file, "rb"); + + if(!f) { + systemMessage(MSG_ERROR_OPENING_IMAGE, N_("Error opening image %s"), file); + return NULL; + } + + fseek(f,0,SEEK_END); + int fileSize = ftell(f); + fseek(f,0,SEEK_SET); + if(size == 0) + size = fileSize; + + if(image == NULL) { + image = (u8 *)malloc(utilGetSize(size)); + if(image == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "data"); + fclose(f); + return NULL; + } + size = fileSize; + } + int read = fileSize <= size ? fileSize : size; + int r = fread(image, 1, read, f); + fclose(f); + + if(r != (int)read) { + systemMessage(MSG_ERROR_READING_IMAGE, + N_("Error reading image %s"), file); + if(data == NULL) + free(image); + return NULL; + } + + size = fileSize; + + return image; +} + +void utilWriteInt(gzFile gzFile, int i) +{ + utilGzWrite(gzFile, &i, sizeof(int)); +} + +int utilReadInt(gzFile gzFile) +{ + int i = 0; + utilGzRead(gzFile, &i, sizeof(int)); + return i; +} + +void utilReadData(gzFile gzFile, variable_desc* data) +{ + while(data->address) { + utilGzRead(gzFile, data->address, data->size); + data++; + } +} + +void utilWriteData(gzFile gzFile, variable_desc *data) +{ + while(data->address) { + utilGzWrite(gzFile, data->address, data->size); + data++; + } +} + +gzFile utilGzOpen(const char *file, const char *mode) +{ + utilGzWriteFunc = (int (ZEXPORT *)(void *,void * const, unsigned int))gzwrite; + utilGzReadFunc = gzread; + utilGzCloseFunc = gzclose; + + return gzopen(file, mode); +} + +gzFile utilGzReopen(int id, const char *mode) +{ + utilGzWriteFunc = (int (*)(void *,void * const, unsigned int))gzwrite; + utilGzReadFunc = gzread; + utilGzCloseFunc = gzclose; + + return gzdopen(id, mode); +} + +gzFile utilMemGzOpen(char *memory, int available, char *mode) +{ + utilGzWriteFunc = memgzwrite; + utilGzReadFunc = memgzread; + utilGzCloseFunc = memgzclose; + + return memgzopen(memory, available, mode); +} + +int utilGzWrite(gzFile file, const voidp buffer, unsigned int len) +{ + return utilGzWriteFunc(file, buffer, len); +} + +int utilGzRead(gzFile file, voidp buffer, unsigned int len) +{ + return utilGzReadFunc(file, buffer, len); +} + +int utilGzClose(gzFile file) +{ + return utilGzCloseFunc(file); +} + +long utilGzMemTell(gzFile file) +{ + return memtell(file); +} + +void utilGBAFindSave(const u8 *data, const int size) +{ + u32 *p = (u32 *)data; + u32 *end = (u32 *)(data + size); + int saveType = 0; + int flashSize = 0x10000; + bool rtcFound = false; + + while(p < end) { + u32 d = READ32LE(p); + + if(d == 0x52504545) { + if(memcmp(p, "EEPROM_", 7) == 0) { + if(saveType == 0) + saveType = 1; + } + } else if (d == 0x4D415253) { + if(memcmp(p, "SRAM_", 5) == 0) { + if(saveType == 0) + saveType = 2; + } + } else if (d == 0x53414C46) { + if(memcmp(p, "FLASH1M_", 8) == 0) { + if(saveType == 0) { + saveType = 3; + flashSize = 0x20000; + } + } else if(memcmp(p, "FLASH", 5) == 0) { + if(saveType == 0) { + saveType = 3; + flashSize = 0x10000; + } + } + } else if (d == 0x52494953) { + if(memcmp(p, "SIIRTC_V", 8) == 0) + rtcFound = true; + } + p++; + } + // if no matches found, then set it to NONE + if(saveType == 0) { + saveType = 5; + } + rtcEnable(rtcFound); + cpuSaveType = saveType; + flashSetSize(flashSize); +} + +void utilUpdateSystemColorMaps() +{ + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + case 24: + case 32: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + } +} diff --git a/src/Util.h b/src/Util.h new file mode 100644 index 0000000..a64aca3 --- /dev/null +++ b/src/Util.h @@ -0,0 +1,66 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_UTIL_H +#define VBA_UTIL_H +enum IMAGE_TYPE { + IMAGE_UNKNOWN = -1, + IMAGE_GBA = 0, + IMAGE_GB = 1 +}; + +// save game + +typedef struct { + void *address; + int size; +} variable_desc; + +extern bool utilWritePNGFile(const char *, int, int, u8 *); +extern bool utilWriteBMPFile(const char *, int, int, u8 *); +extern void utilApplyIPS(const char *ips, u8 **rom, int *size); +extern void utilWriteBMP(char * out, int w, int h, int dstDepth, u8 * in); +extern bool utilIsGBAImage(const char *); +extern bool utilIsGBImage(const char *); +extern bool utilIsZipFile(const char *); +extern bool utilIsGzipFile(const char *); +extern bool utilIsRarFile(const char *); +extern void utilGetBaseName(const char *, char *); +extern IMAGE_TYPE utilFindType(const char *); +extern u8 *utilLoad(const char *, + bool (*)(const char*), + u8 *, + int &); + +extern void utilPutDword(u8 *, u32); +extern void utilPutWord(u8 *, u16); +extern void utilWriteData(gzFile, variable_desc *); +extern void utilReadData(gzFile, variable_desc *); +extern int utilReadInt(gzFile); +extern void utilWriteInt(gzFile, int); +extern gzFile utilGzOpen(const char *file, const char *mode); +extern gzFile utilGzReopen(int id, const char *mode); +extern gzFile utilMemGzOpen(char *memory, int available, char *mode); +extern int utilGzWrite(gzFile file, const voidp buffer, unsigned int len); +extern int utilGzRead(gzFile file, voidp buffer, unsigned int len); +extern int utilGzClose(gzFile file); +extern long utilGzMemTell(gzFile file); +extern void utilGBAFindSave(const u8 *, const int); +extern void utilUpdateSystemColorMaps(); +#endif diff --git a/src/VisualBoyAdvance.cfg b/src/VisualBoyAdvance.cfg new file mode 100644 index 0000000..e6cf0c1 --- /dev/null +++ b/src/VisualBoyAdvance.cfg @@ -0,0 +1,213 @@ +# All numeric values are in hexadecimal +# Use TAB or EQUAL sign to separate name from value + +# +# Key configuration (all numbers are in hexadecimal!) +# +# Keys values are in the format YXXX where Y is the device number. 0 means +# keyborad and XXX is the SDL define for the desired key (read SDL_keysym.h). +# +# If Y is greater than 0, it means joystick number Y-1 and it uses the +# following format for XXX: +# +# - if XXX < 20, XXX is the axis number multiplied by 2. An even number means +# movement to the negative side (on the X axis, it means left). An odd +# number means movement to the positive side (on the X axis, it mean +# right). For the Y axis, negative means up and positive means down. +# X axis is usally axis number 0 and Y is axis number 1. +# - if 20 >= XXX > 30, then XXX is the HAT number multiplied by 4 plus the +# direction: 0 for up, 1 for down, 2 for right and 3 for left. Example: +# 0021 is HAT 0 down, 0026 is HAT 1 right. +# - if 80 >= XXX > 100, XXX is the joystick button number (XXX-080). +# +# Default key configuration is (value in parenthesis): +# +# Left Left Arrow (0114) +# Right Right Arrow (0113) +# Up Up Arrow (0111) +# Down Down Arrow (0112) +# A Z (007a) +# B X (0078) +# L A (0061) +# R S (0073) +# Start ENTER (000d) +# Select BACKSPACE (0008) +# Speed up SPACE (0020) +# Capture F12 (0125) +# +Joy0_Left=0114 +Joy0_Right=0113 +Joy0_Up=0111 +Joy0_Down=0112 +Joy0_A=007a +Joy0_B=0078 +Joy0_L=0061 +Joy0_R=0073 +Joy0_Start=000d +Joy0_Select=0008 +Joy0_Speed=0020 +Joy0_Capture=0125 + +# Motion support keys. Same format as above +# +# Default keys are (value in parenthesis): +# +# Left Numeric Pad 4 (0104) +# Right Numeric Pad 6 (0106) +# Up Numeric Pad 8 (0108) +# Down Numeric Pad 2 (0102) +# +Motion_Left=0104 +Motion_Right=0106 +Motion_Up=0108 +Motion_Down=0102 + +# Frame skip setting. Allowed values are from 0 to 5 only. +frameSkip=2 + +# Gameboy Frame skip setting. Allowed values are from 0 to 5 only. +gbFrameSkip=0 + +# Video setting. 0=1x, 1=2x, 2=3x, 3=4x. +video=1 + +# Use fullscreen mode. 0=false, any other value means true +fullScreen=0 + +# Disables MMX support +disableMMX=1 + +# Use bios file. 0=false, any other value means true +useBios=0 + +# Bios file full path and name (ZIP not supported) +biosFile=none + +# Filter to use. 0=no filter, 1=TV Mode, 2=2xSaI, 3=Super 2xSaI, 4=Super Eagle +# 5=Pixelate, 6=Motion Blur, 7=AdvanceMAME Scale2x, 8=Simple 2x, +# 9=Bilinear, A=Bilinear Plus, B=hq2x, C=lq2x +filter=0 + +# Disable status messages. 0=false, any other value means true +disableStatus=0 + +# Enable Gameboy border. 0=false, any other value means true +borderOn=0 + +# Gameboy emulator type. 0=automatic, 1=CGB/GBC, 2=SGB, 3=GB, 4=GBA, 5=SGB2 +emulatorType=1 + +# Enable washed colors. 0=false, any other value means true +colorOption=1 + +# Directories. Not setting one them makes the file go the rom directory. + +# Save state directory +#saveDir= + +# Screen shot Capture directory +#captureDir= + +# Battery directory +#batteryDir= + +# Screen capture format +# 0=PNG, anything else for BMP +captureFormat=0 + +# Sound quality +# 1=44 Khz, 2=22Khz, 4=11Khz +soundQuality=2 + +# Sound Echo +# 0=false, anything else for true +soundEcho=0 + +# Sound Low pass filter +# 0=false, anything else for true +soundLowPass=0 + +# Sound reverse stereo +# 0=false, anything else for true +soundReverse=0 + +# Remove GBA intros (not supported anymore) +# 0=false, anything else for true +# removeIntros=0 + +# Save Type +# 0=automatic, 1=EEPROM, 2=SRAM, 3=Flash, 4=EEPROM+Sensor, 5=NONE +saveType=0 + +# Flash size +# 0=64K Flash, 1=128K Flash + +flashSize=0 + +# Sound volume +# 0=1x, 1=2x, 2=3x, 3=4x +soundVolume=0 + +# Interframe blending +# 0=none, 1=motion blur, 2=smart +ifbType=0 + +# Show emulation speed +# 0=none, 1=percentage, 2=detailed +showSpeed=1 + +# Show speed in transparent mode +# 0=normal, anything else for transparent +showSpeedTransparent=1 + +# Enable/Disable auto frameskip +# 0=disable, anything else to enable +autoFrameSkip=0 + +# Sets the desired throttle +# 0=disable, 5...1000 valid throttle speeds +throttle=0 + +# Pauses the emulator when the window is inactive +# 0=disable, anything else to enable +pauseWhenInactive=0 + +# Enables AGBPrint support +# 0=disable, anything else to enable +agbPrint=0 + +# Enables GBA RTC support +# 0=disable, anything else to enable +rtcEnabled=0 + +# Sound OFF flag +# 0=sound on, anything else turns off sound +soundOff=0 + +# Sound Enable +# Controls which channels are enabled: (add values) +# 1 - Channel 1 +# 2 - Channel 2 +# 4 - Channel 3 +# 8 - Channel 4 +# 100 - DirectSound A +# 200 - DirectSound B +# 30f=all enabled, 0=mute all +soundEnable=30f + +# Controls automatic SGB border +# 0=disable, anything else enables automatic SGB border display +borderAutomatic=0 + +# Skip bios code +# 0=disable, anything else skips BIOS code +skipBios=0 + +# The interval between the rewind saves +# Minimum of 0 seconds to disable rewind support, +# Maximum of 60 minutes. Value in seconds (hexadecimal numbers) +rewindTimer=0 + +# Enable enhanced save type detection +# 0=disable, anything else to enable (no longer used) +#enhancedDetection=1 diff --git a/src/admame.cpp b/src/admame.cpp new file mode 100644 index 0000000..bdde667 --- /dev/null +++ b/src/admame.cpp @@ -0,0 +1,1010 @@ +/* + * This file is part of the Advance project. + * + * Copyright (C) 1999-2002 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * In addition, as a special exception, Andrea Mazzoleni + * gives permission to link the code of this program with + * the MAME library (or with modified versions of MAME that use the + * same license as MAME), and distribute linked combinations including + * the two. You must obey the GNU General Public License in all + * respects for all of the code used other than MAME. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + +/* + * Alternatively at the previous license terms, you are allowed to use this + * code in your program with these conditions: + * - the program is not used in commercial activities. + * - the whole source code of the program is released with the binary. + */ + +#include "System.h" + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif + +static void internal_scale2x_16_def(u16 *dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) { + /* first pixel */ + dst[0] = src1[0]; + if (src1[1] == src0[0] && src2[0] != src0[0]) + dst[1] = src0[0]; + else + dst[1] = src1[0]; + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src1[-1] == src0[0] && src2[0] != src0[0]) + dst[0] = src0[0]; + else + dst[0] = src1[0]; + dst[1] = src1[0]; +} + +static void internal_scale2x_32_def(u32* dst, + const u32* src0, + const u32* src1, + const u32* src2, + unsigned count) +{ + /* first pixel */ + dst[0] = src1[0]; + if (src1[1] == src0[0] && src2[0] != src0[0]) + dst[1] = src0[0]; + else + dst[1] = src1[0]; + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src1[-1] == src0[0] && src2[0] != src0[0]) + dst[0] = src0[0]; + else + dst[0] = src1[0]; + dst[1] = src1[0]; +} + +#ifdef MMX +static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* src1, const u16* src2, unsigned count) { + /* always do the first and last run */ + count -= 2*4; + +#ifdef __GNUC__ + __asm__ __volatile__( + /* first run */ + /* set the current, current_pre, current_next registers */ + "movq 0(%1), %%mm0\n" + "movq 0(%1),%%mm7\n" + "movq 8(%1),%%mm1\n" + "psllq $48,%%mm0\n" + "psllq $48,%%mm1\n" + "psrlq $48, %%mm0\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $16,%%mm2\n" + "psrlq $16,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqw %%mm6,%%mm2\n" + "pcmpeqw %%mm6,%%mm4\n" + "pcmpeqw (%2),%%mm3\n" + "pcmpeqw (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqw %%mm1,%%mm2\n" + "pcmpeqw %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpcklwd %%mm4,%%mm2\n" + "punpckhwd %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3,8(%3)\n" + + /* next */ + "addl $8,%0\n" + "addl $8,%1\n" + "addl $8,%2\n" + "addl $16,%3\n" + + /* central runs */ + "shrl $2,%4\n" + "jz 1f\n" + + "0:\n" + + /* set the current, current_pre, current_next registers */ + "movq -8(%1),%%mm0\n" + "movq (%1),%%mm7\n" + "movq 8(%1),%%mm1\n" + "psrlq $48,%%mm0\n" + "psllq $48,%%mm1\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $16,%%mm2\n" + "psrlq $16,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqw %%mm6,%%mm2\n" + "pcmpeqw %%mm6,%%mm4\n" + "pcmpeqw (%2),%%mm3\n" + "pcmpeqw (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqw %%mm1,%%mm2\n" + "pcmpeqw %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpcklwd %%mm4,%%mm2\n" + "punpckhwd %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3,8(%3)\n" + + /* next */ + "addl $8,%0\n" + "addl $8,%1\n" + "addl $8,%2\n" + "addl $16,%3\n" + + "decl %4\n" + "jnz 0b\n" + "1:\n" + + /* final run */ + /* set the current, current_pre, current_next registers */ + "movq (%1),%%mm1\n" + "movq (%1),%%mm7\n" + "movq -8(%1),%%mm0\n" + "psrlq $48,%%mm1\n" + "psrlq $48,%%mm0\n" + "psllq $48,%%mm1\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $16,%%mm2\n" + "psrlq $16,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqw %%mm6,%%mm2\n" + "pcmpeqw %%mm6,%%mm4\n" + "pcmpeqw (%2),%%mm3\n" + "pcmpeqw (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqw %%mm1,%%mm2\n" + "pcmpeqw %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpcklwd %%mm4,%%mm2\n" + "punpckhwd %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3,8(%3)\n" + "emms\n" + + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count) + : + : "cc" + ); +#else + __asm { + mov eax, src0; + mov ebx, src1; + mov ecx, src2; + mov edx, dst; + mov esi, count; + + /* first run */ + /* set the current, current_pre, current_next registers */ + movq mm0, qword ptr [ebx]; + movq mm7, qword ptr [ebx]; + movq mm1, qword ptr [ebx + 8]; + psllq mm0, 48; + psllq mm1, 48; + psrlq mm0, 48; + movq mm2, mm7; + movq mm3, mm7; + psllq mm2, 16; + psrlq mm3, 16; + por mm0, mm2; + por mm1, mm3; + + /* current_upper */ + movq mm6, qword ptr [eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2, mm0; + movq mm4, mm1; + movq mm3, mm0; + movq mm5, mm1; + pcmpeqw mm2, mm6; + pcmpeqw mm4, mm6; + pcmpeqw mm3, qword ptr [ecx]; + pcmpeqw mm5, qword ptr [ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqw mm2,mm1; + pcmpeqw mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst0 */ + movq mm3,mm2; + punpcklwd mm2,mm4; + punpckhwd mm3,mm4; + movq qword ptr [edx], mm2; + movq qword ptr [edx + 8], mm3; + + /* next */ + add eax, 8; + add ebx, 8; + add ecx, 8; + add edx, 16; + + /* central runs */ + shr esi, 2; + jz label1; + align 4; + label0: + + /* set the current, current_pre, current_next registers */ + movq mm0, qword ptr [ebx-8]; + movq mm7, qword ptr [ebx]; + movq mm1, qword ptr [ebx+8]; + psrlq mm0,48; + psllq mm1,48; + movq mm2,mm7; + movq mm3,mm7; + psllq mm2,16; + psrlq mm3,16; + por mm0,mm2; + por mm1,mm3; + + /* current_upper */ + movq mm6, qword ptr [eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2,mm0; + movq mm4,mm1; + movq mm3,mm0; + movq mm5,mm1; + pcmpeqw mm2,mm6; + pcmpeqw mm4,mm6; + pcmpeqw mm3, qword ptr [ecx]; + pcmpeqw mm5, qword ptr [ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqw mm2,mm1; + pcmpeqw mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst */ + movq mm3,mm2; + punpcklwd mm2,mm4; + punpckhwd mm3,mm4; + movq qword ptr [edx], mm2; + movq qword ptr [edx+8], mm3; + + /* next */ + add eax,8; + add ebx,8; + add ecx,8; + add edx,16; + + dec esi; + jnz label0; + label1: + + /* final run */ + /* set the current, current_pre, current_next registers */ + movq mm1, qword ptr [ebx]; + movq mm7, qword ptr [ebx]; + movq mm0, qword ptr [ebx-8]; + psrlq mm1,48; + psrlq mm0,48; + psllq mm1,48; + movq mm2,mm7; + movq mm3,mm7; + psllq mm2,16; + psrlq mm3,16; + por mm0,mm2; + por mm1,mm3; + + /* current_upper */ + movq mm6, qword ptr [eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2,mm0; + movq mm4,mm1; + movq mm3,mm0; + movq mm5,mm1; + pcmpeqw mm2,mm6; + pcmpeqw mm4,mm6; + pcmpeqw mm3, qword ptr [ecx]; + pcmpeqw mm5, qword ptr [ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqw mm2,mm1; + pcmpeqw mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst */ + movq mm3,mm2; + punpcklwd mm2,mm4; + punpckhwd mm3,mm4; + movq qword ptr [edx], mm2; + movq qword ptr [edx+8], mm3; + + mov src0, eax; + mov src1, ebx; + mov src2, ecx; + mov dst, edx; + mov count, esi; + + emms; + } +#endif +} + +static void internal_scale2x_32_mmx_single(u32* dst, const u32* src0, const u32* src1, const u32* src2, unsigned count) { + /* always do the first and last run */ + count -= 2*2; + +#ifdef __GNUC__ + __asm__ __volatile__( + /* first run */ + /* set the current, current_pre, current_next registers */ + "movq 0(%1),%%mm0\n" + "movq 0(%1),%%mm7\n" + "movq 8(%1),%%mm1\n" + "psllq $32,%%mm0\n" + "psllq $32,%%mm1\n" + "psrlq $32,%%mm0\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $32,%%mm2\n" + "psrlq $32,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqd %%mm6,%%mm2\n" + "pcmpeqd %%mm6,%%mm4\n" + "pcmpeqd (%2),%%mm3\n" + "pcmpeqd (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqd %%mm1,%%mm2\n" + "pcmpeqd %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpckldq %%mm4,%%mm2\n" + "punpckhdq %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8,%0\n" + "addl $8,%1\n" + "addl $8,%2\n" + "addl $16,%3\n" + + /* central runs */ + "shrl $1,%4\n" + "jz 1f\n" + + "0:\n" + + /* set the current, current_pre, current_next registers */ + "movq -8(%1),%%mm0\n" + "movq (%1),%%mm7\n" + "movq 8(%1),%%mm1\n" + "psrlq $32,%%mm0\n" + "psllq $32,%%mm1\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $32,%%mm2\n" + "psrlq $32,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqd %%mm6,%%mm2\n" + "pcmpeqd %%mm6,%%mm4\n" + "pcmpeqd (%2),%%mm3\n" + "pcmpeqd (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqd %%mm1,%%mm2\n" + "pcmpeqd %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpckldq %%mm4,%%mm2\n" + "punpckhdq %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3,8(%3)\n" + + /* next */ + "addl $8,%0\n" + "addl $8,%1\n" + "addl $8,%2\n" + "addl $16,%3\n" + + "decl %4\n" + "jnz 0b\n" + "1:\n" + + /* final run */ + /* set the current, current_pre, current_next registers */ + "movq (%1),%%mm1\n" + "movq (%1),%%mm7\n" + "movq -8(%1), %%mm0\n" + "psrlq $32,%%mm1\n" + "psrlq $32,%%mm0\n" + "psllq $32,%%mm1\n" + "movq %%mm7,%%mm2\n" + "movq %%mm7,%%mm3\n" + "psllq $32,%%mm2\n" + "psrlq $32,%%mm3\n" + "por %%mm2,%%mm0\n" + "por %%mm3,%%mm1\n" + + /* current_upper */ + "movq (%0),%%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "movq %%mm0,%%mm3\n" + "movq %%mm1,%%mm5\n" + "pcmpeqd %%mm6,%%mm2\n" + "pcmpeqd %%mm6,%%mm4\n" + "pcmpeqd (%2),%%mm3\n" + "pcmpeqd (%2),%%mm5\n" + "pandn %%mm2,%%mm3\n" + "pandn %%mm4,%%mm5\n" + "movq %%mm0,%%mm2\n" + "movq %%mm1,%%mm4\n" + "pcmpeqd %%mm1,%%mm2\n" + "pcmpeqd %%mm0,%%mm4\n" + "pandn %%mm3,%%mm2\n" + "pandn %%mm5,%%mm4\n" + "movq %%mm2,%%mm3\n" + "movq %%mm4,%%mm5\n" + "pand %%mm6,%%mm2\n" + "pand %%mm6,%%mm4\n" + "pandn %%mm7,%%mm3\n" + "pandn %%mm7,%%mm5\n" + "por %%mm3,%%mm2\n" + "por %%mm5,%%mm4\n" + + /* set *dst */ + "movq %%mm2,%%mm3\n" + "punpckldq %%mm4,%%mm2\n" + "punpckhdq %%mm4,%%mm3\n" + "movq %%mm2,(%3)\n" + "movq %%mm3,8(%3)\n" + "emms\n" + + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count) + : + : "cc" + ); +#else + __asm { + mov eax, src0; + mov ebx, src1; + mov ecx, src2; + mov edx, dst; + mov esi, count; + + /* first run */ + /* set the current, current_pre, current_next registers */ + movq mm0,qword ptr [ebx]; + movq mm7,qword ptr [ebx]; + movq mm1,qword ptr [ebx + 8]; + psllq mm0,32; + psllq mm1,32; + psrlq mm0,32; + movq mm2,mm7; + movq mm3,mm7; + psllq mm2,32; + psrlq mm3,32; + por mm0,mm2; + por mm1,mm3; + + /* current_upper */ + movq mm6,qword ptr [eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2,mm0; + movq mm4,mm1; + movq mm3,mm0; + movq mm5,mm1; + pcmpeqd mm2,mm6; + pcmpeqd mm4,mm6; + pcmpeqd mm3,qword ptr [ecx]; + pcmpeqd mm5,qword ptr [ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqd mm2,mm1; + pcmpeqd mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst */ + movq mm3,mm2; + punpckldq mm2,mm4; + punpckhdq mm3,mm4; + movq qword ptr [edx],mm2; + movq qword ptr [edx+8],mm3; + + /* next */ + add eax,8; + add ebx,8; + add ecx,8; + add edx,16; + + /* central runs */ + shr esi,1; + jz label1; +label0: + + /* set the current, current_pre, current_next registers */ + movq mm0,qword ptr [ebx-8]; + movq mm7,qword ptr [ebx]; + movq mm1,qword ptr [ebx+8]; + psrlq mm0,32; + psllq mm1,32; + movq mm2,mm7; + movq mm3,mm7; + psllq mm2,32; + psrlq mm3,32; + por mm0,mm2; + por mm1,mm3; + + /* current_upper */ + movq mm6,qword ptr[eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2,mm0; + movq mm4,mm1; + movq mm3,mm0; + movq mm5,mm1; + pcmpeqd mm2,mm6; + pcmpeqd mm4,mm6; + pcmpeqd mm3,qword ptr[ecx]; + pcmpeqd mm5,qword ptr[ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqd mm2,mm1; + pcmpeqd mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst */ + movq mm3,mm2; + punpckldq mm2,mm4; + punpckhdq mm3,mm4; + movq qword ptr [edx],mm2; + movq qword ptr [edx+8],mm3; + + /* next */ + add eax,8; + add ebx,8; + add ecx,8; + add edx,16; + + dec esi; + jnz label0; +label1: + + /* final run */ + /* set the current, current_pre, current_next registers */ + movq mm1,qword ptr [ebx]; + movq mm7,qword ptr [ebx]; + movq mm0,qword ptr [ebx-8]; + psrlq mm1,32; + psrlq mm0,32; + psllq mm1,32; + movq mm2,mm7; + movq mm3,mm7; + psllq mm2,32; + psrlq mm3,32; + por mm0,mm2; + por mm1,mm3; + + /* current_upper */ + movq mm6,qword ptr [eax]; + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + movq mm2,mm0; + movq mm4,mm1; + movq mm3,mm0; + movq mm5,mm1; + pcmpeqd mm2,mm6; + pcmpeqd mm4,mm6; + pcmpeqd mm3,qword ptr [ecx]; + pcmpeqd mm5,qword ptr [ecx]; + pandn mm3,mm2; + pandn mm5,mm4; + movq mm2,mm0; + movq mm4,mm1; + pcmpeqd mm2,mm1; + pcmpeqd mm4,mm0; + pandn mm2,mm3; + pandn mm4,mm5; + movq mm3,mm2; + movq mm5,mm4; + pand mm2,mm6; + pand mm4,mm6; + pandn mm3,mm7; + pandn mm5,mm7; + por mm2,mm3; + por mm4,mm5; + + /* set *dst */ + movq mm3,mm2; + punpckldq mm2,mm4; + punpckhdq mm3,mm4; + movq qword ptr [edx],mm2; + movq qword ptr [edx+8],mm3; + + mov src0, eax; + mov src1, ebx; + mov src2, ecx; + mov dst, edx; + mov count, esi; + + emms; + } +#endif +} + +static void internal_scale2x_16_mmx(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) { + // assert( count >= 2*4 ); + internal_scale2x_16_mmx_single(dst0, src0, src1, src2, count); + internal_scale2x_16_mmx_single(dst1, src2, src1, src0, count); +} + +static void internal_scale2x_32_mmx(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count) { + // assert( count >= 2*2 ); + internal_scale2x_32_mmx_single(dst0, src0, src1, src2, count); + internal_scale2x_32_mmx_single(dst1, src2, src1, src0, count); +} +#endif + +void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u16 *dst0 = (u16 *)dstPtr; + u16 *dst1 = dst0 + (dstPitch >> 1); + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = src0 + (srcPitch >> 1); + u16 *src2 = src1 + (srcPitch >> 1); +#ifdef MMX + if(cpu_mmx) { + internal_scale2x_16_mmx(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch; + dst1 += dstPitch; + internal_scale2x_16_mmx(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 1; + --count; + } + dst0 += dstPitch; + dst1 += dstPitch; + internal_scale2x_16_mmx(dst0, dst1, src0, src1, src1, width); + } else { +#endif + internal_scale2x_16_def(dst0, src0, src0, src1, width); + internal_scale2x_16_def(dst1, src1, src0, src0, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch; + dst1 += dstPitch; + internal_scale2x_16_def(dst0, src0, src1, src2, width); + internal_scale2x_16_def(dst1, src2, src1, src0, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 1; + --count; + } + dst0 += dstPitch; + dst1 += dstPitch; + internal_scale2x_16_def(dst0, src0, src1, src1, width); + internal_scale2x_16_def(dst1, src1, src1, src0, width); +#ifdef MMX + } +#endif +} + +void AdMame2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dst0 = (u32 *)dstPtr; + u32 *dst1 = dst0 + (dstPitch >> 2); + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = src0 + (srcPitch >> 2); + u32 *src2 = src1 + (srcPitch >> 2); +#ifdef MMX + if(cpu_mmx) { + internal_scale2x_32_mmx(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + internal_scale2x_32_mmx(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 2; + --count; + } + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + internal_scale2x_32_mmx(dst0, dst1, src0, src1, src1, width); + } else { +#endif + internal_scale2x_32_def(dst0, src0, src0, src1, width); + internal_scale2x_32_def(dst1, src1, src0, src0, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + internal_scale2x_32_def(dst0, src0, src1, src2, width); + internal_scale2x_32_def(dst1, src2, src1, src0, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 2; + --count; + } + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + internal_scale2x_32_def(dst0, src0, src1, src1, width); + internal_scale2x_32_def(dst1, src1, src1, src0, width); +#ifdef MMX + } +#endif +} diff --git a/src/agbprint.cpp b/src/agbprint.cpp new file mode 100644 index 0000000..301c671 --- /dev/null +++ b/src/agbprint.cpp @@ -0,0 +1,99 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include + +#include "GBA.h" +#include "Globals.h" +#include "Port.h" + +#define debuggerWriteHalfWord(addr, value) \ + WRITE16LE((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], (value)) + +#define debuggerReadHalfWord(addr) \ + READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +static bool agbPrintEnabled = false; +static bool agbPrintProtect = false; + +bool agbPrintWrite(u32 address, u16 value) +{ + if(agbPrintEnabled) { + if(address == 0x9fe2ffe) { // protect + agbPrintProtect = (value != 0); + debuggerWriteHalfWord(address, value); + return true; + } else { + if(agbPrintProtect && + ((address >= 0x9fe20f8 && address <= 0x9fe20ff) // control structure + || (address >= 0x8fd0000 && address <= 0x8fdffff) + || (address >= 0x9fd0000 && address <= 0x9fdffff))) { + debuggerWriteHalfWord(address, value); + return true; + } + } + } + return false; +} + +void agbPrintReset() +{ + agbPrintProtect = false; +} + +void agbPrintEnable(bool enable) +{ + agbPrintEnabled = enable; +} + +bool agbPrintIsEnabled() +{ + return agbPrintEnabled; +} + +extern void (*dbgOutput)(char *, u32); + +void agbPrintFlush() +{ + u16 get = debuggerReadHalfWord(0x9fe20fc); + u16 put = debuggerReadHalfWord(0x9fe20fe); + + u32 address = (debuggerReadHalfWord(0x9fe20fa) << 16); + if(address != 0xfd0000 && address != 0x1fd0000) { + dbgOutput("Did you forget to call AGBPrintInit?\n", 0); + // get rid of the text otherwise we will continue to be called + debuggerWriteHalfWord(0x9fe20fc, put); + return; + } + + u8 *data = &rom[address]; + + while(get != put) { + char c = data[get++]; + char s[2]; + s[0] = c; + s[1] = 0; + + if(systemVerbose & VERBOSE_AGBPRINT) + dbgOutput(s, 0); + if(c == '\n') + break; + } + debuggerWriteHalfWord(0x9fe20fc, get); +} diff --git a/src/agbprint.h b/src/agbprint.h new file mode 100644 index 0000000..d7742de --- /dev/null +++ b/src/agbprint.h @@ -0,0 +1,27 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_AGBPRINT_H +#define VBA_AGBPRINT_H +extern void agbPrintEnable(bool); +extern bool agbPrintIsEnabled(); +extern void agbPrintReset(); +extern bool agbPrintWrite(u32, u16); +extern void agbPrintFlush(); +#endif diff --git a/src/arm-new.h b/src/arm-new.h new file mode 100644 index 0000000..8dee998 --- /dev/null +++ b/src/arm-new.h @@ -0,0 +1,7164 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifdef BKPT_SUPPORT +#define CONSOLE_OUTPUT(a,b) \ + extern void (*dbgOutput)(char *, u32);\ + if((opcode == 0xe0000000) && (reg[0].I == 0xC0DED00D)) {\ + dbgOutput((a), (b));\ + } +#else +#define CONSOLE_OUTPUT(a,b) +#endif + +#define OP_AND \ + reg[dest].I = reg[(opcode>>16)&15].I & value;\ + CONSOLE_OUTPUT(NULL,reg[2].I); + +#define OP_ANDS \ + reg[dest].I = reg[(opcode>>16)&15].I & value;\ + \ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_EOR \ + reg[dest].I = reg[(opcode>>16)&15].I ^ value; + +#define OP_EORS \ + reg[dest].I = reg[(opcode>>16)&15].I ^ value;\ + \ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; +#ifdef C_CORE +#define NEG(i) ((i) >> 31) +#define POS(i) ((~(i)) >> 31) +#define ADDCARRY(a, b, c) \ + C_FLAG = ((NEG(a) & NEG(b)) |\ + (NEG(a) & POS(c)) |\ + (NEG(b) & POS(c))) ? true : false; +#define ADDOVERFLOW(a, b, c) \ + V_FLAG = ((NEG(a) & NEG(b) & POS(c)) |\ + (POS(a) & POS(b) & NEG(c))) ? true : false; +#define SUBCARRY(a, b, c) \ + C_FLAG = ((NEG(a) & POS(b)) |\ + (NEG(a) & POS(c)) |\ + (POS(b) & POS(c))) ? true : false; +#define SUBOVERFLOW(a, b, c)\ + V_FLAG = ((NEG(a) & POS(b) & POS(c)) |\ + (POS(a) & NEG(b) & NEG(c))) ? true : false; +#define OP_SUB \ + {\ + reg[dest].I = reg[base].I - value;\ + } +#define OP_SUBS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define OP_RSB \ + {\ + reg[dest].I = value - reg[base].I;\ + } +#define OP_RSBS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = rhs - lhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(rhs, lhs, res);\ + SUBOVERFLOW(rhs, lhs, res);\ + } +#define OP_ADD \ + {\ + reg[dest].I = reg[base].I + value;\ + } +#define OP_ADDS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define OP_ADC \ + {\ + reg[dest].I = reg[base].I + value + (u32)C_FLAG;\ + } +#define OP_ADCS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs + (u32)C_FLAG;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define OP_SBC \ + {\ + reg[dest].I = reg[base].I - value - !((u32)C_FLAG);\ + } +#define OP_SBCS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs - !((u32)C_FLAG);\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define OP_RSC \ + {\ + reg[dest].I = value - reg[base].I - !((u32)C_FLAG);\ + } +#define OP_RSCS \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = rhs - lhs - !((u32)C_FLAG);\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(rhs, lhs, res);\ + SUBOVERFLOW(rhs, lhs, res);\ + } +#define OP_CMP \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define OP_CMN \ + {\ + u32 lhs = reg[base].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } + +#define LOGICAL_LSL_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (32 - shift)) & 1 ? true : false;\ + value = v << shift;\ + } +#define LOGICAL_LSR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = v >> shift;\ + } +#define LOGICAL_ASR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = ((s32)v >> (int)(shift - 1)) & 1 ? true : false;\ + value = (s32)v >> (int)shift;\ + } +#define LOGICAL_ROR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } +#define LOGICAL_RRX_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + shift = (int)C_FLAG;\ + C_OUT = (v & 1) ? true : false;\ + value = ((v >> 1) |\ + (shift << 31));\ + } +#define LOGICAL_ROR_IMM \ + {\ + u32 v = opcode & 0xff;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } +#define ARITHMETIC_LSL_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = v << shift;\ + } +#define ARITHMETIC_LSR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = v >> shift;\ + } +#define ARITHMETIC_ASR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = (s32)v >> (int)shift;\ + } +#define ARITHMETIC_ROR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } +#define ARITHMETIC_RRX_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + shift = (int)C_FLAG;\ + value = ((v >> 1) |\ + (shift << 31));\ + } +#define ARITHMETIC_ROR_IMM \ + {\ + u32 v = opcode & 0xff;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } +#define ROR_IMM_MSR \ + {\ + u32 v = opcode & 0xff;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } +#define ROR_VALUE \ + {\ + value = ((value << (32 - shift)) |\ + (value >> shift));\ + } +#define RCR_VALUE \ + {\ + shift = (int)C_FLAG;\ + value = ((value >> 1) |\ + (shift << 31));\ + } +#else +#ifdef __GNUC__ + #ifdef __POWERPC__ + #define OP_SUB \ + {\ + reg[dest].I = reg[base].I - value;\ + } + #define OP_SUBS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_RSB \ + {\ + reg[dest].I = value - reg[base].I;\ + } + #define OP_RSBS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subfco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_ADD \ + {\ + reg[dest].I = reg[base].I + value;\ + } + + #define OP_ADDS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("addco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_ADC \ + {\ + reg[dest].I = reg[base].I + value + (u32)C_FLAG;\ + } + #define OP_ADCS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("mtspr xer, %4\n" \ + "addeo. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value), \ + "r" (C_FLAG << 29) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_SBC \ + {\ + reg[dest].I = reg[base].I - value - (C_FLAG^1);\ + } + #define OP_SBCS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("mtspr xer, %4\n" \ + "subfeo. %0, %3, %2\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value), \ + "r" (C_FLAG << 29) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_RSC \ + {\ + reg[dest].I = value - reg[base].I - (C_FLAG^1);\ + } + #define OP_RSCS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("mtspr xer, %4\n" \ + "subfeo. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value), \ + "r" (C_FLAG << 29) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_CMP \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value) \ + ); \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define OP_CMN \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("addco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[base].I), \ + "r" (value) \ + ); \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + + #define LOGICAL_LSL_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (32 - shift)) & 1 ? true : false;\ + value = v << shift;\ + } + #define LOGICAL_LSR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = v >> shift;\ + } + #define LOGICAL_ASR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = ((s32)v >> (int)(shift - 1)) & 1 ? true : false;\ + value = (s32)v >> (int)shift;\ + } + #define LOGICAL_ROR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } + #define LOGICAL_RRX_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + shift = (int)C_FLAG;\ + C_OUT = (v & 1) ? true : false;\ + value = ((v >> 1) |\ + (shift << 31));\ + } + #define LOGICAL_ROR_IMM \ + {\ + u32 v = opcode & 0xff;\ + C_OUT = (v >> (shift - 1)) & 1 ? true : false;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } + #define ARITHMETIC_LSL_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = v << shift;\ + } + #define ARITHMETIC_LSR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = v >> shift;\ + } + #define ARITHMETIC_ASR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = (s32)v >> (int)shift;\ + } + #define ARITHMETIC_ROR_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } + #define ARITHMETIC_RRX_REG \ + {\ + u32 v = reg[opcode & 0x0f].I;\ + shift = (int)C_FLAG;\ + value = ((v >> 1) |\ + (shift << 31));\ + } + #define ARITHMETIC_ROR_IMM \ + {\ + u32 v = opcode & 0xff;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } + #define ROR_IMM_MSR \ + {\ + u32 v = opcode & 0xff;\ + value = ((v << (32 - shift)) |\ + (v >> shift));\ + } + #define ROR_VALUE \ + {\ + value = ((value << (32 - shift)) |\ + (value >> shift));\ + } + #define RCR_VALUE \ + {\ + shift = (int)C_FLAG;\ + value = ((value >> 1) |\ + (shift << 31));\ + } +#else +#define OP_SUB \ + asm ("sub %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_SUBS \ + asm ("sub %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_RSB \ + asm ("sub %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (reg[base].I), "b" (value)); + +#define OP_RSBS \ + asm ("sub %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (reg[base].I), "b" (value)); + +#define OP_ADD \ + asm ("add %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_ADDS \ + asm ("add %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_ADC \ + asm ("bt $0, C_FLAG;"\ + "adc %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_ADCS \ + asm ("bt $0, C_FLAG;"\ + "adc %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_SBC \ + asm ("bt $0, C_FLAG;"\ + "cmc;"\ + "sbb %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); + +#define OP_SBCS \ + asm ("bt $0, C_FLAG;"\ + "cmc;"\ + "sbb %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[base].I)); +#define OP_RSC \ + asm ("bt $0, C_FLAG;"\ + "cmc;"\ + "sbb %1, %%ebx;"\ + : "=b" (reg[dest].I)\ + : "r" (reg[base].I), "b" (value)); + +#define OP_RSCS \ + asm ("bt $0, C_FLAG;"\ + "cmc;"\ + "sbb %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (reg[base].I), "b" (value)); +#define OP_CMP \ + asm ("sub %0, %1;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + :\ + : "r" (value), "r" (reg[base].I)); + +#define OP_CMN \ + asm ("add %0, %1;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : \ + : "r" (value), "r" (reg[base].I)); +#define LOGICAL_LSL_REG \ + asm("shl %%cl, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define LOGICAL_LSR_REG \ + asm("shr %%cl, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define LOGICAL_ASR_REG \ + asm("sar %%cl, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define LOGICAL_ROR_REG \ + asm("ror %%cl, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define LOGICAL_RRX_REG \ + asm("bt $0, C_FLAG;"\ + "rcr $1, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (reg[opcode & 0x0f].I)); + +#define LOGICAL_ROR_IMM \ + asm("ror %%cl, %%eax;"\ + "setcb %%cl;"\ + : "=a" (value), "=c" (C_OUT)\ + : "a" (opcode & 0xff), "c" (shift)); +#define ARITHMETIC_LSL_REG \ + asm("\ + shl %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define ARITHMETIC_LSR_REG \ + asm("\ + shr %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define ARITHMETIC_ASR_REG \ + asm("\ + sar %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define ARITHMETIC_ROR_REG \ + asm("\ + ror %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (reg[opcode & 0x0f].I), "c" (shift)); + +#define ARITHMETIC_RRX_REG \ + asm("\ + bt $0, C_FLAG;\ + rcr $1, %%eax;"\ + : "=a" (value)\ + : "a" (reg[opcode & 0x0f].I)); + +#define ARITHMETIC_ROR_IMM \ + asm("\ + ror %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (opcode & 0xff), "c" (shift)); +#define ROR_IMM_MSR \ + asm ("ror %%cl, %%eax;"\ + : "=a" (value)\ + : "a" (opcode & 0xFF), "c" (shift)); +#define ROR_VALUE \ + asm("ror %%cl, %0"\ + : "=r" (value)\ + : "r" (value), "c" (shift)); +#define RCR_VALUE \ + asm("bt $0, C_FLAG;"\ + "rcr $1, %0"\ + : "=r" (value)\ + : "r" (value)); +#endif +#else +#define OP_SUB \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm sub ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + } + +#define OP_SUBS \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm sub ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } + +#define OP_RSB \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm mov eax, value\ + __asm sub eax, ebx\ + __asm mov ebx, dest\ + __asm mov dword ptr [OFFSET reg+4*ebx], eax\ + } + +#define OP_RSBS \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm mov eax, value\ + __asm sub eax, ebx\ + __asm mov ebx, dest\ + __asm mov dword ptr [OFFSET reg+4*ebx], eax\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } + +#define OP_ADD \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm add ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + } + +#define OP_ADDS \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm add ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } + +#define OP_ADC \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm bt word ptr C_FLAG, 0\ + __asm adc ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + } + +#define OP_ADCS \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm bt word ptr C_FLAG, 0\ + __asm adc ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } + +#define OP_SBC \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg + 4*ebx]\ + __asm mov eax, value\ + __asm bt word ptr C_FLAG, 0\ + __asm cmc\ + __asm sbb ebx, eax\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg + 4*eax], ebx\ + } + +#define OP_SBCS \ + {\ + __asm mov ebx, base\ + __asm mov ebx, dword ptr [OFFSET reg + 4*ebx]\ + __asm mov eax, value\ + __asm bt word ptr C_FLAG, 0\ + __asm cmc\ + __asm sbb ebx, eax\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg + 4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define OP_RSC \ + {\ + __asm mov ebx, value\ + __asm mov eax, base\ + __asm mov eax, dword ptr[OFFSET reg + 4*eax]\ + __asm bt word ptr C_FLAG, 0\ + __asm cmc\ + __asm sbb ebx, eax\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg + 4*eax], ebx\ + } + +#define OP_RSCS \ + {\ + __asm mov ebx, value\ + __asm mov eax, base\ + __asm mov eax, dword ptr[OFFSET reg + 4*eax]\ + __asm bt word ptr C_FLAG, 0\ + __asm cmc\ + __asm sbb ebx, eax\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg + 4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define OP_CMP \ + {\ + __asm mov eax, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm sub ebx, value\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } + +#define OP_CMN \ + {\ + __asm mov eax, base\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm add ebx, value\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define LOGICAL_LSL_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shl eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT + +#define LOGICAL_LSR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shr eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT + +#define LOGICAL_ASR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm sar eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT + +#define LOGICAL_ROR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0F\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm mov cl, byte ptr shift\ + __asm ror eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT + +#define LOGICAL_RRX_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0F\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm bt word ptr C_OUT, 0\ + __asm rcr eax, 1\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT + +#define LOGICAL_ROR_IMM \ + __asm mov eax, opcode\ + __asm and eax, 0xff\ + __asm mov cl, byte ptr shift\ + __asm ror eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_OUT +#define ARITHMETIC_LSL_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shl eax, cl\ + __asm mov value, eax + +#define ARITHMETIC_LSR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shr eax, cl\ + __asm mov value, eax + +#define ARITHMETIC_ASR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0f\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm sar eax, cl\ + __asm mov value, eax + +#define ARITHMETIC_ROR_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0F\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm mov cl, byte ptr shift\ + __asm ror eax, cl\ + __asm mov value, eax + +#define ARITHMETIC_RRX_REG \ + __asm mov eax, opcode\ + __asm and eax, 0x0F\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm bt word ptr C_FLAG, 0\ + __asm rcr eax, 1\ + __asm mov value, eax + +#define ARITHMETIC_ROR_IMM \ + __asm mov eax, opcode\ + __asm and eax, 0xff\ + __asm mov cl, byte ptr shift\ + __asm ror eax, cl\ + __asm mov value, eax +#define ROR_IMM_MSR \ + {\ + __asm mov eax, opcode\ + __asm and eax, 0xff\ + __asm mov cl, byte ptr shift\ + __asm ror eax, CL\ + __asm mov value, eax\ + } +#define ROR_VALUE \ + {\ + __asm mov cl, byte ptr shift\ + __asm ror dword ptr value, cl\ + } +#define RCR_VALUE \ + {\ + __asm mov cl, byte ptr shift\ + __asm bt word ptr C_FLAG, 0\ + __asm rcr dword ptr value, 1\ + } +#endif +#endif + +#define OP_TST \ + u32 res = reg[base].I & value;\ + N_FLAG = (res & 0x80000000) ? true : false;\ + Z_FLAG = (res) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_TEQ \ + u32 res = reg[base].I ^ value;\ + N_FLAG = (res & 0x80000000) ? true : false;\ + Z_FLAG = (res) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_ORR \ + reg[dest].I = reg[base].I | value; + +#define OP_ORRS \ + reg[dest].I = reg[base].I | value;\ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_MOV \ + reg[dest].I = value; + +#define OP_MOVS \ + reg[dest].I = value;\ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_BIC \ + reg[dest].I = reg[base].I & (~value); + +#define OP_BICS \ + reg[dest].I = reg[base].I & (~value);\ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; + +#define OP_MVN \ + reg[dest].I = ~value; + +#define OP_MVNS \ + reg[dest].I = ~value; \ + N_FLAG = (reg[dest].I & 0x80000000) ? true : false;\ + Z_FLAG = (reg[dest].I) ? false : true;\ + C_FLAG = C_OUT; + +#define CASE_16(BASE) \ + case BASE:\ + case BASE+1:\ + case BASE+2:\ + case BASE+3:\ + case BASE+4:\ + case BASE+5:\ + case BASE+6:\ + case BASE+7:\ + case BASE+8:\ + case BASE+9:\ + case BASE+10:\ + case BASE+11:\ + case BASE+12:\ + case BASE+13:\ + case BASE+14:\ + case BASE+15: + +#define CASE_256(BASE) \ + CASE_16(BASE)\ + CASE_16(BASE+0x10)\ + CASE_16(BASE+0x20)\ + CASE_16(BASE+0x30)\ + CASE_16(BASE+0x40)\ + CASE_16(BASE+0x50)\ + CASE_16(BASE+0x60)\ + CASE_16(BASE+0x70)\ + CASE_16(BASE+0x80)\ + CASE_16(BASE+0x90)\ + CASE_16(BASE+0xa0)\ + CASE_16(BASE+0xb0)\ + CASE_16(BASE+0xc0)\ + CASE_16(BASE+0xd0)\ + CASE_16(BASE+0xe0)\ + CASE_16(BASE+0xf0) + +#define LOGICAL_DATA_OPCODE(OPCODE, OPCODE2, BASE) \ + case BASE: \ + case BASE+8:\ + {\ + /* OP Rd,Rb,Rm LSL # */ \ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + \ + if(shift) {\ + LOGICAL_LSL_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+2:\ + case BASE+10:\ + {\ + /* OP Rd,Rb,Rm LSR # */ \ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_LSR_REG\ + } else {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 0x80000000) ? true : false;\ + }\ + \ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+4:\ + case BASE+12:\ + {\ + /* OP Rd,Rb,Rm ASR # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ASR_REG\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + C_OUT = true;\ + } else {\ + value = 0;\ + C_OUT = false;\ + } \ + }\ + \ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+6:\ + case BASE+14:\ + {\ + /* OP Rd,Rb,Rm ROR # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ROR_REG\ + } else {\ + LOGICAL_RRX_REG\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+1:\ + {\ + /* OP Rd,Rb,Rm LSL Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 1 ? true : false);\ + } else if(shift < 32) {\ + LOGICAL_LSL_REG\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+3:\ + {\ + /* OP Rd,Rb,Rm LSR Rs */ \ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 0x80000000 ? true : false);\ + } else if(shift < 32) {\ + LOGICAL_LSR_REG\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+5:\ + {\ + /* OP Rd,Rb,Rm ASR Rs */ \ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift < 32) {\ + if(shift) {\ + LOGICAL_ASR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + C_OUT = true;\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+7:\ + {\ + /* OP Rd,Rb,Rm ROR Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + shift &= 0x1f;\ + if(shift) {\ + LOGICAL_ROR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + C_OUT = (value & 0x80000000 ? true : false);\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + C_OUT = (value & 0x80000000 ? true : false);\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+0x200:\ + case BASE+0x201:\ + case BASE+0x202:\ + case BASE+0x203:\ + case BASE+0x204:\ + case BASE+0x205:\ + case BASE+0x206:\ + case BASE+0x207:\ + case BASE+0x208:\ + case BASE+0x209:\ + case BASE+0x20a:\ + case BASE+0x20b:\ + case BASE+0x20c:\ + case BASE+0x20d:\ + case BASE+0x20e:\ + case BASE+0x20f:\ + {\ + int shift = (opcode & 0xF00) >> 7;\ + int base = (opcode >> 16) & 0x0F;\ + int dest = (opcode >> 12) & 0x0F;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ROR_IMM\ + } else {\ + value = opcode & 0xff;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break; + +#define LOGICAL_DATA_OPCODE_WITHOUT_base(OPCODE, OPCODE2, BASE) \ + case BASE: \ + case BASE+8:\ + {\ + /* OP Rd,Rb,Rm LSL # */ \ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + \ + if(shift) {\ + LOGICAL_LSL_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+2:\ + case BASE+10:\ + {\ + /* OP Rd,Rb,Rm LSR # */ \ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_LSR_REG\ + } else {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 0x80000000) ? true : false;\ + }\ + \ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+4:\ + case BASE+12:\ + {\ + /* OP Rd,Rb,Rm ASR # */\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ASR_REG\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + C_OUT = true;\ + } else {\ + value = 0;\ + C_OUT = false;\ + } \ + }\ + \ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+6:\ + case BASE+14:\ + {\ + /* OP Rd,Rb,Rm ROR # */\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ROR_REG\ + } else {\ + LOGICAL_RRX_REG\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+1:\ + {\ + /* OP Rd,Rb,Rm LSL Rs */\ + clockTicks++;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 1 ? true : false);\ + } else if(shift < 32) {\ + LOGICAL_LSL_REG\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+3:\ + {\ + /* OP Rd,Rb,Rm LSR Rs */ \ + clockTicks++;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + C_OUT = (reg[opcode & 0x0F].I & 0x80000000 ? true : false);\ + } else if(shift < 32) {\ + LOGICAL_LSR_REG\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+5:\ + {\ + /* OP Rd,Rb,Rm ASR Rs */ \ + clockTicks++;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift < 32) {\ + if(shift) {\ + LOGICAL_ASR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + C_OUT = true;\ + } else {\ + value = 0;\ + C_OUT = false;\ + }\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+7:\ + {\ + /* OP Rd,Rb,Rm ROR Rs */\ + clockTicks++;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + shift &= 0x1f;\ + if(shift) {\ + LOGICAL_ROR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + C_OUT = (value & 0x80000000 ? true : false);\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + C_OUT = (value & 0x80000000 ? true : false);\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+0x200:\ + case BASE+0x201:\ + case BASE+0x202:\ + case BASE+0x203:\ + case BASE+0x204:\ + case BASE+0x205:\ + case BASE+0x206:\ + case BASE+0x207:\ + case BASE+0x208:\ + case BASE+0x209:\ + case BASE+0x20a:\ + case BASE+0x20b:\ + case BASE+0x20c:\ + case BASE+0x20d:\ + case BASE+0x20e:\ + case BASE+0x20f:\ + {\ + int shift = (opcode & 0xF00) >> 7;\ + int dest = (opcode >> 12) & 0x0F;\ + bool C_OUT = C_FLAG;\ + u32 value;\ + if(shift) {\ + LOGICAL_ROR_IMM\ + } else {\ + value = opcode & 0xff;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break; + +#define ARITHMETIC_DATA_OPCODE(OPCODE, OPCODE2, BASE) \ + case BASE:\ + case BASE+8:\ + {\ + /* OP Rd,Rb,Rm LSL # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + ARITHMETIC_LSL_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+2:\ + case BASE+10:\ + {\ + /* OP Rd,Rb,Rm LSR # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + ARITHMETIC_LSR_REG\ + } else {\ + value = 0;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+4:\ + case BASE+12:\ + {\ + /* OP Rd,Rb,Rm ASR # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + ARITHMETIC_ASR_REG\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + } else value = 0;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+6:\ + case BASE+14:\ + {\ + /* OP Rd,Rb,Rm ROR # */\ + int base = (opcode >> 16) & 0x0F;\ + int shift = (opcode >> 7) & 0x1F;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + ARITHMETIC_ROR_REG\ + } else {\ + ARITHMETIC_RRX_REG\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+1:\ + {\ + /* OP Rd,Rb,Rm LSL Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + } else if(shift < 32) {\ + ARITHMETIC_LSL_REG\ + } else value = 0;\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+3:\ + {\ + /* OP Rd,Rb,Rm LSR Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + if(shift == 32) {\ + value = 0;\ + } else if(shift < 32) {\ + ARITHMETIC_LSR_REG\ + } else value = 0;\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+5:\ + {\ + /* OP Rd,Rb,Rm ASR Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift < 32) {\ + if(shift) {\ + ARITHMETIC_ASR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + } else {\ + if(reg[opcode & 0x0F].I & 0x80000000){\ + value = 0xFFFFFFFF;\ + } else value = 0;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+7:\ + {\ + /* OP Rd,Rb,Rm ROR Rs */\ + clockTicks++;\ + int base = (opcode >> 16) & 0x0F;\ + int shift = reg[(opcode >> 8)&15].B.B0;\ + int dest = (opcode>>12) & 15;\ + u32 value;\ + if(shift) {\ + shift &= 0x1f;\ + if(shift) {\ + ARITHMETIC_ROR_REG\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + } else {\ + value = reg[opcode & 0x0F].I;\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break;\ + case BASE+0x200:\ + case BASE+0x201:\ + case BASE+0x202:\ + case BASE+0x203:\ + case BASE+0x204:\ + case BASE+0x205:\ + case BASE+0x206:\ + case BASE+0x207:\ + case BASE+0x208:\ + case BASE+0x209:\ + case BASE+0x20a:\ + case BASE+0x20b:\ + case BASE+0x20c:\ + case BASE+0x20d:\ + case BASE+0x20e:\ + case BASE+0x20f:\ + {\ + int shift = (opcode & 0xF00) >> 7;\ + int base = (opcode >> 16) & 0x0F;\ + int dest = (opcode >> 12) & 0x0F;\ + u32 value;\ + {\ + ARITHMETIC_ROR_IMM\ + }\ + if(dest == 15) {\ + OPCODE2\ + /* todo */\ + if(opcode & 0x00100000) {\ + clockTicks++;\ + CPUSwitchMode(reg[17].I & 0x1f, false);\ + }\ + if(armState) {\ + reg[15].I &= 0xFFFFFFFC;\ + armNextPC = reg[15].I;\ + reg[15].I += 4;\ + } else {\ + reg[15].I &= 0xFFFFFFFE;\ + armNextPC = reg[15].I;\ + reg[15].I += 2;\ + }\ + } else {\ + OPCODE \ + }\ + }\ + break; + + u32 opcode = CPUReadMemoryQuick(armNextPC); + + clockTicks = memoryWaitFetch32[(armNextPC >> 24) & 15]; + +#ifndef FINAL_VERSION + if(armNextPC == stop) { + armNextPC++; + } +#endif + + armNextPC = reg[15].I; + reg[15].I += 4; + int cond = opcode >> 28; + // suggested optimization for frequent cases + bool cond_res; + if(cond == 0x0e) { + cond_res = true; + } else { + switch(cond) { + case 0x00: // EQ + cond_res = Z_FLAG; + break; + case 0x01: // NE + cond_res = !Z_FLAG; + break; + case 0x02: // CS + cond_res = C_FLAG; + break; + case 0x03: // CC + cond_res = !C_FLAG; + break; + case 0x04: // MI + cond_res = N_FLAG; + break; + case 0x05: // PL + cond_res = !N_FLAG; + break; + case 0x06: // VS + cond_res = V_FLAG; + break; + case 0x07: // VC + cond_res = !V_FLAG; + break; + case 0x08: // HI + cond_res = C_FLAG && !Z_FLAG; + break; + case 0x09: // LS + cond_res = !C_FLAG || Z_FLAG; + break; + case 0x0A: // GE + cond_res = N_FLAG == V_FLAG; + break; + case 0x0B: // LT + cond_res = N_FLAG != V_FLAG; + break; + case 0x0C: // GT + cond_res = !Z_FLAG &&(N_FLAG == V_FLAG); + break; + case 0x0D: // LE + cond_res = Z_FLAG || (N_FLAG != V_FLAG); + break; + case 0x0E: + cond_res = true; + break; + case 0x0F: + default: + // ??? + cond_res = false; + break; + } + } + +if(cond_res) { + switch(((opcode>>16)&0xFF0) | ((opcode>>4)&0x0F)) { + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_AND, OP_AND, 0x000); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_ANDS, OP_AND, 0x010); + case 0x009: + { + // MUL Rd, Rm, Rs + int dest = (opcode >> 16) & 0x0F; + int mult = (opcode & 0x0F); + u32 rs = reg[(opcode >> 8) & 0x0F].I; + reg[dest].I = reg[mult].I * rs; + if(((s32)rs)<0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 2; + else if ((rs & 0xFFFF0000) == 0) + clockTicks += 3; + else if ((rs & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + case 0x019: + { + // MULS Rd, Rm, Rs + int dest = (opcode >> 16) & 0x0F; + int mult = (opcode & 0x0F); + u32 rs = reg[(opcode >> 8) & 0x0F].I; + reg[dest].I = reg[mult].I * rs; + N_FLAG = (reg[dest].I & 0x80000000) ? true : false; + Z_FLAG = (reg[dest].I) ? false : true; + if(((s32)rs)<0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 2; + else if ((rs & 0xFFFF0000) == 0) + clockTicks += 3; + else if ((rs & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + case 0x00b: + case 0x02b: + { + // STRH Rd, [Rn], -Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + address -= offset; + reg[base].I = address; + } + break; + case 0x04b: + case 0x06b: + { + // STRH Rd, [Rn], #-offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + address -= offset; + reg[base].I = address; + } + break; + case 0x08b: + case 0x0ab: + { + // STRH Rd, [Rn], Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + address += offset; + reg[base].I = address; + } + break; + case 0x0cb: + case 0x0eb: + { + // STRH Rd, [Rn], #offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + address += offset; + reg[base].I = address; + } + break; + case 0x10b: + { + // STRH Rd, [Rn, -Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + } + break; + case 0x12b: + { + // STRH Rd, [Rn, -Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + reg[base].I = address; + } + break; + case 0x14b: + { + // STRH Rd, [Rn, -#offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + } + break; + case 0x16b: + { + // STRH Rd, [Rn, -#offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + reg[base].I = address; + } + break; + case 0x18b: + { + // STRH Rd, [Rn, Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + } + break; + case 0x1ab: + { + // STRH Rd, [Rn, Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + reg[base].I = address; + } + break; + case 0x1cb: + { + // STRH Rd, [Rn, #offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + } + break; + case 0x1eb: + { + // STRH Rd, [Rn, #offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 4 + CPUUpdateTicksAccess16(address); + CPUWriteHalfWord(address, reg[dest].W.W0); + reg[base].I = address; + } + break; + case 0x01b: + case 0x03b: + { + // LDRH Rd, [Rn], -Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x05b: + case 0x07b: + { + // LDRH Rd, [Rn], #-offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x09b: + case 0x0bb: + { + // LDRH Rd, [Rn], Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x0db: + case 0x0fb: + { + // LDRH Rd, [Rn], #offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x11b: + { + // LDRH Rd, [Rn, -Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + } + break; + case 0x13b: + { + // LDRH Rd, [Rn, -Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x15b: + { + // LDRH Rd, [Rn, -#offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + } + break; + case 0x17b: + { + // LDRH Rd, [Rn, -#offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x19b: + { + // LDRH Rd, [Rn, Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + } + break; + case 0x1bb: + { + // LDRH Rd, [Rn, Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x1db: + { + // LDRH Rd, [Rn, #offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + } + break; + case 0x1fb: + { + // LDRH Rd, [Rn, #offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = CPUReadHalfWord(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x01d: + case 0x03d: + { + // LDRSB Rd, [Rn], -Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x05d: + case 0x07d: + { + // LDRSB Rd, [Rn], #-offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x09d: + case 0x0bd: + { + // LDRSB Rd, [Rn], Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x0dd: + case 0x0fd: + { + // LDRSB Rd, [Rn], #offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x11d: + { + // LDRSB Rd, [Rn, -Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + } + break; + case 0x13d: + { + // LDRSB Rd, [Rn, -Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x15d: + { + // LDRSB Rd, [Rn, -#offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + } + break; + case 0x17d: + { + // LDRSB Rd, [Rn, -#offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x19d: + { + // LDRSB Rd, [Rn, Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + } + break; + case 0x1bd: + { + // LDRSB Rd, [Rn, Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x1dd: + { + // LDRSB Rd, [Rn, #offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + } + break; + case 0x1fd: + { + // LDRSB Rd, [Rn, #offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s8)CPUReadByte(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x01f: + case 0x03f: + { + // LDRSH Rd, [Rn], -Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x05f: + case 0x07f: + { + // LDRSH Rd, [Rn], #-offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) { + address -= offset; + reg[base].I = address; + } + } + break; + case 0x09f: + case 0x0bf: + { + // LDRSH Rd, [Rn], Rm + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x0df: + case 0x0ff: + { + // LDRSH Rd, [Rn], #offset + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I; + int offset = (opcode & 0x0F) | ((opcode >> 4) & 0xF0); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) { + address += offset; + reg[base].I = address; + } + } + break; + case 0x11f: + { + // LDRSH Rd, [Rn, -Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + } + break; + case 0x13f: + { + // LDRSH Rd, [Rn, -Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x15f: + { + // LDRSH Rd, [Rn, -#offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + } + break; + case 0x17f: + { + // LDRSH Rd, [Rn, -#offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I - ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x19f: + { + // LDRSH Rd, [Rn, Rm] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + } + break; + case 0x1bf: + { + // LDRSH Rd, [Rn, Rm]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + reg[opcode & 0x0F].I; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) + reg[base].I = address; + } + break; + case 0x1df: + { + // LDRSH Rd, [Rn, #offset] + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + } + break; + case 0x1ff: + { + // LDRSH Rd, [Rn, #offset]! + int base = (opcode >> 16) & 0x0F; + int dest = (opcode >> 12) & 0x0F; + u32 address = reg[base].I + ((opcode & 0x0F)|((opcode>>4)&0xF0)); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + reg[dest].I = (s16)CPUReadHalfWordSigned(address); + if(dest != base) + reg[base].I = address; + } + break; + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_EOR, OP_EOR, 0x020); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_EORS, OP_EOR, 0x030); + case 0x029: + { + // MLA Rd, Rm, Rs, Rn + int dest = (opcode >> 16) & 0x0F; + int mult = (opcode & 0x0F); + u32 rs = reg[(opcode >> 8) & 0x0F].I; + reg[dest].I = reg[mult].I * rs + reg[(opcode>>12)&0x0f].I; + if(((s32)rs)<0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 3; + else if ((rs & 0xFFFF0000) == 0) + clockTicks += 4; + else if ((rs & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + case 0x039: + { + // MLAS Rd, Rm, Rs, Rn + int dest = (opcode >> 16) & 0x0F; + int mult = (opcode & 0x0F); + u32 rs = reg[(opcode >> 8) & 0x0F].I; + reg[dest].I = reg[mult].I * rs + reg[(opcode>>12)&0x0f].I; + N_FLAG = (reg[dest].I & 0x80000000) ? true : false; + Z_FLAG = (reg[dest].I) ? false : true; + if(((s32)rs)<0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 3; + else if ((rs & 0xFFFF0000) == 0) + clockTicks += 4; + else if ((rs & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + ARITHMETIC_DATA_OPCODE(OP_SUB, OP_SUB, 0x040); + ARITHMETIC_DATA_OPCODE(OP_SUBS, OP_SUB, 0x050); + ARITHMETIC_DATA_OPCODE(OP_RSB, OP_RSB, 0x060); + ARITHMETIC_DATA_OPCODE(OP_RSBS, OP_RSB, 0x070); + ARITHMETIC_DATA_OPCODE(OP_ADD, OP_ADD, 0x080); + ARITHMETIC_DATA_OPCODE(OP_ADDS, OP_ADD, 0x090); + case 0x089: + { + // UMULL RdLo, RdHi, Rn, Rs + u32 umult = reg[(opcode & 0x0F)].I; + u32 usource = reg[(opcode >> 8) & 0x0F].I; + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u64 uTemp = ((u64)umult)*((u64)usource); + reg[destLo].I = (u32)uTemp; + reg[destHi].I = (u32)(uTemp >> 32); + if ((usource & 0xFFFFFF00) == 0) + clockTicks += 2; + else if ((usource & 0xFFFF0000) == 0) + clockTicks += 3; + else if ((usource & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + case 0x099: + { + // UMULLS RdLo, RdHi, Rn, Rs + u32 umult = reg[(opcode & 0x0F)].I; + u32 usource = reg[(opcode >> 8) & 0x0F].I; + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u64 uTemp = ((u64)umult)*((u64)usource); + reg[destLo].I = (u32)uTemp; + reg[destHi].I = (u32)(uTemp >> 32); + Z_FLAG = (uTemp) ? false : true; + N_FLAG = (reg[destHi].I & 0x80000000) ? true : false; + if ((usource & 0xFFFFFF00) == 0) + clockTicks += 2; + else if ((usource & 0xFFFF0000) == 0) + clockTicks += 3; + else if ((usource & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + ARITHMETIC_DATA_OPCODE(OP_ADC, OP_ADC, 0x0a0); + ARITHMETIC_DATA_OPCODE(OP_ADCS, OP_ADC, 0x0b0); + case 0x0a9: + { + // UMLAL RdLo, RdHi, Rn, Rs + u32 umult = reg[(opcode & 0x0F)].I; + u32 usource = reg[(opcode >> 8) & 0x0F].I; + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u64 uTemp = (u64)reg[destHi].I; + uTemp <<= 32; + uTemp |= (u64)reg[destLo].I; + uTemp += ((u64)umult)*((u64)usource); + reg[destLo].I = (u32)uTemp; + reg[destHi].I = (u32)(uTemp >> 32); + if ((usource & 0xFFFFFF00) == 0) + clockTicks += 3; + else if ((usource & 0xFFFF0000) == 0) + clockTicks += 4; + else if ((usource & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + case 0x0b9: + { + // UMLALS RdLo, RdHi, Rn, Rs + u32 umult = reg[(opcode & 0x0F)].I; + u32 usource = reg[(opcode >> 8) & 0x0F].I; + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u64 uTemp = (u64)reg[destHi].I; + uTemp <<= 32; + uTemp |= (u64)reg[destLo].I; + uTemp += ((u64)umult)*((u64)usource); + reg[destLo].I = (u32)uTemp; + reg[destHi].I = (u32)(uTemp >> 32); + Z_FLAG = (uTemp) ? false : true; + N_FLAG = (reg[destHi].I & 0x80000000) ? true : false; + if ((usource & 0xFFFFFF00) == 0) + clockTicks += 3; + else if ((usource & 0xFFFF0000) == 0) + clockTicks += 4; + else if ((usource & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + ARITHMETIC_DATA_OPCODE(OP_SBC, OP_SBC, 0x0c0); + ARITHMETIC_DATA_OPCODE(OP_SBCS, OP_SBC, 0x0d0); + case 0x0c9: + { + // SMULL RdLo, RdHi, Rm, Rs + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u32 rs = reg[(opcode >> 8) & 0x0F].I; + s64 m = (s32)reg[(opcode & 0x0F)].I; + s64 s = (s32)rs; + s64 sTemp = m*s; + reg[destLo].I = (u32)sTemp; + reg[destHi].I = (u32)(sTemp >> 32); + if(((s32)rs) < 0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 2; + else if((rs & 0xFFFF0000) == 0) + clockTicks += 3; + else if((rs & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + case 0x0d9: + { + // SMULLS RdLo, RdHi, Rm, Rs + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u32 rs = reg[(opcode >> 8) & 0x0F].I; + s64 m = (s32)reg[(opcode & 0x0F)].I; + s64 s = (s32)rs; + s64 sTemp = m*s; + reg[destLo].I = (u32)sTemp; + reg[destHi].I = (u32)(sTemp >> 32); + Z_FLAG = (sTemp) ? false : true; + N_FLAG = (sTemp < 0) ? true : false; + if(((s32)rs) < 0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 2; + else if((rs & 0xFFFF0000) == 0) + clockTicks += 3; + else if((rs & 0xFF000000) == 0) + clockTicks += 4; + else + clockTicks += 5; + } + break; + ARITHMETIC_DATA_OPCODE(OP_RSC, OP_RSC, 0x0e0); + ARITHMETIC_DATA_OPCODE(OP_RSCS, OP_RSC, 0x0f0); + case 0x0e9: + { + // SMLAL RdLo, RdHi, Rm, Rs + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u32 rs = reg[(opcode >> 8) & 0x0F].I; + s64 m = (s32)reg[(opcode & 0x0F)].I; + s64 s = (s32)rs; + s64 sTemp = (u64)reg[destHi].I; + sTemp <<= 32; + sTemp |= (u64)reg[destLo].I; + sTemp += m*s; + reg[destLo].I = (u32)sTemp; + reg[destHi].I = (u32)(sTemp >> 32); + if(((s32)rs) < 0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 3; + else if((rs & 0xFFFF0000) == 0) + clockTicks += 4; + else if((rs & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + case 0x0f9: + { + // SMLALS RdLo, RdHi, Rm, Rs + int destLo = (opcode >> 12) & 0x0F; + int destHi = (opcode >> 16) & 0x0F; + u32 rs = reg[(opcode >> 8) & 0x0F].I; + s64 m = (s32)reg[(opcode & 0x0F)].I; + s64 s = (s32)rs; + s64 sTemp = (u64)reg[destHi].I; + sTemp <<= 32; + sTemp |= (u64)reg[destLo].I; + sTemp += m*s; + reg[destLo].I = (u32)sTemp; + reg[destHi].I = (u32)(sTemp >> 32); + Z_FLAG = (sTemp) ? false : true; + N_FLAG = (sTemp < 0) ? true : false; + if(((s32)rs) < 0) + rs = ~rs; + if((rs & 0xFFFFFF00) == 0) + clockTicks += 3; + else if((rs & 0xFFFF0000) == 0) + clockTicks += 4; + else if((rs & 0xFF000000) == 0) + clockTicks += 5; + else + clockTicks += 6; + } + break; + LOGICAL_DATA_OPCODE(OP_TST, OP_TST, 0x110); + case 0x100: + // MRS Rd, CPSR + // TODO: check if right instruction.... + CPUUpdateCPSR(); + reg[(opcode >> 12) & 0x0F].I = reg[16].I; + break; + case 0x109: + { + // SWP Rd, Rm, [Rn] + u32 address = reg[(opcode >> 16) & 15].I; + u32 temp = CPUReadMemory(address); + CPUWriteMemory(address, reg[opcode&15].I); + reg[(opcode >> 12) & 15].I = temp; + } + break; + LOGICAL_DATA_OPCODE(OP_TEQ, OP_TEQ, 0x130); + case 0x120: + { + // MSR CPSR_fields, Rm + CPUUpdateCPSR(); + u32 value = reg[opcode & 15].I; + u32 newValue = reg[16].I; + if(armMode > 0x10) { + if(opcode & 0x00010000) + newValue = (newValue & 0xFFFFFF00) | (value & 0x000000FF); + if(opcode & 0x00020000) + newValue = (newValue & 0xFFFF00FF) | (value & 0x0000FF00); + if(opcode & 0x00040000) + newValue = (newValue & 0xFF00FFFF) | (value & 0x00FF0000); + } + if(opcode & 0x00080000) + newValue = (newValue & 0x00FFFFFF) | (value & 0xFF000000); + newValue |= 0x10; + CPUSwitchMode(newValue & 0x1f, false); + reg[16].I = newValue; + CPUUpdateFlags(); + } + break; + case 0x121: + { + // BX Rm + // TODO: check if right instruction... + clockTicks += 3; + int base = opcode & 0x0F; + armState = reg[base].I & 1 ? false : true; + if(armState) { + reg[15].I = reg[base].I & 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } else { + reg[15].I = reg[base].I & 0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + } + } + break; + ARITHMETIC_DATA_OPCODE(OP_CMP, OP_CMP, 0x150); + case 0x140: + // MRS Rd, SPSR + // TODO: check if right instruction... + reg[(opcode >> 12) & 0x0F].I = reg[17].I; + break; + case 0x149: + { + // SWPB Rd, Rm, [Rn] + u32 address = reg[(opcode >> 16) & 15].I; + u32 temp = CPUReadByte(address); + CPUWriteByte(address, reg[opcode&15].B.B0); + reg[(opcode>>12)&15].I = temp; + } + break; + ARITHMETIC_DATA_OPCODE(OP_CMN, OP_CMN, 0x170); + case 0x160: + { + // MSR SPSR_fields, Rm + u32 value = reg[opcode & 15].I; + if(armMode > 0x10 && armMode < 0x1f) { + if(opcode & 0x00010000) + reg[17].I = (reg[17].I & 0xFFFFFF00) | (value & 0x000000FF); + if(opcode & 0x00020000) + reg[17].I = (reg[17].I & 0xFFFF00FF) | (value & 0x0000FF00); + if(opcode & 0x00040000) + reg[17].I = (reg[17].I & 0xFF00FFFF) | (value & 0x00FF0000); + if(opcode & 0x00080000) + reg[17].I = (reg[17].I & 0x00FFFFFF) | (value & 0xFF000000); + } + } + break; + LOGICAL_DATA_OPCODE (OP_ORR, OP_ORR, 0x180); + LOGICAL_DATA_OPCODE (OP_ORRS, OP_ORR, 0x190); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_MOV, OP_MOV, 0x1a0); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_MOVS, OP_MOV, 0x1b0); + LOGICAL_DATA_OPCODE (OP_BIC, OP_BIC, 0x1c0); + LOGICAL_DATA_OPCODE (OP_BICS, OP_BIC, 0x1d0); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_MVN, OP_MVN, 0x1e0); + LOGICAL_DATA_OPCODE_WITHOUT_base(OP_MVNS, OP_MVN, 0x1f0); +#ifdef BKPT_SUPPORT + case 0x127: + case 0x7ff: // for GDB support + extern void (*dbgSignal)(int,int); + reg[15].I -= 4; + armNextPC -= 4; + dbgSignal(5, (opcode & 0x0f)|((opcode>>4) & 0xfff0)); + return; +#endif + case 0x320: + case 0x321: + case 0x322: + case 0x323: + case 0x324: + case 0x325: + case 0x326: + case 0x327: + case 0x328: + case 0x329: + case 0x32a: + case 0x32b: + case 0x32c: + case 0x32d: + case 0x32e: + case 0x32f: + { + // MSR CPSR_fields, # + CPUUpdateCPSR(); + u32 value = opcode & 0xFF; + int shift = (opcode & 0xF00) >> 7; + if(shift) { + ROR_IMM_MSR; + } + u32 newValue = reg[16].I; + if(armMode > 0x10) { + if(opcode & 0x00010000) + newValue = (newValue & 0xFFFFFF00) | (value & 0x000000FF); + if(opcode & 0x00020000) + newValue = (newValue & 0xFFFF00FF) | (value & 0x0000FF00); + if(opcode & 0x00040000) + newValue = (newValue & 0xFF00FFFF) | (value & 0x00FF0000); + } + if(opcode & 0x00080000) + newValue = (newValue & 0x00FFFFFF) | (value & 0xFF000000); + + newValue |= 0x10; + + CPUSwitchMode(newValue & 0x1f, false); + reg[16].I = newValue; + CPUUpdateFlags(); + } + break; + case 0x360: + case 0x361: + case 0x362: + case 0x363: + case 0x364: + case 0x365: + case 0x366: + case 0x367: + case 0x368: + case 0x369: + case 0x36a: + case 0x36b: + case 0x36c: + case 0x36d: + case 0x36e: + case 0x36f: + { + // MSR SPSR_fields, # + if(armMode > 0x10 && armMode < 0x1f) { + u32 value = opcode & 0xFF; + int shift = (opcode & 0xF00) >> 7; + if(shift) { + ROR_IMM_MSR; + } + if(opcode & 0x00010000) + reg[17].I = (reg[17].I & 0xFFFFFF00) | (value & 0x000000FF); + if(opcode & 0x00020000) + reg[17].I = (reg[17].I & 0xFFFF00FF) | (value & 0x0000FF00); + if(opcode & 0x00040000) + reg[17].I = (reg[17].I & 0xFF00FFFF) | (value & 0x00FF0000); + if(opcode & 0x00080000) + reg[17].I = (reg[17].I & 0x00FFFFFF) | (value & 0xFF000000); + } + } + break; + CASE_16(0x400) + // T versions shouldn't be different on GBA + CASE_16(0x420) + { + // STR Rd, [Rn], -# + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x480) + // T versions shouldn't be different on GBA + CASE_16(0x4a0) + { + // STR Rd, [Rn], # + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x500) + { + // STR Rd, [Rn, -#] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x520) + { + // STR Rd, [Rn, -#]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x580) + { + // STR Rd, [Rn, #] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x5a0) + { + // STR Rd, [Rn, #]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x410) + { + // LDR Rd, [Rn], -# + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I -= offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x430) + { + // LDRT Rd, [Rn], -# + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I -= offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x490) + { + // LDR Rd, [Rn], # + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I += offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x4b0) + { + // LDRT Rd, [Rn], # + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I += offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + } + break; + CASE_16(0x510) + { + // LDR Rd, [Rn, -#] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x530) + { + // LDR Rd, [Rn, -#]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x590) + { + // LDR Rd, [Rn, #] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x5b0) + { + // LDR Rd, [Rn, #]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x440) + // T versions shouldn't be different on GBA + CASE_16(0x460) + { + // STRB Rd, [Rn], -# + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x4c0) + // T versions shouldn't be different on GBA + CASE_16(0x4e0) + // STRB Rd, [Rn], # + { + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x540) + { + // STRB Rd, [Rn, -#] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x560) + { + // STRB Rd, [Rn, -#]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x5c0) + { + // STRB Rd, [Rn, #] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x5e0) + { + // STRB Rd, [Rn, #]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x450) + // T versions shouldn't be different + CASE_16(0x470) + { + // LDRB Rd, [Rn], -# + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I -= offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x4d0) + CASE_16(0x4f0) // T versions should not be different + { + // LDRB Rd, [Rn], # + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I += offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x550) + { + // LDRB Rd, [Rn, -#] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x570) + { + // LDRB Rd, [Rn, -#]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x5d0) + { + // LDRB Rd, [Rn, #] + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + CASE_16(0x5f0) + { + // LDRB Rd, [Rn, #]! + int offset = opcode & 0xFFF; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x600: + case 0x608: + // T versions are the same + case 0x620: + case 0x628: + { + // STR Rd, [Rn], -Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x602: + case 0x60a: + // T versions are the same + case 0x622: + case 0x62a: + { + // STR Rd, [Rn], -Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x604: + case 0x60c: + // T versions are the same + case 0x624: + case 0x62c: + { + // STR Rd, [Rn], -Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x606: + case 0x60e: + // T versions are the same + case 0x626: + case 0x62e: + { + // STR Rd, [Rn], -Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address - value; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x680: + case 0x688: + // T versions are the same + case 0x6a0: + case 0x6a8: + { + // STR Rd, [Rn], Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x682: + case 0x68a: + // T versions are the same + case 0x6a2: + case 0x6aa: + { + // STR Rd, [Rn], Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x684: + case 0x68c: + // T versions are the same + case 0x6a4: + case 0x6ac: + { + // STR Rd, [Rn], Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x686: + case 0x68e: + // T versions are the same + case 0x6a6: + case 0x6ae: + { + // STR Rd, [Rn], Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteMemory(address, reg[dest].I); + reg[base].I = address + value; + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x700: + case 0x708: + { + // STR Rd, [Rn, -Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x702: + case 0x70a: + { + // STR Rd, [Rn, -Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x704: + case 0x70c: + { + // STR Rd, [Rn, -Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x706: + case 0x70e: + { + // STR Rd, [Rn, -Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x720: + case 0x728: + { + // STR Rd, [Rn, -Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x722: + case 0x72a: + { + // STR Rd, [Rn, -Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x724: + case 0x72c: + { + // STR Rd, [Rn, -Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x726: + case 0x72e: + { + // STR Rd, [Rn, -Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x780: + case 0x788: + { + // STR Rd, [Rn, Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x782: + case 0x78a: + { + // STR Rd, [Rn, Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x784: + case 0x78c: + { + // STR Rd, [Rn, Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x786: + case 0x78e: + { + // STR Rd, [Rn, Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x7a0: + case 0x7a8: + { + // STR Rd, [Rn, Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x7a2: + case 0x7aa: + { + // STR Rd, [Rn, Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x7a4: + case 0x7ac: + { + // STR Rd, [Rn, Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x7a6: + case 0x7ae: + { + // STR Rd, [Rn, Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[base].I = address; + CPUWriteMemory(address, reg[dest].I); + clockTicks += 2 + CPUUpdateTicksAccess32(address); + } + break; + case 0x610: + case 0x618: + // T versions are the same + case 0x630: + case 0x638: + { + // LDR Rd, [Rn], -Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x612: + case 0x61a: + // T versions are the same + case 0x632: + case 0x63a: + { + // LDR Rd, [Rn], -Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x614: + case 0x61c: + // T versions are the same + case 0x634: + case 0x63c: + { + // LDR Rd, [Rn], -Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x616: + case 0x61e: + // T versions are the same + case 0x636: + case 0x63e: + { + // LDR Rd, [Rn], -Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address - value; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x690: + case 0x698: + // T versions are the same + case 0x6b0: + case 0x6b8: + { + // LDR Rd, [Rn], Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x692: + case 0x69a: + // T versions are the same + case 0x6b2: + case 0x6ba: + { + // LDR Rd, [Rn], Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x694: + case 0x69c: + // T versions are the same + case 0x6b4: + case 0x6bc: + { + // LDR Rd, [Rn], Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x696: + case 0x69e: + // T versions are the same + case 0x6b6: + case 0x6be: + { + // LDR Rd, [Rn], Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address + value; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x710: + case 0x718: + { + // LDR Rd, [Rn, -Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x712: + case 0x71a: + { + // LDR Rd, [Rn, -Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x714: + case 0x71c: + { + // LDR Rd, [Rn, -Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x716: + case 0x71e: + { + // LDR Rd, [Rn, -Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x730: + case 0x738: + { + // LDR Rd, [Rn, -Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x732: + case 0x73a: + { + // LDR Rd, [Rn, -Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x734: + case 0x73c: + { + // LDR Rd, [Rn, -Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x736: + case 0x73e: + { + // LDR Rd, [Rn, -Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x790: + case 0x798: + { + // LDR Rd, [Rn, Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x792: + case 0x79a: + { + // LDR Rd, [Rn, Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x794: + case 0x79c: + { + // LDR Rd, [Rn, Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x796: + case 0x79e: + { + // LDR Rd, [Rn, Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[dest].I = CPUReadMemory(address); + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x7b0: + case 0x7b8: + { + // LDR Rd, [Rn, Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x7b2: + case 0x7ba: + { + // LDR Rd, [Rn, Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x7b4: + case 0x7bc: + { + // LDR Rd, [Rn, Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x7b6: + case 0x7be: + { + // LDR Rd, [Rn, Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[dest].I = CPUReadMemory(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess32(address); + if(dest == 15) { + clockTicks += 2; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + case 0x640: + case 0x648: + // T versions are the same + case 0x660: + case 0x668: + { + // STRB Rd, [Rn], -Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x642: + case 0x64a: + // T versions are the same + case 0x662: + case 0x66a: + { + // STRB Rd, [Rn], -Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x644: + case 0x64c: + // T versions are the same + case 0x664: + case 0x66c: + { + // STRB Rd, [Rn], -Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address - offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x646: + case 0x64e: + // T versions are the same + case 0x666: + case 0x66e: + { + // STRB Rd, [Rn], -Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address - value; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6c0: + case 0x6c8: + // T versions are the same + case 0x6e0: + case 0x6e8: + { + // STRB Rd, [Rn], Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6c2: + case 0x6ca: + // T versions are the same + case 0x6e2: + case 0x6ea: + { + // STRB Rd, [Rn], Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6c4: + case 0x6cc: + // T versions are the same + case 0x6e4: + case 0x6ec: + { + // STR Rd, [Rn], Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address + offset; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6c6: + case 0x6ce: + // T versions are the same + case 0x6e6: + case 0x6ee: + { + // STRB Rd, [Rn], Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + CPUWriteByte(address, reg[dest].B.B0); + reg[base].I = address + value; + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x740: + case 0x748: + { + // STRB Rd, [Rn, -Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x742: + case 0x74a: + { + // STRB Rd, [Rn, -Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x744: + case 0x74c: + { + // STRB Rd, [Rn, -Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x746: + case 0x74e: + { + // STRB Rd, [Rn, -Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x760: + case 0x768: + { + // STRB Rd, [Rn, -Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x762: + case 0x76a: + { + // STRB Rd, [Rn, -Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x764: + case 0x76c: + { + // STRB Rd, [Rn, -Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x766: + case 0x76e: + { + // STRB Rd, [Rn, -Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7c0: + case 0x7c8: + { + // STRB Rd, [Rn, Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7c2: + case 0x7ca: + { + // STRB Rd, [Rn, Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7c4: + case 0x7cc: + { + // STRB Rd, [Rn, Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7c6: + case 0x7ce: + { + // STRB Rd, [Rn, Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7e0: + case 0x7e8: + { + // STRB Rd, [Rn, Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7e2: + case 0x7ea: + { + // STRB Rd, [Rn, Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7e4: + case 0x7ec: + { + // STRB Rd, [Rn, Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7e6: + case 0x7ee: + { + // STRB Rd, [Rn, Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[base].I = address; + CPUWriteByte(address, reg[dest].B.B0); + clockTicks += 2 + CPUUpdateTicksAccess16(address); + } + break; + case 0x650: + case 0x658: + // T versions are the same + case 0x670: + case 0x678: + { + // LDRB Rd, [Rn], -Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x652: + case 0x65a: + // T versions are the same + case 0x672: + case 0x67a: + { + // LDRB Rd, [Rn], -Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x654: + case 0x65c: + // T versions are the same + case 0x674: + case 0x67c: + { + // LDRB Rd, [Rn], -Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address - offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x656: + case 0x65e: + // T versions are the same + case 0x676: + case 0x67e: + { + // LDRB Rd, [Rn], -Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address - value; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6d0: + case 0x6d8: + // T versions are the same + case 0x6f0: + case 0x6f8: + { + // LDRB Rd, [Rn], Rm, LSL # + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6d2: + case 0x6da: + // T versions are the same + case 0x6f2: + case 0x6fa: + { + // LDRB Rd, [Rn], Rm, LSR # + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6d4: + case 0x6dc: + // T versions are the same + case 0x6f4: + case 0x6fc: + { + // LDRB Rd, [Rn], Rm, ASR # + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address + offset; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x6d6: + case 0x6de: + // T versions are the same + case 0x6f6: + case 0x6fe: + { + // LDRB Rd, [Rn], Rm, ROR # + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address + value; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x750: + case 0x758: + { + // LDRB Rd, [Rn, -Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x752: + case 0x75a: + { + // LDRB Rd, [Rn, -Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x754: + case 0x75c: + { + // LDRB Rd, [Rn, -Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x756: + case 0x75e: + { + // LDRB Rd, [Rn, -Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x770: + case 0x778: + { + // LDRB Rd, [Rn, -Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x772: + case 0x77a: + { + // LDRB Rd, [Rn, -Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x774: + case 0x77c: + { + // LDRB Rd, [Rn, -Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x776: + case 0x77e: + { + // LDRB Rd, [Rn, -Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I - value; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7d0: + case 0x7d8: + { + // LDRB Rd, [Rn, Rm, LSL #] + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7d2: + case 0x7da: + { + // LDRB Rd, [Rn, Rm, LSR #] + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7d4: + case 0x7dc: + { + // LDRB Rd, [Rn, Rm, ASR #] + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7d6: + case 0x7de: + { + // LDRB Rd, [Rn, Rm, ROR #] + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[dest].I = CPUReadByte(address); + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7f0: + case 0x7f8: + { + // LDRB Rd, [Rn, Rm, LSL #]! + int offset = reg[opcode & 15].I << ((opcode>>7)& 31); + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7f2: + case 0x7fa: + { + // LDRB Rd, [Rn, Rm, LSR #]! + int shift = (opcode >> 7) & 31; + int offset = shift ? reg[opcode & 15].I >> shift : 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7f4: + case 0x7fc: + { + // LDRB Rd, [Rn, Rm, ASR #]! + int shift = (opcode >> 7) & 31; + int offset; + if(shift) + offset = (int)((s32)reg[opcode & 15].I >> shift); + else if(reg[opcode & 15].I & 0x80000000) + offset = 0xFFFFFFFF; + else + offset = 0; + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + offset; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; + case 0x7f6: + case 0x7fe: + { + // LDRB Rd, [Rn, Rm, ROR #]! + int shift = (opcode >> 7) & 31; + u32 value = reg[opcode & 15].I; + if(shift) { + ROR_VALUE; + } else { + RCR_VALUE; + } + int dest = (opcode >> 12) & 15; + int base = (opcode >> 16) & 15; + u32 address = reg[base].I + value; + reg[dest].I = CPUReadByte(address); + if(dest != base) + reg[base].I = address; + clockTicks += 3 + CPUUpdateTicksAccess16(address); + } + break; +#define STMW_REG(val,num) \ + if(opcode & (val)) {\ + CPUWriteMemory(address, reg[(num)].I);\ + if(!offset) {\ + reg[base].I = temp;\ + clockTicks += 1 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + } else {\ + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address);\ + }\ + address += 4;\ + } +#define STM_REG(val,num) \ + if(opcode & (val)) {\ + CPUWriteMemory(address, reg[(num)].I);\ + if(!offset) {\ + clockTicks += 1 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + } else {\ + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address);\ + }\ + address += 4;\ + } + + CASE_16(0x800) + // STMDA Rn, {Rlist} + { + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp + 4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + STM_REG(8192, 13); + STM_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x820) + { + // STMDA Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + STMW_REG(8192, 13); + STMW_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + reg[base].I = temp; + } + } + break; + CASE_16(0x840) + { + // STMDA Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + + if(armMode == 0x11) { + STM_REG(256, R8_FIQ); + STM_REG(512, R9_FIQ); + STM_REG(1024, R10_FIQ); + STM_REG(2048, R11_FIQ); + STM_REG(4096, R12_FIQ); + } else { + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + STM_REG(8192, R13_USR); + STM_REG(16384, R14_USR); + } else { + STM_REG(8192, 13); + STM_REG(16384, 14); + } + + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x860) + { + // STMDA Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + + if(armMode == 0x11) { + STMW_REG(256, R8_FIQ); + STMW_REG(512, R9_FIQ); + STMW_REG(1024, R10_FIQ); + STMW_REG(2048, R11_FIQ); + STMW_REG(4096, R12_FIQ); + } else { + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + STMW_REG(8192, R13_USR); + STMW_REG(16384, R14_USR); + } else { + STMW_REG(8192, 13); + STMW_REG(16384, 14); + } + + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + reg[base].I = temp; + } + } + break; + + CASE_16(0x880) + { + // STMIA Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + STM_REG(8192, 13); + STM_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x8a0) + { + // STMIA Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + + cpuBitsSet[(opcode >> 8) & 255]); + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + STMW_REG(8192, 13); + STMW_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) { + reg[base].I = temp; + clockTicks += 1 + CPUUpdateTicksAccess32(address); + } else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x8c0) + { + // STMIA Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + if(armMode == 0x11) { + STM_REG(256, R8_FIQ); + STM_REG(512, R9_FIQ); + STM_REG(1024, R10_FIQ); + STM_REG(2048, R11_FIQ); + STM_REG(4096, R12_FIQ); + } else { + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + } + if(armMode != 0x10 && armMode != 0x1f) { + STM_REG(8192, R13_USR); + STM_REG(16384, R14_USR); + } else { + STM_REG(8192, 13); + STM_REG(16384, 14); + } + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x8e0) + { + // STMIA Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + + cpuBitsSet[(opcode >> 8) & 255]); + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + if(armMode == 0x11) { + STMW_REG(256, R8_FIQ); + STMW_REG(512, R9_FIQ); + STMW_REG(1024, R10_FIQ); + STMW_REG(2048, R11_FIQ); + STMW_REG(4096, R12_FIQ); + } else { + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + } + if(armMode != 0x10 && armMode != 0x1f) { + STMW_REG(8192, R13_USR); + STMW_REG(16384, R14_USR); + } else { + STMW_REG(8192, 13); + STMW_REG(16384, 14); + } + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) { + reg[base].I = temp; + clockTicks += 1 + CPUUpdateTicksAccess32(address); + } else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + + CASE_16(0x900) + { + // STMDB Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + STM_REG(8192, 13); + STM_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x920) + { + // STMDB Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + STMW_REG(8192, 13); + STMW_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + reg[base].I = temp; + } + } + break; + CASE_16(0x940) + { + // STMDB Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + + if(armMode == 0x11) { + STM_REG(256, R8_FIQ); + STM_REG(512, R9_FIQ); + STM_REG(1024, R10_FIQ); + STM_REG(2048, R11_FIQ); + STM_REG(4096, R12_FIQ); + } else { + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + STM_REG(8192, R13_USR); + STM_REG(16384, R14_USR); + } else { + STM_REG(8192, 13); + STM_REG(16384, 14); + } + + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x960) + { + // STMDB Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + + if(armMode == 0x11) { + STMW_REG(256, R8_FIQ); + STMW_REG(512, R9_FIQ); + STMW_REG(1024, R10_FIQ); + STMW_REG(2048, R11_FIQ); + STMW_REG(4096, R12_FIQ); + } else { + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + STMW_REG(8192, R13_USR); + STMW_REG(16384, R14_USR); + } else { + STMW_REG(8192, 13); + STMW_REG(16384, 14); + } + + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + reg[base].I = temp; + } + } + break; + + CASE_16(0x980) + // STMIB Rn, {Rlist} + { + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + STM_REG(8192, 13); + STM_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x9a0) + { + // STMIB Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + + cpuBitsSet[(opcode >> 8) & 255]); + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + STMW_REG(8192, 13); + STMW_REG(16384, 14); + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) { + reg[base].I = temp; + clockTicks += 1 + CPUUpdateTicksAccess32(address); + } else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x9c0) + { + // STMIB Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + STM_REG(1, 0); + STM_REG(2, 1); + STM_REG(4, 2); + STM_REG(8, 3); + STM_REG(16, 4); + STM_REG(32, 5); + STM_REG(64, 6); + STM_REG(128, 7); + if(armMode == 0x11) { + STM_REG(256, R8_FIQ); + STM_REG(512, R9_FIQ); + STM_REG(1024, R10_FIQ); + STM_REG(2048, R11_FIQ); + STM_REG(4096, R12_FIQ); + } else { + STM_REG(256, 8); + STM_REG(512, 9); + STM_REG(1024, 10); + STM_REG(2048, 11); + STM_REG(4096, 12); + } + if(armMode != 0x10 && armMode != 0x1f) { + STM_REG(8192, R13_USR); + STM_REG(16384, R14_USR); + } else { + STM_REG(8192, 13); + STM_REG(16384, 14); + } + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) + clockTicks += 1 + CPUUpdateTicksAccess32(address); + else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + CASE_16(0x9e0) + { + // STMIB Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + + cpuBitsSet[(opcode >> 8) & 255]); + STMW_REG(1, 0); + STMW_REG(2, 1); + STMW_REG(4, 2); + STMW_REG(8, 3); + STMW_REG(16, 4); + STMW_REG(32, 5); + STMW_REG(64, 6); + STMW_REG(128, 7); + if(armMode == 0x11) { + STMW_REG(256, R8_FIQ); + STMW_REG(512, R9_FIQ); + STMW_REG(1024, R10_FIQ); + STMW_REG(2048, R11_FIQ); + STMW_REG(4096, R12_FIQ); + } else { + STMW_REG(256, 8); + STMW_REG(512, 9); + STMW_REG(1024, 10); + STMW_REG(2048, 11); + STMW_REG(4096, 12); + } + if(armMode != 0x10 && armMode != 0x1f) { + STMW_REG(8192, R13_USR); + STMW_REG(16384, R14_USR); + } else { + STMW_REG(8192, 13); + STMW_REG(16384, 14); + } + if(opcode & 32768) { + CPUWriteMemory(address, reg[15].I+4); + if(!offset) { + reg[base].I = temp; + clockTicks += 1 + CPUUpdateTicksAccess32(address); + } else + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address); + } + } + break; + +#define LDM_REG(val,num) \ + if(opcode & (val)) {\ + reg[(num)].I = CPUReadMemory(address);\ + if(offset)\ + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address);\ + else {\ + clockTicks += 1 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + }\ + address += 4;\ + } + + CASE_16(0x810) + { + // LDMDA Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp + 4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x830) + { + // LDMDA Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp + 4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + break; + CASE_16(0x850) + { + // LDMDA Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp + 4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + } + } + break; + CASE_16(0x870) + { + // LDMDA Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (temp + 4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if(!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + if(!(opcode & (1 << base))) + reg[base].I = temp; + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + } + break; + + CASE_16(0x890) + { + // LDMIA Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x8b0) + { + // LDMIA Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I + + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + break; + CASE_16(0x8d0) + { + // LDMIA Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + } + } + break; + CASE_16(0x8f0) + { + // LDMIA Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I + + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = reg[base].I & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if(!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + if(!(opcode & (1 << base))) + reg[base].I = temp; + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + } + break; + + CASE_16(0x910) + { + // LDMDB Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x930) + { + // LDMDB Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + break; + CASE_16(0x950) + { + // LDMDB Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + } + } + break; + CASE_16(0x970) + { + // LDMDB Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I - + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = temp & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if(!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + if(!(opcode & (1 << base))) + reg[base].I = temp; + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + } + break; + + CASE_16(0x990) + { + // LDMIB Rn, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + } + break; + CASE_16(0x9b0) + { + // LDMIB Rn!, {Rlist} + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I + + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + if(opcode & 32768) { + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + armNextPC = reg[15].I; + reg[15].I += 4; + } + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + break; + CASE_16(0x9d0) + { + // LDMIB Rn, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if (!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + } + } + break; + CASE_16(0x9f0) + { + // LDMIB Rn!, {Rlist}^ + int base = (opcode & 0x000F0000) >> 16; + u32 temp = reg[base].I + + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); + u32 address = (reg[base].I+4) & 0xFFFFFFFC; + clockTicks += 2; + int offset = 0; + if(opcode & 0x8000) { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + LDM_REG(8192, 13); + LDM_REG(16384, 14); + + reg[15].I = CPUReadMemory(address); + if(!offset) + clockTicks += 2 + CPUUpdateTicksAccess32(address); + else + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address); + + if(!(opcode & (1 << base))) + reg[base].I = temp; + + CPUSwitchMode(reg[17].I & 0x1f, false); + if(armState) { + armNextPC = reg[15].I & 0xFFFFFFFC; + reg[15].I = armNextPC + 4; + } else { + armNextPC = reg[15].I & 0xFFFFFFFE; + reg[15].I = armNextPC + 2; + } + } else { + LDM_REG(1, 0); + LDM_REG(2, 1); + LDM_REG(4, 2); + LDM_REG(8, 3); + LDM_REG(16, 4); + LDM_REG(32, 5); + LDM_REG(64, 6); + LDM_REG(128, 7); + + if(armMode == 0x11) { + LDM_REG(256, R8_FIQ); + LDM_REG(512, R9_FIQ); + LDM_REG(1024, R10_FIQ); + LDM_REG(2048, R11_FIQ); + LDM_REG(4096, R12_FIQ); + } else { + LDM_REG(256, 8); + LDM_REG(512, 9); + LDM_REG(1024, 10); + LDM_REG(2048, 11); + LDM_REG(4096, 12); + } + + if(armMode != 0x10 && armMode != 0x1f) { + LDM_REG(8192, R13_USR); + LDM_REG(16384, R14_USR); + } else { + LDM_REG(8192, 13); + LDM_REG(16384, 14); + } + + if(!(opcode & (1 << base))) + reg[base].I = temp; + } + } + break; + CASE_256(0xa00) + { + // B + clockTicks += 3; + int offset = opcode & 0x00FFFFFF; + if(offset & 0x00800000) { + offset |= 0xFF000000; + } + offset <<= 2; + reg[15].I += offset; + armNextPC = reg[15].I; + reg[15].I += 4; + } + break; + CASE_256(0xb00) + { + // BL + clockTicks += 3; + int offset = opcode & 0x00FFFFFF; + if(offset & 0x00800000) { + offset |= 0xFF000000; + } + offset <<= 2; + reg[14].I = reg[15].I - 4; + reg[15].I += offset; + armNextPC = reg[15].I; + reg[15].I += 4; + } + break; + CASE_256(0xf00) + // SWI + clockTicks += 3; + CPUSoftwareInterrupt(opcode & 0x00FFFFFF); + break; +#ifdef GP_SUPPORT + case 0xe11: + case 0xe13: + case 0xe15: + case 0xe17: + case 0xe19: + case 0xe1b: + case 0xe1d: + case 0xe1f: + // MRC + break; + case 0xe01: + case 0xe03: + case 0xe05: + case 0xe07: + case 0xe09: + case 0xe0b: + case 0xe0d: + case 0xe0f: + // MRC + break; +#endif + default: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_UNDEFINED) + log("Undefined ARM instruction %08x at %08x\n", opcode, + armNextPC-4); +#endif + CPUUndefinedException(); + break; + // END + } +} diff --git a/src/armdis.cpp b/src/armdis.cpp new file mode 100644 index 0000000..5162952 --- /dev/null +++ b/src/armdis.cpp @@ -0,0 +1,742 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/************************************************************************/ +/* Arm/Thumb command set disassembler */ +/************************************************************************/ +#include + +#include "System.h" +#include "Port.h" +#include "GBA.h" +#include "armdis.h" +#include "elf.h" + +struct Opcodes { + u32 mask; + u32 cval; + char *mnemonic; +}; + +#define debuggerReadMemory(addr) \ + READ32LE(((u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define debuggerReadHalfWord(addr) \ + READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define debuggerReadByte(addr) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] + +const char hdig[] = "0123456789abcdef"; + +const char *decVals[16] = { + "0","1","2","3","4","5","6","7","8", + "9","10","11","12","13","14","15" +}; + +const char *regs[16] = { + "r0","r1","r2","r3","r4","r5","r6","r7", + "r8","r9","r10","r11","r12","sp","lr","pc" +}; + +const char *conditions[16] = { + "eq","ne","cs","cc","mi","pl","vs","vc", + "hi","ls","ge","lt","gt","le","","nv" +}; + +const char *shifts[5] = { + "lsl","lsr","asr","ror","rrx" +}; + +const char *armMultLoadStore[12] = { + // non-stack + "da","ia","db","ib", + // stack store + "ed","ea","fd","fa", + // stack load + "fa","fd","ea","ed" +}; + +const Opcodes thumbOpcodes[] = { + // Format 1 + {0xf800, 0x0000, "lsl %r0, %r3, %o"}, + {0xf800, 0x0800, "lsr %r0, %r3, %o"}, + {0xf800, 0x1000, "asr %r0, %r3, %o"}, + // Format 2 + {0xfe00, 0x1800, "add %r0, %r3, %r6"}, + {0xfe00, 0x1a00, "sub %r0, %r3, %r6"}, + {0xfe00, 0x1c00, "add %r0, %r3, %i"}, + {0xfe00, 0x1e00, "sub %r0, %r3, %i"}, + // Format 3 + {0xf800, 0x2000, "mov %r8, %O"}, + {0xf800, 0x2800, "cmp %r8, %O"}, + {0xf800, 0x3000, "add %r8, %O"}, + {0xf800, 0x3800, "sub %r8, %O"}, + // Format 4 + {0xffc0, 0x4000, "and %r0, %r3"}, + {0xffc0, 0x4040, "eor %r0, %r3"}, + {0xffc0, 0x4080, "lsl %r0, %r3"}, + {0xffc0, 0x40c0, "lsr %r0, %r3"}, + {0xffc0, 0x4100, "asr %r0, %r3"}, + {0xffc0, 0x4140, "adc %r0, %r3"}, + {0xffc0, 0x4180, "sbc %r0, %r3"}, + {0xffc0, 0x41c0, "ror %r0, %r3"}, + {0xffc0, 0x4200, "tst %r0, %r3"}, + {0xffc0, 0x4240, "neg %r0, %r3"}, + {0xffc0, 0x4280, "cmp %r0, %r3"}, + {0xffc0, 0x42c0, "cmn %r0, %r3"}, + {0xffc0, 0x4300, "orr %r0, %r3"}, + {0xffc0, 0x4340, "mul %r0, %r3"}, + {0xffc0, 0x4380, "bic %r0, %r3"}, + {0xffc0, 0x43c0, "mvn %r0, %r3"}, + // Format 5 + {0xff80, 0x4700, "bx %h36"}, + {0xfcc0, 0x4400, "[ ??? ]"}, + {0xff00, 0x4400, "add %h07, %h36"}, + {0xff00, 0x4500, "cmp %h07, %h36"}, + {0xff00, 0x4600, "mov %h07, %h36"}, + // Format 6 + {0xf800, 0x4800, "ldr %r8, [%I] (=%J)"}, + // Format 7 + {0xfa00, 0x5000, "str%b %r0, [%r3, %r6]"}, + {0xfa00, 0x5800, "ldr%b %r0, [%r3, %r6]"}, + // Format 8 + {0xfe00, 0x5200, "strh %r0, [%r3, %r6]"}, + {0xfe00, 0x5600, "ldrh %r0, [%r3, %r6]"}, + {0xfe00, 0x5a00, "ldsb %r0, [%r3, %r6]"}, + {0xfe00, 0x5e00, "ldsh %r0, [%r3, %r6]"}, + // Format 9 + {0xe800, 0x6000, "str%B %r0, [%r3, %p]"}, + {0xe800, 0x6800, "ldr%B %r0, [%r3, %p]"}, + // Format 10 + {0xf800, 0x8000, "strh %r0, [%r3, %e]"}, + {0xf800, 0x8800, "ldrh %r0, [%r3, %e]"}, + // Format 11 + {0xf800, 0x9000, "str %r8, [sp, %w]"}, + {0xf800, 0x9800, "ldr %r8, [sp, %w]"}, + // Format 12 + {0xf800, 0xa000, "add %r8, pc, %w (=%K)"}, + {0xf800, 0xa800, "add %r8, sp, %w"}, + // Format 13 + {0xff00, 0xb000, "add sp, %s"}, + // Format 14 + {0xffff, 0xb500, "push {lr}"}, + {0xff00, 0xb400, "push {%l}"}, + {0xff00, 0xb500, "push {%l,lr}"}, + {0xffff, 0xbd00, "pop {pc}"}, + {0xff00, 0xbd00, "pop {%l,pc}"}, + {0xff00, 0xbc00, "pop {%l}"}, + // Format 15 + {0xf800, 0xc000, "stmia %r8!, {%l}"}, + {0xf800, 0xc800, "ldmia %r8!, {%l}"}, + // Format 17 + {0xff00, 0xdf00, "swi %m"}, + // Format 16 + {0xf000, 0xd000, "b%c %W"}, + // Format 18 + {0xf800, 0xe000, "b %a"}, + // Format 19 + {0xf800, 0xf000, "bl %A"}, + {0xf800, 0xf800, "blh %Z"}, + {0xff00, 0xbe00, "bkpt %O"}, + // Unknown + {0x0000, 0x0000, "[ ??? ]"} +}; + +const Opcodes armOpcodes[] = { + // Undefined + {0x0e000010, 0x06000010, "[ undefined ]"}, + // Branch instructions + {0x0ff000f0, 0x01200010, "bx%c %r0"}, + {0x0f000000, 0x0a000000, "b%c %o"}, + {0x0f000000, 0x0b000000, "bl%c %o"}, + {0x0f000000, 0x0f000000, "swi%c %q"}, + // PSR transfer + {0x0fbf0fff, 0x010f0000, "mrs%c %r3, %p"}, + {0x0db0f000, 0x0120f000, "msr%c %p, %i"}, + // Multiply instructions + {0x0fe000f0, 0x00000090, "mul%c%s %r4, %r0, %r2"}, + {0x0fe000f0, 0x00200090, "mla%c%s %r4, %r0, %r2, %r3"}, + {0x0fa000f0, 0x00800090, "%umull%c%s %r3, %r4, %r0, %r2"}, + {0x0fa000f0, 0x00a00090, "%umlal%c%s %r3, %r4, %r0, %r2"}, + // Load/Store instructions + {0x0fb00ff0, 0x01000090, "swp%c%b %r3, %r0, [%r4]"}, + {0x0fb000f0, 0x01000090, "[ ??? ]"}, + {0x0c100000, 0x04000000, "str%c%b%t %r3, %a"}, + {0x0c100000, 0x04100000, "ldr%c%b%t %r3, %a"}, + {0x0e100090, 0x00000090, "str%c%h %r3, %a"}, + {0x0e100090, 0x00100090, "ldr%c%h %r3, %a"}, + {0x0e100000, 0x08000000, "stm%c%m %r4%l"}, + {0x0e100000, 0x08100000, "ldm%c%m %r4%l"}, + // Data processing + {0x0de00000, 0x00000000, "and%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00200000, "eor%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00400000, "sub%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00600000, "rsb%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00800000, "add%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00a00000, "adc%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00c00000, "sbc%c%s %r3, %r4, %i"}, + {0x0de00000, 0x00e00000, "rsc%c%s %r3, %r4, %i"}, + {0x0de00000, 0x01000000, "tst%c%s %r4, %i"}, + {0x0de00000, 0x01200000, "teq%c%s %r4, %i"}, + {0x0de00000, 0x01400000, "cmp%c%s %r4, %i"}, + {0x0de00000, 0x01600000, "cmn%c%s %r4, %i"}, + {0x0de00000, 0x01800000, "orr%c%s %r3, %r4, %i"}, + {0x0de00000, 0x01a00000, "mov%c%s %r3, %i"}, + {0x0de00000, 0x01c00000, "bic%c%s %r3, %r4, %i"}, + {0x0de00000, 0x01e00000, "mvn%c%s %r3, %i"}, + // Coprocessor operations + {0x0f000010, 0x0e000000, "cdp%c %P, %N, %r3, %R4, %R0%V"}, + {0x0e100000, 0x0c000000, "stc%c%L %P, %r3, %A"}, + {0x0f100010, 0x0e000010, "mcr%c %P, %N, %r3, %R4, %R0%V"}, + {0x0f100010, 0x0e100010, "mrc%c %P, %N, %r3, %R4, %R0%V"}, + // Unknown + {0x00000000, 0x00000000, "[ ??? ]"} +}; + +char* addStr(char *dest, const char *src){ + while (*src){ + *dest++ = *src++; + } + return dest; +} + +char* addHex(char *dest, int siz, u32 val){ + if (siz==0){ + siz = 28; + while ( (((val>>siz)&15)==0) && (siz>=4) ) + siz -= 4; + siz += 4; + } + while (siz>0){ + siz -= 4; + *dest++ = hdig[(val>>siz)&15]; + } + return dest; +} + +int disArm(u32 offset, char *dest, int flags){ + u32 opcode = debuggerReadMemory(offset); + + const Opcodes *sp = armOpcodes; + while( sp->cval != (opcode & sp->mask) ) + sp++; + + if (flags&DIS_VIEW_ADDRESS){ + dest = addHex(dest, 32, offset); + *dest++ = ' '; + } + if (flags&DIS_VIEW_CODE){ + dest = addHex(dest, 32, opcode); + *dest++ = ' '; + } + + char *src = sp->mnemonic; + while (*src){ + if (*src!='%') + *dest++ = *src++; + else{ + src++; + switch (*src){ + case 'c': + dest = addStr(dest, conditions[opcode>>28]); + break; + case 'r': + dest = addStr(dest, regs[(opcode>>((*(++src)-'0')*4))&15]); + break; + case 'o': + { + *dest++ = '$'; + int off = opcode&0xffffff; + if (off&0x800000) + off |= 0xff000000; + off <<= 2; + dest = addHex(dest, 32, offset+8+off); + } + break; + case 'i': + if (opcode&(1<<25)){ + dest = addStr(dest, "#0x"); + int imm = opcode&0xff; + int rot = (opcode&0xf00)>>7; + int val = (imm<<(32-rot))|(imm>>rot); + dest = addHex(dest, 0, val); + } else{ + dest = addStr(dest, regs[opcode&0x0f]); + int shi = (opcode>>5)&3; + int sdw = (opcode>>7)&0x1f; + if ((sdw==0)&&(shi==3)) + shi = 4; + if ( (sdw) || (opcode&0x10) || (shi)) { + dest = addStr(dest, ", "); + dest = addStr(dest, shifts[shi]); + if (opcode&0x10){ + *dest++ = ' '; + dest = addStr(dest, regs[(opcode>>8)&15]); + } else { + if (sdw==0 && ( (shi==1) || (shi==2) )) + sdw = 32; + if(shi != 4) { + dest = addStr(dest, " #0x"); + dest = addHex(dest, 8, sdw); + } + } + } + } + break; + case 'p': + if (opcode&(1<<22)) + dest = addStr(dest, "spsr"); + else + dest = addStr(dest, "cpsr"); + if(opcode & 0x00F00000) { + *dest++ = '_'; + if(opcode & 0x00080000) + *dest++ = 'f'; + if(opcode & 0x00040000) + *dest++ = 's'; + if(opcode & 0x00020000) + *dest++ = 'x'; + if(opcode & 0x00010000) + *dest++ = 'c'; + } + break; + case 's': + if (opcode&(1<<20)) + *dest++ = 's'; + break; + case 'S': + if (opcode&(1<<22)) + *dest++ = 's'; + break; + case 'u': + if (opcode&(1<<22)) + *dest++ = 's'; + else + *dest++ = 'u'; + break; + case 'b': + if (opcode&(1<<22)) + *dest++ = 'b'; + break; + case 'a': + if ((opcode&0x076f0000)==0x004f0000){ + *dest++ = '['; + *dest++ = '$'; + int adr = offset+8; + int add = (opcode&15)|((opcode>>8)&0xf0); + if (opcode&(1<<23)) + adr += add; + else + adr -= add; + dest = addHex(dest, 32, adr); + *dest++ = ']'; + dest = addStr(dest, " (="); + *dest++ = '$'; + dest = addHex(dest ,32, debuggerReadMemory(adr)); + *dest++=')'; + } + if ((opcode&0x072f0000)==0x050f0000){ + *dest++ = '['; + *dest++ = '$'; + int adr = offset+8; + if (opcode&(1<<23)) + adr += opcode&0xfff; + else + adr -= opcode&0xfff; + dest = addHex(dest, 32, adr); + *dest++ = ']'; + dest = addStr(dest, " (="); + *dest++ = '$'; + dest = addHex(dest ,32, debuggerReadMemory(adr)); + *dest++=')'; + } else { + int reg = (opcode>>16)&15; + *dest++ = '['; + dest = addStr(dest, regs[reg]); + if (!(opcode&(1<<24))) + *dest++ = ']'; + if ( ((opcode&(1<<25))&&(opcode&(1<<26))) || (!(opcode&(1<<22))&&!(opcode&(1<<26))) ){ + dest = addStr(dest, ", "); + if (!(opcode&(1<<23))) + *dest++ = '-'; + dest = addStr(dest, regs[opcode&0x0f]); + int shi = (opcode>>5)&3; + if (opcode&(1<<26)){ + if ( ((opcode>>7)&0x1f) || (opcode&0x10) || (shi==1) || (shi==2)){ + dest = addStr(dest, ", "); + dest = addStr(dest, shifts[shi]); + if (opcode&0x10){ + *dest++ = ' '; + dest = addStr(dest, regs[(opcode>>8)&15]); + } else { + int sdw = (opcode>>7)&0x1f; + if (sdw==0 && ( (shi==1) || (shi==2) )) + sdw = 32; + dest = addStr(dest, " #0x"); + dest = addHex(dest, 8, sdw); + } + } + } + } else { + int off; + if (opcode&(1<<26)) + off = opcode&0xfff; + else + off = (opcode&15)|((opcode>>4)&0xf0); + if (off){ + dest = addStr(dest, ", "); + if (!(opcode&(1<<23))) + *dest++ = '-'; + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, off); + } + } + if (opcode&(1<<24)){ + *dest++ = ']'; + if (opcode&(1<<21)) + *dest++ = '!'; + } + } + break; + case 't': + if ((opcode&0x01200000)==0x01200000) + *dest++ = 't'; + break; + case 'h': + if (opcode&(1<<6)) + *dest++ = 's'; + if (opcode&(1<<5)) + *dest++ = 'h'; + else + *dest++ = 'b'; + break; + case 'm': + if (((opcode>>16)&15)==13) { + if(opcode & 0x00100000) + dest = addStr(dest, armMultLoadStore[8+((opcode>>23)&3)]); + else + dest = addStr(dest, armMultLoadStore[4+((opcode>>23)&3)]); + } else + dest = addStr(dest, armMultLoadStore[(opcode>>23)&3]); + break; + case 'l': + if (opcode&(1<<21)) + *dest++ = '!'; + dest = addStr(dest, ", {"); + { + int rlst = opcode&0xffff; + int msk = 0; + int not_first = 0; + while (msk<16){ + if (rlst&(1<>8)&15]); + break; + case 'N': + if (opcode&0x10) + dest = addStr(dest, decVals[(opcode>>21)&7]); + else + dest = addStr(dest, decVals[(opcode>>20)&15]); + break; + case 'R': + { + src++; + int reg = 4*(*src-'0'); + *dest++ = 'c'; + dest = addStr(dest, decVals[(opcode>>reg)&15]); + } + break; + case 'V': + { + int val = (opcode>>5)&7; + if (val){ + dest = addStr(dest, ", "); + dest = addStr(dest, decVals[val]); + } + } + break; + case 'L': + if (opcode&(1<<22)) + *dest++ = 'l'; + break; + case 'A': + if ((opcode&0x012f0000)==0x010f0000){ + int adr = offset+8; + int add = (opcode&0xff)<<2; + if (opcode&(1<<23)) + adr += add; + else + adr -= add; + *dest++ = '$'; + addHex(dest, 32, adr); + } else { + *dest++ = '['; + dest = addStr(dest, regs[(opcode>>16)&15]); + if (!(opcode&(1<<24))) + *dest++ = ']'; + int off = (opcode&0xff)<<2; + if (off){ + dest = addStr(dest, ", "); + if (!(opcode&(1<<23))) + *dest++ = '-'; + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, off); + } + if (opcode&(1<<24)){ + *dest++ = ']'; + if (opcode&(1<<21)) + *dest++ = '!'; + } + } + break; + } + src++; + } + } + *dest++ = 0; + + return 4; +} + +int disThumb(u32 offset, char *dest, int flags){ + u32 opcode = debuggerReadHalfWord(offset); + + const Opcodes *sp = thumbOpcodes; + int ret = 2; + while( sp->cval != (opcode & sp->mask) ) + sp++; + + if (flags&DIS_VIEW_ADDRESS){ + dest = addHex(dest, 32, offset); + *dest++ = ' '; + } + if (flags&DIS_VIEW_CODE){ + dest = addHex(dest, 16, opcode); + *dest++ = ' '; + } + + char *src = sp->mnemonic; + while (*src){ + if (*src!='%') + *dest++ = *src++; + else { + src++; + switch (*src){ + case 'r': + src++; + dest = addStr(dest, regs[(opcode>>(*src-'0'))&7]); + break; + case 'o': + dest = addStr(dest, "#0x"); + { + int val = (opcode>>6)&0x1f; + dest = addHex(dest, 8, val); + } + break; + case 'p': + dest = addStr(dest, "#0x"); + { + int val = (opcode>>6)&0x1f; + if (!(opcode&(1<<12))) + val <<= 2; + dest = addHex(dest, 0, val); + } + break; + case 'e': + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, ((opcode>>6)&0x1f)<<1); + break; + case 'i': + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, (opcode>>6)&7); + break; + case 'h': + { + src++; + int reg = (opcode>>(*src-'0'))&7; + src++; + if (opcode&(1<<(*src-'0'))) + reg += 8; + dest = addStr(dest, regs[reg]); + } + break; + case 'O': + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, (opcode&0xff)); + break; + case 'I': + *dest++ = '$'; + dest = addHex(dest, 32, (offset&0xfffffffc)+4+((opcode&0xff)<<2)); + break; + case 'J': + { + u32 value = debuggerReadMemory((offset&0xfffffffc)+4+ + ((opcode & 0xff)<<2)); + *dest++ = '$'; + dest = addHex(dest, 32, value); + char *s = elfGetAddressSymbol(value); + if(*s) { + *dest++ = ' '; + dest = addStr(dest, s); + } + } + break; + case 'K': + { + u32 value = (offset&0xfffffffc)+4+((opcode & 0xff)<<2); + *dest++ = '$'; + dest = addHex(dest, 32, value); + char *s = elfGetAddressSymbol(value); + if(*s) { + *dest++ = ' '; + dest = addStr(dest, s); + } + } + break; + case 'b': + if (opcode&(1<<10)) + *dest++ = 'b'; + break; + case 'B': + if (opcode&(1<<12)) + *dest++ = 'b'; + break; + case 'w': + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, (opcode&0xff)<<2); + break; + case 'W': + *dest++ = '$'; + { + int add = opcode&0xff; + if (add&0x80) + add |= 0xffffff00; + dest = addHex(dest, 32, (offset&0xfffffffe)+4+(add<<1)); + } + break; + case 'c': + dest = addStr(dest, conditions[(opcode>>8)&15]); + break; + case 's': + if (opcode&(1<<7)) + *dest++ = '-'; + dest = addStr(dest, "#0x"); + dest = addHex(dest, 0, (opcode&0x7f)<<2); + break; + case 'l': + { + int rlst = opcode&0xff; + int msk = 0; + int not_first = 0; + while (msk<8){ + if (rlst&(1<>3) << systemRedShift |\ + ((g) >> 3) << systemGreenShift |\ + ((b) >> 3) << systemBlueShift\ + +static void fill_rgb_row_16(u16 *from, int src_width, u8 *row, int width) +{ + u8 *copy_start = row + src_width*3; + u8 *all_stop = row + width*3; + while (row < copy_start) { + u16 color = *from++; + *row++ = ((color >> systemRedShift) & 0x1f) << 3; + *row++ = ((color >> systemGreenShift) & 0x1f) << 3; + *row++ = ((color >> systemBlueShift) & 0x1f) << 3; + } + // any remaining elements to be written to 'row' are a replica of the + // preceding pixel + u8 *p = row-3; + while (row < all_stop) { + // we're guaranteed three elements per pixel; could unroll the loop + // further, especially with a Duff's Device, but the gains would be + // probably limited (judging by profiler output) + *row++ = *p++; + *row++ = *p++; + *row++ = *p++; + } +} + +static void fill_rgb_row_32(u32 *from, int src_width, u8 *row, int width) +{ + u8 *copy_start = row + src_width*3; + u8 *all_stop = row + width*3; + while (row < copy_start) { + u32 color = *from++; + *row++ = ((color >> systemRedShift) & 0x1f) << 3; + *row++ = ((color >> systemGreenShift) & 0x1f) << 3; + *row++ = ((color >> systemBlueShift) & 0x1f) << 3; + } + // any remaining elements to be written to 'row' are a replica of the + // preceding pixel + u8 *p = row-3; + while (row < all_stop) { + // we're guaranteed three elements per pixel; could unroll the loop + // further, especially with a Duff's Device, but the gains would be + // probably limited (judging by profiler output) + *row++ = *p++; + *row++ = *p++; + *row++ = *p++; + } +} + +void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u16 *to = (u16 *)dstPtr; + u16 *to_odd = (u16 *)(dstPtr + dstPitch); + + int from_width = width; + u16 *from = (u16 *)srcPtr; + fill_rgb_row_16(from, from_width, rgb_row_cur, width+1); + + for(int y = 0; y < height; y++) { + u16 *from_orig = from; + u16 *to_orig = to; + + if (y+1 < height) + fill_rgb_row_16(from+width+2, from_width, rgb_row_next, + width+1); + else + fill_rgb_row_16(from, from_width, rgb_row_next, width+1); + + // every pixel in the src region, is extended to 4 pixels in the + // destination, arranged in a square 'quad'; if the current src + // pixel is 'a', then in what follows 'b' is the src pixel to the + // right, 'c' is the src pixel below, and 'd' is the src pixel to + // the right and down + u8 *cur_row = rgb_row_cur; + u8 *next_row = rgb_row_next; + u8 *ar = cur_row++; + u8 *ag = cur_row++; + u8 *ab = cur_row++; + u8 *cr = next_row++; + u8 *cg = next_row++; + u8 *cb = next_row++; + for(int x=0; x < width; x++) { + u8 *br = cur_row++; + u8 *bg = cur_row++; + u8 *bb = cur_row++; + u8 *dr = next_row++; + u8 *dg = next_row++; + u8 *db = next_row++; + + // upper left pixel in quad: just copy it in + *to++ = RGB(*ar, *ag, *ab); + + // upper right + *to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1); + + // lower left + *to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1); + + // lower right + *to_odd++ = RGB((*ar+*br+*cr+*dr)>>2, + (*ag+*bg+*cg+*dg)>>2, + (*ab+*bb+*cb+*db)>>2); + + // 'b' becomes 'a', 'd' becomes 'c' + ar = br; + ag = bg; + ab = bb; + cr = dr; + cg = dg; + cb = db; + } + + // the "next" rgb row becomes the current; the old current rgb row is + // recycled and serves as the new "next" row + u8 *temp; + temp = rgb_row_cur; + rgb_row_cur = rgb_row_next; + rgb_row_next = temp; + + // update the pointers for start of next pair of lines + from = (u16 *)((u8 *)from_orig + srcPitch); + to = (u16 *)((u8 *)to_orig + (dstPitch << 1)); + to_odd = (u16 *)((u8 *)to + dstPitch); + } +} + +void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u16 *to = (u16 *)dstPtr; + u16 *to_odd = (u16 *)(dstPtr + dstPitch); + + int from_width = width; + u16 *from = (u16 *)srcPtr; + fill_rgb_row_16(from, from_width, rgb_row_cur, width+1); + + for(int y = 0; y < height; y++) { + u16 *from_orig = from; + u16 *to_orig = to; + + if (y+1 < height) + fill_rgb_row_16(from+width+2, from_width, rgb_row_next, + width+1); + else + fill_rgb_row_16(from, from_width, rgb_row_next, width+1); + + // every pixel in the src region, is extended to 4 pixels in the + // destination, arranged in a square 'quad'; if the current src + // pixel is 'a', then in what follows 'b' is the src pixel to the + // right, 'c' is the src pixel below, and 'd' is the src pixel to + // the right and down + u8 *cur_row = rgb_row_cur; + u8 *next_row = rgb_row_next; + u8 *ar = cur_row++; + u8 *ag = cur_row++; + u8 *ab = cur_row++; + u8 *cr = next_row++; + u8 *cg = next_row++; + u8 *cb = next_row++; + for(int x=0; x < width; x++) { + u8 *br = cur_row++; + u8 *bg = cur_row++; + u8 *bb = cur_row++; + u8 *dr = next_row++; + u8 *dg = next_row++; + u8 *db = next_row++; + + // upper left pixel in quad: just copy it in + //*to++ = manip.rgb(*ar, *ag, *ab); +#ifdef USE_ORIGINAL_BILINEAR_PLUS + *to++ = RGB( + (((*ar)<<2) +((*ar)) + (*cr+*br+*br) )>> 3, + (((*ag)<<2) +((*ag)) + (*cg+*bg+*bg) )>> 3, + (((*ab)<<2) +((*ab)) + (*cb+*bb+*bb) )>> 3); +#else + *to++ = RGB( + (((*ar)<<3) +((*ar)<<1) + (*cr+*br+*br+*cr) )>> 4, + (((*ag)<<3) +((*ag)<<1) + (*cg+*bg+*bg+*cg) )>> 4, + (((*ab)<<3) +((*ab)<<1) + (*cb+*bb+*bb+*cb) )>> 4); +#endif + + // upper right + *to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1); + + // lower left + *to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1); + + // lower right + *to_odd++ = RGB((*ar+*br+*cr+*dr)>>2, + (*ag+*bg+*cg+*dg)>>2, + (*ab+*bb+*cb+*db)>>2); + + // 'b' becomes 'a', 'd' becomes 'c' + ar = br; + ag = bg; + ab = bb; + cr = dr; + cg = dg; + cb = db; + } + + // the "next" rgb row becomes the current; the old current rgb row is + // recycled and serves as the new "next" row + u8 *temp; + temp = rgb_row_cur; + rgb_row_cur = rgb_row_next; + rgb_row_next = temp; + + // update the pointers for start of next pair of lines + from = (u16 *)((u8 *)from_orig + srcPitch); + to = (u16 *)((u8 *)to_orig + (dstPitch << 1)); + to_odd = (u16 *)((u8 *)to + dstPitch); + } +} + +void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *to = (u32 *)dstPtr; + u32 *to_odd = (u32 *)(dstPtr + dstPitch); + + int from_width = width; + if(width+1 < from_width) + from_width = width+1; + u32 *from = (u32 *)srcPtr; + fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); + + for(int y = 0; y < height; y++) { + u32 *from_orig = from; + u32 *to_orig = to; + + if (y+1 < height) + fill_rgb_row_32(from+width+1, from_width, rgb_row_next, + width+1); + else + fill_rgb_row_32(from, from_width, rgb_row_next, width+1); + + // every pixel in the src region, is extended to 4 pixels in the + // destination, arranged in a square 'quad'; if the current src + // pixel is 'a', then in what follows 'b' is the src pixel to the + // right, 'c' is the src pixel below, and 'd' is the src pixel to + // the right and down + u8 *cur_row = rgb_row_cur; + u8 *next_row = rgb_row_next; + u8 *ar = cur_row++; + u8 *ag = cur_row++; + u8 *ab = cur_row++; + u8 *cr = next_row++; + u8 *cg = next_row++; + u8 *cb = next_row++; + for(int x=0; x < width; x++) { + u8 *br = cur_row++; + u8 *bg = cur_row++; + u8 *bb = cur_row++; + u8 *dr = next_row++; + u8 *dg = next_row++; + u8 *db = next_row++; + + // upper left pixel in quad: just copy it in + *to++ = RGB(*ar, *ag, *ab); + + // upper right + *to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1); + + // lower left + *to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1); + + // lower right + *to_odd++ = RGB((*ar+*br+*cr+*dr)>>2, + (*ag+*bg+*cg+*dg)>>2, + (*ab+*bb+*cb+*db)>>2); + + // 'b' becomes 'a', 'd' becomes 'c' + ar = br; + ag = bg; + ab = bb; + cr = dr; + cg = dg; + cb = db; + } + + // the "next" rgb row becomes the current; the old current rgb row is + // recycled and serves as the new "next" row + u8 *temp; + temp = rgb_row_cur; + rgb_row_cur = rgb_row_next; + rgb_row_next = temp; + + // update the pointers for start of next pair of lines + from = (u32 *)((u8 *)from_orig + srcPitch); + to = (u32 *)((u8 *)to_orig + (dstPitch << 1)); + to_odd = (u32 *)((u8 *)to + dstPitch); + } +} + +void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *to = (u32 *)dstPtr; + u32 *to_odd = (u32 *)(dstPtr + dstPitch); + + int from_width = width; + if(width+1 < from_width) + from_width = width+1; + u32 *from = (u32 *)srcPtr; + fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); + + for(int y = 0; y < height; y++) { + u32 *from_orig = from; + u32 *to_orig = to; + + if (y+1 < height) + fill_rgb_row_32(from+width+1, from_width, rgb_row_next, + width+1); + else + fill_rgb_row_32(from, from_width, rgb_row_next, width+1); + + // every pixel in the src region, is extended to 4 pixels in the + // destination, arranged in a square 'quad'; if the current src + // pixel is 'a', then in what follows 'b' is the src pixel to the + // right, 'c' is the src pixel below, and 'd' is the src pixel to + // the right and down + u8 *cur_row = rgb_row_cur; + u8 *next_row = rgb_row_next; + u8 *ar = cur_row++; + u8 *ag = cur_row++; + u8 *ab = cur_row++; + u8 *cr = next_row++; + u8 *cg = next_row++; + u8 *cb = next_row++; + for(int x=0; x < width; x++) { + u8 *br = cur_row++; + u8 *bg = cur_row++; + u8 *bb = cur_row++; + u8 *dr = next_row++; + u8 *dg = next_row++; + u8 *db = next_row++; + + // upper left pixel in quad: just copy it in + //*to++ = manip.rgb(*ar, *ag, *ab); +#ifdef USE_ORIGINAL_BILINEAR_PLUS + *to++ = RGB( + (((*ar)<<2) +((*ar)) + (*cr+*br+*br) )>> 3, + (((*ag)<<2) +((*ag)) + (*cg+*bg+*bg) )>> 3, + (((*ab)<<2) +((*ab)) + (*cb+*bb+*bb) )>> 3); +#else + *to++ = RGB( + (((*ar)<<3) +((*ar)<<1) + (*cr+*br+*br+*cr) )>> 4, + (((*ag)<<3) +((*ag)<<1) + (*cg+*bg+*bg+*cg) )>> 4, + (((*ab)<<3) +((*ab)<<1) + (*cb+*bb+*bb+*cb) )>> 4); +#endif + + // upper right + *to++ = RGB((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1); + + // lower left + *to_odd++ = RGB((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1); + + // lower right + *to_odd++ = RGB((*ar+*br+*cr+*dr)>>2, + (*ag+*bg+*cg+*dg)>>2, + (*ab+*bb+*cb+*db)>>2); + + // 'b' becomes 'a', 'd' becomes 'c' + ar = br; + ag = bg; + ab = bb; + cr = dr; + cg = dg; + cb = db; + } + + // the "next" rgb row becomes the current; the old current rgb row is + // recycled and serves as the new "next" row + u8 *temp; + temp = rgb_row_cur; + rgb_row_cur = rgb_row_next; + rgb_row_next = temp; + + // update the pointers for start of next pair of lines + from = (u32 *)((u8 *)from_orig + srcPitch); + to = (u32 *)((u8 *)to_orig + (dstPitch << 1)); + to_odd = (u32 *)((u8 *)to + dstPitch); + } +} + diff --git a/src/bios.cpp b/src/bios.cpp new file mode 100644 index 0000000..aa17dc2 --- /dev/null +++ b/src/bios.cpp @@ -0,0 +1,1158 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#include "GBA.h" +#include "bios.h" +#include "GBAinline.h" +#include "Globals.h" + +s16 sineTable[256] = { + (s16)0x0000, (s16)0x0192, (s16)0x0323, (s16)0x04B5, (s16)0x0645, (s16)0x07D5, (s16)0x0964, (s16)0x0AF1, + (s16)0x0C7C, (s16)0x0E05, (s16)0x0F8C, (s16)0x1111, (s16)0x1294, (s16)0x1413, (s16)0x158F, (s16)0x1708, + (s16)0x187D, (s16)0x19EF, (s16)0x1B5D, (s16)0x1CC6, (s16)0x1E2B, (s16)0x1F8B, (s16)0x20E7, (s16)0x223D, + (s16)0x238E, (s16)0x24DA, (s16)0x261F, (s16)0x275F, (s16)0x2899, (s16)0x29CD, (s16)0x2AFA, (s16)0x2C21, + (s16)0x2D41, (s16)0x2E5A, (s16)0x2F6B, (s16)0x3076, (s16)0x3179, (s16)0x3274, (s16)0x3367, (s16)0x3453, + (s16)0x3536, (s16)0x3612, (s16)0x36E5, (s16)0x37AF, (s16)0x3871, (s16)0x392A, (s16)0x39DA, (s16)0x3A82, + (s16)0x3B20, (s16)0x3BB6, (s16)0x3C42, (s16)0x3CC5, (s16)0x3D3E, (s16)0x3DAE, (s16)0x3E14, (s16)0x3E71, + (s16)0x3EC5, (s16)0x3F0E, (s16)0x3F4E, (s16)0x3F84, (s16)0x3FB1, (s16)0x3FD3, (s16)0x3FEC, (s16)0x3FFB, + (s16)0x4000, (s16)0x3FFB, (s16)0x3FEC, (s16)0x3FD3, (s16)0x3FB1, (s16)0x3F84, (s16)0x3F4E, (s16)0x3F0E, + (s16)0x3EC5, (s16)0x3E71, (s16)0x3E14, (s16)0x3DAE, (s16)0x3D3E, (s16)0x3CC5, (s16)0x3C42, (s16)0x3BB6, + (s16)0x3B20, (s16)0x3A82, (s16)0x39DA, (s16)0x392A, (s16)0x3871, (s16)0x37AF, (s16)0x36E5, (s16)0x3612, + (s16)0x3536, (s16)0x3453, (s16)0x3367, (s16)0x3274, (s16)0x3179, (s16)0x3076, (s16)0x2F6B, (s16)0x2E5A, + (s16)0x2D41, (s16)0x2C21, (s16)0x2AFA, (s16)0x29CD, (s16)0x2899, (s16)0x275F, (s16)0x261F, (s16)0x24DA, + (s16)0x238E, (s16)0x223D, (s16)0x20E7, (s16)0x1F8B, (s16)0x1E2B, (s16)0x1CC6, (s16)0x1B5D, (s16)0x19EF, + (s16)0x187D, (s16)0x1708, (s16)0x158F, (s16)0x1413, (s16)0x1294, (s16)0x1111, (s16)0x0F8C, (s16)0x0E05, + (s16)0x0C7C, (s16)0x0AF1, (s16)0x0964, (s16)0x07D5, (s16)0x0645, (s16)0x04B5, (s16)0x0323, (s16)0x0192, + (s16)0x0000, (s16)0xFE6E, (s16)0xFCDD, (s16)0xFB4B, (s16)0xF9BB, (s16)0xF82B, (s16)0xF69C, (s16)0xF50F, + (s16)0xF384, (s16)0xF1FB, (s16)0xF074, (s16)0xEEEF, (s16)0xED6C, (s16)0xEBED, (s16)0xEA71, (s16)0xE8F8, + (s16)0xE783, (s16)0xE611, (s16)0xE4A3, (s16)0xE33A, (s16)0xE1D5, (s16)0xE075, (s16)0xDF19, (s16)0xDDC3, + (s16)0xDC72, (s16)0xDB26, (s16)0xD9E1, (s16)0xD8A1, (s16)0xD767, (s16)0xD633, (s16)0xD506, (s16)0xD3DF, + (s16)0xD2BF, (s16)0xD1A6, (s16)0xD095, (s16)0xCF8A, (s16)0xCE87, (s16)0xCD8C, (s16)0xCC99, (s16)0xCBAD, + (s16)0xCACA, (s16)0xC9EE, (s16)0xC91B, (s16)0xC851, (s16)0xC78F, (s16)0xC6D6, (s16)0xC626, (s16)0xC57E, + (s16)0xC4E0, (s16)0xC44A, (s16)0xC3BE, (s16)0xC33B, (s16)0xC2C2, (s16)0xC252, (s16)0xC1EC, (s16)0xC18F, + (s16)0xC13B, (s16)0xC0F2, (s16)0xC0B2, (s16)0xC07C, (s16)0xC04F, (s16)0xC02D, (s16)0xC014, (s16)0xC005, + (s16)0xC000, (s16)0xC005, (s16)0xC014, (s16)0xC02D, (s16)0xC04F, (s16)0xC07C, (s16)0xC0B2, (s16)0xC0F2, + (s16)0xC13B, (s16)0xC18F, (s16)0xC1EC, (s16)0xC252, (s16)0xC2C2, (s16)0xC33B, (s16)0xC3BE, (s16)0xC44A, + (s16)0xC4E0, (s16)0xC57E, (s16)0xC626, (s16)0xC6D6, (s16)0xC78F, (s16)0xC851, (s16)0xC91B, (s16)0xC9EE, + (s16)0xCACA, (s16)0xCBAD, (s16)0xCC99, (s16)0xCD8C, (s16)0xCE87, (s16)0xCF8A, (s16)0xD095, (s16)0xD1A6, + (s16)0xD2BF, (s16)0xD3DF, (s16)0xD506, (s16)0xD633, (s16)0xD767, (s16)0xD8A1, (s16)0xD9E1, (s16)0xDB26, + (s16)0xDC72, (s16)0xDDC3, (s16)0xDF19, (s16)0xE075, (s16)0xE1D5, (s16)0xE33A, (s16)0xE4A3, (s16)0xE611, + (s16)0xE783, (s16)0xE8F8, (s16)0xEA71, (s16)0xEBED, (s16)0xED6C, (s16)0xEEEF, (s16)0xF074, (s16)0xF1FB, + (s16)0xF384, (s16)0xF50F, (s16)0xF69C, (s16)0xF82B, (s16)0xF9BB, (s16)0xFB4B, (s16)0xFCDD, (s16)0xFE6E +}; + +void BIOS_ArcTan() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("ArcTan: %08x (VCOUNT=%2d)\n", + reg[0].I, + VCOUNT); + } +#endif + + s32 a = -((s32)(reg[0].I * reg[0].I)) >> 14; + s32 b = ((0xA9 * a) >> 14) + 0x390; + b = ((b * a) >> 14) + 0x91C; + b = ((b * a) >> 14) + 0xFB6; + b = ((b * a) >> 14) + 0x16AA; + b = ((b * a) >> 14) + 0x2081; + b = ((b * a) >> 14) + 0x3651; + b = ((b * a) >> 14) + 0xA2F9; + reg[0].I = (reg[0].I * b) >> 16; + +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("ArcTan: return=%08x\n", + reg[0].I); + } +#endif +} + +void BIOS_ArcTan2() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("ArcTan2: %08x,%08x (VCOUNT=%2d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + s16 x = reg[0].I; + s16 y = reg[1].I; + + if (y == 0) { + reg[0].I = 0x8000 & x; + reg[3].I = 0x170; + } else { + if (x == 0) { + reg[0].I = (0x8000 & y) + 0x4000; + reg[3].I = 0x170; + } else { + if (abs(x) > abs(y)) { + reg[1].I = x; + reg[0].I = y << 14; + BIOS_Div(); + BIOS_ArcTan(); + if (x < 0) + reg[0].I = 0x8000 + reg[0].I; + else + reg[0].I = ((y & 0x8000) << 1 ) + reg[0].I; + reg[3].I = 0x170; + } else { + reg[0].I = x << 14; + BIOS_Div(); + BIOS_ArcTan(); + reg[0].I = (0x4000 + (y & 0x8000)) - reg[0].I; + reg[3].I = 0x170; + } + } + } + +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("ArcTan2: return=%08x\n", + reg[0].I); + } +#endif +} + +void BIOS_BitUnPack() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("BitUnPack: %08x,%08x,%08x (VCOUNT=%2d)\n", + reg[0].I, + reg[1].I, + reg[2].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + u32 header = reg[2].I; + + int len = CPUReadHalfWord(header); + // check address + int bits = CPUReadByte(header+2); + int revbits = 8 - bits; + // u32 value = 0; + u32 base = CPUReadMemory(header+4); + bool addBase = (base & 0x80000000) ? true : false; + base &= 0x7fffffff; + int dataSize = CPUReadByte(header+3); + + int data = 0; + int bitwritecount = 0; + while(1) { + len -= 1; + if(len < 0) + break; + int mask = 0xff >> revbits; + u8 b = CPUReadByte(source); + source++; + int bitcount = 0; + while(1) { + if(bitcount >= 8) + break; + u32 d = b & mask; + u32 temp = d >> bitcount; + if(!temp && addBase) { + temp += base; + } + data |= temp << bitwritecount; + bitwritecount += dataSize; + if(bitwritecount >= 32) { + CPUWriteMemory(dest, data); + dest += 4; + data = 0; + bitwritecount = 0; + } + mask <<= bits; + bitcount += bits; + } + } +} + +void BIOS_BgAffineSet() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("BgAffineSet: %08x,%08x,%08x (VCOUNT=%2d)\n", + reg[0].I, + reg[1].I, + reg[2].I, + VCOUNT); + } +#endif + + u32 src = reg[0].I; + u32 dest = reg[1].I; + int num = reg[2].I; + + for(int i = 0; i < num; i++) { + s32 cx = CPUReadMemory(src); + src+=4; + s32 cy = CPUReadMemory(src); + src+=4; + s16 dispx = CPUReadHalfWord(src); + src+=2; + s16 dispy = CPUReadHalfWord(src); + src+=2; + s16 rx = CPUReadHalfWord(src); + src+=2; + s16 ry = CPUReadHalfWord(src); + src+=2; + u16 theta = CPUReadHalfWord(src)>>8; + src+=4; // keep structure alignment + s32 a = sineTable[(theta+0x40)&255]; + s32 b = sineTable[theta]; + + s16 dx = (rx * a)>>14; + s16 dmx = (rx * b)>>14; + s16 dy = (ry * b)>>14; + s16 dmy = (ry * a)>>14; + + CPUWriteHalfWord(dest, dx); + dest += 2; + CPUWriteHalfWord(dest, -dmx); + dest += 2; + CPUWriteHalfWord(dest, dy); + dest += 2; + CPUWriteHalfWord(dest, dmy); + dest += 2; + + s32 startx = cx - dx * dispx + dmx * dispy; + s32 starty = cy - dy * dispx - dmy * dispy; + + CPUWriteMemory(dest, startx); + dest += 4; + CPUWriteMemory(dest, starty); + dest += 4; + } +} + +void BIOS_CpuSet() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("CpuSet: 0x%08x,0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, reg[1].I, + reg[2].I, VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + u32 cnt = reg[2].I; + + if(((source & 0xe000000) == 0) || + ((source + (((cnt << 11)>>9) & 0x1fffff)) & 0xe000000) == 0) + return; + + int count = cnt & 0x1FFFFF; + + // 32-bit ? + if((cnt >> 26) & 1) { + // needed for 32-bit mode! + source &= 0xFFFFFFFC; + dest &= 0xFFFFFFFC; + // fill ? + if((cnt >> 24) & 1) { + u32 value = CPUReadMemory(source); + while(count) { + CPUWriteMemory(dest, value); + dest += 4; + count--; + } + } else { + // copy + while(count) { + CPUWriteMemory(dest, CPUReadMemory(source)); + source += 4; + dest += 4; + count--; + } + } + } else { + // 16-bit fill? + if((cnt >> 24) & 1) { + u16 value = CPUReadHalfWord(source); + while(count) { + CPUWriteHalfWord(dest, value); + dest += 2; + count--; + } + } else { + // copy + while(count) { + CPUWriteHalfWord(dest, CPUReadHalfWord(source)); + source += 2; + dest += 2; + count--; + } + } + } +} + +void BIOS_CpuFastSet() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("CpuFastSet: 0x%08x,0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, reg[1].I, + reg[2].I, VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + u32 cnt = reg[2].I; + + if(((source & 0xe000000) == 0) || + ((source + (((cnt << 11)>>9) & 0x1fffff)) & 0xe000000) == 0) + return; + + // needed for 32-bit mode! + source &= 0xFFFFFFFC; + dest &= 0xFFFFFFFC; + + int count = cnt & 0x1FFFFF; + + // fill? + if((cnt >> 24) & 1) { + while(count > 0) { + // BIOS always transfers 32 bytes at a time + u32 value = CPUReadMemory(source); + for(int i = 0; i < 8; i++) { + CPUWriteMemory(dest, value); + dest += 4; + } + count -= 8; + } + } else { + // copy + while(count > 0) { + // BIOS always transfers 32 bytes at a time + for(int i = 0; i < 8; i++) { + CPUWriteMemory(dest, CPUReadMemory(source)); + source += 4; + dest += 4; + } + count -= 8; + } + } +} + +void BIOS_Diff8bitUnFilterWram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Diff8bitUnFilterWram: 0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, + reg[1].I, VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff) & 0xe000000) == 0)) + return; + + int len = header >> 8; + + u8 data = CPUReadByte(source++); + CPUWriteByte(dest++, data); + len--; + + while(len > 0) { + u8 diff = CPUReadByte(source++); + data += diff; + CPUWriteByte(dest++, data); + len--; + } +} + +void BIOS_Diff8bitUnFilterVram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Diff8bitUnFilterVram: 0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, + reg[1].I, VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int len = header >> 8; + + u8 data = CPUReadByte(source++); + u16 writeData = data; + int shift = 8; + int bytes = 1; + + while(len >= 2) { + u8 diff = CPUReadByte(source++); + data += diff; + writeData |= (data << shift); + bytes++; + shift += 8; + if(bytes == 2) { + CPUWriteHalfWord(dest, writeData); + dest += 2; + len -= 2; + bytes = 0; + writeData = 0; + shift = 0; + } + } +} + +void BIOS_Diff16bitUnFilter() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Diff16bitUnFilter: 0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, + reg[1].I, VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int len = header >> 8; + + u16 data = CPUReadHalfWord(source); + source += 2; + CPUWriteHalfWord(dest, data); + dest += 2; + len -= 2; + + while(len >= 2) { + u16 diff = CPUReadHalfWord(source); + source += 2; + data += diff; + CPUWriteHalfWord(dest, data); + dest += 2; + len -= 2; + } +} + +void BIOS_Div() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Div: 0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + int number = reg[0].I; + int denom = reg[1].I; + + if(denom != 0) { + reg[0].I = number / denom; + reg[1].I = number % denom; + s32 temp = (s32)reg[0].I; + reg[3].I = temp < 0 ? (u32)-temp : (u32)temp; + } +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Div: return=0x%08x,0x%08x,0x%08x\n", + reg[0].I, + reg[1].I, + reg[3].I); + } +#endif +} + +void BIOS_DivARM() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("DivARM: 0x%08x, (VCOUNT=%d)\n", + reg[0].I, + VCOUNT); + } +#endif + + u32 temp = reg[0].I; + reg[0].I = reg[1].I; + reg[1].I = temp; + BIOS_Div(); +} + +void BIOS_HuffUnComp() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("HuffUnComp: 0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + u8 treeSize = CPUReadByte(source++); + + u32 treeStart = source; + + source += (treeSize<<1) + 1; + + int len = header >> 8; + + u32 mask = 0x80000000; + u32 data = CPUReadMemory(source); + source += 4; + + int pos = 0; + u8 rootNode = CPUReadByte(treeStart); + u8 currentNode = rootNode; + bool writeData = false; + int byteShift = 0; + int byteCount = 0; + u32 writeValue = 0; + + if((header & 0x0F) == 8) { + while(len > 0) { + // take left + if(pos == 0) + pos++; + else + pos += (((currentNode & 0x3F)+1)<<1); + + if(data & mask) { + // right + if(currentNode & 0x40) + writeData = true; + currentNode = CPUReadByte(treeStart+pos+1); + } else { + // left + if(currentNode & 0x80) + writeData = true; + currentNode = CPUReadByte(treeStart+pos); + } + + if(writeData) { + writeValue |= (currentNode << byteShift); + byteCount++; + byteShift += 8; + + pos = 0; + currentNode = rootNode; + writeData = false; + + if(byteCount == 4) { + byteCount = 0; + byteShift = 0; + CPUWriteMemory(dest, writeValue); + writeValue = 0; + dest += 4; + len -= 4; + } + } + mask >>= 1; + if(mask == 0) { + mask = 0x80000000; + data = CPUReadMemory(source); + source += 4; + } + } + } else { + int halfLen = 0; + int value = 0; + while(len > 0) { + // take left + if(pos == 0) + pos++; + else + pos += (((currentNode & 0x3F)+1)<<1); + + if((data & mask)) { + // right + if(currentNode & 0x40) + writeData = true; + currentNode = CPUReadByte(treeStart+pos+1); + } else { + // left + if(currentNode & 0x80) + writeData = true; + currentNode = CPUReadByte(treeStart+pos); + } + + if(writeData) { + if(halfLen == 0) + value |= currentNode; + else + value |= (currentNode<<4); + + halfLen += 4; + if(halfLen == 8) { + writeValue |= (value << byteShift); + byteCount++; + byteShift += 8; + + halfLen = 0; + value = 0; + + if(byteCount == 4) { + byteCount = 0; + byteShift = 0; + CPUWriteMemory(dest, writeValue); + dest += 4; + writeValue = 0; + len -= 4; + } + } + pos = 0; + currentNode = rootNode; + writeData = false; + } + mask >>= 1; + if(mask == 0) { + mask = 0x80000000; + data = CPUReadMemory(source); + source += 4; + } + } + } +} + +void BIOS_LZ77UnCompVram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("LZ77UnCompVram: 0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int byteCount = 0; + int byteShift = 0; + u32 writeValue = 0; + + int len = header >> 8; + + while(len > 0) { + u8 d = CPUReadByte(source++); + + if(d) { + for(int i = 0; i < 8; i++) { + if(d & 0x80) { + u16 data = CPUReadByte(source++) << 8; + data |= CPUReadByte(source++); + int length = (data >> 12) + 3; + int offset = (data & 0x0FFF); + u32 windowOffset = dest + byteCount - offset - 1; + for(int i = 0; i < length; i++) { + writeValue |= (CPUReadByte(windowOffset++) << byteShift); + byteShift += 8; + byteCount++; + + if(byteCount == 2) { + CPUWriteHalfWord(dest, writeValue); + dest += 2; + byteCount = 0; + byteShift = 0; + writeValue = 0; + } + len--; + if(len == 0) + return; + } + } else { + writeValue |= (CPUReadByte(source++) << byteShift); + byteShift += 8; + byteCount++; + if(byteCount == 2) { + CPUWriteHalfWord(dest, writeValue); + dest += 2; + byteCount = 0; + byteShift = 0; + writeValue = 0; + } + len--; + if(len == 0) + return; + } + d <<= 1; + } + } else { + for(int i = 0; i < 8; i++) { + writeValue |= (CPUReadByte(source++) << byteShift); + byteShift += 8; + byteCount++; + if(byteCount == 2) { + CPUWriteHalfWord(dest, writeValue); + dest += 2; + byteShift = 0; + byteCount = 0; + writeValue = 0; + } + len--; + if(len == 0) + return; + } + } + } +} + +void BIOS_LZ77UnCompWram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("LZ77UnCompWram: 0x%08x,0x%08x (VCOUNT=%d)\n", reg[0].I, reg[1].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int len = header >> 8; + + while(len > 0) { + u8 d = CPUReadByte(source++); + + if(d) { + for(int i = 0; i < 8; i++) { + if(d & 0x80) { + u16 data = CPUReadByte(source++) << 8; + data |= CPUReadByte(source++); + int length = (data >> 12) + 3; + int offset = (data & 0x0FFF); + u32 windowOffset = dest - offset - 1; + for(int i = 0; i < length; i++) { + CPUWriteByte(dest++, CPUReadByte(windowOffset++)); + len--; + if(len == 0) + return; + } + } else { + CPUWriteByte(dest++, CPUReadByte(source++)); + len--; + if(len == 0) + return; + } + d <<= 1; + } + } else { + for(int i = 0; i < 8; i++) { + CPUWriteByte(dest++, CPUReadByte(source++)); + len--; + if(len == 0) + return; + } + } + } +} + +void BIOS_ObjAffineSet() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("ObjAffineSet: 0x%08x,0x%08x,0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + reg[2].I, + reg[3].I, + VCOUNT); + } +#endif + + u32 src = reg[0].I; + u32 dest = reg[1].I; + int num = reg[2].I; + int offset = reg[3].I; + + for(int i = 0; i < num; i++) { + s16 rx = CPUReadHalfWord(src); + src+=2; + s16 ry = CPUReadHalfWord(src); + src+=2; + u16 theta = CPUReadHalfWord(src)>>8; + src+=4; // keep structure alignment + + s32 a = (s32)sineTable[(theta+0x40)&255]; + s32 b = (s32)sineTable[theta]; + + s16 dx = ((s32)rx * a)>>14; + s16 dmx = ((s32)rx * b)>>14; + s16 dy = ((s32)ry * b)>>14; + s16 dmy = ((s32)ry * a)>>14; + + CPUWriteHalfWord(dest, dx); + dest += offset; + CPUWriteHalfWord(dest, -dmx); + dest += offset; + CPUWriteHalfWord(dest, dy); + dest += offset; + CPUWriteHalfWord(dest, dmy); + dest += offset; + } +} + +void BIOS_RegisterRamReset(u32 flags) +{ + // no need to trace here. this is only called directly from GBA.cpp + // to emulate bios initialization + + if(flags) { + if(flags & 0x01) { + // clear work RAM + memset(workRAM, 0, 0x40000); + } + if(flags & 0x02) { + // clear internal RAM + memset(internalRAM, 0, 0x7e00); // don't clear 0x7e00-0x7fff + } + if(flags & 0x04) { + // clear palette RAM + memset(paletteRAM, 0, 0x400); + } + if(flags & 0x08) { + // clear VRAM + memset(vram, 0, 0x18000); + } + if(flags & 0x10) { + // clean OAM + memset(oam, 0, 0x400); + } + + if(flags & 0x80) { + int i; + for(i = 0; i < 8; i++) + CPUUpdateRegister(0x200+i*2, 0); + + CPUUpdateRegister(0x202, 0xFFFF); + + for(i = 0; i < 8; i++) + CPUUpdateRegister(0x4+i*2, 0); + + for(i = 0; i < 16; i++) + CPUUpdateRegister(0x20+i*2, 0); + + for(i = 0; i < 24; i++) + CPUUpdateRegister(0xb0+i*2, 0); + + CPUUpdateRegister(0x130, 0); + CPUUpdateRegister(0x20, 0x100); + CPUUpdateRegister(0x30, 0x100); + CPUUpdateRegister(0x26, 0x100); + CPUUpdateRegister(0x36, 0x100); + } + + if(flags & 0x20) { + int i; + for(i = 0; i < 8; i++) + CPUUpdateRegister(0x110+i*2, 0); + CPUUpdateRegister(0x134, 0x8000); + for(i = 0; i < 7; i++) + CPUUpdateRegister(0x140+i*2, 0); + } + + if(flags & 0x40) { + int i; + CPUWriteByte(0x4000084, 0); + CPUWriteByte(0x4000084, 0x80); + CPUWriteMemory(0x4000080, 0x880e0000); + CPUUpdateRegister(0x88, CPUReadHalfWord(0x4000088)&0x3ff); + CPUWriteByte(0x4000070, 0x70); + for(i = 0; i < 8; i++) + CPUUpdateRegister(0x90+i*2, 0); + CPUWriteByte(0x4000070, 0); + for(i = 0; i < 8; i++) + CPUUpdateRegister(0x90+i*2, 0); + CPUWriteByte(0x4000084, 0); + } + } +} + +void BIOS_RegisterRamReset() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("RegisterRamReset: 0x%08x (VCOUNT=%d)\n", + reg[0].I, + VCOUNT); + } +#endif + + BIOS_RegisterRamReset(reg[0].I); +} + +void BIOS_RLUnCompVram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("RLUnCompVram: 0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int len = header >> 8; + int byteCount = 0; + int byteShift = 0; + u32 writeValue = 0; + + while(len > 0) { + u8 d = CPUReadByte(source++); + int l = d & 0x7F; + if(d & 0x80) { + u8 data = CPUReadByte(source++); + l += 3; + for(int i = 0;i < l; i++) { + writeValue |= (data << byteShift); + byteShift += 8; + byteCount++; + + if(byteCount == 2) { + CPUWriteHalfWord(dest, writeValue); + dest += 2; + byteCount = 0; + byteShift = 0; + writeValue = 0; + } + len--; + if(len == 0) + return; + } + } else { + l++; + for(int i = 0; i < l; i++) { + writeValue |= (CPUReadByte(source++) << byteShift); + byteShift += 8; + byteCount++; + if(byteCount == 2) { + CPUWriteHalfWord(dest, writeValue); + dest += 2; + byteCount = 0; + byteShift = 0; + writeValue = 0; + } + len--; + if(len == 0) + return; + } + } + } +} + +void BIOS_RLUnCompWram() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("RLUnCompWram: 0x%08x,0x%08x (VCOUNT=%d)\n", + reg[0].I, + reg[1].I, + VCOUNT); + } +#endif + + u32 source = reg[0].I; + u32 dest = reg[1].I; + + u32 header = CPUReadMemory(source); + source += 4; + + if(((source & 0xe000000) == 0) || + ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) + return; + + int len = header >> 8; + + while(len > 0) { + u8 d = CPUReadByte(source++); + int l = d & 0x7F; + if(d & 0x80) { + u8 data = CPUReadByte(source++); + l += 3; + for(int i = 0;i < l; i++) { + CPUWriteByte(dest++, data); + len--; + if(len == 0) + return; + } + } else { + l++; + for(int i = 0; i < l; i++) { + CPUWriteByte(dest++, CPUReadByte(source++)); + len--; + if(len == 0) + return; + } + } + } +} + +void BIOS_SoftReset() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("SoftReset: (VCOUNT=%d)\n", VCOUNT); + } +#endif + + armState = true; + armMode = 0x1F; + armIrqEnable = false; + C_FLAG = V_FLAG = N_FLAG = Z_FLAG = false; + reg[13].I = 0x03007F00; + reg[14].I = 0x00000000; + reg[16].I = 0x00000000; + reg[R13_IRQ].I = 0x03007FA0; + reg[R14_IRQ].I = 0x00000000; + reg[SPSR_IRQ].I = 0x00000000; + reg[R13_SVC].I = 0x03007FE0; + reg[R14_SVC].I = 0x00000000; + reg[SPSR_SVC].I = 0x00000000; + u8 b = internalRAM[0x7ffa]; + + memset(&internalRAM[0x7e00], 0, 0x200); + + if(b) { + armNextPC = 0x02000000; + reg[15].I = 0x02000004; + } else { + armNextPC = 0x08000000; + reg[15].I = 0x08000004; + } +} + +void BIOS_Sqrt() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Sqrt: %08x (VCOUNT=%2d)\n", + reg[0].I, + VCOUNT); + } +#endif + reg[0].I = (u32)sqrt((double)reg[0].I); +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Sqrt: return=%08x\n", + reg[0].I); + } +#endif +} + +void BIOS_MidiKey2Freq() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("MidiKey2Freq: WaveData=%08x mk=%08x fp=%08x\n", + reg[0].I, + reg[1].I, + reg[2].I); + } +#endif + int freq = CPUReadMemory(reg[0].I+4); + double tmp; + tmp = ((double)(180 - reg[1].I)) - ((double)reg[2].I / 256.f); + tmp = pow((double)2.f, tmp / 12.f); + reg[0].I = (int)((double)freq / tmp); + +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("MidiKey2Freq: return %08x\n", + reg[0].I); + } +#endif +} + +void BIOS_SndDriverJmpTableCopy() +{ +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("SndDriverJmpTableCopy: dest=%08x\n", + reg[0].I); + } +#endif + for(int i = 0; i < 0x24; i++) { + CPUWriteMemory(reg[0].I, 0x9c); + reg[0].I += 4; + } +} diff --git a/src/bios.h b/src/bios.h new file mode 100644 index 0000000..58b3417 --- /dev/null +++ b/src/bios.h @@ -0,0 +1,46 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_BIOS_H +#define VBA_BIOS_H + +extern void BIOS_ArcTan(); +extern void BIOS_ArcTan2(); +extern void BIOS_BitUnPack(); +extern void BIOS_BgAffineSet(); +extern void BIOS_CpuSet(); +extern void BIOS_CpuFastSet(); +extern void BIOS_Diff8bitUnFilterWram(); +extern void BIOS_Diff8bitUnFilterVram(); +extern void BIOS_Diff16bitUnFilter(); +extern void BIOS_Div(); +extern void BIOS_DivARM(); +extern void BIOS_HuffUnComp(); +extern void BIOS_LZ77UnCompVram(); +extern void BIOS_LZ77UnCompWram(); +extern void BIOS_ObjAffineSet(); +extern void BIOS_RegisterRamReset(); +extern void BIOS_RegisterRamReset(u32); +extern void BIOS_RLUnCompVram(); +extern void BIOS_RLUnCompWram(); +extern void BIOS_SoftReset(); +extern void BIOS_Sqrt(); +extern void BIOS_MidiKey2Freq(); +extern void BIOS_SndDriverJmpTableCopy(); +#endif // VBA_BIOS_H diff --git a/src/elf.cpp b/src/elf.cpp new file mode 100644 index 0000000..90be846 --- /dev/null +++ b/src/elf.cpp @@ -0,0 +1,2997 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#include "GBA.h" +#include "Port.h" +#include "elf.h" +#include "NLS.h" + +#define elfReadMemory(addr) \ + READ32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define DW_TAG_array_type 0x01 +#define DW_TAG_enumeration_type 0x04 +#define DW_TAG_formal_parameter 0x05 +#define DW_TAG_label 0x0a +#define DW_TAG_lexical_block 0x0b +#define DW_TAG_member 0x0d +#define DW_TAG_pointer_type 0x0f +#define DW_TAG_reference_type 0x10 +#define DW_TAG_compile_unit 0x11 +#define DW_TAG_structure_type 0x13 +#define DW_TAG_subroutine_type 0x15 +#define DW_TAG_typedef 0x16 +#define DW_TAG_union_type 0x17 +#define DW_TAG_unspecified_parameters 0x18 +#define DW_TAG_inheritance 0x1c +#define DW_TAG_inlined_subroutine 0x1d +#define DW_TAG_subrange_type 0x21 +#define DW_TAG_base_type 0x24 +#define DW_TAG_const_type 0x26 +#define DW_TAG_enumerator 0x28 +#define DW_TAG_subprogram 0x2e +#define DW_TAG_variable 0x34 +#define DW_TAG_volatile_type 0x35 + +#define DW_AT_sibling 0x01 +#define DW_AT_location 0x02 +#define DW_AT_name 0x03 +#define DW_AT_byte_size 0x0b +#define DW_AT_bit_offset 0x0c +#define DW_AT_bit_size 0x0d +#define DW_AT_stmt_list 0x10 +#define DW_AT_low_pc 0x11 +#define DW_AT_high_pc 0x12 +#define DW_AT_language 0x13 +#define DW_AT_compdir 0x1b +#define DW_AT_const_value 0x1c +#define DW_AT_containing_type 0x1d +#define DW_AT_inline 0x20 +#define DW_AT_producer 0x25 +#define DW_AT_prototyped 0x27 +#define DW_AT_upper_bound 0x2f +#define DW_AT_abstract_origin 0x31 +#define DW_AT_accessibility 0x32 +#define DW_AT_artificial 0x34 +#define DW_AT_data_member_location 0x38 +#define DW_AT_decl_file 0x3a +#define DW_AT_decl_line 0x3b +#define DW_AT_declaration 0x3c +#define DW_AT_encoding 0x3e +#define DW_AT_external 0x3f +#define DW_AT_frame_base 0x40 +#define DW_AT_macro_info 0x43 +#define DW_AT_specification 0x47 +#define DW_AT_type 0x49 +#define DW_AT_virtuality 0x4c +#define DW_AT_vtable_elem_location 0x4d +// DWARF 2.1/3.0 extensions +#define DW_AT_entry_pc 0x52 +#define DW_AT_ranges 0x55 +// ARM Compiler extensions +#define DW_AT_proc_body 0x2000 +#define DW_AT_save_offset 0x2001 +#define DW_AT_user_2002 0x2002 +// MIPS extensions +#define DW_AT_MIPS_linkage_name 0x2007 + +#define DW_FORM_addr 0x01 +#define DW_FORM_data2 0x05 +#define DW_FORM_data4 0x06 +#define DW_FORM_string 0x08 +#define DW_FORM_block 0x09 +#define DW_FORM_block1 0x0a +#define DW_FORM_data1 0x0b +#define DW_FORM_flag 0x0c +#define DW_FORM_sdata 0x0d +#define DW_FORM_strp 0x0e +#define DW_FORM_udata 0x0f +#define DW_FORM_ref_addr 0x10 +#define DW_FORM_ref4 0x13 +#define DW_FORM_ref_udata 0x15 +#define DW_FORM_indirect 0x16 + +#define DW_OP_addr 0x03 +#define DW_OP_plus_uconst 0x23 +#define DW_OP_reg0 0x50 +#define DW_OP_reg1 0x51 +#define DW_OP_reg2 0x52 +#define DW_OP_reg3 0x53 +#define DW_OP_reg4 0x54 +#define DW_OP_reg5 0x55 +#define DW_OP_reg6 0x56 +#define DW_OP_reg7 0x57 +#define DW_OP_reg8 0x58 +#define DW_OP_reg9 0x59 +#define DW_OP_reg10 0x5a +#define DW_OP_reg11 0x5b +#define DW_OP_reg12 0x5c +#define DW_OP_reg13 0x5d +#define DW_OP_reg14 0x5e +#define DW_OP_reg15 0x5f +#define DW_OP_fbreg 0x91 + +#define DW_LNS_extended_op 0x00 +#define DW_LNS_copy 0x01 +#define DW_LNS_advance_pc 0x02 +#define DW_LNS_advance_line 0x03 +#define DW_LNS_set_file 0x04 +#define DW_LNS_set_column 0x05 +#define DW_LNS_negate_stmt 0x06 +#define DW_LNS_set_basic_block 0x07 +#define DW_LNS_const_add_pc 0x08 +#define DW_LNS_fixed_advance_pc 0x09 + +#define DW_LNE_end_sequence 0x01 +#define DW_LNE_set_address 0x02 +#define DW_LNE_define_file 0x03 + +#define DW_CFA_advance_loc 0x01 +#define DW_CFA_offset 0x02 +#define DW_CFA_restore 0x03 +#define DW_CFA_set_loc 0x01 +#define DW_CFA_advance_loc1 0x02 +#define DW_CFA_advance_loc2 0x03 +#define DW_CFA_advance_loc4 0x04 +#define DW_CFA_offset_extended 0x05 +#define DW_CFA_restore_extended 0x06 +#define DW_CFA_undefined 0x07 +#define DW_CFA_same_value 0x08 +#define DW_CFA_register 0x09 +#define DW_CFA_remember_state 0x0a +#define DW_CFA_restore_state 0x0b +#define DW_CFA_def_cfa 0x0c +#define DW_CFA_def_cfa_register 0x0d +#define DW_CFA_def_cfa_offset 0x0e +#define DW_CFA_nop 0x00 + +#define CASE_TYPE_TAG \ + case DW_TAG_const_type:\ + case DW_TAG_volatile_type:\ + case DW_TAG_pointer_type:\ + case DW_TAG_base_type:\ + case DW_TAG_array_type:\ + case DW_TAG_structure_type:\ + case DW_TAG_union_type:\ + case DW_TAG_typedef:\ + case DW_TAG_subroutine_type:\ + case DW_TAG_enumeration_type:\ + case DW_TAG_enumerator:\ + case DW_TAG_reference_type + +struct ELFcie { + ELFcie *next; + u32 offset; + u8 *augmentation; + u32 codeAlign; + s32 dataAlign; + int returnAddress; + u8 *data; + u32 dataLen; +}; + +struct ELFfde { + ELFcie *cie; + u32 address; + u32 end; + u8 *data; + u32 dataLen; +}; + +enum ELFRegMode { + REG_NOT_SET, + REG_OFFSET, + REG_REGISTER +}; + + +struct ELFFrameStateRegister { + ELFRegMode mode; + int reg; + s32 offset; +}; + +struct ELFFrameStateRegisters { + ELFFrameStateRegister regs[16]; + ELFFrameStateRegisters *previous; +}; + +enum ELFCfaMode { + CFA_NOT_SET, + CFA_REG_OFFSET +}; + +struct ELFFrameState { + ELFFrameStateRegisters registers; + + ELFCfaMode cfaMode; + int cfaRegister; + s32 cfaOffset; + + u32 pc; + + int dataAlign; + int codeAlign; + int returnAddress; +}; + +extern bool cpuIsMultiBoot; + +Symbol *elfSymbols = NULL; +char *elfSymbolsStrTab = NULL; +int elfSymbolsCount = 0; + +ELFSectionHeader **elfSectionHeaders = NULL; +char *elfSectionHeadersStringTable = NULL; +int elfSectionHeadersCount = 0; +u8 *elfFileData = NULL; + +CompileUnit *elfCompileUnits = NULL; +DebugInfo *elfDebugInfo = NULL; +char *elfDebugStrings = NULL; + +ELFcie *elfCies = NULL; +ELFfde **elfFdes = NULL; +int elfFdeCount = 0; + +CompileUnit *elfCurrentUnit = NULL; + +u32 elfRead4Bytes(u8 *); +u16 elfRead2Bytes(u8 *); + +CompileUnit *elfGetCompileUnit(u32 addr) +{ + if(elfCompileUnits) { + CompileUnit *unit = elfCompileUnits; + while(unit) { + if(unit->lowPC) { + if(addr >= unit->lowPC && addr < unit->highPC) + return unit; + } else { + ARanges *r = unit->ranges; + if(r) { + int count = r->count; + for(int j = 0; j < count; j++) { + if(addr >= r->ranges[j].lowPC && addr < r->ranges[j].highPC) + return unit; + } + } + } + unit = unit->next; + } + } + return NULL; +} + +char *elfGetAddressSymbol(u32 addr) +{ + static char buffer[256]; + + CompileUnit *unit = elfGetCompileUnit(addr); + // found unit, need to find function + if(unit) { + Function *func = unit->functions; + while(func) { + if(addr >= func->lowPC && addr < func->highPC) { + int offset = addr - func->lowPC; + char *name = func->name; + if(!name) + name = ""; + if(offset) + sprintf(buffer, "%s+%d", name, offset); + else + strcpy(buffer, name); + return buffer; + } + func = func->next; + } + } + + if(elfSymbolsCount) { + for(int i = 0; i < elfSymbolsCount; i++) { + Symbol *s = &elfSymbols[i]; + if((addr >= s->value) && addr < (s->value+s->size)) { + int offset = addr-s->value; + char *name = s->name; + if(name == NULL) + name = ""; + if(offset) + sprintf(buffer, "%s+%d", name, addr-s->value); + else + strcpy(buffer, name); + return buffer; + } else if(addr == s->value) { + if(s->name) + strcpy(buffer, s->name); + else + strcpy(buffer, ""); + return buffer; + } + } + } + + return ""; +} + +bool elfFindLineInModule(u32 *addr, char *name, int line) +{ + CompileUnit *unit = elfCompileUnits; + + while(unit) { + if(unit->lineInfoTable) { + int i; + int count = unit->lineInfoTable->fileCount; + char *found = NULL; + for(i = 0; i < count; i++) { + if(strcmp(name, unit->lineInfoTable->files[i]) == 0) { + found = unit->lineInfoTable->files[i]; + break; + } + } + // found a matching filename... try to find line now + if(found) { + LineInfoItem *table = unit->lineInfoTable->lines; + count = unit->lineInfoTable->number; + for(i = 0; i < count; i++) { + if(table[i].file == found && table[i].line == line) { + *addr = table[i].address; + return true; + } + } + // we can only find a single match + return false; + } + } + unit = unit->next; + } + return false; +} + +int elfFindLine(CompileUnit *unit, Function * /* func */, u32 addr, char **f) +{ + int currentLine = -1; + if(unit->hasLineInfo) { + int count = unit->lineInfoTable->number; + LineInfoItem *table = unit->lineInfoTable->lines; + int i; + for(i = 0; i < count; i++) { + if(addr <= table[i].address) + break; + } + if(i == count) + i--; + *f = table[i].file; + currentLine = table[i].line; + } + return currentLine; +} + +bool elfFindLineInUnit(u32 *addr, CompileUnit *unit, int line) +{ + if(unit->hasLineInfo) { + int count = unit->lineInfoTable->number; + LineInfoItem *table = unit->lineInfoTable->lines; + int i; + for(i = 0; i < count; i++) { + if(line == table[i].line) { + *addr = table[i].address; + return true; + } + } + } + return false; +} + +bool elfGetCurrentFunction(u32 addr, Function **f, CompileUnit **u) +{ + CompileUnit *unit = elfGetCompileUnit(addr); + // found unit, need to find function + if(unit) { + Function *func = unit->functions; + while(func) { + if(addr >= func->lowPC && addr < func->highPC) { + *f = func; + *u = unit; + return true; + } + func = func->next; + } + } + return false; +} + +bool elfGetObject(char *name, Function *f, CompileUnit *u, Object **o) +{ + if(f && u) { + Object *v = f->variables; + + while(v) { + if(strcmp(name, v->name) == 0) { + *o = v; + return true; + } + v = v->next; + } + v = f->parameters; + while(v) { + if(strcmp(name, v->name) == 0) { + *o = v; + return true; + } + v = v->next; + } + v = u->variables; + while(v) { + if(strcmp(name, v->name) == 0) { + *o = v; + return true; + } + v = v->next; + } + } + + CompileUnit *c = elfCompileUnits; + + while(c) { + if(c != u) { + Object *v = c->variables; + while(v) { + if(strcmp(name, v->name) == 0) { + *o = v; + return true; + } + v = v->next; + } + } + c = c->next; + } + + return false; +} + +char *elfGetSymbol(int i, u32 *value, u32 *size, int *type) +{ + if(i < elfSymbolsCount) { + Symbol *s = &elfSymbols[i]; + *value = s->value; + *size = s->size; + *type = s->type; + return s->name; + } + return NULL; +} + +bool elfGetSymbolAddress(char *sym, u32 *addr, u32 *size, int *type) +{ + if(elfSymbolsCount) { + for(int i = 0; i < elfSymbolsCount; i++) { + Symbol *s = &elfSymbols[i]; + if(strcmp(sym, s->name) == 0) { + *addr = s->value; + *size = s->size; + *type = s->type; + return true; + } + } + } + return false; +} + +ELFfde *elfGetFde(u32 address) +{ + if(elfFdes) { + int i; + for(i = 0; i < elfFdeCount; i++) { + if(address >= elfFdes[i]->address && + address < elfFdes[i]->end) { + return elfFdes[i]; + } + } + } + + return NULL; +} + +void elfExecuteCFAInstructions(ELFFrameState *state, u8 *data, u32 len, + u32 pc) +{ + u8 *end = data + len; + int bytes; + int reg; + ELFFrameStateRegisters *fs; + + while(data < end && state->pc < pc) { + u8 op = *data++; + + switch(op >> 6) { + case DW_CFA_advance_loc: + state->pc += (op & 0x3f) * state->codeAlign; + break; + case DW_CFA_offset: + reg = op & 0x3f; + state->registers.regs[reg].mode = REG_OFFSET; + state->registers.regs[reg].offset = state->dataAlign * + (s32)elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_CFA_restore: + // we don't care much about the other possible settings, + // so just setting to unset is enough for now + state->registers.regs[op & 0x3f].mode = REG_NOT_SET; + break; + case 0: + switch(op & 0x3f) { + case DW_CFA_nop: + break; + case DW_CFA_advance_loc1: + state->pc += state->codeAlign * (*data++); + break; + case DW_CFA_advance_loc2: + state->pc += state->codeAlign * elfRead2Bytes(data); + data += 2; + break; + case DW_CFA_advance_loc4: + state->pc += state->codeAlign * elfRead4Bytes(data); + data += 4; + break; + case DW_CFA_offset_extended: + reg = elfReadLEB128(data, &bytes); + data += bytes; + state->registers.regs[reg].mode = REG_OFFSET; + state->registers.regs[reg].offset = state->dataAlign * + (s32)elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_CFA_restore_extended: + case DW_CFA_undefined: + case DW_CFA_same_value: + reg = elfReadLEB128(data, &bytes); + data += bytes; + state->registers.regs[reg].mode = REG_NOT_SET; + break; + case DW_CFA_register: + reg = elfReadLEB128(data, &bytes); + data += bytes; + state->registers.regs[reg].mode = REG_REGISTER; + state->registers.regs[reg].reg = elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_CFA_remember_state: + fs = (ELFFrameStateRegisters *)calloc(1, + sizeof(ELFFrameStateRegisters)); + memcpy(fs, &state->registers, sizeof(ELFFrameStateRegisters)); + state->registers.previous = fs; + break; + case DW_CFA_restore_state: + if(state->registers.previous == NULL) { + printf("Error: previous frame state is NULL.\n"); + return; + } + fs = state->registers.previous; + memcpy(&state->registers, fs, sizeof(ELFFrameStateRegisters)); + free(fs); + break; + case DW_CFA_def_cfa: + state->cfaRegister = elfReadLEB128(data, &bytes); + data += bytes; + state->cfaOffset = (s32)elfReadLEB128(data, &bytes); + data += bytes; + state->cfaMode = CFA_REG_OFFSET; + break; + case DW_CFA_def_cfa_register: + state->cfaRegister = elfReadLEB128(data, &bytes); + data += bytes; + state->cfaMode = CFA_REG_OFFSET; + break; + case DW_CFA_def_cfa_offset: + state->cfaOffset = (s32)elfReadLEB128(data, &bytes); + data += bytes; + state->cfaMode = CFA_REG_OFFSET; + break; + default: + printf("Unknown CFA opcode %08x\n", op); + return; + } + break; + default: + printf("Unknown CFA opcode %08x\n", op); + return; + } + } +} + +ELFFrameState *elfGetFrameState(ELFfde *fde, u32 address) +{ + ELFFrameState *state = (ELFFrameState *)calloc(1, sizeof(ELFFrameState)); + state->pc = fde->address; + state->dataAlign = fde->cie->dataAlign; + state->codeAlign = fde->cie->codeAlign; + state->returnAddress = fde->cie->returnAddress; + + elfExecuteCFAInstructions(state, + fde->cie->data, + fde->cie->dataLen, + 0xffffffff); + elfExecuteCFAInstructions(state, + fde->data, + fde->dataLen, + address); + + return state; +} + +void elfPrintCallChain(u32 address) +{ + int count = 1; + + reg_pair regs[15]; + reg_pair newRegs[15]; + + memcpy(®s[0], ®[0], sizeof(reg_pair) * 15); + + while(count < 20) { + char *addr = elfGetAddressSymbol(address); + if(*addr == 0) + addr = "???"; + + printf("%08x %s\n", address, addr); + + ELFfde *fde = elfGetFde(address); + + if(fde == NULL) { + break; + } + + ELFFrameState *state = elfGetFrameState(fde, address); + + if(!state) { + break; + } + + if(state->cfaMode == CFA_REG_OFFSET) { + memcpy(&newRegs[0], ®s[0], sizeof(reg_pair) * 15); + u32 addr = 0; + for(int i = 0; i < 15; i++) { + ELFFrameStateRegister *r = &state->registers. + regs[i]; + + switch(r->mode) { + case REG_NOT_SET: + newRegs[i].I = regs[i].I; + break; + case REG_OFFSET: + newRegs[i].I = elfReadMemory(regs[state->cfaRegister].I + + state->cfaOffset + + r->offset); + break; + case REG_REGISTER: + newRegs[i].I = regs[r->reg].I; + break; + default: + printf("Unknown register mode: %d\n", r->mode); + break; + } + } + memcpy(regs, newRegs, sizeof(reg_pair)*15); + addr = newRegs[14].I; + addr &= 0xfffffffe; + address = addr; + count++; + } else { + printf("CFA not set\n"); + break; + } + if(state->registers.previous) { + ELFFrameStateRegisters *prev = state->registers.previous; + + while(prev) { + ELFFrameStateRegisters *p = prev->previous; + free(prev); + prev = p; + } + } + free(state); + } +} + +u32 elfDecodeLocation(Function *f, ELFBlock *o, LocationType *type, u32 base) +{ + u32 framebase = 0; + if(f && f->frameBase) { + ELFBlock *b = f->frameBase; + switch(*b->data) { + case DW_OP_reg0: + case DW_OP_reg1: + case DW_OP_reg2: + case DW_OP_reg3: + case DW_OP_reg4: + case DW_OP_reg5: + case DW_OP_reg6: + case DW_OP_reg7: + case DW_OP_reg8: + case DW_OP_reg9: + case DW_OP_reg10: + case DW_OP_reg11: + case DW_OP_reg12: + case DW_OP_reg13: + case DW_OP_reg14: + case DW_OP_reg15: + framebase = reg[*b->data-0x50].I; + break; + default: + fprintf(stderr, "Unknown frameBase %02x\n", *b->data); + break; + } + } + + ELFBlock *loc = o; + u32 location = 0; + int bytes = 0; + if(loc) { + switch(*loc->data) { + case DW_OP_addr: + location = elfRead4Bytes(loc->data+1); + *type = LOCATION_memory; + break; + case DW_OP_plus_uconst: + location = base + elfReadLEB128(loc->data+1, &bytes); + *type = LOCATION_memory; + break; + case DW_OP_reg0: + case DW_OP_reg1: + case DW_OP_reg2: + case DW_OP_reg3: + case DW_OP_reg4: + case DW_OP_reg5: + case DW_OP_reg6: + case DW_OP_reg7: + case DW_OP_reg8: + case DW_OP_reg9: + case DW_OP_reg10: + case DW_OP_reg11: + case DW_OP_reg12: + case DW_OP_reg13: + case DW_OP_reg14: + case DW_OP_reg15: + location = *loc->data - 0x50; + *type = LOCATION_register; + break; + case DW_OP_fbreg: + { + int bytes; + s32 off = elfReadSignedLEB128(loc->data+1, &bytes); + location = framebase + off; + *type = LOCATION_memory; + } + break; + default: + fprintf(stderr, "Unknown location %02x\n", *loc->data); + break; + } + } + return location; +} + +u32 elfDecodeLocation(Function *f, ELFBlock *o, LocationType *type) +{ + return elfDecodeLocation(f, o, type, 0); +} + +// reading function + +u32 elfRead4Bytes(u8 *data) +{ + u32 value = *data++; + value |= (*data++ << 8); + value |= (*data++ << 16); + value |= (*data << 24); + return value; +} + +u16 elfRead2Bytes(u8 *data) +{ + u16 value = *data++; + value |= (*data << 8); + return value; +} + +char *elfReadString(u8 *data, int *bytesRead) +{ + if(*data == 0) { + *bytesRead = 1; + return NULL; + } + *bytesRead = strlen((char *)data) + 1; + return (char *)data; +} + +s32 elfReadSignedLEB128(u8 *data, int *bytesRead) +{ + s32 result = 0; + int shift = 0; + int count = 0; + + u8 byte; + do { + byte = *data++; + count++; + result |= (byte & 0x7f) << shift; + shift += 7; + } while(byte & 0x80); + if((shift < 32) && (byte & 0x40)) + result |= -(1 << shift); + *bytesRead = count; + return result; +} + +u32 elfReadLEB128(u8 *data, int *bytesRead) +{ + u32 result = 0; + int shift = 0; + int count = 0; + u8 byte; + do { + byte = *data++; + count++; + result |= (byte & 0x7f) << shift; + shift += 7; + } while(byte & 0x80); + *bytesRead = count; + return result; +} + +u8 *elfReadSection(u8 *data, ELFSectionHeader *sh) +{ + return data + READ32LE(&sh->offset); +} + +ELFSectionHeader *elfGetSectionByName(char *name) +{ + for(int i = 0; i < elfSectionHeadersCount; i++) { + if(strcmp(name, + &elfSectionHeadersStringTable[READ32LE(&elfSectionHeaders[i]-> + name)]) == 0) { + return elfSectionHeaders[i]; + } + } + return NULL; +} + +ELFSectionHeader *elfGetSectionByNumber(int number) +{ + if(number < elfSectionHeadersCount) { + return elfSectionHeaders[number]; + } + return NULL; +} + +CompileUnit *elfGetCompileUnitForData(u8 *data) +{ + u8 *end = elfCurrentUnit->top + 4 + elfCurrentUnit->length; + + if(data >= elfCurrentUnit->top && data < end) + return elfCurrentUnit; + + CompileUnit *unit = elfCompileUnits; + + while(unit) { + end = unit->top + 4 + unit->length; + + if(data >= unit->top && data < end) + return unit; + + unit = unit->next; + } + + printf("Error: cannot find reference to compile unit at offset %08x\n", + (int)(data - elfDebugInfo->infodata)); + exit(-1); +} + +u8 *elfReadAttribute(u8 *data, ELFAttr *attr) +{ + int bytes; + int form = attr->form; + start: + switch(form) { + case DW_FORM_addr: + attr->value = elfRead4Bytes(data); + data += 4; + break; + case DW_FORM_data2: + attr->value = elfRead2Bytes(data); + data += 2; + break; + case DW_FORM_data4: + attr->value = elfRead4Bytes(data); + data += 4; + break; + case DW_FORM_string: + attr->string = (char *)data; + data += strlen(attr->string)+1; + break; + case DW_FORM_strp: + attr->string = elfDebugStrings + elfRead4Bytes(data); + data += 4; + break; + case DW_FORM_block: + attr->block = (ELFBlock *)malloc(sizeof(ELFBlock)); + attr->block->length = elfReadLEB128(data, &bytes); + data += bytes; + attr->block->data = data; + data += attr->block->length; + break; + case DW_FORM_block1: + attr->block = (ELFBlock *)malloc(sizeof(ELFBlock)); + attr->block->length = *data++; + attr->block->data = data; + data += attr->block->length; + break; + case DW_FORM_data1: + attr->value = *data++; + break; + case DW_FORM_flag: + attr->flag = (*data++) ? true : false; + break; + case DW_FORM_sdata: + attr->value = elfReadSignedLEB128(data, &bytes); + data += bytes; + break; + case DW_FORM_udata: + attr->value = elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_FORM_ref_addr: + attr->value = (elfDebugInfo->infodata + elfRead4Bytes(data)) - + elfGetCompileUnitForData(data)->top; + data += 4; + break; + case DW_FORM_ref4: + attr->value = elfRead4Bytes(data); + data += 4; + break; + case DW_FORM_ref_udata: + attr->value = (elfDebugInfo->infodata + + (elfGetCompileUnitForData(data)->top - + elfDebugInfo->infodata) + + elfReadLEB128(data, &bytes)) - + elfCurrentUnit->top; + data += bytes; + break; + case DW_FORM_indirect: + form = elfReadLEB128(data, &bytes); + data += bytes; + goto start; + default: + fprintf(stderr, "Unsupported FORM %02x\n", form); + exit(-1); + } + return data; +} + +ELFAbbrev *elfGetAbbrev(ELFAbbrev **table, u32 number) +{ + int hash = number % 121; + + ELFAbbrev *abbrev = table[hash]; + + while(abbrev) { + if(abbrev->number == number) + return abbrev; + abbrev = abbrev->next; + } + return NULL; +} + +ELFAbbrev **elfReadAbbrevs(u8 *data, u32 offset) +{ + data += offset; + ELFAbbrev **abbrevs = (ELFAbbrev **)calloc(sizeof(ELFAbbrev *)*121,1); + int bytes = 0; + u32 number = elfReadLEB128(data, &bytes); + data += bytes; + while(number) { + ELFAbbrev *abbrev = (ELFAbbrev *)calloc(sizeof(ELFAbbrev),1); + + // read tag information + abbrev->number = number; + abbrev->tag = elfReadLEB128(data, &bytes); + data += bytes; + abbrev->hasChildren = *data++ ? true: false; + + // read attributes + int name = elfReadLEB128(data, &bytes); + data += bytes; + int form = elfReadLEB128(data, &bytes); + data += bytes; + + while(name) { + if((abbrev->numAttrs % 4) == 0) { + abbrev->attrs = (ELFAttr *)realloc(abbrev->attrs, + (abbrev->numAttrs + 4) * + sizeof(ELFAttr)); + } + abbrev->attrs[abbrev->numAttrs].name = name; + abbrev->attrs[abbrev->numAttrs++].form = form; + + name = elfReadLEB128(data, &bytes); + data += bytes; + form = elfReadLEB128(data, &bytes); + data += bytes; + } + + int hash = number % 121; + abbrev->next = abbrevs[hash]; + abbrevs[hash] = abbrev; + + number = elfReadLEB128(data, &bytes); + data += bytes; + + if(elfGetAbbrev(abbrevs, number) != NULL) + break; + } + + return abbrevs; +} + +void elfParseCFA(u8 *top) +{ + ELFSectionHeader *h = elfGetSectionByName(".debug_frame"); + + if(h == NULL) { + return; + } + + u8 *data = elfReadSection(top, h); + + u8 *topOffset = data; + + u8 *end = data + READ32LE(&h->size); + + ELFcie *cies = NULL; + + while(data < end) { + u32 offset = data - topOffset; + u32 len = elfRead4Bytes(data); + data += 4; + + u8 *dataEnd = data + len; + + u32 id = elfRead4Bytes(data); + data += 4; + + if(id == 0xffffffff) { + // skip version + *data++; + + ELFcie *cie = (ELFcie *)calloc(1, sizeof(ELFcie)); + + cie->next = cies; + cies = cie; + + cie->offset = offset; + + cie->augmentation = data; + while(*data) + data++; + data++; + + if(*cie->augmentation) { + fprintf(stderr, "Error: augmentation not supported\n"); + exit(-1); + } + + int bytes; + cie->codeAlign = elfReadLEB128(data, &bytes); + data += bytes; + + cie->dataAlign = elfReadSignedLEB128(data, &bytes); + data += bytes; + + cie->returnAddress = *data++; + + cie->data = data; + cie->dataLen = dataEnd - data; + } else { + ELFfde *fde = (ELFfde *)calloc(1, sizeof(ELFfde)); + + ELFcie *cie = cies; + + while(cie != NULL) { + if(cie->offset == id) + break; + cie = cie->next; + } + + if(!cie) { + fprintf(stderr, "Cannot find CIE %08x\n", id); + exit(-1); + } + + fde->cie = cie; + + fde->address = elfRead4Bytes(data); + data += 4; + + fde->end = fde->address + elfRead4Bytes(data); + data += 4; + + fde->data = data; + fde->dataLen = dataEnd - data; + + if((elfFdeCount %10) == 0) { + elfFdes = (ELFfde **)realloc(elfFdes, (elfFdeCount+10) * + sizeof(ELFfde *)); + } + elfFdes[elfFdeCount++] = fde; + } + data = dataEnd; + } + + elfCies = cies; +} + +void elfAddLine(LineInfo *l, u32 a, int file, int line, int *max) +{ + if(l->number == *max) { + *max += 1000; + l->lines = (LineInfoItem *)realloc(l->lines, *max*sizeof(LineInfoItem)); + } + LineInfoItem *li = &l->lines[l->number]; + li->file = l->files[file-1]; + li->address = a; + li->line = line; + l->number++; +} + +void elfParseLineInfo(CompileUnit *unit, u8 *top) +{ + ELFSectionHeader *h = elfGetSectionByName(".debug_line"); + if(h == NULL) { + fprintf(stderr, "No line information found\n"); + return; + } + LineInfo *l = unit->lineInfoTable = (LineInfo *)calloc(1, sizeof(LineInfo)); + l->number = 0; + int max = 1000; + l->lines = (LineInfoItem *)malloc(1000*sizeof(LineInfoItem)); + + u8 *data = elfReadSection(top, h); + data += unit->lineInfo; + u32 totalLen = elfRead4Bytes(data); + data += 4; + u8 *end = data + totalLen; + // u16 version = elfRead2Bytes(data); + data += 2; + // u32 offset = elfRead4Bytes(data); + data += 4; + int minInstrSize = *data++; + int defaultIsStmt = *data++; + int lineBase = (s8)*data++; + int lineRange = *data++; + int opcodeBase = *data++; + u8 *stdOpLen = (u8 *)malloc(opcodeBase * sizeof(u8)); + stdOpLen[0] = 1; + int i; + for(i = 1; i < opcodeBase; i++) + stdOpLen[i] = *data++; + + free(stdOpLen);// todo + int bytes = 0; + + char *s; + while((s = elfReadString(data, &bytes)) != NULL) { + data += bytes; + // fprintf(stderr, "Directory is %s\n", s); + } + data += bytes; + int count = 4; + int index = 0; + l->files = (char **)malloc(sizeof(char *)*count); + + while((s = elfReadString(data, &bytes)) != NULL) { + l->files[index++] = s; + + data += bytes; + // directory + elfReadLEB128(data, &bytes); + data += bytes; + // time + elfReadLEB128(data, &bytes); + data += bytes; + // size + elfReadLEB128(data, &bytes); + data += bytes; + // fprintf(stderr, "File is %s\n", s); + if(index == count) { + count += 4; + l->files = (char **)realloc(l->files, sizeof(char *)*count); + } + } + l->fileCount = index; + data += bytes; + + while(data < end) { + u32 address = 0; + int file = 1; + int line = 1; + int col = 0; + int isStmt = defaultIsStmt; + int basicBlock = 0; + int endSeq = 0; + + while(!endSeq) { + int op = *data++; + switch(op) { + case DW_LNS_extended_op: + { + data++; + op = *data++; + switch(op) { + case DW_LNE_end_sequence: + endSeq = 1; + break; + case DW_LNE_set_address: + address = elfRead4Bytes(data); + data += 4; + break; + default: + fprintf(stderr, "Unknown extended LINE opcode %02x\n", op); + exit(-1); + } + } + break; + case DW_LNS_copy: + // fprintf(stderr, "Address %08x line %d (%d)\n", address, line, file); + elfAddLine(l, address, file, line, &max); + basicBlock = 0; + break; + case DW_LNS_advance_pc: + address += minInstrSize * elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_LNS_advance_line: + line += elfReadSignedLEB128(data, &bytes); + data += bytes; + break; + case DW_LNS_set_file: + file = elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_LNS_set_column: + col = elfReadLEB128(data, &bytes); + data += bytes; + break; + case DW_LNS_negate_stmt: + isStmt = !isStmt; + break; + case DW_LNS_set_basic_block: + basicBlock = 1; + break; + case DW_LNS_const_add_pc: + address += (minInstrSize *((255 - opcodeBase)/lineRange)); + break; + case DW_LNS_fixed_advance_pc: + address += elfRead2Bytes(data); + data += 2; + break; + default: + op = op - opcodeBase; + address += (op / lineRange) * minInstrSize; + line += lineBase + (op % lineRange); + elfAddLine(l, address, file, line, &max); + // fprintf(stderr, "Address %08x line %d (%d)\n", address, line,file); + basicBlock = 1; + break; + } + } + } + l->lines = (LineInfoItem *)realloc(l->lines, l->number*sizeof(LineInfoItem)); +} + +u8 *elfSkipData(u8 *data, ELFAbbrev *abbrev, ELFAbbrev **abbrevs) +{ + int i; + int bytes; + + for(i = 0; i < abbrev->numAttrs; i++) { + data = elfReadAttribute(data, &abbrev->attrs[i]); + if(abbrev->attrs[i].form == DW_FORM_block1) + free(abbrev->attrs[i].block); + } + + if(abbrev->hasChildren) { + int nesting = 1; + while(nesting) { + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + nesting--; + continue; + } + + abbrev = elfGetAbbrev(abbrevs, abbrevNum); + + for(i = 0; i < abbrev->numAttrs; i++) { + data = elfReadAttribute(data, &abbrev->attrs[i]); + if(abbrev->attrs[i].form == DW_FORM_block1) + free(abbrev->attrs[i].block); + } + + if(abbrev->hasChildren) { + nesting++; + } + } + } + return data; +} + +Type *elfParseType(CompileUnit *unit, u32); +u8 *elfParseObject(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, + Object **object); +u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, + Function **function); +void elfCleanUp(Function *); + +void elfAddType(Type *type, CompileUnit *unit, u32 offset) +{ + if(type->next == NULL) { + if(unit->types != type && type->offset == 0) { + type->offset = offset; + type->next = unit->types; + unit->types = type; + } + } +} + +void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, + Type **type) +{ + switch(abbrev->tag) { + case DW_TAG_typedef: + { + u32 typeref = 0; + char *name = NULL; + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + name = attr->string; + break; + case DW_AT_type: + typeref = attr->value; + break; + case DW_AT_decl_file: + case DW_AT_decl_line: + break; + default: + fprintf(stderr, "Unknown attribute for typedef %02x\n", attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for typedef\n"); + *type = elfParseType(unit, typeref); + if(name) + (*type)->name = name; + return; + } + break; + case DW_TAG_union_type: + case DW_TAG_structure_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + if(abbrev->tag == DW_TAG_structure_type) + t->type = TYPE_struct; + else + t->type = TYPE_union; + + Struct *s = (Struct *)calloc(sizeof(Struct), 1); + t->structure = s; + elfAddType(t, unit, offset); + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + t->name = attr->string; + break; + case DW_AT_byte_size: + t->size = attr->value; + break; + case DW_AT_decl_file: + case DW_AT_decl_line: + case DW_AT_sibling: + case DW_AT_containing_type: // todo? + case DW_AT_declaration: + case DW_AT_specification: // TODO: + break; + default: + fprintf(stderr, "Unknown attribute for struct %02x\n", attr->name); + break; + } + } + if(abbrev->hasChildren) { + int bytes; + u32 num = elfReadLEB128(data, &bytes); + data += bytes; + int index = 0; + while(num) { + ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); + + switch(abbr->tag) { + case DW_TAG_member: + { + if((index % 4) == 0) + s->members = (Member *)realloc(s->members, + sizeof(Member)*(index+4)); + Member *m = &s->members[index]; + m->location = NULL; + m->bitOffset = 0; + m->bitSize = 0; + m->byteSize = 0; + for(int i = 0; i < abbr->numAttrs; i++) { + ELFAttr *attr = &abbr->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + m->name = attr->string; + break; + case DW_AT_type: + m->type = elfParseType(unit, attr->value); + break; + case DW_AT_data_member_location: + m->location = attr->block; + break; + case DW_AT_byte_size: + m->byteSize = attr->value; + break; + case DW_AT_bit_offset: + m->bitOffset = attr->value; + break; + case DW_AT_bit_size: + m->bitSize = attr->value; + break; + case DW_AT_decl_file: + case DW_AT_decl_line: + case DW_AT_accessibility: + case DW_AT_artificial: // todo? + break; + default: + fprintf(stderr, "Unknown member attribute %02x\n", + attr->name); + } + } + index++; + } + break; + case DW_TAG_subprogram: + { + Function *fnc = NULL; + data = elfParseFunction(data, abbr, unit, &fnc); + if(fnc != NULL) { + if(unit->lastFunction) + unit->lastFunction->next = fnc; + else + unit->functions = fnc; + unit->lastFunction = fnc; + } + } + break; + case DW_TAG_inheritance: + // TODO: add support + data = elfSkipData(data, abbr, unit->abbrevs); + break; + CASE_TYPE_TAG: + // skip types... parsed only when used + data = elfSkipData(data, abbr, unit->abbrevs); + break; + case DW_TAG_variable: + data = elfSkipData(data, abbr, unit->abbrevs); + break; + default: + fprintf(stderr, "Unknown struct tag %02x %s\n", abbr->tag, t->name); + data = elfSkipData(data, abbr, unit->abbrevs); + break; + } + num = elfReadLEB128(data, &bytes); + data += bytes; + } + s->memberCount = index; + } + *type = t; + return; + } + break; + case DW_TAG_base_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + + t->type = TYPE_base; + elfAddType(t, unit, offset); + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + t->name = attr->string; + break; + case DW_AT_encoding: + t->encoding = attr->value; + break; + case DW_AT_byte_size: + t->size = attr->value; + break; + case DW_AT_bit_size: + t->bitSize = attr->value; + break; + default: + fprintf(stderr, "Unknown attribute for base type %02x\n", + attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for base type\n"); + *type = t; + return; + } + break; + case DW_TAG_pointer_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + + t->type = TYPE_pointer; + + elfAddType(t, unit, offset); + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data =elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_type: + t->pointer = elfParseType(unit, attr->value); + break; + case DW_AT_byte_size: + t->size = attr->value; + break; + default: + fprintf(stderr, "Unknown pointer type attribute %02x\n", attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for pointer type\n"); + *type = t; + return; + } + break; + case DW_TAG_reference_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + + t->type = TYPE_reference; + + elfAddType(t, unit, offset); + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data =elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_type: + t->pointer = elfParseType(unit, attr->value); + break; + case DW_AT_byte_size: + t->size = attr->value; + break; + default: + fprintf(stderr, "Unknown ref type attribute %02x\n", attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for ref type\n"); + *type = t; + return; + } + break; + case DW_TAG_volatile_type: + { + u32 typeref = 0; + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_type: + typeref = attr->value; + break; + default: + fprintf(stderr, "Unknown volatile attribute for type %02x\n", + attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for volatile type\n"); + *type = elfParseType(unit, typeref); + return; + } + break; + case DW_TAG_const_type: + { + u32 typeref = 0; + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_type: + typeref = attr->value; + break; + default: + fprintf(stderr, "Unknown const attribute for type %02x\n", + attr->name); + break; + } + } + if(abbrev->hasChildren) + fprintf(stderr, "Unexpected children for const type\n"); + *type = elfParseType(unit, typeref); + return; + } + break; + case DW_TAG_enumeration_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + t->type = TYPE_enum; + Enum *e = (Enum *)calloc(sizeof(Enum), 1); + t->enumeration = e; + elfAddType(t, unit, offset); + int count = 0; + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + t->name = attr->string; + break; + case DW_AT_byte_size: + t->size = attr->value; + break; + case DW_AT_sibling: + case DW_AT_decl_file: + case DW_AT_decl_line: + break; + default: + fprintf(stderr, "Unknown enum attribute %02x\n", attr->name); + } + } + if(abbrev->hasChildren) { + int bytes; + u32 num = elfReadLEB128(data, &bytes); + data += bytes; + while(num) { + ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); + + switch(abbr->tag) { + case DW_TAG_enumerator: + { + count++; + e->members = (EnumMember *)realloc(e->members, + count*sizeof(EnumMember)); + EnumMember *m = &e->members[count-1]; + for(int i = 0; i < abbr->numAttrs; i++) { + ELFAttr *attr = &abbr->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_name: + m->name = attr->string; + break; + case DW_AT_const_value: + m->value = attr->value; + break; + default: + fprintf(stderr, "Unknown sub param attribute %02x\n", + attr->name); + } + } + } + break; + default: + fprintf(stderr, "Unknown enum tag %02x\n", abbr->tag); + data = elfSkipData(data, abbr, unit->abbrevs); + break; + } + num = elfReadLEB128(data, &bytes); + data += bytes; + } + } + e->count = count; + *type = t; + return; + } + break; + case DW_TAG_subroutine_type: + { + Type *t = (Type *)calloc(sizeof(Type), 1); + t->type = TYPE_function; + FunctionType *f = (FunctionType *)calloc(sizeof(FunctionType), 1); + t->function = f; + elfAddType(t, unit, offset); + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_prototyped: + case DW_AT_sibling: + break; + case DW_AT_type: + f->returnType = elfParseType(unit, attr->value); + break; + default: + fprintf(stderr, "Unknown subroutine attribute %02x\n", attr->name); + } + } + if(abbrev->hasChildren) { + int bytes; + u32 num = elfReadLEB128(data, &bytes); + data += bytes; + Object *lastVar = NULL; + while(num) { + ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); + + switch(abbr->tag) { + case DW_TAG_formal_parameter: + { + Object *o; + data = elfParseObject(data, abbr, unit, &o); + if(f->args) + lastVar->next = o; + else + f->args = o; + lastVar = o; + } + break; + case DW_TAG_unspecified_parameters: + // no use in the debugger yet + data = elfSkipData(data, abbr, unit->abbrevs); + break; + CASE_TYPE_TAG: + // skip types... parsed only when used + data = elfSkipData(data, abbr, unit->abbrevs); + break; + default: + fprintf(stderr, "Unknown subroutine tag %02x\n", abbr->tag); + data = elfSkipData(data, abbr, unit->abbrevs); + break; + } + num = elfReadLEB128(data, &bytes); + data += bytes; + } + } + *type = t; + return; + } + break; + case DW_TAG_array_type: + { + u32 typeref = 0; + int i; + Array *array = (Array *)calloc(sizeof(Array), 1); + Type *t = (Type *)calloc(sizeof(Type), 1); + t->type = TYPE_array; + elfAddType(t, unit, offset); + + for(i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_sibling: + break; + case DW_AT_type: + typeref = attr->value; + array->type = elfParseType(unit, typeref); + break; + default: + fprintf(stderr, "Unknown array attribute %02x\n", attr->name); + } + } + if(abbrev->hasChildren) { + int bytes; + u32 num = elfReadLEB128(data, &bytes); + data += bytes; + int index = 0; + int maxBounds = 0; + while(num) { + ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); + + switch(abbr->tag) { + case DW_TAG_subrange_type: + { + if(maxBounds == index) { + maxBounds += 4; + array->bounds = (int *)realloc(array->bounds, + sizeof(int)*maxBounds); + } + for(int i = 0; i < abbr->numAttrs; i++) { + ELFAttr *attr = &abbr->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_upper_bound: + array->bounds[index] = attr->value+1; + break; + case DW_AT_type: // ignore + break; + default: + fprintf(stderr, "Unknown subrange attribute %02x\n", + attr->name); + } + } + index++; + } + break; + default: + fprintf(stderr, "Unknown array tag %02x\n", abbr->tag); + data = elfSkipData(data, abbr, unit->abbrevs); + break; + } + num = elfReadLEB128(data, &bytes); + data += bytes; + } + array->maxBounds = index; + } + t->size = array->type->size; + for(i = 0; i < array->maxBounds; i++) + t->size *= array->bounds[i]; + t->array = array; + *type = t; + return; + } + break; + default: + fprintf(stderr, "Unknown type TAG %02x\n", abbrev->tag); + exit(-1); + } +} + +Type *elfParseType(CompileUnit *unit, u32 offset) +{ + Type *t = unit->types; + + while(t) { + if(t->offset == offset) + return t; + t = t->next; + } + if(offset == 0) { + Type *t = (Type *)calloc(sizeof(Type), 1); + t->type = TYPE_void; + t->offset = 0; + elfAddType(t, unit, 0); + return t; + } + u8 *data = unit->top + offset; + int bytes; + int abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + Type *type = NULL; + + ELFAbbrev *abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + elfParseType(data, offset, abbrev, unit, &type); + return type; +} + +void elfGetObjectAttributes(CompileUnit *unit, u32 offset, Object *o) +{ + u8 *data = unit->top + offset; + int bytes; + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + return; + } + + ELFAbbrev *abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_location: + o->location = attr->block; + break; + case DW_AT_name: + if(o->name == NULL) + o->name = attr->string; + break; + case DW_AT_MIPS_linkage_name: + o->name = attr->string; + break; + case DW_AT_decl_file: + o->file = attr->value; + break; + case DW_AT_decl_line: + o->line = attr->value; + break; + case DW_AT_type: + o->type = elfParseType(unit, attr->value); + break; + case DW_AT_external: + o->external = attr->flag; + break; + case DW_AT_const_value: + case DW_AT_abstract_origin: + case DW_AT_declaration: + case DW_AT_artificial: + // todo + break; + case DW_AT_specification: + // TODO: + break; + default: + fprintf(stderr, "Unknown object attribute %02x\n", attr->name); + break; + } + } +} + +u8 *elfParseObject(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, + Object **object) +{ + Object *o = (Object *)calloc(sizeof(Object), 1); + + o->next = NULL; + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_location: + o->location = attr->block; + break; + case DW_AT_name: + if(o->name == NULL) + o->name = attr->string; + break; + case DW_AT_MIPS_linkage_name: + o->name = attr->string; + break; + case DW_AT_decl_file: + o->file = attr->value; + break; + case DW_AT_decl_line: + o->line = attr->value; + break; + case DW_AT_type: + o->type = elfParseType(unit, attr->value); + break; + case DW_AT_external: + o->external = attr->flag; + break; + case DW_AT_abstract_origin: + elfGetObjectAttributes(unit, attr->value, o); + break; + case DW_AT_const_value: + case DW_AT_declaration: + case DW_AT_artificial: + break; + case DW_AT_specification: + // TODO: + break; + default: + fprintf(stderr, "Unknown object attribute %02x\n", attr->name); + break; + } + } + *object = o; + return data; +} + +u8 *elfParseBlock(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, + Function *func, Object **lastVar) +{ + int bytes; + u32 start = func->lowPC; + u32 end = func->highPC; + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_sibling: + break; + case DW_AT_low_pc: + start = attr->value; + break; + case DW_AT_high_pc: + end = attr->value; + break; + case DW_AT_ranges: // ignore for now + break; + default: + fprintf(stderr, "Unknown block attribute %02x\n", attr->name); + break; + } + } + + if(abbrev->hasChildren) { + int nesting = 1; + + while(nesting) { + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + nesting--; + continue; + } + + abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + switch(abbrev->tag) { + CASE_TYPE_TAG: // types only parsed when used + case DW_TAG_label: // not needed + data = elfSkipData(data, abbrev, unit->abbrevs); + break; + case DW_TAG_lexical_block: + data = elfParseBlock(data, abbrev, unit, func, lastVar); + break; + case DW_TAG_subprogram: + { + Function *f = NULL; + data = elfParseFunction(data, abbrev, unit, &f); + if(f != NULL) { + if(unit->lastFunction) + unit->lastFunction->next = f; + else + unit->functions = f; + unit->lastFunction = f; + } + } + break; + case DW_TAG_variable: + { + Object *o; + data = elfParseObject(data, abbrev, unit, &o); + if(o->startScope == 0) + o->startScope = start; + if(o->endScope == 0) + o->endScope = 0; + if(func->variables) + (*lastVar)->next = o; + else + func->variables = o; + *lastVar = o; + } + break; + case DW_TAG_inlined_subroutine: + // TODO: + data = elfSkipData(data, abbrev, unit->abbrevs); + break; + default: + { + fprintf(stderr, "Unknown block TAG %02x\n", abbrev->tag); + data = elfSkipData(data, abbrev, unit->abbrevs); + } + break; + } + } + } + return data; +} + +void elfGetFunctionAttributes(CompileUnit *unit, u32 offset, Function *func) +{ + u8 *data = unit->top + offset; + int bytes; + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + return; + } + + ELFAbbrev *abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + + switch(attr->name) { + case DW_AT_sibling: + break; + case DW_AT_name: + if(func->name == NULL) + func->name = attr->string; + break; + case DW_AT_MIPS_linkage_name: + func->name = attr->string; + break; + case DW_AT_low_pc: + func->lowPC = attr->value; + break; + case DW_AT_high_pc: + func->highPC = attr->value; + break; + case DW_AT_decl_file: + func->file = attr->value; + break; + case DW_AT_decl_line: + func->line = attr->value; + break; + case DW_AT_external: + func->external = attr->flag; + break; + case DW_AT_frame_base: + func->frameBase = attr->block; + break; + case DW_AT_type: + func->returnType = elfParseType(unit, attr->value); + break; + case DW_AT_inline: + case DW_AT_specification: + case DW_AT_declaration: + case DW_AT_artificial: + case DW_AT_prototyped: + case DW_AT_proc_body: + case DW_AT_save_offset: + case DW_AT_user_2002: + case DW_AT_virtuality: + case DW_AT_containing_type: + case DW_AT_accessibility: + // todo; + break; + case DW_AT_vtable_elem_location: + free(attr->block); + break; + default: + fprintf(stderr, "Unknown function attribute %02x\n", attr->name); + break; + } + } + + return; +} + +u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, + Function **f) +{ + Function *func = (Function *)calloc(sizeof(Function), 1); + *f = func; + + int bytes; + bool mangled = false; + bool declaration = false; + for(int i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + switch(attr->name) { + case DW_AT_sibling: + break; + case DW_AT_name: + if(func->name == NULL) + func->name = attr->string; + break; + case DW_AT_MIPS_linkage_name: + func->name = attr->string; + mangled = true; + break; + case DW_AT_low_pc: + func->lowPC = attr->value; + break; + case DW_AT_high_pc: + func->highPC = attr->value; + break; + case DW_AT_prototyped: + break; + case DW_AT_decl_file: + func->file = attr->value; + break; + case DW_AT_decl_line: + func->line = attr->value; + break; + case DW_AT_external: + func->external = attr->flag; + break; + case DW_AT_frame_base: + func->frameBase = attr->block; + break; + case DW_AT_type: + func->returnType = elfParseType(unit, attr->value); + break; + case DW_AT_abstract_origin: + elfGetFunctionAttributes(unit, attr->value, func); + break; + case DW_AT_declaration: + declaration = attr->flag; + break; + case DW_AT_inline: + case DW_AT_specification: + case DW_AT_artificial: + case DW_AT_proc_body: + case DW_AT_save_offset: + case DW_AT_user_2002: + case DW_AT_virtuality: + case DW_AT_containing_type: + case DW_AT_accessibility: + // todo; + break; + case DW_AT_vtable_elem_location: + free(attr->block); + break; + default: + fprintf(stderr, "Unknown function attribute %02x\n", attr->name); + break; + } + } + + if(declaration) { + elfCleanUp(func); + free(func); + *f = NULL; + + while(1) { + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + return data; + } + + abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + data = elfSkipData(data, abbrev, unit->abbrevs); + } + } + + if(abbrev->hasChildren) { + int nesting = 1; + Object *lastParam = NULL; + Object *lastVar = NULL; + + while(nesting) { + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + nesting--; + continue; + } + + abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + + switch(abbrev->tag) { + CASE_TYPE_TAG: // no need to parse types. only parsed when used + case DW_TAG_label: // not needed + data = elfSkipData(data, abbrev, unit->abbrevs); + break; + case DW_TAG_subprogram: + { + Function *fnc=NULL; + data = elfParseFunction(data, abbrev, unit, &fnc); + if(fnc != NULL) { + if(unit->lastFunction == NULL) + unit->functions = fnc; + else + unit->lastFunction->next = fnc; + unit->lastFunction = fnc; + } + } + break; + case DW_TAG_lexical_block: + { + data = elfParseBlock(data, abbrev, unit, func, &lastVar); + } + break; + case DW_TAG_formal_parameter: + { + Object *o; + data = elfParseObject(data, abbrev, unit, &o); + if(func->parameters) + lastParam->next = o; + else + func->parameters = o; + lastParam = o; + } + break; + case DW_TAG_variable: + { + Object *o; + data = elfParseObject(data, abbrev, unit, &o); + if(func->variables) + lastVar->next = o; + else + func->variables = o; + lastVar = o; + } + break; + case DW_TAG_unspecified_parameters: + case DW_TAG_inlined_subroutine: + { + // todo + for(int i = 0; i < abbrev->numAttrs; i++) { + data = elfReadAttribute(data, &abbrev->attrs[i]); + if(abbrev->attrs[i].form == DW_FORM_block1) + free(abbrev->attrs[i].block); + } + + if(abbrev->hasChildren) + nesting++; + } + break; + default: + { + fprintf(stderr, "Unknown function TAG %02x\n", abbrev->tag); + data = elfSkipData(data, abbrev, unit->abbrevs); + } + break; + } + } + } + return data; +} + +u8 *elfParseUnknownData(u8 *data, ELFAbbrev *abbrev, ELFAbbrev **abbrevs) +{ + int i; + int bytes; + // switch(abbrev->tag) { + // default: + fprintf(stderr, "Unknown TAG %02x\n", abbrev->tag); + + for(i = 0; i < abbrev->numAttrs; i++) { + data = elfReadAttribute(data, &abbrev->attrs[i]); + if(abbrev->attrs[i].form == DW_FORM_block1) + free(abbrev->attrs[i].block); + } + + if(abbrev->hasChildren) { + int nesting = 1; + while(nesting) { + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + if(!abbrevNum) { + nesting--; + continue; + } + + abbrev = elfGetAbbrev(abbrevs, abbrevNum); + + fprintf(stderr, "Unknown TAG %02x\n", abbrev->tag); + + for(i = 0; i < abbrev->numAttrs; i++) { + data = elfReadAttribute(data, &abbrev->attrs[i]); + if(abbrev->attrs[i].form == DW_FORM_block1) + free(abbrev->attrs[i].block); + } + + if(abbrev->hasChildren) { + nesting++; + } + } + } + // } + return data; +} + +u8 *elfParseCompileUnitChildren(u8 *data, CompileUnit *unit) +{ + int bytes; + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + Object *lastObj = NULL; + while(abbrevNum) { + ELFAbbrev *abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); + switch(abbrev->tag) { + case DW_TAG_subprogram: + { + Function *func = NULL; + data = elfParseFunction(data, abbrev, unit, &func); + if(func != NULL) { + if(unit->lastFunction) + unit->lastFunction->next = func; + else + unit->functions = func; + unit->lastFunction = func; + } + } + break; + CASE_TYPE_TAG: + data = elfSkipData(data, abbrev, unit->abbrevs); + break; + case DW_TAG_variable: + { + Object *var = NULL; + data = elfParseObject(data, abbrev, unit, &var); + if(lastObj) + lastObj->next = var; + else + unit->variables = var; + lastObj = var; + } + break; + default: + data = elfParseUnknownData(data, abbrev, unit->abbrevs); + break; + } + + abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + } + return data; +} + + +CompileUnit *elfParseCompUnit(u8 *data, u8 *abbrevData) +{ + int bytes; + u8 *top = data; + + u32 length = elfRead4Bytes(data); + data += 4; + + u16 version = elfRead2Bytes(data); + data += 2; + + u32 offset = elfRead4Bytes(data); + data += 4; + + u8 addrSize = *data++; + + if(version != 2) { + fprintf(stderr, "Unsupported debugging information version %d\n", version); + return NULL; + } + + if(addrSize != 4) { + fprintf(stderr, "Unsupported address size %d\n", addrSize); + return NULL; + } + + ELFAbbrev **abbrevs = elfReadAbbrevs(abbrevData, offset); + + u32 abbrevNum = elfReadLEB128(data, &bytes); + data += bytes; + + ELFAbbrev *abbrev = elfGetAbbrev(abbrevs, abbrevNum); + + CompileUnit *unit = (CompileUnit *)calloc(sizeof(CompileUnit), 1); + unit->top = top; + unit->length = length; + unit->abbrevs = abbrevs; + unit->next = NULL; + + elfCurrentUnit = unit; + + int i; + + for(i = 0; i < abbrev->numAttrs; i++) { + ELFAttr *attr = &abbrev->attrs[i]; + data = elfReadAttribute(data, attr); + + switch(attr->name) { + case DW_AT_name: + unit->name = attr->string; + break; + case DW_AT_stmt_list: + unit->hasLineInfo = true; + unit->lineInfo = attr->value; + break; + case DW_AT_low_pc: + unit->lowPC = attr->value; + break; + case DW_AT_high_pc: + unit->highPC = attr->value; + break; + case DW_AT_compdir: + unit->compdir = attr->string; + break; + // ignore + case DW_AT_language: + case DW_AT_producer: + case DW_AT_macro_info: + case DW_AT_entry_pc: + break; + default: + fprintf(stderr, "Unknown attribute %02x\n", attr->name); + break; + } + } + + if(abbrev->hasChildren) + elfParseCompileUnitChildren(data, unit); + + return unit; +} + +void elfParseAranges(u8 *data) +{ + ELFSectionHeader *sh = elfGetSectionByName(".debug_aranges"); + if(sh == NULL) { + fprintf(stderr, "No aranges found\n"); + return; + } + + data = elfReadSection(data, sh); + u8 *end = data + READ32LE(&sh->size); + + int max = 4; + ARanges *ranges = (ARanges *)calloc(sizeof(ARanges), 4); + + int index = 0; + + while(data < end) { + u32 len = elfRead4Bytes(data); + data += 4; + // u16 version = elfRead2Bytes(data); + data += 2; + u32 offset = elfRead4Bytes(data); + data += 4; + // u8 addrSize = *data++; + // u8 segSize = *data++; + data += 2; // remove if uncommenting above + data += 4; + ranges[index].count = (len-20)/8; + ranges[index].offset = offset; + ranges[index].ranges = (ARange *)calloc(sizeof(ARange), (len-20)/8); + int i = 0; + while(true) { + u32 addr = elfRead4Bytes(data); + data += 4; + u32 len = elfRead4Bytes(data); + data += 4; + if(addr == 0 && len == 0) + break; + ranges[index].ranges[i].lowPC = addr; + ranges[index].ranges[i].highPC = addr+len; + i++; + } + index++; + if(index == max) { + max += 4; + ranges = (ARanges *)realloc(ranges, max*sizeof(ARanges)); + } + } + elfDebugInfo->numRanges = index; + elfDebugInfo->ranges = ranges; +} + +void elfReadSymtab(u8 *data) +{ + ELFSectionHeader *sh = elfGetSectionByName(".symtab"); + int table = READ32LE(&sh->link); + + char *strtable = (char *)elfReadSection(data, elfGetSectionByNumber(table)); + + ELFSymbol *symtab = (ELFSymbol *)elfReadSection(data, sh); + + int count = READ32LE(&sh->size) / sizeof(ELFSymbol); + elfSymbolsCount = 0; + + elfSymbols = (Symbol *)malloc(sizeof(Symbol)*count); + + int i; + + for(i = 0; i < count; i++) { + ELFSymbol *s = &symtab[i]; + int type = s->info & 15; + int binding = s->info >> 4; + + if(binding) { + Symbol *sym = &elfSymbols[elfSymbolsCount]; + sym->name = &strtable[READ32LE(&s->name)]; + sym->binding = binding; + sym->type = type; + sym->value = READ32LE(&s->value); + sym->size = READ32LE(&s->size); + elfSymbolsCount++; + } + } + for(i = 0; i < count; i++) { + ELFSymbol *s = &symtab[i]; + int bind = s->info>>4; + int type = s->info & 15; + + if(!bind) { + Symbol *sym = &elfSymbols[elfSymbolsCount]; + sym->name = &strtable[READ32LE(&s->name)]; + sym->binding = (s->info >> 4); + sym->type = type; + sym->value = READ32LE(&s->value); + sym->size = READ32LE(&s->size); + elfSymbolsCount++; + } + } + elfSymbolsStrTab = strtable; + // free(symtab); +} + +bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) +{ + int count = READ16LE(&eh->e_phnum); + int i; + + if(READ32LE(&eh->e_entry) == 0x2000000) + cpuIsMultiBoot = true; + + // read program headers... should probably move this code down + u8 *p = data + READ32LE(&eh->e_phoff); + size = 0; + for(i = 0; i < count; i++) { + ELFProgramHeader *ph = (ELFProgramHeader *)p; + p += sizeof(ELFProgramHeader); + if(READ16LE(&eh->e_phentsize) != sizeof(ELFProgramHeader)) { + p += READ16LE(&eh->e_phentsize) - sizeof(ELFProgramHeader); + } + + // printf("PH %d %08x %08x %08x %08x %08x %08x %08x %08x\n", + // i, ph->type, ph->offset, ph->vaddr, ph->paddr, + // ph->filesz, ph->memsz, ph->flags, ph->align); + if(cpuIsMultiBoot) { + if(READ32LE(&ph->paddr) >= 0x2000000 && + READ32LE(&ph->paddr) <= 0x203ffff) { + memcpy(&workRAM[READ32LE(&ph->paddr) & 0x3ffff], + data + READ32LE(&ph->offset), + READ32LE(&ph->filesz)); + } + } else { + if(READ32LE(&ph->paddr) >= 0x8000000 && + READ32LE(&ph->paddr) <= 0x9ffffff) { + memcpy(&rom[READ32LE(&ph->paddr) & 0x1ffffff], + data + READ32LE(&ph->offset), + READ32LE(&ph->filesz)); + size += READ32LE(&ph->filesz); + } + } + } + + char *stringTable = NULL; + + // read section headers + p = data + READ32LE(&eh->e_shoff); + count = READ16LE(&eh->e_shnum); + + ELFSectionHeader **sh = (ELFSectionHeader **) + malloc(sizeof(ELFSectionHeader *) * count); + + for(i = 0; i < count; i++) { + sh[i] = (ELFSectionHeader *)p; + p += sizeof(ELFSectionHeader); + if(READ16LE(&eh->e_shentsize) != sizeof(ELFSectionHeader)) + p += READ16LE(&eh->e_shentsize) - sizeof(ELFSectionHeader); + } + + if(READ16LE(&eh->e_shstrndx) != 0) { + stringTable = (char *)elfReadSection(data, + sh[READ16LE(&eh->e_shstrndx)]); + } + + elfSectionHeaders = sh; + elfSectionHeadersStringTable = stringTable; + elfSectionHeadersCount = count; + + for(i = 0; i < count; i++) { + // printf("SH %d %-20s %08x %08x %08x %08x %08x %08x %08x %08x\n", + // i, &stringTable[sh[i]->name], sh[i]->name, sh[i]->type, + // sh[i]->flags, sh[i]->addr, sh[i]->offset, sh[i]->size, + // sh[i]->link, sh[i]->info); + if(READ32LE(&sh[i]->flags) & 2) { // load section + if(cpuIsMultiBoot) { + if(READ32LE(&sh[i]->addr) >= 0x2000000 && + READ32LE(&sh[i]->addr) <= 0x203ffff) { + memcpy(&workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + + READ32LE(&sh[i]->offset), + READ32LE(&sh[i]->size)); + } + } else { + if(READ32LE(&sh[i]->addr) >= 0x8000000 && + READ32LE(&sh[i]->addr) <= 0x9ffffff) { + memcpy(&rom[READ32LE(&sh[i]->addr) & 0x1ffffff], + data + READ32LE(&sh[i]->offset), + READ32LE(&sh[i]->size)); + size += READ32LE(&sh[i]->size); + } + } + } + } + + if(parseDebug) { + fprintf(stderr, "Parsing debug info\n"); + + ELFSectionHeader *dbgHeader = elfGetSectionByName(".debug_info"); + if(dbgHeader == NULL) { + fprintf(stderr, "Cannot find debug information\n"); + goto end; + } + + ELFSectionHeader *h = elfGetSectionByName(".debug_abbrev"); + if(h == NULL) { + fprintf(stderr, "Cannot find abbreviation table\n"); + goto end; + } + + elfDebugInfo = (DebugInfo *)calloc(sizeof(DebugInfo), 1); + u8 *abbrevdata = elfReadSection(data, h); + + h = elfGetSectionByName(".debug_str"); + + if(h == NULL) + elfDebugStrings = NULL; + else + elfDebugStrings = (char *)elfReadSection(data, h); + + u8 *debugdata = elfReadSection(data, dbgHeader); + + elfDebugInfo->debugdata = data; + elfDebugInfo->infodata = debugdata; + + u32 total = READ32LE(&dbgHeader->size); + u8 *end = debugdata + total; + u8 *ddata = debugdata; + + CompileUnit *last = NULL; + CompileUnit *unit = NULL; + + while(ddata < end) { + unit = elfParseCompUnit(ddata, abbrevdata); + unit->offset = ddata-debugdata; + elfParseLineInfo(unit, data); + if(last == NULL) + elfCompileUnits = unit; + else + last->next = unit; + last = unit; + ddata += 4 + unit->length; + } + elfParseAranges(data); + CompileUnit *comp = elfCompileUnits; + while(comp) { + ARanges *r = elfDebugInfo->ranges; + for(int i = 0; i < elfDebugInfo->numRanges; i++) + if(r[i].offset == comp->offset) { + comp->ranges = &r[i]; + break; + } + comp = comp->next; + } + elfParseCFA(data); + elfReadSymtab(data); + } + end: + if(sh) { + free(sh); + } + + elfSectionHeaders = NULL; + elfSectionHeadersStringTable = NULL; + elfSectionHeadersCount = 0; + + return true; +} + +extern bool parseDebug; + +bool elfRead(const char *name, int& siz, FILE *f) +{ + fseek(f, 0, SEEK_END); + long size = ftell(f); + elfFileData = (u8 *)malloc(size); + fseek(f, 0, SEEK_SET); + fread(elfFileData, 1, size, f); + fclose(f); + + ELFHeader *header = (ELFHeader *)elfFileData; + + if(READ32LE(&header->magic) != 0x464C457F || + READ16LE(&header->e_machine) != 40 || + header->clazz != 1) { + systemMessage(0, N_("Not a valid ELF file %s"), name); + free(elfFileData); + elfFileData = NULL; + return false; + } + + if(!elfReadProgram(header, elfFileData, siz, parseDebug)) { + free(elfFileData); + elfFileData = NULL; + return false; + } + + return true; +} + +void elfCleanUp(Object *o) +{ + free(o->location); +} + +void elfCleanUp(Function *func) +{ + Object *o = func->parameters; + while(o) { + elfCleanUp(o); + Object *next = o->next; + free(o); + o = next; + } + + o = func->variables; + while(o) { + elfCleanUp(o); + Object *next = o->next; + free(o); + o = next; + } + free(func->frameBase); +} + +void elfCleanUp(ELFAbbrev **abbrevs) +{ + for(int i = 0; i < 121; i++) { + ELFAbbrev *abbrev = abbrevs[i]; + + while(abbrev) { + free(abbrev->attrs); + ELFAbbrev *next = abbrev->next; + free(abbrev); + + abbrev = next; + } + } +} + +void elfCleanUp(Type *t) +{ + switch(t->type) { + case TYPE_function: + if(t->function) { + Object *o = t->function->args; + while(o) { + elfCleanUp(o); + Object *next = o->next; + free(o); + o = next; + } + free(t->function); + } + break; + case TYPE_array: + if(t->array) { + free(t->array->bounds); + free(t->array); + } + break; + case TYPE_struct: + case TYPE_union: + if(t->structure) { + for(int i = 0; i < t->structure->memberCount; i++) { + free(t->structure->members[i].location); + } + free(t->structure->members); + free(t->structure); + } + break; + case TYPE_enum: + if(t->enumeration) { + free(t->enumeration->members); + free(t->enumeration); + } + break; + case TYPE_base: + case TYPE_pointer: + case TYPE_void: + case TYPE_reference: + break; // nothing to do + } +} + +void elfCleanUp(CompileUnit *comp) +{ + elfCleanUp(comp->abbrevs); + free(comp->abbrevs); + Function *func = comp->functions; + while(func) { + elfCleanUp(func); + Function *next = func->next; + free(func); + func = next; + } + Type *t = comp->types; + while(t) { + elfCleanUp(t); + Type *next = t->next; + free(t); + t = next; + } + Object *o = comp->variables; + while(o) { + elfCleanUp(o); + Object *next = o->next; + free(o); + o = next; + } + if(comp->lineInfoTable) { + free(comp->lineInfoTable->lines); + free(comp->lineInfoTable->files); + free(comp->lineInfoTable); + } +} + +void elfCleanUp() +{ + CompileUnit *comp = elfCompileUnits; + + while(comp) { + elfCleanUp(comp); + CompileUnit *next = comp->next; + free(comp); + comp = next; + } + elfCompileUnits = NULL; + free(elfSymbols); + elfSymbols = NULL; + // free(elfSymbolsStrTab); + elfSymbolsStrTab = NULL; + + elfDebugStrings = NULL; + if(elfDebugInfo) { + int num = elfDebugInfo->numRanges; + int i; + for(i = 0; i < num; i++) { + free(elfDebugInfo->ranges[i].ranges); + } + free(elfDebugInfo->ranges); + free(elfDebugInfo); + elfDebugInfo = NULL; + } + + if(elfFdes) { + if(elfFdeCount) { + for(int i = 0; i < elfFdeCount; i++) + free(elfFdes[i]); + } + free(elfFdes); + + elfFdes = NULL; + elfFdeCount = 0; + } + + ELFcie *cie = elfCies; + while(cie) { + ELFcie *next = cie->next; + free(cie); + cie = next; + } + elfCies = NULL; + + if(elfFileData) { + free(elfFileData); + elfFileData = NULL; + } +} diff --git a/src/elf.h b/src/elf.h new file mode 100644 index 0000000..8ce4379 --- /dev/null +++ b/src/elf.h @@ -0,0 +1,283 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_ELF_H +#define VBA_ELF_H + +enum LocationType { + LOCATION_register, + LOCATION_memory, + LOCATION_value +}; + +#define DW_ATE_boolean 0x02 +#define DW_ATE_signed 0x05 +#define DW_ATE_unsigned 0x07 +#define DW_ATE_unsigned_char 0x08 + +struct ELFHeader { + u32 magic; + u8 clazz; + u8 data; + u8 version; + u8 pad[9]; + u16 e_type; + u16 e_machine; + u32 e_version; + u32 e_entry; + u32 e_phoff; + u32 e_shoff; + u32 e_flags; + u16 e_ehsize; + u16 e_phentsize; + u16 e_phnum; + u16 e_shentsize; + u16 e_shnum; + u16 e_shstrndx; +}; + +struct ELFProgramHeader { + u32 type; + u32 offset; + u32 vaddr; + u32 paddr; + u32 filesz; + u32 memsz; + u32 flags; + u32 align; +}; + +struct ELFSectionHeader { + u32 name; + u32 type; + u32 flags; + u32 addr; + u32 offset; + u32 size; + u32 link; + u32 info; + u32 addralign; + u32 entsize; +}; + +struct ELFSymbol { + u32 name; + u32 value; + u32 size; + u8 info; + u8 other; + u16 shndx; +}; + +struct ELFBlock { + int length; + u8 *data; +}; + +struct ELFAttr { + u32 name; + u32 form; + union { + u32 value; + char *string; + u8 *data; + bool flag; + ELFBlock *block; + }; +}; + +struct ELFAbbrev { + u32 number; + u32 tag; + bool hasChildren; + int numAttrs; + ELFAttr *attrs; + ELFAbbrev *next; +}; + +enum TypeEnum { + TYPE_base, + TYPE_pointer, + TYPE_function, + TYPE_void, + TYPE_array, + TYPE_struct, + TYPE_reference, + TYPE_enum, + TYPE_union +}; + +struct Type; +struct Object; + +struct FunctionType { + Type *returnType; + Object *args; +}; + +struct Member { + char *name; + Type *type; + int bitSize; + int bitOffset; + int byteSize; + ELFBlock *location; +}; + +struct Struct { + int memberCount; + Member *members; +}; + +struct Array { + Type *type; + int maxBounds; + int *bounds; +}; + +struct EnumMember { + char *name; + u32 value; +}; + +struct Enum { + int count; + EnumMember *members; +}; + +struct Type { + u32 offset; + TypeEnum type; + char *name; + int encoding; + int size; + int bitSize; + union { + Type *pointer; + FunctionType *function; + Array *array; + Struct *structure; + Enum *enumeration; + }; + Type *next; +}; + +struct Object { + char *name; + int file; + int line; + bool external; + Type *type; + ELFBlock *location; + u32 startScope; + u32 endScope; + Object *next; +}; + +struct Function { + char *name; + u32 lowPC; + u32 highPC; + int file; + int line; + bool external; + Type *returnType; + Object *parameters; + Object *variables; + ELFBlock *frameBase; + Function *next; +}; + +struct LineInfoItem { + u32 address; + char *file; + int line; +}; + +struct LineInfo { + int fileCount; + char **files; + int number; + LineInfoItem *lines; +}; + +struct ARange { + u32 lowPC; + u32 highPC; +}; + +struct ARanges { + u32 offset; + int count; + ARange *ranges; +}; + +struct CompileUnit { + u32 length; + u8 *top; + u32 offset; + ELFAbbrev **abbrevs; + ARanges *ranges; + char *name; + char *compdir; + u32 lowPC; + u32 highPC; + bool hasLineInfo; + u32 lineInfo; + LineInfo *lineInfoTable; + Function *functions; + Function *lastFunction; + Object *variables; + Type *types; + CompileUnit *next; +}; + +struct DebugInfo { + u8 *debugfile; + u8 *abbrevdata; + u8 *debugdata; + u8 *infodata; + int numRanges; + ARanges *ranges; +}; + +struct Symbol { + char *name; + int type; + int binding; + u32 address; + u32 value; + u32 size; +}; + +extern u32 elfReadLEB128(u8 *, int *); +extern s32 elfReadSignedLEB128(u8 *, int *); +extern bool elfRead(const char *, int &, FILE *f); +extern bool elfGetSymbolAddress(char *,u32 *, u32 *, int *); +extern char *elfGetAddressSymbol(u32); +extern char *elfGetSymbol(int, u32 *, u32 *, int *); +extern void elfCleanUp(); +extern bool elfGetCurrentFunction(u32, Function **, CompileUnit **c); +extern bool elfGetObject(char *, Function *, CompileUnit *, Object **); +extern bool elfFindLineInUnit(u32 *, CompileUnit *, int); +extern bool elfFindLineInModule(u32 *, char *, int); +u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *); +u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *, u32); +int elfFindLine(CompileUnit *unit, Function *func, u32 addr, char **); +#endif diff --git a/src/expr-lex.cpp b/src/expr-lex.cpp new file mode 100644 index 0000000..91f1074 --- /dev/null +++ b/src/expr-lex.cpp @@ -0,0 +1,1590 @@ +#line 2 "expr-lex.cpp" +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvsroot/vba/VisualBoyAdvance/src/expr-lex.cpp,v 1.2 2003/06/06 14:17:21 forgotten Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#ifdef __GNUC__ +#include +#endif + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 10 +#define YY_END_OF_BUFFER 11 +static yyconst short int yy_accept[24] = + { 0, + 0, 0, 11, 9, 8, 8, 6, 7, 9, 4, + 3, 2, 2, 8, 5, 3, 2, 2, 2, 2, + 2, 1, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 4, 1, 1, + 1, 5, 1, 1, 6, 7, 1, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, + 1, 9, 1, 1, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 1, 1, 1, 1, 10, 1, 10, 10, 10, 10, + + 11, 12, 10, 10, 13, 10, 10, 10, 10, 10, + 14, 10, 10, 10, 15, 10, 10, 10, 10, 10, + 10, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[17] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, + 2, 2, 2, 2, 2, 2 + } ; + +static yyconst short int yy_base[25] = + { 0, + 0, 0, 32, 33, 15, 17, 33, 33, 22, 33, + 22, 0, 16, 19, 33, 20, 0, 11, 15, 11, + 12, 0, 33, 21 + } ; + +static yyconst short int yy_def[25] = + { 0, + 23, 1, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 24, 24, 23, 23, 23, 24, 24, 24, 24, + 24, 24, 0, 23 + } ; + +static yyconst short int yy_nxt[50] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, + 12, 12, 12, 12, 13, 12, 14, 14, 14, 14, + 14, 14, 17, 22, 21, 20, 19, 16, 18, 16, + 15, 23, 3, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23 + } ; + +static yyconst short int yy_chk[50] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, + 14, 14, 24, 21, 20, 19, 18, 16, 13, 11, + 9, 3, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "expr.l" +#define INITIAL 0 +#line 2 "expr.l" +#include "expr.cpp.h" + +#ifndef __GNUC__ +#include +#define isatty _isatty +#endif + +char *exprString; +int exprCol; + +#define YY_INPUT(buf,result,max_size) \ + { \ + int c = *exprString++; \ + exprCol++;\ + result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ + } +#define YY_MAIN 0 +#line 400 "expr-lex.cpp" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + +#line 31 "expr.l" + + +#line 554 "expr-lex.cpp" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 24 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 33 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 33 "expr.l" +{ + return TOKEN_SIZEOF; +} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 37 "expr.l" +{ + return TOKEN_IDENTIFIER; +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 41 "expr.l" +{ + return TOKEN_NUMBER; +} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 45 "expr.l" +{ + return TOKEN_DOT; +} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 49 "expr.l" +{ + return TOKEN_ARROW; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 53 "expr.l" +{ + return TOKEN_ADDR; +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 57 "expr.l" +{ + return TOKEN_STAR; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 61 "expr.l" + + YY_BREAK +case 9: +YY_RULE_SETUP +#line 63 "expr.l" +return *yytext; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 65 "expr.l" +ECHO; + YY_BREAK +#line 701 "expr-lex.cpp" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 24 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 24 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 23); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 65 "expr.l" + + +void exprCleanBuffer() +{ + yy_delete_buffer(yy_current_buffer); + yy_init = 1; +} diff --git a/src/expr.cpp b/src/expr.cpp new file mode 100644 index 0000000..25c68f6 --- /dev/null +++ b/src/expr.cpp @@ -0,0 +1,998 @@ + +/* A Bison parser, made from expr.y + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define TOKEN_IDENTIFIER 257 +#define TOKEN_DOT 258 +#define TOKEN_STAR 259 +#define TOKEN_ARROW 260 +#define TOKEN_ADDR 261 +#define TOKEN_SIZEOF 262 +#define TOKEN_NUMBER 263 + +#line 1 "expr.y" + +namespace std { +#include +#include +#include +#include +} + +using namespace std; + +#include "System.h" +#include "elf.h" +#include "exprNode.h" + +extern int yyerror(char *); +extern int yylex(); +extern char *yytext; + + +//#define YYERROR_VERBOSE 1 +//#define YYDEBUG 1 + + Node *result = NULL; +#ifndef YYSTYPE +#define YYSTYPE int +#endif +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 26 +#define YYFLAG -32768 +#define YYNTBASE 14 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 263 ? yytranslate[x] : 19) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 11, + 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 10, 2, 13, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 8, 12, 16, 21, 23, 26, 29, + 34, 36 +}; + +static const short yyrhs[] = { 15, + 0, 16, 0, 11, 15, 12, 0, 15, 4, 18, + 0, 15, 6, 18, 0, 15, 10, 17, 13, 0, + 18, 0, 5, 15, 0, 7, 15, 0, 8, 11, + 15, 12, 0, 9, 0, 3, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 32, 35, 36, 37, 38, 39, 42, 43, 44, 45, + 49, 53 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","TOKEN_IDENTIFIER", +"TOKEN_DOT","TOKEN_STAR","TOKEN_ARROW","TOKEN_ADDR","TOKEN_SIZEOF","TOKEN_NUMBER", +"'['","'('","')'","']'","final","expression","simple_expression","number","ident", NULL +}; +#endif + +static const short yyr1[] = { 0, + 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, + 17, 18 +}; + +static const short yyr2[] = { 0, + 1, 1, 3, 3, 3, 4, 1, 2, 2, 4, + 1, 1 +}; + +static const short yydefact[] = { 0, + 12, 0, 0, 0, 0, 1, 2, 7, 8, 9, + 0, 0, 0, 0, 0, 0, 3, 4, 5, 11, + 0, 10, 6, 0, 0, 0 +}; + +static const short yydefgoto[] = { 24, + 6, 7, 21, 8 +}; + +static const short yypact[] = { -1, +-32768, -1, -1, -6, -1, 17,-32768,-32768, 17, 17, + -1, 7, 5, 5, 13, 8,-32768,-32768,-32768,-32768, + 11,-32768,-32768, 25, 26,-32768 +}; + +static const short yypgoto[] = {-32768, + -2,-32768,-32768, 2 +}; + + +#define YYLAST 27 + + +static const short yytable[] = { 9, + 10, 1, 12, 2, 11, 3, 4, 1, 16, 5, + 13, 13, 14, 14, 18, 19, 15, 15, 17, 22, + 13, 20, 14, 23, 25, 26, 15 +}; + +static const short yycheck[] = { 2, + 3, 3, 5, 5, 11, 7, 8, 3, 11, 11, + 4, 4, 6, 6, 13, 14, 10, 10, 12, 12, + 4, 9, 6, 13, 0, 0, 10 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/lib/bison.simple" +/* This file comes from bison-1.28. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 217 "/usr/lib/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 32 "expr.y" +{ result = yyvsp[0]; ; + break;} +case 2: +#line 36 "expr.y" +{ yyval = yyvsp[0]; ; + break;} +case 3: +#line 37 "expr.y" +{ yyval = yyvsp[-1]; ; + break;} +case 4: +#line 38 "expr.y" +{ yyval = exprNodeDot(yyvsp[-2], yyvsp[0]); ; + break;} +case 5: +#line 39 "expr.y" +{ yyval = exprNodeArrow(yyvsp[-2], yyvsp[0]); ; + break;} +case 6: +#line 40 "expr.y" +{ yyval = exprNodeArray(yyvsp[-3], yyvsp[-1]); ; + break;} +case 7: +#line 43 "expr.y" +{ yyval = yyvsp[0]; ; + break;} +case 8: +#line 44 "expr.y" +{ yyval = exprNodeStar(yyvsp[0]); ; + break;} +case 9: +#line 45 "expr.y" +{ yyval = exprNodeAddr(yyvsp[0]); ; + break;} +case 10: +#line 46 "expr.y" +{ yyval = exprNodeSizeof(yyvsp[-1]); ; + break;} +case 11: +#line 50 "expr.y" +{ yyval = exprNodeNumber(); ; + break;} +case 12: +#line 54 "expr.y" +{yyval = exprNodeIdentifier(); ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/lib/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 57 "expr.y" + + +int yyerror(char *s) +{ + return 0; +} + +#ifndef SDL +extern FILE *yyin; +int main(int argc, char **argv) +{ + // yydebug = 1; + ++argv, --argc; + if(argc > 0) + yyin = fopen(argv[0], "r"); + else + yyin = stdin; + if(!yyparse()) + result->print(); +} +#endif diff --git a/src/expr.cpp.h b/src/expr.cpp.h new file mode 100644 index 0000000..9b3fdc3 --- /dev/null +++ b/src/expr.cpp.h @@ -0,0 +1,13 @@ +#ifndef YYSTYPE +#define YYSTYPE int +#endif +#define TOKEN_IDENTIFIER 257 +#define TOKEN_DOT 258 +#define TOKEN_STAR 259 +#define TOKEN_ARROW 260 +#define TOKEN_ADDR 261 +#define TOKEN_SIZEOF 262 +#define TOKEN_NUMBER 263 + + +extern YYSTYPE yylval; diff --git a/src/expr.l b/src/expr.l new file mode 100644 index 0000000..19cd49d --- /dev/null +++ b/src/expr.l @@ -0,0 +1,71 @@ +%{ +#include "expr.cpp.h" + +#ifndef __GNUC__ +#include +#define isatty _isatty +#endif + +char *exprString; +int exprCol; + +#define YY_INPUT(buf,result,max_size) \ + { \ + int c = *exprString++; \ + exprCol++;\ + result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ + } +%} + +%option nomain +%option noyywrap + +SIZEOF "sizeof" +ID [a-zA-Z_][a-zA-Z0-9_]* +NUM [0-9]+ +DOT "." +ARROW "->" +STAR "*" +ADDR "&" + +%% + +{SIZEOF} { + return TOKEN_SIZEOF; +} + +{ID} { + return TOKEN_IDENTIFIER; +} + +{NUM} { + return TOKEN_NUMBER; +} + +{DOT} { + return TOKEN_DOT; +} + +{ARROW} { + return TOKEN_ARROW; +} + +{ADDR} { + return TOKEN_ADDR; +} + +{STAR} { + return TOKEN_STAR; +} + +[ \t\n]+ + +. return *yytext; + +%% + +void exprCleanBuffer() +{ + yy_delete_buffer(yy_current_buffer); + yy_init = 1; +} diff --git a/src/expr.y b/src/expr.y new file mode 100644 index 0000000..0a02026 --- /dev/null +++ b/src/expr.y @@ -0,0 +1,77 @@ +%{ +namespace std { +#include +#include +#include +#include +} + +using namespace std; + +#include "System.h" +#include "elf.h" +#include "exprNode.h" + +extern int yyerror(char *); +extern int yylex(); +extern char *yytext; + + +//#define YYERROR_VERBOSE 1 +//#define YYDEBUG 1 + + Node *result = NULL; +%} + +%token TOKEN_IDENTIFIER TOKEN_DOT TOKEN_STAR TOKEN_ARROW TOKEN_ADDR +%token TOKEN_SIZEOF TOKEN_NUMBER +%left TOKEN_DOT TOKEN_ARROW '[' +%expect 6 +%% + +final: expression { result = $1; } +; + +expression: + simple_expression { $$ = $1; } | + '(' expression ')' { $$ = $2; } | + expression TOKEN_DOT ident { $$ = exprNodeDot($1, $3); } | + expression TOKEN_ARROW ident { $$ = exprNodeArrow($1, $3); } | + expression '[' number ']' { $$ = exprNodeArray($1, $3); } +; +simple_expression: + ident { $$ = $1; } | + TOKEN_STAR expression { $$ = exprNodeStar($2); } | + TOKEN_ADDR expression { $$ = exprNodeAddr($2); } | + TOKEN_SIZEOF '(' expression ')' { $$ = exprNodeSizeof($3); } +; + +number: + TOKEN_NUMBER { $$ = exprNodeNumber(); } +; + +ident: + TOKEN_IDENTIFIER {$$ = exprNodeIdentifier(); } +; + +%% + +int yyerror(char *s) +{ + return 0; +} + +#ifndef SDL +extern FILE *yyin; +int main(int argc, char **argv) +{ + // yydebug = 1; + ++argv, --argc; + if(argc > 0) + yyin = fopen(argv[0], "r"); + else + yyin = stdin; + if(!yyparse()) + result->print(); +} +#endif diff --git a/src/exprNode.cpp b/src/exprNode.cpp new file mode 100644 index 0000000..fab17f8 --- /dev/null +++ b/src/exprNode.cpp @@ -0,0 +1,411 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#include "GBA.h" +#include "Port.h" +#include "elf.h" +#include "exprNode.h" + +extern char *yytext; + +#define debuggerReadMemory(addr) \ + READ32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +void *exprNodeCleanUpList[100]; +int exprNodeCleanUpCount = 0; +Type exprNodeType = { 0, TYPE_base, "int", DW_ATE_signed, 4, 0, {0}, 0 }; + +void exprNodeClean(void *m) +{ + exprNodeCleanUpList[exprNodeCleanUpCount++] = m; +} + +void exprNodeCleanUp() +{ + for(int i = 0; i < exprNodeCleanUpCount; i++) { + free(exprNodeCleanUpList[i]); + } + exprNodeCleanUpCount = 0; +} + +Node *exprNodeIdentifier() +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + n->name = strdup(yytext); + + exprNodeClean(n->name); + exprNodeClean(n); + + n->print = exprNodeIdentifierPrint; + n->resolve = exprNodeIdentifierResolve; + return n; +} + +bool exprNodeIdentifierResolve(Node *n, Function *f, CompileUnit *u) +{ + Object *o; + if(elfGetObject(n->name, f, u, &o)) { + n->type = o->type; + n->location = elfDecodeLocation(f, o->location, &n->locType); + return true; + } else { + printf("Object %s not found\n", n->name); + } + return false; +} + +void exprNodeIdentifierPrint(Node *n) +{ + printf("%s", n->name); +} + +Node *exprNodeNumber() +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + + exprNodeClean(n); + n->location = atoi(yytext); + n->type = &exprNodeType; + n->locType = LOCATION_value; + n->print = exprNodeNumberPrint; + n->resolve = exprNodeNumberResolve; + return n; +} + +bool exprNodeNumberResolve(Node *n, Function *f, CompileUnit *u) +{ + return true; +} + +void exprNodeNumberPrint(Node *n) +{ + printf("%d", n->location); +} + +Node *exprNodeStar(Node *exp) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + + n->print = exprNodeStarPrint; + n->resolve = exprNodeStarResolve; + return n; +} + +bool exprNodeStarResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + if(n->expression->type->type == TYPE_pointer) { + n->location = n->expression->location; + if(n->expression->locType == LOCATION_memory) { + n->location = debuggerReadMemory(n->location); + } else if(n->expression->locType == LOCATION_register) { + n->location = reg[n->expression->location].I; + } else { + n->location = n->expression->location; + } + n->type = n->expression->type->pointer; + n->locType = LOCATION_memory; + return true; + } else { + printf("Object is not of pointer type\n"); + } + } + return false; +} + +void exprNodeStarPrint(Node *n) +{ + printf("*"); + n->expression->print(n->expression); +} + +Node *exprNodeDot(Node *exp, Node *ident) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + n->name = ident->name; + + n->print = exprNodeDotPrint; + n->resolve = exprNodeDotResolve; + return n; +} + +bool exprNodeDotResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + TypeEnum tt = n->expression->type->type; + + if(tt == TYPE_struct || + tt == TYPE_union) { + u32 loc = n->expression->location; + Type *t = n->expression->type; + int count = t->structure->memberCount; + int i = 0; + while(i < count) { + Member *m = &t->structure->members[i]; + if(strcmp(m->name, n->name) == 0) { + // found member + n->type = m->type; + if(tt == TYPE_struct) { + n->location = elfDecodeLocation(f, m->location, &n->locType, + loc); + n->objLocation = loc; + } else { + n->location = loc; + n->locType = n->expression->locType; + n->objLocation = loc; + } + n->member = m; + return true; + } + i++; + } + printf("Member %s not found\n", n->name); + } else { + printf("Object is not of structure type\n"); + } + } + return false; +} + +void exprNodeDotPrint(Node *n) +{ + n->expression->print(n->expression); + printf(".%s", n->name); +} + +Node *exprNodeArrow(Node *exp, Node *ident) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + n->name = ident->name; + + n->print = exprNodeArrowPrint; + n->resolve = exprNodeArrowResolve; + return n; +} + +bool exprNodeArrowResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + TypeEnum tt = n->expression->type->type; + if(tt != TYPE_pointer) { + printf("Object not of pointer type\n"); + return false; + } + tt = n->expression->type->pointer->type; + + if(tt == TYPE_struct || + tt == TYPE_union) { + u32 loc = debuggerReadMemory(n->expression->location); + Type *t = n->expression->type->pointer; + int count = t->structure->memberCount; + int i = 0; + while(i < count) { + Member *m = &t->structure->members[i]; + if(strcmp(m->name, n->name) == 0) { + // found member + n->type = m->type; + if(tt == TYPE_struct) { + n->location = elfDecodeLocation(f, m->location, &n->locType, + loc); + n->objLocation = loc; + } else { + n->location = loc; + n->objLocation = loc; + } + n->locType = LOCATION_memory; + n->member = m; + return true; + } + i++; + } + printf("Member %s not found\n", n->name); + } else { + printf("Object is not of structure type\n"); + } + } + return false; +} + +void exprNodeArrowPrint(Node *n) +{ + n->expression->print(n->expression); + printf("->%s", n->name); +} + +Node *exprNodeAddr(Node *exp) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + + n->print = exprNodeAddrPrint; + n->resolve = exprNodeAddrResolve; + return n; +} + +bool exprNodeAddrResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + if(n->expression->locType == LOCATION_memory) { + n->location = n->expression->location; + n->locType = LOCATION_value; + n->type = &exprNodeType; + } else if(n->expression->locType == LOCATION_register) { + printf("Value is in register %d\n", n->expression->location); + } else { + printf("Direct value is %d\n", n->location); + } + return true; + } + return false; +} + +void exprNodeAddrPrint(Node *n) +{ + printf("*"); + n->expression->print(n->expression); +} + +Node *exprNodeSizeof(Node *exp) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + + n->print = exprNodeSizeofPrint; + n->resolve = exprNodeSizeofResolve; + return n; +} + +bool exprNodeSizeofResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + n->location = n->expression->type->size; + n->locType = LOCATION_value; + n->type = &exprNodeType; + return true; + } + return false; +} + +void exprNodeSizeofPrint(Node *n) +{ + printf("sizeof("); + n->expression->print(n->expression); + printf(")"); +} + +Node *exprNodeArray(Node *exp, Node *number) +{ + Node *n = (Node *)calloc(1, sizeof(Node)); + exprNodeClean(n); + + n->expression = exp; + n->value = number->location; + + n->print = exprNodeArrayPrint; + n->resolve = exprNodeArrayResolve; + return n; +} + +int exprNodeGetSize(Array *a, int index) +{ + index++; + if(index == a->maxBounds) { + return a->type->size; + } else { + int size = a->bounds[a->maxBounds-1] * a->type->size; + + for(int i = index; i < a->maxBounds-1; i++) { + size *= a->bounds[i]; + } + return size; + } +} + +bool exprNodeArrayResolve(Node *n, Function *f, CompileUnit *u) +{ + if(n->expression->resolve(n->expression, f, u)) { + TypeEnum tt = n->expression->type->type; + if(tt != TYPE_array && + tt != TYPE_pointer) { + printf("Object not of array or pointer type\n"); + return false; + } + + if(tt == TYPE_array) { + Array *a = n->expression->type->array; + + u32 loc = n->expression->location; + Type *t = a->type; + if(a->maxBounds > 1) { + int index = n->expression->index; + + if(index == a->maxBounds) { + printf("Too many indices for array\n"); + return false; + } + + if((index+1) < a->maxBounds) { + n->type = n->expression->type; + n->index = index+1; + n->locType = LOCATION_memory; + n->location = n->expression->location + + n->value * exprNodeGetSize(a, index); + return true; + } + } + n->type = t; + n->location = loc + n->value * t->size; + n->locType = LOCATION_memory; + } else { + Type *t = n->expression->type->pointer; + u32 loc = n->expression->location; + if(n->expression->locType == LOCATION_register) + loc = reg[loc].I; + else + loc = debuggerReadMemory(loc); + n->type = t; + n->location = loc + n->value * t->size; + n->locType = LOCATION_memory; + } + return true; + } + return false; +} + +void exprNodeArrayPrint(Node *n) +{ + n->expression->print(n->expression); + printf("[%d]", n->value); +} diff --git a/src/exprNode.h b/src/exprNode.h new file mode 100644 index 0000000..15c1e4b --- /dev/null +++ b/src/exprNode.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +struct Node { + Type *type; + u32 location; + u32 objLocation; + LocationType locType; + int value; + int index; + char *name; + Node *expression; + Member *member; + void (*print)(Node *); + bool (*resolve)(Node *, Function *f, CompileUnit *u); +}; + +extern void exprNodeCleanUp(); + +extern Node *exprNodeIdentifier(); +extern void exprNodeIdentifierPrint(Node *); +extern bool exprNodeIdentifierResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeNumber(); +extern void exprNodeNumberPrint(Node *); +extern bool exprNodeNumberResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeStar(Node *); +extern void exprNodeStarPrint(Node *); +extern bool exprNodeStarResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeDot(Node *, Node *); +extern void exprNodeDotPrint(Node *); +extern bool exprNodeDotResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeArrow(Node *, Node *); +extern void exprNodeArrowPrint(Node *); +extern bool exprNodeArrowResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeAddr(Node *); +extern void exprNodeAddrPrint(Node *); +extern bool exprNodeAddrResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeSizeof(Node *); +extern void exprNodeSizeofPrint(Node *); +extern bool exprNodeSizeofResolve(Node *, Function *, CompileUnit *); + +extern Node *exprNodeArray(Node *, Node *); +extern void exprNodeArrayPrint(Node *); +extern bool exprNodeArrayResolve(Node *, Function *, CompileUnit *); + +#define YYSTYPE struct Node * diff --git a/src/gb/GB.cpp b/src/gb/GB.cpp new file mode 100644 index 0000000..5471eb9 --- /dev/null +++ b/src/gb/GB.cpp @@ -0,0 +1,3805 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include + +#include "../System.h" +#include "../NLS.h" +#include "GB.h" +#include "gbCheats.h" +#include "gbGlobals.h" +#include "gbMemory.h" +#include "gbSGB.h" +#include "gbSound.h" +#include "../unzip.h" +#include "../Util.h" +#if (defined(WIN32) && !defined(SDL)) +# include "../win32/stdafx.h" +# include "../win32/vba.h" +#endif +#include "../movie.h" + +#ifdef __GNUC__ +#define _stricmp strcasecmp +#endif + +u8 *origPix = NULL; +extern u8 *pix; +extern bool speedup; + +bool gbUpdateSizes(); + +// debugging +bool memorydebug = false; +char gbBuffer[2048]; + +extern u16 gbLineMix[160]; + +// mappers +void (*mapper)(u16,u8) = NULL; +void (*mapperRAM)(u16,u8) = NULL; +u8 (*mapperReadRAM)(u16) = NULL; + +// registers +gbRegister PC; +gbRegister SP; +gbRegister AF; +gbRegister BC; +gbRegister DE; +gbRegister HL; +u16 IFF; +// 0xff04 +u8 register_DIV = 0; +// 0xff05 +u8 register_TIMA = 0; +// 0xff06 +u8 register_TMA = 0; +// 0xff07 +u8 register_TAC = 0; +// 0xff0f +u8 register_IF = 0; +// 0xff40 +u8 register_LCDC = 0; +// 0xff41 +u8 register_STAT = 0; +// 0xff42 +u8 register_SCY = 0; +// 0xff43 +u8 register_SCX = 0; +// 0xff44 +u8 register_LY = 0; +// 0xff45 +u8 register_LYC = 0; +// 0xff46 +u8 register_DMA = 0; +// 0xff4a +u8 register_WY = 0; +// 0xff4b +u8 register_WX = 0; +// 0xff4f +u8 register_VBK = 0; +// 0xff51 +u8 register_HDMA1 = 0; +// 0xff52 +u8 register_HDMA2 = 0; +// 0xff53 +u8 register_HDMA3 = 0; +// 0xff54 +u8 register_HDMA4 = 0; +// 0xff55 +u8 register_HDMA5 = 0; +// 0xff70 +u8 register_SVBK = 0; +// 0xffff +u8 register_IE = 0; + +// ticks definition +int GBDIV_CLOCK_TICKS = 64; +int GBLCD_MODE_0_CLOCK_TICKS = 51; +int GBLCD_MODE_1_CLOCK_TICKS = 1140; +int GBLCD_MODE_2_CLOCK_TICKS = 20; +int GBLCD_MODE_3_CLOCK_TICKS = 43; +int GBLY_INCREMENT_CLOCK_TICKS = 114; +int GBTIMER_MODE_0_CLOCK_TICKS = 256; +int GBTIMER_MODE_1_CLOCK_TICKS = 4; +int GBTIMER_MODE_2_CLOCK_TICKS = 16; +int GBTIMER_MODE_3_CLOCK_TICKS = 64; +int GBSERIAL_CLOCK_TICKS = 128; +int GBSYNCHRONIZE_CLOCK_TICKS = 52920; + +// state variables + +// interrupt +int gbInterrupt = 0; +int gbInterruptWait = 0; +// serial +int gbSerialOn = 0; +int gbSerialTicks = 0; +int gbSerialBits = 0; +// timer +int gbTimerOn = 0; +int gbTimerTicks = 0; +int gbTimerClockTicks = 0; +int gbTimerMode = 0; +// lcd +int gbLcdMode = 2; +int gbLcdTicks = GBLCD_MODE_2_CLOCK_TICKS; +int gbLcdLYIncrementTicks = 0; +// div +int gbDivTicks = GBDIV_CLOCK_TICKS; +// cgb +int gbVramBank = 0; +int gbWramBank = 1; +int gbHdmaSource = 0x0000; +int gbHdmaDestination = 0x8000; +int gbHdmaBytes = 0x0000; +int gbHdmaOn = 0; +int gbSpeed = 0; +// frame counting +int gbFrameCount = 0; +int gbFrameSkip = 0; +int gbFrameSkipCount = 0; +// timing +u32 gbLastTime = 0; +u32 gbElapsedTime = 0; +u32 gbTimeNow = 0; +int gbSynchronizeTicks = GBSYNCHRONIZE_CLOCK_TICKS; +int gbDMASpeedVersion = 1; +// emulator features +int gbBattery = 0; +int gbCaptureNumber = 0; +bool gbCapture = false; +bool gbCapturePrevious = false; +int gbJoymask[4] = { 0, 0, 0, 0 }; + +static bool pauseAfterFrameAdvance = false; + +int gbRomSizes[] = { 0x00008000, // 32K +0x00010000, // 64K +0x00020000, // 128K +0x00040000, // 256K +0x00080000, // 512K +0x00100000, // 1024K +0x00200000, // 2048K +0x00400000, // 4096K +0x00800000 // 8192K +}; +int gbRomSizesMasks[] = { 0x00007fff, +0x0000ffff, +0x0001ffff, +0x0003ffff, +0x0007ffff, +0x000fffff, +0x001fffff, +0x003fffff, +0x007fffff +}; + +int gbRamSizes[6] = { 0x00000000, // 0K +0x00000800, // 2K +0x00002000, // 8K +0x00008000, // 32K +0x00020000, // 128K +0x00010000 // 64K +}; + +int gbRamSizesMasks[6] = { 0x00000000, +0x000007ff, +0x00001fff, +0x00007fff, +0x0001ffff, +0x0000ffff +}; + +int gbCycles[] = +{ + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, // 0 + 1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, // 1 + 2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, // 2 + 2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, // 3 + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 4 + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 5 + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 6 + 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, // 7 + 1, 1, 1, 1, 1,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// a + 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // b + 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // c + 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // d + 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // e + 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2 // f +}; + +u16 DAATable[] = +{ + 0x0080,0x0100,0x0200,0x0300,0x0400,0x0500,0x0600,0x0700, + 0x0800,0x0900,0x1020,0x1120,0x1220,0x1320,0x1420,0x1520, + 0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700, + 0x1800,0x1900,0x2020,0x2120,0x2220,0x2320,0x2420,0x2520, + 0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,0x2700, + 0x2800,0x2900,0x3020,0x3120,0x3220,0x3320,0x3420,0x3520, + 0x3000,0x3100,0x3200,0x3300,0x3400,0x3500,0x3600,0x3700, + 0x3800,0x3900,0x4020,0x4120,0x4220,0x4320,0x4420,0x4520, + 0x4000,0x4100,0x4200,0x4300,0x4400,0x4500,0x4600,0x4700, + 0x4800,0x4900,0x5020,0x5120,0x5220,0x5320,0x5420,0x5520, + 0x5000,0x5100,0x5200,0x5300,0x5400,0x5500,0x5600,0x5700, + 0x5800,0x5900,0x6020,0x6120,0x6220,0x6320,0x6420,0x6520, + 0x6000,0x6100,0x6200,0x6300,0x6400,0x6500,0x6600,0x6700, + 0x6800,0x6900,0x7020,0x7120,0x7220,0x7320,0x7420,0x7520, + 0x7000,0x7100,0x7200,0x7300,0x7400,0x7500,0x7600,0x7700, + 0x7800,0x7900,0x8020,0x8120,0x8220,0x8320,0x8420,0x8520, + 0x8000,0x8100,0x8200,0x8300,0x8400,0x8500,0x8600,0x8700, + 0x8800,0x8900,0x9020,0x9120,0x9220,0x9320,0x9420,0x9520, + 0x9000,0x9100,0x9200,0x9300,0x9400,0x9500,0x9600,0x9700, + 0x9800,0x9900,0x00B0,0x0130,0x0230,0x0330,0x0430,0x0530, + 0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,0x0610,0x0710, + 0x0810,0x0910,0x1030,0x1130,0x1230,0x1330,0x1430,0x1530, + 0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,0x1610,0x1710, + 0x1810,0x1910,0x2030,0x2130,0x2230,0x2330,0x2430,0x2530, + 0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,0x2610,0x2710, + 0x2810,0x2910,0x3030,0x3130,0x3230,0x3330,0x3430,0x3530, + 0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,0x3610,0x3710, + 0x3810,0x3910,0x4030,0x4130,0x4230,0x4330,0x4430,0x4530, + 0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,0x4610,0x4710, + 0x4810,0x4910,0x5030,0x5130,0x5230,0x5330,0x5430,0x5530, + 0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,0x5610,0x5710, + 0x5810,0x5910,0x6030,0x6130,0x6230,0x6330,0x6430,0x6530, + 0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,0x6610,0x6710, + 0x6810,0x6910,0x7030,0x7130,0x7230,0x7330,0x7430,0x7530, + 0x7010,0x7110,0x7210,0x7310,0x7410,0x7510,0x7610,0x7710, + 0x7810,0x7910,0x8030,0x8130,0x8230,0x8330,0x8430,0x8530, + 0x8010,0x8110,0x8210,0x8310,0x8410,0x8510,0x8610,0x8710, + 0x8810,0x8910,0x9030,0x9130,0x9230,0x9330,0x9430,0x9530, + 0x9010,0x9110,0x9210,0x9310,0x9410,0x9510,0x9610,0x9710, + 0x9810,0x9910,0xA030,0xA130,0xA230,0xA330,0xA430,0xA530, + 0xA010,0xA110,0xA210,0xA310,0xA410,0xA510,0xA610,0xA710, + 0xA810,0xA910,0xB030,0xB130,0xB230,0xB330,0xB430,0xB530, + 0xB010,0xB110,0xB210,0xB310,0xB410,0xB510,0xB610,0xB710, + 0xB810,0xB910,0xC030,0xC130,0xC230,0xC330,0xC430,0xC530, + 0xC010,0xC110,0xC210,0xC310,0xC410,0xC510,0xC610,0xC710, + 0xC810,0xC910,0xD030,0xD130,0xD230,0xD330,0xD430,0xD530, + 0xD010,0xD110,0xD210,0xD310,0xD410,0xD510,0xD610,0xD710, + 0xD810,0xD910,0xE030,0xE130,0xE230,0xE330,0xE430,0xE530, + 0xE010,0xE110,0xE210,0xE310,0xE410,0xE510,0xE610,0xE710, + 0xE810,0xE910,0xF030,0xF130,0xF230,0xF330,0xF430,0xF530, + 0xF010,0xF110,0xF210,0xF310,0xF410,0xF510,0xF610,0xF710, + 0xF810,0xF910,0x00B0,0x0130,0x0230,0x0330,0x0430,0x0530, + 0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,0x0610,0x0710, + 0x0810,0x0910,0x1030,0x1130,0x1230,0x1330,0x1430,0x1530, + 0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,0x1610,0x1710, + 0x1810,0x1910,0x2030,0x2130,0x2230,0x2330,0x2430,0x2530, + 0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,0x2610,0x2710, + 0x2810,0x2910,0x3030,0x3130,0x3230,0x3330,0x3430,0x3530, + 0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,0x3610,0x3710, + 0x3810,0x3910,0x4030,0x4130,0x4230,0x4330,0x4430,0x4530, + 0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,0x4610,0x4710, + 0x4810,0x4910,0x5030,0x5130,0x5230,0x5330,0x5430,0x5530, + 0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,0x5610,0x5710, + 0x5810,0x5910,0x6030,0x6130,0x6230,0x6330,0x6430,0x6530, + 0x0600,0x0700,0x0800,0x0900,0x0A00,0x0B00,0x0C00,0x0D00, + 0x0E00,0x0F00,0x1020,0x1120,0x1220,0x1320,0x1420,0x1520, + 0x1600,0x1700,0x1800,0x1900,0x1A00,0x1B00,0x1C00,0x1D00, + 0x1E00,0x1F00,0x2020,0x2120,0x2220,0x2320,0x2420,0x2520, + 0x2600,0x2700,0x2800,0x2900,0x2A00,0x2B00,0x2C00,0x2D00, + 0x2E00,0x2F00,0x3020,0x3120,0x3220,0x3320,0x3420,0x3520, + 0x3600,0x3700,0x3800,0x3900,0x3A00,0x3B00,0x3C00,0x3D00, + 0x3E00,0x3F00,0x4020,0x4120,0x4220,0x4320,0x4420,0x4520, + 0x4600,0x4700,0x4800,0x4900,0x4A00,0x4B00,0x4C00,0x4D00, + 0x4E00,0x4F00,0x5020,0x5120,0x5220,0x5320,0x5420,0x5520, + 0x5600,0x5700,0x5800,0x5900,0x5A00,0x5B00,0x5C00,0x5D00, + 0x5E00,0x5F00,0x6020,0x6120,0x6220,0x6320,0x6420,0x6520, + 0x6600,0x6700,0x6800,0x6900,0x6A00,0x6B00,0x6C00,0x6D00, + 0x6E00,0x6F00,0x7020,0x7120,0x7220,0x7320,0x7420,0x7520, + 0x7600,0x7700,0x7800,0x7900,0x7A00,0x7B00,0x7C00,0x7D00, + 0x7E00,0x7F00,0x8020,0x8120,0x8220,0x8320,0x8420,0x8520, + 0x8600,0x8700,0x8800,0x8900,0x8A00,0x8B00,0x8C00,0x8D00, + 0x8E00,0x8F00,0x9020,0x9120,0x9220,0x9320,0x9420,0x9520, + 0x9600,0x9700,0x9800,0x9900,0x9A00,0x9B00,0x9C00,0x9D00, + 0x9E00,0x9F00,0x00B0,0x0130,0x0230,0x0330,0x0430,0x0530, + 0x0610,0x0710,0x0810,0x0910,0x0A10,0x0B10,0x0C10,0x0D10, + 0x0E10,0x0F10,0x1030,0x1130,0x1230,0x1330,0x1430,0x1530, + 0x1610,0x1710,0x1810,0x1910,0x1A10,0x1B10,0x1C10,0x1D10, + 0x1E10,0x1F10,0x2030,0x2130,0x2230,0x2330,0x2430,0x2530, + 0x2610,0x2710,0x2810,0x2910,0x2A10,0x2B10,0x2C10,0x2D10, + 0x2E10,0x2F10,0x3030,0x3130,0x3230,0x3330,0x3430,0x3530, + 0x3610,0x3710,0x3810,0x3910,0x3A10,0x3B10,0x3C10,0x3D10, + 0x3E10,0x3F10,0x4030,0x4130,0x4230,0x4330,0x4430,0x4530, + 0x4610,0x4710,0x4810,0x4910,0x4A10,0x4B10,0x4C10,0x4D10, + 0x4E10,0x4F10,0x5030,0x5130,0x5230,0x5330,0x5430,0x5530, + 0x5610,0x5710,0x5810,0x5910,0x5A10,0x5B10,0x5C10,0x5D10, + 0x5E10,0x5F10,0x6030,0x6130,0x6230,0x6330,0x6430,0x6530, + 0x6610,0x6710,0x6810,0x6910,0x6A10,0x6B10,0x6C10,0x6D10, + 0x6E10,0x6F10,0x7030,0x7130,0x7230,0x7330,0x7430,0x7530, + 0x7610,0x7710,0x7810,0x7910,0x7A10,0x7B10,0x7C10,0x7D10, + 0x7E10,0x7F10,0x8030,0x8130,0x8230,0x8330,0x8430,0x8530, + 0x8610,0x8710,0x8810,0x8910,0x8A10,0x8B10,0x8C10,0x8D10, + 0x8E10,0x8F10,0x9030,0x9130,0x9230,0x9330,0x9430,0x9530, + 0x9610,0x9710,0x9810,0x9910,0x9A10,0x9B10,0x9C10,0x9D10, + 0x9E10,0x9F10,0xA030,0xA130,0xA230,0xA330,0xA430,0xA530, + 0xA610,0xA710,0xA810,0xA910,0xAA10,0xAB10,0xAC10,0xAD10, + 0xAE10,0xAF10,0xB030,0xB130,0xB230,0xB330,0xB430,0xB530, + 0xB610,0xB710,0xB810,0xB910,0xBA10,0xBB10,0xBC10,0xBD10, + 0xBE10,0xBF10,0xC030,0xC130,0xC230,0xC330,0xC430,0xC530, + 0xC610,0xC710,0xC810,0xC910,0xCA10,0xCB10,0xCC10,0xCD10, + 0xCE10,0xCF10,0xD030,0xD130,0xD230,0xD330,0xD430,0xD530, + 0xD610,0xD710,0xD810,0xD910,0xDA10,0xDB10,0xDC10,0xDD10, + 0xDE10,0xDF10,0xE030,0xE130,0xE230,0xE330,0xE430,0xE530, + 0xE610,0xE710,0xE810,0xE910,0xEA10,0xEB10,0xEC10,0xED10, + 0xEE10,0xEF10,0xF030,0xF130,0xF230,0xF330,0xF430,0xF530, + 0xF610,0xF710,0xF810,0xF910,0xFA10,0xFB10,0xFC10,0xFD10, + 0xFE10,0xFF10,0x00B0,0x0130,0x0230,0x0330,0x0430,0x0530, + 0x0610,0x0710,0x0810,0x0910,0x0A10,0x0B10,0x0C10,0x0D10, + 0x0E10,0x0F10,0x1030,0x1130,0x1230,0x1330,0x1430,0x1530, + 0x1610,0x1710,0x1810,0x1910,0x1A10,0x1B10,0x1C10,0x1D10, + 0x1E10,0x1F10,0x2030,0x2130,0x2230,0x2330,0x2430,0x2530, + 0x2610,0x2710,0x2810,0x2910,0x2A10,0x2B10,0x2C10,0x2D10, + 0x2E10,0x2F10,0x3030,0x3130,0x3230,0x3330,0x3430,0x3530, + 0x3610,0x3710,0x3810,0x3910,0x3A10,0x3B10,0x3C10,0x3D10, + 0x3E10,0x3F10,0x4030,0x4130,0x4230,0x4330,0x4430,0x4530, + 0x4610,0x4710,0x4810,0x4910,0x4A10,0x4B10,0x4C10,0x4D10, + 0x4E10,0x4F10,0x5030,0x5130,0x5230,0x5330,0x5430,0x5530, + 0x5610,0x5710,0x5810,0x5910,0x5A10,0x5B10,0x5C10,0x5D10, + 0x5E10,0x5F10,0x6030,0x6130,0x6230,0x6330,0x6430,0x6530, + 0x00C0,0x0140,0x0240,0x0340,0x0440,0x0540,0x0640,0x0740, + 0x0840,0x0940,0x0440,0x0540,0x0640,0x0740,0x0840,0x0940, + 0x1040,0x1140,0x1240,0x1340,0x1440,0x1540,0x1640,0x1740, + 0x1840,0x1940,0x1440,0x1540,0x1640,0x1740,0x1840,0x1940, + 0x2040,0x2140,0x2240,0x2340,0x2440,0x2540,0x2640,0x2740, + 0x2840,0x2940,0x2440,0x2540,0x2640,0x2740,0x2840,0x2940, + 0x3040,0x3140,0x3240,0x3340,0x3440,0x3540,0x3640,0x3740, + 0x3840,0x3940,0x3440,0x3540,0x3640,0x3740,0x3840,0x3940, + 0x4040,0x4140,0x4240,0x4340,0x4440,0x4540,0x4640,0x4740, + 0x4840,0x4940,0x4440,0x4540,0x4640,0x4740,0x4840,0x4940, + 0x5040,0x5140,0x5240,0x5340,0x5440,0x5540,0x5640,0x5740, + 0x5840,0x5940,0x5440,0x5540,0x5640,0x5740,0x5840,0x5940, + 0x6040,0x6140,0x6240,0x6340,0x6440,0x6540,0x6640,0x6740, + 0x6840,0x6940,0x6440,0x6540,0x6640,0x6740,0x6840,0x6940, + 0x7040,0x7140,0x7240,0x7340,0x7440,0x7540,0x7640,0x7740, + 0x7840,0x7940,0x7440,0x7540,0x7640,0x7740,0x7840,0x7940, + 0x8040,0x8140,0x8240,0x8340,0x8440,0x8540,0x8640,0x8740, + 0x8840,0x8940,0x8440,0x8540,0x8640,0x8740,0x8840,0x8940, + 0x9040,0x9140,0x9240,0x9340,0x9440,0x9540,0x9640,0x9740, + 0x9840,0x9940,0x3450,0x3550,0x3650,0x3750,0x3850,0x3950, + 0x4050,0x4150,0x4250,0x4350,0x4450,0x4550,0x4650,0x4750, + 0x4850,0x4950,0x4450,0x4550,0x4650,0x4750,0x4850,0x4950, + 0x5050,0x5150,0x5250,0x5350,0x5450,0x5550,0x5650,0x5750, + 0x5850,0x5950,0x5450,0x5550,0x5650,0x5750,0x5850,0x5950, + 0x6050,0x6150,0x6250,0x6350,0x6450,0x6550,0x6650,0x6750, + 0x6850,0x6950,0x6450,0x6550,0x6650,0x6750,0x6850,0x6950, + 0x7050,0x7150,0x7250,0x7350,0x7450,0x7550,0x7650,0x7750, + 0x7850,0x7950,0x7450,0x7550,0x7650,0x7750,0x7850,0x7950, + 0x8050,0x8150,0x8250,0x8350,0x8450,0x8550,0x8650,0x8750, + 0x8850,0x8950,0x8450,0x8550,0x8650,0x8750,0x8850,0x8950, + 0x9050,0x9150,0x9250,0x9350,0x9450,0x9550,0x9650,0x9750, + 0x9850,0x9950,0x9450,0x9550,0x9650,0x9750,0x9850,0x9950, + 0xA050,0xA150,0xA250,0xA350,0xA450,0xA550,0xA650,0xA750, + 0xA850,0xA950,0xA450,0xA550,0xA650,0xA750,0xA850,0xA950, + 0xB050,0xB150,0xB250,0xB350,0xB450,0xB550,0xB650,0xB750, + 0xB850,0xB950,0xB450,0xB550,0xB650,0xB750,0xB850,0xB950, + 0xC050,0xC150,0xC250,0xC350,0xC450,0xC550,0xC650,0xC750, + 0xC850,0xC950,0xC450,0xC550,0xC650,0xC750,0xC850,0xC950, + 0xD050,0xD150,0xD250,0xD350,0xD450,0xD550,0xD650,0xD750, + 0xD850,0xD950,0xD450,0xD550,0xD650,0xD750,0xD850,0xD950, + 0xE050,0xE150,0xE250,0xE350,0xE450,0xE550,0xE650,0xE750, + 0xE850,0xE950,0xE450,0xE550,0xE650,0xE750,0xE850,0xE950, + 0xF050,0xF150,0xF250,0xF350,0xF450,0xF550,0xF650,0xF750, + 0xF850,0xF950,0xF450,0xF550,0xF650,0xF750,0xF850,0xF950, + 0x00D0,0x0150,0x0250,0x0350,0x0450,0x0550,0x0650,0x0750, + 0x0850,0x0950,0x0450,0x0550,0x0650,0x0750,0x0850,0x0950, + 0x1050,0x1150,0x1250,0x1350,0x1450,0x1550,0x1650,0x1750, + 0x1850,0x1950,0x1450,0x1550,0x1650,0x1750,0x1850,0x1950, + 0x2050,0x2150,0x2250,0x2350,0x2450,0x2550,0x2650,0x2750, + 0x2850,0x2950,0x2450,0x2550,0x2650,0x2750,0x2850,0x2950, + 0x3050,0x3150,0x3250,0x3350,0x3450,0x3550,0x3650,0x3750, + 0x3850,0x3950,0x3450,0x3550,0x3650,0x3750,0x3850,0x3950, + 0x4050,0x4150,0x4250,0x4350,0x4450,0x4550,0x4650,0x4750, + 0x4850,0x4950,0x4450,0x4550,0x4650,0x4750,0x4850,0x4950, + 0x5050,0x5150,0x5250,0x5350,0x5450,0x5550,0x5650,0x5750, + 0x5850,0x5950,0x5450,0x5550,0x5650,0x5750,0x5850,0x5950, + 0x6050,0x6150,0x6250,0x6350,0x6450,0x6550,0x6650,0x6750, + 0x6850,0x6950,0x6450,0x6550,0x6650,0x6750,0x6850,0x6950, + 0x7050,0x7150,0x7250,0x7350,0x7450,0x7550,0x7650,0x7750, + 0x7850,0x7950,0x7450,0x7550,0x7650,0x7750,0x7850,0x7950, + 0x8050,0x8150,0x8250,0x8350,0x8450,0x8550,0x8650,0x8750, + 0x8850,0x8950,0x8450,0x8550,0x8650,0x8750,0x8850,0x8950, + 0x9050,0x9150,0x9250,0x9350,0x9450,0x9550,0x9650,0x9750, + 0x9850,0x9950,0x9450,0x9550,0x9650,0x9750,0x9850,0x9950, + 0xFA60,0xFB60,0xFC60,0xFD60,0xFE60,0xFF60,0x00C0,0x0140, + 0x0240,0x0340,0x0440,0x0540,0x0640,0x0740,0x0840,0x0940, + 0x0A60,0x0B60,0x0C60,0x0D60,0x0E60,0x0F60,0x1040,0x1140, + 0x1240,0x1340,0x1440,0x1540,0x1640,0x1740,0x1840,0x1940, + 0x1A60,0x1B60,0x1C60,0x1D60,0x1E60,0x1F60,0x2040,0x2140, + 0x2240,0x2340,0x2440,0x2540,0x2640,0x2740,0x2840,0x2940, + 0x2A60,0x2B60,0x2C60,0x2D60,0x2E60,0x2F60,0x3040,0x3140, + 0x3240,0x3340,0x3440,0x3540,0x3640,0x3740,0x3840,0x3940, + 0x3A60,0x3B60,0x3C60,0x3D60,0x3E60,0x3F60,0x4040,0x4140, + 0x4240,0x4340,0x4440,0x4540,0x4640,0x4740,0x4840,0x4940, + 0x4A60,0x4B60,0x4C60,0x4D60,0x4E60,0x4F60,0x5040,0x5140, + 0x5240,0x5340,0x5440,0x5540,0x5640,0x5740,0x5840,0x5940, + 0x5A60,0x5B60,0x5C60,0x5D60,0x5E60,0x5F60,0x6040,0x6140, + 0x6240,0x6340,0x6440,0x6540,0x6640,0x6740,0x6840,0x6940, + 0x6A60,0x6B60,0x6C60,0x6D60,0x6E60,0x6F60,0x7040,0x7140, + 0x7240,0x7340,0x7440,0x7540,0x7640,0x7740,0x7840,0x7940, + 0x7A60,0x7B60,0x7C60,0x7D60,0x7E60,0x7F60,0x8040,0x8140, + 0x8240,0x8340,0x8440,0x8540,0x8640,0x8740,0x8840,0x8940, + 0x8A60,0x8B60,0x8C60,0x8D60,0x8E60,0x8F60,0x9040,0x9140, + 0x9240,0x9340,0x3450,0x3550,0x3650,0x3750,0x3850,0x3950, + 0x3A70,0x3B70,0x3C70,0x3D70,0x3E70,0x3F70,0x4050,0x4150, + 0x4250,0x4350,0x4450,0x4550,0x4650,0x4750,0x4850,0x4950, + 0x4A70,0x4B70,0x4C70,0x4D70,0x4E70,0x4F70,0x5050,0x5150, + 0x5250,0x5350,0x5450,0x5550,0x5650,0x5750,0x5850,0x5950, + 0x5A70,0x5B70,0x5C70,0x5D70,0x5E70,0x5F70,0x6050,0x6150, + 0x6250,0x6350,0x6450,0x6550,0x6650,0x6750,0x6850,0x6950, + 0x6A70,0x6B70,0x6C70,0x6D70,0x6E70,0x6F70,0x7050,0x7150, + 0x7250,0x7350,0x7450,0x7550,0x7650,0x7750,0x7850,0x7950, + 0x7A70,0x7B70,0x7C70,0x7D70,0x7E70,0x7F70,0x8050,0x8150, + 0x8250,0x8350,0x8450,0x8550,0x8650,0x8750,0x8850,0x8950, + 0x8A70,0x8B70,0x8C70,0x8D70,0x8E70,0x8F70,0x9050,0x9150, + 0x9250,0x9350,0x9450,0x9550,0x9650,0x9750,0x9850,0x9950, + 0x9A70,0x9B70,0x9C70,0x9D70,0x9E70,0x9F70,0xA050,0xA150, + 0xA250,0xA350,0xA450,0xA550,0xA650,0xA750,0xA850,0xA950, + 0xAA70,0xAB70,0xAC70,0xAD70,0xAE70,0xAF70,0xB050,0xB150, + 0xB250,0xB350,0xB450,0xB550,0xB650,0xB750,0xB850,0xB950, + 0xBA70,0xBB70,0xBC70,0xBD70,0xBE70,0xBF70,0xC050,0xC150, + 0xC250,0xC350,0xC450,0xC550,0xC650,0xC750,0xC850,0xC950, + 0xCA70,0xCB70,0xCC70,0xCD70,0xCE70,0xCF70,0xD050,0xD150, + 0xD250,0xD350,0xD450,0xD550,0xD650,0xD750,0xD850,0xD950, + 0xDA70,0xDB70,0xDC70,0xDD70,0xDE70,0xDF70,0xE050,0xE150, + 0xE250,0xE350,0xE450,0xE550,0xE650,0xE750,0xE850,0xE950, + 0xEA70,0xEB70,0xEC70,0xED70,0xEE70,0xEF70,0xF050,0xF150, + 0xF250,0xF350,0xF450,0xF550,0xF650,0xF750,0xF850,0xF950, + 0xFA70,0xFB70,0xFC70,0xFD70,0xFE70,0xFF70,0x00D0,0x0150, + 0x0250,0x0350,0x0450,0x0550,0x0650,0x0750,0x0850,0x0950, + 0x0A70,0x0B70,0x0C70,0x0D70,0x0E70,0x0F70,0x1050,0x1150, + 0x1250,0x1350,0x1450,0x1550,0x1650,0x1750,0x1850,0x1950, + 0x1A70,0x1B70,0x1C70,0x1D70,0x1E70,0x1F70,0x2050,0x2150, + 0x2250,0x2350,0x2450,0x2550,0x2650,0x2750,0x2850,0x2950, + 0x2A70,0x2B70,0x2C70,0x2D70,0x2E70,0x2F70,0x3050,0x3150, + 0x3250,0x3350,0x3450,0x3550,0x3650,0x3750,0x3850,0x3950, + 0x3A70,0x3B70,0x3C70,0x3D70,0x3E70,0x3F70,0x4050,0x4150, + 0x4250,0x4350,0x4450,0x4550,0x4650,0x4750,0x4850,0x4950, + 0x4A70,0x4B70,0x4C70,0x4D70,0x4E70,0x4F70,0x5050,0x5150, + 0x5250,0x5350,0x5450,0x5550,0x5650,0x5750,0x5850,0x5950, + 0x5A70,0x5B70,0x5C70,0x5D70,0x5E70,0x5F70,0x6050,0x6150, + 0x6250,0x6350,0x6450,0x6550,0x6650,0x6750,0x6850,0x6950, + 0x6A70,0x6B70,0x6C70,0x6D70,0x6E70,0x6F70,0x7050,0x7150, + 0x7250,0x7350,0x7450,0x7550,0x7650,0x7750,0x7850,0x7950, + 0x7A70,0x7B70,0x7C70,0x7D70,0x7E70,0x7F70,0x8050,0x8150, + 0x8250,0x8350,0x8450,0x8550,0x8650,0x8750,0x8850,0x8950, + 0x8A70,0x8B70,0x8C70,0x8D70,0x8E70,0x8F70,0x9050,0x9150, + 0x9250,0x9350,0x9450,0x9550,0x9650,0x9750,0x9850,0x9950, +}; + +u8 ZeroTable[] = +{ + 0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0 +}; + +#define GBSAVE_GAME_VERSION_1 1 +#define GBSAVE_GAME_VERSION_2 2 +#define GBSAVE_GAME_VERSION_3 3 +#define GBSAVE_GAME_VERSION_4 4 +#define GBSAVE_GAME_VERSION_5 5 +#define GBSAVE_GAME_VERSION_6 6 +#define GBSAVE_GAME_VERSION_7 7 +#define GBSAVE_GAME_VERSION_8 8 +#define GBSAVE_GAME_VERSION_9 9 +#define GBSAVE_GAME_VERSION_10 10 +#define GBSAVE_GAME_VERSION_11 11 +#define GBSAVE_GAME_VERSION_12 12 +#define GBSAVE_GAME_VERSION GBSAVE_GAME_VERSION_12 + +int inline gbGetValue(int min,int max,int v) +{ + return (int)(min+(float)(max-min)*(2.0*(v/31.0)-(v/31.0)*(v/31.0))); +} + +void gbGenFilter() +{ + for (int r=0;r<32;r++) + { + for (int g=0;g<32;g++) + { + for (int b=0;b<32;b++) + { + int nr=gbGetValue(gbGetValue(4,14,g), + gbGetValue(24,29,g),r)-4; + int ng=gbGetValue(gbGetValue(4+gbGetValue(0,5,r), + 14+gbGetValue(0,3,r),b), + gbGetValue(24+gbGetValue(0,3,r), + 29+gbGetValue(0,1,r),b),g)-4; + int nb=gbGetValue(gbGetValue(4+gbGetValue(0,5,r), + 14+gbGetValue(0,3,r),g), + gbGetValue(24+gbGetValue(0,3,r), + 29+gbGetValue(0,1,r),g),b)-4; + gbColorFilter[(b<<10)|(g<<5)|r]=(nb<<10)|(ng<<5)|nr; + } + } + } +} + +bool gbIsGameboyRom(char * file) +{ + if(strlen(file) > 4) + { + char * p = strrchr(file,'.'); + + if(p != NULL) + { + if(_stricmp(p, ".gb") == 0) + return true; + if(_stricmp(p, ".gbc") == 0) + return true; + if(_stricmp(p, ".cgb") == 0) + return true; + if(_stricmp(p, ".sgb") == 0) + return true; + } + } + + return false; +} + +void gbCopyMemory(u16 d, u16 s, int count) +{ + while(count) + { + gbMemoryMap[d>>12][d & 0x0fff] = gbMemoryMap[s>>12][s & 0x0fff]; + s++; + d++; + count--; + } +} + +void gbDoHdma() +{ + gbCopyMemory(gbHdmaDestination, + gbHdmaSource, + 0x10); + + gbHdmaDestination += 0x10; + gbHdmaSource += 0x10; + + register_HDMA2 += 0x10; + if(register_HDMA2 == 0x00) + register_HDMA1++; + + register_HDMA4 += 0x10; + if(register_HDMA4 == 0x00) + register_HDMA3++; + + if(gbHdmaDestination == 0x96b0) + gbHdmaBytes = gbHdmaBytes; + gbHdmaBytes -= 0x10; + register_HDMA5--; + if(register_HDMA5 == 0xff) + gbHdmaOn = 0; +} + +// fix for Harley and Lego Racers +void gbCompareLYToLYC() +{ + if(register_LY == register_LYC) + { + // mark that we have a match + register_STAT |= 4; + + // check if we need an interrupt + if((register_STAT & 0x40) && (register_IE & 2)) + gbInterrupt |= 2; + } else // no match + register_STAT &= 0xfb; +} + +void gbWriteMemory(register u16 address, register u8 value) +{ + if(address < 0x8000) + { +#ifndef FINAL_VERSION + if(memorydebug && (address>0x3fff || address < 0x2000)) + { + log("Memory register write %04x=%02x PC=%04x\n", + address, + value, + PC.W); + } +#endif + if(mapper) + (*mapper)(address, value); + return; + } + + if(address < 0xa000) + { + gbMemoryMap[address>>12][address&0x0fff] = value; + return; + } + + if(address < 0xc000) + { +#ifndef FINAL_VERSION + if(memorydebug) + { + log("Memory register write %04x=%02x PC=%04x\n", + address, + value, + PC.W); + } +#endif + + if(mapper) + (*mapperRAM)(address, value); + return; + } + + if(address < 0xfe00) + { + gbMemoryMap[address>>12][address & 0x0fff] = value; + return; + } + + if(address < 0xff00) + { + gbMemory[address] = value; + return; + } + + switch(address & 0x00ff) + { + case 0x00: + { + gbMemory[0xff00] = ((gbMemory[0xff00] & 0xcf) | + (value & 0x30)); + if(gbSgbMode) + { + gbSgbDoBitTransfer(value); + } + + return; + } + + case 0x01: + { + gbMemory[0xff01] = value; + return; + } + + // serial control + case 0x02: + { + gbSerialOn = (value & 0x80); + gbMemory[0xff02] = value; + if(gbSerialOn) + { + gbSerialTicks = GBSERIAL_CLOCK_TICKS; +#ifdef LINK_EMULATION + if(linkConnected) + { + if(value & 1) + { + linkSendByte(0x100|gbMemory[0xFF01]); + Sleep(5); + } + } +#endif + } + + gbSerialBits = 0; + return; + } + + // DIV register resets on any write + case 0x04: + { + register_DIV = 0; + return; + } + case 0x05: + register_TIMA = value; + return; + + case 0x06: + register_TMA = value; + return; + + // TIMER control + case 0x07: + { + register_TAC = value; + + gbTimerOn = (value & 4); + gbTimerMode = value & 3; + // register_TIMA = register_TMA; + switch(gbTimerMode) + { + case 0: + gbTimerClockTicks = gbTimerTicks = GBTIMER_MODE_0_CLOCK_TICKS; + break; + case 1: + gbTimerClockTicks = gbTimerTicks = GBTIMER_MODE_1_CLOCK_TICKS; + break; + case 2: + gbTimerClockTicks = gbTimerTicks = GBTIMER_MODE_2_CLOCK_TICKS; + break; + case 3: + gbTimerClockTicks = gbTimerTicks = GBTIMER_MODE_3_CLOCK_TICKS; + break; + } + return; + } + + case 0x0f: + { + register_IF = value; + gbInterrupt = value; + return; + } + + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + case 0x1c: + case 0x1d: + case 0x1e: + case 0x1f: + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + { + SOUND_EVENT(address,value); + return; + } + case 0x40: + { + int lcdChange = (register_LCDC & 0x80) ^ (value & 0x80); + + if(lcdChange) + { + if(value & 0x80) + { + gbLcdTicks = GBLCD_MODE_1_CLOCK_TICKS; + gbLcdMode = 0; + register_STAT &= 0xfc; + register_LY = 0x00; + } else + { + gbLcdTicks = 0; + gbLcdMode = 0; + register_STAT &= 0xfc; + register_LY = 0x00; + } + // compareLYToLYC(); + } + // don't draw the window if it was not enabled and not being drawn before + if(!(register_LCDC & 0x20) && (value & 0x20) && gbWindowLine == -1 && + register_LY > register_WY) + gbWindowLine = 144; + + register_LCDC = value; + + return; + } + + // STAT + case 0x41: + { + //register_STAT = (register_STAT & 0x87) | + // (value & 0x7c); + register_STAT = (value & 0xf8) | (register_STAT & 0x07); // fix ? + // GB bug from Devrs FAQ + if(!gbCgbMode && (register_LCDC & 0x80) && gbLcdMode < 2) + gbInterrupt |= 2; + return; + } + + // SCY + case 0x42: + { + register_SCY = value; + return; + } + + // SCX + case 0x43: + { + register_SCX = value; + return; + } + + // LY + case 0x44: + { + // read only + return; + } + + // LYC + case 0x45: + { + register_LYC = value; + if((register_LCDC & 0x80)) + { + gbCompareLYToLYC(); + } + return; + } + + // DMA! + case 0x46: + { + int source = value * 0x0100; + + gbCopyMemory(0xfe00, + source, + 0xa0); + register_DMA = value; + return; + } + + // BGP + case 0x47: + { + gbBgp[0] = value & 0x03; + gbBgp[1] = (value & 0x0c)>>2; + gbBgp[2] = (value & 0x30)>>4; + gbBgp[3] = (value & 0xc0)>>6; + break; + } + + // OBP0 + case 0x48: + { + gbObp0[0] = value & 0x03; + gbObp0[1] = (value & 0x0c)>>2; + gbObp0[2] = (value & 0x30)>>4; + gbObp0[3] = (value & 0xc0)>>6; + break; + } + + // OBP1 + case 0x49: + { + gbObp1[0] = value & 0x03; + gbObp1[1] = (value & 0x0c)>>2; + gbObp1[2] = (value & 0x30)>>4; + gbObp1[3] = (value & 0xc0)>>6; + break; + } + + case 0x4a: + register_WY = value; + return; + + case 0x4b: + register_WX = value; + return; + + // KEY1 + case 0x4d: + { + if(gbCgbMode) + { + gbMemory[0xff4d] = (gbMemory[0xff4d] & 0x80) | (value & 1); + return; + } + } + break; + + // VBK + case 0x4f: + { + if(gbCgbMode) + { + value = value & 1; + if(value == gbVramBank) + return; + + int vramAddress = value * 0x2000; + gbMemoryMap[0x08] = &gbVram[vramAddress]; + gbMemoryMap[0x09] = &gbVram[vramAddress + 0x1000]; + + gbVramBank = value; + register_VBK = value; + } + return; + } + break; + + // HDMA1 + case 0x51: + { + if(gbCgbMode) + { + if(value > 0x7f && value < 0xa0) + value = 0; + + gbHdmaSource = (value << 8) | (register_HDMA2 & 0xf0); + + register_HDMA1 = value; + return; + } + } + break; + + // HDMA2 + case 0x52: + { + if(gbCgbMode) + { + value = value & 0xf0; + + gbHdmaSource = (register_HDMA1 << 8) | (value); + + register_HDMA2 = value; + return; + } + } + break; + + // HDMA3 + case 0x53: + { + if(gbCgbMode) + { + value = value & 0x1f; + gbHdmaDestination = (value << 8) | (register_HDMA4 & 0xf0); + gbHdmaDestination += 0x8000; + register_HDMA3 = value; + return; + } + } + break; + + // HDMA4 + case 0x54: + { + if(gbCgbMode) + { + value = value & 0xf0; + gbHdmaDestination = ((register_HDMA3 & 0x1f) << 8) | value; + gbHdmaDestination += 0x8000; + register_HDMA4 = value; + return; + } + } + break; + + // HDMA5 + case 0x55: + { + if(gbCgbMode) + { + gbHdmaBytes = 16 + (value & 0x7f) * 16; + if(gbHdmaOn) + { + if(value & 0x80) + { + register_HDMA5 = (value & 0x7f); + } else + { + register_HDMA5 = 0xff; + gbHdmaOn = 0; + } + } else + { + if(value & 0x80) + { + gbHdmaOn = 1; + register_HDMA5 = value & 0x7f; + if(gbLcdMode == 0) + gbDoHdma(); + } else + { + // we need to take the time it takes to complete the transfer into + // account... according to GB DEV FAQs, the setup time is the same + // for single and double speed, but the actual transfer takes the + // same time // (is that a typo?) + switch(gbDMASpeedVersion) + { + case 1: // I believe this is more correct + // the lower 7 bits of FF55 specify the Transfer Length (divided by 16, minus 1) + // and we make gbDmaTicks twice as many cycles at double speed to make the transfer take the same time + if(gbSpeed) + gbDmaTicks = 16 * ((value & 0x7f) + 1); + else + gbDmaTicks = 8 * ((value & 0x7f) + 1); + break; + case 0: // here for backward compatibility + // I think this was a guess that approximates the above in most but not all games + if(gbSpeed) + gbDmaTicks = 231 + 16 * (value & 0x7f); + else + gbDmaTicks = 231 + 8 * (value & 0x7f); + break; + default: // shouldn't happen + //assert(0); + break; + } + gbCopyMemory(gbHdmaDestination, + gbHdmaSource, + gbHdmaBytes); + gbHdmaDestination += gbHdmaBytes; + gbHdmaSource += gbHdmaBytes; + + register_HDMA3 = ((gbHdmaDestination - 0x8000) >> 8) & 0x1f; + register_HDMA4 = gbHdmaDestination & 0xf0; + register_HDMA1 = (gbHdmaSource >> 8) & 0xff; + register_HDMA2 = gbHdmaSource & 0xf0; + } + } + return; + } + } + break; + + // BCPS + case 0x68: + { + if(gbCgbMode) + { + int paletteIndex = (value & 0x3f) >> 1; + int paletteHiLo = (value & 0x01); + + gbMemory[0xff68] = value; + gbMemory[0xff69] = (paletteHiLo ? + (gbPalette[paletteIndex] >> 8) : + (gbPalette[paletteIndex] & 0x00ff)); + return; + } + } + break; + + // BCPD + case 0x69: + { + if(gbCgbMode) + { + int v = gbMemory[0xff68]; + int paletteIndex = (v & 0x3f) >> 1; + int paletteHiLo = (v & 0x01); + gbMemory[0xff69] = value; + gbPalette[paletteIndex] = (paletteHiLo ? + ((value << 8) | (gbPalette[paletteIndex] & 0xff)) : + ((gbPalette[paletteIndex] & 0xff00) | (value))) & 0x7fff; + + if(gbMemory[0xff68] & 0x80) + { + int index = ((gbMemory[0xff68] & 0x3f) + 1) & 0x3f; + + gbMemory[0xff68] = (gbMemory[0xff68] & 0x80) | index; + + gbMemory[0xff69] = (index & 1 ? + (gbPalette[index>>1] >> 8) : + (gbPalette[index>>1] & 0x00ff)); + + } + return; + } + } + break; + + // OCPS + case 0x6a: + { + if(gbCgbMode) + { + int paletteIndex = (value & 0x3f) >> 1; + int paletteHiLo = (value & 0x01); + + paletteIndex += 32; + + gbMemory[0xff6a] = value; + gbMemory[0xff6b] = (paletteHiLo ? + (gbPalette[paletteIndex] >> 8) : + (gbPalette[paletteIndex] & 0x00ff)); + return; + } + } + break; + + // OCPD + case 0x6b: + { + if(gbCgbMode) + { + int v = gbMemory[0xff6a]; + int paletteIndex = (v & 0x3f) >> 1; + int paletteHiLo = (v & 0x01); + + paletteIndex += 32; + + gbMemory[0xff6b] = value; + gbPalette[paletteIndex] = (paletteHiLo ? + ((value << 8) | (gbPalette[paletteIndex] & 0xff)) : + ((gbPalette[paletteIndex] & 0xff00) | (value))) & 0x7fff; + if(gbMemory[0xff6a] & 0x80) + { + int index = ((gbMemory[0xff6a] & 0x3f) + 1) & 0x3f; + + gbMemory[0xff6a] = (gbMemory[0xff6a] & 0x80) | index; + + gbMemory[0xff6b] = (index & 1 ? + (gbPalette[(index>>1) + 32] >> 8) : + (gbPalette[(index>>1) + 32] & 0x00ff)); + + } + return; + } + } + break; + + // SVBK + case 0x70: + { + if(gbCgbMode) + { + value = value & 7; + + int bank = value; + if(value == 0) + bank = 1; + + if(bank == gbWramBank) + return; + + int wramAddress = bank * 0x1000; + gbMemoryMap[0x0d] = &gbWram[wramAddress]; + + gbWramBank = bank; + register_SVBK = value; + return; + } + } + break; + + case 0xff: + { + register_IE = value; + register_IF &= value; + return; + } + } + + gbMemory[address] = value; +} + +u8 gbReadOpcode(register u16 address) +{ + if(gbCheatMap[address]) + return gbCheatRead(address); + + switch(address & 0xf000) + { + case 0x0a: + case 0x0b: + if(mapperReadRAM) + return mapperReadRAM(address); + break; + case 0x0f: + if(address > 0xff00) + { + switch(address & 0x00ff) + { + case 0x04: + return register_DIV; + case 0x05: + return register_TIMA; + case 0x06: + return register_TMA; + case 0x07: + return (0xf8 | register_TAC); + case 0x0f: + return (0xe0 | register_IF); + case 0x40: + return register_LCDC; + case 0x41: + return (0x80 | register_STAT); + case 0x42: + return register_SCY; + case 0x43: + return register_SCX; + case 0x44: + return register_LY; + case 0x45: + return register_LYC; + case 0x46: + return register_DMA; + case 0x4a: + return register_WY; + case 0x4b: + return register_WX; + case 0x4f: + return (0xfe | register_VBK); + case 0x51: + return register_HDMA1; + case 0x52: + return register_HDMA2; + case 0x53: + return register_HDMA3; + case 0x54: + return register_HDMA4; + case 0x55: + return register_HDMA5; + case 0x70: + return (0xf8 | register_SVBK); + case 0xff: + return register_IE; + } + } + break; + } + return gbMemoryMap[address>>12][address & 0x0fff]; +} + +u8 gbReadMemory(register u16 address) +{ + if(gbCheatMap[address]) + return gbCheatRead(address); + + if(address < 0xa000) + return gbMemoryMap[address>>12][address&0x0fff]; + + if(address < 0xc000) + { +#ifndef FINAL_VERSION + if(memorydebug) + { + log("Memory register read %04x PC=%04x\n", + address, + PC.W); + } +#endif + + if(mapperReadRAM) + return mapperReadRAM(address); + return gbMemoryMap[address>>12][address & 0x0fff]; + } + + if(address >= 0xff00) + { + switch(address & 0x00ff) + { + case 0x00: + { + if(gbSgbMode) + { + gbSgbReadingController |= 4; + gbSgbResetPacketState(); + } + + int b = gbMemory[0xff00]; + + if((b & 0x30) == 0x20) + { + b &= 0xf0; + + int joy = 0; + if(gbSgbMode && gbSgbMultiplayer) + { + switch(gbSgbNextController) + { + case 0x0f: + joy = 0; + break; + case 0x0e: + joy = 1; + break; + case 0x0d: + joy = 2; + break; + case 0x0c: + joy = 3; + break; + default: + joy = 0; + } + } + int joystate = gbJoymask[joy]; + if(!(joystate & 128)) + b |= 0x08; + if(!(joystate & 64)) + b |= 0x04; + if(!(joystate & 32)) + b |= 0x02; + if(!(joystate & 16)) + b |= 0x01; + + gbMemory[0xff00] = b; + } else if((b & 0x30) == 0x10) + { + b &= 0xf0; + + int joy = 0; + if(gbSgbMode && gbSgbMultiplayer) + { + switch(gbSgbNextController) + { + case 0x0f: + joy = 0; + break; + case 0x0e: + joy = 1; + break; + case 0x0d: + joy = 2; + break; + case 0x0c: + joy = 3; + break; + default: + joy = 0; + } + } + int joystate = gbJoymask[joy]; + if(!(joystate & 8)) + b |= 0x08; + if(!(joystate & 4)) + b |= 0x04; + if(!(joystate & 2)) + b |= 0x02; + if(!(joystate & 1)) + b |= 0x01; + + gbMemory[0xff00] = b; + } else + { + if(gbSgbMode && gbSgbMultiplayer) + { + gbMemory[0xff00] = 0xf0 | gbSgbNextController; + } else + { + gbMemory[0xff00] = 0xff; + } + } + } + return gbMemory[0xff00]; + break; + case 0x01: + return gbMemory[0xff01]; + case 0x04: + return register_DIV; + case 0x05: + return register_TIMA; + case 0x06: + return register_TMA; + case 0x07: + return (0xf8 | register_TAC); + case 0x0f: + return (0xe0 | register_IF); + case 0x40: + return register_LCDC; + case 0x41: + return (0x80 | register_STAT); + case 0x42: + return register_SCY; + case 0x43: + return register_SCX; + case 0x44: + return register_LY; + case 0x45: + return register_LYC; + case 0x46: + return register_DMA; + case 0x4a: + return register_WY; + case 0x4b: + return register_WX; + case 0x4f: + return (0xfe | register_VBK); + case 0x51: + return register_HDMA1; + case 0x52: + return register_HDMA2; + case 0x53: + return register_HDMA3; + case 0x54: + return register_HDMA4; + case 0x55: + return register_HDMA5; + case 0x70: + return (0xf8 | register_SVBK); + case 0xff: + return register_IE; + } + } + + return gbMemoryMap[address>>12][address & 0x0fff]; +} + +void gbVblank_interrupt() +{ + if(IFF & 0x80) + { + PC.W++; + IFF &= 0x7f; + } + gbInterrupt &= 0xfe; + + IFF &= 0x7e; + register_IF &= 0xfe; + + gbWriteMemory(--SP.W, PC.B.B1); + gbWriteMemory(--SP.W, PC.B.B0); + PC.W = 0x40; +} + +void gbLcd_interrupt() +{ + if(IFF & 0x80) + { + PC.W++; + IFF &= 0x7f; + } + gbInterrupt &= 0xfd; + IFF &= 0x7e; + register_IF &= 0xfd; + + gbWriteMemory(--SP.W, PC.B.B1); + gbWriteMemory(--SP.W, PC.B.B0); + + PC.W = 0x48; +} + +void gbTimer_interrupt() +{ + if(IFF & 0x80) + { + PC.W++; + IFF &= 0x7f; + } + IFF &= 0x7e; + gbInterrupt &= 0xfb; + register_IF &= 0xfb; + + gbWriteMemory(--SP.W, PC.B.B1); + gbWriteMemory(--SP.W, PC.B.B0); + + PC.W = 0x50; +} + +void gbSerial_interrupt() +{ + if(IFF & 0x80) + { + PC.W++; + IFF &= 0x7f; + } + IFF &= 0x7e; + gbInterrupt &= 0xf7; + register_IF &= 0xf7; + + gbWriteMemory(--SP.W, PC.B.B1); + gbWriteMemory(--SP.W, PC.B.B0); + + PC.W = 0x58; +} + +void gbJoypad_interrupt() +{ + if(IFF & 0x80) + { + PC.W++; + IFF &= 0x7f; + } + IFF &= 0x7e; + gbInterrupt &= 0xef; + register_IF &= 0xef; + + gbWriteMemory(--SP.W, PC.B.B1); + gbWriteMemory(--SP.W, PC.B.B0); + + PC.W = 0x60; +} + +void gbSpeedSwitch() +{ + if(gbSpeed == 0) + { + gbSpeed = 1; + GBLCD_MODE_0_CLOCK_TICKS = 51 * 2; //127; //51 * 2; + GBLCD_MODE_1_CLOCK_TICKS = 1140 * 2; + GBLCD_MODE_2_CLOCK_TICKS = 20 * 2; //52; //20 * 2; + GBLCD_MODE_3_CLOCK_TICKS = 43 * 2; //99; //43 * 2; + GBDIV_CLOCK_TICKS = 64 * 2; + GBLY_INCREMENT_CLOCK_TICKS = 114 * 2; + GBTIMER_MODE_0_CLOCK_TICKS = 256; //256*2; + GBTIMER_MODE_1_CLOCK_TICKS = 4; //4*2; + GBTIMER_MODE_2_CLOCK_TICKS = 16; //16*2; + GBTIMER_MODE_3_CLOCK_TICKS = 64; //64*2; + GBSERIAL_CLOCK_TICKS = 128 * 2; + gbDivTicks *= 2; + gbLcdTicks *= 2; + gbLcdLYIncrementTicks *= 2; + // timerTicks *= 2; + // timerClockTicks *= 2; + gbSerialTicks *= 2; + SOUND_CLOCK_TICKS = soundQuality * 24 * 2; + soundTicks *= 2; + // synchronizeTicks *= 2; + // SYNCHRONIZE_CLOCK_TICKS *= 2; + } else + { + gbSpeed = 0; + GBLCD_MODE_0_CLOCK_TICKS = 51; + GBLCD_MODE_1_CLOCK_TICKS = 1140; + GBLCD_MODE_2_CLOCK_TICKS = 20; + GBLCD_MODE_3_CLOCK_TICKS = 43; + GBDIV_CLOCK_TICKS = 64; + GBLY_INCREMENT_CLOCK_TICKS = 114; + GBTIMER_MODE_0_CLOCK_TICKS = 256; + GBTIMER_MODE_1_CLOCK_TICKS = 4; + GBTIMER_MODE_2_CLOCK_TICKS = 16; + GBTIMER_MODE_3_CLOCK_TICKS = 64; + GBSERIAL_CLOCK_TICKS = 128; + gbDivTicks /= 2; + gbLcdTicks /= 2; + gbLcdLYIncrementTicks /= 2; + // timerTicks /= 2; + // timerClockTicks /= 2; + gbSerialTicks /= 2; + SOUND_CLOCK_TICKS = soundQuality * 24; + soundTicks /= 2; + // synchronizeTicks /= 2; + // SYNCHRONIZE_CLOCK_TICKS /= 2; + } +} + +void gbReset() +{ +#if (defined(WIN32) && !defined(SDL)) + theApp.globalFrameCount = 0; +#endif + VBAMovieSignalReset(); + + SP.W = 0xfffe; + AF.W = 0x01b0; + BC.W = 0x0013; + DE.W = 0x00d8; + HL.W = 0x014d; + PC.W = 0x0100; + IFF = 0; + gbInterrupt = 1; + gbInterruptWait = 0; + + register_DIV = 0; + register_TIMA = 0; + register_TMA = 0; + register_TAC = 0; + register_IF = 1; + register_LCDC = 0x91; + register_STAT = 0; + register_SCY = 0; + register_SCX = 0; + register_LY = 0; + register_LYC = 0; + register_DMA = 0; + register_WY = 0; + register_WX = 0; + register_VBK = 0; + register_HDMA1 = 0; + register_HDMA2 = 0; + register_HDMA3 = 0; + register_HDMA4 = 0; + register_HDMA5 = 0; + register_SVBK = 0; + register_IE = 0; + + if(gbCgbMode) + { + if(gbSgbMode) + { + if(gbEmulatorType == 5) + AF.W = 0xffb0; + else + AF.W = 0x01b0; + BC.W = 0x0013; + DE.W = 0x00d8; + HL.W = 0x014d; + for(int i = 0; i < 8; i++) + gbPalette[i] = systemGbPalette[gbPaletteOption*8+i]; + } else + { + AF.W = 0x11b0; + BC.W = 0x0000; + DE.W = 0xff56; + HL.W = 0x000d; + } + if(gbEmulatorType == 4) + BC.B.B1 |= 0x01; + + register_HDMA5 = 0xff; + gbMemory[0xff68] = 0xc0; + gbMemory[0xff6a] = 0xc0; + } else + { + for(int i = 0; i < 8; i++) + gbPalette[i] = systemGbPalette[gbPaletteOption*8+i]; + } + + if(gbSpeed) + { + gbSpeedSwitch(); + gbMemory[0xff4d] = 0; + } + + gbDivTicks = GBDIV_CLOCK_TICKS; + gbLcdMode = 2; + gbLcdTicks = GBLCD_MODE_2_CLOCK_TICKS; + gbLcdLYIncrementTicks = 0; + gbTimerTicks = 0; + gbTimerClockTicks = 0; + gbSerialTicks = 0; + gbSerialBits = 0; + gbSerialOn = 0; + gbWindowLine = -1; + gbTimerOn = 0; + gbTimerMode = 0; + // gbSynchronizeTicks = GBSYNCHRONIZE_CLOCK_TICKS; + gbSpeed = 0; + gbJoymask[0] = gbJoymask[1] = gbJoymask[2] = gbJoymask[3] = 0; + + if(gbCgbMode) + { + gbSpeed = 0; + gbHdmaOn = 0; + gbHdmaSource = 0x0000; + gbHdmaDestination = 0x8000; + gbVramBank = 0; + gbWramBank = 1; + register_LY = 0x90; + gbLcdMode = 1; + for(int i = 0; i < 64; i++) + gbPalette[i] = 0x7fff; + } + + if(gbSgbMode) + { + gbSgbReset(); + } + + for(int i =0; i < 4; i++) + gbBgp[i] = gbObp0[i] = gbObp1[i] = i; + + memset(&gbDataMBC1,0, sizeof(gbDataMBC1)); + gbDataMBC1.mapperROMBank = 1; + + gbDataMBC2.mapperRAMEnable = 0; + gbDataMBC2.mapperROMBank = 1; + + memset(&gbDataMBC3,0, 6 * sizeof(int)); + gbDataMBC3.mapperROMBank = 1; + + memset(&gbDataMBC5, 0, sizeof(gbDataMBC5)); + gbDataMBC5.mapperROMBank = 1; + + memset(&gbDataHuC1, 0, sizeof(gbDataHuC1)); + gbDataHuC1.mapperROMBank = 1; + + memset(&gbDataHuC3, 0, sizeof(gbDataHuC3)); + gbDataHuC3.mapperROMBank = 1; + + gbMemoryMap[0x00] = &gbRom[0x0000]; + gbMemoryMap[0x01] = &gbRom[0x1000]; + gbMemoryMap[0x02] = &gbRom[0x2000]; + gbMemoryMap[0x03] = &gbRom[0x3000]; + gbMemoryMap[0x04] = &gbRom[0x4000]; + gbMemoryMap[0x05] = &gbRom[0x5000]; + gbMemoryMap[0x06] = &gbRom[0x6000]; + gbMemoryMap[0x07] = &gbRom[0x7000]; + if(gbCgbMode) + { + gbMemoryMap[0x08] = &gbVram[0x0000]; + gbMemoryMap[0x09] = &gbVram[0x1000]; + gbMemoryMap[0x0a] = &gbMemory[0xa000]; + gbMemoryMap[0x0b] = &gbMemory[0xb000]; + gbMemoryMap[0x0c] = &gbMemory[0xc000]; + gbMemoryMap[0x0d] = &gbWram[0x1000]; + gbMemoryMap[0x0e] = &gbMemory[0xe000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; + } else + { + gbMemoryMap[0x08] = &gbMemory[0x8000]; + gbMemoryMap[0x09] = &gbMemory[0x9000]; + gbMemoryMap[0x0a] = &gbMemory[0xa000]; + gbMemoryMap[0x0b] = &gbMemory[0xb000]; + gbMemoryMap[0x0c] = &gbMemory[0xc000]; + gbMemoryMap[0x0d] = &gbMemory[0xd000]; + gbMemoryMap[0x0e] = &gbMemory[0xe000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; + } + + if(gbRam) + { + gbMemoryMap[0x0a] = &gbRam[0x0000]; + gbMemoryMap[0x0b] = &gbRam[0x1000]; + } + + gbSoundReset(); + +#if (defined(WIN32) && !defined(SDL)) + theApp.sensorX = theApp.sensorY = 2047; +#else + extern int sensorX, sensorY; // from SDL.cpp + sensorX = sensorY = 2047; +#endif + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + gbLastTime = systemGetClock(); + gbFrameCount = 0; +} + +void gbWriteSaveMBC1(const char * name) +{ + FILE *gzFile = fopen(name,"wb"); + + if(gzFile == NULL) + { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); + return; + } + + fwrite(gbRam, + 1, + gbRamSize, + gzFile); + + fclose(gzFile); +} + +void gbWriteSaveMBC2(const char * name) +{ + FILE *file = fopen(name, "wb"); + + if(file == NULL) + { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); + return; + } + + fwrite(&gbMemory[0xa000], + 1, + 256, + file); + + fclose(file); +} + +void gbWriteSaveMBC3(const char * name, bool extendedSave) +{ + FILE *gzFile = fopen(name,"wb"); + + if(gzFile == NULL) + { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); + return; + } + + fwrite(gbRam, + 1, + gbRamSize, + gzFile); + + if(extendedSave) + fwrite(&gbDataMBC3.mapperSeconds, + 1, + 10*sizeof(int) + sizeof(time_t), + gzFile); + + fclose(gzFile); +} + +void gbWriteSaveMBC5(const char * name) +{ + FILE *gzFile = fopen(name,"wb"); + + if(gzFile == NULL) + { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); + return; + } + + fwrite(gbRam, + 1, + gbRamSize, + gzFile); + + fclose(gzFile); +} + +void gbWriteSaveMBC7(const char * name) +{ + FILE *file = fopen(name, "wb"); + + if(file == NULL) + { + systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); + return; + } + + fwrite(&gbMemory[0xa000], + 1, + 256, + file); + + fclose(file); +} + +bool gbReadSaveMBC1(const char * name) +{ + gzFile gzFile = gzopen(name, "rb"); + + if(gzFile == NULL) + { + return false; + } + + int read = gzread(gzFile, + gbRam, + gbRamSize); + + if(read != gbRamSize) + { + systemMessage(MSG_FAILED_TO_READ_SGM, N_("Failed to read complete save game %s (%d)"), name, read); + gzclose(gzFile); + return false; + } + + gzclose(gzFile); + return true; +} + +bool gbReadSaveMBC2(const char * name) +{ + FILE *file = fopen(name, "rb"); + + if(file == NULL) + { + return false; + } + + int read = fread(&gbMemory[0xa000], + 1, + 256, + file); + + if(read != 256) + { + systemMessage(MSG_FAILED_TO_READ_SGM, + N_("Failed to read complete save game %s (%d)"), name, read); + fclose(file); + return false; + } + + fclose(file); + return true; +} + +bool gbReadSaveMBC3(const char * name) +{ + gzFile gzFile = gzopen(name, "rb"); + + if(gzFile == NULL) + { + return false; + } + + int read = gzread(gzFile, + gbRam, + gbRamSize); + + bool res = true; + + if(read != gbRamSize) + { + systemMessage(MSG_FAILED_TO_READ_SGM, + N_("Failed to read complete save game %s (%d)"), name, read); + } else + { + read = gzread(gzFile, + &gbDataMBC3.mapperSeconds, + sizeof(int)*10 + sizeof(time_t)); + + if(read != (sizeof(int)*10 + sizeof(time_t)) && read != 0) + { + systemMessage(MSG_FAILED_TO_READ_RTC, + N_("Failed to read RTC from save game %s (continuing)"), + name); + res = false; + } + } + + gzclose(gzFile); + return res; +} + +bool gbReadSaveMBC5(const char * name) +{ + gzFile gzFile = gzopen(name, "rb"); + + if(gzFile == NULL) + { + return false; + } + + int read = gzread(gzFile, + gbRam, + gbRamSize); + + if(read != gbRamSize) + { + systemMessage(MSG_FAILED_TO_READ_SGM, + N_("Failed to read complete save game %s (%d)"), name, read); + gzclose(gzFile); + return false; + } + + gzclose(gzFile); + return true; +} + +bool gbReadSaveMBC7(const char * name) +{ + FILE *file = fopen(name, "rb"); + + if(file == NULL) + { + return false; + } + + int read = fread(&gbMemory[0xa000], + 1, + 256, + file); + + if(read != 256) + { + systemMessage(MSG_FAILED_TO_READ_SGM, + N_("Failed to read complete save game %s (%d)"), name, read); + fclose(file); + return false; + } + + fclose(file); + return true; +} + +void gbInit() +{ + gbGenFilter(); + gbSgbInit(); + + gbMemory = (u8 *)malloc(65536); + memset(gbMemory,0, 65536); + + // HACK: +4 at start to accomodate the 2xSaI filter reading out of bounds of the leftmost pixel + origPix = (u8 *)calloc(1,4*257*226 +4); + pix = origPix + 4; + + gbLineBuffer = (u16 *)malloc(160 * sizeof(u16)); +} + +bool gbWriteBatteryFile(const char *file, bool extendedSave) +{ + if(gbBattery) + { + int type = gbRom[0x147]; + + switch(type) + { + case 0x03: + gbWriteSaveMBC1(file); + break; + case 0x06: + gbWriteSaveMBC2(file); + break; + case 0x0f: + case 0x10: + case 0x13: + gbWriteSaveMBC3(file, extendedSave); + break; + case 0x1b: + case 0x1e: + gbWriteSaveMBC5(file); + break; + case 0x22: + gbWriteSaveMBC7(file); + break; + case 0xff: + gbWriteSaveMBC1(file); + break; + } + } + return true; +} + +bool gbWriteBatteryFile(const char *file) +{ + gbWriteBatteryFile(file, true); + return true; +} + +bool gbWriteBatteryToStream(gzFile gzfile) +{ + /// XXX FIXME: probably broken - reading it fails + + // the GB save code is ugly, so rather than convert it all to use gzFiles, just save it to a temp file... +#define TEMP_SAVE_FNAME ("tempvbawrite.sav") + bool retVal = gbWriteBatteryFile(TEMP_SAVE_FNAME, true); + + // ...open the temp file and figure out its size... + gzFile gzFileTemp = utilGzOpen(TEMP_SAVE_FNAME, "rb"); + gzseek(gzFileTemp, 0, SEEK_END); + int len = gztell(gzFileTemp); + + // ...copy over the temp file... + char * temp = new char [len]; + if(temp == NULL) return false; + gzseek(gzFileTemp, 0, SEEK_SET); + utilGzRead(gzFileTemp, temp, len); + utilGzClose(gzFileTemp); + utilGzWrite(gzfile, temp, len); + delete [] temp; + + // ... and delete the temp file + remove(TEMP_SAVE_FNAME); +#undef TEMP_SAVE_FNAME + + return retVal; +} + + +bool gbReadBatteryFile(const char *file) +{ + bool res = false; + if(gbBattery) + { + int type = gbRom[0x147]; + + switch(type) + { + case 0x03: + res = gbReadSaveMBC1(file); + break; + case 0x06: + res = gbReadSaveMBC2(file); + break; + case 0x0f: + case 0x10: + case 0x13: + if(!gbReadSaveMBC3(file)) + { + struct tm *lt; + + if(VBAMovieActive() || VBAMovieLoading()) + { + gbDataMBC3.mapperLastTime = VBAMovieGetId() + VBAMovieGetFrameCounter()/60; + lt = gmtime(&gbDataMBC3.mapperLastTime); + } + else + { + time(&gbDataMBC3.mapperLastTime); + lt = localtime(&gbDataMBC3.mapperLastTime); + } + systemScreenMessage(ctime(&gbDataMBC3.mapperLastTime), 4); + + gbDataMBC3.mapperSeconds = lt->tm_sec; + gbDataMBC3.mapperMinutes = lt->tm_min; + gbDataMBC3.mapperHours = lt->tm_hour; + gbDataMBC3.mapperDays = lt->tm_yday & 255; + gbDataMBC3.mapperControl = (gbDataMBC3.mapperControl & 0xfe) | + (lt->tm_yday > 255 ? 1: 0); + res = false; + break; + } + systemScreenMessage(ctime(&gbDataMBC3.mapperLastTime), 4); + res = true; + break; + case 0x1b: + case 0x1e: + res = gbReadSaveMBC5(file); + break; + case 0x22: + res = gbReadSaveMBC7(file); + case 0xff: + res = gbReadSaveMBC1(file); + break; + } + } + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + return res; +} + +bool gbReadBatteryFromStream(gzFile gzfile) +{ + /// XXX FIXME: probably broken - fails to read save + + // the GB save code is ugly, so rather than convert it all to use gzFiles, just copy it to temp RAM... +#define TEMP_SAVE_FNAME ("tempvbaread.sav") + int pos = gztell(gzfile); + gzseek(gzfile, 0, SEEK_END); + int len = gztell(gzfile); + gzseek(gzfile, pos, SEEK_SET); + char * temp = new char [len]; + if(temp == NULL) return false; + + // ...make a temp file and write it there... + gzFile gzFileTemp = utilGzOpen(TEMP_SAVE_FNAME, "wb"); + utilGzRead(gzfile, temp, len); + gzseek(gzfile, pos, SEEK_SET); /// FIXME: leaves pos in gzfile before save instead of after it (everything that calls this right now does a seek afterwards so it doesn't matter for now, but it's still bad) + utilGzWrite(gzFileTemp, temp, len); + delete [] temp; + + // ... load from the temp file... + bool retVal = gbReadBatteryFile(TEMP_SAVE_FNAME); + + // ... and delete the temp file + remove(TEMP_SAVE_FNAME); +#undef TEMP_SAVE_FNAME + + return retVal; +} + +bool gbReadGSASnapshot(const char *fileName) +{ + FILE *file = fopen(fileName, "rb"); + + if(!file) + { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); + return false; + } + + // long size = ftell(file); + fseek(file, 0x4, SEEK_SET); + char buffer[16]; + char buffer2[16]; + fread(buffer, 1, 15, file); + buffer[15] = 0; + memcpy(buffer2, &gbRom[0x134], 15); + buffer2[15] = 0; + if(memcmp(buffer, buffer2, 15)) + { + systemMessage(MSG_CANNOT_IMPORT_SNAPSHOT_FOR, + N_("Cannot import snapshot for %s. Current game is %s"), + buffer, + buffer2); + fclose(file); + return false; + } + fseek(file, 0x13, SEEK_SET); + int read = 0; + int toRead = 0; + switch(gbRom[0x147]) + { + case 0x03: + case 0x0f: + case 0x10: + case 0x13: + case 0x1b: + case 0x1e: + case 0xff: + read = fread(gbRam, 1, gbRamSize, file); + toRead = gbRamSize; + break; + case 0x06: + case 0x22: + read = fread(&gbMemory[0xa000],1,256,file); + toRead = 256; + break; + default: + systemMessage(MSG_UNSUPPORTED_SNAPSHOT_FILE, + N_("Unsupported snapshot file %s"), + fileName); + fclose(file); + return false; + } + fclose(file); + gbReset(); + return true; +} + +variable_desc gbSaveGameStruct[] = +{ + { &PC.W, sizeof(u16) }, + { &SP.W, sizeof(u16) }, + { &AF.W, sizeof(u16) }, + { &BC.W, sizeof(u16) }, + { &DE.W, sizeof(u16) }, + { &HL.W, sizeof(u16) }, + { &IFF, sizeof(u8) }, + { &GBLCD_MODE_0_CLOCK_TICKS, sizeof(int) }, + { &GBLCD_MODE_1_CLOCK_TICKS, sizeof(int) }, + { &GBLCD_MODE_2_CLOCK_TICKS, sizeof(int) }, + { &GBLCD_MODE_3_CLOCK_TICKS, sizeof(int) }, + { &GBDIV_CLOCK_TICKS, sizeof(int) }, + { &GBLY_INCREMENT_CLOCK_TICKS, sizeof(int) }, + { &GBTIMER_MODE_0_CLOCK_TICKS, sizeof(int) }, + { &GBTIMER_MODE_1_CLOCK_TICKS, sizeof(int) }, + { &GBTIMER_MODE_2_CLOCK_TICKS, sizeof(int) }, + { &GBTIMER_MODE_3_CLOCK_TICKS, sizeof(int) }, + { &GBSERIAL_CLOCK_TICKS, sizeof(int) }, + { &GBSYNCHRONIZE_CLOCK_TICKS, sizeof(int) }, + { &gbDivTicks, sizeof(int) }, + { &gbLcdMode, sizeof(int) }, + { &gbLcdTicks, sizeof(int) }, + { &gbLcdLYIncrementTicks, sizeof(int) }, + { &gbTimerTicks, sizeof(int) }, + { &gbTimerClockTicks, sizeof(int) }, + { &gbSerialTicks, sizeof(int) }, + { &gbSerialBits, sizeof(int) }, + { &gbInterrupt, sizeof(int) }, + { &gbInterruptWait, sizeof(int) }, + { &gbSynchronizeTicks, sizeof(int) }, + { &gbTimerOn, sizeof(int) }, + { &gbTimerMode, sizeof(int) }, + { &gbSerialOn, sizeof(int) }, + { &gbWindowLine, sizeof(int) }, + { &gbCgbMode, sizeof(int) }, + { &gbVramBank, sizeof(int) }, + { &gbWramBank, sizeof(int) }, + { &gbHdmaSource, sizeof(int) }, + { &gbHdmaDestination, sizeof(int) }, + { &gbHdmaBytes, sizeof(int) }, + { &gbHdmaOn, sizeof(int) }, + { &gbSpeed, sizeof(int) }, + { &gbSgbMode, sizeof(int) }, + { ®ister_DIV, sizeof(u8) }, + { ®ister_TIMA, sizeof(u8) }, + { ®ister_TMA, sizeof(u8) }, + { ®ister_TAC, sizeof(u8) }, + { ®ister_IF, sizeof(u8) }, + { ®ister_LCDC, sizeof(u8) }, + { ®ister_STAT, sizeof(u8) }, + { ®ister_SCY, sizeof(u8) }, + { ®ister_SCX, sizeof(u8) }, + { ®ister_LY, sizeof(u8) }, + { ®ister_LYC, sizeof(u8) }, + { ®ister_DMA, sizeof(u8) }, + { ®ister_WY, sizeof(u8) }, + { ®ister_WX, sizeof(u8) }, + { ®ister_VBK, sizeof(u8) }, + { ®ister_HDMA1, sizeof(u8) }, + { ®ister_HDMA2, sizeof(u8) }, + { ®ister_HDMA3, sizeof(u8) }, + { ®ister_HDMA4, sizeof(u8) }, + { ®ister_HDMA5, sizeof(u8) }, + { ®ister_SVBK, sizeof(u8) }, + { ®ister_IE , sizeof(u8) }, + { &gbBgp[0], sizeof(u8) }, + { &gbBgp[1], sizeof(u8) }, + { &gbBgp[2], sizeof(u8) }, + { &gbBgp[3], sizeof(u8) }, + { &gbObp0[0], sizeof(u8) }, + { &gbObp0[1], sizeof(u8) }, + { &gbObp0[2], sizeof(u8) }, + { &gbObp0[3], sizeof(u8) }, + { &gbObp1[0], sizeof(u8) }, + { &gbObp1[1], sizeof(u8) }, + { &gbObp1[2], sizeof(u8) }, + { &gbObp1[3], sizeof(u8) }, + { NULL, 0 } +}; + + +bool gbWriteSaveStateToStream(gzFile gzFile) +{ + utilWriteInt(gzFile, GBSAVE_GAME_VERSION); + + utilGzWrite(gzFile, &gbRom[0x134], 15); + + utilWriteData(gzFile, gbSaveGameStruct); + + utilGzWrite(gzFile, &IFF, 2); + + if(gbSgbMode) + { + gbSgbSaveGame(gzFile); + } + + utilGzWrite(gzFile, &gbDataMBC1, sizeof(gbDataMBC1)); + utilGzWrite(gzFile, &gbDataMBC2, sizeof(gbDataMBC2)); + utilGzWrite(gzFile, &gbDataMBC3, sizeof(gbDataMBC3)); + utilGzWrite(gzFile, &gbDataMBC5, sizeof(gbDataMBC5)); + utilGzWrite(gzFile, &gbDataHuC1, sizeof(gbDataHuC1)); + utilGzWrite(gzFile, &gbDataHuC3, sizeof(gbDataHuC3)); + + // yes, this definitely needs to be saved, or loading paused games will show a black screen + // this is also necessary to be consistent with what the GBA saving does + utilGzWrite(gzFile, pix, 4*257*226); + + utilGzWrite(gzFile, gbPalette, 128 * sizeof(u16)); + // todo: remove + utilGzWrite(gzFile, gbPalette, 128 * sizeof(u16)); + + utilGzWrite(gzFile, &gbMemory[0x8000], 0x8000); + + if(gbRamSize && gbRam) + { + utilGzWrite(gzFile, gbRam, gbRamSize); + } + + if(gbCgbMode) + { + utilGzWrite(gzFile, gbVram, 0x4000); + utilGzWrite(gzFile, gbWram, 0x8000); + } + + gbSoundSaveGame(gzFile); + + gbCheatsSaveGame(gzFile); + + // new to re-recording version: + { +#if (defined(WIN32) && !defined(SDL)) + utilGzWrite(gzFile, &theApp.sensorX, sizeof(theApp.sensorX)); + utilGzWrite(gzFile, &theApp.sensorY, sizeof(theApp.sensorY)); +#else + extern int sensorX, sensorY; // from SDL.cpp + utilGzWrite(gzFile, &sensorX, sizeof(sensorX)); + utilGzWrite(gzFile, &sensorY, sizeof(sensorY)); +#endif + utilGzWrite(gzFile, gbJoymask, 4*sizeof(*gbJoymask)); // this has to be saved or old input will incorrectly get carried back on loading a snapshot! + + bool8 movieActive = VBAMovieActive(); + utilGzWrite(gzFile, &movieActive, sizeof(movieActive)); + if(movieActive) + { + uint8* movie_freeze_buf = NULL; + uint32 movie_freeze_size = 0; + + VBAMovieFreeze(&movie_freeze_buf, &movie_freeze_size); + if(movie_freeze_buf) + { + utilGzWrite(gzFile, &movie_freeze_size, sizeof(movie_freeze_size)); + utilGzWrite(gzFile, movie_freeze_buf, movie_freeze_size); + delete [] movie_freeze_buf; + } + else + { + systemMessage(0, N_("Failed to save movie snapshot.")); + return false; + } + } +#if (defined(WIN32) && !defined(SDL)) + utilGzWrite(gzFile, &theApp.globalFrameCount, sizeof(theApp.globalFrameCount)); +#else + int dummy = 0; + utilGzWrite(gzFile, &dummy, sizeof(dummy)); +#endif + } + + return true; +} + +bool gbWriteMemSaveState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "w"); + + if(gzFile == NULL) + { + return false; + } + + bool res = gbWriteSaveStateToStream(gzFile); + + long pos = utilGzMemTell(gzFile)+8; + + if(pos >= (available)) + res = false; + + utilGzClose(gzFile); + + return res; +} + +bool gbWriteSaveState(const char *name) +{ + gzFile gzFile = utilGzOpen(name,"wb"); + + if(gzFile == NULL) + return false; + + bool res = gbWriteSaveStateToStream(gzFile); + + utilGzClose(gzFile); + return res; +} + +static int tempStateID = 0; +static int tempFailCount = 0; +static bool backupSafe = true; + +bool gbReadSaveStateFromStream(gzFile gzFile) +{ + int type; + char tempBackupName [128]; + if(backupSafe) + { + sprintf(tempBackupName, "gbatempsave%d.sav", tempStateID++); + gbWriteSaveState(tempBackupName); + } + + int version = utilReadInt(gzFile); + + if(version > GBSAVE_GAME_VERSION || version < 0) + { + systemMessage(MSG_UNSUPPORTED_VB_SGM, + N_("Unsupported VisualBoy save game version %d"), version); + goto failedLoadGB; + } + + u8 romname[20]; + + utilGzRead(gzFile, romname, 15); + + if(memcmp(&gbRom[0x134], romname, 15) != 0) + { + systemMessage(MSG_CANNOT_LOAD_SGM_FOR, + N_("Cannot load save game for %s. Playing %s"), + romname, &gbRom[0x134]); + goto failedLoadGB; + } + + utilReadData(gzFile, gbSaveGameStruct); + + if(version >= GBSAVE_GAME_VERSION_7) + { + utilGzRead(gzFile, &IFF, 2); + } + + if(gbSgbMode) + { + gbSgbReadGame(gzFile, version); + } else + { + gbSgbMask = 0; // loading a game at the wrong time causes no display + } + + utilGzRead(gzFile, &gbDataMBC1, sizeof(gbDataMBC1)); + utilGzRead(gzFile, &gbDataMBC2, sizeof(gbDataMBC2)); + if(version < GBSAVE_GAME_VERSION_4) + // prior to version 4, there was no adjustment for the time the game + // was last played, so we have less to read. This needs update if the + // structure changes again. + utilGzRead(gzFile, &gbDataMBC3, sizeof(gbDataMBC3)-sizeof(time_t)); + else + utilGzRead(gzFile, &gbDataMBC3, sizeof(gbDataMBC3)); + utilGzRead(gzFile, &gbDataMBC5, sizeof(gbDataMBC5)); + utilGzRead(gzFile, &gbDataHuC1, sizeof(gbDataHuC1)); + utilGzRead(gzFile, &gbDataHuC3, sizeof(gbDataHuC3)); + + if(version >= GBSAVE_GAME_VERSION_12) + { + utilGzRead(gzFile, pix, 4*257*226); + } + else + { + memset(pix, 0, 257*226*sizeof(u32)); +// if(version < GBSAVE_GAME_VERSION_5) +// utilGzRead(gzFile, pix, 256*224*sizeof(u16)); + } + + if(version < GBSAVE_GAME_VERSION_6) + { + utilGzRead(gzFile, gbPalette, 64 * sizeof(u16)); + } + else + utilGzRead(gzFile, gbPalette, 128 * sizeof(u16)); + + // todo: remove + utilGzRead(gzFile, gbPalette, 128 * sizeof(u16)); + + if(version < GBSAVE_GAME_VERSION_10) + { + if(!gbCgbMode && !gbSgbMode) + { + for(int i = 0; i < 8; i++) + gbPalette[i] = systemGbPalette[gbPaletteOption*8+i]; + } + } + + utilGzRead(gzFile, &gbMemory[0x8000], 0x8000); + + if(gbRamSize && gbRam) + { + utilGzRead(gzFile, gbRam, gbRamSize); + } + + gbMemoryMap[0x00] = &gbRom[0x0000]; + gbMemoryMap[0x01] = &gbRom[0x1000]; + gbMemoryMap[0x02] = &gbRom[0x2000]; + gbMemoryMap[0x03] = &gbRom[0x3000]; + gbMemoryMap[0x04] = &gbRom[0x4000]; + gbMemoryMap[0x05] = &gbRom[0x5000]; + gbMemoryMap[0x06] = &gbRom[0x6000]; + gbMemoryMap[0x07] = &gbRom[0x7000]; + gbMemoryMap[0x08] = &gbMemory[0x8000]; + gbMemoryMap[0x09] = &gbMemory[0x9000]; + gbMemoryMap[0x0a] = &gbMemory[0xa000]; + gbMemoryMap[0x0b] = &gbMemory[0xb000]; + gbMemoryMap[0x0c] = &gbMemory[0xc000]; + gbMemoryMap[0x0d] = &gbMemory[0xd000]; + gbMemoryMap[0x0e] = &gbMemory[0xe000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; + + type = gbRom[0x147]; + + switch(type) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + // MBC 1 + memoryUpdateMapMBC1(); + break; + case 0x05: + case 0x06: + // MBC2 + memoryUpdateMapMBC2(); + break; + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + // MBC 3 + memoryUpdateMapMBC3(); + break; + case 0x19: + case 0x1a: + case 0x1b: + // MBC5 + memoryUpdateMapMBC5(); + break; + case 0x1c: + case 0x1d: + case 0x1e: + // MBC 5 Rumble + memoryUpdateMapMBC5(); + break; + case 0x22: + // MBC 7 + memoryUpdateMapMBC7(); + break; + case 0xfe: + // HuC3 + memoryUpdateMapHuC3(); + break; + case 0xff: + // HuC1 + memoryUpdateMapHuC1(); + break; + } + + if(gbCgbMode) + { + utilGzRead(gzFile, gbVram, 0x4000); + utilGzRead(gzFile, gbWram, 0x8000); + + int value = register_SVBK; + if(value == 0) + value = 1; + + gbMemoryMap[0x08] = &gbVram[register_VBK * 0x2000]; + gbMemoryMap[0x09] = &gbVram[register_VBK * 0x2000 + 0x1000]; + gbMemoryMap[0x0d] = &gbWram[value * 0x1000]; + } + + gbSoundReadGame(version, gzFile); + + if(gbBorderOn) + { + gbSgbRenderBorder(); + } +#if (defined(WIN32) && !defined(SDL)) + theApp.painting = true; + systemDrawScreen(); + theApp.painting = false; +#endif + + if(version > GBSAVE_GAME_VERSION_1) + gbCheatsReadGame(gzFile, version); + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + if(version >= GBSAVE_GAME_VERSION_11) // new to re-recording version: + { +#if (defined(WIN32) && !defined(SDL)) + utilGzRead(gzFile, &theApp.sensorX, sizeof(theApp.sensorX)); + utilGzRead(gzFile, &theApp.sensorY, sizeof(theApp.sensorY)); +#else + extern int sensorX, sensorY; // from SDL.cpp + utilGzRead(gzFile, &sensorX, sizeof(sensorX)); + utilGzRead(gzFile, &sensorY, sizeof(sensorY)); +#endif + utilGzRead(gzFile, gbJoymask, 4*sizeof(*gbJoymask)); // this has to be saved or old input will incorrectly get carried back on loading a snapshot! + + bool8 movieSnapshot; + utilGzRead(gzFile, &movieSnapshot, sizeof(movieSnapshot)); + if(VBAMovieActive() && !movieSnapshot) + { + systemMessage(0, N_("Can't load a non-movie snapshot while a movie is active.")); + goto failedLoadGB; + } +#if (defined(WIN32) && !defined(SDL)) + extern bool8 loadedMovieSnapshot; + loadedMovieSnapshot = movieSnapshot; +#endif + if(movieSnapshot) // even if a movie isn't active we still want to parse through this in case other stuff is added later on in the save format + { + uint32 movieInputDataSize = 0; + utilGzRead(gzFile, &movieInputDataSize, sizeof(movieInputDataSize)); + uint8* local_movie_data = new uint8 [movieInputDataSize]; + int readBytes = utilGzRead(gzFile, local_movie_data, movieInputDataSize); + if(readBytes != movieInputDataSize) + { + systemMessage(0, N_("Corrupt movie snapshot.")); + if(local_movie_data) delete [] local_movie_data; + goto failedLoadGB; + } + int code = VBAMovieUnfreeze(local_movie_data, movieInputDataSize); + if(local_movie_data) delete [] local_movie_data; + if(code != SUCCESS && VBAMovieActive()) + { + char errStr [1024]; + strcpy(errStr, "Failed to load movie snapshot"); + switch(code) + { + case NOT_FROM_THIS_MOVIE: strcat(errStr, ";\nSnapshot not from this movie"); break; + case NOT_FROM_A_MOVIE: strcat(errStr, ";\nNot a movie snapshot"); break; // shouldn't get here... + case INVALID_FRAME: strcat(errStr, ";\nInvalid frame number"); break; + case WRONG_FORMAT: strcat(errStr, ";\nWrong format"); break; + } + strcat(errStr, "."); + systemMessage(0, N_(errStr)); + goto failedLoadGB; + } + } +#if (defined(WIN32) && !defined(SDL)) + utilGzRead(gzFile, &theApp.globalFrameCount, sizeof(theApp.globalFrameCount)); +#else + int dummy; + utilGzRead(gzFile, &dummy, sizeof(dummy)); +#endif + } + + if(backupSafe) + { + remove(tempBackupName); + tempFailCount = 0; + } + VBAUpdateFrameCountDisplay(); + return true; + +failedLoadGB: + if(backupSafe) + { + tempFailCount++; + if(tempFailCount < 3) // fail no more than 2 times in a row + gbReadSaveState(tempBackupName); + remove(tempBackupName); + } + return false; +} + +bool gbReadMemSaveState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "r"); + + backupSafe = false; + bool res = gbReadSaveStateFromStream(gzFile); + backupSafe = true; + + utilGzClose(gzFile); + + return res; +} + +bool gbReadSaveState(const char *name) +{ + gzFile gzFile = utilGzOpen(name,"rb"); + + if(gzFile == NULL) + { + return false; + } + + bool res = gbReadSaveStateFromStream(gzFile); + + utilGzClose(gzFile); + + return res; +} + +bool gbWritePNGFile(const char *fileName) +{ + if(gbBorderOn) + return utilWritePNGFile(fileName, 256, 224, pix); + return utilWritePNGFile(fileName, 160, 144, pix); +} + +bool gbWriteBMPFile(const char *fileName) +{ + if(gbBorderOn) + return utilWriteBMPFile(fileName, 256, 224, pix); + return utilWriteBMPFile(fileName, 160, 144, pix); +} + +static bool frameBoundary = false; + +void gbCleanUp() +{ + frameBoundary = false; + +#if (defined(WIN32) && !defined(SDL)) + theApp.globalFrameCount = 0; +#endif + + if(gbRam != NULL) + { + free(gbRam); + gbRam = NULL; + } + + if(gbRom != NULL) + { + free(gbRom); + gbRom = NULL; + } + + if(gbMemory != NULL) + { + free(gbMemory); + gbMemory = NULL; + } + + if(gbLineBuffer != NULL) + { + free(gbLineBuffer); + gbLineBuffer = NULL; + } + + if(origPix != NULL) + { + free(origPix); + origPix = NULL; + } + pix = NULL; + + gbSgbShutdown(); + + if(gbVram != NULL) + { + free(gbVram); + gbVram = NULL; + } + + if(gbWram != NULL) + { + free(gbWram); + gbWram = NULL; + } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; +} + +bool gbLoadRom(const char *szFile) +{ + int size = 0; + + if(gbRom != NULL) + { + gbCleanUp(); + } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + gbRom = utilLoad(szFile, + utilIsGBImage, + NULL, + size); + if(!gbRom) + return false; + + gbRomSize = size; + + return gbUpdateSizes(); +} + +bool gbUpdateSizes() +{ + if(gbRom[0x148] > 8) + { + systemMessage(MSG_UNSUPPORTED_ROM_SIZE, + N_("Unsupported rom size %02x"), gbRom[0x148]); + return false; + } + + if(gbRomSize < gbRomSizes[gbRom[0x148]]) + { + gbRom = (u8 *)realloc(gbRom, gbRomSizes[gbRom[0x148]]); + } + gbRomSize = gbRomSizes[gbRom[0x148]]; + gbRomSizeMask = gbRomSizesMasks[gbRom[0x148]]; + + if(gbRom[0x149] > 5) + { + systemMessage(MSG_UNSUPPORTED_RAM_SIZE, + N_("Unsupported ram size %02x"), gbRom[0x149]); + return false; + } + + gbRamSize = gbRamSizes[gbRom[0x149]]; + gbRamSizeMask = gbRamSizesMasks[gbRom[0x149]]; + + if(gbRamSize) + { + gbRam = (u8 *)malloc(gbRamSize); + memset(gbRam, 0xFF, gbRamSize); + } + + int type = gbRom[0x147]; + + mapperReadRAM = NULL; + + switch(type) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + // MBC 1 + mapper = mapperMBC1ROM; + mapperRAM = mapperMBC1RAM; + break; + case 0x05: + case 0x06: + // MBC2 + mapper = mapperMBC2ROM; + mapperRAM = mapperMBC2RAM; + gbRamSize = 0x200; + gbRamSizeMask = 0x1ff; + break; + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + // MBC 3 + mapper = mapperMBC3ROM; + mapperRAM = mapperMBC3RAM; + mapperReadRAM = mapperMBC3ReadRAM; + break; + case 0x19: + case 0x1a: + case 0x1b: + // MBC5 + mapper = mapperMBC5ROM; + mapperRAM = mapperMBC5RAM; + break; + case 0x1c: + case 0x1d: + case 0x1e: + // MBC 5 Rumble + mapper = mapperMBC5ROM; + mapperRAM = mapperMBC5RAM; + break; + case 0x22: + // MBC 7 + mapper = mapperMBC7ROM; + mapperRAM = mapperMBC7RAM; + mapperReadRAM = mapperMBC7ReadRAM; + break; + case 0xfe: + // HuC3 + mapper = mapperHuC3ROM; + mapperRAM = mapperHuC3RAM; + mapperReadRAM = mapperHuC3ReadRAM; + break; + case 0xff: + // HuC1 + mapper = mapperHuC1ROM; + mapperRAM = mapperHuC1RAM; + break; + default: + systemMessage(MSG_UNKNOWN_CARTRIDGE_TYPE, + N_("Unknown cartridge type %02x"), type); + return false; + } + + switch(type) + { + case 0x03: + case 0x06: + case 0x0f: + case 0x10: + case 0x13: + case 0x1b: + case 0x1d: + case 0x1e: + case 0x22: + case 0xff: + gbBattery = 1; + break; + } + + if(gbRom[0x146] == 0x03) + { + if(gbEmulatorType == 0 || + gbEmulatorType == 2 || + gbEmulatorType == 5 || + (!(gbRom[0x143] & 0x80) && (gbEmulatorType == 1 || gbEmulatorType == 4))) + gbSgbMode = 1; + else + gbSgbMode = 0; + } else + gbSgbMode = 0; + + if(gbRom[0x143] & 0x80) + { + if(gbEmulatorType == 0 || + gbEmulatorType == 1 || + gbEmulatorType == 4 || + gbEmulatorType == 5 || + (gbRom[0x146] != 0x03 && (gbEmulatorType == 2))) + { + gbCgbMode = 1; + gbVram = (u8 *)malloc(0x4000); + gbWram = (u8 *)malloc(0x8000); + memset(gbVram,0,0x4000); + memset(gbWram,0,0x8000); + memset(gbPalette,0, 2*128); + } else + { + gbCgbMode = 0; + } + } else + gbCgbMode = 0; + + gbInit(); + gbReset(); + + switch(type) + { + case 0x1c: + case 0x1d: + case 0x1e: + gbDataMBC5.isRumbleCartridge = 1; + } + + return true; +} + + +#if (defined(WIN32) && !defined(SDL)) +# define USE_OLD_GB_TIMING (theApp.useOldGBTiming) +#else +# define USE_OLD_GB_TIMING (false) /// SDL FIXME +#endif + + +void gbEmulate(int ticksToStop) +{ + gbRegister tempRegister; + u8 tempValue; + s8 offset; + + int clockTicks = 0; + gbDmaTicks = 0; + + register int opcode = 0; + + while(1) + { +#ifndef FINAL_VERSION + if(systemDebug) + { + if(!(IFF & 0x80)) + { + if(systemDebug > 1) + { + sprintf(gbBuffer,"PC=%04x AF=%04x BC=%04x DE=%04x HL=%04x SP=%04x I=%04x\n", + PC.W, AF.W, BC.W, DE.W,HL.W,SP.W,IFF); + } else + { + sprintf(gbBuffer,"PC=%04x I=%02x\n", PC.W, IFF); + } + log(gbBuffer); + } + } +#endif + if(IFF & 0x80) + { + if(register_LCDC & 0x80) + { + clockTicks = gbLcdTicks; + } else + clockTicks = 100; + + if(gbLcdMode == 1 && (gbLcdLYIncrementTicks < clockTicks)) + clockTicks = gbLcdLYIncrementTicks; + + if(gbSerialOn && (gbSerialTicks < clockTicks)) + clockTicks = gbSerialTicks; + + if(gbTimerOn && (gbTimerTicks < clockTicks)) + clockTicks = gbTimerTicks; + + if(soundTicks && (soundTicks < clockTicks)) + clockTicks = soundTicks; + } else + { + opcode = gbReadOpcode(PC.W++); + + if(IFF & 0x100) + { + IFF &= 0xff; + PC.W--; + } + + clockTicks = gbCycles[opcode]; + + switch(opcode) + { + case 0xCB: + // extended opcode + opcode = gbReadOpcode(PC.W++); + clockTicks = gbCyclesCB[opcode]; + switch(opcode) + { +#include "gbCodesCB.h" + } + break; +#include "gbCodes.h" + } + } + + if(!emulating) + return; + + if(gbDmaTicks) + { + clockTicks += gbDmaTicks; + gbDmaTicks = 0; + } + + if(gbSgbMode) + { + if(gbSgbPacketTimeout) + { + gbSgbPacketTimeout -= clockTicks; + + if(gbSgbPacketTimeout <= 0) + gbSgbResetPacketState(); + } + } + + ticksToStop -= clockTicks; + + // DIV register emulation + gbDivTicks -= clockTicks; + while(gbDivTicks <= 0) + { + register_DIV++; + gbDivTicks += GBDIV_CLOCK_TICKS; + } + + if(register_LCDC & 0x80) + { + // LCD stuff + gbLcdTicks -= clockTicks; + if(gbLcdMode == 1) + { + // during V-BLANK,we need to increment LY at the same rate! + gbLcdLYIncrementTicks -= clockTicks; + while(gbLcdLYIncrementTicks <= 0) + { + gbLcdLYIncrementTicks += GBLY_INCREMENT_CLOCK_TICKS; + + if(register_LY < 153) + { + register_LY++; + + gbCompareLYToLYC(); + + if(register_LY >= 153) + gbLcdLYIncrementTicks = 6; + } else + { + register_LY = 0x00; + // reset the window line + gbWindowLine = -1; + gbLcdLYIncrementTicks = GBLY_INCREMENT_CLOCK_TICKS * 2; + gbCompareLYToLYC(); + } + } + } + + // our counter is off, see what we need to do + while(gbLcdTicks <= 0) + { + int framesToSkip = systemFrameSkip; + + bool fastForward = speedup; + +#if (defined(WIN32) && !defined(SDL)) + int throttle = theApp.throttle; + if(theApp.frameSearching && throttle < 100) + throttle = 100; + fastForward |= theApp.frameSearchSkipping; +#else + extern int throttle; +#endif + + if(fastForward) + framesToSkip = 9; // try 6 FPS during speedup + else if(throttle != 100) + framesToSkip = (framesToSkip * throttle) / 100; + + switch(gbLcdMode) + { + case 0: + // H-Blank + register_LY++; + + gbCompareLYToLYC(); + + // check if we reached the V-Blank period + if(register_LY == 144) + { + // Yes, V-Blank + // set the LY increment counter + gbLcdLYIncrementTicks = gbLcdTicks + GBLY_INCREMENT_CLOCK_TICKS; + gbLcdTicks += GBLCD_MODE_1_CLOCK_TICKS; + gbLcdMode = 1; + if(register_LCDC & 0x80) + { + gbInterrupt |= 1; // V-Blank interrupt + gbInterruptWait = 6; + if(register_STAT & 0x10) + gbInterrupt |= 2; + } + + gbFrameCount++; + + systemFrame(60); + + if(gbFrameCount >= 60) + { + u32 currentTime = systemGetClock(); + if(currentTime != gbLastTime) + systemShowSpeed(100000/(currentTime - gbLastTime)); + else + systemShowSpeed(0); + gbLastTime = currentTime; + gbFrameCount = 0; + } + + if(systemReadJoypads()) + { + bool sensor = (gbRom[0x147] == 0x22); + + // read joystick + if(gbSgbMode && gbSgbMultiplayer) + { + if(gbSgbFourPlayers) + { + gbJoymask[0] = systemReadJoypad(0,sensor); + gbJoymask[1] = systemReadJoypad(1,false); + gbJoymask[2] = systemReadJoypad(2,false); + gbJoymask[3] = systemReadJoypad(3,false); + } else + { + gbJoymask[0] = systemReadJoypad(0,sensor); + gbJoymask[1] = systemReadJoypad(1,false); + } + } else + { + gbJoymask[0] = systemReadJoypad(-1,sensor); + } + } + + frameBoundary = true; + + int newmask = gbJoymask[0] & 255; + + if(newmask) + { + gbInterrupt |= 16; + } + + newmask = (gbJoymask[0] >> 10); + + speedup = (newmask & 1) ? true : false; + gbCapture = (newmask & 2) ? true : false; + + if(gbCapture && !gbCapturePrevious) + { + gbCaptureNumber++; + systemScreenCapture(gbCaptureNumber); + } + gbCapturePrevious = gbCapture; + + pauseAfterFrameAdvance = systemPauseOnFrame(); + + if(gbFrameSkipCount >= framesToSkip || pauseAfterFrameAdvance) + { + systemDrawScreen(); + gbFrameSkipCount = 0; + } else + gbFrameSkipCount++; + + if(pauseAfterFrameAdvance) + { +#if (defined(WIN32) && !defined(SDL)) + if(theApp.muteFrameAdvance) + theApp.frameAdvanceMuteNow = true; + theApp.paused = true; + if(theApp.sound) + theApp.sound->pause(); // prevents the sound from looping annoyingly after a frame advance in GBA games +#else + extern bool paused; // from SDL.cpp + paused = true; + systemSoundPause(); +#endif + } + else + { +#if (defined(WIN32) && !defined(SDL)) + theApp.frameAdvanceMuteNow = false; +#endif + } + + + } else + { + // go the the OAM being accessed mode + gbLcdTicks += GBLCD_MODE_2_CLOCK_TICKS; + gbLcdMode = 2; + + // only one LCD interrupt per line. may need to generalize... + if(!(register_STAT & 0x40) || + (register_LY != register_LYC)) + { + if((register_STAT & 0x28) == 0x20) + gbInterrupt |= 2; + } + } + + break; + case 1: + // V-Blank + // next mode is OAM being accessed mode + gbLcdTicks += GBLCD_MODE_2_CLOCK_TICKS; + gbLcdMode = 2; + if(!(register_STAT & 0x40) || + (register_LY != register_LYC)) + { + if((register_STAT & 0x28) == 0x20) + gbInterrupt |= 2; + } + break; + case 2: + // OAM being accessed mode + + // next mode is OAM and VRAM in use + gbLcdTicks += GBLCD_MODE_3_CLOCK_TICKS; + gbLcdMode = 3; + break; + case 3: + // OAM and VRAM in use + // next mode is H-Blank + if(register_LY < 144) + { + if(!gbSgbMask) + { + if(gbFrameSkipCount >= framesToSkip || pauseAfterFrameAdvance) + { + gbRenderLine(); + gbDrawSprites(); + + switch(systemColorDepth) + { + case 16: + + { + + u16 * dest = (u16 *)pix + + (gbBorderLineSkip+2) * (register_LY + gbBorderRowSkip+1) + + gbBorderColumnSkip; + for(int x = 0; x < 160; ) + { + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + *dest++ = systemColorMap16[gbLineMix[x++]]; + } + if(gbBorderOn) + dest += gbBorderColumnSkip; + *dest++ = 0; // for filters that read one pixel more + } + break; + case 24: + + { + u8 *dest = (u8 *)pix + + 3*(gbBorderLineSkip * (register_LY + gbBorderRowSkip) + + gbBorderColumnSkip); + for(int x = 0; x < 160;) + { + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; + dest+= 3; + } + } + break; + case 32: + + { + u32 * dest = (u32 *)pix + + (gbBorderLineSkip+1) * (register_LY + gbBorderRowSkip+1) + + gbBorderColumnSkip; + for(int x = 0; x < 160;) + { + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + *dest++ = systemColorMap32[gbLineMix[x++]]; + } + } + break; + } + } + } + } + gbLcdTicks += GBLCD_MODE_0_CLOCK_TICKS; + gbLcdMode = 0; + // only one LCD interrupt per line. may need to generalize... + if(!(register_STAT & 0x40) || + (register_LY != register_LYC)) + { + if(register_STAT & 0x08) + gbInterrupt |= 2; + } + if(gbHdmaOn) + { + gbDoHdma(); + } + break; + } + // mark the correct lcd mode on STAT register + register_STAT = (register_STAT & 0xfc) | gbLcdMode; + } + } + + // serial emulation + if(gbSerialOn) + { +#ifdef LINK_EMULATION + if(linkConnected) + { + gbSerialTicks -= clockTicks; + + while(gbSerialTicks <= 0) + { + // increment number of shifted bits + gbSerialBits++; + linkProc(); + if(gbSerialOn && (gbMemory[0xff02] & 1)) + { + if(gbSerialBits == 8) + { + gbSerialBits = 0; + gbMemory[0xff01] = 0xff; + gbMemory[0xff02] &= 0x7f; + gbSerialOn = 0; + gbInterrupt |= 8; + gbSerialTicks = 0; + } + } + gbSerialTicks += GBSERIAL_CLOCK_TICKS; + } + } else + { +#endif + if(gbMemory[0xff02] & 1) + { + gbSerialTicks -= clockTicks; + + // overflow + while(gbSerialTicks <= 0) + { + // shift serial byte to right and put a 1 bit in its place + // gbMemory[0xff01] = 0x80 | (gbMemory[0xff01]>>1); + // increment number of shifted bits + gbSerialBits++; + if(gbSerialBits == 8) + { + // end of transmission + if(gbSerialFunction) // external device + gbMemory[0xff01] = gbSerialFunction(gbMemory[0xff01]); + else + gbMemory[0xff01] = 0xff; + gbSerialTicks = 0; + gbMemory[0xff02] &= 0x7f; + gbSerialOn = 0; + gbInterrupt |= 8; + gbSerialBits = 0; + } else + gbSerialTicks += GBSERIAL_CLOCK_TICKS; + } + } +#ifdef LINK_EMULATION + } +#endif + } + + // timer emulation + if(gbTimerOn) + { + gbTimerTicks -= clockTicks; + + while(gbTimerTicks <= 0) + { + register_TIMA++; + + if(register_TIMA == 0) + { + // timer overflow! + + // reload timer modulo + register_TIMA = register_TMA; + + // flag interrupt + gbInterrupt |= 4; + } + + gbTimerTicks += gbTimerClockTicks; + } + } + + /* + if(soundOffFlag) + { + if(synchronize && !speedup) + { + synchronizeTicks -= clockTicks; + + while(synchronizeTicks < 0) + { + synchronizeTicks += SYNCHRONIZE_CLOCK_TICKS; + + DWORD now = timeGetTime(); + gbElapsedTime += (now - timeNow); + + if(gbElapsedTime < 50) + { + DWORD diff = 50 - gbElapsedTime; + Sleep(diff); + timeNow = timeGetTime(); + elapsedTime = timeNow - now - diff; + if((int)elapsedTime < 0) + elapsedTime = 0; + } else + { + timeNow = timeGetTime(); + elapsedTime = 0; + } + } + } + } + */ + + soundTicks -= clockTicks; + while(soundTicks < 0) + { + soundTicks += SOUND_CLOCK_TICKS; + + gbSoundTick(); + } + + + register_IF = gbInterrupt; + + if(IFF & 0x20) + { + IFF &= 0xdf; + IFF |= 0x01; + gbInterruptWait = 0; + } else if(gbInterrupt) + { + if(gbInterruptWait == 0) + { + // gbInterruptWait = 0; + + if(IFF & 0x01) + { + if((gbInterrupt & 1) && (register_IE & 1)) + { + gbVblank_interrupt(); + continue; + } + + if((gbInterrupt & 2) && (register_IE & 2)) + { + gbLcd_interrupt(); + continue; + } + + if((gbInterrupt & 4) && (register_IE & 4)) + { + gbTimer_interrupt(); + continue; + } + + if((gbInterrupt & 8) && (register_IE & 8)) + { + gbSerial_interrupt(); + continue; + } + + if((gbInterrupt & 16) && (register_IE & 16)) + { + gbJoypad_interrupt(); + continue; + } + } + } else + { + gbInterruptWait -= clockTicks; + if(gbInterruptWait < 0) + gbInterruptWait = 0; + } + } + + if(USE_OLD_GB_TIMING) + { + // old timing code + + if(ticksToStop > 0) + continue; + } + else + { + if(!frameBoundary && (register_LCDC & 0x80) != 0) + continue; + } + + + + if(!(register_LCDC & 0x80)) + { + // Apparently it IS necessary to do something on this condition or games like + // Megaman will freeze upon low-level restart interrupt sequence (Start+Select+A+B). + if(USE_OLD_GB_TIMING) + { + if(systemReadJoypads()) + { + if(gbSgbMode && gbSgbMultiplayer) + { + if(gbSgbFourPlayers) + { + gbJoymask[0] = systemReadJoypad(0,false); + gbJoymask[1] = systemReadJoypad(1,false); + gbJoymask[2] = systemReadJoypad(2,false); + gbJoymask[3] = systemReadJoypad(3,false); + } + else + { + gbJoymask[0] = systemReadJoypad(0,false); + gbJoymask[1] = systemReadJoypad(1,false); + } + } + else + { + gbJoymask[0] = systemReadJoypad(-1,false); + } + } + } + else + { + // For the benefit of (movies) having a constant rate of input, just reset this to 0 (same as user letting go of the button) immediately, + // otherwise an internal timer variables will change independently of how many frames of input pass by. + // (This fake-input is merely used to make the system wait at a certain frame until you let go of the buttons, + // if it is used at all, sometimes it is sampled at the same frame as other input and completely ignored.) + + gbJoymask[0] = gbJoymask[1] = gbJoymask[2] = gbJoymask[3] = 0; + } + + if(!USE_OLD_GB_TIMING) + frameBoundary = true; + } + + // makes sure frames are really divided across input sampling boundaries which occur at a constant rate + if(frameBoundary || USE_OLD_GB_TIMING) + { + frameBoundary = false; + return; + } + } +} + +struct EmulatedSystem GBSystem = +{ + // emuMain + gbEmulate, + // emuReset + gbReset, + // emuCleanUp + gbCleanUp, + // emuReadBattery + gbReadBatteryFile, + // emuWriteBattery + gbWriteBatteryFile, + // emuReadBatteryFromStream + gbReadBatteryFromStream, + // emuWriteBatteryToStream + gbWriteBatteryToStream, + // emuReadState + gbReadSaveState, + // emuWriteState + gbWriteSaveState, + // emuReadStateFromStream + gbReadSaveStateFromStream, + // emuWriteStateToStream + gbWriteSaveStateToStream, + // emuReadMemState + gbReadMemSaveState, + // emuWriteMemState + gbWriteMemSaveState, + // emuWritePNG + gbWritePNGFile, + // emuWriteBMP + gbWriteBMPFile, + // emuUpdateCPSR + NULL, + // emuHasDebugger + false, + // emuCount +#ifdef FINAL_VERSION + 70000/4, +#else + 1000, +#endif +}; diff --git a/src/gb/GB.h b/src/gb/GB.h new file mode 100644 index 0000000..a95cda2 --- /dev/null +++ b/src/gb/GB.h @@ -0,0 +1,64 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_GB_GB_H +#define VBA_GB_GB_H + +#define C_FLAG 0x10 +#define H_FLAG 0x20 +#define N_FLAG 0x40 +#define Z_FLAG 0x80 + +typedef union { + struct { +#ifdef WORDS_BIGENDIAN + u8 B1, B0; +#else + u8 B0,B1; +#endif + } B; + u16 W; +} gbRegister; + +extern bool gbLoadRom(const char *); +extern void gbEmulate(int); +extern bool gbIsGameboyRom(const char *); +extern void gbSoundReset(); +extern void gbSoundSetQuality(int); +extern void gbReset(); +extern void gbCleanUp(); +extern bool gbWriteBatteryFile(const char *); +extern bool gbWriteBatteryFile(const char *, bool); +extern bool gbWriteBatteryToStream(gzFile); +extern bool gbReadBatteryFile(const char *); +extern bool gbReadBatteryFromStream(gzFile); +extern bool gbWriteSaveState(const char *); +extern bool gbWriteMemSaveState(char *, int); +extern bool gbReadSaveState(const char *); +extern bool gbReadMemSaveState(char *, int); +extern bool gbReadSaveStateFromStream(gzFile); +extern bool gbWriteSaveStateToStream(gzFile); +extern void gbSgbRenderBorder(); +extern bool gbWritePNGFile(const char *); +extern bool gbWriteBMPFile(const char *); +extern bool gbReadGSASnapshot(const char *); + +extern struct EmulatedSystem GBSystem; + +#endif diff --git a/src/gb/Makefile.am b/src/gb/Makefile.am new file mode 100644 index 0000000..a318425 --- /dev/null +++ b/src/gb/Makefile.am @@ -0,0 +1,21 @@ +noinst_LIBRARIES = libgb.a + +libgb_a_SOURCES = \ + gbCheats.cpp \ + gbCheats.h \ + gbCodesCB.h \ + gbCodes.h \ + GB.cpp \ + GB.h \ + gbDis.cpp \ + gbGfx.cpp \ + gbGlobals.cpp \ + gbGlobals.h \ + gbMemory.cpp \ + gbMemory.h \ + gbPrinter.cpp \ + gbPrinter.h \ + gbSGB.cpp \ + gbSGB.h \ + gbSound.cpp \ + gbSound.h diff --git a/src/gb/Makefile.in b/src/gb/Makefile.in new file mode 100644 index 0000000..e5dc92b --- /dev/null +++ b/src/gb/Makefile.in @@ -0,0 +1,442 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +noinst_LIBRARIES = libgb.a + +libgb_a_SOURCES = \ + gbCheats.cpp \ + gbCheats.h \ + gbCodesCB.h \ + gbCodes.h \ + GB.cpp \ + GB.h \ + gbDis.cpp \ + gbGfx.cpp \ + gbGlobals.cpp \ + gbGlobals.h \ + gbMemory.cpp \ + gbMemory.h \ + gbPrinter.cpp \ + gbPrinter.h \ + gbSGB.cpp \ + gbSGB.h \ + gbSound.cpp \ + gbSound.h + +subdir = src/gb +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libgb_a_AR = $(AR) cru +libgb_a_LIBADD = +am_libgb_a_OBJECTS = gbCheats.$(OBJEXT) GB.$(OBJEXT) gbDis.$(OBJEXT) \ + gbGfx.$(OBJEXT) gbGlobals.$(OBJEXT) gbMemory.$(OBJEXT) \ + gbPrinter.$(OBJEXT) gbSGB.$(OBJEXT) gbSound.$(OBJEXT) +libgb_a_OBJECTS = $(am_libgb_a_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/GB.Po ./$(DEPDIR)/gbCheats.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gbDis.Po ./$(DEPDIR)/gbGfx.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gbGlobals.Po ./$(DEPDIR)/gbMemory.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gbPrinter.Po ./$(DEPDIR)/gbSGB.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gbSound.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libgb_a_SOURCES) +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +SOURCES = $(libgb_a_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gb/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgb.a: $(libgb_a_OBJECTS) $(libgb_a_DEPENDENCIES) + -rm -f libgb.a + $(libgb_a_AR) libgb.a $(libgb_a_OBJECTS) $(libgb_a_LIBADD) + $(RANLIB) libgb.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GB.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbCheats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbDis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbGfx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbGlobals.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbMemory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbPrinter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbSGB.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbSound.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/gb/gbCheats.cpp b/src/gb/gbCheats.cpp new file mode 100644 index 0000000..941bb16 --- /dev/null +++ b/src/gb/gbCheats.cpp @@ -0,0 +1,462 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include + +#include "../System.h" +#include "../NLS.h" +#include "../Util.h" + +#include "gbCheats.h" +#include "gbGlobals.h" + +gbCheat gbCheatList[100]; +int gbCheatNumber = 0; +bool gbCheatMap[0x10000]; + +extern bool cheatsEnabled; + +#define GBCHEAT_IS_HEX(a) ( ((a)>='A' && (a) <='F') || ((a) >='0' && (a) <= '9')) +#define GBCHEAT_HEX_VALUE(a) ( (a) >= 'A' ? (a) - 'A' + 10 : (a) - '0') + +void gbCheatUpdateMap() +{ + memset(gbCheatMap, 0, 0x10000); + + for(int i = 0; i < gbCheatNumber; i++) { + if(gbCheatList[i].enabled) + gbCheatMap[gbCheatList[i].address] = true; + } +} + +void gbCheatsSaveGame(gzFile gzFile) +{ + utilWriteInt(gzFile, gbCheatNumber); + if(gbCheatNumber) + utilGzWrite(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber); +} + +void gbCheatsReadGame(gzFile gzFile, int version) +{ + if(version <= 8) { + int gbGgOn = utilReadInt(gzFile); + + if(gbGgOn) { + int n = utilReadInt(gzFile); + gbXxCheat tmpCheat; + for(int i = 0; i < n; i++) { + utilGzRead(gzFile,&tmpCheat, sizeof(gbXxCheat)); + gbAddGgCheat(tmpCheat.cheatCode, tmpCheat.cheatDesc); + } + } + + int gbGsOn = utilReadInt(gzFile); + + if(gbGsOn) { + int n = utilReadInt(gzFile); + gbXxCheat tmpCheat; + for(int i = 0; i < n; i++) { + utilGzRead(gzFile,&tmpCheat, sizeof(gbXxCheat)); + gbAddGsCheat(tmpCheat.cheatCode, tmpCheat.cheatDesc); + } + } + } else { + gbCheatNumber = utilReadInt(gzFile); + + if(gbCheatNumber) { + utilGzRead(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber); + } + } + + gbCheatUpdateMap(); +} + +void gbCheatsSaveCheatList(const char *file) +{ + if(gbCheatNumber == 0) + return; + FILE *f = fopen(file, "wb"); + if(f == NULL) + return; + int version = 1; + fwrite(&version, 1, sizeof(version), f); + int type = 1; + fwrite(&type, 1, sizeof(type), f); + fwrite(&gbCheatNumber, 1, sizeof(gbCheatNumber), f); + fwrite(gbCheatList, 1, sizeof(gbCheatList), f); + fclose(f); +} + +bool gbCheatsLoadCheatList(const char *file) +{ + gbCheatNumber = 0; + + gbCheatUpdateMap(); + + int count = 0; + + FILE *f = fopen(file, "rb"); + + if(f == NULL) + return false; + + int version = 0; + + if(fread(&version, 1, sizeof(version), f) != sizeof(version)) { + fclose(f); + return false; + } + + if(version != 1) { + systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_VERSION, + N_("Unsupported cheat list version %d"), version); + fclose(f); + return false; + } + + int type = 0; + if(fread(&type, 1, sizeof(type), f) != sizeof(type)) { + fclose(f); + return false; + } + + if(type != 1) { + systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_TYPE, + N_("Unsupported cheat list type %d"), type); + fclose(f); + return false; + } + + if(fread(&count, 1, sizeof(count), f) != sizeof(count)) { + fclose(f); + return false; + } + + if(fread(gbCheatList, 1, sizeof(gbCheatList), f) != sizeof(gbCheatList)) { + fclose(f); + return false; + } + + gbCheatNumber = count; + gbCheatUpdateMap(); + + return true; +} + +bool gbVerifyGsCode(const char *code) +{ + int len = strlen(code); + + if(len == 0) + return true; + + if(len != 8) + return false; + + for(int i = 0; i < 8; i++) + if(!GBCHEAT_IS_HEX(code[i])) + return false; + + int address = GBCHEAT_HEX_VALUE(code[6]) << 12 | + GBCHEAT_HEX_VALUE(code[7]) << 8 | + GBCHEAT_HEX_VALUE(code[4]) << 4 | + GBCHEAT_HEX_VALUE(code[5]); + + if(address < 0xa000 || + address > 0xdfff) + return false; + + return true; +} + +void gbAddGsCheat(const char *code, const char *desc) +{ + if(gbCheatNumber > 99) { + systemMessage(MSG_MAXIMUM_NUMBER_OF_CHEATS, + N_("Maximum number of cheats reached.")); + return; + } + + if(!gbVerifyGsCode(code)) { + systemMessage(MSG_INVALID_GAMESHARK_CODE, + N_("Invalid GameShark code: %s"), code); + return; + } + + int i = gbCheatNumber; + + strcpy(gbCheatList[i].cheatCode, code); + strcpy(gbCheatList[i].cheatDesc, desc); + + gbCheatList[i].code = GBCHEAT_HEX_VALUE(code[0]) << 4 | + GBCHEAT_HEX_VALUE(code[1]); + + gbCheatList[i].value = GBCHEAT_HEX_VALUE(code[2]) << 4 | + GBCHEAT_HEX_VALUE(code[3]); + + gbCheatList[i].address = GBCHEAT_HEX_VALUE(code[6]) << 12 | + GBCHEAT_HEX_VALUE(code[7]) << 8 | + GBCHEAT_HEX_VALUE(code[4]) << 4 | + GBCHEAT_HEX_VALUE(code[5]); + + gbCheatList[i].compare = 0; + + gbCheatList[i].enabled = true; + + gbCheatMap[gbCheatList[i].address] = true; + + gbCheatNumber++; +} + +bool gbVerifyGgCode(const char *code) +{ + int len = strlen(code); + + if(len != 11 && + len != 7 && + len != 6 && + len != 0) + return false; + + if(len == 0) + return true; + + if(!GBCHEAT_IS_HEX(code[0])) + return false; + if(!GBCHEAT_IS_HEX(code[1])) + return false; + if(!GBCHEAT_IS_HEX(code[2])) + return false; + if(code[3] != '-') + return false; + if(!GBCHEAT_IS_HEX(code[4])) + return false; + if(!GBCHEAT_IS_HEX(code[5])) + return false; + if(!GBCHEAT_IS_HEX(code[6])) + return false; + if(code[7] != 0) { + if(code[7] != '-') + return false; + if(code[8] != 0) { + if(!GBCHEAT_IS_HEX(code[8])) + return false; + if(!GBCHEAT_IS_HEX(code[9])) + return false; + if(!GBCHEAT_IS_HEX(code[10])) + return false; + } + } + + // int replace = (GBCHEAT_HEX_VALUE(code[0]) << 4) + + // GBCHEAT_HEX_VALUE(code[1]); + + int address = (GBCHEAT_HEX_VALUE(code[2]) << 8) + + (GBCHEAT_HEX_VALUE(code[4]) << 4) + + (GBCHEAT_HEX_VALUE(code[5])) + + ((GBCHEAT_HEX_VALUE(code[6]) ^ 0x0f) << 12); + + if(address >= 0x8000 && address <= 0x9fff) + return false; + + if(address >= 0xc000) + return false; + + if(code[7] == 0 || code[8] == '0') + return true; + + int compare = (GBCHEAT_HEX_VALUE(code[8]) << 4) + + (GBCHEAT_HEX_VALUE(code[10])); + compare = compare ^ 0xff; + compare = (compare >> 2) | ( (compare << 6) & 0xc0); + compare ^= 0x45; + + int cloak = (GBCHEAT_HEX_VALUE(code[8])) ^ (GBCHEAT_HEX_VALUE(code[9])); + + if(cloak >=1 && cloak <= 7) + return false; + + return true; +} + +void gbAddGgCheat(const char *code, const char *desc) +{ + if(gbCheatNumber > 99) { + systemMessage(MSG_MAXIMUM_NUMBER_OF_CHEATS, + N_("Maximum number of cheats reached.")); + return; + } + + if(!gbVerifyGgCode(code)) { + systemMessage(MSG_INVALID_GAMEGENIE_CODE, + N_("Invalid GameGenie code: %s"), code); + return; + } + + int i = gbCheatNumber; + + int len = strlen(code); + + strcpy(gbCheatList[i].cheatCode, code); + strcpy(gbCheatList[i].cheatDesc, desc); + + gbCheatList[i].code = 1; + gbCheatList[i].value = (GBCHEAT_HEX_VALUE(code[0]) << 4) + + GBCHEAT_HEX_VALUE(code[1]); + + gbCheatList[i].address = (GBCHEAT_HEX_VALUE(code[2]) << 8) + + (GBCHEAT_HEX_VALUE(code[4]) << 4) + + (GBCHEAT_HEX_VALUE(code[5])) + + ((GBCHEAT_HEX_VALUE(code[6]) ^ 0x0f) << 12); + + gbCheatList[i].compare = 0; + + if(len != 7 && len != 8) { + + int compare = (GBCHEAT_HEX_VALUE(code[8]) << 4) + + (GBCHEAT_HEX_VALUE(code[10])); + compare = compare ^ 0xff; + compare = (compare >> 2) | ( (compare << 6) & 0xc0); + compare ^= 0x45; + + gbCheatList[i].compare = compare; + gbCheatList[i].code = 0; + } + + gbCheatList[i].enabled = true; + + gbCheatMap[gbCheatList[i].address] = true; + + gbCheatNumber++; +} + +void gbCheatRemove(int i) +{ + if(i < 0 || i >= gbCheatNumber) { + systemMessage(MSG_INVALID_CHEAT_TO_REMOVE, + N_("Invalid cheat to remove %d"), i); + return; + } + + if((i+1) < gbCheatNumber) { + memcpy(&gbCheatList[i], &gbCheatList[i+1], sizeof(gbCheat)* + (gbCheatNumber-i-1)); + } + + gbCheatNumber--; + + gbCheatUpdateMap(); +} + +void gbCheatRemoveAll() +{ + gbCheatNumber = 0; + gbCheatUpdateMap(); +} + +void gbCheatEnable(int i) +{ + if(i >=0 && i < gbCheatNumber) { + if(!gbCheatList[i].enabled) { + gbCheatList[i].enabled = true; + gbCheatUpdateMap(); + } + } +} + +void gbCheatDisable(int i) +{ + if(i >=0 && i < gbCheatNumber) { + if(gbCheatList[i].enabled) { + gbCheatList[i].enabled = false; + gbCheatUpdateMap(); + } + } +} + +bool gbCheatReadGSCodeFile(const char *fileName) +{ + FILE *file = fopen(fileName, "rb"); + + if(!file) { + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), fileName); + return false; + } + + fseek(file, 0x18, SEEK_SET); + int count = 0; + fread(&count, 1, 2, file); + int dummy = 0; + gbCheatRemoveAll(); + char desc[13]; + char code[9]; + int i; + for(i = 0; i < count; i++) { + fread(&dummy, 1, 2, file); + fread(desc, 1, 12, file); + desc[12] = 0; + fread(code, 1, 8, file); + code[8] = 0; + gbAddGsCheat(code, desc); + } + + for(i = 0; i < gbCheatNumber; i++) + gbCheatDisable(i); + + fclose(file); + return true; +} + +u8 gbCheatRead(u16 address) +{ + if(!cheatsEnabled) + return gbMemoryMap[address>>12][address & 0xFFF]; + + for(int i = 0; i < gbCheatNumber; i++) { + if(gbCheatList[i].enabled && gbCheatList[i].address == address) { + switch(gbCheatList[i].code) { + case 0x100: // GameGenie support + if(gbMemoryMap[address>>12][address&0xFFF] == gbCheatList[i].compare) + return gbCheatList[i].value; + break; + case 0x00: + case 0x01: + case 0x80: + return gbCheatList[i].value; + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + if(address >= 0xd000 && address < 0xe000) { + if(((gbMemoryMap[0x0d] - gbWram)/0x1000) == + (gbCheatList[i].code - 0x90)) + return gbCheatList[i].value; + } else + return gbCheatList[i].value; + } + } + } + return gbMemoryMap[address>>12][address&0xFFF]; +} diff --git a/src/gb/gbCheats.h b/src/gb/gbCheats.h new file mode 100644 index 0000000..3845a53 --- /dev/null +++ b/src/gb/gbCheats.h @@ -0,0 +1,58 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_GB_GBCHEATS_H +#define __VBA_GB_GBCHEATS_H + +#include "../System.h" + +struct gbXxCheat { + char cheatDesc[100]; + char cheatCode[20]; +}; + +struct gbCheat { + char cheatCode[20]; + char cheatDesc[32]; + u16 address; + int code; + u8 compare; + u8 value; + bool enabled; +}; + +extern void gbCheatsSaveGame(gzFile); +extern void gbCheatsReadGame(gzFile, int); +extern void gbCheatsSaveCheatList(const char *); +extern bool gbCheatsLoadCheatList(const char *); +extern bool gbCheatReadGSCodeFile(const char *); + +extern void gbAddGsCheat(const char *, const char*); +extern void gbAddGgCheat(const char *, const char*); +extern void gbCheatRemove(int); +extern void gbCheatRemoveAll(); +extern void gbCheatEnable(int); +extern void gbCheatDisable(int); +extern u8 gbCheatRead(u16); + +extern int gbCheatNumber; +extern gbCheat gbCheatList[100]; +extern bool gbCheatMap[0x10000]; +#endif + diff --git a/src/gb/gbCodes.h b/src/gb/gbCodes.h new file mode 100644 index 0000000..43c4519 --- /dev/null +++ b/src/gb/gbCodes.h @@ -0,0 +1,1407 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + case 0x00: + // NOP + break; + case 0x01: + // LD BC, NNNN + BC.B.B0=gbReadMemory(PC.W++); + BC.B.B1=gbReadMemory(PC.W++); + break; + case 0x02: + // LD (BC),A + gbWriteMemory(BC.W,AF.B.B1); + break; + case 0x03: + // INC BC + BC.W++; + break; + case 0x04: + // INC B + BC.B.B1++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[BC.B.B1]| (BC.B.B1&0x0F? 0:H_FLAG); + break; + case 0x05: + // DEC B + BC.B.B1--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[BC.B.B1]| + ((BC.B.B1&0x0F)==0x0F? H_FLAG:0); + break; + case 0x06: + // LD B, NN + BC.B.B1=gbReadOpcode(PC.W++); + break; + case 0x07: + // RLCA + tempValue=AF.B.B1&0x80? C_FLAG:0; + AF.B.B1=(AF.B.B1<<1)|(AF.B.B1>>7); + AF.B.B0=tempValue; + break; + case 0x08: + // LD (NNNN), SP + tempRegister.B.B0=gbReadOpcode(PC.W++); + tempRegister.B.B1=gbReadOpcode(PC.W++); + gbWriteMemory(tempRegister.W++,SP.B.B0); + gbWriteMemory(tempRegister.W,SP.B.B1); + break; + case 0x09: + // ADD HL,BC + tempRegister.W=(HL.W+BC.W)&0xFFFF; + AF.B.B0= (AF.B.B0 & Z_FLAG)| ((HL.W^BC.W^tempRegister.W)&0x1000? H_FLAG:0)| + (((long)HL.W+(long)BC.W)&0x10000? C_FLAG:0); + HL.W=tempRegister.W; + break; + case 0x0a: + // LD A,(BC) + AF.B.B1=gbReadMemory(BC.W); + break; + case 0x0b: + // DEC BC + BC.W--; + break; + case 0x0c: + // INC C + BC.B.B0++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[BC.B.B0]| (BC.B.B0&0x0F? 0:H_FLAG); + break; + case 0x0d: + // DEC C + BC.B.B0--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[BC.B.B0]| + ((BC.B.B0&0x0F)==0x0F? H_FLAG:0); + break; + case 0x0e: + // LD C, NN + BC.B.B0=gbReadOpcode(PC.W++); + break; + case 0x0f: + // RRCA + tempValue=AF.B.B1&0x01; + AF.B.B1=(AF.B.B1>>1)|(tempValue? 0x80:0); + AF.B.B0=(tempValue<<4); + break; + case 0x10: + // STOP + opcode = gbReadOpcode(PC.W++); + if(gbCgbMode) { + if(gbMemory[0xff4d] & 1) { + gbSpeedSwitch(); + + if(gbSpeed == 0) + gbMemory[0xff4d] = 0x00; + else + gbMemory[0xff4d] = 0x80; + } + } + break; + case 0x11: + // LD DE, NNNN + DE.B.B0=gbReadMemory(PC.W++); + DE.B.B1=gbReadMemory(PC.W++); + break; + case 0x12: + // LD (DE),A + gbWriteMemory(DE.W,AF.B.B1); + break; + case 0x13: + // INC DE + DE.W++; + break; + case 0x14: + // INC D + DE.B.B1++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[DE.B.B1]| (DE.B.B1&0x0F? 0:H_FLAG); + break; + case 0x15: + // DEC D + DE.B.B1--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[DE.B.B1]| + ((DE.B.B1&0x0F)==0x0F? H_FLAG:0); + break; + case 0x16: + // LD D,NN + DE.B.B1=gbReadOpcode(PC.W++); + break; + case 0x17: + // RLA + tempValue=AF.B.B1&0x80? C_FLAG:0; + AF.B.B1=(AF.B.B1<<1)|((AF.B.B0&C_FLAG)>>4); + AF.B.B0=tempValue; + break; + case 0x18: + // JR NN + PC.W+=(s8)gbReadMemory(PC.W)+1; + break; + case 0x19: + // ADD HL,DE + tempRegister.W=(HL.W+DE.W)&0xFFFF; + AF.B.B0= (AF.B.B0 & Z_FLAG)| ((HL.W^DE.W^tempRegister.W)&0x1000? H_FLAG:0)| + (((long)HL.W+(long)DE.W)&0x10000? C_FLAG:0); + HL.W=tempRegister.W; + break; + case 0x1a: + // LD A,(DE) + AF.B.B1=gbReadMemory(DE.W); + break; + case 0x1b: + // DEC DE + DE.W--; + break; + case 0x1c: + // INC E + DE.B.B0++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[DE.B.B0]| (DE.B.B0&0x0F? 0:H_FLAG); + break; + case 0x1d: + // DEC E + DE.B.B0--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[DE.B.B0]| + ((DE.B.B0&0x0F)==0x0F? H_FLAG:0); + break; + case 0x1e: + // LD E,NN + DE.B.B0=gbReadOpcode(PC.W++); + break; + case 0x1f: + // RRA + tempValue=AF.B.B1&0x01; + AF.B.B1=(AF.B.B1>>1)|(AF.B.B0&C_FLAG? 0x80:0); + AF.B.B0=(tempValue<<4); + break; + case 0x20: + // JR NZ,NN + if(AF.B.B0&Z_FLAG) + PC.W++; + else { + PC.W+=(s8)gbReadMemory(PC.W)+1; + clockTicks++; + } + break; + case 0x21: + // LD HL,NNNN + HL.B.B0=gbReadMemory(PC.W++); + HL.B.B1=gbReadMemory(PC.W++); + break; + case 0x22: + // LDI (HL),A + gbWriteMemory(HL.W++,AF.B.B1); + break; + case 0x23: + // INC HL + HL.W++; + break; + case 0x24: + // INC H + HL.B.B1++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[HL.B.B1]| (HL.B.B1&0x0F? 0:H_FLAG); + break; + case 0x25: + // DEC H + HL.B.B1--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[HL.B.B1]| + ((HL.B.B1&0x0F)==0x0F? H_FLAG:0); + break; + case 0x26: + // LD H,NN + HL.B.B1=gbReadOpcode(PC.W++); + break; + case 0x27: + // DAA + tempRegister.W=AF.B.B1; + if(AF.B.B0&C_FLAG) tempRegister.W|=256; + if(AF.B.B0&H_FLAG) tempRegister.W|=512; + if(AF.B.B0&N_FLAG) tempRegister.W|=1024; + AF.W=DAATable[tempRegister.W]; + break; + case 0x28: + // JR Z,NN + if(AF.B.B0&Z_FLAG) { + PC.W+=(s8)gbReadMemory(PC.W)+1; + clockTicks++; + } else + PC.W++; + break; + case 0x29: + // ADD HL,HL + tempRegister.W=(HL.W+HL.W)&0xFFFF; AF.B.B0= (AF.B.B0 & Z_FLAG)| + ((HL.W^HL.W^tempRegister.W)&0x1000? H_FLAG:0)| + (((long)HL.W+(long)HL.W)&0x10000? C_FLAG:0); + HL.W=tempRegister.W; + break; + case 0x2a: + // LDI A,(HL) + AF.B.B1 = gbReadMemory(HL.W++); + break; + case 0x2b: + // DEC HL + HL.W--; + break; + case 0x2c: + // INC L + HL.B.B0++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[HL.B.B0]| (HL.B.B0&0x0F? 0:H_FLAG); + break; + case 0x2d: + // DEC L + HL.B.B0--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[HL.B.B0]| + ((HL.B.B0&0x0F)==0x0F? H_FLAG:0); + break; + case 0x2e: + // LD L,NN + HL.B.B0=gbReadOpcode(PC.W++); + break; + case 0x2f: + // CPL + AF.B.B1 ^= 255; + AF.B.B0|=N_FLAG|H_FLAG; + break; + case 0x30: + // JR NC,NN + if(AF.B.B0&C_FLAG) + PC.W++; + else { + PC.W+=(s8)gbReadMemory(PC.W)+1; + clockTicks++; + } + break; + case 0x31: + // LD SP,NNNN + SP.B.B0=gbReadMemory(PC.W++); + SP.B.B1=gbReadMemory(PC.W++); + break; + case 0x32: + // LDD (HL),A + gbWriteMemory(HL.W--,AF.B.B1); + break; + case 0x33: + // INC SP + SP.W++; + break; + case 0x34: + // INC (HL) + tempValue=gbReadMemory(HL.W)+1; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[tempValue]| (tempValue&0x0F? 0:H_FLAG); + gbWriteMemory(HL.W,tempValue); + break; + case 0x35: + // DEC (HL) + tempValue=gbReadMemory(HL.W)-1; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[tempValue]| + ((tempValue&0x0F)==0x0F? H_FLAG:0);gbWriteMemory(HL.W,tempValue); + break; + case 0x36: + // LD (HL),NN + gbWriteMemory(HL.W,gbReadOpcode(PC.W++)); + break; + case 0x37: + // SCF + AF.B.B0 = AF.B.B0 & Z_FLAG | C_FLAG; + break; +case 0x38: + // JR C,NN + if(AF.B.B0&C_FLAG) { + PC.W+=(s8)gbReadMemory(PC.W)+1; + clockTicks ++; + } else + PC.W++; + break; + case 0x39: + // ADD HL,SP + tempRegister.W=(HL.W+SP.W)&0xFFFF; + AF.B.B0= (AF.B.B0 & Z_FLAG)| ((HL.W^SP.W^tempRegister.W)&0x1000? H_FLAG:0)| + (((long)HL.W+(long)SP.W)&0x10000? C_FLAG:0); + HL.W=tempRegister.W; + break; + case 0x3a: + // LDD A,(HL) + AF.B.B1 = gbReadMemory(HL.W--); + break; + case 0x3b: + // DEC SP + SP.W--; + break; + case 0x3c: + // INC A + AF.B.B1++; + AF.B.B0= (AF.B.B0 & C_FLAG)|ZeroTable[AF.B.B1]| (AF.B.B1&0x0F? 0:H_FLAG); + break; + case 0x3d: + // DEC A + AF.B.B1--; + AF.B.B0= N_FLAG|(AF.B.B0 & C_FLAG)|ZeroTable[AF.B.B1]| + ((AF.B.B1&0x0F)==0x0F? H_FLAG:0); + break; + case 0x3e: + // LD A,NN + AF.B.B1=gbReadOpcode(PC.W++); + break; + case 0x3f: + // CCF + AF.B.B0^=C_FLAG;AF.B.B0&=~(N_FLAG|H_FLAG); + break; + case 0x40: + // LD B,B + BC.B.B1=BC.B.B1; + break; + case 0x41: + // LD B,C + BC.B.B1=BC.B.B0; + break; + case 0x42: + // LD B,D + BC.B.B1=DE.B.B1; + break; + case 0x43: + // LD B,E + BC.B.B1=DE.B.B0; + break; + case 0x44: + // LD B,H + BC.B.B1=HL.B.B1; + break; + case 0x45: + // LD B,L + BC.B.B1=HL.B.B0; + break; + case 0x46: + // LD B,(HL) + BC.B.B1=gbReadMemory(HL.W); + break; + case 0x47: + // LD B,A + BC.B.B1=AF.B.B1; + break; + case 0x48: + // LD C,B + BC.B.B0=BC.B.B1; + break; + case 0x49: + // LD C,C + BC.B.B0=BC.B.B0; + break; + case 0x4a: + // LD C,D + BC.B.B0=DE.B.B1; + break; + case 0x4b: + // LD C,E + BC.B.B0=DE.B.B0; + break; + case 0x4c: + // LD C,H + BC.B.B0=HL.B.B1; + break; + case 0x4d: + // LD C,L + BC.B.B0=HL.B.B0; + break; + case 0x4e: + // LD C,(HL) + BC.B.B0=gbReadMemory(HL.W); + break; + case 0x4f: + // LD C,A + BC.B.B0=AF.B.B1; + break; + case 0x50: + // LD D,B + DE.B.B1=BC.B.B1; + break; + case 0x51: + // LD D,C + DE.B.B1=BC.B.B0; + break; + case 0x52: + // LD D,D + DE.B.B1=DE.B.B1; + break; + case 0x53: + // LD D,E + DE.B.B1=DE.B.B0; + break; + case 0x54: + // LD D,H + DE.B.B1=HL.B.B1; + break; + case 0x55: + // LD D,L + DE.B.B1=HL.B.B0; + break; + case 0x56: + // LD D,(HL) + DE.B.B1=gbReadMemory(HL.W); + break; + case 0x57: + // LD D,A + DE.B.B1=AF.B.B1; + break; + case 0x58: + // LD E,B + DE.B.B0=BC.B.B1; + break; + case 0x59: + // LD E,C + DE.B.B0=BC.B.B0; + break; + case 0x5a: + // LD E,D + DE.B.B0=DE.B.B1; + break; + case 0x5b: + // LD E,E + DE.B.B0=DE.B.B0; + break; + case 0x5c: + // LD E,H + DE.B.B0=HL.B.B1; + break; + case 0x5d: + // LD E,L + DE.B.B0=HL.B.B0; + break; + case 0x5e: + // LD E,(HL) + DE.B.B0=gbReadMemory(HL.W); + break; + case 0x5f: + // LD E,A + DE.B.B0=AF.B.B1; + break; + case 0x60: + // LD H,B + HL.B.B1=BC.B.B1; + break; + case 0x61: + // LD H,C + HL.B.B1=BC.B.B0; + break; + case 0x62: + // LD H,D + HL.B.B1=DE.B.B1; + break; + case 0x63: + // LD H,E + HL.B.B1=DE.B.B0; + break; + case 0x64: + // LD H,H + HL.B.B1=HL.B.B1; + break; + case 0x65: + // LD H,L + HL.B.B1=HL.B.B0; + break; + case 0x66: + // LD H,(HL) + HL.B.B1=gbReadMemory(HL.W); + break; + case 0x67: + // LD H,A + HL.B.B1=AF.B.B1; + break; + case 0x68: + // LD L,B + HL.B.B0=BC.B.B1; + break; + case 0x69: + // LD L,C + HL.B.B0=BC.B.B0; + break; + case 0x6a: + // LD L,D + HL.B.B0=DE.B.B1; + break; + case 0x6b: + // LD L,E + HL.B.B0=DE.B.B0; + break; + case 0x6c: + // LD L,H + HL.B.B0=HL.B.B1; + break; + case 0x6d: + // LD L,L + HL.B.B0=HL.B.B0; + break; + case 0x6e: + // LD L,(HL) + HL.B.B0=gbReadMemory(HL.W); + break; + case 0x6f: + // LD L,A + HL.B.B0=AF.B.B1; + break; + case 0x70: + // LD (HL),B + gbWriteMemory(HL.W,BC.B.B1); + break; + case 0x71: + // LD (HL),C + gbWriteMemory(HL.W,BC.B.B0); + break; + case 0x72: + // LD (HL),D + gbWriteMemory(HL.W,DE.B.B1); + break; + case 0x73: + // LD (HL),E + gbWriteMemory(HL.W,DE.B.B0); + break; + case 0x74: + // LD (HL),H + gbWriteMemory(HL.W,HL.B.B1); + break; + case 0x75: + // LD (HL),L + gbWriteMemory(HL.W,HL.B.B0); + break; + case 0x76: + // HALT + if(IFF & 1) { + PC.W--; + IFF |= 0x80; + } else { + if((register_IE & register_IF) > 0) + IFF |= 0x100; + else { + PC.W--; + IFF |= 0x81; + } + } + break; + case 0x77: + // LD (HL),A + gbWriteMemory(HL.W,AF.B.B1); + break; + case 0x78: + // LD A,B + AF.B.B1=BC.B.B1; + break; + case 0x79: + // LD A,C + AF.B.B1=BC.B.B0; + break; + case 0x7a: + // LD A,D + AF.B.B1=DE.B.B1; + break; + case 0x7b: + // LD A,E + AF.B.B1=DE.B.B0; + break; + case 0x7c: + // LD A,H + AF.B.B1=HL.B.B1; + break; + case 0x7d: + // LD A,L + AF.B.B1=HL.B.B0; + break; + case 0x7e: + // LD A,(HL) + AF.B.B1=gbReadMemory(HL.W); + break; + case 0x7f: + // LD A,A + AF.B.B1=AF.B.B1; + break; + case 0x80: + // ADD B + tempRegister.W=AF.B.B1+BC.B.B1; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B1^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x81: + // ADD C + tempRegister.W=AF.B.B1+BC.B.B0; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B0^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x82: + // ADD D + tempRegister.W=AF.B.B1+DE.B.B1; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B1^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x83: + // ADD E + tempRegister.W=AF.B.B1+DE.B.B0; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B0^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x84: + // ADD H + tempRegister.W=AF.B.B1+HL.B.B1; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B1^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x85: + // ADD L + tempRegister.W=AF.B.B1+HL.B.B0; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B0^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x86: + // ADD (HL) + tempValue=gbReadMemory(HL.W); + tempRegister.W=AF.B.B1+tempValue; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x87: + // ADD A + tempRegister.W=AF.B.B1+AF.B.B1; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^AF.B.B1^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x88: + // ADC B: + tempRegister.W=AF.B.B1+BC.B.B1+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x89: + // ADC C + tempRegister.W=AF.B.B1+BC.B.B0+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x8a: + // ADC D + tempRegister.W=AF.B.B1+DE.B.B1+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x8b: + // ADC E + tempRegister.W=AF.B.B1+DE.B.B0+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x8c: + // ADC H + tempRegister.W=AF.B.B1+HL.B.B1+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); AF.B.B1=tempRegister.B.B0; + break; + case 0x8d: + // ADC L + tempRegister.W=AF.B.B1+HL.B.B0+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x8e: + // ADC (HL) + tempValue=gbReadMemory(HL.W); + tempRegister.W=AF.B.B1+tempValue+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x8f: + // ADC A + tempRegister.W=AF.B.B1+AF.B.B1+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^AF.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x90: + // SUB B + tempRegister.W=AF.B.B1-BC.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x91: + // SUB C + tempRegister.W=AF.B.B1-BC.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x92: + // SUB D + tempRegister.W=AF.B.B1-DE.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x93: + // SUB E + tempRegister.W=AF.B.B1-DE.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x94: + // SUB H + tempRegister.W=AF.B.B1-HL.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x95: + // SUB L + tempRegister.W=AF.B.B1-HL.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x96: + // SUB (HL) + tempValue=gbReadMemory(HL.W); + tempRegister.W=AF.B.B1-tempValue; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x97: + // SUB A + AF.B.B1=0; + AF.B.B0=N_FLAG|Z_FLAG; + break; + case 0x98: + // SBC B + tempRegister.W=AF.B.B1-BC.B.B1-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x99: + // SBC C + tempRegister.W=AF.B.B1-BC.B.B0-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9a: + // SBC D + tempRegister.W=AF.B.B1-DE.B.B1-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9b: + // SBC E + tempRegister.W=AF.B.B1-DE.B.B0-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9c: + // SBC H + tempRegister.W=AF.B.B1-HL.B.B1-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9d: + // SBC L + tempRegister.W=AF.B.B1-HL.B.B0-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9e: + // SBC (HL) + tempValue=gbReadMemory(HL.W); + tempRegister.W=AF.B.B1-tempValue-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0x9f: + // SBC A + tempRegister.W=AF.B.B1-AF.B.B1-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^AF.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0xa0: + // AND B + AF.B.B1&=BC.B.B1; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa1: + // AND C + AF.B.B1&=BC.B.B0; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa2: + // AND_D + AF.B.B1&=DE.B.B1; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa3: + // AND E + AF.B.B1&=DE.B.B0; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa4: + // AND H + AF.B.B1&=HL.B.B1; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa5: + // AND L + AF.B.B1&=HL.B.B0; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa6: + // AND (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B1&=tempValue; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa7: + // AND A + AF.B.B1&=AF.B.B1; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xa8: + // XOR B + AF.B.B1^=BC.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xa9: + // XOR C + AF.B.B1^=BC.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xaa: + // XOR D + AF.B.B1^=DE.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xab: + // XOR E + AF.B.B1^=DE.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xac: + // XOR H + AF.B.B1^=HL.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xad: + // XOR L + AF.B.B1^=HL.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xae: + // XOR (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B1^=tempValue; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xaf: + // XOR A + AF.B.B1=0; + AF.B.B0=Z_FLAG; + break; + case 0xb0: + // OR B + AF.B.B1|=BC.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb1: + // OR C + AF.B.B1|=BC.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb2: + // OR D + AF.B.B1|=DE.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb3: + // OR E + AF.B.B1|=DE.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb4: + // OR H + AF.B.B1|=HL.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb5: + // OR L + AF.B.B1|=HL.B.B0; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb6: + // OR (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B1|=tempValue; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb7: + // OR A + AF.B.B1|=AF.B.B1; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xb8: + // CP B: + tempRegister.W=AF.B.B1-BC.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xb9: + // CP C + tempRegister.W=AF.B.B1-BC.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^BC.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xba: + // CP D + tempRegister.W=AF.B.B1-DE.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xbb: + // CP E + tempRegister.W=AF.B.B1-DE.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^DE.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xbc: + // CP H + tempRegister.W=AF.B.B1-HL.B.B1; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B1^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xbd: + // CP L + tempRegister.W=AF.B.B1-HL.B.B0; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^HL.B.B0^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xbe: + // CP (HL) + tempValue=gbReadMemory(HL.W); + tempRegister.W=AF.B.B1-tempValue; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xbf: + // CP A + AF.B.B0=N_FLAG|Z_FLAG; + break; + case 0xc0: + // RET NZ + if(!(AF.B.B0&Z_FLAG)) { + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + clockTicks += 3; + } + break; + case 0xc1: + // POP BC + BC.B.B0=gbReadMemory(SP.W++); + BC.B.B1=gbReadMemory(SP.W++); + break; + case 0xc2: + // JP NZ,NNNN + if(AF.B.B0&Z_FLAG) + PC.W+=2; + else { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W); + PC.W=tempRegister.W; + clockTicks++; + } + break; + case 0xc3: + // JP NNNN + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W); + PC.W=tempRegister.W; + break; + case 0xc4: + // CALL NZ,NNNN + if(AF.B.B0&Z_FLAG) + PC.W+=2; + else { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W++); + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=tempRegister.W; + clockTicks += 3; + } + break; + case 0xc5: + // PUSH BC + gbWriteMemory(--SP.W,BC.B.B1); + gbWriteMemory(--SP.W,BC.B.B0); + break; + case 0xc6: + // ADD NN + tempValue=gbReadOpcode(PC.W++); + tempRegister.W=AF.B.B1+tempValue; + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10 ? H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0xc7: + // RST 00 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0000; + break; + case 0xc8: + // RET Z + if(AF.B.B0&Z_FLAG) { + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + clockTicks += 3; + } + break; + case 0xc9: + // RET + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + break; + case 0xca: + // JP Z,NNNN + if(AF.B.B0&Z_FLAG) { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W); + PC.W=tempRegister.W; + clockTicks++; + } else + PC.W+=2; + break; + // CB done outside + case 0xcc: + // CALL Z,NNNN + if(AF.B.B0&Z_FLAG) { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W++); + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=tempRegister.W; + clockTicks += 3; + } else + PC.W+=2; + break; + case 0xcd: + // CALL NNNN + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W++); + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=tempRegister.W; + break; + case 0xce: + // ADC NN + tempValue=gbReadOpcode(PC.W++); + tempRegister.W=AF.B.B1+tempValue+(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= (tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0xcf: + // RST 08 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0008; + break; + case 0xd0: + // RET NC + if(!(AF.B.B0&C_FLAG)) { + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + clockTicks += 3; + } + break; + case 0xd1: + // POP DE + DE.B.B0=gbReadMemory(SP.W++); + DE.B.B1=gbReadMemory(SP.W++); + break; + case 0xd2: + // JP NC,NNNN + if(AF.B.B0&C_FLAG) + PC.W+=2; + else { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W); + PC.W=tempRegister.W; + clockTicks++; + } + break; + // D3 illegal + case 0xd4: + // CALL NC,NNNN + if(AF.B.B0&C_FLAG) + PC.W+=2; + else { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W++); + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=tempRegister.W; + clockTicks += 3; + } + break; + case 0xd5: + // PUSH DE + gbWriteMemory(--SP.W,DE.B.B1); + gbWriteMemory(--SP.W,DE.B.B0); + break; + case 0xd6: + // SUB NN + tempValue=gbReadOpcode(PC.W++); + tempRegister.W=AF.B.B1-tempValue; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0xd7: + // RST 10 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0010; + break; + case 0xd8: + // RET C + if(AF.B.B0&C_FLAG) { + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + clockTicks += 4; + } + break; + case 0xd9: + // RETI + PC.B.B0=gbReadMemory(SP.W++); + PC.B.B1=gbReadMemory(SP.W++); + IFF |= 0x01; + break; + case 0xda: + // JP C,NNNN + if(AF.B.B0&C_FLAG) { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W); + PC.W=tempRegister.W; + clockTicks++; + } else + PC.W+=2; + break; + // DB illegal + case 0xdc: + // CALL C,NNNN + if(AF.B.B0&C_FLAG) { + tempRegister.B.B0=gbReadMemory(PC.W++); + tempRegister.B.B1=gbReadMemory(PC.W++); + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=tempRegister.W; + clockTicks += 3; + } else + PC.W+=2; + break; + // DD illegal + case 0xde: + // SBC NN + tempValue=gbReadOpcode(PC.W++); + tempRegister.W=AF.B.B1-tempValue-(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + AF.B.B1=tempRegister.B.B0; + break; + case 0xdf: + // RST 18 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0018; + break; + case 0xe0: + // LD (FF00+NN),A + gbWriteMemory(0xff00 + gbReadOpcode(PC.W++),AF.B.B1); + break; + case 0xe1: + // POP HL + HL.B.B0=gbReadMemory(SP.W++); + HL.B.B1=gbReadMemory(SP.W++); + break; + case 0xe2: + // LD (FF00+C),A + gbWriteMemory(0xff00 + BC.B.B0,AF.B.B1); + break; + // E3 illegal + // E4 illegal + case 0xe5: + // PUSH HL + gbWriteMemory(--SP.W,HL.B.B1); + gbWriteMemory(--SP.W,HL.B.B0); + break; + case 0xe6: + // AND NN + tempValue=gbReadOpcode(PC.W++); + AF.B.B1&=tempValue; + AF.B.B0=H_FLAG|ZeroTable[AF.B.B1]; + break; + case 0xe7: + // RST 20 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0020; + break; + case 0xe8: + // ADD SP,NN + offset = (s8)gbReadOpcode(PC.W++); + + if(offset >= 0) { + tempRegister.W = SP.W + offset; + AF.B.B0 = (SP.W > tempRegister.W ? C_FLAG : 0) | + ((SP.W^offset^tempRegister.W)&0x1000? H_FLAG:0); + SP.W = tempRegister.W; + } else { + tempRegister.W = SP.W + offset; + AF.B.B0 = (SP.W < tempRegister.W ? C_FLAG : 0) | + ((SP.W^offset^tempRegister.W)&0x1000?H_FLAG:0); + SP.W = tempRegister.W; + } + break; + case 0xe9: + // LD PC,HL + PC.W=HL.W; + break; + case 0xea: + // LD (NNNN),A + tempRegister.B.B0=gbReadOpcode(PC.W++); + tempRegister.B.B1=gbReadOpcode(PC.W++); + gbWriteMemory(tempRegister.W,AF.B.B1); + break; + // EB illegal + // EC illegal + // ED illegal + case 0xee: + // XOR NN + tempValue=gbReadOpcode(PC.W++); + AF.B.B1^=tempValue; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xef: + // RST 28 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0028; + break; + case 0xf0: + // LD A,(FF00+NN) + AF.B.B1 = gbReadMemory(0xff00+gbReadOpcode(PC.W++)); + break; + case 0xf1: + // POP AF + AF.B.B0=gbReadMemory(SP.W++); + AF.B.B1=gbReadMemory(SP.W++); + break; + case 0xf2: + // LD A,(FF00+C) + AF.B.B1 = gbReadMemory(0xff00+BC.B.B0); + break; + case 0xf3: + // DI + // IFF&=0xFE; + IFF&=(~0x21); + break; + // F4 illegal + case 0xf5: + // PUSH AF + gbWriteMemory(--SP.W,AF.B.B1); + gbWriteMemory(--SP.W,AF.B.B0); + break; + case 0xf6: + // OR NN + tempValue=gbReadOpcode(PC.W++); + AF.B.B1|=tempValue; + AF.B.B0=ZeroTable[AF.B.B1]; + break; + case 0xf7: + // RST 30 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0030; + break; + case 0xf8: + // LD HL,SP+NN + offset = (s8)gbReadOpcode(PC.W++); + if(offset >= 0) { + tempRegister.W = SP.W + offset; + AF.B.B0 = (SP.W > tempRegister.W ? C_FLAG : 0) | + ((SP.W^offset^tempRegister.W)&0x1000? H_FLAG:0); + HL.W = tempRegister.W; + } else { + tempRegister.W = SP.W + offset; + AF.B.B0 = (SP.W < tempRegister.W ? C_FLAG : 0) | + ((SP.W^offset^tempRegister.W)&0x1000?H_FLAG:0); + HL.W = tempRegister.W; + } + break; + case 0xf9: + // LD SP,HL + SP.W=HL.W; + break; + case 0xfa: + // LD A,(NNNN) + tempRegister.B.B0=gbReadOpcode(PC.W++); + tempRegister.B.B1=gbReadOpcode(PC.W++); + AF.B.B1=gbReadMemory(tempRegister.W); + break; + case 0xfb: + // EI + IFF|=0x20; + break; + // FC illegal + // FD illegal + case 0xfe: + // CP NN + tempValue=gbReadOpcode(PC.W++); + tempRegister.W=AF.B.B1-tempValue; + AF.B.B0= N_FLAG|(tempRegister.B.B1?C_FLAG:0)|ZeroTable[tempRegister.B.B0]| + ((AF.B.B1^tempValue^tempRegister.B.B0)&0x10?H_FLAG:0); + break; + case 0xff: + // RST 38 + gbWriteMemory(--SP.W,PC.B.B1); + gbWriteMemory(--SP.W,PC.B.B0); + PC.W=0x0038; + break; + default: + systemMessage(0, N_("Unknown opcode %02x at %04x"), + gbReadOpcode(PC.W-1),PC.W-1); + emulating = false; + return; diff --git a/src/gb/gbCodesCB.h b/src/gb/gbCodesCB.h new file mode 100644 index 0000000..05dce6e --- /dev/null +++ b/src/gb/gbCodesCB.h @@ -0,0 +1,1288 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + case 0x00: + // RLC B + AF.B.B0 = (BC.B.B1 & 0x80)?C_FLAG:0; + BC.B.B1 = (BC.B.B1<<1) | (BC.B.B1>>7); + AF.B.B0 |= ZeroTable[BC.B.B1]; + break; + case 0x01: + // RLC C + AF.B.B0 = (BC.B.B0 & 0x80)?C_FLAG:0; + BC.B.B0 = (BC.B.B0<<1) | (BC.B.B0>>7); + AF.B.B0 |= ZeroTable[BC.B.B0]; + break; + case 0x02: + // RLC D + AF.B.B0 = (DE.B.B1 & 0x80)?C_FLAG:0; + DE.B.B1 = (DE.B.B1<<1) | (DE.B.B1>>7); + AF.B.B0 |= ZeroTable[DE.B.B1]; + break; + case 0x03: + // RLC E + AF.B.B0 = (DE.B.B0 & 0x80)?C_FLAG:0; + DE.B.B0 = (DE.B.B0<<1) | (DE.B.B0>>7); + AF.B.B0 |= ZeroTable[DE.B.B0]; + break; + case 0x04: + // RLC H + AF.B.B0 = (HL.B.B1 & 0x80)?C_FLAG:0; + HL.B.B1 = (HL.B.B1<<1) | (HL.B.B1>>7); + AF.B.B0 |= ZeroTable[HL.B.B1]; + break; + case 0x05: + // RLC L + AF.B.B0 = (HL.B.B0 & 0x80)?C_FLAG:0; + HL.B.B0 = (HL.B.B0<<1) | (HL.B.B0>>7); + AF.B.B0 |= ZeroTable[HL.B.B0]; + break; + case 0x06: + // RLC (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0 = (tempValue & 0x80)?C_FLAG:0; + tempValue = (tempValue<<1) | (tempValue>>7); + AF.B.B0 |= ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x07: + // RLC A + AF.B.B0 = (AF.B.B1 & 0x80)?C_FLAG:0; + AF.B.B1 = (AF.B.B1<<1) | (AF.B.B1>>7); + AF.B.B0 |= ZeroTable[AF.B.B1]; + break; + case 0x08: + // RRC B + AF.B.B0=(BC.B.B1&0x01 ? C_FLAG : 0); + BC.B.B1=(BC.B.B1>>1)|(BC.B.B1<<7); + AF.B.B0|=ZeroTable[BC.B.B1]; + break; + case 0x09: + // RRC C + AF.B.B0=(BC.B.B0&0x01 ? C_FLAG : 0); + BC.B.B0=(BC.B.B0>>1)|(BC.B.B0<<7); + AF.B.B0|=ZeroTable[BC.B.B0]; + break; + case 0x0a: + // RRC D + AF.B.B0=(DE.B.B1&0x01 ? C_FLAG : 0); + DE.B.B1=(DE.B.B1>>1)|(DE.B.B1<<7); + AF.B.B0|=ZeroTable[DE.B.B1]; + break; + case 0x0b: + // RRC E + AF.B.B0=(DE.B.B0&0x01 ? C_FLAG : 0); + DE.B.B0=(DE.B.B0>>1)|(DE.B.B0<<7); + AF.B.B0|=ZeroTable[DE.B.B0]; + break; + case 0x0c: + // RRC H + AF.B.B0=(HL.B.B1&0x01 ? C_FLAG : 0); + HL.B.B1=(HL.B.B1>>1)|(HL.B.B1<<7); + AF.B.B0|=ZeroTable[HL.B.B1]; + break; + case 0x0d: + // RRC L + AF.B.B0=(HL.B.B0&0x01 ? C_FLAG : 0); + HL.B.B0=(HL.B.B0>>1)|(HL.B.B0<<7); + AF.B.B0|=ZeroTable[HL.B.B0]; + break; + case 0x0e: + // RRC (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(tempValue&0x01 ? C_FLAG : 0); + tempValue=(tempValue>>1)|(tempValue<<7); + AF.B.B0|=ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x0f: + // RRC A + AF.B.B0=(AF.B.B1&0x01 ? C_FLAG : 0); + AF.B.B1=(AF.B.B1>>1)|(AF.B.B1<<7); + AF.B.B0|=ZeroTable[AF.B.B1]; + break; + case 0x10: + // RL B + if(BC.B.B1&0x80) { + BC.B.B1=(BC.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[BC.B.B1]|C_FLAG; + } else { + BC.B.B1=(BC.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[BC.B.B1]; + } + break; + case 0x11: + // RL C + if(BC.B.B0&0x80) { + BC.B.B0=(BC.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[BC.B.B0]|C_FLAG; + } else { + BC.B.B0=(BC.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[BC.B.B0]; + } + break; + case 0x12: + // RL D + if(DE.B.B1&0x80) { + DE.B.B1=(DE.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[DE.B.B1]|C_FLAG; + } else { + DE.B.B1=(DE.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[DE.B.B1]; + } + break; + case 0x13: + // RL E + if(DE.B.B0&0x80) { + DE.B.B0=(DE.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[DE.B.B0]|C_FLAG; + } else { + DE.B.B0=(DE.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[DE.B.B0]; + } + break; + case 0x14: + // RL H + if(HL.B.B1&0x80) { + HL.B.B1=(HL.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[HL.B.B1]|C_FLAG; + } else { + HL.B.B1=(HL.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[HL.B.B1]; + } + break; + case 0x15: + // RL L + if(HL.B.B0&0x80) { + HL.B.B0=(HL.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[HL.B.B0]|C_FLAG; + } else { + HL.B.B0=(HL.B.B0<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[HL.B.B0]; + } + break; + case 0x16: + // RL (HL) + tempValue=gbReadMemory(HL.W); + if(tempValue&0x80) { + tempValue=(tempValue<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[tempValue]|C_FLAG; + } else { + tempValue=(tempValue<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[tempValue]; + } + gbWriteMemory(HL.W,tempValue); + break; + case 0x17: + // RL A + if(AF.B.B1&0x80) { + AF.B.B1=(AF.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[AF.B.B1]|C_FLAG; + } else { + AF.B.B1=(AF.B.B1<<1)|(AF.B.B0&C_FLAG ? 1 : 0); + AF.B.B0=ZeroTable[AF.B.B1]; + } + break; + case 0x18: + // RR B + if(BC.B.B1&0x01) { + BC.B.B1=(BC.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[BC.B.B1]|C_FLAG; + } else { + BC.B.B1=(BC.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[BC.B.B1]; + } + break; + case 0x19: + // RR C + if(BC.B.B0&0x01) { + BC.B.B0=(BC.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[BC.B.B0]|C_FLAG; + } else { + BC.B.B0=(BC.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[BC.B.B0]; + } + break; + case 0x1a: + // RR D + if(DE.B.B1&0x01) { + DE.B.B1=(DE.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[DE.B.B1]|C_FLAG; + } else { + DE.B.B1=(DE.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[DE.B.B1]; + } + break; + case 0x1b: + // RR E + if(DE.B.B0&0x01) { + DE.B.B0=(DE.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[DE.B.B0]|C_FLAG; + } else { + DE.B.B0=(DE.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[DE.B.B0]; + } + break; + case 0x1c: + // RR H + if(HL.B.B1&0x01) { + HL.B.B1=(HL.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[HL.B.B1]|C_FLAG; + } else { + HL.B.B1=(HL.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[HL.B.B1]; + } + break; + case 0x1d: + // RR L + if(HL.B.B0&0x01) { + HL.B.B0=(HL.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[HL.B.B0]|C_FLAG; + } else { + HL.B.B0=(HL.B.B0>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[HL.B.B0]; + } + break; + case 0x1e: + // RR (HL) + tempValue=gbReadMemory(HL.W); + if(tempValue&0x01) { + tempValue=(tempValue>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[tempValue]|C_FLAG; + } else { + tempValue=(tempValue>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[tempValue]; + } + gbWriteMemory(HL.W,tempValue); + break; + case 0x1f: + // RR A + if(AF.B.B1&0x01) { + AF.B.B1=(AF.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[AF.B.B1]|C_FLAG; + } else { + AF.B.B1=(AF.B.B1>>1)|(AF.B.B0 & C_FLAG ? 0x80:0); + AF.B.B0=ZeroTable[AF.B.B1]; + } + break; + case 0x20: + // SLA B + AF.B.B0=(BC.B.B1&0x80?C_FLAG : 0); + BC.B.B1<<=1; + AF.B.B0|=ZeroTable[BC.B.B1]; + break; + case 0x21: + // SLA C + AF.B.B0=(BC.B.B0&0x80?C_FLAG : 0); + BC.B.B0<<=1; + AF.B.B0|=ZeroTable[BC.B.B0]; + break; + case 0x22: + // SLA D + AF.B.B0=(DE.B.B1&0x80?C_FLAG : 0); + DE.B.B1<<=1; + AF.B.B0|=ZeroTable[DE.B.B1]; + break; + case 0x23: + // SLA E + AF.B.B0=(DE.B.B0&0x80?C_FLAG : 0); + DE.B.B0<<=1; + AF.B.B0|=ZeroTable[DE.B.B0]; + break; + case 0x24: + // SLA H + AF.B.B0=(HL.B.B1&0x80?C_FLAG : 0); + HL.B.B1<<=1; + AF.B.B0|=ZeroTable[HL.B.B1]; + break; + case 0x25: + // SLA L + AF.B.B0=(HL.B.B0&0x80?C_FLAG : 0); + HL.B.B0<<=1; + AF.B.B0|=ZeroTable[HL.B.B0]; + break; + case 0x26: + // SLA (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(tempValue&0x80?C_FLAG : 0); + tempValue<<=1; + AF.B.B0|=ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x27: + // SLA A + AF.B.B0=(AF.B.B1&0x80?C_FLAG : 0); + AF.B.B1<<=1; + AF.B.B0|=ZeroTable[AF.B.B1]; + break; + case 0x28: + // SRA B + AF.B.B0=(BC.B.B1&0x01 ? C_FLAG: 0); + BC.B.B1=(BC.B.B1>>1)|(BC.B.B1&0x80); + AF.B.B0|=ZeroTable[BC.B.B1]; + break; + case 0x29: + // SRA C + AF.B.B0=(BC.B.B0&0x01 ? C_FLAG: 0); + BC.B.B0=(BC.B.B0>>1)|(BC.B.B0&0x80); + AF.B.B0|=ZeroTable[BC.B.B0]; + break; + case 0x2a: + // SRA D + AF.B.B0=(DE.B.B1&0x01 ? C_FLAG: 0); + DE.B.B1=(DE.B.B1>>1)|(DE.B.B1&0x80); + AF.B.B0|=ZeroTable[DE.B.B1]; + break; + case 0x2b: + // SRA E + AF.B.B0=(DE.B.B0&0x01 ? C_FLAG: 0); + DE.B.B0=(DE.B.B0>>1)|(DE.B.B0&0x80); + AF.B.B0|=ZeroTable[DE.B.B0]; + break; + case 0x2c: + // SRA H + AF.B.B0=(HL.B.B1&0x01 ? C_FLAG: 0); + HL.B.B1=(HL.B.B1>>1)|(HL.B.B1&0x80); + AF.B.B0|=ZeroTable[HL.B.B1]; + break; + case 0x2d: + // SRA L + AF.B.B0=(HL.B.B0&0x01 ? C_FLAG: 0); + HL.B.B0=(HL.B.B0>>1)|(HL.B.B0&0x80); + AF.B.B0|=ZeroTable[HL.B.B0]; + break; + case 0x2e: + // SRA (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(tempValue&0x01 ? C_FLAG: 0); + tempValue=(tempValue>>1)|(tempValue&0x80); + AF.B.B0|=ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x2f: + // SRA A + AF.B.B0=(AF.B.B1&0x01 ? C_FLAG: 0); + AF.B.B1=(AF.B.B1>>1)|(AF.B.B1&0x80); + AF.B.B0|=ZeroTable[AF.B.B1]; + break; + case 0x30: + // SWAP B + BC.B.B1 = (BC.B.B1&0xf0)>>4 | (BC.B.B1&0x0f)<<4; + AF.B.B0 = ZeroTable[BC.B.B1]; + break; + case 0x31: + // SWAP C + BC.B.B0 = (BC.B.B0&0xf0)>>4 | (BC.B.B0&0x0f)<<4; + AF.B.B0 = ZeroTable[BC.B.B0]; + break; + case 0x32: + // SWAP D + DE.B.B1 = (DE.B.B1&0xf0)>>4 | (DE.B.B1&0x0f)<<4; + AF.B.B0 = ZeroTable[DE.B.B1]; + break; + case 0x33: + // SWAP E + DE.B.B0 = (DE.B.B0&0xf0)>>4 | (DE.B.B0&0x0f)<<4; + AF.B.B0 = ZeroTable[DE.B.B0]; + break; + case 0x34: + // SWAP H + HL.B.B1 = (HL.B.B1&0xf0)>>4 | (HL.B.B1&0x0f)<<4; + AF.B.B0 = ZeroTable[HL.B.B1]; + break; + case 0x35: + // SWAP L + HL.B.B0 = (HL.B.B0&0xf0)>>4 | (HL.B.B0&0x0f)<<4; + AF.B.B0 = ZeroTable[HL.B.B0]; + break; + case 0x36: + // SWAP (HL) + tempValue=gbReadMemory(HL.W); + tempValue = (tempValue&0xf0)>>4 | (tempValue&0x0f)<<4; + AF.B.B0 = ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x37: + // SWAP A + AF.B.B1 = (AF.B.B1&0xf0)>>4 | (AF.B.B1&0x0f)<<4; + AF.B.B0 = ZeroTable[AF.B.B1]; + break; + case 0x38: + // SRL B + AF.B.B0=(BC.B.B1&0x01)?C_FLAG:0; + BC.B.B1>>=1; + AF.B.B0|=ZeroTable[BC.B.B1]; + break; + case 0x39: + // SRL C + AF.B.B0=(BC.B.B0&0x01)?C_FLAG:0; + BC.B.B0>>=1; + AF.B.B0|=ZeroTable[BC.B.B0]; + break; + case 0x3a: + // SRL D + AF.B.B0=(DE.B.B1&0x01)?C_FLAG:0; + DE.B.B1>>=1; + AF.B.B0|=ZeroTable[DE.B.B1]; + break; + case 0x3b: + // SRL E + AF.B.B0=(DE.B.B0&0x01)?C_FLAG:0; + DE.B.B0>>=1; + AF.B.B0|=ZeroTable[DE.B.B0]; + break; + case 0x3c: + // SRL H + AF.B.B0=(HL.B.B1&0x01)?C_FLAG:0; + HL.B.B1>>=1; + AF.B.B0|=ZeroTable[HL.B.B1]; + break; + case 0x3d: + // SRL L + AF.B.B0=(HL.B.B0&0x01)?C_FLAG:0; + HL.B.B0>>=1; + AF.B.B0|=ZeroTable[HL.B.B0]; + break; + case 0x3e: + // SRL (HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(tempValue&0x01)?C_FLAG:0; + tempValue>>=1; + AF.B.B0|=ZeroTable[tempValue]; + gbWriteMemory(HL.W,tempValue); + break; + case 0x3f: + // SRL A + AF.B.B0=(AF.B.B1&0x01)?C_FLAG:0; + AF.B.B1>>=1; + AF.B.B0|=ZeroTable[AF.B.B1]; + break; + case 0x40: + // BIT 0,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<0)? 0:Z_FLAG); + break; + case 0x41: + // BIT 0,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<0)? 0:Z_FLAG); + break; + case 0x42: + // BIT 0,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<0)? 0:Z_FLAG); + break; + case 0x43: + // BIT 0,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<0)? 0:Z_FLAG); + break; + case 0x44: + // BIT 0,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<0)? 0:Z_FLAG); + break; + case 0x45: + // BIT 0,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<0)? 0:Z_FLAG); + break; + case 0x46: + // BIT 0,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<0)? 0:Z_FLAG); + break; + case 0x47: + // BIT 0,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<0)? 0:Z_FLAG); + break; + case 0x48: + // BIT 1,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<1)? 0:Z_FLAG); + break; + case 0x49: + // BIT 1,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<1)? 0:Z_FLAG); + break; + case 0x4a: + // BIT 1,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<1)? 0:Z_FLAG); + break; + case 0x4b: + // BIT 1,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<1)? 0:Z_FLAG); + break; + case 0x4c: + // BIT 1,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<1)? 0:Z_FLAG); + break; + case 0x4d: + // BIT 1,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<1)? 0:Z_FLAG); + break; + case 0x4e: + // BIT 1,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<1)? 0:Z_FLAG); + break; + case 0x4f: + // BIT 1,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<1)? 0:Z_FLAG); + break; + case 0x50: + // BIT 2,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<2)? 0:Z_FLAG); + break; + case 0x51: + // BIT 2,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<2)? 0:Z_FLAG); + break; + case 0x52: + // BIT 2,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<2)? 0:Z_FLAG); + break; + case 0x53: + // BIT 2,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<2)? 0:Z_FLAG); + break; + case 0x54: + // BIT 2,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<2)? 0:Z_FLAG); + break; + case 0x55: + // BIT 2,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<2)? 0:Z_FLAG); + break; + case 0x56: + // BIT 2,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<2)? 0:Z_FLAG); + break; + case 0x57: + // BIT 2,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<2)? 0:Z_FLAG); + break; + case 0x58: + // BIT 3,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<3)? 0:Z_FLAG); + break; + case 0x59: + // BIT 3,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<3)? 0:Z_FLAG); + break; + case 0x5a: + // BIT 3,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<3)? 0:Z_FLAG); + break; + case 0x5b: + // BIT 3,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<3)? 0:Z_FLAG); + break; + case 0x5c: + // BIT 3,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<3)? 0:Z_FLAG); + break; + case 0x5d: + // BIT 3,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<3)? 0:Z_FLAG); + break; + case 0x5e: + // BIT 3,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<3)? 0:Z_FLAG); + break; + case 0x5f: + // BIT 3,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<3)? 0:Z_FLAG); + break; + case 0x60: + // BIT 4,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<4)? 0:Z_FLAG); + break; + case 0x61: + // BIT 4,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<4)? 0:Z_FLAG); + break; + case 0x62: + // BIT 4,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<4)? 0:Z_FLAG); + break; + case 0x63: + // BIT 4,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<4)? 0:Z_FLAG); + break; + case 0x64: + // BIT 4,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<4)? 0:Z_FLAG); + break; + case 0x65: + // BIT 4,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<4)? 0:Z_FLAG); + break; + case 0x66: + // BIT 4,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<4)? 0:Z_FLAG); + break; + case 0x67: + // BIT 4,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<4)? 0:Z_FLAG); + break; + case 0x68: + // BIT 5,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<5)? 0:Z_FLAG); + break; + case 0x69: + // BIT 5,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<5)? 0:Z_FLAG); + break; + case 0x6a: + // BIT 5,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<5)? 0:Z_FLAG); + break; + case 0x6b: + // BIT 5,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<5)? 0:Z_FLAG); + break; + case 0x6c: + // BIT 5,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<5)? 0:Z_FLAG); + break; + case 0x6d: + // BIT 5,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<5)? 0:Z_FLAG); + break; + case 0x6e: + // BIT 5,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<5)? 0:Z_FLAG); + break; + case 0x6f: + // BIT 5,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<5)? 0:Z_FLAG); + break; + case 0x70: + // BIT 6,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<6)? 0:Z_FLAG); + break; + case 0x71: + // BIT 6,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<6)? 0:Z_FLAG); + break; + case 0x72: + // BIT 6,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<6)? 0:Z_FLAG); + break; + case 0x73: + // BIT 6,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<6)? 0:Z_FLAG); + break; + case 0x74: + // BIT 6,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<6)? 0:Z_FLAG); + break; + case 0x75: + // BIT 6,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<6)? 0:Z_FLAG); + break; + case 0x76: + // BIT 6,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<6)? 0:Z_FLAG); + break; + case 0x77: + // BIT 6,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<6)? 0:Z_FLAG); + break; + case 0x78: + // BIT 7,B + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B1&(1<<7)? 0:Z_FLAG); + break; + case 0x79: + // BIT 7,C + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(BC.B.B0&(1<<7)? 0:Z_FLAG); + break; + case 0x7a: + // BIT 7,D + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B1&(1<<7)? 0:Z_FLAG); + break; + case 0x7b: + // BIT 7,E + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(DE.B.B0&(1<<7)? 0:Z_FLAG); + break; + case 0x7c: + // BIT 7,H + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B1&(1<<7)? 0:Z_FLAG); + break; + case 0x7d: + // BIT 7,L + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(HL.B.B0&(1<<7)? 0:Z_FLAG); + break; + case 0x7e: + // BIT 7,(HL) + tempValue=gbReadMemory(HL.W); + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(tempValue&(1<<7)? 0:Z_FLAG); + break; + case 0x7f: + // BIT 7,A + AF.B.B0=(AF.B.B0&C_FLAG)|H_FLAG|(AF.B.B1&(1<<7)? 0:Z_FLAG); + break; + case 0x80: + // RES 0,B + BC.B.B1&=~(1<<0); + break; + case 0x81: + // RES 0,C + BC.B.B0&=~(1<<0); + break; + case 0x82: + // RES 0,D + DE.B.B1&=~(1<<0); + break; + case 0x83: + // RES 0,E + DE.B.B0&=~(1<<0); + break; + case 0x84: + // RES 0,H + HL.B.B1&=~(1<<0); + break; + case 0x85: + // RES 0,L + HL.B.B0&=~(1<<0); + break; + case 0x86: + // RES 0,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<0); + gbWriteMemory(HL.W,tempValue); + break; + case 0x87: + // RES 0,A + AF.B.B1&=~(1<<0); + break; + case 0x88: + // RES 1,B + BC.B.B1&=~(1<<1); + break; + case 0x89: + // RES 1,C + BC.B.B0&=~(1<<1); + break; + case 0x8a: + // RES 1,D + DE.B.B1&=~(1<<1); + break; + case 0x8b: + // RES 1,E + DE.B.B0&=~(1<<1); + break; + case 0x8c: + // RES 1,H + HL.B.B1&=~(1<<1); + break; + case 0x8d: + // RES 1,L + HL.B.B0&=~(1<<1); + break; + case 0x8e: + // RES 1,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<1); + gbWriteMemory(HL.W,tempValue); + break; + case 0x8f: + // RES 1,A + AF.B.B1&=~(1<<1); + break; + case 0x90: + // RES 2,B + BC.B.B1&=~(1<<2); + break; + case 0x91: + // RES 2,C + BC.B.B0&=~(1<<2); + break; + case 0x92: + // RES 2,D + DE.B.B1&=~(1<<2); + break; + case 0x93: + // RES 2,E + DE.B.B0&=~(1<<2); + break; + case 0x94: + // RES 2,H + HL.B.B1&=~(1<<2); + break; + case 0x95: + // RES 2,L + HL.B.B0&=~(1<<2); + break; + case 0x96: + // RES 2,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<2); + gbWriteMemory(HL.W,tempValue); + break; + case 0x97: + // RES 2,A + AF.B.B1&=~(1<<2); + break; + case 0x98: + // RES 3,B + BC.B.B1&=~(1<<3); + break; + case 0x99: + // RES 3,C + BC.B.B0&=~(1<<3); + break; + case 0x9a: + // RES 3,D + DE.B.B1&=~(1<<3); + break; + case 0x9b: + // RES 3,E + DE.B.B0&=~(1<<3); + break; + case 0x9c: + // RES 3,H + HL.B.B1&=~(1<<3); + break; + case 0x9d: + // RES 3,L + HL.B.B0&=~(1<<3); + break; + case 0x9e: + // RES 3,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<3); + gbWriteMemory(HL.W,tempValue); + break; + case 0x9f: + // RES 3,A + AF.B.B1&=~(1<<3); + break; + case 0xa0: + // RES 4,B + BC.B.B1&=~(1<<4); + break; + case 0xa1: + // RES 4,C + BC.B.B0&=~(1<<4); + break; + case 0xa2: + // RES 4,D + DE.B.B1&=~(1<<4); + break; + case 0xa3: + // RES 4,E + DE.B.B0&=~(1<<4); + break; + case 0xa4: + // RES 4,H + HL.B.B1&=~(1<<4); + break; + case 0xa5: + // RES 4,L + HL.B.B0&=~(1<<4); + break; + case 0xa6: + // RES 4,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<4); + gbWriteMemory(HL.W,tempValue); + break; + case 0xa7: + // RES 4,A + AF.B.B1&=~(1<<4); + break; + case 0xa8: + // RES 5,B + BC.B.B1&=~(1<<5); + break; + case 0xa9: + // RES 5,C + BC.B.B0&=~(1<<5); + break; + case 0xaa: + // RES 5,D + DE.B.B1&=~(1<<5); + break; + case 0xab: + // RES 5,E + DE.B.B0&=~(1<<5); + break; + case 0xac: + // RES 5,H + HL.B.B1&=~(1<<5); + break; + case 0xad: + // RES 5,L + HL.B.B0&=~(1<<5); + break; + case 0xae: + // RES 5,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<5); + gbWriteMemory(HL.W,tempValue); + break; + case 0xaf: + // RES 5,A + AF.B.B1&=~(1<<5); + break; + case 0xb0: + // RES 6,B + BC.B.B1&=~(1<<6); + break; + case 0xb1: + // RES 6,C + BC.B.B0&=~(1<<6); + break; + case 0xb2: + // RES 6,D + DE.B.B1&=~(1<<6); + break; + case 0xb3: + // RES 6,E + DE.B.B0&=~(1<<6); + break; + case 0xb4: + // RES 6,H + HL.B.B1&=~(1<<6); + break; + case 0xb5: + // RES 6,L + HL.B.B0&=~(1<<6); + break; + case 0xb6: + // RES 6,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<6); + gbWriteMemory(HL.W,tempValue); + break; + case 0xb7: + // RES 6,A + AF.B.B1&=~(1<<6); + break; + case 0xb8: + // RES 7,B + BC.B.B1&=~(1<<7); + break; + case 0xb9: + // RES 7,C + BC.B.B0&=~(1<<7); + break; + case 0xba: + // RES 7,D + DE.B.B1&=~(1<<7); + break; + case 0xbb: + // RES 7,E + DE.B.B0&=~(1<<7); + break; + case 0xbc: + // RES 7,H + HL.B.B1&=~(1<<7); + break; + case 0xbd: + // RES 7,L + HL.B.B0&=~(1<<7); + break; + case 0xbe: + // RES 7,(HL) + tempValue=gbReadMemory(HL.W); + tempValue&=~(1<<7); + gbWriteMemory(HL.W,tempValue); + break; + case 0xbf: + // RES 7,A + AF.B.B1&=~(1<<7); + break; + case 0xc0: + // SET 0,B + BC.B.B1|=1<<0; + break; + case 0xc1: + // SET 0,C + BC.B.B0|=1<<0; + break; + case 0xc2: + // SET 0,D + DE.B.B1|=1<<0; + break; + case 0xc3: + // SET 0,E + DE.B.B0|=1<<0; + break; + case 0xc4: + // SET 0,H + HL.B.B1|=1<<0; + break; + case 0xc5: + // SET 0,L + HL.B.B0|=1<<0; + break; + case 0xc6: + // SET 0,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<0; + gbWriteMemory(HL.W,tempValue); + break; + case 0xc7: + // SET 0,A + AF.B.B1|=1<<0; + break; + case 0xc8: + // SET 1,B + BC.B.B1|=1<<1; + break; + case 0xc9: + // SET 1,C + BC.B.B0|=1<<1; + break; + case 0xca: + // SET 1,D + DE.B.B1|=1<<1; + break; + case 0xcb: + // SET 1,E + DE.B.B0|=1<<1; + break; + case 0xcc: + // SET 1,H + HL.B.B1|=1<<1; + break; + case 0xcd: + // SET 1,L + HL.B.B0|=1<<1; + break; + case 0xce: + // SET 1,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<1; + gbWriteMemory(HL.W,tempValue); + break; + case 0xcf: + // SET 1,A + AF.B.B1|=1<<1; + break; + case 0xd0: + // SET 2,B + BC.B.B1|=1<<2; + break; + case 0xd1: + // SET 2,C + BC.B.B0|=1<<2; + break; + case 0xd2: + // SET 2,D + DE.B.B1|=1<<2; + break; + case 0xd3: + // SET 2,E + DE.B.B0|=1<<2; + break; + case 0xd4: + // SET 2,H + HL.B.B1|=1<<2; + break; + case 0xd5: + // SET 2,L + HL.B.B0|=1<<2; + break; + case 0xd6: + // SET 2,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<2; + gbWriteMemory(HL.W,tempValue); + break; + case 0xd7: + // SET 2,A + AF.B.B1|=1<<2; + break; + case 0xd8: + // SET 3,B + BC.B.B1|=1<<3; + break; + case 0xd9: + // SET 3,C + BC.B.B0|=1<<3; + break; + case 0xda: + // SET 3,D + DE.B.B1|=1<<3; + break; + case 0xdb: + // SET 3,E + DE.B.B0|=1<<3; + break; + case 0xdc: + // SET 3,H + HL.B.B1|=1<<3; + break; + case 0xdd: + // SET 3,L + HL.B.B0|=1<<3; + break; + case 0xde: + // SET 3,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<3; + gbWriteMemory(HL.W,tempValue); + break; + case 0xdf: + // SET 3,A + AF.B.B1|=1<<3; + break; + case 0xe0: + // SET 4,B + BC.B.B1|=1<<4; + break; + case 0xe1: + // SET 4,C + BC.B.B0|=1<<4; + break; + case 0xe2: + // SET 4,D + DE.B.B1|=1<<4; + break; + case 0xe3: + // SET 4,E + DE.B.B0|=1<<4; + break; + case 0xe4: + // SET 4,H + HL.B.B1|=1<<4; + break; + case 0xe5: + // SET 4,L + HL.B.B0|=1<<4; + break; + case 0xe6: + // SET 4,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<4; + gbWriteMemory(HL.W,tempValue); + break; + case 0xe7: + // SET 4,A + AF.B.B1|=1<<4; + break; + case 0xe8: + // SET 5,B + BC.B.B1|=1<<5; + break; + case 0xe9: + // SET 5,C + BC.B.B0|=1<<5; + break; + case 0xea: + // SET 5,D + DE.B.B1|=1<<5; + break; + case 0xeb: + // SET 5,E + DE.B.B0|=1<<5; + break; + case 0xec: + // SET 5,H + HL.B.B1|=1<<5; + break; + case 0xed: + // SET 5,L + HL.B.B0|=1<<5; + break; + case 0xee: + // SET 5,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<5; + gbWriteMemory(HL.W,tempValue); + break; + case 0xef: + // SET 5,A + AF.B.B1|=1<<5; + break; + case 0xf0: + // SET 6,B + BC.B.B1|=1<<6; + break; + case 0xf1: + // SET 6,C + BC.B.B0|=1<<6; + break; + case 0xf2: + // SET 6,D + DE.B.B1|=1<<6; + break; + case 0xf3: + // SET 6,E + DE.B.B0|=1<<6; + break; + case 0xf4: + // SET 6,H + HL.B.B1|=1<<6; + break; + case 0xf5: + // SET 6,L + HL.B.B0|=1<<6; + break; + case 0xf6: + // SET 6,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<6; + gbWriteMemory(HL.W,tempValue); + break; + case 0xf7: + // SET 6,A + AF.B.B1|=1<<6; + break; + case 0xf8: + // SET 7,B + BC.B.B1|=1<<7; + break; + case 0xf9: + // SET 7,C + BC.B.B0|=1<<7; + break; + case 0xfa: + // SET 7,D + DE.B.B1|=1<<7; + break; + case 0xfb: + // SET 7,E + DE.B.B0|=1<<7; + break; + case 0xfc: + // SET 7,H + HL.B.B1|=1<<7; + break; + case 0xfd: + // SET 7,L + HL.B.B0|=1<<7; + break; + case 0xfe: + // SET 7,(HL) + tempValue=gbReadMemory(HL.W); + tempValue|=1<<7; + gbWriteMemory(HL.W,tempValue); + break; + case 0xff: + // SET 7,A + AF.B.B1|=1<<7; + break; + default: + systemMessage(0, N_("Unknown opcode %02x at %04x"), + gbReadOpcode(PC.W-1),PC.W-1); + emulating = false; + return; diff --git a/src/gb/gbDis.cpp b/src/gb/gbDis.cpp new file mode 100644 index 0000000..bf85f3a --- /dev/null +++ b/src/gb/gbDis.cpp @@ -0,0 +1,249 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include + +#include "../System.h" +#include "gbGlobals.h" + +typedef struct { + u8 mask; + u8 value; + char *mnen; +} GBOPCODE; + +#define GB_READ(x) gbMemoryMap[(x)>>12][(x)&0xfff] + +static char *registers[] = + { "B", "C", "D", "E", "H", "L", "(HL)", "A" }; + +static char *registers16[] = + { "BC", "DE", "HL", "SP", // for some operations + "BC", "DE", "HL", "AF" }; // for push/pop + +static char *cond[] = + { "NZ", "Z", "NC", "C" }; + +static char hexDigits[16] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' +}; + +static GBOPCODE opcodes[] = { + { 0xff, 0x00, "NOP" }, + { 0xcf, 0x01, "LD %R4,%W" }, + { 0xff, 0x02, "LD (BC),A" }, + { 0xcf, 0x03, "INC %R4" }, + { 0xc7, 0x04, "INC %r3" }, + { 0xc7, 0x05, "DEC %r3" }, + { 0xc7, 0x06, "LD %r3,%B" }, + { 0xff, 0x07, "RLCA" }, + { 0xff, 0x08, "LD (%W),SP" }, + { 0xcf, 0x09, "ADD HL,%R4" }, + { 0xff, 0x0a, "LD A,(BC)" }, + { 0xcf, 0x0b, "DEC %R4" }, + { 0xff, 0x0f, "RRCA" }, + { 0xff, 0x10, "STOP" }, + { 0xff, 0x12, "LD (DE),A" }, + { 0xff, 0x17, "RLA" }, + { 0xff, 0x18, "JR %d" }, + { 0xff, 0x1a, "LD A,(DE)" }, + { 0xff, 0x1f, "RRA" }, + { 0xe7, 0x20, "JR %c3,%d" }, + { 0xff, 0x22, "LDI (HL),A" }, + { 0xff, 0x27, "DAA" }, + { 0xff, 0x2a, "LDI A,(HL)" }, + { 0xff, 0x2f, "CPL" }, + { 0xff, 0x32, "LDD (HL),A" }, + { 0xff, 0x37, "SCF" }, + { 0xff, 0x3a, "LDD A,(HL)" }, + { 0xff, 0x3f, "CCF" }, + { 0xff, 0x76, "HALT" }, + { 0xc0, 0x40, "LD %r3,%r0" }, + { 0xf8, 0x80, "ADD A,%r0" }, + { 0xf8, 0x88, "ADC A,%r0" }, + { 0xf8, 0x90, "SUB %r0" }, + { 0xf8, 0x98, "SBC A,%r0" }, + { 0xf8, 0xa0, "AND %r0" }, + { 0xf8, 0xa8, "XOR %r0" }, + { 0xf8, 0xb0, "OR %r0" }, + { 0xf8, 0xb8, "CP %r0" }, + { 0xe7, 0xc0, "RET %c3" }, + { 0xcf, 0xc1, "POP %t4" }, + { 0xe7, 0xc2, "JP %c3,%W" }, + { 0xff, 0xc3, "JP %W" }, + { 0xe7, 0xc4, "CALL %c3,%W" }, + { 0xcf, 0xc5, "PUSH %t4" }, + { 0xff, 0xc6, "ADD A,%B" }, + { 0xc7, 0xc7, "RST %P" }, + { 0xff, 0xc9, "RET" }, + { 0xff, 0xcd, "CALL %W" }, + { 0xff, 0xce, "ADC %B" }, + { 0xff, 0xd6, "SUB %B" }, + { 0xff, 0xd9, "RETI" }, + { 0xff, 0xde, "SBC %B" }, + { 0xff, 0xe0, "LD (FF%B),A" }, + { 0xff, 0xe2, "LD (FF00h+C),A" }, + { 0xff, 0xe6, "AND %B" }, + { 0xff, 0xe8, "ADD SP,%D" }, + { 0xff, 0xe9, "LD PC,HL" }, + { 0xff, 0xea, "LD (%W),A" }, + { 0xff, 0xee, "XOR %B" }, + { 0xff, 0xf0, "LD A,(FF%B)" }, + { 0xff, 0xf2, "LD A,(FF00h+C)" }, + { 0xff, 0xf3, "DI" }, + { 0xff, 0xf6, "OR %B" }, + { 0xff, 0xf8, "LD HL,SP%D" }, + { 0xff, 0xf9, "LD SP,HL" }, + { 0xff, 0xfa, "LD A,(%W)" }, + { 0xff, 0xfb, "EI" }, + { 0xff, 0xfe, "CP %B" }, + { 0x00, 0x00, "DB %B" } +}; + +static GBOPCODE cbOpcodes[] = { + { 0xf8, 0x00, "RLC %r0" }, + { 0xf8, 0x08, "RRC %r0" }, + { 0xf8, 0x10, "RL %r0" }, + { 0xf8, 0x18, "RR %r0" }, + { 0xf8, 0x20, "SLA %r0" }, + { 0xf8, 0x28, "SRA %r0" }, + { 0xf8, 0x30, "SWAP %r0" }, + { 0xf8, 0x38, "SRL %r0" }, + { 0xc0, 0x40, "BIT %b,%r0" }, + { 0xc0, 0x80, "RES %b,%r0" }, + { 0xc0, 0xc0, "SET %b,%r0" }, + { 0x00, 0x00, "DB CBh,%B" } +}; + +static char *addHex(char *p, u8 value) +{ + *p++ = hexDigits[value >> 4]; + *p++ = hexDigits[value & 15]; + return p; +} + +static char *addHex16(char *p, u16 value) +{ + p = addHex(p, value>>8); + return addHex(p, value & 255); +} + +static char *addStr(char *p, char *s) +{ + while(*s) { + *p++ = *s++; + } + return p; +} + +int gbDis(char *buffer, u16 address) +{ + char *p = buffer; + int instr = 1; + u16 addr = address; + sprintf(p, "%04x ", address); + p += 12; + + u8 opcode = GB_READ(address); + address++; + char *mnen; + GBOPCODE *op; + if(opcode == 0xcb) { + opcode = GB_READ(address); + address++; + instr++; + op = cbOpcodes; + } else { + op = opcodes; + } + while(op->value != (opcode & op->mask)) op++; + mnen = op->mnen; + + u8 b0, b1; + s8 disp; + int shift; + + while(*mnen) { + if(*mnen == '%') { + mnen++; + switch(*mnen++) { + case 'W': + b0 = GB_READ(address); + address++; + b1 = GB_READ(address); + address++; + p = addHex16(p, b0|b1<<8); + instr += 2; + *p++ = 'h'; + break; + case 'B': + p = addHex(p, GB_READ(address)); + *p++ = 'h'; + address++; + instr++; + break; + case 'D': + disp = GB_READ(address); + if(disp >= 0) + *p++ = '+'; + p += sprintf(p, "%d", disp); + instr++; + break; + case 'd': + disp = GB_READ(address); + address++; + p = addHex16(p, address+disp); + *p++ = 'h'; + instr++; + break; + case 'b': + // kind of a hack, but it works :-) + *p++ = hexDigits[(opcode >> 3) & 7]; + break; + case 'r': + shift = *mnen++ - '0'; + p = addStr(p, registers[(opcode >> shift) & 7]); + break; + case 'R': + shift = *mnen++ - '0'; + p = addStr(p, registers16[(opcode >> shift) & 3]); + break; + case 't': + shift = *mnen++ - '0'; + p = addStr(p, registers16[4+((opcode >> shift) & 3)]); + break; + case 'P': + p = addHex(p, ((opcode >> 3) & 7) * 8); + break; + case 'c': + shift = *mnen++ - '0'; + p = addStr(p, cond[(opcode >> shift) & 3]); + break; + } + } else + *p++ = *mnen++; + } + for(int i = 0; i < instr; i++) { + u16 a = addr + i; + addHex(buffer+5+i*2, GB_READ(a)); + } + *p = 0; + return instr; +} diff --git a/src/gb/gbGfx.cpp b/src/gb/gbGfx.cpp new file mode 100644 index 0000000..aa63966 --- /dev/null +++ b/src/gb/gbGfx.cpp @@ -0,0 +1,490 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include + +#include "../GBA.h" +#include "gbGlobals.h" +#include "gbSGB.h" + +u8 gbInvertTab[256] = { + 0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0, + 0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0, + 0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8, + 0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8, + 0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4, + 0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4, + 0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec, + 0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc, + 0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2, + 0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2, + 0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea, + 0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa, + 0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6, + 0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6, + 0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee, + 0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe, + 0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1, + 0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1, + 0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9, + 0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9, + 0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5, + 0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5, + 0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed, + 0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd, + 0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3, + 0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3, + 0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb, + 0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb, + 0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7, + 0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7, + 0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef, + 0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff +}; + +u16 gbLineMix[160]; + +void gbRenderLine() +{ + u8 * bank0; + u8 * bank1; + if(gbCgbMode) { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } else { + bank0 = &gbMemory[0x8000]; + bank1 = NULL; + } + + int tile_map = 0x1800; + if((register_LCDC & 8) != 0) + tile_map = 0x1c00; + + int tile_pattern = 0x0800; + + if((register_LCDC & 16) != 0) + tile_pattern = 0x0000; + + int x = 0; + int y = register_LY; + + if(y >= 144) + return; + + // int yLine = (y + gbBorderRowSkip) * gbBorderLineSkip; + + int sx = register_SCX; + int sy = register_SCY; + + sy+=y; + + sy &= 255; + + int tx = sx >> 3; + int ty = sy >> 3; + + int bx = 1 << (7 - (sx & 7)); + int by = sy & 7; + + int tile_map_line_y = tile_map + ty * 32; + + int tile_map_address = tile_map_line_y + tx; + + u8 attrs = 0; + if(bank1 != NULL) + attrs = bank1[tile_map_address]; + + u8 tile = bank0[tile_map_address]; + + tile_map_address++; + + if((register_LCDC & 16) == 0) { + if(tile < 128) tile += 128; + else tile -= 128; + } + + int tile_pattern_address = tile_pattern + tile * 16 + by*2; + + if(register_LCDC & 0x80) { + if((register_LCDC & 0x01 || gbCgbMode) && (layerSettings & 0x0100)) { + while(x < 160) { + u8 tile_a = 0; + u8 tile_b = 0; + + if(attrs & 0x40) { + tile_pattern_address = tile_pattern + tile * 16 + (7-by)*2; + } + + if(attrs & 0x08) { + tile_a = bank1[tile_pattern_address++]; + tile_b = bank1[tile_pattern_address]; + } else { + tile_a = bank0[tile_pattern_address++]; + tile_b = bank0[tile_pattern_address]; + } + + if(attrs & 0x20) { + tile_a = gbInvertTab[tile_a]; + tile_b = gbInvertTab[tile_b]; + } + + while(bx > 0) { + u8 c = (tile_a & bx) ? 1 : 0; + c += ((tile_b & bx) ? 2 : 0); + + gbLineBuffer[x] = c; // mark the gbLineBuffer color + + if(attrs & 0x80) + gbLineBuffer[x] |= 0x300; + + if(gbCgbMode) { + c = c + (attrs & 7)*4; + } else { + c = gbBgp[c]; + if(gbSgbMode && !gbCgbMode) { + int dx = x >> 3; + int dy = y >> 3; + + int palette = gbSgbATF[dy * 20 + dx]; + + if(c == 0) + palette = 0; + + c = c + 4*palette; + } + } + gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c]] : + gbPalette[c]; + x++; + if(x >= 160) + break; + bx >>= 1; + } + tx++; + if(tx == 32) + tx = 0; + bx = 128; + + if(bank1) + attrs = bank1[tile_map_line_y + tx]; + + tile = bank0[tile_map_line_y + tx]; + + if((register_LCDC & 16) == 0) { + if(tile < 128) tile += 128; + else tile -= 128; + } + tile_pattern_address = tile_pattern + tile * 16 + by * 2; + } + } else { + for(int i = 0; i < 160; i++) { + gbLineMix[i] = gbPalette[0]; + gbLineBuffer[i] = 0; + } + } + + // do the window display + if((register_LCDC & 0x20) && (layerSettings & 0x2000)) { + int wy = register_WY; + + if(y >= wy) { + int wx = register_WX; + wx -= 7; + + if( wx <= 159 && gbWindowLine <= 143) { + + tile_map = 0x1800; + + if((register_LCDC & 0x40) != 0) + tile_map = 0x1c00; + + if(gbWindowLine == -1) { + gbWindowLine = 0; + } + + tx = 0; + ty = gbWindowLine >> 3; + + bx = 128; + by = gbWindowLine & 7; + + if(wx < 0) { + bx >>= (-wx); + wx = 0; + } + + tile_map_line_y = tile_map + ty * 32; + + tile_map_address = tile_map_line_y + tx; + + x = wx; + + tile = bank0[tile_map_address]; + u8 attrs = 0; + if(bank1) + attrs = bank1[tile_map_address]; + tile_map_address++; + + if((register_LCDC & 16) == 0) { + if(tile < 128) tile += 128; + else tile -= 128; + } + + tile_pattern_address = tile_pattern + tile * 16 + by*2; + + while(x < 160) { + u8 tile_a = 0; + u8 tile_b = 0; + + if(attrs & 0x40) { + tile_pattern_address = tile_pattern + tile * 16 + (7-by)*2; + } + + if(attrs & 0x08) { + tile_a = bank1[tile_pattern_address++]; + tile_b = bank1[tile_pattern_address]; + } else { + tile_a = bank0[tile_pattern_address++]; + tile_b = bank0[tile_pattern_address]; + } + + if(attrs & 0x20) { + tile_a = gbInvertTab[tile_a]; + tile_b = gbInvertTab[tile_b]; + } + + while(bx > 0) { + u8 c = (tile_a & bx) != 0 ? 1 : 0; + c += ((tile_b & bx) != 0 ? 2 : 0); + + if(attrs & 0x80) + gbLineBuffer[x] = 0x300 + c; + else + gbLineBuffer[x] = 0x100 + c; + + if(gbCgbMode) { + c = c + (attrs & 7) * 4; + } else { + c = gbBgp[c]; + if(gbSgbMode && ! gbCgbMode) { + int dx = x >> 3; + int dy = y >> 3; + + int palette = gbSgbATF[dy * 20 + dx]; + + if(c == 0) + palette = 0; + + c = c + 4*palette; + } + } + gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c]] : + gbPalette[c]; + x++; + if(x >= 160) + break; + bx >>= 1; + } + tx++; + if(tx == 32) + tx = 0; + bx = 128; + tile = bank0[tile_map_line_y + tx]; + if(bank1) + attrs = bank1[tile_map_line_y + tx]; + + if((register_LCDC & 16) == 0) { + if(tile < 128) tile += 128; + else tile -= 128; + } + tile_pattern_address = tile_pattern + tile * 16 + by * 2; + } + gbWindowLine++; + } + } + } + } else { + for(int i = 0; i < 160; i++) { + gbLineMix[i] = gbPalette[0]; + gbLineBuffer[i] = 0; + } + } +} + +void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, + int size,int spriteNumber) +{ + u8 * bank0; + u8 * bank1; + if(gbCgbMode) { + if(register_VBK & 1) { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } else { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } + } else { + bank0 = &gbMemory[0x8000]; + bank1 = NULL; + } + + int init = 0x0000; + + // int yLine = (y+gbBorderRowSkip) * gbBorderLineSkip; + + u8 *pal = gbObp0; + + int flipx = (flags & 0x20); + int flipy = (flags & 0x40); + + if((flags & 0x10)) + pal = gbObp1; + + if(flipy) { + t = (size ? 15 : 7) - t; + } + + int prio = flags & 0x80; + + int address = init + tile * 16 + 2*t; + int a = 0; + int b = 0; + + if(gbCgbMode && flags & 0x08) { + a = bank1[address++]; + b = bank1[address++]; + } else { + a = bank0[address++]; + b = bank0[address++]; + } + + for(int xx = 0; xx < 8; xx++) { + u8 mask = 1 << (7-xx); + u8 c = 0; + if( (a & mask)) + c++; + if( (b & mask)) + c+=2; + + if(c==0) continue; + + int xxx = xx+x; + if(flipx) + xxx = (7-xx+x); + + if(xxx < 0 || xxx > 159) + continue; + + u16 color = gbLineBuffer[xxx]; + + if(prio) { + if(color < 0x200 && ((color & 0xFF) != 0)) + continue; + } + if(color >= 0x300 && color != 0x300) + continue; + else if(color >= 0x200 && color < 0x300) { + int sprite = color & 0xff; + + int spriteX = gbMemory[0xfe00 + 4 * sprite + 1] - 8; + + if(spriteX == x) { + if(sprite < spriteNumber) + continue; + } else { + if(gbCgbMode) { + if(sprite < spriteNumber) + continue; + } else { + if(spriteX < x+8) + continue; + } + } + } + + + gbLineBuffer[xxx] = 0x200 + spriteNumber; + + // make sure that sprites will work even in CGB mode + if(gbCgbMode) { + c = c + (flags & 0x07)*4 + 32; + } else { + c = pal[c]; + + if(gbSgbMode && !gbCgbMode) { + int dx = xxx >> 3; + int dy = y >> 3; + + int palette = gbSgbATF[dy * 20 + dx]; + + if(c == 0) + palette = 0; + + c = c + 4*palette; + } else { + c += 4; + } + } + + gbLineMix[xxx] = gbColorOption ? gbColorFilter[gbPalette[c]] : + gbPalette[c]; + } +} + +void gbDrawSprites() +{ + int x = 0; + int y = 0; + int count = 0; + + int size = (register_LCDC & 4); + + if(!(register_LCDC & 0x80)) + return; + + if((register_LCDC & 2) && (layerSettings & 0x1000)) { + int yc = register_LY; + + int address = 0xfe00; + for(int i = 0; i < 40; i++) { + y = gbMemory[address++]; + x = gbMemory[address++]; + int tile = gbMemory[address++]; + if(size) + tile &= 254; + int flags = gbMemory[address++]; + + if(x > 0 && y > 0 && x < 168 && y < 160) { + // check if sprite intersects current line + int t = yc -y + 16; + if(size && t >=0 && t < 16) { + gbDrawSpriteTile(tile,x-8,yc,t,flags,size,i); + count++; + } else if(!size && t >= 0 && t < 8) { + gbDrawSpriteTile(tile, x-8, yc, t, flags,size,i); + count++; + } + } + // sprite limit reached! + if(count >= 10) + break; + } + } +} + diff --git a/src/gb/gbGlobals.cpp b/src/gb/gbGlobals.cpp new file mode 100644 index 0000000..90b1af1 --- /dev/null +++ b/src/gb/gbGlobals.cpp @@ -0,0 +1,54 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "../GBA.h" + +u8 *gbMemoryMap[16]; + +int gbRomSizeMask = 0; +int gbRomSize = 0; +int gbRamSizeMask = 0; +int gbRamSize = 0; + +u8 *gbMemory = NULL; +u8 *gbVram = NULL; +u8 *gbRom = NULL; +u8 *gbRam = NULL; +u8 *gbWram = NULL; +u16 *gbLineBuffer = NULL; + +u16 gbPalette[128]; +u8 gbBgp[4] = { 0, 1, 2, 3}; +u8 gbObp0[4] = { 0, 1, 2, 3}; +u8 gbObp1[4] = { 0, 1, 2, 3}; +int gbWindowLine = -1; + +int gbCgbMode = 0; + +u16 gbColorFilter[32768]; +int gbColorOption = 0; +int gbPaletteOption = 0; +int gbEmulatorType = 0; +int gbBorderOn = 1; +int gbBorderAutomatic = 0; +int gbBorderLineSkip = 160; +int gbBorderRowSkip = 0; +int gbBorderColumnSkip = 0; +int gbDmaTicks = 0; + +u8 (*gbSerialFunction)(u8) = NULL; diff --git a/src/gb/gbGlobals.h b/src/gb/gbGlobals.h new file mode 100644 index 0000000..380f933 --- /dev/null +++ b/src/gb/gbGlobals.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +extern int gbRomSizeMask; +extern int gbRomSize; +extern int gbRamSize; +extern int gbRamSizeMask; + +extern u8 *gbRom; +extern u8 *gbRam; +extern u8 *gbVram; +extern u8 *gbWram; +extern u8 *gbMemory; +extern u16 *gbLineBuffer; + +extern u8 *gbMemoryMap[16]; + +extern int gbFrameSkip; +extern u16 gbColorFilter[32768]; +extern int gbColorOption; +extern int gbPaletteOption; +extern int gbEmulatorType; +extern int gbBorderOn; +extern int gbBorderAutomatic; +extern int gbCgbMode; +extern int gbSgbMode; +extern int gbWindowLine; +extern int gbSpeed; +extern u8 gbBgp[4]; +extern u8 gbObp0[4]; +extern u8 gbObp1[4]; +extern u16 gbPalette[128]; + +extern u8 register_LCDC; +extern u8 register_LY; +extern u8 register_SCY; +extern u8 register_SCX; +extern u8 register_WY; +extern u8 register_WX; +extern u8 register_VBK; + +extern int emulating; + +extern int gbBorderLineSkip; +extern int gbBorderRowSkip; +extern int gbBorderColumnSkip; +extern int gbDmaTicks; + +extern void gbRenderLine(); +extern void gbDrawSprites(); + +extern u8 (*gbSerialFunction)(u8); diff --git a/src/gb/gbMemory.cpp b/src/gb/gbMemory.cpp new file mode 100644 index 0000000..3723dcd --- /dev/null +++ b/src/gb/gbMemory.cpp @@ -0,0 +1,979 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "../GBA.h" +#include "../Port.h" +#include "gbGlobals.h" +#include "gbMemory.h" +#include "../movie.h" + +mapperMBC1 gbDataMBC1 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // memory model + 0, // ROM high address + 0 // RAM address +}; + +// MBC1 ROM write registers +void mapperMBC1ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + gbDataMBC1.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0); + break; + case 0x2000: // ROM bank select + // value = value & 0x1f; + if(value == 0) + value = 1; + if(value == gbDataMBC1.mapperROMBank) + break; + + tmpAddress = value << 14; + + // check current model + if(gbDataMBC1.mapperMemoryModel == 0) { + // model is 16/8, so we have a high address in use + tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19; + } + + tmpAddress &= gbRomSizeMask; + gbDataMBC1.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + break; + case 0x4000: // RAM bank select + if(gbDataMBC1.mapperMemoryModel == 1) { + // 4/32 model, RAM bank switching provided + value = value & 0x03; + if(value == gbDataMBC1.mapperRAMBank) + break; + tmpAddress = value << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + gbDataMBC1.mapperRAMBank = value; + gbDataMBC1.mapperRAMAddress = tmpAddress; + } else { + // 16/8, set the high address + gbDataMBC1.mapperROMHighAddress = value & 0x03; + tmpAddress = gbDataMBC1.mapperROMBank << 14; + tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19; + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + } + break; + case 0x6000: // memory model select + gbDataMBC1.mapperMemoryModel = value & 1; + break; + } +} + +// MBC1 RAM write +void mapperMBC1RAM(u16 address, u8 value) +{ + if(gbDataMBC1.mapperRAMEnable) { + if(gbRamSize) { + gbMemoryMap[address >> 12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } +} + +void memoryUpdateMapMBC1() +{ + int tmpAddress = gbDataMBC1.mapperROMBank << 14; + + // check current model + if(gbDataMBC1.mapperMemoryModel == 1) { + // model is 16/8, so we have a high address in use + tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19; + } + + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + if(gbRamSize) { + gbMemoryMap[0x0a] = &gbRam[gbDataMBC1.mapperRAMAddress]; + gbMemoryMap[0x0b] = &gbRam[gbDataMBC1.mapperRAMAddress + 0x1000]; + } +} + +mapperMBC2 gbDataMBC2 = { + 0, // RAM enable + 1 // ROM bank +}; + +// MBC2 ROM write registers +void mapperMBC2ROM(u16 address, u8 value) +{ + switch(address & 0x6000) { + case 0x0000: // RAM enable + if(!(address & 0x0100)) { + gbDataMBC2.mapperRAMEnable = (value & 0x0f) == 0x0a; + } + break; + case 0x2000: // ROM bank select + if(address & 0x0100) { + value &= 0x0f; + + if(value == 0) + value = 1; + if(gbDataMBC2.mapperROMBank != value) { + gbDataMBC2.mapperROMBank = value; + + int tmpAddress = value << 14; + + tmpAddress &= gbRomSizeMask; + + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + } + } + break; + } +} + +// MBC2 RAM write +void mapperMBC2RAM(u16 address, u8 value) +{ + if(gbDataMBC2.mapperRAMEnable) { + if(gbRamSize && address < 0xa200) { + gbMemoryMap[address >> 12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } +} + +void memoryUpdateMapMBC2() +{ + int tmpAddress = gbDataMBC2.mapperROMBank << 14; + + tmpAddress &= gbRomSizeMask; + + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; +} + +mapperMBC3 gbDataMBC3 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // RAM address + 0, // timer clock latch + 0, // timer clock register + 0, // timer seconds + 0, // timer minutes + 0, // timer hours + 0, // timer days + 0, // timer control + 0, // timer latched seconds + 0, // timer latched minutes + 0, // timer latched hours + 0, // timer latched days + 0, // timer latched control + (time_t)-1 // last time +}; + +void memoryUpdateMBC3Clock() +{ + time_t now; + + if(VBAMovieActive() || VBAMovieLoading()) + now = (time_t)(VBAMovieGetId() + VBAMovieGetFrameCounter()/60); /// FIXME: is /60 the right factor? + else + now = time(NULL); + + time_t diff = now - gbDataMBC3.mapperLastTime; + if(diff > 0) { + // update the clock according to the last update time + gbDataMBC3.mapperSeconds += diff % 60; + if(gbDataMBC3.mapperSeconds > 59) { + gbDataMBC3.mapperSeconds -= 60; + gbDataMBC3.mapperMinutes++; + } + + diff /= 60; + + gbDataMBC3.mapperMinutes += diff % 60; + if(gbDataMBC3.mapperMinutes > 60) { + gbDataMBC3.mapperMinutes -= 60; + gbDataMBC3.mapperHours++; + } + + diff /= 60; + + gbDataMBC3.mapperHours += diff % 24; + if(gbDataMBC3.mapperHours > 24) { + gbDataMBC3.mapperHours -= 24; + gbDataMBC3.mapperDays++; + } + diff /= 24; + + gbDataMBC3.mapperDays += diff; + if(gbDataMBC3.mapperDays > 255) { + if(gbDataMBC3.mapperDays > 511) { + gbDataMBC3.mapperDays %= 512; + gbDataMBC3.mapperControl |= 0x80; + } + gbDataMBC3.mapperControl = (gbDataMBC3.mapperControl & 0xfe) | + (gbDataMBC3.mapperDays>255 ? 1 : 0); + } + } + gbDataMBC3.mapperLastTime = now; +} + +// MBC3 ROM write registers +void mapperMBC3ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + gbDataMBC3.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0); + break; + case 0x2000: // ROM bank select + value = value & 0x7f; + if(value == 0) + value = 1; + if(value == gbDataMBC3.mapperROMBank) + break; + + tmpAddress = value << 14; + + tmpAddress &= gbRomSizeMask; + gbDataMBC3.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + break; + case 0x4000: // RAM bank select + if(value < 8) { + if(value == gbDataMBC3.mapperRAMBank) + break; + tmpAddress = value << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + gbDataMBC3.mapperRAMBank = value; + gbDataMBC3.mapperRAMAddress = tmpAddress; + } else { + if(gbDataMBC3.mapperRAMEnable) { + gbDataMBC3.mapperRAMBank = -1; + + gbDataMBC3.mapperClockRegister = value; + } + } + break; + case 0x6000: // clock latch + if(gbDataMBC3.mapperClockLatch == 0 && value == 1) { + memoryUpdateMBC3Clock(); + gbDataMBC3.mapperLSeconds = gbDataMBC3.mapperSeconds; + gbDataMBC3.mapperLMinutes = gbDataMBC3.mapperMinutes; + gbDataMBC3.mapperLHours = gbDataMBC3.mapperHours; + gbDataMBC3.mapperLDays = gbDataMBC3.mapperDays; + gbDataMBC3.mapperLControl = gbDataMBC3.mapperControl; + } + if(value == 0x00 || value == 0x01) + gbDataMBC3.mapperClockLatch = value; + break; + } +} + +// MBC3 RAM write +void mapperMBC3RAM(u16 address, u8 value) +{ + if(gbDataMBC3.mapperRAMEnable) { + if(gbDataMBC3.mapperRAMBank != -1) { + if(gbRamSize) { + gbMemoryMap[address>>12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } else { + if(VBAMovieActive() || VBAMovieLoading()) + gbDataMBC3.mapperLastTime = VBAMovieGetId() + VBAMovieGetFrameCounter()/60; + else + time(&gbDataMBC3.mapperLastTime); + systemScreenMessage(ctime(&gbDataMBC3.mapperLastTime), 4); + + switch(gbDataMBC3.mapperClockRegister) { + case 0x08: + gbDataMBC3.mapperSeconds = value; + break; + case 0x09: + gbDataMBC3.mapperMinutes = value; + break; + case 0x0a: + gbDataMBC3.mapperHours = value; + break; + case 0x0b: + gbDataMBC3.mapperDays = value; + break; + case 0x0c: + if(gbDataMBC3.mapperControl & 0x80) + gbDataMBC3.mapperControl = 0x80 | value; + else + gbDataMBC3.mapperControl = value; + break; + } + } + } +} + +// MBC3 read RAM +u8 mapperMBC3ReadRAM(u16 address) +{ + if(gbDataMBC3.mapperRAMEnable) { + if(gbDataMBC3.mapperRAMBank != -1) { + return gbMemoryMap[address>>12][address & 0x0fff]; + } + + switch(gbDataMBC3.mapperClockRegister) { + case 0x08: + return gbDataMBC3.mapperLSeconds; + break; + case 0x09: + return gbDataMBC3.mapperLMinutes; + break; + case 0x0a: + return gbDataMBC3.mapperLHours; + break; + case 0x0b: + return gbDataMBC3.mapperLDays; + break; + case 0x0c: + return gbDataMBC3.mapperLControl; + } + } + return 0; +} + +void memoryUpdateMapMBC3() +{ + int tmpAddress = gbDataMBC3.mapperROMBank << 14; + + tmpAddress &= gbRomSizeMask; + + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + if(gbDataMBC3.mapperRAMBank >= 0 && gbRamSize) { + tmpAddress = gbDataMBC3.mapperRAMBank << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + } +} + +mapperMBC5 gbDataMBC5 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // ROM high address + 0, // RAM address + 0 // is rumble cartridge? +}; + +// MBC5 ROM write registers +void mapperMBC5ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + gbDataMBC5.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0); + break; + case 0x2000: // ROM bank select + if(address < 0x3000) { + value = value & 0xff; + if(value == gbDataMBC5.mapperROMBank) + break; + + tmpAddress = (value << 14) | (gbDataMBC5.mapperROMHighAddress << 22) ; + + tmpAddress &= gbRomSizeMask; + gbDataMBC5.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + } else { + value = value & 1; + if(value == gbDataMBC5.mapperROMHighAddress) + break; + + tmpAddress = (gbDataMBC5.mapperROMBank << 14) | (value << 22); + + tmpAddress &= gbRomSizeMask; + gbDataMBC5.mapperROMHighAddress = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + } + break; + case 0x4000: // RAM bank select + if(gbDataMBC5.isRumbleCartridge) + value &= 0x07; + else + value &= 0x0f; + if(value == gbDataMBC5.mapperRAMBank) + break; + tmpAddress = value << 13; + tmpAddress &= gbRamSizeMask; + if(gbRamSize) { + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + + gbDataMBC5.mapperRAMBank = value; + gbDataMBC5.mapperRAMAddress = tmpAddress; + } + break; + } +} + +// MBC5 RAM write +void mapperMBC5RAM(u16 address, u8 value) +{ + if(gbDataMBC5.mapperRAMEnable) { + if(gbRamSize) { + gbMemoryMap[address >> 12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } +} + +void memoryUpdateMapMBC5() +{ + int tmpAddress = (gbDataMBC5.mapperROMBank << 14) | + (gbDataMBC5.mapperROMHighAddress << 22) ; + + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + if(gbRamSize) { + tmpAddress = gbDataMBC5.mapperRAMBank << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + } +} + +mapperMBC7 gbDataMBC7 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // RAM address + 0, // chip select + 0, // ?? + 0, // mapper state + 0, // buffer for receiving serial data + 0, // idle state + 0, // count of bits received + 0, // command received + 0, // address received + 0, // write enable + 0, // value to return on ram +}; + +// MBC7 ROM write registers +void mapperMBC7ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: + break; + case 0x2000: // ROM bank select + value = value & 0x7f; + if(value == 0) + value = 1; + + if(value == gbDataMBC7.mapperROMBank) + break; + + tmpAddress = (value << 14); + + tmpAddress &= gbRomSizeMask; + gbDataMBC7.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + break; + case 0x4000: // RAM bank select/enable + if(value < 8) { + tmpAddress = (value&3) << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbMemory[0xa000]; + gbMemoryMap[0x0b] = &gbMemory[0xb000]; + + gbDataMBC7.mapperRAMBank = value; + gbDataMBC7.mapperRAMAddress = tmpAddress; + gbDataMBC7.mapperRAMEnable = 0; + } else { + gbDataMBC7.mapperRAMEnable = 0; + } + break; + } +} + +// MBC7 read RAM +u8 mapperMBC7ReadRAM(u16 address) +{ + switch(address & 0xa0f0) { + case 0xa000: + case 0xa010: + case 0xa060: + case 0xa070: + return 0; + case 0xa020: + // sensor X low byte + return systemGetSensorX() & 255; + case 0xa030: + // sensor X high byte + return systemGetSensorX() >> 8; + case 0xa040: + // sensor Y low byte + return systemGetSensorY() & 255; + case 0xa050: + // sensor Y high byte + return systemGetSensorY() >> 8; + case 0xa080: + return gbDataMBC7.value; + } + return 0xff; +} + +// MBC7 RAM write +void mapperMBC7RAM(u16 address, u8 value) +{ + if(address == 0xa080) { + // special processing needed + int oldCs = gbDataMBC7.cs,oldSk=gbDataMBC7.sk; + + gbDataMBC7.cs=value>>7; + gbDataMBC7.sk=(value>>6)&1; + + if(!oldCs && gbDataMBC7.cs) { + if(gbDataMBC7.state==5) { + if(gbDataMBC7.writeEnable) { + gbMemory[0xa000+gbDataMBC7.address*2]=gbDataMBC7.buffer>>8; + gbMemory[0xa000+gbDataMBC7.address*2+1]=gbDataMBC7.buffer&0xff; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + gbDataMBC7.state=0; + gbDataMBC7.value=1; + } else { + gbDataMBC7.idle=true; + gbDataMBC7.state=0; + } + } + + if(!oldSk && gbDataMBC7.sk) { + if(gbDataMBC7.idle) { + if(value & 0x02) { + gbDataMBC7.idle=false; + gbDataMBC7.count=0; + gbDataMBC7.state=1; + } + } else { + switch(gbDataMBC7.state) { + case 1: + // receiving command + gbDataMBC7.buffer <<= 1; + gbDataMBC7.buffer |= (value & 0x02)?1:0; + gbDataMBC7.count++; + if(gbDataMBC7.count==2) { + // finished receiving command + gbDataMBC7.state=2; + gbDataMBC7.count=0; + gbDataMBC7.code=gbDataMBC7.buffer & 3; + } + break; + case 2: + // receive address + gbDataMBC7.buffer <<= 1; + gbDataMBC7.buffer |= (value&0x02)?1:0; + gbDataMBC7.count++; + if(gbDataMBC7.count==8) { + // finish receiving + gbDataMBC7.state=3; + gbDataMBC7.count=0; + gbDataMBC7.address=gbDataMBC7.buffer&0xff; + if(gbDataMBC7.code==0) { + if((gbDataMBC7.address>>6)==0) { + gbDataMBC7.writeEnable=0; + gbDataMBC7.state=0; + } else if((gbDataMBC7.address>>6) == 3) { + gbDataMBC7.writeEnable=1; + gbDataMBC7.state=0; + } + } + } + break; + case 3: + gbDataMBC7.buffer <<= 1; + gbDataMBC7.buffer |= (value&0x02)?1:0; + gbDataMBC7.count++; + + switch(gbDataMBC7.code) { + case 0: + if(gbDataMBC7.count==16) { + if((gbDataMBC7.address>>6)==0) { + gbDataMBC7.writeEnable = 0; + gbDataMBC7.state=0; + } else if((gbDataMBC7.address>>6)==1) { + if (gbDataMBC7.writeEnable) { + for(int i=0;i<256;i++) { + gbMemory[0xa000+i*2] = gbDataMBC7.buffer >> 8; + gbMemory[0xa000+i*2+1] = gbDataMBC7.buffer & 0xff; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } + gbDataMBC7.state=5; + } else if((gbDataMBC7.address>>6) == 2) { + if (gbDataMBC7.writeEnable) { + for(int i=0;i<256;i++) + WRITE16LE((u16 *)&gbMemory[0xa000+i*2], 0xffff); + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + gbDataMBC7.state=5; + } else if((gbDataMBC7.address>>6)==3) { + gbDataMBC7.writeEnable = 1; + gbDataMBC7.state=0; + } + gbDataMBC7.count=0; + } + break; + case 1: + if(gbDataMBC7.count==16) { + gbDataMBC7.count=0; + gbDataMBC7.state=5; + gbDataMBC7.value=0; + } + break; + case 2: + if(gbDataMBC7.count==1) { + gbDataMBC7.state=4; + gbDataMBC7.count=0; + gbDataMBC7.buffer = (gbMemory[0xa000+gbDataMBC7.address*2]<<8)| + (gbMemory[0xa000+gbDataMBC7.address*2+1]); + } + break; + case 3: + if(gbDataMBC7.count==16) { + gbDataMBC7.count=0; + gbDataMBC7.state=5; + gbDataMBC7.value=0; + gbDataMBC7.buffer=0xffff; + } + break; + } + break; + } + } + } + + if (oldSk && !gbDataMBC7.sk) { + if (gbDataMBC7.state==4) { + gbDataMBC7.value = (gbDataMBC7.buffer & 0x8000)?1:0; + gbDataMBC7.buffer <<= 1; + gbDataMBC7.count++; + if (gbDataMBC7.count==16) { + gbDataMBC7.count=0; + gbDataMBC7.state=0; + } + } + } + } +} + +void memoryUpdateMapMBC7() +{ + int tmpAddress = (gbDataMBC5.mapperROMBank << 14); + + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; +} + +mapperHuC1 gbDataHuC1 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // memory model + 0, // ROM high address + 0 // RAM address +}; + +// HuC1 ROM write registers +void mapperHuC1ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + gbDataHuC1.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0); + break; + case 0x2000: // ROM bank select + value = value & 0x3f; + if(value == 0) + value = 1; + if(value == gbDataHuC1.mapperROMBank) + break; + + tmpAddress = value << 14; + + tmpAddress &= gbRomSizeMask; + gbDataHuC1.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + break; + case 0x4000: // RAM bank select + if(gbDataHuC1.mapperMemoryModel == 1) { + // 4/32 model, RAM bank switching provided + value = value & 0x03; + if(value == gbDataHuC1.mapperRAMBank) + break; + tmpAddress = value << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + gbDataHuC1.mapperRAMBank = value; + gbDataHuC1.mapperRAMAddress = tmpAddress; + } else { + // 16/8, set the high address + gbDataHuC1.mapperROMHighAddress = value & 0x03; + tmpAddress = gbDataHuC1.mapperROMBank << 14; + tmpAddress |= (gbDataHuC1.mapperROMHighAddress) << 19; + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + } + break; + case 0x6000: // memory model select + gbDataHuC1.mapperMemoryModel = value & 1; + break; + } +} + +// HuC1 RAM write +void mapperHuC1RAM(u16 address, u8 value) +{ + if(gbDataHuC1.mapperRAMEnable) { + if(gbRamSize) { + gbMemoryMap[address >> 12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } +} + +void memoryUpdateMapHuC1() +{ + int tmpAddress = gbDataHuC1.mapperROMBank << 14; + + tmpAddress &= gbRomSizeMask; + + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + if(gbRamSize) { + tmpAddress = gbDataHuC1.mapperRAMBank << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + } +} + +mapperHuC3 gbDataHuC3 = { + 0, // RAM enable + 1, // ROM bank + 0, // RAM bank + 0, // RAM address + 0, // RAM flag + 0 // RAM read value +}; + + +// HuC3 ROM write registers +void mapperHuC3ROM(u16 address, u8 value) +{ + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + gbDataHuC3.mapperRAMEnable = ( value == 0x0a ? 1 : 0); + gbDataHuC3.mapperRAMFlag = value; + if(gbDataHuC3.mapperRAMFlag != 0x0a) + gbDataHuC3.mapperRAMBank = -1; + break; + case 0x2000: // ROM bank select + value = value & 0x7f; + if(value == 0) + value = 1; + if(value == gbDataHuC3.mapperROMBank) + break; + + tmpAddress = value << 14; + + tmpAddress &= gbRomSizeMask; + gbDataHuC3.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + break; + case 0x4000: // RAM bank select + value = value & 0x03; + if(value == gbDataHuC3.mapperRAMBank) + break; + tmpAddress = value << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + gbDataHuC3.mapperRAMBank = value; + gbDataHuC3.mapperRAMAddress = tmpAddress; + break; + case 0x6000: // nothing to do! + break; + } +} + +// HuC3 read RAM +u8 mapperHuC3ReadRAM(u16 address) +{ + if(gbDataHuC3.mapperRAMFlag > 0x0b && + gbDataHuC3.mapperRAMFlag < 0x0e) { + if(gbDataHuC3.mapperRAMFlag != 0x0c) + return 1; + return gbDataHuC3.mapperRAMValue; + } else + return gbMemoryMap[address >> 12][address & 0x0fff]; +} + +// HuC3 RAM write +void mapperHuC3RAM(u16 address, u8 value) +{ + int *p; + + if(gbDataHuC3.mapperRAMFlag < 0x0b || + gbDataHuC3.mapperRAMFlag > 0x0e) { + if(gbDataHuC3.mapperRAMEnable) { + if(gbRamSize) { + gbMemoryMap[address >> 12][address & 0x0fff] = value; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; + } + } + } else { + if(gbDataHuC3.mapperRAMFlag == 0x0b) { + if(value == 0x62) { + gbDataHuC3.mapperRAMValue = 1; + } else { + switch(value & 0xf0) { + case 0x10: + p = &gbDataHuC3.mapperRegister2; + gbDataHuC3.mapperRAMValue = *(p+gbDataHuC3.mapperRegister1++); + if(gbDataHuC3.mapperRegister1 > 6) + gbDataHuC3.mapperRegister1 = 0; + break; + case 0x30: + p = &gbDataHuC3.mapperRegister2; + *(p+gbDataHuC3.mapperRegister1++) = value & 0x0f; + if(gbDataHuC3.mapperRegister1 > 6) + gbDataHuC3.mapperRegister1 = 0; + gbDataHuC3.mapperAddress = + (gbDataHuC3.mapperRegister6 << 24) | + (gbDataHuC3.mapperRegister5 << 16) | + (gbDataHuC3.mapperRegister4 << 8) | + (gbDataHuC3.mapperRegister3 << 4) | + (gbDataHuC3.mapperRegister2); + break; + case 0x40: + gbDataHuC3.mapperRegister1 = (gbDataHuC3.mapperRegister1 & 0xf0) | + (value & 0x0f); + gbDataHuC3.mapperRegister2 = (gbDataHuC3.mapperAddress & 0x0f); + gbDataHuC3.mapperRegister3 = ((gbDataHuC3.mapperAddress>>4)&0x0f); + gbDataHuC3.mapperRegister4 = ((gbDataHuC3.mapperAddress>>8)&0x0f); + gbDataHuC3.mapperRegister5 = ((gbDataHuC3.mapperAddress>>16)&0x0f); + gbDataHuC3.mapperRegister6 = ((gbDataHuC3.mapperAddress>>24)&0x0f); + gbDataHuC3.mapperRegister7 = 0; + gbDataHuC3.mapperRegister8 = 0; + gbDataHuC3.mapperRAMValue = 0; + break; + case 0x50: + gbDataHuC3.mapperRegister1 = (gbDataHuC3.mapperRegister1 & 0x0f) | + ((value << 4)&0x0f); + break; + default: + gbDataHuC3.mapperRAMValue = 1; + break; + } + } + } + } +} + +void memoryUpdateMapHuC3() +{ + int tmpAddress = gbDataHuC3.mapperROMBank << 14; + + tmpAddress &= gbRomSizeMask; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; + gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; + + if(gbRamSize) { + tmpAddress = gbDataHuC3.mapperRAMBank << 13; + tmpAddress &= gbRamSizeMask; + gbMemoryMap[0x0a] = &gbRam[tmpAddress]; + gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; + } +} diff --git a/src/gb/gbMemory.h b/src/gb/gbMemory.h new file mode 100644 index 0000000..9ce19ed --- /dev/null +++ b/src/gb/gbMemory.h @@ -0,0 +1,149 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include + +struct mapperMBC1 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperMemoryModel; + int mapperROMHighAddress; + int mapperRAMAddress; +}; + +struct mapperMBC2 { + int mapperRAMEnable; + int mapperROMBank; +}; + +struct mapperMBC3 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperRAMAddress; + int mapperClockLatch; + int mapperClockRegister; + int mapperSeconds; + int mapperMinutes; + int mapperHours; + int mapperDays; + int mapperControl; + int mapperLSeconds; + int mapperLMinutes; + int mapperLHours; + int mapperLDays; + int mapperLControl; + time_t mapperLastTime; +}; + +struct mapperMBC5 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperROMHighAddress; + int mapperRAMAddress; + int isRumbleCartridge; +}; + +struct mapperMBC7 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperRAMAddress; + int cs; + int sk; + int state; + int buffer; + int idle; + int count; + int code; + int address; + int writeEnable; + int value; +}; + +struct mapperHuC1 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperMemoryModel; + int mapperROMHighAddress; + int mapperRAMAddress; +}; + +struct mapperHuC3 { + int mapperRAMEnable; + int mapperROMBank; + int mapperRAMBank; + int mapperRAMAddress; + int mapperAddress; + int mapperRAMFlag; + int mapperRAMValue; + int mapperRegister1; + int mapperRegister2; + int mapperRegister3; + int mapperRegister4; + int mapperRegister5; + int mapperRegister6; + int mapperRegister7; + int mapperRegister8; +}; + +extern mapperMBC1 gbDataMBC1; +extern mapperMBC2 gbDataMBC2; +extern mapperMBC3 gbDataMBC3; +extern mapperMBC5 gbDataMBC5; +extern mapperHuC1 gbDataHuC1; +extern mapperHuC3 gbDataHuC3; + +void mapperMBC1ROM(u16,u8); +void mapperMBC1RAM(u16,u8); +void mapperMBC2ROM(u16,u8); +void mapperMBC2RAM(u16,u8); +void mapperMBC3ROM(u16,u8); +void mapperMBC3RAM(u16,u8); +u8 mapperMBC3ReadRAM(u16); +void mapperMBC5ROM(u16,u8); +void mapperMBC5RAM(u16,u8); +void mapperMBC7ROM(u16,u8); +void mapperMBC7RAM(u16,u8); +u8 mapperMBC7ReadRAM(u16); +void mapperHuC1ROM(u16,u8); +void mapperHuC1RAM(u16,u8); +void mapperHuC3ROM(u16,u8); +void mapperHuC3RAM(u16,u8); +u8 mapperHuC3ReadRAM(u16); + +//extern void (*mapper)(u16,u8); +//extern void (*mapperRAM)(u16,u8); +//extern u8 (*mapperReadRAM)(u16); + +extern void memoryUpdateMapMBC1(); +extern void memoryUpdateMapMBC2(); +extern void memoryUpdateMapMBC3(); +extern void memoryUpdateMapMBC5(); +extern void memoryUpdateMapMBC7(); +extern void memoryUpdateMapHuC1(); +extern void memoryUpdateMapHuC3(); + + + + + diff --git a/src/gb/gbPrinter.cpp b/src/gb/gbPrinter.cpp new file mode 100644 index 0000000..cf676c9 --- /dev/null +++ b/src/gb/gbPrinter.cpp @@ -0,0 +1,229 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include "../GBA.h" + +u8 gbPrinterStatus = 0; +int gbPrinterState = 0; +u8 gbPrinterData[0x280*9]; +u8 gbPrinterPacket[0x400]; +int gbPrinterCount = 0; +int gbPrinterDataCount = 0; +int gbPrinterDataSize = 0; +int gbPrinterResult = 0; + +bool gbPrinterCheckCRC() +{ + u16 crc = 0; + + for(int i = 2; i < (6+gbPrinterDataSize); i++) { + crc += gbPrinterPacket[i]; + } + + int msgCrc = gbPrinterPacket[6+gbPrinterDataSize] + + (gbPrinterPacket[7+gbPrinterDataSize]<<8); + + return msgCrc == crc; +} + +void gbPrinterReset() +{ + gbPrinterState = 0; + gbPrinterDataSize = 0; + gbPrinterDataCount = 0; + gbPrinterCount = 0; + gbPrinterStatus = 0; + gbPrinterResult = 0; +} + +void gbPrinterShowData() +{ + systemGbPrint(gbPrinterData, + gbPrinterPacket[6], + gbPrinterPacket[7], + gbPrinterPacket[8], + gbPrinterPacket[9]); + /* + allegro_init(); + install_keyboard(); + set_gfx_mode(GFX_AUTODETECT, 160, 144, 0, 0); + PALETTE pal; + pal[0].r = 255; + pal[0].g = 255; + pal[0].b = 255; + pal[1].r = 168; + pal[1].g = 168; + pal[1].b = 168; + pal[2].r = 96; + pal[2].g = 96; + pal[2].b = 96; + pal[3].r = 0; + pal[3].g = 0; + pal[3].b = 0; + set_palette(pal); + acquire_screen(); + u8 *data = gbPrinterData; + for(int y = 0; y < 0x12; y++) { + for(int x = 0; x < 0x14; x++) { + for(int k = 0; k < 8; k++) { + int a = *data++; + int b = *data++; + for(int j = 0; j < 8; j++) { + int mask = 1 << (7-j); + int c = 0; + if(a & mask) + c++; + if(b & mask) + c+=2; + putpixel(screen, x*8+j, y*8+k, c); + } + } + } + } + release_screen(); + while(!keypressed()) { + } + */ +} + +void gbPrinterReceiveData() +{ + if(gbPrinterPacket[3]) { // compressed + u8 *data = &gbPrinterPacket[6]; + u8 *dest = &gbPrinterData[gbPrinterDataCount]; + int len = 0; + while(len < gbPrinterDataSize) { + u8 control = *data++; + if(control & 0x80) { // repeated data + control &= 0x7f; + control += 2; + memset(dest, *data++, control); + len += control; + dest += control; + } else { // raw data + control++; + memcpy(dest, data, control); + dest += control; + data += control; + len += control; + } + } + } else { + memcpy(&gbPrinterData[gbPrinterDataCount], + &gbPrinterPacket[6], + gbPrinterDataSize); + gbPrinterDataCount += gbPrinterDataSize; + } +} + +void gbPrinterCommand() +{ + switch(gbPrinterPacket[2]) { + case 0x01: + // reset/initialize packet + gbPrinterDataCount = 0; + gbPrinterStatus = 0; + break; + case 0x02: + // print packet + gbPrinterShowData(); + break; + case 0x04: + // data packet + gbPrinterReceiveData(); + break; + case 0x0f: + // NUL packet + break; + } +} + +u8 gbPrinterSend(u8 b) +{ + switch(gbPrinterState) { + case 0: + gbPrinterCount = 0; + // receiving preamble + if(b == 0x88) { + gbPrinterPacket[gbPrinterCount++] = b; + gbPrinterState++; + } else { + // todo: handle failure + gbPrinterReset(); + } + break; + case 1: + // receiving preamble + if(b == 0x33) { + gbPrinterPacket[gbPrinterCount++] = b; + gbPrinterState++; + } else { + // todo: handle failure + gbPrinterReset(); + } + break; + case 2: + // receiving header + gbPrinterPacket[gbPrinterCount++] = b; + if(gbPrinterCount == 6) { + gbPrinterState++; + gbPrinterDataSize = gbPrinterPacket[4] + (gbPrinterPacket[5]<<8); + } + break; + case 3: + // receiving data + if(gbPrinterDataSize) { + gbPrinterPacket[gbPrinterCount++] = b; + if(gbPrinterCount == (6+gbPrinterDataSize)) { + gbPrinterState++; + } + break; + } + gbPrinterState++; + // intentionally move to next if no data to receive + case 4: + // receiving CRC + gbPrinterPacket[gbPrinterCount++] = b; + gbPrinterState++; + break; + case 5: + // receiving CRC-2 + gbPrinterPacket[gbPrinterCount++] = b; + if(gbPrinterCheckCRC()) { + gbPrinterCommand(); + } + gbPrinterState++; + break; + case 6: + // receiving dummy 1 + gbPrinterPacket[gbPrinterCount++] = b; + gbPrinterResult = 0x81; + gbPrinterState++; + break; + case 7: + // receiving dummy 2 + gbPrinterPacket[gbPrinterCount++] = b; + gbPrinterResult = gbPrinterStatus; + gbPrinterState = 0; + gbPrinterCount = 0; + break; + } + return gbPrinterResult; +} diff --git a/src/gb/gbPrinter.h b/src/gb/gbPrinter.h new file mode 100644 index 0000000..9bebd4e --- /dev/null +++ b/src/gb/gbPrinter.h @@ -0,0 +1,20 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +extern u8 gbPrinterSend(u8 b); diff --git a/src/gb/gbSGB.cpp b/src/gb/gbSGB.cpp new file mode 100644 index 0000000..29d2e81 --- /dev/null +++ b/src/gb/gbSGB.cpp @@ -0,0 +1,919 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include + +#include "../System.h" +#include "../Port.h" +#include "../Util.h" +#include "GB.h" +#include "gbGlobals.h" +#include "../movie.h" + +extern u8 *pix; +extern bool speedup; + +#define GBSGB_NONE 0 +#define GBSGB_RESET 1 +#define GBSGB_PACKET_TRANSMIT 2 + +u8 gbSgbBorderChar [32 * 256]; +u8 gbSgbBorder [2048]; + +int gbSgbCGBSupport = 0; +int gbSgbMask = 0; +int gbSgbMode = 0; +int gbSgbPacketState = GBSGB_NONE; +int gbSgbBit = 0; +int gbSgbPacketTimeout = 0; +int GBSGB_PACKET_TIMEOUT = 66666; +u8 gbSgbPacket[16*7]; +int gbSgbPacketNBits = 0; +int gbSgbPacketByte = 0; +int gbSgbPacketNumber = 0; +int gbSgbMultiplayer = 0; +int gbSgbFourPlayers = 0; +u8 gbSgbNextController = 0x0f; +u8 gbSgbReadingController = 0; +u16 gbSgbSCPPalette[4*512]; +u8 gbSgbATF[20 * 18]; +u8 gbSgbATFList[45 * 20 * 18]; +u8 gbSgbScreenBuffer[4160]; + +inline void gbSgbDraw24Bit(u8 *p, u16 v) +{ + *((u32*) p) = systemColorMap32[v]; +} + +inline void gbSgbDraw32Bit(u32 *p, u16 v) +{ + *p = systemColorMap32[v]; +} + +inline void gbSgbDraw16Bit(u16 *p, u16 v) +{ + *p = systemColorMap16[v]; +} + +void gbSgbReset() +{ + gbSgbPacketTimeout = 0; + gbSgbCGBSupport = 0; + gbSgbMask = 0; + gbSgbPacketState = GBSGB_NONE; + gbSgbBit = 0; + gbSgbPacketNBits = 0; + gbSgbPacketNumber = 0; + gbSgbMultiplayer = 0; + gbSgbFourPlayers = 0; + gbSgbNextController = 0x0f; + gbSgbReadingController = 0; + + memset(gbSgbSCPPalette, 0, 512*4); + memset(gbSgbATF, 0, 20*18); + memset(gbSgbATFList, 0, 45 * 20 * 18); + memset(gbSgbPacket, 0, 16 * 7); + memset(gbSgbBorderChar, 0, 32*256); + memset(gbSgbBorder, 0, 2048); + + int i; + for(i = 1; i < 2048; i+=2) { + gbSgbBorder[i] = 1 << 2; + } + + for(i = 0; i < 4; i++) { + gbPalette[i*4] = (0x1f) | (0x1f << 5) | (0x1f << 10); + gbPalette[i*4+1] = (0x15) | (0x15 << 5) | (0x15 << 10); + gbPalette[i*4+2] = (0x0c) | (0x0c << 5) | (0x0c << 10); + gbPalette[i*4+3] = 0; + } +} + +void gbSgbInit() +{ + gbSgbReset(); +} + +void gbSgbShutdown() +{ + memset(gbSgbBorderChar, 0, 32*256); + memset(gbSgbBorder, 0, 2048); +} + +void gbSgbFillScreen(u16 color) +{ + switch(systemColorDepth) { + case 16: + { + for(int y = 0; y < 144; y++) { + int yLine = (y+gbBorderRowSkip+1)*(gbBorderLineSkip+2) + + gbBorderColumnSkip; + u16 *dest = (u16*)pix + yLine; + for(register int x = 0; x < 160; x++) + gbSgbDraw16Bit(dest++, color); + } + } + break; + case 24: + { + for(int y = 0; y < 144; y++) { + int yLine = (y+gbBorderRowSkip)*gbBorderLineSkip + gbBorderColumnSkip; + u8 *dest = (u8 *)pix + yLine*3; + for(register int x = 0; x < 160; x++) { + gbSgbDraw24Bit(dest, color); + dest += 3; + } + } + } + break; + case 32: + { + for(int y = 0; y < 144; y++) { + int yLine = (y+gbBorderRowSkip+1)*(gbBorderLineSkip+1) + gbBorderColumnSkip; + u32 *dest = (u32 *)pix + yLine; + for(register int x = 0; x < 160; x++) { + gbSgbDraw32Bit(dest++, color); + } + } + } + break; + } +} + +#define getmem(x) gbMemoryMap[(x) >> 12][(x) & 0xfff] + +void gbSgbRenderScreenToBuffer() +{ + u16 mapAddress = 0x9800; + + if(register_LCDC & 0x08) + mapAddress = 0x9c00; + + u16 patternAddress = 0x8800; + + int flag = 1; + + if(register_LCDC & 0x10) { + patternAddress = 0x8000; + flag = 0; + } + + u8 *toAddress = gbSgbScreenBuffer; + + for(int i = 0; i < 13; i++) { + for(int j = 0; j < 20; j++) { + int tile = getmem(mapAddress); + mapAddress++; + + if(flag) { + if(tile > 127) + tile -= 128; + else + tile += 128; + } + for(int k = 0; k < 16; k++) + *toAddress++ = getmem(patternAddress + tile*16 + k); + } + mapAddress += 12; + } +} + +void gbSgbDrawBorderTile(int x, int y, int tile, int attr) +{ + u16 *dest = (u16*)pix + ((y+1) * (256+2)) + x; + u8 *dest8 = (u8*)pix + ((y*256)+x)*3; + u32 *dest32 = (u32*)pix + ((y+1)*257) + x; + + u8 *tileAddress = &gbSgbBorderChar[tile * 32]; + u8 *tileAddress2 = &gbSgbBorderChar[tile * 32 + 16]; + + u8 l = 8; + + u8 palette = ((attr >> 2 ) & 7); + + if(palette < 4) + palette += 4; + + palette *= 16; + + u8 xx = 0; + u8 yy = 0; + + int flipX = attr & 0x40; + int flipY = attr & 0x80; + + while(l > 0) { + u8 mask = 0x80; + u8 a = *tileAddress++; + u8 b = *tileAddress++; + u8 c = *tileAddress2++; + u8 d = *tileAddress2++; + + while(mask > 0) { + + u8 color = 0; + if(a & mask) + color++; + if(b & mask) + color+=2; + if(c & mask) + color+=4; + if(d & mask) + color+=8; + + u8 xxx = xx; + u8 yyy = yy; + + if(flipX) + xxx = 7 - xx; + if(flipY) + yyy = 7 - yy; + + u16 c = gbPalette[palette + color]; + if(!color) + c = gbPalette[0]; + if((yy < 40 || yy >= 184) || (xx < 48 || xx >= 208)) { + switch(systemColorDepth) { + case 16: + gbSgbDraw16Bit(dest + yyy*(256+2) + xxx, c); + break; + case 24: + gbSgbDraw24Bit(dest8 + (yyy*256+xxx)*3, c); + break; + case 32: + gbSgbDraw32Bit(dest32 + yyy*(256+1)+xxx, c); + break; + } + } + + mask >>= 1; + + xx++; + } + yy++; + xx = 0; + l--; + mask = 0x80; + } +} + +void gbSgbRenderBorder() +{ + if(gbBorderOn) { + u8 *fromAddress = gbSgbBorder; + + for(u8 y = 0; y < 28; y++) { + for(u8 x = 0; x< 32; x++) { + u8 tile = *fromAddress++; + u8 attr = *fromAddress++; + + gbSgbDrawBorderTile(x*8,y*8,tile,attr); + } + } + } +} + +void gbSgbPicture() +{ + gbSgbRenderScreenToBuffer(); + + memcpy(gbSgbBorder, gbSgbScreenBuffer, 2048); + + u16 *paletteAddr = (u16 *)&gbSgbScreenBuffer[2048]; + + for(int i = 64; i < 128; i++) { + gbPalette[i] = READ16LE(paletteAddr++); + } + + gbSgbCGBSupport |= 4; + + if(gbBorderAutomatic && !gbBorderOn && gbSgbCGBSupport > 4) { + gbBorderOn = 1; + systemGbBorderOn(); + } + + if(gbBorderOn && !gbSgbMask) + gbSgbRenderBorder(); + + if(gbSgbMode && gbCgbMode && gbSgbCGBSupport > 4) { + gbSgbCGBSupport = 0; + gbSgbMode = 0; + gbSgbMask = 0; + gbSgbRenderBorder(); + VBAMovieSignalIgnoreNextReset(); + gbReset(); + } + + if(gbSgbCGBSupport > 4) + gbSgbCGBSupport = 0; +} + +void gbSgbSetPalette(int a,int b,u16 *p) +{ + u16 bit00 = READ16LE(p++); + int i; + + for(i = 1; i < 4; i++) { + gbPalette[a*4+i] = READ16LE(p++); + } + + for(i = 1; i < 4; i++) { + gbPalette[b*4+i] = READ16LE(p++); + } + + gbPalette[0] = gbPalette[4] = gbPalette[8] = gbPalette[12] = bit00; + if(gbBorderOn && !gbSgbMask) + gbSgbRenderBorder(); +} + +void gbSgbScpPalette() +{ + gbSgbRenderScreenToBuffer(); + + u16 *fromAddress = (u16 *)gbSgbScreenBuffer; + + for(int i = 0; i < 512*4; i++) { + gbSgbSCPPalette[i] = READ16LE(fromAddress++); + } +} + +void gbSgbSetATF(int n) +{ + if(n < 0) + n = 0; + if(n > 44) + n = 44; + memcpy(gbSgbATF,&gbSgbATFList[n * 20 * 18], 20 * 18); + + if(gbSgbPacket[1] & 0x40) { + gbSgbMask = 0; + if(gbBorderOn) + gbSgbRenderBorder(); + } +} + +void gbSgbSetPalette() +{ + u16 pal = READ16LE((((u16 *)&gbSgbPacket[1])))&511; + memcpy(&gbPalette[0], &gbSgbSCPPalette[pal*4], 4 * sizeof(u16)); + + pal = READ16LE((((u16 *)&gbSgbPacket[3])))&511; + memcpy(&gbPalette[4], &gbSgbSCPPalette[pal*4], 4 * sizeof(u16)); + + pal = READ16LE((((u16 *)&gbSgbPacket[5])))&511; + memcpy(&gbPalette[8], &gbSgbSCPPalette[pal*4], 4 * sizeof(u16)); + + pal = READ16LE((((u16 *)&gbSgbPacket[7])))&511; + memcpy(&gbPalette[12], &gbSgbSCPPalette[pal*4], 4 * sizeof(u16)); + + u8 atf = gbSgbPacket[9]; + + if(atf & 0x80) { + gbSgbSetATF(atf & 0x3f); + } + + if(atf & 0x40) { + gbSgbMask = 0; + if(gbBorderOn) + gbSgbRenderBorder(); + } +} + +void gbSgbAttributeBlock() +{ + u8 *fromAddress = &gbSgbPacket[1]; + + u8 nDataSet = *fromAddress++; + if(nDataSet > 12) + nDataSet = 12; + if(nDataSet == 0) + nDataSet = 1; + + while(nDataSet) { + u8 controlCode = (*fromAddress++) & 7; + u8 paletteDesignation = (*fromAddress++) & 0x3f; + u8 startH = (*fromAddress++) & 0x1f; + u8 startV = (*fromAddress++) & 0x1f; + u8 endH = (*fromAddress++) & 0x1f; + u8 endV = (*fromAddress++) & 0x1f; + + u8 * toAddress = gbSgbATF; + + for(u8 y = 0; y < 18; y++) { + for(u8 x = 0; x < 20; x++) { + if(x < startH || y < startV || + x > endH || y > endV) { + // outside + if(controlCode & 0x04) + *toAddress = (paletteDesignation >> 4) & 0x03; + } else if(x > startH && x < endH && + y > startV && y < endV) { + // inside + if(controlCode & 0x01) + *toAddress = paletteDesignation & 0x03; + } else { + // surrounding line + if(controlCode & 0x02) + *toAddress = (paletteDesignation>>2) & 0x03; + else if(controlCode == 0x01) + *toAddress = paletteDesignation & 0x03; + } + toAddress++; + } + } + nDataSet--; + } +} + +void gbSgbSetColumnPalette(u8 col, u8 p) +{ + // if(col < 0) + // col = 0; + if(col > 19) + col = 19; + + p &= 3; + + u8 *toAddress = &gbSgbATF[col]; + + for(u8 y = 0; y < 18; y++) { + *toAddress = p; + toAddress += 20; + } +} + +void gbSgbSetRowPalette(u8 row, u8 p) +{ + // if(row < 0) + // row = 0; + if(row > 17) + row = 17; + + p &= 3; + + u8 *toAddress = &gbSgbATF[row*20]; + + for(u8 x = 0; x < 20; x++) { + *toAddress++ = p; + } +} + +void gbSgbAttributeDivide() +{ + u8 control = gbSgbPacket[1]; + u8 coord = gbSgbPacket[2]; + u8 colorBR = control & 3; + u8 colorAL = (control >> 2) & 3; + u8 colorOL = (control >> 4) & 3; + + if(control & 0x40) { + if(coord > 17) + coord = 17; + + for(u8 i = 0; i < 18; i++) { + if(i < coord) + gbSgbSetRowPalette(i, colorAL); + else if ( i > coord) + gbSgbSetRowPalette(i, colorBR); + else + gbSgbSetRowPalette(i, colorOL); + } + } else { + if(coord > 19) + coord = 19; + + for(u8 i = 0; i < 20; i++) { + if(i < coord) + gbSgbSetColumnPalette(i, colorAL); + else if ( i > coord) + gbSgbSetColumnPalette(i, colorBR); + else + gbSgbSetColumnPalette(i, colorOL); + } + } +} + +void gbSgbAttributeLine() +{ + u8 *fromAddress = &gbSgbPacket[1]; + + u8 nDataSet = *fromAddress++; + + if(nDataSet > 0x6e) + nDataSet = 0x6e; + + while(nDataSet) { + u8 line = *fromAddress++; + u8 num = line & 0x1f; + u8 pal = (line >> 5) & 0x03; + if(line & 0x80) { + if(num > 17) + num = 17; + gbSgbSetRowPalette(num,pal); + } else { + if(num > 19) + num = 19; + gbSgbSetColumnPalette(num,pal); + } + nDataSet--; + } +} + +void gbSgbAttributeCharacter() +{ + u8 startH = gbSgbPacket[1] & 0x1f; + u8 startV = gbSgbPacket[2] & 0x1f; + int nDataSet = READ16LE(((u16 *)&gbSgbPacket[3])); + int style = gbSgbPacket[5] & 1; + if(startH > 19) + startH = 19; + if(startV > 17) + startV = 17; + + u8 s = 6; + u8 *fromAddress = &gbSgbPacket[6]; + u8 v = *fromAddress++; + + if(style) { + while(nDataSet) { + u8 p = (v >> s) & 3; + gbSgbATF[startV * 20 + startH] = p; + startV++; + if(startV == 18) { + startV = 0; + startH++; + if(startH == 20) + break; + } + + if(s) + s -= 2; + else { + s = 6; + v = *fromAddress++; + nDataSet--; + } + } + } else { + while(nDataSet) { + u8 p = (v >> s) & 3; + gbSgbATF[startV * 20 + startH] = p; + startH++; + if(startH == 20) { + startH = 0; + startV++; + if(startV == 18) + break; + } + + if(s) + s -= 2; + else { + s = 6; + v = *fromAddress++; + nDataSet--; + } + } + } +} + +void gbSgbSetATFList() +{ + gbSgbRenderScreenToBuffer(); + + u8 *fromAddress = gbSgbScreenBuffer; + u8 *toAddress = gbSgbATFList; + + for(int i = 0; i < 45; i++) { + for(int j = 0; j < 90; j++) { + u8 v = *fromAddress++; + u8 s = 6; + if(i == 2) + s = 6; + for(int k = 0; k < 4; k++) { + *toAddress++ = (v >> s) & 0x03; + s -= 2; + } + } + } +} + +void gbSgbMaskEnable() +{ + int gbSgbMaskFlag = gbSgbPacket[1] & 3; + + gbSgbMask = gbSgbMaskFlag; + + switch(gbSgbMaskFlag) { + case 1: + break; + case 2: + gbSgbFillScreen(0x0000); + // memset(&gbPalette[0], 0, 128*sizeof(u16)); + break; + case 3: + gbSgbFillScreen(gbPalette[0]); + break; + } + if(!gbSgbMask) { + if(gbBorderOn) + gbSgbRenderBorder(); + } +} + +void gbSgbChrTransfer() +{ + gbSgbRenderScreenToBuffer(); + + int address = (gbSgbPacket[1] & 1) * (128*32); + + if(gbSgbPacket[1] & 1) + gbSgbCGBSupport |= 2; + else + gbSgbCGBSupport |= 1; + + memcpy(&gbSgbBorderChar[address], gbSgbScreenBuffer, 128 * 32); + + if(gbBorderAutomatic && !gbBorderOn && gbSgbCGBSupport > 4) { + gbBorderOn = 1; + systemGbBorderOn(); + } + + if(gbBorderOn && !gbSgbMask) + gbSgbRenderBorder(); + + if(gbSgbMode && gbCgbMode && gbSgbCGBSupport == 7) { + gbSgbCGBSupport = 0; + gbSgbMode = 0; + gbSgbMask = 0; + gbSgbRenderBorder(); + gbReset(); + } + + if(gbSgbCGBSupport > 4) + gbSgbCGBSupport = 0; +} + +void gbSgbMultiRequest() +{ + if(gbSgbPacket[1] & 1) { + gbSgbMultiplayer = 1; + if(gbSgbPacket[1] & 2) + gbSgbFourPlayers = 1; + else + gbSgbFourPlayers = 0; + gbSgbNextController = 0x0e; + } else { + gbSgbFourPlayers = 0; + gbSgbMultiplayer = 0; + gbSgbNextController = 0x0f; + } +} + +void gbSgbCommand() +{ + int command = gbSgbPacket[0] >> 3; + // int nPacket = gbSgbPacket[0] & 7; + + switch(command) { + case 0x00: + gbSgbSetPalette(0,1,(u16 *)&gbSgbPacket[1]); + break; + case 0x01: + gbSgbSetPalette(2,3,(u16 *)&gbSgbPacket[1]); + break; + case 0x02: + gbSgbSetPalette(0,3,(u16 *)&gbSgbPacket[1]); + break; + case 0x03: + gbSgbSetPalette(1,2,(u16 *)&gbSgbPacket[1]); + break; + case 0x04: + gbSgbAttributeBlock(); + break; + case 0x05: + gbSgbAttributeLine(); + break; + case 0x06: + gbSgbAttributeDivide(); + break; + case 0x07: + gbSgbAttributeCharacter(); + break; + case 0x0a: + gbSgbSetPalette(); + break; + case 0x0b: + gbSgbScpPalette(); + break; + case 0x11: + gbSgbMultiRequest(); + break; + case 0x13: + gbSgbChrTransfer(); + break; + case 0x14: + gbSgbPicture(); + break; + case 0x15: + gbSgbSetATFList(); + break; + case 0x16: + gbSgbSetATF(gbSgbPacket[1] & 0x3f); + break; + case 0x17: + gbSgbMaskEnable(); + break; + } +} + +void gbSgbResetPacketState() +{ + gbSgbPacketState = GBSGB_NONE; + gbSgbPacketTimeout = 0; +} + +void gbSgbDoBitTransfer(u8 value) +{ + value = value & 0x30; + switch(gbSgbPacketState) { + case GBSGB_NONE: + if(value == 0) { + gbSgbPacketState = GBSGB_RESET; + gbSgbPacketTimeout = GBSGB_PACKET_TIMEOUT; + } else if (value == 0x30) { + if(gbSgbMultiplayer) { + if((gbSgbReadingController & 7) == 7) { + gbSgbReadingController = 0; + if(gbSgbMultiplayer) { + gbSgbNextController--; + if(gbSgbFourPlayers) { + if(gbSgbNextController == 0x0b) + gbSgbNextController = 0x0f; + } else { + if(gbSgbNextController == 0x0d) + gbSgbNextController = 0x0f; + } + } + } else { + gbSgbReadingController &= 3; + } + } + gbSgbPacketTimeout = 0; + } else { + if(value == 0x10) + gbSgbReadingController |= 0x2; + else if(value == 0x20) + gbSgbReadingController |= 0x01; + gbSgbPacketTimeout = 0; + } + gbSgbPacketTimeout = 0; + break; + case GBSGB_RESET: + if(value == 0x30) { + gbSgbPacketState = GBSGB_PACKET_TRANSMIT; + gbSgbPacketByte = 0; + gbSgbPacketNBits = 0; + gbSgbPacketTimeout = GBSGB_PACKET_TIMEOUT; + } else if(value == 0x00) { + gbSgbPacketTimeout = GBSGB_PACKET_TIMEOUT; + gbSgbPacketState = GBSGB_RESET; + } else { + gbSgbPacketState = GBSGB_NONE; + gbSgbPacketTimeout = 0; + } + break; + case GBSGB_PACKET_TRANSMIT: + if(value == 0) { + gbSgbPacketState = GBSGB_RESET; + gbSgbPacketTimeout = 0; + } else if (value == 0x30){ + if(gbSgbPacketNBits == 128) { + gbSgbPacketNBits = 0; + gbSgbPacketByte = 0; + gbSgbPacketNumber++; + gbSgbPacketTimeout = 0; + if(gbSgbPacketNumber == (gbSgbPacket[0] & 7)) { + gbSgbCommand(); + gbSgbPacketNumber = 0; + gbSgbPacketState = GBSGB_NONE; + gbSgbPacketTimeout = 0; + } + } else { + if(gbSgbPacketNBits < 128) { + gbSgbPacket[gbSgbPacketNumber * 16 + gbSgbPacketByte] >>= 1; + gbSgbPacket[gbSgbPacketNumber * 16 + gbSgbPacketByte] |= gbSgbBit; + gbSgbPacketNBits++; + if(!(gbSgbPacketNBits & 7)) { + gbSgbPacketByte++; + } + gbSgbPacketTimeout = GBSGB_PACKET_TIMEOUT; + } + } + } else { + if(value == 0x20) + gbSgbBit = 0x00; + else + gbSgbBit = 0x80; + gbSgbPacketTimeout = GBSGB_PACKET_TIMEOUT; + } + gbSgbReadingController = 0; + break; + default: + gbSgbPacketState = GBSGB_NONE; + gbSgbPacketTimeout = 0; + break; + } +} + +variable_desc gbSgbSaveStruct[] = { + { &gbSgbMask, sizeof(int) }, + { &gbSgbPacketState, sizeof(int) }, + { &gbSgbBit, sizeof(int) }, + { &gbSgbPacketNBits, sizeof(int) }, + { &gbSgbPacketByte, sizeof(int) }, + { &gbSgbPacketNumber, sizeof(int) }, + { &gbSgbMultiplayer, sizeof(int) }, + { &gbSgbNextController, sizeof(u8) }, + { &gbSgbReadingController, sizeof(u8) }, + { NULL, 0 } +}; + +variable_desc gbSgbSaveStructV3[] = { + { &gbSgbMask, sizeof(int) }, + { &gbSgbPacketState, sizeof(int) }, + { &gbSgbBit, sizeof(int) }, + { &gbSgbPacketNBits, sizeof(int) }, + { &gbSgbPacketByte, sizeof(int) }, + { &gbSgbPacketNumber, sizeof(int) }, + { &gbSgbMultiplayer, sizeof(int) }, + { &gbSgbNextController, sizeof(u8) }, + { &gbSgbReadingController, sizeof(u8) }, + { &gbSgbFourPlayers, sizeof(int) }, + { NULL, 0 } +}; + + +void gbSgbSaveGame(gzFile gzFile) +{ + utilWriteData(gzFile, gbSgbSaveStructV3); + + utilGzWrite(gzFile, gbSgbBorder, 2048); + utilGzWrite(gzFile, gbSgbBorderChar, 32*256); + + utilGzWrite(gzFile, gbSgbPacket, 16*7); + + utilGzWrite(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16)); + utilGzWrite(gzFile, gbSgbATF, 20 * 18); + utilGzWrite(gzFile, gbSgbATFList, 45 * 20 * 18); + + utilGzWrite(gzFile, gbSgbScreenBuffer, 4160); + utilGzWrite(gzFile, &gbSgbMode, sizeof(gbSgbMode)); + utilGzWrite(gzFile, &gbSgbCGBSupport, sizeof(gbSgbCGBSupport)); + utilGzWrite(gzFile, &gbSgbPacketTimeout, sizeof(gbSgbPacketTimeout)); +} + +void gbSgbReadGame(gzFile gzFile, int version) +{ + if(version >= 3) + utilReadData(gzFile, gbSgbSaveStructV3); + else { + utilReadData(gzFile, gbSgbSaveStruct); + gbSgbFourPlayers = 0; + } + + if(version >= 8) { + utilGzRead(gzFile, gbSgbBorder, 2048); + utilGzRead(gzFile, gbSgbBorderChar, 32*256); + } + + utilGzRead(gzFile, gbSgbPacket, 16*7); + + utilGzRead(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16)); + utilGzRead(gzFile, gbSgbATF, 20 * 18); + utilGzRead(gzFile, gbSgbATFList, 45 * 20 * 18); + + if(version >= 11) + { + utilGzRead(gzFile, gbSgbScreenBuffer, 4160); + utilGzRead(gzFile, &gbSgbMode, sizeof(gbSgbMode)); + utilGzRead(gzFile, &gbSgbCGBSupport, sizeof(gbSgbCGBSupport)); + utilGzRead(gzFile, &gbSgbPacketTimeout, sizeof(gbSgbPacketTimeout)); + } +} diff --git a/src/gb/gbSGB.h b/src/gb/gbSGB.h new file mode 100644 index 0000000..95afb2c --- /dev/null +++ b/src/gb/gbSGB.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +void gbSgbInit(); +void gbSgbShutdown(); +void gbSgbCommand(); +void gbSgbResetPacketState(); +void gbSgbReset(); +void gbSgbDoBitTransfer(u8); +void gbSgbSaveGame(gzFile); +void gbSgbReadGame(gzFile, int version); +void gbSgbRenderBorder(); + +extern u8 gbSgbATF[20*18]; +extern int gbSgbMode; +extern int gbSgbMask; +extern int gbSgbMultiplayer; +extern u8 gbSgbNextController; +extern int gbSgbPacketTimeout; +extern u8 gbSgbReadingController; +extern int gbSgbFourPlayers; + + diff --git a/src/gb/gbSound.cpp b/src/gb/gbSound.cpp new file mode 100644 index 0000000..b17304d --- /dev/null +++ b/src/gb/gbSound.cpp @@ -0,0 +1,973 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifdef WIN32 +# include "../win32/stdafx.h" +# include "../win32/VBA.h" +#endif + +#include + +#include "../System.h" +#include "../Util.h" +#include "gbGlobals.h" +#include "gbSound.h" + +extern u8 soundBuffer[6][735]; +extern u16 soundFinalWave[1470]; +extern int soundVolume; + +#define SOUND_MAGIC 0x60000000 +#define SOUND_MAGIC_2 0x30000000 +#define NOISE_MAGIC 5 + +extern int speed; + +extern void soundResume(); + +extern u8 soundWavePattern[4][32]; + +extern int soundBufferLen; +extern int soundBufferTotalLen; +extern int soundQuality; +extern int soundPaused; +extern int soundPlay; +extern int soundTicks; +extern int SOUND_CLOCK_TICKS; +extern u32 soundNextPosition; + +extern int soundLevel1; +extern int soundLevel2; +extern int soundBalance; +extern int soundMasterOn; +extern int soundIndex; +extern int soundBufferIndex; +int soundVIN = 0; +extern int soundDebug; + +extern int sound1On; +extern int sound1ATL; +extern int sound1Skip; +extern int sound1Index; +extern int sound1Continue; +extern int sound1EnvelopeVolume; +extern int sound1EnvelopeATL; +extern int sound1EnvelopeUpDown; +extern int sound1EnvelopeATLReload; +extern int sound1SweepATL; +extern int sound1SweepATLReload; +extern int sound1SweepSteps; +extern int sound1SweepUpDown; +extern int sound1SweepStep; +extern u8 *sound1Wave; + +extern int sound2On; +extern int sound2ATL; +extern int sound2Skip; +extern int sound2Index; +extern int sound2Continue; +extern int sound2EnvelopeVolume; +extern int sound2EnvelopeATL; +extern int sound2EnvelopeUpDown; +extern int sound2EnvelopeATLReload; +extern u8 *sound2Wave; + +extern int sound3On; +extern int sound3ATL; +extern int sound3Skip; +extern int sound3Index; +extern int sound3Continue; +extern int sound3OutputLevel; +extern int sound3Last; + +extern int sound4On; +extern int sound4Clock; +extern int sound4ATL; +extern int sound4Skip; +extern int sound4Index; +extern int sound4ShiftRight; +extern int sound4ShiftSkip; +extern int sound4ShiftIndex; +extern int sound4NSteps; +extern int sound4CountDown; +extern int sound4Continue; +extern int sound4EnvelopeVolume; +extern int sound4EnvelopeATL; +extern int sound4EnvelopeUpDown; +extern int sound4EnvelopeATLReload; + +extern int soundEnableFlag; + +extern int soundFreqRatio[8]; +extern int soundShiftClock[16]; + +extern s16 soundFilter[4000]; +extern s16 soundLeft[5]; +extern s16 soundRight[5]; +extern int soundEchoIndex; +extern bool soundEcho; +extern bool soundLowPass; +extern bool soundReverse; +extern bool soundOffFlag; + +bool gbDigitalSound = false; + +void gbSoundEvent(register u16 address, register int data) +{ + int freq = 0; + + gbMemory[address] = data; + +#ifndef FINAL_VERSION + if(soundDebug) { + // don't translate. debug only + log("Sound event: %08lx %02x\n", address, data); + } +#endif + switch(address) { + case NR10: + sound1SweepATL = sound1SweepATLReload = 344 * ((data >> 4) & 7); + sound1SweepSteps = data & 7; + sound1SweepUpDown = data & 0x08; + sound1SweepStep = 0; + break; + case NR11: + sound1Wave = soundWavePattern[data >> 6]; + sound1ATL = 172 * (64 - (data & 0x3f)); + break; + case NR12: + sound1EnvelopeVolume = data >> 4; + sound1EnvelopeUpDown = data & 0x08; + sound1EnvelopeATLReload = sound1EnvelopeATL = 689 * (data & 7); + break; + case NR13: + freq = (((int)(gbMemory[NR14] & 7)) << 8) | data; + sound1ATL = 172 * (64 - (gbMemory[NR11] & 0x3f)); + freq = 2048 - freq; + if(freq) { + sound1Skip = SOUND_MAGIC / freq; + } else + sound1Skip = 0; + break; + case NR14: + freq = (((int)(data&7) << 8) | gbMemory[NR13]); + freq = 2048 - freq; + sound1ATL = 172 * (64 - (gbMemory[NR11] & 0x3f)); + sound1Continue = data & 0x40; + if(freq) { + sound1Skip = SOUND_MAGIC / freq; + } else + sound1Skip = 0; + if(data & 0x80) { + gbMemory[NR52] |= 1; + sound1EnvelopeVolume = gbMemory[NR12] >> 4; + sound1EnvelopeUpDown = gbMemory[NR12] & 0x08; + sound1ATL = 172 * (64 - (gbMemory[NR11] & 0x3f)); + sound1EnvelopeATLReload = sound1EnvelopeATL = 689 * (gbMemory[NR12] & 7); + sound1SweepATL = sound1SweepATLReload = 344 * ((gbMemory[NR10] >> 4) & 7); + sound1SweepSteps = gbMemory[NR10] & 7; + sound1SweepUpDown = gbMemory[NR10] & 0x08; + sound1SweepStep = 0; + + sound1Index = 0; + sound1On = 1; + } + break; + case NR21: + sound2Wave = soundWavePattern[data >> 6]; + sound2ATL = 172 * (64 - (data & 0x3f)); + break; + case NR22: + sound2EnvelopeVolume = data >> 4; + sound2EnvelopeUpDown = data & 0x08; + sound2EnvelopeATLReload = sound2EnvelopeATL = 689 * (data & 7); + break; + case NR23: + freq = (((int)(gbMemory[NR24] & 7)) << 8) | data; + sound2ATL = 172 * (64 - (gbMemory[NR21] & 0x3f)); + freq = 2048 - freq; + if(freq) { + sound2Skip = SOUND_MAGIC / freq; + } else + sound2Skip = 0; + break; + case NR24: + freq = (((int)(data&7) << 8) | gbMemory[NR23]); + freq = 2048 - freq; + sound2ATL = 172 * (64 - (gbMemory[NR21] & 0x3f)); + sound2Continue = data & 0x40; + if(freq) { + sound2Skip = SOUND_MAGIC / freq; + } else + sound2Skip = 0; + if(data & 0x80) { + gbMemory[NR52] |= 2; + sound2EnvelopeVolume = gbMemory[NR22] >> 4; + sound2EnvelopeUpDown = gbMemory[NR22] & 0x08; + sound2ATL = 172 * (64 - (gbMemory[NR21] & 0x3f)); + sound2EnvelopeATLReload = sound2EnvelopeATL = 689 * (gbMemory[NR22] & 7); + + sound2Index = 0; + sound2On = 1; + } + break; + case NR30: + if(!(data & 0x80)) { + gbMemory[NR52] &= 0xfb; + sound3On = 0; + } + break; + case NR31: + sound3ATL = 172 * (256-data); + break; + case NR32: + sound3OutputLevel = (data >> 5) & 3; + break; + case NR33: + freq = 2048 - (((int)(gbMemory[NR34]&7) << 8) | data); + if(freq) { + sound3Skip = SOUND_MAGIC_2 / freq; + } else + sound3Skip = 0; + break; + case NR34: + freq = 2048 - (((data &7) << 8) | (int)gbMemory[NR33]); + if(freq) { + sound3Skip = SOUND_MAGIC_2 / freq; + } else { + sound3Skip = 0; + } + sound3Continue = data & 0x40; + if((data & 0x80) && (gbMemory[NR30] & 0x80)) { + gbMemory[NR52] |= 4; + sound3ATL = 172 * (256 - gbMemory[NR31]); + sound3Index = 0; + sound3On = 1; + } + break; + case NR41: + sound4ATL = 172 * (64 - (data & 0x3f)); + break; + case NR42: + sound4EnvelopeVolume = data >> 4; + sound4EnvelopeUpDown = data & 0x08; + sound4EnvelopeATLReload = sound4EnvelopeATL = 689 * (data & 7); + break; + case NR43: + freq = soundFreqRatio[data & 7]; + sound4NSteps = data & 0x08; + + sound4Skip = (freq << 8) / NOISE_MAGIC; + + sound4Clock = data >> 4; + + freq = freq / soundShiftClock[sound4Clock]; + + sound4ShiftSkip = (freq << 8) / NOISE_MAGIC; + + break; + case NR44: + sound4Continue = data & 0x40; + if(data & 0x80) { + gbMemory[NR52] |= 8; + sound4EnvelopeVolume = gbMemory[NR42] >> 4; + sound4EnvelopeUpDown = gbMemory[NR42] & 0x08; + sound4ATL = 172 * (64 - (gbMemory[NR41] & 0x3f)); + sound4EnvelopeATLReload = sound4EnvelopeATL = 689 * (gbMemory[NR42] & 7); + + sound4On = 1; + + sound4Index = 0; + sound4ShiftIndex = 0; + + freq = soundFreqRatio[gbMemory[NR43] & 7]; + + sound4Skip = (freq << 8) / NOISE_MAGIC; + + sound4NSteps = gbMemory[NR43] & 0x08; + + freq = freq / soundShiftClock[gbMemory[NR43] >> 4]; + + sound4ShiftSkip = (freq << 8) / NOISE_MAGIC; + if(sound4NSteps) + sound4ShiftRight = 0x7fff; + else + sound4ShiftRight = 0x7f; + } + break; + case NR50: + soundVIN = data & 0x88; + soundLevel1 = data & 7; + soundLevel2 = (data >> 4) & 7; + break; + case NR51: + soundBalance = (data & soundEnableFlag); + gbMemory[address] = data; + break; + case NR52: + soundMasterOn = data & 0x80; + if(!(data & 0x80)) { + sound1On = 0; + sound2On = 0; + sound3On = 0; + sound4On = 0; + } + break; + } + + gbDigitalSound = true; + + if(sound1On && sound1EnvelopeVolume != 0) + gbDigitalSound = false; + if(sound2On && sound2EnvelopeVolume != 0) + gbDigitalSound = false; + if(sound3On && sound3OutputLevel != 0) + gbDigitalSound = false; + if(sound4On && sound4EnvelopeVolume != 0) + gbDigitalSound = false; +} + + void gbSoundChannel1() +{ + int vol = sound1EnvelopeVolume; + + int freq = 0; + + int value = 0; + + if(sound1On && (sound1ATL || !sound1Continue)) { + sound1Index += soundQuality*sound1Skip; + sound1Index &= 0x1fffffff; + + value = ((s8)sound1Wave[sound1Index>>24]) * vol; + } + + soundBuffer[0][soundIndex] = value; + + + if(sound1On) { + if(sound1ATL) { + sound1ATL-=soundQuality; + + if(sound1ATL <=0 && sound1Continue) { + gbMemory[NR52] &= 0xfe; + sound1On = 0; + } + } + + if(sound1EnvelopeATL) { + sound1EnvelopeATL-=soundQuality; + + if(sound1EnvelopeATL<=0) { + if(sound1EnvelopeUpDown) { + if(sound1EnvelopeVolume < 15) + sound1EnvelopeVolume++; + } else { + if(sound1EnvelopeVolume) + sound1EnvelopeVolume--; + } + + sound1EnvelopeATL += sound1EnvelopeATLReload; + } + } + + if(sound1SweepATL) { + sound1SweepATL-=soundQuality; + + if(sound1SweepATL<=0) { + freq = (((int)(gbMemory[NR14]&7) << 8) | gbMemory[NR13]); + + int updown = 1; + + if(sound1SweepUpDown) + updown = -1; + + int newfreq = 0; + if(sound1SweepSteps) { + newfreq = freq + updown * freq / (1 << sound1SweepSteps); + if(newfreq == freq) + newfreq = 0; + } else + newfreq = freq; + + if(newfreq < 0) { + sound1SweepATL += sound1SweepATLReload; + } else if(newfreq > 2047) { + sound1SweepATL = 0; + sound1On = 0; + gbMemory[NR52] &= 0xfe; + } else { + sound1SweepATL += sound1SweepATLReload; + sound1Skip = SOUND_MAGIC/(2048 - newfreq); + + gbMemory[NR13] = newfreq & 0xff; + gbMemory[NR14] = (gbMemory[NR14] & 0xf8) |((newfreq >> 8) & 7); + } + } + } + } +} + +void gbSoundChannel2() +{ + // int freq = 0; + int vol = sound2EnvelopeVolume; + + int value = 0; + + if(sound2On && (sound2ATL || !sound2Continue)) { + sound2Index += soundQuality*sound2Skip; + sound2Index &= 0x1fffffff; + + value = ((s8)sound2Wave[sound2Index>>24]) * vol; + } + + soundBuffer[1][soundIndex] = value; + + if(sound2On) { + if(sound2ATL) { + sound2ATL-=soundQuality; + + if(sound2ATL <= 0 && sound2Continue) { + gbMemory[NR52] &= 0xfd; + sound2On = 0; + } + } + + if(sound2EnvelopeATL) { + sound2EnvelopeATL-=soundQuality; + + if(sound2EnvelopeATL <= 0) { + if(sound2EnvelopeUpDown) { + if(sound2EnvelopeVolume < 15) + sound2EnvelopeVolume++; + } else { + if(sound2EnvelopeVolume) + sound2EnvelopeVolume--; + } + sound2EnvelopeATL += sound2EnvelopeATLReload; + } + } + } +} + +void gbSoundChannel3() +{ + int value = sound3Last; + + if(sound3On && (sound3ATL || !sound3Continue)) { + sound3Index += soundQuality*sound3Skip; + sound3Index &= 0x1fffffff; + + value = gbMemory[0xff30 + (sound3Index>>25)]; + + if( (sound3Index & 0x01000000)) { + value &= 0x0f; + } else { + value >>= 4; + } + + value -= 8; + + switch(sound3OutputLevel) { + case 0: + value = 0; + break; + case 1: + break; + case 2: + value = (value >> 1); + break; + case 3: + value = (value >> 2); + break; + } + sound3Last = value; + } + + soundBuffer[2][soundIndex] = value; + + if(sound3On) { + if(sound3ATL) { + sound3ATL-=soundQuality; + + if(sound3ATL <= 0 && sound3Continue) { + gbMemory[NR52] &= 0xfb; + sound3On = 0; + } + } + } +} + +void gbSoundChannel4() +{ + int vol = sound4EnvelopeVolume; + + int value = 0; + + if(sound4Clock <= 0x0c) { + if(sound4On && (sound4ATL || !sound4Continue)) { + sound4Index += soundQuality*sound4Skip; + sound4ShiftIndex += soundQuality*sound4ShiftSkip; + + if(sound4NSteps) { + while(sound4ShiftIndex > 0x1fffff) { + sound4ShiftRight = (((sound4ShiftRight << 6) ^ + (sound4ShiftRight << 5)) & 0x40) | + (sound4ShiftRight >> 1); + sound4ShiftIndex -= 0x200000; + } + } else { + while(sound4ShiftIndex > 0x1fffff) { + sound4ShiftRight = (((sound4ShiftRight << 14) ^ + (sound4ShiftRight << 13)) & 0x4000) | + (sound4ShiftRight >> 1); + + sound4ShiftIndex -= 0x200000; + } + } + + sound4Index &= 0x1fffff; + sound4ShiftIndex &= 0x1fffff; + + value = ((sound4ShiftRight & 1)*2-1) * vol; + } else { + value = 0; + } + } + + soundBuffer[3][soundIndex] = value; + + if(sound4On) { + if(sound4ATL) { + sound4ATL-=soundQuality; + + if(sound4ATL <= 0 && sound4Continue) { + gbMemory[NR52] &= 0xfd; + sound4On = 0; + } + } + + if(sound4EnvelopeATL) { + sound4EnvelopeATL-=soundQuality; + + if(sound4EnvelopeATL <= 0) { + if(sound4EnvelopeUpDown) { + if(sound4EnvelopeVolume < 15) + sound4EnvelopeVolume++; + } else { + if(sound4EnvelopeVolume) + sound4EnvelopeVolume--; + } + sound4EnvelopeATL += sound4EnvelopeATLReload; + } + } + } +} + +void gbSoundMix() +{ + int res = 0; + + if(soundBalance & 16) { + res += ((s8)soundBuffer[0][soundIndex]); + } + if(soundBalance & 32) { + res += ((s8)soundBuffer[1][soundIndex]); + } + if(soundBalance & 64) { + res += ((s8)soundBuffer[2][soundIndex]); + } + if(soundBalance & 128) { + res += ((s8)soundBuffer[3][soundIndex]); + } + + if(gbDigitalSound) + res = soundLevel1*256; + else + res *= soundLevel1*60; + + if(soundEcho) { + res *= 2; + res += soundFilter[soundEchoIndex]; + res /= 2; + soundFilter[soundEchoIndex++] = res; + } + + if(soundLowPass) { + soundLeft[4] = soundLeft[3]; + soundLeft[3] = soundLeft[2]; + soundLeft[2] = soundLeft[1]; + soundLeft[1] = soundLeft[0]; + soundLeft[0] = res; + res = (soundLeft[4] + 2*soundLeft[3] + 8*soundLeft[2] + 2*soundLeft[1] + + soundLeft[0])/14; + } + + switch(soundVolume) { + case 0: + case 1: + case 2: + case 3: + res *= (soundVolume+1); + break; + case 4: + res >>= 2; + break; + case 5: + res >>= 1; + break; + } + + if(res > 32767) + res = 32767; + if(res < -32768) + res = -32768; + + if(soundReverse) + soundFinalWave[++soundBufferIndex] = res; + else + soundFinalWave[soundBufferIndex++] = res; + + res = 0; + + if(soundBalance & 1) { + res += ((s8)soundBuffer[0][soundIndex]); + } + if(soundBalance & 2) { + res += ((s8)soundBuffer[1][soundIndex]); + } + if(soundBalance & 4) { + res += ((s8)soundBuffer[2][soundIndex]); + } + if(soundBalance & 8) { + res += ((s8)soundBuffer[3][soundIndex]); + } + + if(gbDigitalSound) + res = soundLevel2*256; + else + res *= soundLevel2*60; + + if(soundEcho) { + res *= 2; + res += soundFilter[soundEchoIndex]; + res /= 2; + soundFilter[soundEchoIndex++] = res; + + if(soundEchoIndex >= 4000) + soundEchoIndex = 0; + } + + if(soundLowPass) { + soundRight[4] = soundRight[3]; + soundRight[3] = soundRight[2]; + soundRight[2] = soundRight[1]; + soundRight[1] = soundRight[0]; + soundRight[0] = res; + res = (soundRight[4] + 2*soundRight[3] + 8*soundRight[2] + 2*soundRight[1] + + soundRight[0])/14; + } + + switch(soundVolume) { + case 0: + case 1: + case 2: + case 3: + res *= (soundVolume+1); + break; + case 4: + res >>= 2; + break; + case 5: + res >>= 1; + break; + } + + if(res > 32767) + res = 32767; + if(res < -32768) + res = -32768; + + if(soundReverse) + soundFinalWave[-1+soundBufferIndex++] = res; + else + soundFinalWave[soundBufferIndex++] = res; +} + +void gbSoundTick() +{ + if(systemSoundOn) { + if(soundMasterOn +#if (defined(WIN32) && !defined(SDL)) + && !theApp.frameAdvanceMuteNow +#endif + ) { + gbSoundChannel1(); + gbSoundChannel2(); + gbSoundChannel3(); + gbSoundChannel4(); + + gbSoundMix(); + } else { + soundFinalWave[soundBufferIndex++] = 0; + soundFinalWave[soundBufferIndex++] = 0; + } + + soundIndex++; + + if(2*soundBufferIndex >= soundBufferLen) { + if(systemSoundOn) { + if(soundPaused) { + soundResume(); + } + + systemWriteDataToSoundBuffer(); + } + soundIndex = 0; + soundBufferIndex = 0; + } + } +} + +void gbSoundReset() +{ + soundPaused = 1; + soundPlay = 0; + SOUND_CLOCK_TICKS = soundQuality * 24; +// soundTicks = SOUND_CLOCK_TICKS; + soundTicks = 0; + soundNextPosition = 0; + soundMasterOn = 1; + soundIndex = 0; + soundBufferIndex = 0; + soundLevel1 = 7; + soundLevel2 = 7; + soundVIN = 0; + + sound1On = 0; + sound1ATL = 0; + sound1Skip = 0; + sound1Index = 0; + sound1Continue = 0; + sound1EnvelopeVolume = 0; + sound1EnvelopeATL = 0; + sound1EnvelopeUpDown = 0; + sound1EnvelopeATLReload = 0; + sound1SweepATL = 0; + sound1SweepATLReload = 0; + sound1SweepSteps = 0; + sound1SweepUpDown = 0; + sound1SweepStep = 0; + sound1Wave = soundWavePattern[2]; + + sound2On = 0; + sound2ATL = 0; + sound2Skip = 0; + sound2Index = 0; + sound2Continue = 0; + sound2EnvelopeVolume = 0; + sound2EnvelopeATL = 0; + sound2EnvelopeUpDown = 0; + sound2EnvelopeATLReload = 0; + sound2Wave = soundWavePattern[2]; + + sound3On = 0; + sound3ATL = 0; + sound3Skip = 0; + sound3Index = 0; + sound3Continue = 0; + sound3OutputLevel = 0; + + sound4On = 0; + sound4Clock = 0; + sound4ATL = 0; + sound4Skip = 0; + sound4Index = 0; + sound4ShiftRight = 0x7f; + sound4NSteps = 0; + sound4CountDown = 0; + sound4Continue = 0; + sound4EnvelopeVolume = 0; + sound4EnvelopeATL = 0; + sound4EnvelopeUpDown = 0; + sound4EnvelopeATLReload = 0; + + // don't translate + if(soundDebug) { + log("*** Sound Init ***\n"); + } + + gbSoundEvent(0xff10, 0x80); + gbSoundEvent(0xff11, 0xbf); + gbSoundEvent(0xff12, 0xf3); + gbSoundEvent(0xff14, 0xbf); + gbSoundEvent(0xff16, 0x3f); + gbSoundEvent(0xff17, 0x00); + gbSoundEvent(0xff19, 0xbf); + + gbSoundEvent(0xff1a, 0x7f); + gbSoundEvent(0xff1b, 0xff); + gbSoundEvent(0xff1c, 0xbf); + gbSoundEvent(0xff1e, 0xbf); + + gbSoundEvent(0xff20, 0xff); + gbSoundEvent(0xff21, 0x00); + gbSoundEvent(0xff22, 0x00); + gbSoundEvent(0xff23, 0xbf); + gbSoundEvent(0xff24, 0x77); + gbSoundEvent(0xff25, 0xf3); + + gbSoundEvent(0xff26, 0xf0); + + // don't translate + if(soundDebug) { + log("*** Sound Init Complete ***\n"); + } + + sound1On = 0; + sound2On = 0; + sound3On = 0; + sound4On = 0; + + int addr = 0xff30; + + while(addr < 0xff40) { + gbMemory[addr++] = 0x00; + gbMemory[addr++] = 0xff; + } + + memset(soundFinalWave, 0x00, soundBufferLen); + + + memset(soundFilter, 0, sizeof(soundFilter)); + soundEchoIndex = 0; +} + +extern bool soundInit(); +extern void soundShutdown(); + +void gbSoundSetQuality(int quality) +{ + if(soundQuality != quality && systemCanChangeSoundQuality()) { + if(!soundOffFlag) + soundShutdown(); + soundQuality = quality; + soundNextPosition = 0; + if(!soundOffFlag) + soundInit(); + SOUND_CLOCK_TICKS = (gbSpeed ? 2 : 1) * 24 * soundQuality; + soundIndex = 0; + soundBufferIndex = 0; + } else { + soundNextPosition = 0; + SOUND_CLOCK_TICKS = (gbSpeed ? 2 : 1) * 24 * soundQuality; + soundIndex = 0; + soundBufferIndex = 0; + } +} + +variable_desc gbSoundSaveStruct[] = { + { &soundPaused, sizeof(int) }, + { &soundPlay, sizeof(int) }, + { &soundTicks, sizeof(int) }, + { &SOUND_CLOCK_TICKS, sizeof(int) }, + { &soundLevel1, sizeof(int) }, + { &soundLevel2, sizeof(int) }, + { &soundBalance, sizeof(int) }, + { &soundMasterOn, sizeof(int) }, + { &soundIndex, sizeof(int) }, + { &soundVIN, sizeof(int) }, + { &sound1On, sizeof(int) }, + { &sound1ATL, sizeof(int) }, + { &sound1Skip, sizeof(int) }, + { &sound1Index, sizeof(int) }, + { &sound1Continue, sizeof(int) }, + { &sound1EnvelopeVolume, sizeof(int) }, + { &sound1EnvelopeATL, sizeof(int) }, + { &sound1EnvelopeATLReload, sizeof(int) }, + { &sound1EnvelopeUpDown, sizeof(int) }, + { &sound1SweepATL, sizeof(int) }, + { &sound1SweepATLReload, sizeof(int) }, + { &sound1SweepSteps, sizeof(int) }, + { &sound1SweepUpDown, sizeof(int) }, + { &sound1SweepStep, sizeof(int) }, + { &sound2On, sizeof(int) }, + { &sound2ATL, sizeof(int) }, + { &sound2Skip, sizeof(int) }, + { &sound2Index, sizeof(int) }, + { &sound2Continue, sizeof(int) }, + { &sound2EnvelopeVolume, sizeof(int) }, + { &sound2EnvelopeATL, sizeof(int) }, + { &sound2EnvelopeATLReload, sizeof(int) }, + { &sound2EnvelopeUpDown, sizeof(int) }, + { &sound3On, sizeof(int) }, + { &sound3ATL, sizeof(int) }, + { &sound3Skip, sizeof(int) }, + { &sound3Index, sizeof(int) }, + { &sound3Continue, sizeof(int) }, + { &sound3OutputLevel, sizeof(int) }, + { &sound4On, sizeof(int) }, + { &sound4ATL, sizeof(int) }, + { &sound4Skip, sizeof(int) }, + { &sound4Index, sizeof(int) }, + { &sound4Clock, sizeof(int) }, + { &sound4ShiftRight, sizeof(int) }, + { &sound4ShiftSkip, sizeof(int) }, + { &sound4ShiftIndex, sizeof(int) }, + { &sound4NSteps, sizeof(int) }, + { &sound4CountDown, sizeof(int) }, + { &sound4Continue, sizeof(int) }, + { &sound4EnvelopeVolume, sizeof(int) }, + { &sound4EnvelopeATL, sizeof(int) }, + { &sound4EnvelopeATLReload, sizeof(int) }, + { &sound4EnvelopeUpDown, sizeof(int) }, + { &soundEnableFlag, sizeof(int) }, + { NULL, 0 } +}; + +void gbSoundSaveGame(gzFile gzFile) +{ + utilWriteData(gzFile, gbSoundSaveStruct); + + utilGzWrite(gzFile, soundBuffer, 4*735); + utilGzWrite(gzFile, soundFinalWave, 2*735); + utilGzWrite(gzFile, &soundQuality, sizeof(int)); +} + +void gbSoundReadGame(int version,gzFile gzFile) +{ + utilReadData(gzFile, gbSoundSaveStruct); + + soundBufferIndex = soundIndex * 2; + + utilGzRead(gzFile, soundBuffer, 4*735); + utilGzRead(gzFile, soundFinalWave, 2*735); + + if(version >=7) { + int quality = 1; + utilGzRead(gzFile, &quality, sizeof(int)); + gbSoundSetQuality(quality); + } else { + soundQuality = -1; + gbSoundSetQuality(1); + } + + sound1Wave = soundWavePattern[gbMemory[NR11] >> 6]; + sound2Wave = soundWavePattern[gbMemory[NR21] >> 6]; +} diff --git a/src/gb/gbSound.h b/src/gb/gbSound.h new file mode 100644 index 0000000..50658b2 --- /dev/null +++ b/src/gb/gbSound.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#define NR10 0xff10 +#define NR11 0xff11 +#define NR12 0xff12 +#define NR13 0xff13 +#define NR14 0xff14 +#define NR21 0xff16 +#define NR22 0xff17 +#define NR23 0xff18 +#define NR24 0xff19 +#define NR30 0xff1a +#define NR31 0xff1b +#define NR32 0xff1c +#define NR33 0xff1d +#define NR34 0xff1e +#define NR41 0xff20 +#define NR42 0xff21 +#define NR43 0xff22 +#define NR44 0xff23 +#define NR50 0xff24 +#define NR51 0xff25 +#define NR52 0xff26 + +#define SOUND_EVENT(address,value) \ + gbSoundEvent(address,value) + +extern void gbSoundTick(); +extern void gbSoundPause(); +extern void gbSoundResume(); +extern void gbSoundEnable(int); +extern void gbSoundDisable(int); +extern int gbSoundGetEnable(); +extern void gbSoundReset(); +extern void gbSoundSaveGame(gzFile); +extern void gbSoundReadGame(int,gzFile); +extern void gbSoundEvent(register u16, register int); +extern void gbSoundSetQuality(int); + +extern int soundTicks; +extern int soundQuality; +extern int SOUND_CLOCK_TICKS; diff --git a/src/getopt.c b/src/getopt.c new file mode 100644 index 0000000..4235bad --- /dev/null +++ b/src/getopt.c @@ -0,0 +1,1060 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 + Free Software Foundation, Inc. + + NOTE: This source is derived from an old version taken from the GNU C + Library (glibc). + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include +# include +#endif /* GNU C library. */ + +#ifdef VMS +# include +# if HAVE_STRING_H - 0 +# include +# endif +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +# ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif +#endif + +#ifdef _MSC_VER +#include +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include +# define my_index strchr +#else + +# if HAVE_STRING_H +# include +# else +# if HAVE_STRINGS_H +# include +# endif +# endif + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/src/getopt.h b/src/getopt.h new file mode 100644 index 0000000..cb5feba --- /dev/null +++ b/src/getopt.h @@ -0,0 +1,141 @@ +/* Declarations for getopt. + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is + undefined, we haven't run the autoconf check so provide the + declaration without arguments. If it is 0, we checked and failed + to find the declaration so provide a fully prototyped one. If it + is 1, we found it so don't provide any declaration at all. */ +#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT) +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +# if !defined (HAVE_DECL_GETOPT) +extern int getopt (); +# endif +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* getopt.h */ diff --git a/src/getopt1.c b/src/getopt1.c new file mode 100644 index 0000000..a3637c2 --- /dev/null +++ b/src/getopt1.c @@ -0,0 +1,190 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + + NOTE: This source is derived from an old version taken from the GNU C + Library (glibc). + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "getopt.h" + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/src/gtk/Makefile.am b/src/gtk/Makefile.am new file mode 100644 index 0000000..f55a545 --- /dev/null +++ b/src/gtk/Makefile.am @@ -0,0 +1,110 @@ +SUBDIRS = images + +bin_PROGRAMS = gvba + +noinst_LIBRARIES = libgba.a + +gvba_SOURCES = \ + configfile.cpp \ + configfile.h \ + filters.cpp \ + filters.h \ + input.cpp \ + input.h \ + intl.h \ + joypadconfig.cpp \ + joypadconfig.h \ + main.cpp \ + menuitem.h \ + screenarea.cpp \ + screenarea.h \ + sigccompat.h \ + system.cpp \ + tools.cpp \ + tools.h \ + windowcallbacks.cpp \ + window.cpp \ + window.h + +gvba_LDADD = libgba.a @VBA_LIBS@ @GTKMM_LIBS@ @LIBINTL@ @SDL_LIBS@ + +gvba_DEPENDENCIES = libgba.a @VBA_LIBS@ + +gvba_CPPFLAGS = \ + -DPKGDATADIR=\"$(pkgdatadir)\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ + -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \ + $(GTKMM_CPPFLAGS) + +gvba_CXXFLAGS = @GTKMM_CFLAGS@ @SDL_CFLAGS@ + +libgba_a_SOURCES = \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bilinear.cpp \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../getopt.c \ + ../getopt.h \ + ../getopt1.c \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interframe.cpp \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + +libgba_a_CPPFLAGS = -DSDL + +libgba_a_CXXFLAGS = -fno-exceptions + +dist_pkgdata_DATA = vba.glade diff --git a/src/gtk/Makefile.in b/src/gtk/Makefile.in new file mode 100644 index 0000000..ad2aedc --- /dev/null +++ b/src/gtk/Makefile.in @@ -0,0 +1,1798 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = images + +bin_PROGRAMS = gvba + +noinst_LIBRARIES = libgba.a + +gvba_SOURCES = \ + configfile.cpp \ + configfile.h \ + filters.cpp \ + filters.h \ + input.cpp \ + input.h \ + intl.h \ + joypadconfig.cpp \ + joypadconfig.h \ + main.cpp \ + menuitem.h \ + screenarea.cpp \ + screenarea.h \ + sigccompat.h \ + system.cpp \ + tools.cpp \ + tools.h \ + windowcallbacks.cpp \ + window.cpp \ + window.h + + +gvba_LDADD = libgba.a @VBA_LIBS@ @GTKMM_LIBS@ @LIBINTL@ @SDL_LIBS@ + +gvba_DEPENDENCIES = libgba.a @VBA_LIBS@ + +gvba_CPPFLAGS = \ + -DPKGDATADIR=\"$(pkgdatadir)\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ + -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \ + $(GTKMM_CPPFLAGS) + + +gvba_CXXFLAGS = @GTKMM_CFLAGS@ @SDL_CFLAGS@ + +libgba_a_SOURCES = \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bilinear.cpp \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../getopt.c \ + ../getopt.h \ + ../getopt1.c \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interframe.cpp \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + + +libgba_a_CPPFLAGS = -DSDL + +libgba_a_CXXFLAGS = -fno-exceptions + +dist_pkgdata_DATA = vba.glade +subdir = src/gtk +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libgba_a_AR = $(AR) cru +libgba_a_LIBADD = +am_libgba_a_OBJECTS = libgba_a-2xSaI.$(OBJEXT) libgba_a-Cheats.$(OBJEXT) \ + libgba_a-EEprom.$(OBJEXT) libgba_a-Flash.$(OBJEXT) \ + libgba_a-GBA.$(OBJEXT) libgba_a-Gfx.$(OBJEXT) \ + libgba_a-Globals.$(OBJEXT) libgba_a-Mode0.$(OBJEXT) \ + libgba_a-Mode1.$(OBJEXT) libgba_a-Mode2.$(OBJEXT) \ + libgba_a-Mode3.$(OBJEXT) libgba_a-Mode4.$(OBJEXT) \ + libgba_a-Mode5.$(OBJEXT) libgba_a-RTC.$(OBJEXT) \ + libgba_a-Sound.$(OBJEXT) libgba_a-Sram.$(OBJEXT) \ + libgba_a-Text.$(OBJEXT) libgba_a-Util.$(OBJEXT) \ + libgba_a-admame.$(OBJEXT) libgba_a-agbprint.$(OBJEXT) \ + libgba_a-armdis.$(OBJEXT) libgba_a-bilinear.$(OBJEXT) \ + libgba_a-bios.$(OBJEXT) libgba_a-elf.$(OBJEXT) \ + libgba_a-getopt.$(OBJEXT) libgba_a-getopt1.$(OBJEXT) \ + libgba_a-hq2x.$(OBJEXT) libgba_a-interframe.$(OBJEXT) \ + libgba_a-memgzio.$(OBJEXT) libgba_a-motionblur.$(OBJEXT) \ + libgba_a-pixel.$(OBJEXT) libgba_a-remote.$(OBJEXT) \ + libgba_a-scanline.$(OBJEXT) libgba_a-simple2x.$(OBJEXT) \ + libgba_a-unzip.$(OBJEXT) +libgba_a_OBJECTS = $(am_libgba_a_OBJECTS) +bin_PROGRAMS = gvba$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_gvba_OBJECTS = gvba-configfile.$(OBJEXT) gvba-filters.$(OBJEXT) \ + gvba-input.$(OBJEXT) gvba-joypadconfig.$(OBJEXT) \ + gvba-main.$(OBJEXT) gvba-screenarea.$(OBJEXT) \ + gvba-system.$(OBJEXT) gvba-tools.$(OBJEXT) \ + gvba-windowcallbacks.$(OBJEXT) gvba-window.$(OBJEXT) +gvba_OBJECTS = $(am_gvba_OBJECTS) +gvba_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gvba-configfile.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-filters.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-input.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-joypadconfig.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-main.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-screenarea.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-system.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-tools.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-window.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/gvba-windowcallbacks.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-2xSaI.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Cheats.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-EEprom.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Flash.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-GBA.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Gfx.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Globals.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode0.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode2.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode3.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode4.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Mode5.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-RTC.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Sound.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Sram.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Text.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-Util.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-admame.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-agbprint.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-armdis.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-bilinear.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-bios.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-elf.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-getopt.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-getopt1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-hq2x.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-interframe.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-memgzio.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-motionblur.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-pixel.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-remote.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-scanline.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-simple2x.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/libgba_a-unzip.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +DIST_SOURCES = $(libgba_a_SOURCES) $(gvba_SOURCES) +DATA = $(dist_pkgdata_DATA) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.in Makefile.am +DIST_SUBDIRS = $(SUBDIRS) +SOURCES = $(libgba_a_SOURCES) $(gvba_SOURCES) + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cpp .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gtk/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgba.a: $(libgba_a_OBJECTS) $(libgba_a_DEPENDENCIES) + -rm -f libgba.a + $(libgba_a_AR) libgba.a $(libgba_a_OBJECTS) $(libgba_a_LIBADD) + $(RANLIB) libgba.a +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +gvba$(EXEEXT): $(gvba_OBJECTS) $(gvba_DEPENDENCIES) + @rm -f gvba$(EXEEXT) + $(CXXLINK) $(gvba_LDFLAGS) $(gvba_OBJECTS) $(gvba_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-configfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-filters.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-joypadconfig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-screenarea.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-system.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-tools.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-window.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvba-windowcallbacks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-2xSaI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Cheats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-EEprom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Flash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-GBA.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Gfx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Globals.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Mode5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-RTC.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Sound.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Sram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Text.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-Util.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-admame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-agbprint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-armdis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-bilinear.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-elf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-hq2x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-interframe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-memgzio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-motionblur.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-pixel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-remote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-scanline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-simple2x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgba_a-unzip.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +libgba_a-getopt.o: ../getopt.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-getopt.o -MD -MP -MF "$(DEPDIR)/libgba_a-getopt.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-getopt.o `test -f '../getopt.c' || echo '$(srcdir)/'`../getopt.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-getopt.Tpo" "$(DEPDIR)/libgba_a-getopt.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-getopt.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt.c' object='libgba_a-getopt.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-getopt.Po' tmpdepfile='$(DEPDIR)/libgba_a-getopt.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-getopt.o `test -f '../getopt.c' || echo '$(srcdir)/'`../getopt.c + +libgba_a-getopt.obj: ../getopt.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-getopt.obj -MD -MP -MF "$(DEPDIR)/libgba_a-getopt.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-getopt.obj `if test -f '../getopt.c'; then $(CYGPATH_W) '../getopt.c'; else $(CYGPATH_W) '$(srcdir)/../getopt.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-getopt.Tpo" "$(DEPDIR)/libgba_a-getopt.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-getopt.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt.c' object='libgba_a-getopt.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-getopt.Po' tmpdepfile='$(DEPDIR)/libgba_a-getopt.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-getopt.obj `if test -f '../getopt.c'; then $(CYGPATH_W) '../getopt.c'; else $(CYGPATH_W) '$(srcdir)/../getopt.c'; fi` + +libgba_a-getopt1.o: ../getopt1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-getopt1.o -MD -MP -MF "$(DEPDIR)/libgba_a-getopt1.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-getopt1.o `test -f '../getopt1.c' || echo '$(srcdir)/'`../getopt1.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-getopt1.Tpo" "$(DEPDIR)/libgba_a-getopt1.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-getopt1.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt1.c' object='libgba_a-getopt1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-getopt1.Po' tmpdepfile='$(DEPDIR)/libgba_a-getopt1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-getopt1.o `test -f '../getopt1.c' || echo '$(srcdir)/'`../getopt1.c + +libgba_a-getopt1.obj: ../getopt1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-getopt1.obj -MD -MP -MF "$(DEPDIR)/libgba_a-getopt1.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-getopt1.obj `if test -f '../getopt1.c'; then $(CYGPATH_W) '../getopt1.c'; else $(CYGPATH_W) '$(srcdir)/../getopt1.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-getopt1.Tpo" "$(DEPDIR)/libgba_a-getopt1.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-getopt1.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt1.c' object='libgba_a-getopt1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-getopt1.Po' tmpdepfile='$(DEPDIR)/libgba_a-getopt1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-getopt1.obj `if test -f '../getopt1.c'; then $(CYGPATH_W) '../getopt1.c'; else $(CYGPATH_W) '$(srcdir)/../getopt1.c'; fi` + +libgba_a-memgzio.o: ../memgzio.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-memgzio.o -MD -MP -MF "$(DEPDIR)/libgba_a-memgzio.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-memgzio.o `test -f '../memgzio.c' || echo '$(srcdir)/'`../memgzio.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-memgzio.Tpo" "$(DEPDIR)/libgba_a-memgzio.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-memgzio.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../memgzio.c' object='libgba_a-memgzio.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-memgzio.Po' tmpdepfile='$(DEPDIR)/libgba_a-memgzio.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-memgzio.o `test -f '../memgzio.c' || echo '$(srcdir)/'`../memgzio.c + +libgba_a-memgzio.obj: ../memgzio.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgba_a-memgzio.obj -MD -MP -MF "$(DEPDIR)/libgba_a-memgzio.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libgba_a-memgzio.obj `if test -f '../memgzio.c'; then $(CYGPATH_W) '../memgzio.c'; else $(CYGPATH_W) '$(srcdir)/../memgzio.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgba_a-memgzio.Tpo" "$(DEPDIR)/libgba_a-memgzio.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libgba_a-memgzio.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../memgzio.c' object='libgba_a-memgzio.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libgba_a-memgzio.Po' tmpdepfile='$(DEPDIR)/libgba_a-memgzio.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgba_a-memgzio.obj `if test -f '../memgzio.c'; then $(CYGPATH_W) '../memgzio.c'; else $(CYGPATH_W) '$(srcdir)/../memgzio.c'; fi` + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +libgba_a-2xSaI.o: ../2xSaI.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-2xSaI.o -MD -MP -MF "$(DEPDIR)/libgba_a-2xSaI.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-2xSaI.o `test -f '../2xSaI.cpp' || echo '$(srcdir)/'`../2xSaI.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-2xSaI.Tpo" "$(DEPDIR)/libgba_a-2xSaI.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-2xSaI.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../2xSaI.cpp' object='libgba_a-2xSaI.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-2xSaI.Po' tmpdepfile='$(DEPDIR)/libgba_a-2xSaI.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-2xSaI.o `test -f '../2xSaI.cpp' || echo '$(srcdir)/'`../2xSaI.cpp + +libgba_a-2xSaI.obj: ../2xSaI.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-2xSaI.obj -MD -MP -MF "$(DEPDIR)/libgba_a-2xSaI.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-2xSaI.obj `if test -f '../2xSaI.cpp'; then $(CYGPATH_W) '../2xSaI.cpp'; else $(CYGPATH_W) '$(srcdir)/../2xSaI.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-2xSaI.Tpo" "$(DEPDIR)/libgba_a-2xSaI.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-2xSaI.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../2xSaI.cpp' object='libgba_a-2xSaI.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-2xSaI.Po' tmpdepfile='$(DEPDIR)/libgba_a-2xSaI.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-2xSaI.obj `if test -f '../2xSaI.cpp'; then $(CYGPATH_W) '../2xSaI.cpp'; else $(CYGPATH_W) '$(srcdir)/../2xSaI.cpp'; fi` + +libgba_a-Cheats.o: ../Cheats.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Cheats.o -MD -MP -MF "$(DEPDIR)/libgba_a-Cheats.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Cheats.o `test -f '../Cheats.cpp' || echo '$(srcdir)/'`../Cheats.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Cheats.Tpo" "$(DEPDIR)/libgba_a-Cheats.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Cheats.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Cheats.cpp' object='libgba_a-Cheats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Cheats.Po' tmpdepfile='$(DEPDIR)/libgba_a-Cheats.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Cheats.o `test -f '../Cheats.cpp' || echo '$(srcdir)/'`../Cheats.cpp + +libgba_a-Cheats.obj: ../Cheats.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Cheats.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Cheats.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Cheats.obj `if test -f '../Cheats.cpp'; then $(CYGPATH_W) '../Cheats.cpp'; else $(CYGPATH_W) '$(srcdir)/../Cheats.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Cheats.Tpo" "$(DEPDIR)/libgba_a-Cheats.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Cheats.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Cheats.cpp' object='libgba_a-Cheats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Cheats.Po' tmpdepfile='$(DEPDIR)/libgba_a-Cheats.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Cheats.obj `if test -f '../Cheats.cpp'; then $(CYGPATH_W) '../Cheats.cpp'; else $(CYGPATH_W) '$(srcdir)/../Cheats.cpp'; fi` + +libgba_a-EEprom.o: ../EEprom.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-EEprom.o -MD -MP -MF "$(DEPDIR)/libgba_a-EEprom.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-EEprom.o `test -f '../EEprom.cpp' || echo '$(srcdir)/'`../EEprom.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-EEprom.Tpo" "$(DEPDIR)/libgba_a-EEprom.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-EEprom.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../EEprom.cpp' object='libgba_a-EEprom.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-EEprom.Po' tmpdepfile='$(DEPDIR)/libgba_a-EEprom.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-EEprom.o `test -f '../EEprom.cpp' || echo '$(srcdir)/'`../EEprom.cpp + +libgba_a-EEprom.obj: ../EEprom.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-EEprom.obj -MD -MP -MF "$(DEPDIR)/libgba_a-EEprom.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-EEprom.obj `if test -f '../EEprom.cpp'; then $(CYGPATH_W) '../EEprom.cpp'; else $(CYGPATH_W) '$(srcdir)/../EEprom.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-EEprom.Tpo" "$(DEPDIR)/libgba_a-EEprom.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-EEprom.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../EEprom.cpp' object='libgba_a-EEprom.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-EEprom.Po' tmpdepfile='$(DEPDIR)/libgba_a-EEprom.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-EEprom.obj `if test -f '../EEprom.cpp'; then $(CYGPATH_W) '../EEprom.cpp'; else $(CYGPATH_W) '$(srcdir)/../EEprom.cpp'; fi` + +libgba_a-Flash.o: ../Flash.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Flash.o -MD -MP -MF "$(DEPDIR)/libgba_a-Flash.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Flash.o `test -f '../Flash.cpp' || echo '$(srcdir)/'`../Flash.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Flash.Tpo" "$(DEPDIR)/libgba_a-Flash.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Flash.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Flash.cpp' object='libgba_a-Flash.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Flash.Po' tmpdepfile='$(DEPDIR)/libgba_a-Flash.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Flash.o `test -f '../Flash.cpp' || echo '$(srcdir)/'`../Flash.cpp + +libgba_a-Flash.obj: ../Flash.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Flash.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Flash.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Flash.obj `if test -f '../Flash.cpp'; then $(CYGPATH_W) '../Flash.cpp'; else $(CYGPATH_W) '$(srcdir)/../Flash.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Flash.Tpo" "$(DEPDIR)/libgba_a-Flash.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Flash.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Flash.cpp' object='libgba_a-Flash.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Flash.Po' tmpdepfile='$(DEPDIR)/libgba_a-Flash.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Flash.obj `if test -f '../Flash.cpp'; then $(CYGPATH_W) '../Flash.cpp'; else $(CYGPATH_W) '$(srcdir)/../Flash.cpp'; fi` + +libgba_a-GBA.o: ../GBA.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-GBA.o -MD -MP -MF "$(DEPDIR)/libgba_a-GBA.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-GBA.o `test -f '../GBA.cpp' || echo '$(srcdir)/'`../GBA.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-GBA.Tpo" "$(DEPDIR)/libgba_a-GBA.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-GBA.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../GBA.cpp' object='libgba_a-GBA.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-GBA.Po' tmpdepfile='$(DEPDIR)/libgba_a-GBA.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-GBA.o `test -f '../GBA.cpp' || echo '$(srcdir)/'`../GBA.cpp + +libgba_a-GBA.obj: ../GBA.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-GBA.obj -MD -MP -MF "$(DEPDIR)/libgba_a-GBA.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-GBA.obj `if test -f '../GBA.cpp'; then $(CYGPATH_W) '../GBA.cpp'; else $(CYGPATH_W) '$(srcdir)/../GBA.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-GBA.Tpo" "$(DEPDIR)/libgba_a-GBA.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-GBA.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../GBA.cpp' object='libgba_a-GBA.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-GBA.Po' tmpdepfile='$(DEPDIR)/libgba_a-GBA.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-GBA.obj `if test -f '../GBA.cpp'; then $(CYGPATH_W) '../GBA.cpp'; else $(CYGPATH_W) '$(srcdir)/../GBA.cpp'; fi` + +libgba_a-Gfx.o: ../Gfx.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Gfx.o -MD -MP -MF "$(DEPDIR)/libgba_a-Gfx.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Gfx.o `test -f '../Gfx.cpp' || echo '$(srcdir)/'`../Gfx.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Gfx.Tpo" "$(DEPDIR)/libgba_a-Gfx.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Gfx.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Gfx.cpp' object='libgba_a-Gfx.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Gfx.Po' tmpdepfile='$(DEPDIR)/libgba_a-Gfx.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Gfx.o `test -f '../Gfx.cpp' || echo '$(srcdir)/'`../Gfx.cpp + +libgba_a-Gfx.obj: ../Gfx.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Gfx.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Gfx.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Gfx.obj `if test -f '../Gfx.cpp'; then $(CYGPATH_W) '../Gfx.cpp'; else $(CYGPATH_W) '$(srcdir)/../Gfx.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Gfx.Tpo" "$(DEPDIR)/libgba_a-Gfx.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Gfx.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Gfx.cpp' object='libgba_a-Gfx.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Gfx.Po' tmpdepfile='$(DEPDIR)/libgba_a-Gfx.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Gfx.obj `if test -f '../Gfx.cpp'; then $(CYGPATH_W) '../Gfx.cpp'; else $(CYGPATH_W) '$(srcdir)/../Gfx.cpp'; fi` + +libgba_a-Globals.o: ../Globals.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Globals.o -MD -MP -MF "$(DEPDIR)/libgba_a-Globals.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Globals.o `test -f '../Globals.cpp' || echo '$(srcdir)/'`../Globals.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Globals.Tpo" "$(DEPDIR)/libgba_a-Globals.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Globals.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Globals.cpp' object='libgba_a-Globals.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Globals.Po' tmpdepfile='$(DEPDIR)/libgba_a-Globals.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Globals.o `test -f '../Globals.cpp' || echo '$(srcdir)/'`../Globals.cpp + +libgba_a-Globals.obj: ../Globals.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Globals.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Globals.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Globals.obj `if test -f '../Globals.cpp'; then $(CYGPATH_W) '../Globals.cpp'; else $(CYGPATH_W) '$(srcdir)/../Globals.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Globals.Tpo" "$(DEPDIR)/libgba_a-Globals.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Globals.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Globals.cpp' object='libgba_a-Globals.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Globals.Po' tmpdepfile='$(DEPDIR)/libgba_a-Globals.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Globals.obj `if test -f '../Globals.cpp'; then $(CYGPATH_W) '../Globals.cpp'; else $(CYGPATH_W) '$(srcdir)/../Globals.cpp'; fi` + +libgba_a-Mode0.o: ../Mode0.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode0.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode0.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode0.o `test -f '../Mode0.cpp' || echo '$(srcdir)/'`../Mode0.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode0.Tpo" "$(DEPDIR)/libgba_a-Mode0.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode0.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode0.cpp' object='libgba_a-Mode0.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode0.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode0.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode0.o `test -f '../Mode0.cpp' || echo '$(srcdir)/'`../Mode0.cpp + +libgba_a-Mode0.obj: ../Mode0.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode0.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode0.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode0.obj `if test -f '../Mode0.cpp'; then $(CYGPATH_W) '../Mode0.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode0.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode0.Tpo" "$(DEPDIR)/libgba_a-Mode0.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode0.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode0.cpp' object='libgba_a-Mode0.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode0.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode0.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode0.obj `if test -f '../Mode0.cpp'; then $(CYGPATH_W) '../Mode0.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode0.cpp'; fi` + +libgba_a-Mode1.o: ../Mode1.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode1.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode1.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode1.o `test -f '../Mode1.cpp' || echo '$(srcdir)/'`../Mode1.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode1.Tpo" "$(DEPDIR)/libgba_a-Mode1.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode1.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode1.cpp' object='libgba_a-Mode1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode1.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode1.o `test -f '../Mode1.cpp' || echo '$(srcdir)/'`../Mode1.cpp + +libgba_a-Mode1.obj: ../Mode1.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode1.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode1.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode1.obj `if test -f '../Mode1.cpp'; then $(CYGPATH_W) '../Mode1.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode1.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode1.Tpo" "$(DEPDIR)/libgba_a-Mode1.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode1.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode1.cpp' object='libgba_a-Mode1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode1.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode1.obj `if test -f '../Mode1.cpp'; then $(CYGPATH_W) '../Mode1.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode1.cpp'; fi` + +libgba_a-Mode2.o: ../Mode2.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode2.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode2.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode2.o `test -f '../Mode2.cpp' || echo '$(srcdir)/'`../Mode2.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode2.Tpo" "$(DEPDIR)/libgba_a-Mode2.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode2.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode2.cpp' object='libgba_a-Mode2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode2.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode2.o `test -f '../Mode2.cpp' || echo '$(srcdir)/'`../Mode2.cpp + +libgba_a-Mode2.obj: ../Mode2.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode2.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode2.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode2.obj `if test -f '../Mode2.cpp'; then $(CYGPATH_W) '../Mode2.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode2.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode2.Tpo" "$(DEPDIR)/libgba_a-Mode2.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode2.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode2.cpp' object='libgba_a-Mode2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode2.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode2.obj `if test -f '../Mode2.cpp'; then $(CYGPATH_W) '../Mode2.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode2.cpp'; fi` + +libgba_a-Mode3.o: ../Mode3.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode3.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode3.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode3.o `test -f '../Mode3.cpp' || echo '$(srcdir)/'`../Mode3.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode3.Tpo" "$(DEPDIR)/libgba_a-Mode3.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode3.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode3.cpp' object='libgba_a-Mode3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode3.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode3.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode3.o `test -f '../Mode3.cpp' || echo '$(srcdir)/'`../Mode3.cpp + +libgba_a-Mode3.obj: ../Mode3.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode3.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode3.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode3.obj `if test -f '../Mode3.cpp'; then $(CYGPATH_W) '../Mode3.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode3.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode3.Tpo" "$(DEPDIR)/libgba_a-Mode3.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode3.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode3.cpp' object='libgba_a-Mode3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode3.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode3.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode3.obj `if test -f '../Mode3.cpp'; then $(CYGPATH_W) '../Mode3.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode3.cpp'; fi` + +libgba_a-Mode4.o: ../Mode4.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode4.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode4.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode4.o `test -f '../Mode4.cpp' || echo '$(srcdir)/'`../Mode4.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode4.Tpo" "$(DEPDIR)/libgba_a-Mode4.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode4.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode4.cpp' object='libgba_a-Mode4.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode4.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode4.o `test -f '../Mode4.cpp' || echo '$(srcdir)/'`../Mode4.cpp + +libgba_a-Mode4.obj: ../Mode4.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode4.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode4.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode4.obj `if test -f '../Mode4.cpp'; then $(CYGPATH_W) '../Mode4.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode4.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode4.Tpo" "$(DEPDIR)/libgba_a-Mode4.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode4.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode4.cpp' object='libgba_a-Mode4.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode4.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode4.obj `if test -f '../Mode4.cpp'; then $(CYGPATH_W) '../Mode4.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode4.cpp'; fi` + +libgba_a-Mode5.o: ../Mode5.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode5.o -MD -MP -MF "$(DEPDIR)/libgba_a-Mode5.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode5.o `test -f '../Mode5.cpp' || echo '$(srcdir)/'`../Mode5.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode5.Tpo" "$(DEPDIR)/libgba_a-Mode5.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode5.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode5.cpp' object='libgba_a-Mode5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode5.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode5.o `test -f '../Mode5.cpp' || echo '$(srcdir)/'`../Mode5.cpp + +libgba_a-Mode5.obj: ../Mode5.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Mode5.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Mode5.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Mode5.obj `if test -f '../Mode5.cpp'; then $(CYGPATH_W) '../Mode5.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode5.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Mode5.Tpo" "$(DEPDIR)/libgba_a-Mode5.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Mode5.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode5.cpp' object='libgba_a-Mode5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Mode5.Po' tmpdepfile='$(DEPDIR)/libgba_a-Mode5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Mode5.obj `if test -f '../Mode5.cpp'; then $(CYGPATH_W) '../Mode5.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode5.cpp'; fi` + +libgba_a-RTC.o: ../RTC.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-RTC.o -MD -MP -MF "$(DEPDIR)/libgba_a-RTC.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-RTC.o `test -f '../RTC.cpp' || echo '$(srcdir)/'`../RTC.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-RTC.Tpo" "$(DEPDIR)/libgba_a-RTC.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-RTC.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../RTC.cpp' object='libgba_a-RTC.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-RTC.Po' tmpdepfile='$(DEPDIR)/libgba_a-RTC.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-RTC.o `test -f '../RTC.cpp' || echo '$(srcdir)/'`../RTC.cpp + +libgba_a-RTC.obj: ../RTC.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-RTC.obj -MD -MP -MF "$(DEPDIR)/libgba_a-RTC.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-RTC.obj `if test -f '../RTC.cpp'; then $(CYGPATH_W) '../RTC.cpp'; else $(CYGPATH_W) '$(srcdir)/../RTC.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-RTC.Tpo" "$(DEPDIR)/libgba_a-RTC.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-RTC.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../RTC.cpp' object='libgba_a-RTC.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-RTC.Po' tmpdepfile='$(DEPDIR)/libgba_a-RTC.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-RTC.obj `if test -f '../RTC.cpp'; then $(CYGPATH_W) '../RTC.cpp'; else $(CYGPATH_W) '$(srcdir)/../RTC.cpp'; fi` + +libgba_a-Sound.o: ../Sound.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Sound.o -MD -MP -MF "$(DEPDIR)/libgba_a-Sound.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Sound.o `test -f '../Sound.cpp' || echo '$(srcdir)/'`../Sound.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Sound.Tpo" "$(DEPDIR)/libgba_a-Sound.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Sound.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sound.cpp' object='libgba_a-Sound.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Sound.Po' tmpdepfile='$(DEPDIR)/libgba_a-Sound.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Sound.o `test -f '../Sound.cpp' || echo '$(srcdir)/'`../Sound.cpp + +libgba_a-Sound.obj: ../Sound.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Sound.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Sound.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Sound.obj `if test -f '../Sound.cpp'; then $(CYGPATH_W) '../Sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sound.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Sound.Tpo" "$(DEPDIR)/libgba_a-Sound.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Sound.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sound.cpp' object='libgba_a-Sound.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Sound.Po' tmpdepfile='$(DEPDIR)/libgba_a-Sound.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Sound.obj `if test -f '../Sound.cpp'; then $(CYGPATH_W) '../Sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sound.cpp'; fi` + +libgba_a-Sram.o: ../Sram.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Sram.o -MD -MP -MF "$(DEPDIR)/libgba_a-Sram.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Sram.o `test -f '../Sram.cpp' || echo '$(srcdir)/'`../Sram.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Sram.Tpo" "$(DEPDIR)/libgba_a-Sram.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Sram.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sram.cpp' object='libgba_a-Sram.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Sram.Po' tmpdepfile='$(DEPDIR)/libgba_a-Sram.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Sram.o `test -f '../Sram.cpp' || echo '$(srcdir)/'`../Sram.cpp + +libgba_a-Sram.obj: ../Sram.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Sram.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Sram.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Sram.obj `if test -f '../Sram.cpp'; then $(CYGPATH_W) '../Sram.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sram.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Sram.Tpo" "$(DEPDIR)/libgba_a-Sram.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Sram.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sram.cpp' object='libgba_a-Sram.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Sram.Po' tmpdepfile='$(DEPDIR)/libgba_a-Sram.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Sram.obj `if test -f '../Sram.cpp'; then $(CYGPATH_W) '../Sram.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sram.cpp'; fi` + +libgba_a-Text.o: ../Text.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Text.o -MD -MP -MF "$(DEPDIR)/libgba_a-Text.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Text.o `test -f '../Text.cpp' || echo '$(srcdir)/'`../Text.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Text.Tpo" "$(DEPDIR)/libgba_a-Text.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Text.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Text.cpp' object='libgba_a-Text.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Text.Po' tmpdepfile='$(DEPDIR)/libgba_a-Text.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Text.o `test -f '../Text.cpp' || echo '$(srcdir)/'`../Text.cpp + +libgba_a-Text.obj: ../Text.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Text.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Text.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Text.obj `if test -f '../Text.cpp'; then $(CYGPATH_W) '../Text.cpp'; else $(CYGPATH_W) '$(srcdir)/../Text.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Text.Tpo" "$(DEPDIR)/libgba_a-Text.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Text.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Text.cpp' object='libgba_a-Text.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Text.Po' tmpdepfile='$(DEPDIR)/libgba_a-Text.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Text.obj `if test -f '../Text.cpp'; then $(CYGPATH_W) '../Text.cpp'; else $(CYGPATH_W) '$(srcdir)/../Text.cpp'; fi` + +libgba_a-Util.o: ../Util.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Util.o -MD -MP -MF "$(DEPDIR)/libgba_a-Util.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Util.o `test -f '../Util.cpp' || echo '$(srcdir)/'`../Util.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Util.Tpo" "$(DEPDIR)/libgba_a-Util.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Util.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Util.cpp' object='libgba_a-Util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Util.Po' tmpdepfile='$(DEPDIR)/libgba_a-Util.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Util.o `test -f '../Util.cpp' || echo '$(srcdir)/'`../Util.cpp + +libgba_a-Util.obj: ../Util.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-Util.obj -MD -MP -MF "$(DEPDIR)/libgba_a-Util.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-Util.obj `if test -f '../Util.cpp'; then $(CYGPATH_W) '../Util.cpp'; else $(CYGPATH_W) '$(srcdir)/../Util.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-Util.Tpo" "$(DEPDIR)/libgba_a-Util.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-Util.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Util.cpp' object='libgba_a-Util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-Util.Po' tmpdepfile='$(DEPDIR)/libgba_a-Util.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-Util.obj `if test -f '../Util.cpp'; then $(CYGPATH_W) '../Util.cpp'; else $(CYGPATH_W) '$(srcdir)/../Util.cpp'; fi` + +libgba_a-admame.o: ../admame.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-admame.o -MD -MP -MF "$(DEPDIR)/libgba_a-admame.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-admame.o `test -f '../admame.cpp' || echo '$(srcdir)/'`../admame.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-admame.Tpo" "$(DEPDIR)/libgba_a-admame.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-admame.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../admame.cpp' object='libgba_a-admame.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-admame.Po' tmpdepfile='$(DEPDIR)/libgba_a-admame.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-admame.o `test -f '../admame.cpp' || echo '$(srcdir)/'`../admame.cpp + +libgba_a-admame.obj: ../admame.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-admame.obj -MD -MP -MF "$(DEPDIR)/libgba_a-admame.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-admame.obj `if test -f '../admame.cpp'; then $(CYGPATH_W) '../admame.cpp'; else $(CYGPATH_W) '$(srcdir)/../admame.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-admame.Tpo" "$(DEPDIR)/libgba_a-admame.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-admame.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../admame.cpp' object='libgba_a-admame.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-admame.Po' tmpdepfile='$(DEPDIR)/libgba_a-admame.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-admame.obj `if test -f '../admame.cpp'; then $(CYGPATH_W) '../admame.cpp'; else $(CYGPATH_W) '$(srcdir)/../admame.cpp'; fi` + +libgba_a-agbprint.o: ../agbprint.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-agbprint.o -MD -MP -MF "$(DEPDIR)/libgba_a-agbprint.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-agbprint.o `test -f '../agbprint.cpp' || echo '$(srcdir)/'`../agbprint.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-agbprint.Tpo" "$(DEPDIR)/libgba_a-agbprint.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-agbprint.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../agbprint.cpp' object='libgba_a-agbprint.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-agbprint.Po' tmpdepfile='$(DEPDIR)/libgba_a-agbprint.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-agbprint.o `test -f '../agbprint.cpp' || echo '$(srcdir)/'`../agbprint.cpp + +libgba_a-agbprint.obj: ../agbprint.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-agbprint.obj -MD -MP -MF "$(DEPDIR)/libgba_a-agbprint.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-agbprint.obj `if test -f '../agbprint.cpp'; then $(CYGPATH_W) '../agbprint.cpp'; else $(CYGPATH_W) '$(srcdir)/../agbprint.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-agbprint.Tpo" "$(DEPDIR)/libgba_a-agbprint.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-agbprint.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../agbprint.cpp' object='libgba_a-agbprint.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-agbprint.Po' tmpdepfile='$(DEPDIR)/libgba_a-agbprint.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-agbprint.obj `if test -f '../agbprint.cpp'; then $(CYGPATH_W) '../agbprint.cpp'; else $(CYGPATH_W) '$(srcdir)/../agbprint.cpp'; fi` + +libgba_a-armdis.o: ../armdis.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-armdis.o -MD -MP -MF "$(DEPDIR)/libgba_a-armdis.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-armdis.o `test -f '../armdis.cpp' || echo '$(srcdir)/'`../armdis.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-armdis.Tpo" "$(DEPDIR)/libgba_a-armdis.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-armdis.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../armdis.cpp' object='libgba_a-armdis.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-armdis.Po' tmpdepfile='$(DEPDIR)/libgba_a-armdis.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-armdis.o `test -f '../armdis.cpp' || echo '$(srcdir)/'`../armdis.cpp + +libgba_a-armdis.obj: ../armdis.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-armdis.obj -MD -MP -MF "$(DEPDIR)/libgba_a-armdis.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-armdis.obj `if test -f '../armdis.cpp'; then $(CYGPATH_W) '../armdis.cpp'; else $(CYGPATH_W) '$(srcdir)/../armdis.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-armdis.Tpo" "$(DEPDIR)/libgba_a-armdis.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-armdis.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../armdis.cpp' object='libgba_a-armdis.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-armdis.Po' tmpdepfile='$(DEPDIR)/libgba_a-armdis.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-armdis.obj `if test -f '../armdis.cpp'; then $(CYGPATH_W) '../armdis.cpp'; else $(CYGPATH_W) '$(srcdir)/../armdis.cpp'; fi` + +libgba_a-bilinear.o: ../bilinear.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-bilinear.o -MD -MP -MF "$(DEPDIR)/libgba_a-bilinear.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-bilinear.o `test -f '../bilinear.cpp' || echo '$(srcdir)/'`../bilinear.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-bilinear.Tpo" "$(DEPDIR)/libgba_a-bilinear.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-bilinear.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bilinear.cpp' object='libgba_a-bilinear.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-bilinear.Po' tmpdepfile='$(DEPDIR)/libgba_a-bilinear.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-bilinear.o `test -f '../bilinear.cpp' || echo '$(srcdir)/'`../bilinear.cpp + +libgba_a-bilinear.obj: ../bilinear.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-bilinear.obj -MD -MP -MF "$(DEPDIR)/libgba_a-bilinear.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-bilinear.obj `if test -f '../bilinear.cpp'; then $(CYGPATH_W) '../bilinear.cpp'; else $(CYGPATH_W) '$(srcdir)/../bilinear.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-bilinear.Tpo" "$(DEPDIR)/libgba_a-bilinear.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-bilinear.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bilinear.cpp' object='libgba_a-bilinear.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-bilinear.Po' tmpdepfile='$(DEPDIR)/libgba_a-bilinear.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-bilinear.obj `if test -f '../bilinear.cpp'; then $(CYGPATH_W) '../bilinear.cpp'; else $(CYGPATH_W) '$(srcdir)/../bilinear.cpp'; fi` + +libgba_a-bios.o: ../bios.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-bios.o -MD -MP -MF "$(DEPDIR)/libgba_a-bios.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-bios.o `test -f '../bios.cpp' || echo '$(srcdir)/'`../bios.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-bios.Tpo" "$(DEPDIR)/libgba_a-bios.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-bios.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bios.cpp' object='libgba_a-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-bios.Po' tmpdepfile='$(DEPDIR)/libgba_a-bios.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-bios.o `test -f '../bios.cpp' || echo '$(srcdir)/'`../bios.cpp + +libgba_a-bios.obj: ../bios.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-bios.obj -MD -MP -MF "$(DEPDIR)/libgba_a-bios.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-bios.obj `if test -f '../bios.cpp'; then $(CYGPATH_W) '../bios.cpp'; else $(CYGPATH_W) '$(srcdir)/../bios.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-bios.Tpo" "$(DEPDIR)/libgba_a-bios.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-bios.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bios.cpp' object='libgba_a-bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-bios.Po' tmpdepfile='$(DEPDIR)/libgba_a-bios.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-bios.obj `if test -f '../bios.cpp'; then $(CYGPATH_W) '../bios.cpp'; else $(CYGPATH_W) '$(srcdir)/../bios.cpp'; fi` + +libgba_a-elf.o: ../elf.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-elf.o -MD -MP -MF "$(DEPDIR)/libgba_a-elf.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-elf.o `test -f '../elf.cpp' || echo '$(srcdir)/'`../elf.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-elf.Tpo" "$(DEPDIR)/libgba_a-elf.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-elf.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../elf.cpp' object='libgba_a-elf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-elf.Po' tmpdepfile='$(DEPDIR)/libgba_a-elf.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-elf.o `test -f '../elf.cpp' || echo '$(srcdir)/'`../elf.cpp + +libgba_a-elf.obj: ../elf.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-elf.obj -MD -MP -MF "$(DEPDIR)/libgba_a-elf.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-elf.obj `if test -f '../elf.cpp'; then $(CYGPATH_W) '../elf.cpp'; else $(CYGPATH_W) '$(srcdir)/../elf.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-elf.Tpo" "$(DEPDIR)/libgba_a-elf.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-elf.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../elf.cpp' object='libgba_a-elf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-elf.Po' tmpdepfile='$(DEPDIR)/libgba_a-elf.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-elf.obj `if test -f '../elf.cpp'; then $(CYGPATH_W) '../elf.cpp'; else $(CYGPATH_W) '$(srcdir)/../elf.cpp'; fi` + +libgba_a-hq2x.o: ../hq2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-hq2x.o -MD -MP -MF "$(DEPDIR)/libgba_a-hq2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-hq2x.o `test -f '../hq2x.cpp' || echo '$(srcdir)/'`../hq2x.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-hq2x.Tpo" "$(DEPDIR)/libgba_a-hq2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-hq2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hq2x.cpp' object='libgba_a-hq2x.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-hq2x.Po' tmpdepfile='$(DEPDIR)/libgba_a-hq2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-hq2x.o `test -f '../hq2x.cpp' || echo '$(srcdir)/'`../hq2x.cpp + +libgba_a-hq2x.obj: ../hq2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-hq2x.obj -MD -MP -MF "$(DEPDIR)/libgba_a-hq2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-hq2x.obj `if test -f '../hq2x.cpp'; then $(CYGPATH_W) '../hq2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../hq2x.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-hq2x.Tpo" "$(DEPDIR)/libgba_a-hq2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-hq2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hq2x.cpp' object='libgba_a-hq2x.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-hq2x.Po' tmpdepfile='$(DEPDIR)/libgba_a-hq2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-hq2x.obj `if test -f '../hq2x.cpp'; then $(CYGPATH_W) '../hq2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../hq2x.cpp'; fi` + +libgba_a-interframe.o: ../interframe.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-interframe.o -MD -MP -MF "$(DEPDIR)/libgba_a-interframe.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-interframe.o `test -f '../interframe.cpp' || echo '$(srcdir)/'`../interframe.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-interframe.Tpo" "$(DEPDIR)/libgba_a-interframe.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-interframe.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../interframe.cpp' object='libgba_a-interframe.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-interframe.Po' tmpdepfile='$(DEPDIR)/libgba_a-interframe.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-interframe.o `test -f '../interframe.cpp' || echo '$(srcdir)/'`../interframe.cpp + +libgba_a-interframe.obj: ../interframe.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-interframe.obj -MD -MP -MF "$(DEPDIR)/libgba_a-interframe.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-interframe.obj `if test -f '../interframe.cpp'; then $(CYGPATH_W) '../interframe.cpp'; else $(CYGPATH_W) '$(srcdir)/../interframe.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-interframe.Tpo" "$(DEPDIR)/libgba_a-interframe.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-interframe.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../interframe.cpp' object='libgba_a-interframe.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-interframe.Po' tmpdepfile='$(DEPDIR)/libgba_a-interframe.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-interframe.obj `if test -f '../interframe.cpp'; then $(CYGPATH_W) '../interframe.cpp'; else $(CYGPATH_W) '$(srcdir)/../interframe.cpp'; fi` + +libgba_a-motionblur.o: ../motionblur.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-motionblur.o -MD -MP -MF "$(DEPDIR)/libgba_a-motionblur.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-motionblur.o `test -f '../motionblur.cpp' || echo '$(srcdir)/'`../motionblur.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-motionblur.Tpo" "$(DEPDIR)/libgba_a-motionblur.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-motionblur.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../motionblur.cpp' object='libgba_a-motionblur.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-motionblur.Po' tmpdepfile='$(DEPDIR)/libgba_a-motionblur.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-motionblur.o `test -f '../motionblur.cpp' || echo '$(srcdir)/'`../motionblur.cpp + +libgba_a-motionblur.obj: ../motionblur.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-motionblur.obj -MD -MP -MF "$(DEPDIR)/libgba_a-motionblur.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-motionblur.obj `if test -f '../motionblur.cpp'; then $(CYGPATH_W) '../motionblur.cpp'; else $(CYGPATH_W) '$(srcdir)/../motionblur.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-motionblur.Tpo" "$(DEPDIR)/libgba_a-motionblur.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-motionblur.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../motionblur.cpp' object='libgba_a-motionblur.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-motionblur.Po' tmpdepfile='$(DEPDIR)/libgba_a-motionblur.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-motionblur.obj `if test -f '../motionblur.cpp'; then $(CYGPATH_W) '../motionblur.cpp'; else $(CYGPATH_W) '$(srcdir)/../motionblur.cpp'; fi` + +libgba_a-pixel.o: ../pixel.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-pixel.o -MD -MP -MF "$(DEPDIR)/libgba_a-pixel.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-pixel.o `test -f '../pixel.cpp' || echo '$(srcdir)/'`../pixel.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-pixel.Tpo" "$(DEPDIR)/libgba_a-pixel.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-pixel.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../pixel.cpp' object='libgba_a-pixel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-pixel.Po' tmpdepfile='$(DEPDIR)/libgba_a-pixel.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-pixel.o `test -f '../pixel.cpp' || echo '$(srcdir)/'`../pixel.cpp + +libgba_a-pixel.obj: ../pixel.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-pixel.obj -MD -MP -MF "$(DEPDIR)/libgba_a-pixel.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-pixel.obj `if test -f '../pixel.cpp'; then $(CYGPATH_W) '../pixel.cpp'; else $(CYGPATH_W) '$(srcdir)/../pixel.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-pixel.Tpo" "$(DEPDIR)/libgba_a-pixel.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-pixel.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../pixel.cpp' object='libgba_a-pixel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-pixel.Po' tmpdepfile='$(DEPDIR)/libgba_a-pixel.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-pixel.obj `if test -f '../pixel.cpp'; then $(CYGPATH_W) '../pixel.cpp'; else $(CYGPATH_W) '$(srcdir)/../pixel.cpp'; fi` + +libgba_a-remote.o: ../remote.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-remote.o -MD -MP -MF "$(DEPDIR)/libgba_a-remote.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-remote.o `test -f '../remote.cpp' || echo '$(srcdir)/'`../remote.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-remote.Tpo" "$(DEPDIR)/libgba_a-remote.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-remote.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../remote.cpp' object='libgba_a-remote.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-remote.Po' tmpdepfile='$(DEPDIR)/libgba_a-remote.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-remote.o `test -f '../remote.cpp' || echo '$(srcdir)/'`../remote.cpp + +libgba_a-remote.obj: ../remote.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-remote.obj -MD -MP -MF "$(DEPDIR)/libgba_a-remote.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-remote.obj `if test -f '../remote.cpp'; then $(CYGPATH_W) '../remote.cpp'; else $(CYGPATH_W) '$(srcdir)/../remote.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-remote.Tpo" "$(DEPDIR)/libgba_a-remote.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-remote.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../remote.cpp' object='libgba_a-remote.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-remote.Po' tmpdepfile='$(DEPDIR)/libgba_a-remote.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-remote.obj `if test -f '../remote.cpp'; then $(CYGPATH_W) '../remote.cpp'; else $(CYGPATH_W) '$(srcdir)/../remote.cpp'; fi` + +libgba_a-scanline.o: ../scanline.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-scanline.o -MD -MP -MF "$(DEPDIR)/libgba_a-scanline.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-scanline.o `test -f '../scanline.cpp' || echo '$(srcdir)/'`../scanline.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-scanline.Tpo" "$(DEPDIR)/libgba_a-scanline.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-scanline.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../scanline.cpp' object='libgba_a-scanline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-scanline.Po' tmpdepfile='$(DEPDIR)/libgba_a-scanline.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-scanline.o `test -f '../scanline.cpp' || echo '$(srcdir)/'`../scanline.cpp + +libgba_a-scanline.obj: ../scanline.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-scanline.obj -MD -MP -MF "$(DEPDIR)/libgba_a-scanline.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-scanline.obj `if test -f '../scanline.cpp'; then $(CYGPATH_W) '../scanline.cpp'; else $(CYGPATH_W) '$(srcdir)/../scanline.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-scanline.Tpo" "$(DEPDIR)/libgba_a-scanline.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-scanline.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../scanline.cpp' object='libgba_a-scanline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-scanline.Po' tmpdepfile='$(DEPDIR)/libgba_a-scanline.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-scanline.obj `if test -f '../scanline.cpp'; then $(CYGPATH_W) '../scanline.cpp'; else $(CYGPATH_W) '$(srcdir)/../scanline.cpp'; fi` + +libgba_a-simple2x.o: ../simple2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-simple2x.o -MD -MP -MF "$(DEPDIR)/libgba_a-simple2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-simple2x.o `test -f '../simple2x.cpp' || echo '$(srcdir)/'`../simple2x.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-simple2x.Tpo" "$(DEPDIR)/libgba_a-simple2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-simple2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../simple2x.cpp' object='libgba_a-simple2x.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-simple2x.Po' tmpdepfile='$(DEPDIR)/libgba_a-simple2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-simple2x.o `test -f '../simple2x.cpp' || echo '$(srcdir)/'`../simple2x.cpp + +libgba_a-simple2x.obj: ../simple2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-simple2x.obj -MD -MP -MF "$(DEPDIR)/libgba_a-simple2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-simple2x.obj `if test -f '../simple2x.cpp'; then $(CYGPATH_W) '../simple2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../simple2x.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-simple2x.Tpo" "$(DEPDIR)/libgba_a-simple2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-simple2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../simple2x.cpp' object='libgba_a-simple2x.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-simple2x.Po' tmpdepfile='$(DEPDIR)/libgba_a-simple2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-simple2x.obj `if test -f '../simple2x.cpp'; then $(CYGPATH_W) '../simple2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../simple2x.cpp'; fi` + +libgba_a-unzip.o: ../unzip.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-unzip.o -MD -MP -MF "$(DEPDIR)/libgba_a-unzip.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-unzip.o `test -f '../unzip.cpp' || echo '$(srcdir)/'`../unzip.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-unzip.Tpo" "$(DEPDIR)/libgba_a-unzip.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-unzip.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../unzip.cpp' object='libgba_a-unzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-unzip.Po' tmpdepfile='$(DEPDIR)/libgba_a-unzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-unzip.o `test -f '../unzip.cpp' || echo '$(srcdir)/'`../unzip.cpp + +libgba_a-unzip.obj: ../unzip.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -MT libgba_a-unzip.obj -MD -MP -MF "$(DEPDIR)/libgba_a-unzip.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o libgba_a-unzip.obj `if test -f '../unzip.cpp'; then $(CYGPATH_W) '../unzip.cpp'; else $(CYGPATH_W) '$(srcdir)/../unzip.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgba_a-unzip.Tpo" "$(DEPDIR)/libgba_a-unzip.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/libgba_a-unzip.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../unzip.cpp' object='libgba_a-unzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/libgba_a-unzip.Po' tmpdepfile='$(DEPDIR)/libgba_a-unzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgba_a_CPPFLAGS) $(CPPFLAGS) $(libgba_a_CXXFLAGS) $(CXXFLAGS) -c -o libgba_a-unzip.obj `if test -f '../unzip.cpp'; then $(CYGPATH_W) '../unzip.cpp'; else $(CYGPATH_W) '$(srcdir)/../unzip.cpp'; fi` + +gvba-configfile.o: configfile.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-configfile.o -MD -MP -MF "$(DEPDIR)/gvba-configfile.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-configfile.o `test -f 'configfile.cpp' || echo '$(srcdir)/'`configfile.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-configfile.Tpo" "$(DEPDIR)/gvba-configfile.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-configfile.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='configfile.cpp' object='gvba-configfile.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-configfile.Po' tmpdepfile='$(DEPDIR)/gvba-configfile.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-configfile.o `test -f 'configfile.cpp' || echo '$(srcdir)/'`configfile.cpp + +gvba-configfile.obj: configfile.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-configfile.obj -MD -MP -MF "$(DEPDIR)/gvba-configfile.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-configfile.obj `if test -f 'configfile.cpp'; then $(CYGPATH_W) 'configfile.cpp'; else $(CYGPATH_W) '$(srcdir)/configfile.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-configfile.Tpo" "$(DEPDIR)/gvba-configfile.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-configfile.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='configfile.cpp' object='gvba-configfile.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-configfile.Po' tmpdepfile='$(DEPDIR)/gvba-configfile.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-configfile.obj `if test -f 'configfile.cpp'; then $(CYGPATH_W) 'configfile.cpp'; else $(CYGPATH_W) '$(srcdir)/configfile.cpp'; fi` + +gvba-filters.o: filters.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-filters.o -MD -MP -MF "$(DEPDIR)/gvba-filters.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-filters.o `test -f 'filters.cpp' || echo '$(srcdir)/'`filters.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-filters.Tpo" "$(DEPDIR)/gvba-filters.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-filters.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='filters.cpp' object='gvba-filters.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-filters.Po' tmpdepfile='$(DEPDIR)/gvba-filters.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-filters.o `test -f 'filters.cpp' || echo '$(srcdir)/'`filters.cpp + +gvba-filters.obj: filters.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-filters.obj -MD -MP -MF "$(DEPDIR)/gvba-filters.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-filters.obj `if test -f 'filters.cpp'; then $(CYGPATH_W) 'filters.cpp'; else $(CYGPATH_W) '$(srcdir)/filters.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-filters.Tpo" "$(DEPDIR)/gvba-filters.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-filters.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='filters.cpp' object='gvba-filters.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-filters.Po' tmpdepfile='$(DEPDIR)/gvba-filters.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-filters.obj `if test -f 'filters.cpp'; then $(CYGPATH_W) 'filters.cpp'; else $(CYGPATH_W) '$(srcdir)/filters.cpp'; fi` + +gvba-input.o: input.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-input.o -MD -MP -MF "$(DEPDIR)/gvba-input.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-input.o `test -f 'input.cpp' || echo '$(srcdir)/'`input.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-input.Tpo" "$(DEPDIR)/gvba-input.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-input.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='input.cpp' object='gvba-input.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-input.Po' tmpdepfile='$(DEPDIR)/gvba-input.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-input.o `test -f 'input.cpp' || echo '$(srcdir)/'`input.cpp + +gvba-input.obj: input.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-input.obj -MD -MP -MF "$(DEPDIR)/gvba-input.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-input.obj `if test -f 'input.cpp'; then $(CYGPATH_W) 'input.cpp'; else $(CYGPATH_W) '$(srcdir)/input.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-input.Tpo" "$(DEPDIR)/gvba-input.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-input.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='input.cpp' object='gvba-input.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-input.Po' tmpdepfile='$(DEPDIR)/gvba-input.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-input.obj `if test -f 'input.cpp'; then $(CYGPATH_W) 'input.cpp'; else $(CYGPATH_W) '$(srcdir)/input.cpp'; fi` + +gvba-joypadconfig.o: joypadconfig.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-joypadconfig.o -MD -MP -MF "$(DEPDIR)/gvba-joypadconfig.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-joypadconfig.o `test -f 'joypadconfig.cpp' || echo '$(srcdir)/'`joypadconfig.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-joypadconfig.Tpo" "$(DEPDIR)/gvba-joypadconfig.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-joypadconfig.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='joypadconfig.cpp' object='gvba-joypadconfig.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-joypadconfig.Po' tmpdepfile='$(DEPDIR)/gvba-joypadconfig.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-joypadconfig.o `test -f 'joypadconfig.cpp' || echo '$(srcdir)/'`joypadconfig.cpp + +gvba-joypadconfig.obj: joypadconfig.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-joypadconfig.obj -MD -MP -MF "$(DEPDIR)/gvba-joypadconfig.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-joypadconfig.obj `if test -f 'joypadconfig.cpp'; then $(CYGPATH_W) 'joypadconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/joypadconfig.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-joypadconfig.Tpo" "$(DEPDIR)/gvba-joypadconfig.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-joypadconfig.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='joypadconfig.cpp' object='gvba-joypadconfig.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-joypadconfig.Po' tmpdepfile='$(DEPDIR)/gvba-joypadconfig.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-joypadconfig.obj `if test -f 'joypadconfig.cpp'; then $(CYGPATH_W) 'joypadconfig.cpp'; else $(CYGPATH_W) '$(srcdir)/joypadconfig.cpp'; fi` + +gvba-main.o: main.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-main.o -MD -MP -MF "$(DEPDIR)/gvba-main.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-main.o `test -f 'main.cpp' || echo '$(srcdir)/'`main.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-main.Tpo" "$(DEPDIR)/gvba-main.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-main.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cpp' object='gvba-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-main.Po' tmpdepfile='$(DEPDIR)/gvba-main.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-main.o `test -f 'main.cpp' || echo '$(srcdir)/'`main.cpp + +gvba-main.obj: main.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-main.obj -MD -MP -MF "$(DEPDIR)/gvba-main.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-main.obj `if test -f 'main.cpp'; then $(CYGPATH_W) 'main.cpp'; else $(CYGPATH_W) '$(srcdir)/main.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-main.Tpo" "$(DEPDIR)/gvba-main.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-main.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cpp' object='gvba-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-main.Po' tmpdepfile='$(DEPDIR)/gvba-main.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-main.obj `if test -f 'main.cpp'; then $(CYGPATH_W) 'main.cpp'; else $(CYGPATH_W) '$(srcdir)/main.cpp'; fi` + +gvba-screenarea.o: screenarea.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-screenarea.o -MD -MP -MF "$(DEPDIR)/gvba-screenarea.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-screenarea.o `test -f 'screenarea.cpp' || echo '$(srcdir)/'`screenarea.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-screenarea.Tpo" "$(DEPDIR)/gvba-screenarea.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-screenarea.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screenarea.cpp' object='gvba-screenarea.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-screenarea.Po' tmpdepfile='$(DEPDIR)/gvba-screenarea.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-screenarea.o `test -f 'screenarea.cpp' || echo '$(srcdir)/'`screenarea.cpp + +gvba-screenarea.obj: screenarea.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-screenarea.obj -MD -MP -MF "$(DEPDIR)/gvba-screenarea.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-screenarea.obj `if test -f 'screenarea.cpp'; then $(CYGPATH_W) 'screenarea.cpp'; else $(CYGPATH_W) '$(srcdir)/screenarea.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-screenarea.Tpo" "$(DEPDIR)/gvba-screenarea.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-screenarea.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='screenarea.cpp' object='gvba-screenarea.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-screenarea.Po' tmpdepfile='$(DEPDIR)/gvba-screenarea.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-screenarea.obj `if test -f 'screenarea.cpp'; then $(CYGPATH_W) 'screenarea.cpp'; else $(CYGPATH_W) '$(srcdir)/screenarea.cpp'; fi` + +gvba-system.o: system.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-system.o -MD -MP -MF "$(DEPDIR)/gvba-system.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-system.o `test -f 'system.cpp' || echo '$(srcdir)/'`system.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-system.Tpo" "$(DEPDIR)/gvba-system.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-system.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='system.cpp' object='gvba-system.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-system.Po' tmpdepfile='$(DEPDIR)/gvba-system.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-system.o `test -f 'system.cpp' || echo '$(srcdir)/'`system.cpp + +gvba-system.obj: system.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-system.obj -MD -MP -MF "$(DEPDIR)/gvba-system.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-system.obj `if test -f 'system.cpp'; then $(CYGPATH_W) 'system.cpp'; else $(CYGPATH_W) '$(srcdir)/system.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-system.Tpo" "$(DEPDIR)/gvba-system.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-system.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='system.cpp' object='gvba-system.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-system.Po' tmpdepfile='$(DEPDIR)/gvba-system.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-system.obj `if test -f 'system.cpp'; then $(CYGPATH_W) 'system.cpp'; else $(CYGPATH_W) '$(srcdir)/system.cpp'; fi` + +gvba-tools.o: tools.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-tools.o -MD -MP -MF "$(DEPDIR)/gvba-tools.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-tools.o `test -f 'tools.cpp' || echo '$(srcdir)/'`tools.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-tools.Tpo" "$(DEPDIR)/gvba-tools.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-tools.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tools.cpp' object='gvba-tools.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-tools.Po' tmpdepfile='$(DEPDIR)/gvba-tools.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-tools.o `test -f 'tools.cpp' || echo '$(srcdir)/'`tools.cpp + +gvba-tools.obj: tools.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-tools.obj -MD -MP -MF "$(DEPDIR)/gvba-tools.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-tools.obj `if test -f 'tools.cpp'; then $(CYGPATH_W) 'tools.cpp'; else $(CYGPATH_W) '$(srcdir)/tools.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-tools.Tpo" "$(DEPDIR)/gvba-tools.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-tools.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tools.cpp' object='gvba-tools.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-tools.Po' tmpdepfile='$(DEPDIR)/gvba-tools.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-tools.obj `if test -f 'tools.cpp'; then $(CYGPATH_W) 'tools.cpp'; else $(CYGPATH_W) '$(srcdir)/tools.cpp'; fi` + +gvba-windowcallbacks.o: windowcallbacks.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-windowcallbacks.o -MD -MP -MF "$(DEPDIR)/gvba-windowcallbacks.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-windowcallbacks.o `test -f 'windowcallbacks.cpp' || echo '$(srcdir)/'`windowcallbacks.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-windowcallbacks.Tpo" "$(DEPDIR)/gvba-windowcallbacks.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-windowcallbacks.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='windowcallbacks.cpp' object='gvba-windowcallbacks.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-windowcallbacks.Po' tmpdepfile='$(DEPDIR)/gvba-windowcallbacks.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-windowcallbacks.o `test -f 'windowcallbacks.cpp' || echo '$(srcdir)/'`windowcallbacks.cpp + +gvba-windowcallbacks.obj: windowcallbacks.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-windowcallbacks.obj -MD -MP -MF "$(DEPDIR)/gvba-windowcallbacks.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-windowcallbacks.obj `if test -f 'windowcallbacks.cpp'; then $(CYGPATH_W) 'windowcallbacks.cpp'; else $(CYGPATH_W) '$(srcdir)/windowcallbacks.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-windowcallbacks.Tpo" "$(DEPDIR)/gvba-windowcallbacks.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-windowcallbacks.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='windowcallbacks.cpp' object='gvba-windowcallbacks.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-windowcallbacks.Po' tmpdepfile='$(DEPDIR)/gvba-windowcallbacks.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-windowcallbacks.obj `if test -f 'windowcallbacks.cpp'; then $(CYGPATH_W) 'windowcallbacks.cpp'; else $(CYGPATH_W) '$(srcdir)/windowcallbacks.cpp'; fi` + +gvba-window.o: window.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-window.o -MD -MP -MF "$(DEPDIR)/gvba-window.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-window.o `test -f 'window.cpp' || echo '$(srcdir)/'`window.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-window.Tpo" "$(DEPDIR)/gvba-window.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-window.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='window.cpp' object='gvba-window.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-window.Po' tmpdepfile='$(DEPDIR)/gvba-window.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-window.o `test -f 'window.cpp' || echo '$(srcdir)/'`window.cpp + +gvba-window.obj: window.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -MT gvba-window.obj -MD -MP -MF "$(DEPDIR)/gvba-window.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o gvba-window.obj `if test -f 'window.cpp'; then $(CYGPATH_W) 'window.cpp'; else $(CYGPATH_W) '$(srcdir)/window.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gvba-window.Tpo" "$(DEPDIR)/gvba-window.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/gvba-window.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='window.cpp' object='gvba-window.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/gvba-window.Po' tmpdepfile='$(DEPDIR)/gvba-window.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gvba_CPPFLAGS) $(CPPFLAGS) $(gvba_CXXFLAGS) $(CXXFLAGS) -c -o gvba-window.obj `if test -f 'window.cpp'; then $(CYGPATH_W) 'window.cpp'; else $(CYGPATH_W) '$(srcdir)/window.cpp'; fi` +uninstall-info-am: +dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) +install-dist_pkgdataDATA: $(dist_pkgdata_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \ + $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +uninstall-dist_pkgdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \ + rm -f $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-dist_pkgdataDATA + +install-exec-am: install-binPROGRAMS + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-dist_pkgdataDATA \ + uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-recursive \ + distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-binPROGRAMS \ + install-data install-data-am install-data-recursive \ + install-dist_pkgdataDATA install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-dist_pkgdataDATA uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/gtk/configfile.cpp b/src/gtk/configfile.cpp new file mode 100644 index 0000000..3b50457 --- /dev/null +++ b/src/gtk/configfile.cpp @@ -0,0 +1,262 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "configfile.h" + +#include +#include + +#include +#include + +namespace VBA +{ +namespace Config +{ + +using std::string; +using Glib::IOChannel; + +Line::Line(const string & _rsKey, const string & _rsValue) : + m_sKey(_rsKey), + m_sValue(_rsValue) +{ +} + +Section::Section(const string & _rsName) : + m_sName(_rsName) +{ +} + +bool Section::bKeyExists(const string & _rsKey) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + return true; + } + } + return false; +} + +void Section::vSetKey(const string & _rsKey, const string & _rsValue) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + it->m_sValue = _rsValue; + return; + } + } + push_back(Line(_rsKey, _rsValue)); +} + +string Section::sGetKey(const string & _rsKey) const +{ + for (const_iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + return it->m_sValue; + } + } + throw KeyNotFound(m_sName, _rsKey); +} + +void Section::vRemoveKey(const string & _rsKey) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + erase(it); + return; + } + } +} + +File::File() +{ +} + +File::File(const string & _rsFile) +{ + vLoad(_rsFile); +} + +File::~File() +{ +} + +bool File::bSectionExists(const string & _rsName) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->sGetName() == _rsName) + { + return true; + } + } + return false; +} + +Section * File::poAddSection(const string & _rsName) +{ + Section * poSection = NULL; + for (iterator it = begin(); it != end(); it++) + { + if (it->sGetName() == _rsName) + { + poSection = &(*it); + } + } + if (poSection == NULL) + { + push_back(Section(_rsName)); + poSection = &back(); + } + return poSection; +} + +Section * File::poGetSection(const string & _rsName) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->sGetName() == _rsName) + { + return &(*it); + } + } + throw SectionNotFound(_rsName); +} + +void File::vRemoveSection(const string & _rsName) +{ + for (iterator it = begin(); it != end(); it++) + { + if (it->sGetName() == _rsName) + { + erase(it); + return; + } + } +} + +void File::vLoad(const string & _rsFile, + bool _bAddSection, + bool _bAddKey) +{ + string sBuffer = Glib::file_get_contents(_rsFile); + Section * poSection = NULL; + char ** lines = g_strsplit(sBuffer.c_str(), "\n", 0); + char * tmp; + int i = 0; + while (lines[i]) + { + if (lines[i][0] == '[') + { + if ((tmp = strchr(lines[i], ']'))) + { + *tmp = '\0'; + if (_bAddSection) + { + poSection = poAddSection(&lines[i][1]); + } + else + { + try + { + poSection = poGetSection(&lines[i][1]); + } + catch (...) + { + poSection = NULL; + } + } + } + } + else if (lines[i][0] != '#' && poSection != NULL) + { + if ((tmp = strchr(lines[i], '='))) + { + *tmp = '\0'; + tmp++; + if (_bAddKey || poSection->bKeyExists(lines[i])) + { + poSection->vSetKey(lines[i], tmp); + } + } + } + i++; + } + g_strfreev(lines); +} + +void File::vSave(const string & _rsFile) +{ + Glib::RefPtr poFile = IOChannel::create_from_file(_rsFile, "w"); + poFile->set_encoding(""); + + for (const_iterator poSection = begin(); + poSection != end(); + poSection++) + { + string sName = "[" + poSection->sGetName() + "]\n"; + poFile->write(sName); + + for (Section::const_iterator poLine = poSection->begin(); + poLine != poSection->end(); + poLine++) + { + string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n"; + poFile->write(sLine); + } + poFile->write("\n"); + } +} + +void File::vClear() +{ + clear(); +} + +std::ostream & operator<<(std::ostream & _roOut, const File & _roFile) +{ + for (File::const_iterator poSection = _roFile.begin(); + poSection != _roFile.end(); + poSection++) + { + string sName = "[" + poSection->sGetName() + "]\n"; + _roOut << sName; + + for (Section::const_iterator poLine = poSection->begin(); + poLine != poSection->end(); + poLine++) + { + string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n"; + _roOut << sLine; + } + _roOut << "\n"; + } + return _roOut; +} + +} // namespace Config +} // namespace VBA diff --git a/src/gtk/configfile.h b/src/gtk/configfile.h new file mode 100644 index 0000000..15b9dfc --- /dev/null +++ b/src/gtk/configfile.h @@ -0,0 +1,204 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_CONFIGFILE_H__ +#define __VBA_CONFIGFILE_H__ + +#include +#include +#include +#include + +namespace VBA +{ +namespace Config +{ + +class NotFound +{ +public: + virtual ~NotFound() {} + +protected: + NotFound() {} +}; + +class SectionNotFound : public NotFound +{ +public: + SectionNotFound(const std::string & _rsName) : + m_sName(_rsName) + { + } + virtual ~SectionNotFound() {} + + inline std::string sGetName() const { return m_sName; } + +private: + std::string m_sName; +}; + +class KeyNotFound : public NotFound +{ +public: + KeyNotFound(const std::string & _rsSection, const std::string & _rsKey) : + m_sSection(_rsSection), + m_sKey(_rsKey) + { + } + virtual ~KeyNotFound() {} + + inline std::string sGetSection() const { return m_sSection; } + inline std::string sGetKey() const { return m_sKey; } + +private: + std::string m_sSection; + std::string m_sKey; +}; + +class Line +{ +public: + Line(const std::string & _rsKey, const std::string & _rsValue); + + std::string m_sKey; + std::string m_sValue; +}; + +class Section : private std::list +{ +public: + explicit Section(const std::string & _rsName); + + inline std::string sGetName() const { return m_sName; } + + bool bKeyExists(const std::string & _rsKey); + void vSetKey(const std::string & _rsKey, const std::string & _rsValue); + std::string sGetKey(const std::string & _rsKey) const; + void vRemoveKey(const std::string & _rsKey); + + template + void vSetKey(const std::string & _rsKey, const T & _rValue); + + template + T oGetKey(const std::string & _rsKey) const; + + // read only + typedef std::list::const_iterator const_iterator; + inline const_iterator begin() const + { + return std::list::begin(); + } + inline const_iterator end() const + { + return std::list::end(); + } + +private: + inline iterator begin() + { + return std::list::begin(); + } + inline iterator end() + { + return std::list::end(); + } + + std::string m_sName; +}; + +class File : private std::list
+{ +public: + File(); + File(const std::string & _rsFile); + virtual ~File(); + + bool bSectionExists(const std::string & _rsName); + Section * poAddSection(const std::string & _rsName); + Section * poGetSection(const std::string & _rsName); + void vRemoveSection(const std::string & _rsName); + void vLoad(const std::string & _rsFile, + bool _bAddSection = true, + bool _bAddKey = true); + void vSave(const std::string & _rsFile); + void vClear(); + + // read only + typedef std::list
::const_iterator const_iterator; + inline const_iterator begin() const + { + return std::list
::begin(); + } + inline const_iterator end() const + { + return std::list
::end(); + } + +private: + inline iterator begin() + { + return std::list
::begin(); + } + inline iterator end() + { + return std::list
::end(); + } +}; + +// debug +std::ostream & operator<<(std::ostream & _roOut, const File & _roConfig); + +template +void Section::vSetKey(const std::string & _rsKey, const T & _rValue) +{ + std::ostringstream oOut; + oOut << _rValue; + for (iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + it->m_sValue = oOut.str(); + return; + } + } + push_back(Line(_rsKey, oOut.str())); +} + +template +T Section::oGetKey(const std::string & _rsKey) const +{ + T oValue; + for (const_iterator it = begin(); it != end(); it++) + { + if (it->m_sKey == _rsKey) + { + std::istringstream oIn(it->m_sValue); + oIn >> oValue; + return oValue; + } + } + throw KeyNotFound(m_sName, _rsKey); +} + +} // namespace Config +} // namespace VBA + + +#endif // __VBA_CONFIGFILE_H__ diff --git a/src/gtk/filters.cpp b/src/gtk/filters.cpp new file mode 100644 index 0000000..50f31bf --- /dev/null +++ b/src/gtk/filters.cpp @@ -0,0 +1,59 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "filters.h" + +namespace VBA +{ + +static const Filter2x apvFilters2x[][2] = +{ + { NULL, NULL }, + { _2xSaI, _2xSaI32 }, + { Super2xSaI, Super2xSaI32 }, + { SuperEagle, SuperEagle32 }, + { Pixelate, Pixelate32 }, + { MotionBlur, MotionBlur32 }, + { AdMame2x, AdMame2x32 }, + { Simple2x, Simple2x32 }, + { Bilinear, Bilinear32 }, + { BilinearPlus, BilinearPlus32 }, + { Scanlines, Scanlines32 }, + { ScanlinesTV, ScanlinesTV32 }, + { hq2x, hq2x32 }, + { lq2x, lq2x32 } +}; + +static const FilterIB apvFiltersIB[][2] = +{ + { NULL, NULL }, + { SmartIB, SmartIB32 }, + { MotionBlurIB, MotionBlurIB32 } +}; + +Filter2x pvGetFilter2x(EFilter2x _eFilter2x, EFilterDepth _eDepth) +{ + return apvFilters2x[_eFilter2x][_eDepth]; +} + +FilterIB pvGetFilterIB(EFilterIB _eFilterIB, EFilterDepth _eDepth) +{ + return apvFiltersIB[_eFilterIB][_eDepth]; +} + +} // namespace VBA diff --git a/src/gtk/filters.h b/src/gtk/filters.h new file mode 100644 index 0000000..a058f80 --- /dev/null +++ b/src/gtk/filters.h @@ -0,0 +1,106 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_FILTERS_H__ +#define __VBA_FILTERS_H__ + +#include "../System.h" + +int Init_2xSaI(u32); + +void _2xSaI (u8 *, u32, u8 *, u8 *, u32, int, int); +void _2xSaI32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void Super2xSaI (u8 *, u32, u8 *, u8 *, u32, int, int); +void Super2xSaI32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void SuperEagle (u8 *, u32, u8 *, u8 *, u32, int, int); +void SuperEagle32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void Pixelate (u8 *, u32, u8 *, u8 *, u32, int, int); +void Pixelate32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void MotionBlur (u8 *, u32, u8 *, u8 *, u32, int, int); +void MotionBlur32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void AdMame2x (u8 *, u32, u8 *, u8 *, u32, int, int); +void AdMame2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void Simple2x (u8 *, u32, u8 *, u8 *, u32, int, int); +void Simple2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void Bilinear (u8 *, u32, u8 *, u8 *, u32, int, int); +void Bilinear32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void BilinearPlus (u8 *, u32, u8 *, u8 *, u32, int, int); +void BilinearPlus32(u8 *, u32, u8 *, u8 *, u32, int, int); +void Scanlines (u8 *, u32, u8 *, u8 *, u32, int, int); +void Scanlines32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void ScanlinesTV (u8 *, u32, u8 *, u8 *, u32, int, int); +void ScanlinesTV32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void hq2x (u8 *, u32, u8 *, u8 *, u32, int, int); +void hq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void lq2x (u8 *, u32, u8 *, u8 *, u32, int, int); +void lq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); + +void SmartIB (u8 *, u32, int, int); +void SmartIB32 (u8 *, u32, int, int); +void MotionBlurIB (u8 *, u32, int, int); +void MotionBlurIB32(u8 *, u32, int, int); + +namespace VBA +{ + +typedef void (*Filter2x)(u8 *, u32, u8 *, u8 *, u32, int, int); +typedef void (*FilterIB)(u8 *, u32, int, int); + +enum EFilter2x +{ + FirstFilter, + FilterNone = FirstFilter, + Filter2xSaI, + FilterSuper2xSaI, + FilterSuperEagle, + FilterPixelate, + FilterMotionBlur, + FilterAdMame2x, + FilterSimple2x, + FilterBilinear, + FilterBilinearPlus, + FilterScanlines, + FilterScanlinesTV, + FilterHq2x, + FilterLq2x, + LastFilter = FilterLq2x +}; + +enum EFilterIB +{ + FirstFilterIB, + FilterIBNone = FirstFilterIB, + FilterIBSmart, + FilterIBMotionBlur, + LastFilterIB = FilterIBMotionBlur +}; + +enum EFilterDepth +{ + FilterDepth16, + FilterDepth32 +}; + +Filter2x pvGetFilter2x(EFilter2x _eFilter2x, EFilterDepth _eDepth); +FilterIB pvGetFilterIB(EFilterIB _eFilterIB, EFilterDepth _eDepth); + +} // namespace VBA + + +#endif // __VBA_FILTERS_H__ diff --git a/src/gtk/images/Makefile.am b/src/gtk/images/Makefile.am new file mode 100644 index 0000000..7b6d942 --- /dev/null +++ b/src/gtk/images/Makefile.am @@ -0,0 +1,22 @@ +VBA_WM_IMAGES = \ + stock-vba-wm-16.png \ + stock-vba-wm-32.png \ + stock-vba-wm-48.png \ + stock-vba-wm-64.png + +VBA_WM_VARIABLES = \ + stock_vba_wm_16 $(srcdir)/stock-vba-wm-16.png \ + stock_vba_wm_32 $(srcdir)/stock-vba-wm-32.png \ + stock_vba_wm_48 $(srcdir)/stock-vba-wm-48.png \ + stock_vba_wm_64 $(srcdir)/stock-vba-wm-64.png + +EXTRA_DIST = $(VBA_WM_IMAGES) + +noinst_DATA = vba-wm-pixbufs.h + +dist_pkgdata_DATA = vba-64.png + +CLEANFILES = $(noinst_DATA) + +$(srcdir)/vba-wm-pixbufs.h: $(VBA_WM_IMAGES) Makefile.am + gdk-pixbuf-csource --raw --build-list $(VBA_WM_VARIABLES) > $(@F) diff --git a/src/gtk/images/Makefile.in b/src/gtk/images/Makefile.in new file mode 100644 index 0000000..a698130 --- /dev/null +++ b/src/gtk/images/Makefile.in @@ -0,0 +1,339 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +VBA_WM_IMAGES = \ + stock-vba-wm-16.png \ + stock-vba-wm-32.png \ + stock-vba-wm-48.png \ + stock-vba-wm-64.png + + +VBA_WM_VARIABLES = \ + stock_vba_wm_16 $(srcdir)/stock-vba-wm-16.png \ + stock_vba_wm_32 $(srcdir)/stock-vba-wm-32.png \ + stock_vba_wm_48 $(srcdir)/stock-vba-wm-48.png \ + stock_vba_wm_64 $(srcdir)/stock-vba-wm-64.png + + +EXTRA_DIST = $(VBA_WM_IMAGES) + +noinst_DATA = vba-wm-pixbufs.h + +dist_pkgdata_DATA = vba-64.png + +CLEANFILES = $(noinst_DATA) +subdir = src/gtk/images +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DATA = $(dist_pkgdata_DATA) $(noinst_DATA) + +DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.in Makefile.am +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gtk/images/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: +dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) +install-dist_pkgdataDATA: $(dist_pkgdata_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \ + $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +uninstall-dist_pkgdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \ + rm -f $(DESTDIR)$(pkgdatadir)/$$f; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-dist_pkgdataDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am \ + install-dist_pkgdataDATA install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am \ + uninstall-dist_pkgdataDATA uninstall-info-am + + +$(srcdir)/vba-wm-pixbufs.h: $(VBA_WM_IMAGES) Makefile.am + gdk-pixbuf-csource --raw --build-list $(VBA_WM_VARIABLES) > $(@F) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/gtk/images/stock-vba-wm-16.png b/src/gtk/images/stock-vba-wm-16.png new file mode 100644 index 0000000000000000000000000000000000000000..bee56f76c1847ce7d134fadb3915419c69d6f368 GIT binary patch literal 727 zcmV;|0x127P)ErgoUedD=%*=xnoHco7B#p$l^oMG+Qt8630Qf-=_RhJWC#d2Us%~^B1El9@!eY=2NUxnkw zmZm?zTF#=X(#H7?$)0`tJ?HZAw*iiYiDfs2l@#ziKe`%^fT{@)!XTy)WH|u^qs>n# zbe2K!kAm7->5ZOOF+1@NU|Gz5DE78fAb$}sUfY~|&UBksww3Ml{u9#&?hIMeL1_R0002ov JPDHLkV1h_JO8Wo+ literal 0 HcmV?d00001 diff --git a/src/gtk/images/stock-vba-wm-32.png b/src/gtk/images/stock-vba-wm-32.png new file mode 100644 index 0000000000000000000000000000000000000000..9eb6f01669eafc7bb8509595ab07e3f1fb588077 GIT binary patch literal 1810 zcmV+t2krQYP)IYsVM7PJ%D2li)R1934?Zla<>1Sdr* zPbdncZ%7~_AtauVKwwpc2cRv1@(?9qV|s~|=4Pi&Hjc5qzO23Xnc1D0Gjn(dsZcRa z?1UnIk4N9p{50R~5IiKF7i``kLXrfCi471xNW&~>unY=Q)0t@u^9*Z%JSadqVv}dP z;GE9FshiB4Vk1Wvj>8??eno~}v^GqaCfBtUk ztMjrfd)vdd&#;J0EylM5;hD%l)hVHj!N{r5(m7IU2{PsENuEBEKsX$(FveuJ$A{Ku zzH7^}GexS!q)GhmeP-+D=XCgVQGj6Cu$3xw(}F%Fph*f?upHC?Phd$}z^pSPpj`5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mX8lTRE!%E{4Vw6=7T&1P3b z^)Gga#Y&m6sY#@x*f2ayCX=b(aKrT<9~vAysI^9G{kC(iSas1DgX_BXp@$y&bX!~7 ziHq-zkH5ythYym^w$RqvhUa-JGpP{7NkVIDE9=%@g_4SG+qV6?O+)LyTd!BKHhEo^ zZ33lI=^d>pl}b%N_~3(|`07```t4e+)_URk+}sSWB!}3%@fw7HvGMU0@dcfo9rX1N zpcBpT@P_|7G`#L_JkLYxEBm-?Neu{s;2q1BEnA+w_uhNoLOmCX1r8kEPyebx)(#B3 zYfb3v?4WN=KlPx_*6XhQ${n}w{4Z%QhcOXCIB$}7)f;>#BBjJy%Z?p8{^^DrZutAR zP})kF=MOx``ZXI^H?S7p^On`(YHx34Rqtxbr81ozZQt5<({+E++}w;pA!Yh4K5E$} zu-sGfJdcll^rQcFa&mI>m!dm@?;o>`L~AHCholL zE{>i&$f?)P5Jk}vwrlC>>87o{i%PjnKHqTkBM;pBfpu4{J5#T}eG%mL+wWYS2_#9f zY^l|13=a?Qzwf^L{^U~cE*2N~(cT|0ylx9uty_=hdHBA6nQ$!VUA2nVw#DR0V8=FX zSbuNUOP?u+%Xg+L*JQg4QPEm+&pr2iZP%_{U$|thzfj~+xEWQYc~x2R0#dH zn_HpoaQv>NTCI}H<$_Or>QjHv+S)pPNxo4o@pu39_na-1=<4XgPo>D^vh?@&qa2s% z>2u7@&6-86`LcjJvW{^zEqCQ_-?inPOiAxvL34?q0ypNaFWv-e^w83l|n z?}>zANN;cN*uxJ${6IrPL*c@F=~Rl-r%tnd$M#1*_OXwBdZkbN7fOVd0#-`N)~#Fj z-F^4n9|P)2DQeX!9UUE?-*x9*4=bhgQWc$FSpY785QZT;ckcSm?%lip)N!2ItA>XD scH{8I|BxinidK()J$^lYJuW%^KPde*+4!U)IsgCw07*qoM6N<$f-qkz6951J literal 0 HcmV?d00001 diff --git a/src/gtk/images/vba-64.png b/src/gtk/images/vba-64.png new file mode 100644 index 0000000000000000000000000000000000000000..beaa29009858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-86`LcjJvW{^zEqCQ_-?inPOiAxvL34?q0ypNaFWv-e^w83l|n z?}>zANN;cN*uxJ${6IrPL*c@F=~Rl-r%tnd$M#1*_OXwBdZkbN7fOVd0#-`N)~#Fj z-F^4n9|P)2DQeX!9UUE?-*x9*4=bhgQWc$FSpY785QZT;ckcSm?%lip)N!2ItA>XD scH{8I|BxinidK()J$^lYJuW%^KPde*+4!U)IsgCw07*qoM6N<$f-qkz6951J literal 0 HcmV?d00001 diff --git a/src/gtk/input.cpp b/src/gtk/input.cpp new file mode 100644 index 0000000..5eecbf1 --- /dev/null +++ b/src/gtk/input.cpp @@ -0,0 +1,53 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "input.h" + +#include + +namespace VBA +{ + +Keymap::Keymap() +{ + m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal); + if (m_pstTable == NULL) + { + throw std::bad_alloc(); + } +} + +Keymap::~Keymap() +{ + g_hash_table_destroy(m_pstTable); +} + +void Keymap::vRegister(guint _uiVal, EKey _eKey) +{ + g_hash_table_insert(m_pstTable, + GUINT_TO_POINTER(_uiVal), + GUINT_TO_POINTER(_eKey)); +} + +void Keymap::vClear() +{ + g_hash_table_destroy(m_pstTable); + m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal); +} + +} // namespace VBA diff --git a/src/gtk/input.h b/src/gtk/input.h new file mode 100644 index 0000000..5b2b21e --- /dev/null +++ b/src/gtk/input.h @@ -0,0 +1,92 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_INPUT_H__ +#define __VBA_INPUT_H__ + +#include + +namespace VBA +{ + +enum EKey +{ + KeyNone, + // GBA keys + KeyA, + KeyB, + KeySelect, + KeyStart, + KeyRight, + KeyLeft, + KeyUp, + KeyDown, + KeyR, + KeyL, + // VBA extension + KeySpeed, + KeyCapture +}; + +enum EKeyFlag +{ + // GBA keys + KeyFlagA = 1 << 0, + KeyFlagB = 1 << 1, + KeyFlagSelect = 1 << 2, + KeyFlagStart = 1 << 3, + KeyFlagRight = 1 << 4, + KeyFlagLeft = 1 << 5, + KeyFlagUp = 1 << 6, + KeyFlagDown = 1 << 7, + KeyFlagR = 1 << 8, + KeyFlagL = 1 << 9, + // VBA extension + KeyFlagSpeed = 1 << 10, + KeyFlagCapture = 1 << 11, +}; + +class Keymap +{ + public: + Keymap(); + ~Keymap(); + + void vRegister(guint _uiVal, EKey _eKey); + void vClear(); + inline EKey eGetKey(guint _uiVal); + + private: + GHashTable * m_pstTable; + + // noncopyable + Keymap(const Keymap &); + Keymap & operator=(const Keymap &); +}; + +inline EKey Keymap::eGetKey(guint _uiVal) +{ + return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable, + GUINT_TO_POINTER(_uiVal))); +} + +} // namespace VBA + + +#endif // __VBA_INPUT_H__ diff --git a/src/gtk/intl.h b/src/gtk/intl.h new file mode 100644 index 0000000..f40f779 --- /dev/null +++ b/src/gtk/intl.h @@ -0,0 +1,42 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_INTL_H__ +#define __VBA_INTL_H__ + +#ifndef GETTEXT_PACKAGE +# error "GETTEXT_PACKAGE must be defined" +#endif + +#ifdef ENABLE_NLS +# include +# define _(String) gettext(String) +# define N_(String) (String) +#else +# define _(String) (String) +# define N_(String) (String) +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,String) (String) +# define dcgettext(Domain,String,Type) (String) +# define bindtextdomain(Domain,Directory) (Domain) +#endif + + +#endif // __VBA_INTL_H__ diff --git a/src/gtk/joypadconfig.cpp b/src/gtk/joypadconfig.cpp new file mode 100644 index 0000000..17be83b --- /dev/null +++ b/src/gtk/joypadconfig.cpp @@ -0,0 +1,276 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "joypadconfig.h" + +#include + +#include "intl.h" + +namespace VBA +{ + +guint * JoypadConfig::puiAt(int _iIndex) +{ + guint * puiMember; + + switch (_iIndex) + { + case 0: + puiMember = &m_uiUp; + break; + case 1: + puiMember = &m_uiDown; + break; + case 2: + puiMember = &m_uiLeft; + break; + case 3: + puiMember = &m_uiRight; + break; + case 4: + puiMember = &m_uiA; + break; + case 5: + puiMember = &m_uiB; + break; + case 6: + puiMember = &m_uiL; + break; + case 7: + puiMember = &m_uiR; + break; + case 8: + puiMember = &m_uiSelect; + break; + case 9: + puiMember = &m_uiStart; + break; + case 10: + puiMember = &m_uiSpeed; + break; + case 11: + puiMember = &m_uiCapture; + break; + default: + puiMember = NULL; + } + + return puiMember; +} + +int JoypadConfig::iFind(guint _uiKeycode) +{ + for (guint i = 0; i < 12; i++) + { + if (*puiAt(i) == _uiKeycode) + { + return i; + } + } + + return -1; +} + +void JoypadConfig::vSetDefault() +{ + guint auiKeyval[] = + { + GDK_Up, GDK_Down, GDK_Left, GDK_Right, + GDK_z, GDK_x, GDK_a, GDK_s, + GDK_BackSpace, GDK_Return, + GDK_space, GDK_F12 + }; + + for (guint i = 0; i < G_N_ELEMENTS(auiKeyval); i++) + { + GdkKeymapKey * pstKeys; + int iKeys; + + if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), + auiKeyval[i], + &pstKeys, + &iKeys)) + { + *puiAt(i) = pstKeys[0].keycode; + g_free(pstKeys); + } + else + { + *puiAt(i) = 0; + } + } +} + +Keymap * JoypadConfig::poCreateKeymap() const +{ + Keymap * poKeymap = new Keymap(); + + poKeymap->vRegister(m_uiUp, KeyUp ); + poKeymap->vRegister(m_uiDown, KeyDown ); + poKeymap->vRegister(m_uiLeft, KeyLeft ); + poKeymap->vRegister(m_uiRight, KeyRight ); + poKeymap->vRegister(m_uiA, KeyA ); + poKeymap->vRegister(m_uiB, KeyB ); + poKeymap->vRegister(m_uiL, KeyL ); + poKeymap->vRegister(m_uiR, KeyR ); + poKeymap->vRegister(m_uiSelect, KeySelect ); + poKeymap->vRegister(m_uiStart, KeyStart ); + poKeymap->vRegister(m_uiSpeed, KeySpeed ); + poKeymap->vRegister(m_uiCapture, KeyCapture ); + + return poKeymap; +} + +JoypadConfigDialog::JoypadConfigDialog(GtkDialog * _pstDialog, + const Glib::RefPtr & _poXml) : + Gtk::Dialog(_pstDialog) +{ + m_puiCurrentKeyCode = NULL; + + memset(&m_oConfig, 0, sizeof(m_oConfig)); + + m_poOkButton = dynamic_cast(_poXml->get_widget("JoypadOkButton")); + + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadUpEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadDownEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadLeftEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadRightEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadAEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadBEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadLEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadREntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadSelectEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadStartEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadSpeedEntry"))); + m_oEntries.push_back(dynamic_cast(_poXml->get_widget("JoypadCaptureEntry"))); + + for (guint i = 0; i < m_oEntries.size(); i++) + { + Gtk::Entry * poEntry = m_oEntries[i]; + + poEntry->signal_focus_in_event().connect(SigC::bind( + SigC::slot(*this, &JoypadConfigDialog::bOnEntryFocusIn), + i)); + poEntry->signal_focus_out_event().connect(SigC::slot(*this, &JoypadConfigDialog::bOnEntryFocusOut)); + } + + vUpdateEntries(); +} + +JoypadConfigDialog::~JoypadConfigDialog() +{ +} + +void JoypadConfigDialog::vSetConfig(const JoypadConfig & _roConfig) +{ + m_oConfig = _roConfig; + vUpdateEntries(); +} + +void JoypadConfigDialog::vUpdateEntries() +{ + for (guint i = 0; i < m_oEntries.size(); i++) + { + guint uiKeyval = 0; + gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(), + *m_oConfig.puiAt(i), + (GdkModifierType)0, + 0, + &uiKeyval, + NULL, + NULL, + NULL); + const char * csName = gdk_keyval_name(uiKeyval); + if (csName == NULL) + { + m_oEntries[i]->set_text(_("")); + } + else + { + m_oEntries[i]->set_text(csName); + } + } +} + +bool JoypadConfigDialog::bOnEntryFocusIn(GdkEventFocus * _pstEvent, + guint _uiEntry) +{ + m_uiCurrentEntry = _uiEntry; + m_puiCurrentKeyCode = m_oConfig.puiAt(_uiEntry); + + return false; +} + +bool JoypadConfigDialog::bOnEntryFocusOut(GdkEventFocus * _pstEvent) +{ + m_puiCurrentKeyCode = NULL; + + return false; +} + +bool JoypadConfigDialog::on_key_press_event(GdkEventKey * _pstEvent) +{ + if (m_puiCurrentKeyCode == NULL) + { + return Gtk::Dialog::on_key_press_event(_pstEvent); + } + + *m_puiCurrentKeyCode = 0; + int iFound = m_oConfig.iFind(_pstEvent->hardware_keycode); + if (iFound >= 0) + { + *m_oConfig.puiAt(iFound) = 0; + m_oEntries[iFound]->set_text(_("")); + } + + *m_puiCurrentKeyCode = _pstEvent->hardware_keycode; + + guint uiKeyval = 0; + gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(), + _pstEvent->hardware_keycode, + (GdkModifierType)0, + 0, + &uiKeyval, + NULL, + NULL, + NULL); + + const char * csName = gdk_keyval_name(uiKeyval); + if (csName == NULL) + { + m_oEntries[m_uiCurrentEntry]->set_text(_("")); + } + else + { + m_oEntries[m_uiCurrentEntry]->set_text(csName); + } + + if (m_uiCurrentEntry + 1 < m_oEntries.size()) + { + m_oEntries[m_uiCurrentEntry + 1]->grab_focus(); + } + else + { + m_poOkButton->grab_focus(); + } + + return true; +} + +} // namespace VBA diff --git a/src/gtk/joypadconfig.h b/src/gtk/joypadconfig.h new file mode 100644 index 0000000..0af7f3a --- /dev/null +++ b/src/gtk/joypadconfig.h @@ -0,0 +1,88 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_JOYPADCONFIG_H__ +#define __VBA_JOYPADCONFIG_H__ + +#include + +#include +#include + +#ifndef GTKMM20 +# include "sigccompat.h" +#endif // ! GTKMM20 + +#include "input.h" + +namespace VBA +{ + +class JoypadConfig +{ +public: + guint m_uiUp; + guint m_uiDown; + guint m_uiLeft; + guint m_uiRight; + guint m_uiA; + guint m_uiB; + guint m_uiL; + guint m_uiR; + guint m_uiSelect; + guint m_uiStart; + guint m_uiSpeed; + guint m_uiCapture; + + guint * puiAt(int _iIndex); + int iFind(guint _uiKeycode); + void vSetDefault(); + Keymap * poCreateKeymap() const; +}; + +class JoypadConfigDialog : public Gtk::Dialog +{ +public: + JoypadConfigDialog(GtkDialog * _pstDialog, + const Glib::RefPtr & _poXml); + virtual ~JoypadConfigDialog(); + + void vSetConfig(const JoypadConfig & _roConfig); + inline JoypadConfig stGetConfig() const { return m_oConfig; } + +protected: + bool bOnEntryFocusIn(GdkEventFocus * _pstEvent, guint _uiEntry); + bool bOnEntryFocusOut(GdkEventFocus * _pstEvent); + + bool on_key_press_event(GdkEventKey * _pstEvent); + +private: + JoypadConfig m_oConfig; + Gtk::Button * m_poOkButton; + std::vector m_oEntries; + guint * m_puiCurrentKeyCode; + guint m_uiCurrentEntry; + + void vUpdateEntries(); +}; + +} // namespace VBA + + +#endif // __VBA_JOYPADCONFIG_H__ diff --git a/src/gtk/main.cpp b/src/gtk/main.cpp new file mode 100644 index 0000000..a783bd2 --- /dev/null +++ b/src/gtk/main.cpp @@ -0,0 +1,177 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include "../getopt.h" + +#include + +#include +#include +#include +#include + +#include "images/vba-wm-pixbufs.h" + +#include "window.h" +#include "intl.h" + +using Gnome::Glade::Xml; + +static const char * csProgramName; + +static int iShowHelp; +static int iShowVersion; + +// Non-characters used for long options that have no equivalent short option +enum +{ + IGNORED_OPTION = CHAR_MAX + 1 +}; + +static const char csShortOptions[] = "V"; + +static const struct option astLongOptions[] = +{ + { "help", no_argument, &iShowHelp, IGNORED_OPTION }, + { "version", no_argument, NULL, 'V' }, + { 0, 0, 0, 0 } +}; + +static void vUsage(int iStatus) +{ + if (iStatus != 0) + { + g_printerr(_("Try `%s --help' for more information.\n"), csProgramName); + } + else + { + g_print(_("Usage: %s [option ...] [file]\n"), csProgramName); + g_print(_("\ +\n\ +Options:\n\ + --help Output this help.\n\ + -V, --version Output version information.\n\ +")); + } + + exit(iStatus); +} + +static void vSetDefaultWindowIcon() +{ + const guint8 * apuiInlinePixbuf[] = + { + stock_vba_wm_16, + stock_vba_wm_32, + stock_vba_wm_48, + stock_vba_wm_64 + }; + + std::list > listPixbuf; + for (guint i = 0; i < G_N_ELEMENTS(apuiInlinePixbuf); i++) + { + listPixbuf.push_back( + Gdk::Pixbuf::create_from_inline(-1, apuiInlinePixbuf[i])); + } + + Gtk::Window::set_default_icon_list(listPixbuf); +} + +int main(int argc, char * argv[]) +{ + csProgramName = argv[0]; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); + textdomain(GETTEXT_PACKAGE); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); +#endif // ENABLE_NLS + + Gtk::Main oKit(argc, argv); + + int iOpt; + while ((iOpt = getopt_long(argc, argv, csShortOptions, astLongOptions, NULL)) + != -1) + { + switch (iOpt) + { + case 'V': + iShowVersion = 1; + break; + case 0: + // Long options + break; + default: + vUsage(1); + break; + } + } + + if (iShowVersion) + { + g_print(_("VisualBoyAdvance version %s [GTK+]\n"), VERSION); + exit(0); + } + + if (iShowHelp) + { + vUsage(0); + } + + vSetDefaultWindowIcon(); + + Glib::RefPtr poXml; + try + { + poXml = Xml::create(PKGDATADIR "/vba.glade", "MainWindow"); + } + catch (const Xml::Error & e) + { + Gtk::MessageDialog oDialog(e.what(), +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK); + oDialog.run(); + return 1; + } + + VBA::Window * poWindow = NULL; + poXml->get_widget_derived("MainWindow", poWindow); + + if (optind < argc) + { + // Display the window before loading the file + poWindow->show(); + while (Gtk::Main::events_pending()) + { + Gtk::Main::iteration(); + } + + poWindow->bLoadROM(argv[optind]); + } + + Gtk::Main::run(*poWindow); + delete poWindow; + + return 0; +} diff --git a/src/gtk/menuitem.h b/src/gtk/menuitem.h new file mode 100644 index 0000000..d846458 --- /dev/null +++ b/src/gtk/menuitem.h @@ -0,0 +1,80 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_MENUITEM_H__ +#define __VBA_MENUITEM_H__ + +#include +#include + +#ifdef GTKMM20 +namespace Gtk { typedef Gtk::Menu_Helpers::AccelKey AccelKey; } +#endif // GTKMM20 + +namespace VBA +{ + +class MenuItem : public Gtk::MenuItem +{ +public: + MenuItem() + {} + + MenuItem(Gtk::Widget & _roWidget) : + Gtk::MenuItem(_roWidget) + {} + + MenuItem(const Glib::ustring & _rsLabel, bool _bMnemonic = false) : + Gtk::MenuItem(_rsLabel, _bMnemonic) + {} + + inline void set_accel_key(const Gtk::AccelKey & _roAccelKey) + { + Gtk::MenuItem::set_accel_key(_roAccelKey); + } +}; + +class ImageMenuItem : public Gtk::ImageMenuItem +{ +public: + ImageMenuItem() + {} + + ImageMenuItem(Widget & _roImage, const Glib::ustring & _rsLabel, bool _bMnemonic = false) : + Gtk::ImageMenuItem(_roImage, _rsLabel, _bMnemonic) + {} + + ImageMenuItem(const Glib::ustring & _rsLabel, bool _bMnemonic = false) : + Gtk::ImageMenuItem(_rsLabel, _bMnemonic) + {} + + ImageMenuItem(const Gtk::StockID & _roId) : + Gtk::ImageMenuItem(_roId) + {} + + inline void set_accel_key(const Gtk::AccelKey & _roAccelKey) + { + Gtk::MenuItem::set_accel_key(_roAccelKey); + } +}; + +} // namespace VBA + + +#endif // __VBA_MENUITEM_H__ diff --git a/src/gtk/screenarea.cpp b/src/gtk/screenarea.cpp new file mode 100644 index 0000000..b6d2969 --- /dev/null +++ b/src/gtk/screenarea.cpp @@ -0,0 +1,293 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "screenarea.h" + +#include + +namespace VBA +{ + +ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) : + m_puiPixels(NULL), + m_puiDelta(NULL), + m_vFilter2x(NULL), + m_vFilterIB(NULL), + m_bShowCursor(true) +{ + g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1); + + m_iWidth = _iWidth; + m_iHeight = _iHeight; + m_iScale = _iScale; + vUpdateSize(); + + set_events(Gdk::EXPOSURE_MASK + | Gdk::POINTER_MOTION_MASK + | Gdk::ENTER_NOTIFY_MASK + | Gdk::LEAVE_NOTIFY_MASK); + + char aiEmptyData[8]; + memset(aiEmptyData, 0, sizeof(aiEmptyData)); + Glib::RefPtr poSource = Gdk::Bitmap::create(aiEmptyData, 8, 8); + Glib::RefPtr poMask = Gdk::Bitmap::create(aiEmptyData, 8, 8); + Gdk::Color oFg; + Gdk::Color oBg; + oFg.set_rgb(0, 0, 0); + oBg.set_rgb(0, 0, 0); + + m_poEmptyCursor = new Gdk::Cursor(poSource, poMask, oFg, oBg, 0, 0); +} + +ScreenArea::~ScreenArea() +{ + if (m_puiPixels != NULL) + { + delete[] m_puiPixels; + } + + if (m_puiDelta != NULL) + { + delete[] m_puiDelta; + } + + if (m_poEmptyCursor != NULL) + { + delete m_poEmptyCursor; + } +} + +void ScreenArea::vSetSize(int _iWidth, int _iHeight) +{ + g_return_if_fail(_iWidth >= 1 && _iHeight >= 1); + + if (_iWidth != m_iWidth || _iHeight != m_iHeight) + { + m_iWidth = _iWidth; + m_iHeight = _iHeight; + vUpdateSize(); + } +} + +void ScreenArea::vSetScale(int _iScale) +{ + g_return_if_fail(_iScale >= 1); + + if (_iScale != m_iScale) + { + m_iScale = _iScale; + vUpdateSize(); + } +} + +void ScreenArea::vSetFilter2x(EFilter2x _eFilter2x) +{ + m_vFilter2x = pvGetFilter2x(_eFilter2x, FilterDepth32); +} + +void ScreenArea::vSetFilterIB(EFilterIB _eFilterIB) +{ + m_vFilterIB = pvGetFilterIB(_eFilterIB, FilterDepth32); +} + +void ScreenArea::vDrawPixels(u8 * _puiData) +{ + if (m_vFilterIB != NULL) + { + m_vFilterIB(_puiData + m_iAreaWidth * 2 + 4, + m_iAreaWidth * 2 + 4, + m_iWidth, + m_iHeight); + } + + if (m_iScale == 1) + { + u32 * puiSrc = (u32 *)_puiData + m_iWidth + 1; + u32 * puiPixel = m_puiPixels; + for (int y = 0; y < m_iHeight; y++) + { + for (int x = 0; x < m_iWidth; x++) + { + *puiPixel++ = *puiSrc++; + } + puiSrc++; + } + } + else if (m_iScale == 2 && m_vFilter2x != NULL) + { + m_vFilter2x(_puiData + m_iAreaWidth * 2 + 4, + m_iAreaWidth * 2 + 4, + m_puiDelta, + (u8 *)m_puiPixels, + m_iRowStride, + m_iWidth, + m_iHeight); + } + else + { + u32 * puiSrc = (u32 *)_puiData + m_iWidth + 1; + u32 * puiSrc2; + u32 * puiPixel = m_puiPixels; + for (int y = 0; y < m_iHeight; y++) + { + for (int j = 0; j < m_iScale; j++) + { + puiSrc2 = puiSrc; + for (int x = 0; x < m_iWidth; x++) + { + for (int i = 0; i < m_iScale; i++) + { + *puiPixel++ = *puiSrc2; + } + puiSrc2++; + } + } + puiSrc = puiSrc2 + 1; + } + } + + queue_draw_area(0, 0, m_iAreaWidth, m_iAreaHeight); +} + +void ScreenArea::vDrawColor(u32 _uiColor) +{ + _uiColor = GUINT32_TO_BE(_uiColor) << 8; + + u32 * puiPixel = m_puiPixels; + u32 * puiEnd = m_puiPixels + m_iAreaWidth * m_iAreaHeight; + while (puiPixel != puiEnd) + { + *puiPixel++ = _uiColor; + } + + queue_draw_area(0, 0, m_iAreaWidth, m_iAreaHeight); +} + +void ScreenArea::vUpdateSize() +{ + if (m_puiPixels != NULL) + { + delete[] m_puiPixels; + } + + if (m_puiDelta != NULL) + { + delete[] m_puiDelta; + } + + m_iAreaWidth = m_iScale * m_iWidth; + m_iAreaHeight = m_iScale * m_iHeight; + m_iRowStride = m_iAreaWidth * 4; + + m_puiPixels = new u32[m_iAreaWidth * m_iAreaHeight]; + + m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * 4]; + memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * 4); + + set_size_request(m_iAreaWidth, m_iAreaHeight); +} + +void ScreenArea::vStartCursorTimeout() +{ + m_oCursorSig.disconnect(); + m_oCursorSig = Glib::signal_timeout().connect( + SigC::slot(*this, &ScreenArea::bOnCursorTimeout), + 2000); +} + +void ScreenArea::vStopCursorTimeout() +{ + m_oCursorSig.disconnect(); +} + +void ScreenArea::vHideCursor() +{ + get_window()->set_cursor(*m_poEmptyCursor); + m_bShowCursor = false; +} + +void ScreenArea::vShowCursor() +{ + get_window()->set_cursor(); + m_bShowCursor = true; +} + +bool ScreenArea::on_expose_event(GdkEventExpose * _pstEvent) +{ + if (_pstEvent->area.x + _pstEvent->area.width > m_iAreaWidth + || _pstEvent->area.y + _pstEvent->area.height > m_iAreaHeight) + { + return false; + } + + guchar * puiAreaPixels = (guchar *)m_puiPixels; + + if (_pstEvent->area.x != 0) + { + puiAreaPixels += _pstEvent->area.x << 2; + } + + if (_pstEvent->area.y != 0) + { + puiAreaPixels += _pstEvent->area.y * m_iRowStride; + } + + get_window()->draw_rgb_32_image(get_style()->get_fg_gc(get_state()), + _pstEvent->area.x, + _pstEvent->area.y, + _pstEvent->area.width, + _pstEvent->area.height, + Gdk::RGB_DITHER_MAX, + puiAreaPixels, + m_iRowStride); + return true; +} + +bool ScreenArea::on_motion_notify_event(GdkEventMotion * _pstEvent) +{ + if (! m_bShowCursor) + { + vShowCursor(); + } + vStartCursorTimeout(); + return false; +} + +bool ScreenArea::on_enter_notify_event(GdkEventCrossing * _pstEvent) +{ + vStartCursorTimeout(); + return false; +} + +bool ScreenArea::on_leave_notify_event(GdkEventCrossing * _pstEvent) +{ + vStopCursorTimeout(); + if (! m_bShowCursor) + { + vShowCursor(); + } + return false; +} + +bool ScreenArea::bOnCursorTimeout() +{ + vHideCursor(); + return false; +} + +} // namespace VBA diff --git a/src/gtk/screenarea.h b/src/gtk/screenarea.h new file mode 100644 index 0000000..41662c7 --- /dev/null +++ b/src/gtk/screenarea.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_SCREENAREA_H__ +#define __VBA_SCREENAREA_H__ + +#include +#include + +#ifndef GTKMM20 +# include "sigccompat.h" +#endif // ! GTKMM20 + +#include "filters.h" + +namespace VBA +{ + +class ScreenArea : public Gtk::DrawingArea +{ +public: + ScreenArea(int _iWidth, int _iHeight, int _iScale = 1); + virtual ~ScreenArea(); + + void vSetSize(int _iWidth, int _iHeight); + void vSetScale(int _iScale); + void vSetFilter2x(EFilter2x _eFilter2x); + void vSetFilterIB(EFilterIB _eFilterIB); + void vDrawPixels(u8 * _puiData); + void vDrawColor(u32 _uiColor); // 0xRRGGBB + +protected: + virtual bool on_expose_event(GdkEventExpose * _pstEvent); + virtual bool on_motion_notify_event(GdkEventMotion * _pstEvent); + virtual bool on_enter_notify_event(GdkEventCrossing * _pstEvent); + virtual bool on_leave_notify_event(GdkEventCrossing * _pstEvent); + virtual bool bOnCursorTimeout(); + +private: + int m_iWidth; + int m_iHeight; + int m_iScale; + int m_iAreaWidth; + int m_iAreaHeight; + int m_iRowStride; + u32 * m_puiPixels; + u8 * m_puiDelta; + Filter2x m_vFilter2x; + FilterIB m_vFilterIB; + + bool m_bShowCursor; + Gdk::Cursor * m_poEmptyCursor; + SigC::Connection m_oCursorSig; + + void vUpdateSize(); + void vStartCursorTimeout(); + void vStopCursorTimeout(); + void vHideCursor(); + void vShowCursor(); +}; + +} // namespace VBA + + +#endif // __VBA_SCREENAREA_H__ diff --git a/src/gtk/sigccompat.h b/src/gtk/sigccompat.h new file mode 100644 index 0000000..d640d1d --- /dev/null +++ b/src/gtk/sigccompat.h @@ -0,0 +1,55 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_SIGCCOMPAT_H__ +#define __VBA_SIGCCOMPAT_H__ + +#undef LIBSIGC_DISABLE_DEPRECATED +#include +#include + +#include +#include +#include + +namespace SigC +{ + +template +inline Slot0 +slot( T_obj1& _A_obj, T_return (T_obj2::*_A_func)() ) +{ return ::sigc::bound_mem_functor0 + (dynamic_cast< T_obj1&>(_A_obj), _A_func); } + +template +inline Slot1 +slot( T_obj1& _A_obj, T_return (T_obj2::*_A_func)(T_arg1) ) +{ return ::sigc::bound_mem_functor1 + (dynamic_cast< T_obj1&>(_A_obj), _A_func); } + +template +inline Slot2 +slot( T_obj1& _A_obj, T_return (T_obj2::*_A_func)(T_arg1,T_arg2) ) +{ return ::sigc::bound_mem_functor2 + (dynamic_cast< T_obj1&>(_A_obj), _A_func); } + +} // namespace SigC + + +#endif // __VBA_SIGCCOMPAT_H__ diff --git a/src/gtk/system.cpp b/src/gtk/system.cpp new file mode 100644 index 0000000..888eaf3 --- /dev/null +++ b/src/gtk/system.cpp @@ -0,0 +1,343 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#include +#include + +#include "../GBA.h" +#include "../gb/GB.h" +#include "../gb/gbGlobals.h" +#include "../Util.h" +#include "../Sound.h" + +#include "window.h" +#include "intl.h" + +// Required vars, used by the emulator core +// +int systemRedShift; +int systemGreenShift; +int systemBlueShift; +int systemColorDepth; +int systemDebug; +int systemVerbose; +int systemSaveUpdateCounter; +int systemFrameSkip; +u32 systemColorMap32[0x10000]; +u16 systemColorMap16[0x10000]; +u16 systemGbPalette[24]; +bool systemSoundOn; + +int emulating; +bool debugger; +int RGB_LOW_BITS_MASK; + +// Extra vars, only used for the GUI +// +int systemRenderedFrames; +int systemFPS; + +// Sound stuff +// +const int iSoundSamples = 2048; +const int iSoundTotalLen = iSoundSamples * 4; +static u8 auiSoundBuffer[iSoundTotalLen]; +static int iSoundLen; +static SDL_cond * pstSoundCond; +static SDL_mutex * pstSoundMutex; + +inline VBA::Window * GUI() +{ + return VBA::Window::poGetInstance(); +} + +void systemMessage(int _iId, const char * _csFormat, ...) +{ + va_list args; + va_start(args, _csFormat); + + GUI()->vPopupErrorV(_(_csFormat), args); + + va_end(args); +} + +void systemDrawScreen() +{ + GUI()->vDrawScreen(); + systemRenderedFrames++; +} + +bool systemReadJoypads() +{ + return true; +} + +u32 systemReadJoypad(int,bool) +{ + return GUI()->uiReadJoypad(); +} + +void systemShowSpeed(int _iSpeed) +{ + systemFPS = systemRenderedFrames; + systemRenderedFrames = 0; + + GUI()->vShowSpeed(_iSpeed); +} + +void system10Frames(int _iRate) +{ + GUI()->vComputeFrameskip(_iRate); +} + +void systemFrame() +{ +} + +void systemSetTitle(const char * _csTitle) +{ + GUI()->set_title(_csTitle); +} + +void systemScreenCapture(int _iNum) +{ + GUI()->vCaptureScreen(_iNum); +} + +void systemWriteDataToSoundBuffer() +{ + if (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING) + { + SDL_PauseAudio(0); + } + + bool bWait = true; + while (bWait && ! speedup && GUI()->iGetThrottle() == 0) + { + SDL_mutexP(pstSoundMutex); + if (iSoundLen < iSoundTotalLen) + { + bWait = false; + } + SDL_mutexV(pstSoundMutex); + } + + int iLen = soundBufferLen; + int iCopied = 0; + if (iSoundLen + iLen >= iSoundTotalLen) + { + iCopied = iSoundTotalLen - iSoundLen; + memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, iCopied); + + iSoundLen = iSoundTotalLen; + SDL_CondSignal(pstSoundCond); + + bWait = true; + if (! speedup && GUI()->iGetThrottle() == 0) + { + while(bWait) + { + SDL_mutexP(pstSoundMutex); + if (iSoundLen < iSoundTotalLen) + { + bWait = false; + } + SDL_mutexV(pstSoundMutex); + } + + memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied, + soundBufferLen - iCopied); + + iSoundLen = soundBufferLen - iCopied; + } + else + { + memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied, + soundBufferLen); + } + } + else + { + memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, soundBufferLen); + iSoundLen += soundBufferLen; + } +} + +static void vSoundCallback(void * _pvUserData, u8 * _puiStream, int _iLen) +{ + if (! emulating) + { + return; + } + + SDL_mutexP(pstSoundMutex); + if (! speedup && GUI()->iGetThrottle() == 0) + { + while (iSoundLen < iSoundTotalLen && emulating) + { + SDL_CondWait(pstSoundCond, pstSoundMutex); + } + } + if (emulating) + { + memcpy(_puiStream, auiSoundBuffer, _iLen); + } + iSoundLen = 0; + SDL_mutexV(pstSoundMutex); +} + +bool systemSoundInit() +{ + SDL_AudioSpec stAudio; + + switch (soundQuality) + { + case 1: + stAudio.freq = 44100; + soundBufferLen = 1470 * 2; + break; + case 2: + stAudio.freq = 22050; + soundBufferLen = 736 * 2; + break; + case 4: + stAudio.freq = 11025; + soundBufferLen = 368 * 2; + break; + } + + stAudio.format = AUDIO_S16SYS; + stAudio.channels = 2; + stAudio.samples = iSoundSamples; + stAudio.callback = vSoundCallback; + stAudio.userdata = NULL; + + if (SDL_OpenAudio(&stAudio, NULL) < 0) + { + fprintf(stderr, "Failed to open audio: %s\n", SDL_GetError()); + return false; + } + + pstSoundCond = SDL_CreateCond(); + pstSoundMutex = SDL_CreateMutex(); + + soundBufferTotalLen = soundBufferLen * 10; + iSoundLen = 0; + systemSoundOn = true; + + return true; +} + +void systemSoundShutdown() +{ + SDL_mutexP(pstSoundMutex); + int iSave = emulating; + emulating = 0; + SDL_CondSignal(pstSoundCond); + SDL_mutexV(pstSoundMutex); + + SDL_DestroyCond(pstSoundCond); + pstSoundCond = NULL; + + SDL_DestroyMutex(pstSoundMutex); + pstSoundMutex = NULL; + + SDL_CloseAudio(); + + emulating = iSave; + systemSoundOn = false; +} + +void systemSoundPause() +{ + SDL_PauseAudio(1); +} + +void systemSoundResume() +{ + SDL_PauseAudio(0); +} + +void systemSoundReset() +{ +} + +u32 systemGetClock() +{ + return SDL_GetTicks(); +} + +void systemUpdateMotionSensor() +{ +} + +int systemGetSensorX() +{ + return 0; +} + +int systemGetSensorY() +{ + return 0; +} + +void systemGbPrint(u8 * _puiData, + int _iPages, + int _iFeed, + int _iPalette, + int _iContrast) +{ +} + +void systemScreenMessage(const char * _csMsg, int slot, int duration, const char *colorList) +{ +} + +bool systemCanChangeSoundQuality() +{ + return true; +} + +bool systemPauseOnFrame() +{ + return false; +} + +void systemGbBorderOn() +{ +} + +void debuggerMain() +{ +} + +void debuggerSignal(int, int) +{ +} + +void debuggerOutput(char *, u32) +{ +} + +void (*dbgMain)() = debuggerMain; +void (*dbgSignal)(int, int) = debuggerSignal; +void (*dbgOutput)(char *, u32) = debuggerOutput; diff --git a/src/gtk/tools.cpp b/src/gtk/tools.cpp new file mode 100644 index 0000000..6e1a065 --- /dev/null +++ b/src/gtk/tools.cpp @@ -0,0 +1,65 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "tools.h" + +namespace VBA +{ + +std::string sCutSuffix(const std::string & _rsString, + const std::string & _rsSep) +{ + return _rsString.substr(0, _rsString.find_last_of(_rsSep)); +} + +Glib::ustring sCutSuffix(const Glib::ustring & _rsString, + const Glib::ustring & _rsSep) +{ + return _rsString.substr(0, _rsString.find_last_of(_rsSep)); +} + +bool bHasSuffix(const Glib::ustring & _rsString, + const Glib::ustring & _rsSuffix, + bool _bCaseSensitive) +{ + if (_rsSuffix.size() > _rsString.size()) + { + return false; + } + + Glib::ustring sEnd = _rsString.substr(_rsString.size() - _rsSuffix.size()); + + if (_bCaseSensitive) + { + if (_rsSuffix == sEnd) + { + return true; + } + } + else + { + if (_rsSuffix.lowercase() == sEnd.lowercase()) + { + return true; + } + } + + return false; +} + +} // namespace VBA diff --git a/src/gtk/tools.h b/src/gtk/tools.h new file mode 100644 index 0000000..6dca228 --- /dev/null +++ b/src/gtk/tools.h @@ -0,0 +1,42 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_TOOLS_H__ +#define __VBA_TOOLS_H__ + +#include +#include + +namespace VBA +{ + +std::string sCutSuffix(const std::string & _rsString, + const std::string & _rsSep = "."); + +Glib::ustring sCutSuffix(const Glib::ustring & _rsString, + const Glib::ustring & _rsSep = "."); + +bool bHasSuffix(const Glib::ustring & _rsString, + const Glib::ustring & _rsSuffix, + bool _bCaseSensitive = true); + +} + + +#endif // __VBA_TOOLS_H__ diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade new file mode 100644 index 0000000..ca1cc8a --- /dev/null +++ b/src/gtk/vba.glade @@ -0,0 +1,3597 @@ + + + + + + + VBA + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + + + + True + False + 0 + + + + True + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + + + True + + + + True + _File + True + + + + + + + True + _Open... + True + + + + + True + gtk-open + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + True + + + + + + True + _Load... + True + + + + + + + True + _Save... + True + + + + + + + True + Loa_d game + True + + + + + + + True + Most recent + True + + + + + + True + Auto load most recent + True + False + + + + + + True + + + + + + True + Slot1 + True + + + + + + + True + Slot2 + True + + + + + + + True + Slot3 + True + + + + + + + True + Slot4 + True + + + + + + + True + Slot5 + True + + + + + + + True + Slot6 + True + + + + + + + True + Slot7 + True + + + + + + + True + Slot8 + True + + + + + + + True + Slot9 + True + + + + + + + True + Slot10 + True + + + + + + + + + + + True + S_ave game + True + + + + + + + True + Oldest slot + True + + + + + + True + + + + + + True + Slot1 + True + + + + + + + True + Slot2 + True + + + + + + + True + Slot3 + True + + + + + + + True + Slot4 + True + + + + + + + True + Slot5 + True + + + + + + + True + Slot6 + True + + + + + + + True + Slot7 + True + + + + + + + True + Slot8 + True + + + + + + + True + Slot9 + True + + + + + + + True + Slot10 + True + + + + + + + + + + + True + + + + + + True + _Pause + True + False + + + + + + + True + _Reset + True + + + + + + + True + + + + + + True + Rece_nt + True + + + + + + + True + _Reset + True + + + + + + True + _Freeze + True + False + + + + + + True + + + + + + + + + + True + + + + + + True + _Import + True + + + + + + + True + _Battery file... + True + + + + + + + + + + True + E_xport + True + + + + + + + True + _Battery file... + True + + + + + + + + + + True + + + + + + True + Screen capt_ure... + True + + + + + + True + + + + + + True + _Close + True + + + + True + gtk-close + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + True + _Exit + True + + + + + True + gtk-quit + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + + + + + True + _Options + True + + + + + + + True + _Frameskip + True + + + + + + + True + _Throttle + True + + + + + + + True + _No throttle + True + True + + + + + + True + 25% + True + False + ThrottleNoThrottle + + + + + + True + 50% + True + False + ThrottleNoThrottle + + + + + + True + 100% + True + False + ThrottleNoThrottle + + + + + + True + 150% + True + False + ThrottleNoThrottle + + + + + + True + 200% + True + False + ThrottleNoThrottle + + + + + + True + _Other... + True + False + ThrottleNoThrottle + + + + + + + + + + True + + + + + + True + _Automatic + True + True + + + + + + True + _0 + True + False + FrameskipAutomatic + + + + + + True + _1 + True + False + FrameskipAutomatic + + + + + + True + _2 + True + False + FrameskipAutomatic + + + + + + True + _3 + True + False + FrameskipAutomatic + + + + + + True + _4 + True + False + FrameskipAutomatic + + + + + + True + _5 + True + False + FrameskipAutomatic + + + + + + True + _6 + True + False + FrameskipAutomatic + + + + + + True + _7 + True + False + FrameskipAutomatic + + + + + + True + _8 + True + False + FrameskipAutomatic + + + + + + True + _9 + True + False + FrameskipAutomatic + + + + + + + + + + True + _Video + True + + + + + + + True + _1x + True + True + + + + + + True + _2x + True + False + Video1x + + + + + + True + _3x + True + False + Video1x + + + + + + True + _4x + True + False + Video1x + + + + + + True + _5x + True + False + Video1x + + + + + + True + _6x + True + False + Video1x + + + + + + True + + + + + + True + _Layers + True + + + + + + + True + BG0 + True + False + + + + + + + True + BG1 + True + False + + + + + + + True + BG2 + True + False + + + + + + + True + BG3 + True + False + + + + + + + True + OBJ + True + False + + + + + + + True + WIN0 + True + False + + + + + + + True + WIN1 + True + False + + + + + + + True + OBJWIN + True + False + + + + + + + + + + + + + + + True + _Emulator + True + + + + + + + True + Directories... + True + + + + + + True + Pause when inactive window + True + False + + + + + + True + Show speed + True + + + + + + + True + None + True + True + + + + + + True + Percentage + True + False + ShowSpeedNone + + + + + + True + Detailed + True + False + ShowSpeedNone + + + + + + + + + + True + Save type + True + + + + + + + True + _Automatic + True + True + + + + + + True + EEPROM + True + False + SaveTypeAutomatic + + + + + + True + SRAM + True + False + SaveTypeAutomatic + + + + + + True + Flash + True + False + SaveTypeAutomatic + + + + + + True + EEPROM+Sensor + True + False + SaveTypeAutomatic + + + + + + True + None + True + False + SaveTypeAutomatic + + + + + + True + + + + + + True + Flash 64K + True + True + + + + + + True + Flash 128K + True + False + SaveTypeFlash64K + + + + + + + + + + True + + + + + + True + _Select BIOS file... + True + + + + + + True + _Use BIOS file + True + False + + + + + + True + + + + + + True + Screenshot format + True + + + + + + + True + _PNG + True + True + + + + + + True + _BMP + True + False + ScreenshotFormatPNG + + + + + + + + + + + + + + True + _Sound + True + + + + + + + True + O_ff + True + True + + + + + + True + _Mute + True + False + SoundOff + + + + + + True + _On + True + False + SoundOff + + + + + + True + + + + + + True + Echo + True + False + + + + + + True + Low pass filter + True + False + + + + + + True + Reverse stereo + True + False + + + + + + True + + + + + + True + Channel _1 + True + False + + + + + + True + Channel _2 + True + False + + + + + + True + Channel _3 + True + False + + + + + + True + Channel _4 + True + False + + + + + + True + Channel _A + True + False + + + + + + True + Channel _B + True + False + + + + + + True + + + + + + True + 11 _Khz + True + True + + + + + + True + 22 K_hz + True + False + Sound11Khz + + + + + + True + 44 Kh_z + True + False + Sound11Khz + + + + + + True + + + + + + True + _Volume + True + + + + + + + True + 25% + True + True + + + + + + True + 50% + True + False + Volume25 + + + + + + True + 100% + True + False + Volume25 + + + + + + True + 200% + True + False + Volume25 + + + + + + True + 300% + True + False + Volume25 + + + + + + True + 400% + True + False + Volume25 + + + + + + + + + + + + + + True + _Gameboy + True + + + + + + + True + _Border + True + False + + + + + + True + _Printer + True + False + + + + + + True + + + + + + True + _Automatic + True + True + + + + + + True + _GBA + True + False + GameboyAutomatic + + + + + + True + _CGB/GBC + True + False + GameboyAutomatic + + + + + + True + _SGB + True + False + GameboyAutomatic + + + + + + True + SGB_2 + True + False + GameboyAutomatic + + + + + + True + G_B + True + False + GameboyAutomatic + + + + + + + + + + True + F_ilter + True + + + + + + + True + Interframe _blending + True + + + + + + + True + _None + True + True + + + + + + True + _Smart + True + False + IFBNone + + + + + + True + _Motion Blur + True + False + IFBNone + + + + + + + + + + True + + + + + + True + _None + True + True + + + + + + True + _TV Mode + True + False + FilterNone + + + + + + True + _2xSaI + True + False + FilterNone + + + + + + True + _Super 2xSaI + True + False + FilterNone + + + + + + True + Super _Eagle + True + False + FilterNone + + + + + + True + _Pixelate + True + False + FilterNone + + + + + + True + _Motion Blur + True + False + FilterNone + + + + + + True + _AdvanceMAME 2x + True + False + FilterNone + + + + + + True + S_imple 2x + True + False + FilterNone + + + + + + True + Bilinea_r + True + False + FilterNone + + + + + + True + Bilinear Pl_us + True + False + FilterNone + + + + + + True + S_canlines + True + False + FilterNone + + + + + + True + h_q2x + True + False + FilterNone + + + + + + True + _lq2x + True + False + FilterNone + + + + + + True + + + + + + True + _Disable MMX + True + False + + + + + + + + + + True + _Joypad + True + + + + + + + True + _Configure + True + + + + + + + True + _1... + True + + + + + + True + _2... + True + + + + + + True + _3... + True + + + + + + True + _4... + True + + + + + + + + + + True + + + + + + True + _1 + True + True + + + + + + True + _2 + True + False + Joypad1 + + + + + + True + _3 + True + False + Joypad1 + + + + + + True + _4 + True + False + Joypad1 + + + + + + True + + + + + + True + _Autofire + True + + + + + + + True + _A + True + False + + + + + + + True + _B + True + False + + + + + + + True + _L + True + False + + + + + + + True + _R + True + False + + + + + + + + + + + + + + + + + + + True + _Tools + True + + + + + + + True + _GDB + True + + + + + + + True + _Wait connection... + True + + + + + + True + _Load and wait... + True + + + + + + True + _Break + True + + + + + + True + _Disconnect + True + + + + + + + + + + + + + + True + _Help + True + + + + + + + True + _About + True + + + + + + + + + + + 0 + False + True + + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + + + 0 + True + True + + + + + + + + About VBA + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + + + 0 + True + True + + + + + + True + True + + False + True + GTK_JUSTIFY_CENTER + False + True + 0.5 + 0.5 + 5 + 5 + + + 0 + True + False + + + + + + True + True + An emulator for Gameboy(TM) and GameboyAdvance(TM). + False + False + GTK_JUSTIFY_CENTER + True + True + 0.5 + 0.5 + 5 + 5 + + + 0 + True + False + + + + + + True + True + <i>Special thanks to Yann Parmentier aka "kohai" for the icons.</i> + False + True + GTK_JUSTIFY_LEFT + False + True + 0.5 + 0.5 + 5 + 5 + + + 0 + True + False + + + + + + True + True + <small>Copyright (C) 2004 Forgotten and the VBA development team</small> + False + True + GTK_JUSTIFY_CENTER + True + True + 0.5 + 0.5 + 5 + 5 + + + 0 + True + False + + + + + + + + Throttle + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 0 + + + + True + Throttle : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + True + 100 5 1000 1 25 25 + + + 0 + True + True + + + + + + True + % + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + + 0 + True + True + + + + + + + + Directories + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 5 + 4 + False + 0 + 0 + + + + True + GBA roms : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 0 + 1 + fill + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 3 + 4 + 0 + 1 + fill + expand + + + + + + True + GB roms : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 3 + 4 + 1 + 2 + fill + expand + + + + + + True + Batteries : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 3 + 4 + 2 + 3 + fill + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 2 + 3 + fill + expand + + + + + + True + Saves : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 3 + 4 + fill + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 3 + 4 + fill + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 3 + 4 + 3 + 4 + fill + expand + + + + + + True + Captures : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 4 + 5 + fill + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 4 + 5 + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 4 + 5 + fill + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 3 + 4 + 4 + 5 + fill + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + expand + + + + + + True + True + GTK_RELIEF_NONE + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 1 + 2 + fill + expand + + + + + 0 + True + True + + + + + + + + Joypad config + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 0.5 + 0.5 + 0 + 1 + + + + True + 12 + 2 + False + 5 + 0 + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + fill + expand + + + + + + True + Down : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + expand + + + + + + True + Left : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + expand + + + + + + True + Right : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 3 + 4 + fill + expand + + + + + + True + Button A : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 4 + 5 + fill + expand + + + + + + True + Button B : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 5 + 6 + fill + expand + + + + + + True + Button L : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 6 + 7 + fill + expand + + + + + + True + Button R : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 7 + 8 + fill + expand + + + + + + True + Select : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 8 + 9 + fill + expand + + + + + + True + Start : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 9 + 10 + fill + expand + + + + + + True + Speed : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 10 + 11 + fill + expand + + + + + + True + Capture : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 11 + 12 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 4 + 5 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 5 + 6 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 6 + 7 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 7 + 8 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 8 + 9 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 9 + 10 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 10 + 11 + fill + expand + + + + + + True + True + False + True + 0 + + True + * + False + + + 1 + 2 + 11 + 12 + fill + expand + + + + + + True + Up : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + expand + + + + + + + 0 + True + True + + + + + + + + TCP port + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + True + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 0 + + + + True + Port : + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + True + 55555 1 65535 1 100 100 + + + 0 + True + True + + + + + + + 0 + True + True + + + + + + + diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp new file mode 100644 index 0000000..9fa2b24 --- /dev/null +++ b/src/gtk/window.cpp @@ -0,0 +1,1942 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "window.h" + +#include + +#include +#include + +#include + +#include "../GBA.h" +#include "../gb/GB.h" +#include "../gb/gbGlobals.h" +#include "../gb/gbPrinter.h" +#include "../Sound.h" +#include "../Util.h" + +#include "menuitem.h" +#include "tools.h" +#include "intl.h" + +extern int systemRenderedFrames; +extern int systemFPS; +extern bool debugger; +extern int RGB_LOW_BITS_MASK; +extern void (*dbgMain)(); +extern void (*dbgSignal)(int, int); +extern void (*dbgOutput)(char *, u32); +extern void remoteInit(); +extern void remoteCleanUp(); +extern void remoteStubMain(); +extern void remoteStubSignal(int, int); +extern void remoteOutput(char *, u32); +extern void remoteSetProtocol(int); +extern void remoteSetPort(int); + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif // MMX + +namespace VBA +{ + +using Gnome::Glade::Xml; + +Window * Window::m_poInstance = NULL; + +Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : + Gtk::Window (_pstWindow), + m_iGBScreenWidth (160), + m_iGBScreenHeight (144), + m_iSGBScreenWidth (256), + m_iSGBScreenHeight(224), + m_iGBAScreenWidth (240), + m_iGBAScreenHeight(160), + m_iFrameskipMin (0), + m_iFrameskipMax (9), + m_iThrottleMin (5), + m_iThrottleMax (1000), + m_iScaleMin (1), + m_iScaleMax (6), + m_iShowSpeedMin (ShowNone), + m_iShowSpeedMax (ShowDetailed), + m_iSaveTypeMin (SaveAuto), + m_iSaveTypeMax (SaveNone), + m_iSoundQualityMin(Sound44K), + m_iSoundQualityMax(Sound11K), + m_iSoundVolumeMin (Sound100), + m_iSoundVolumeMax (Sound50), + m_iEmulatorTypeMin(EmulatorAuto), + m_iEmulatorTypeMax(EmulatorSGB2), + m_iFilter2xMin (FirstFilter), + m_iFilter2xMax (LastFilter), + m_iFilterIBMin (FirstFilterIB), + m_iFilterIBMax (LastFilterIB), + m_iJoypadMin (1), + m_iJoypadMax (4) +{ + m_poXml = _poXml; + m_poFileOpenDialog = NULL; + m_iScreenWidth = m_iGBAScreenWidth; + m_iScreenHeight = m_iGBAScreenHeight; + m_eCartridge = CartridgeNone; + m_uiJoypadState = 0; + + vInitSystem(); + vInitSDL(); + + Gtk::Container * poC; + poC = dynamic_cast(_poXml->get_widget("ScreenContainer")); + m_poScreenArea = Gtk::manage(new ScreenArea(m_iScreenWidth, m_iScreenHeight)); + poC->add(*m_poScreenArea); + vDrawDefaultScreen(); + m_poScreenArea->show(); + + // Get config + // + vInitConfig(); + + m_sUserDataDir = Glib::get_home_dir() + "/.gvba"; + m_sConfigFile = m_sUserDataDir + "/config"; + + if (! Glib::file_test(m_sUserDataDir, Glib::FILE_TEST_EXISTS)) + { + mkdir(m_sUserDataDir.c_str(), 0777); + } + if (Glib::file_test(m_sConfigFile, Glib::FILE_TEST_EXISTS)) + { + vLoadConfig(m_sConfigFile); + vCheckConfig(); + } + else + { + vSaveConfig(m_sConfigFile); + } + + vCreateFileOpenDialog(); + vLoadHistoryFromConfig(); + vLoadJoypadsFromConfig(); + + Gtk::MenuItem * poMI; + Gtk::CheckMenuItem * poCMI; + + // File menu + // + poMI = dynamic_cast(_poXml->get_widget("FileOpen")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileOpen)); + + poMI = dynamic_cast(_poXml->get_widget("FileLoad")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileLoad)); + m_listSensitiveWhenPlaying.push_back(poMI); + + poMI = dynamic_cast(_poXml->get_widget("FileSave")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileSave)); + m_listSensitiveWhenPlaying.push_back(poMI); + + for (int i = 0; i < 10; i++) + { + char csName[20]; + snprintf(csName, 20, "LoadGameSlot%d", i + 1); + m_apoLoadGameItem[i] = dynamic_cast(_poXml->get_widget(csName)); + snprintf(csName, 20, "SaveGameSlot%d", i + 1); + m_apoSaveGameItem[i] = dynamic_cast(_poXml->get_widget(csName)); + + m_apoLoadGameItem[i]->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnLoadGame), + i + 1)); + m_apoSaveGameItem[i]->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSaveGame), + i + 1)); + } + vUpdateGameSlots(); + + poMI = dynamic_cast(_poXml->get_widget("LoadGameMostRecent")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnLoadGameMostRecent)); + m_listSensitiveWhenPlaying.push_back(poMI); + + poCMI = dynamic_cast(_poXml->get_widget("LoadGameAuto")); + poCMI->set_active(m_poCoreConfig->oGetKey("load_game_auto")); + vOnLoadGameAutoToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnLoadGameAutoToggled), + poCMI)); + + poMI = dynamic_cast(_poXml->get_widget("SaveGameOldest")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnSaveGameOldest)); + m_listSensitiveWhenPlaying.push_back(poMI); + + m_poFilePauseItem = dynamic_cast(_poXml->get_widget("FilePause")); + m_poFilePauseItem->set_active(false); + vOnFilePauseToggled(m_poFilePauseItem); + m_poFilePauseItem->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnFilePauseToggled), + m_poFilePauseItem)); + m_listSensitiveWhenPlaying.push_back(m_poFilePauseItem); + + poMI = dynamic_cast(_poXml->get_widget("FileReset")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileReset)); + m_listSensitiveWhenPlaying.push_back(poMI); + + poMI = dynamic_cast(_poXml->get_widget("FileScreenCapture")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileScreenCapture)); + m_listSensitiveWhenPlaying.push_back(poMI); + + poMI = dynamic_cast(_poXml->get_widget("FileClose")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileClose)); + m_listSensitiveWhenPlaying.push_back(poMI); + + poMI = dynamic_cast(_poXml->get_widget("FileExit")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnFileExit)); + + // Recent menu + // + m_poRecentMenu = dynamic_cast(_poXml->get_widget("RecentMenu_menu")); + vUpdateHistoryMenu(); + + m_poRecentResetItem = dynamic_cast(_poXml->get_widget("RecentReset")); + m_poRecentResetItem->signal_activate().connect(SigC::slot(*this, &Window::vOnRecentReset)); + + poCMI = dynamic_cast(_poXml->get_widget("RecentFreeze")); + poCMI->set_active(m_poHistoryConfig->oGetKey("freeze")); + vOnRecentFreezeToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnRecentFreezeToggled), + poCMI)); + + // Import menu + // + poMI = dynamic_cast(_poXml->get_widget("ImportBatteryFile")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnImportBatteryFile)); + m_listSensitiveWhenPlaying.push_back(poMI); + + // Export menu + // + poMI = dynamic_cast(_poXml->get_widget("ExportBatteryFile")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnExportBatteryFile)); + m_listSensitiveWhenPlaying.push_back(poMI); + + // Frameskip menu + // + struct + { + const char * m_csName; + const int m_iFrameskip; + } + astFrameskip[] = + { + { "FrameskipAutomatic", -1 }, + { "Frameskip0", 0 }, + { "Frameskip1", 1 }, + { "Frameskip2", 2 }, + { "Frameskip3", 3 }, + { "Frameskip4", 4 }, + { "Frameskip5", 5 }, + { "Frameskip6", 6 }, + { "Frameskip7", 7 }, + { "Frameskip8", 8 }, + { "Frameskip9", 9 } + }; + int iDefaultFrameskip; + if (m_poCoreConfig->sGetKey("frameskip") == "auto") + { + iDefaultFrameskip = -1; + } + else + { + iDefaultFrameskip = m_poCoreConfig->oGetKey("frameskip"); + } + for (guint i = 0; i < G_N_ELEMENTS(astFrameskip); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astFrameskip[i].m_csName)); + if (astFrameskip[i].m_iFrameskip == iDefaultFrameskip) + { + poCMI->set_active(); + vOnFrameskipToggled(poCMI, iDefaultFrameskip); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnFrameskipToggled), + poCMI, astFrameskip[i].m_iFrameskip)); + } + + // Throttle menu + // + struct + { + const char * m_csName; + const int m_iThrottle; + } + astThrottle[] = + { + { "ThrottleNoThrottle", 0 }, + { "Throttle25", 25 }, + { "Throttle50", 50 }, + { "Throttle100", 100 }, + { "Throttle150", 150 }, + { "Throttle200", 200 } + }; + poCMI = dynamic_cast(_poXml->get_widget("ThrottleOther")); + poCMI->set_active(); + poCMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnThrottleOther), + poCMI)); + + int iDefaultThrottle = m_poCoreConfig->oGetKey("throttle"); + for (guint i = 0; i < G_N_ELEMENTS(astThrottle); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astThrottle[i].m_csName)); + if (astThrottle[i].m_iThrottle == iDefaultThrottle) + { + poCMI->set_active(); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnThrottleToggled), + poCMI, astThrottle[i].m_iThrottle)); + } + vSetThrottle(iDefaultThrottle); + + // Video menu + // + struct + { + const char * m_csName; + const int m_iScale; + } + astVideoScale[] = + { + { "Video1x", 1 }, + { "Video2x", 2 }, + { "Video3x", 3 }, + { "Video4x", 4 }, + { "Video5x", 5 }, + { "Video6x", 6 } + }; + int iDefaultScale = m_poDisplayConfig->oGetKey("scale"); + for (guint i = 0; i < G_N_ELEMENTS(astVideoScale); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astVideoScale[i].m_csName)); + if (astVideoScale[i].m_iScale == iDefaultScale) + { + poCMI->set_active(); + vOnVideoScaleToggled(poCMI, iDefaultScale); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnVideoScaleToggled), + poCMI, astVideoScale[i].m_iScale)); + } + + // Layers menu + // + struct + { + const char * m_csName; + const char * m_csKey; + const int m_iLayer; + } + astLayer[] = + { + { "LayersBg0", "layer_bg0", 0 }, + { "LayersBg1", "layer_bg1", 1 }, + { "LayersBg2", "layer_bg2", 2 }, + { "LayersBg3", "layer_bg3", 3 }, + { "LayersObj", "layer_obj", 4 }, + { "LayersWin0", "layer_win0", 5 }, + { "LayersWin1", "layer_win1", 6 }, + { "LayersObjWin", "layer_objwin", 7 } + }; + for (guint i = 0; i < G_N_ELEMENTS(astLayer); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astLayer[i].m_csName)); + poCMI->set_active(m_poCoreConfig->oGetKey(astLayer[i].m_csKey)); + vOnLayerToggled(poCMI, astLayer[i].m_iLayer); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnLayerToggled), + poCMI, astLayer[i].m_iLayer)); + } + + // Emulator menu + // + poMI = dynamic_cast(_poXml->get_widget("EmulatorDirectories")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnDirectories)); + + poCMI = dynamic_cast(_poXml->get_widget("EmulatorPauseWhenInactive")); + poCMI->set_active(m_poDisplayConfig->oGetKey("pause_when_inactive")); + vOnPauseWhenInactiveToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnPauseWhenInactiveToggled), + poCMI)); + + m_poUseBiosItem = dynamic_cast(_poXml->get_widget("EmulatorUseBios")); + m_poUseBiosItem->set_active(m_poCoreConfig->oGetKey("use_bios_file")); + if (m_poCoreConfig->sGetKey("bios_file") == "") + { + m_poUseBiosItem->set_sensitive(false); + } + m_poUseBiosItem->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnUseBiosToggled), + m_poUseBiosItem)); + + poMI = dynamic_cast(_poXml->get_widget("EmulatorSelectBios")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnSelectBios)); + + // Show speed menu + // + struct + { + const char * m_csName; + const EShowSpeed m_eShowSpeed; + } + astShowSpeed[] = + { + { "ShowSpeedNone", ShowNone }, + { "ShowSpeedPercentage", ShowPercentage }, + { "ShowSpeedDetailed", ShowDetailed } + }; + EShowSpeed eDefaultShowSpeed = (EShowSpeed)m_poDisplayConfig->oGetKey("show_speed"); + for (guint i = 0; i < G_N_ELEMENTS(astShowSpeed); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astShowSpeed[i].m_csName)); + if (astShowSpeed[i].m_eShowSpeed == eDefaultShowSpeed) + { + poCMI->set_active(); + vOnShowSpeedToggled(poCMI, eDefaultShowSpeed); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnShowSpeedToggled), + poCMI, astShowSpeed[i].m_eShowSpeed)); + } + + // Save type menu + // + struct + { + const char * m_csName; + const ESaveType m_eSaveType; + } + astSaveType[] = + { + { "SaveTypeAutomatic", SaveAuto }, + { "SaveTypeEeprom", SaveEEPROM }, + { "SaveTypeSram", SaveSRAM }, + { "SaveTypeFlash", SaveFlash }, + { "SaveTypeEepromSensor", SaveEEPROMSensor }, + { "SaveTypeNone", SaveNone } + }; + ESaveType eDefaultSaveType = (ESaveType)m_poCoreConfig->oGetKey("save_type"); + for (guint i = 0; i < G_N_ELEMENTS(astSaveType); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astSaveType[i].m_csName)); + if (astSaveType[i].m_eSaveType == eDefaultSaveType) + { + poCMI->set_active(); + vOnSaveTypeToggled(poCMI, eDefaultSaveType); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSaveTypeToggled), + poCMI, astSaveType[i].m_eSaveType)); + } + + // Flash size menu + // + struct + { + const char * m_csName; + const int m_iFlashSize; + } + astFlashSize[] = + { + { "SaveTypeFlash64K", 64 }, + { "SaveTypeFlash128K", 128 } + }; + int iDefaultFlashSize = m_poCoreConfig->oGetKey("flash_size"); + for (guint i = 0; i < G_N_ELEMENTS(astFlashSize); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astFlashSize[i].m_csName)); + if (astFlashSize[i].m_iFlashSize == iDefaultFlashSize) + { + poCMI->set_active(); + vOnFlashSizeToggled(poCMI, iDefaultFlashSize); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnFlashSizeToggled), + poCMI, astFlashSize[i].m_iFlashSize)); + } + + // Screenshot format menu + // + struct + { + const char * m_csName; + const char * m_csScreenshotFormat; + } + astScreenshotFormat[] = + { + { "ScreenshotFormatPNG", "png" }, + { "ScreenshotFormatBMP", "bmp" } + }; + std::string sDefaultScreenshotFormat = m_poCoreConfig->sGetKey("screenshot_format"); + for (guint i = 0; i < G_N_ELEMENTS(astScreenshotFormat); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astScreenshotFormat[i].m_csName)); + if (astScreenshotFormat[i].m_csScreenshotFormat == sDefaultScreenshotFormat) + { + poCMI->set_active(); + vOnScreenshotFormatToggled(poCMI, sDefaultScreenshotFormat); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnScreenshotFormatToggled), + poCMI, std::string(astScreenshotFormat[i].m_csScreenshotFormat))); + } + + // Sound menu + // + std::string sDefaultSoundStatus = m_poSoundConfig->sGetKey("status"); + + poCMI = dynamic_cast(_poXml->get_widget("SoundOff")); + if (sDefaultSoundStatus == "off") + { + poCMI->set_active(); + vOnSoundStatusToggled(poCMI, SoundOff); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundStatusToggled), + poCMI, SoundOff)); + m_poSoundOffItem = poCMI; + + poCMI = dynamic_cast(_poXml->get_widget("SoundMute")); + if (sDefaultSoundStatus == "mute") + { + poCMI->set_active(); + vOnSoundStatusToggled(poCMI, SoundMute); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundStatusToggled), + poCMI, SoundMute)); + + poCMI = dynamic_cast(_poXml->get_widget("SoundOn")); + if (sDefaultSoundStatus == "on") + { + poCMI->set_active(); + vOnSoundStatusToggled(poCMI, SoundOn); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundStatusToggled), + poCMI, SoundOn)); + + poCMI = dynamic_cast(_poXml->get_widget("SoundEcho")); + poCMI->set_active(m_poSoundConfig->oGetKey("echo")); + vOnSoundEchoToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundEchoToggled), + poCMI)); + + poCMI = dynamic_cast(_poXml->get_widget("SoundLowPass")); + poCMI->set_active(m_poSoundConfig->oGetKey("low_pass")); + vOnSoundLowPassToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundLowPassToggled), + poCMI)); + + poCMI = dynamic_cast(_poXml->get_widget("SoundReverseStereo")); + poCMI->set_active(m_poSoundConfig->oGetKey("reverse_stereo")); + vOnSoundReverseToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundReverseToggled), + poCMI)); + + struct + { + const char * m_csName; + const char * m_csKey; + const int m_iSoundChannel; + } + astSoundChannel[] = + { + { "SoundChannel1", "channel_1", 0 }, + { "SoundChannel2", "channel_2", 1 }, + { "SoundChannel3", "channel_3", 2 }, + { "SoundChannel4", "channel_4", 3 }, + { "SoundChannelA", "channel_A", 4 }, + { "SoundChannelB", "channel_B", 5 } + }; + for (guint i = 0; i < G_N_ELEMENTS(astSoundChannel); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astSoundChannel[i].m_csName)); + poCMI->set_active(m_poSoundConfig->oGetKey(astSoundChannel[i].m_csKey)); + vOnSoundChannelToggled(poCMI, astSoundChannel[i].m_iSoundChannel); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundChannelToggled), + poCMI, astSoundChannel[i].m_iSoundChannel)); + } + + struct + { + const char * m_csName; + const ESoundQuality m_eSoundQuality; + } + astSoundQuality[] = + { + { "Sound11Khz", Sound11K }, + { "Sound22Khz", Sound22K }, + { "Sound44Khz", Sound44K } + }; + ESoundQuality eDefaultSoundQuality = (ESoundQuality)m_poSoundConfig->oGetKey("quality"); + for (guint i = 0; i < G_N_ELEMENTS(astSoundQuality); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astSoundQuality[i].m_csName)); + if (astSoundQuality[i].m_eSoundQuality == eDefaultSoundQuality) + { + poCMI->set_active(); + vOnSoundQualityToggled(poCMI, eDefaultSoundQuality); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundQualityToggled), + poCMI, astSoundQuality[i].m_eSoundQuality)); + } + + // Volume menu + // + struct + { + const char * m_csName; + const ESoundVolume m_eSoundVolume; + } + astSoundVolume[] = + { + { "Volume25", Sound25 }, + { "Volume50", Sound50 }, + { "Volume100", Sound100 }, + { "Volume200", Sound200 }, + { "Volume300", Sound300 }, + { "Volume400", Sound400 } + }; + ESoundVolume eDefaultSoundVolume = (ESoundVolume)m_poSoundConfig->oGetKey("volume"); + for (guint i = 0; i < G_N_ELEMENTS(astSoundVolume); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astSoundVolume[i].m_csName)); + if (astSoundVolume[i].m_eSoundVolume == eDefaultSoundVolume) + { + poCMI->set_active(); + vOnSoundVolumeToggled(poCMI, eDefaultSoundVolume); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnSoundVolumeToggled), + poCMI, astSoundVolume[i].m_eSoundVolume)); + } + + // Gameboy menu + // + poCMI = dynamic_cast(_poXml->get_widget("GameboyBorder")); + poCMI->set_active(m_poCoreConfig->oGetKey("gb_border")); + vOnGBBorderToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnGBBorderToggled), + poCMI)); + + poCMI = dynamic_cast(_poXml->get_widget("GameboyPrinter")); + poCMI->set_active(m_poCoreConfig->oGetKey("gb_printer")); + vOnGBPrinterToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnGBPrinterToggled), + poCMI)); + + struct + { + const char * m_csName; + const EEmulatorType m_eEmulatorType; + } + astEmulatorType[] = + { + { "GameboyAutomatic", EmulatorAuto }, + { "GameboyGba", EmulatorGBA }, + { "GameboyCgb", EmulatorCGB }, + { "GameboySgb", EmulatorSGB }, + { "GameboySgb2", EmulatorSGB2 }, + { "GameboyGb", EmulatorGB } + }; + EEmulatorType eDefaultEmulatorType = (EEmulatorType)m_poCoreConfig->oGetKey("emulator_type"); + for (guint i = 0; i < G_N_ELEMENTS(astEmulatorType); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astEmulatorType[i].m_csName)); + if (astEmulatorType[i].m_eEmulatorType == eDefaultEmulatorType) + { + poCMI->set_active(); + vOnEmulatorTypeToggled(poCMI, eDefaultEmulatorType); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnEmulatorTypeToggled), + poCMI, astEmulatorType[i].m_eEmulatorType)); + } + + // Filter menu + // + struct + { + const char * m_csName; + const EFilter2x m_eFilter2x; + } + astFilter2x[] = + { + { "FilterNone", FilterNone }, + { "FilterTVMode", FilterScanlinesTV }, + { "Filter2xSaI", Filter2xSaI }, + { "FilterSuper2xSaI", FilterSuper2xSaI }, + { "FilterSuperEagle", FilterSuperEagle }, + { "FilterPixelate", FilterPixelate }, + { "FilterMotionBlur", FilterMotionBlur }, + { "FilterAdvanceMame2x", FilterAdMame2x }, + { "FilterSimple2x", FilterSimple2x }, + { "FilterBilinear", FilterBilinear }, + { "FilterBilinearPlus", FilterBilinearPlus }, + { "FilterScanlines", FilterScanlines }, + { "FilterHq2x", FilterHq2x }, + { "FilterLq2x", FilterLq2x } + }; + EFilter2x eDefaultFilter2x = (EFilter2x)m_poDisplayConfig->oGetKey("filter2x"); + for (guint i = 0; i < G_N_ELEMENTS(astFilter2x); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astFilter2x[i].m_csName)); + if (astFilter2x[i].m_eFilter2x == eDefaultFilter2x) + { + poCMI->set_active(); + vOnFilter2xToggled(poCMI, eDefaultFilter2x); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnFilter2xToggled), + poCMI, astFilter2x[i].m_eFilter2x)); + } + + poCMI = dynamic_cast(_poXml->get_widget("FilterDisableMmx")); +#ifdef MMX + poCMI->set_active(m_poDisplayConfig->oGetKey("filter_disable_mmx")); + vOnDisableMMXToggled(poCMI); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnDisableMMXToggled), + poCMI)); +#else // ! MMX + poCMI->set_active(); + poCMI->set_sensitive(false); +#endif // ! MMX + + // Interframe blending menu + // + struct + { + const char * m_csName; + const EFilterIB m_eFilterIB; + } + astFilterIB[] = + { + { "IFBNone", FilterIBNone }, + { "IFBSmart", FilterIBSmart }, + { "IFBMotionBlur", FilterIBMotionBlur } + }; + EFilterIB eDefaultFilterIB = (EFilterIB)m_poDisplayConfig->oGetKey("filterIB"); + for (guint i = 0; i < G_N_ELEMENTS(astFilterIB); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astFilterIB[i].m_csName)); + if (astFilterIB[i].m_eFilterIB == eDefaultFilterIB) + { + poCMI->set_active(); + vOnFilterIBToggled(poCMI, eDefaultFilterIB); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnFilterIBToggled), + poCMI, astFilterIB[i].m_eFilterIB)); + } + + // Joypad menu + // + poMI = dynamic_cast(_poXml->get_widget("JoypadConfigure1")); + poMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnJoypadConfigure), 1)); + + poMI = dynamic_cast(_poXml->get_widget("JoypadConfigure2")); + poMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnJoypadConfigure), 2)); + + poMI = dynamic_cast(_poXml->get_widget("JoypadConfigure3")); + poMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnJoypadConfigure), 3)); + + poMI = dynamic_cast(_poXml->get_widget("JoypadConfigure4")); + poMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnJoypadConfigure), 4)); + + int iDefaultJoypad = m_poInputConfig->oGetKey("active_joypad"); + for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++) + { + char csName[20]; + snprintf(csName, sizeof(csName), "Joypad%d", i); + + poCMI = dynamic_cast(_poXml->get_widget(csName)); + if (i == iDefaultJoypad) + { + poCMI->set_active(); + vOnJoypadToggled(poCMI, iDefaultJoypad); + } + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnJoypadToggled), + poCMI, i)); + } + + // Autofire menu + // + struct + { + const char * m_csName; + const char * m_csKey; + const EKeyFlag m_eKeyFlag; + } + astAutofire[] = + { + { "AutofireA", "autofire_A", KeyFlagA }, + { "AutofireB", "autofire_B", KeyFlagB }, + { "AutofireL", "autofire_L", KeyFlagL }, + { "AutofireR", "autofire_R", KeyFlagR } + }; + for (guint i = 0; i < G_N_ELEMENTS(astAutofire); i++) + { + poCMI = dynamic_cast(_poXml->get_widget(astAutofire[i].m_csName)); + poCMI->set_active(m_poInputConfig->oGetKey(astAutofire[i].m_csKey)); + vOnAutofireToggled(poCMI, astAutofire[i].m_eKeyFlag); + poCMI->signal_toggled().connect(SigC::bind( + SigC::slot(*this, &Window::vOnAutofireToggled), + poCMI, astAutofire[i].m_eKeyFlag)); + } + + // GDB menu + // + poMI = dynamic_cast(_poXml->get_widget("GdbWait")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBWait)); + + poMI = dynamic_cast(_poXml->get_widget("GdbLoadAndWait")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBLoadAndWait)); + + poMI = dynamic_cast(_poXml->get_widget("GdbBreak")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBBreak)); + + poMI = dynamic_cast(_poXml->get_widget("GdbDisconnect")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnGDBDisconnect)); + + // Help menu + // + poMI = dynamic_cast(_poXml->get_widget("HelpAbout")); + poMI->signal_activate().connect(SigC::slot(*this, &Window::vOnHelpAbout)); + + // Init widgets sensitivity + for (std::list::iterator it = m_listSensitiveWhenPlaying.begin(); + it != m_listSensitiveWhenPlaying.end(); + it++) + { + (*it)->set_sensitive(false); + } + + if (m_poInstance == NULL) + { + m_poInstance = this; + } + else + { + abort(); + } +} + +Window::~Window() +{ + vOnFileClose(); + vSaveHistoryToConfig(); + vSaveJoypadsToConfig(); + vSaveConfig(m_sConfigFile); + + if (m_poFileOpenDialog != NULL) + { + delete m_poFileOpenDialog; + } + + if (m_poKeymap != NULL) + { + delete m_poKeymap; + } + + m_poInstance = NULL; +} + +void Window::vInitSystem() +{ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + systemRedShift = 3; + systemGreenShift = 11; + systemBlueShift = 19; + RGB_LOW_BITS_MASK = 0x00010101; +#else + systemRedShift = 27; + systemGreenShift = 19; + systemBlueShift = 11; + RGB_LOW_BITS_MASK = 0x01010100; +#endif + + systemColorDepth = 32; + systemDebug = 0; + systemVerbose = 0; + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + systemFrameSkip = 0; + systemSoundOn = false; + soundOffFlag = true; + + systemRenderedFrames = 0; + systemFPS = 0; + + emulating = 0; + debugger = false; + + for (int i = 0; i < 0x10000; i++) + { +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + systemColorMap32[i] = (((i & 0x1f) << systemRedShift) + | (((i & 0x3e0) >> 5) << systemGreenShift) + | (((i & 0x7c00) >> 10) << systemBlueShift)); +#else + systemColorMap32[i] = (((i & 0x1f) << systemRedShift) + | (((i & 0x3e0) >> 5) << systemGreenShift) + | (((i & 0x7c00) >> 10) << systemBlueShift)); +#endif + } + + gbFrameSkip = 0; + + for (int i = 0; i < 24; ) + { + systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + systemGbPalette[i++] = (0x15) | (0x15 << 5) | (0x15 << 10); + systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + systemGbPalette[i++] = 0; + } + + Init_2xSaI(32); +} + +void Window::vInitSDL() +{ + static bool bDone = false; + + if (bDone) + return; + + int iFlags = (SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE); + + if (SDL_Init(iFlags) < 0) + { + fprintf(stderr, "Failed to init SDL: %s", SDL_GetError()); + abort(); + } + + bDone = true; +} + +void Window::vInitConfig() +{ + m_oConfig.vClear(); + + // History section + // + m_poHistoryConfig = m_oConfig.poAddSection("History"); + m_poHistoryConfig->vSetKey("freeze", false ); + m_poHistoryConfig->vSetKey("0", "" ); + m_poHistoryConfig->vSetKey("1", "" ); + m_poHistoryConfig->vSetKey("2", "" ); + m_poHistoryConfig->vSetKey("3", "" ); + m_poHistoryConfig->vSetKey("4", "" ); + m_poHistoryConfig->vSetKey("5", "" ); + m_poHistoryConfig->vSetKey("6", "" ); + m_poHistoryConfig->vSetKey("7", "" ); + m_poHistoryConfig->vSetKey("8", "" ); + m_poHistoryConfig->vSetKey("9", "" ); + + // Directories section + // + m_poDirConfig = m_oConfig.poAddSection("Directories"); + m_poDirConfig->vSetKey("gb_roms", "" ); + m_poDirConfig->vSetKey("gba_roms", "" ); + m_poDirConfig->vSetKey("batteries", "" ); + m_poDirConfig->vSetKey("saves", "" ); + m_poDirConfig->vSetKey("captures", "" ); + + // Core section + // + m_poCoreConfig = m_oConfig.poAddSection("Core"); + m_poCoreConfig->vSetKey("load_game_auto", false ); + m_poCoreConfig->vSetKey("frameskip", "auto" ); + m_poCoreConfig->vSetKey("throttle", 0 ); + m_poCoreConfig->vSetKey("layer_bg0", true ); + m_poCoreConfig->vSetKey("layer_bg1", true ); + m_poCoreConfig->vSetKey("layer_bg2", true ); + m_poCoreConfig->vSetKey("layer_bg3", true ); + m_poCoreConfig->vSetKey("layer_obj", true ); + m_poCoreConfig->vSetKey("layer_win0", true ); + m_poCoreConfig->vSetKey("layer_win1", true ); + m_poCoreConfig->vSetKey("layer_objwin", true ); + m_poCoreConfig->vSetKey("use_bios_file", false ); + m_poCoreConfig->vSetKey("bios_file", "" ); + m_poCoreConfig->vSetKey("save_type", SaveAuto ); + m_poCoreConfig->vSetKey("flash_size", 64 ); + m_poCoreConfig->vSetKey("gb_border", true ); + m_poCoreConfig->vSetKey("gb_printer", false ); + m_poCoreConfig->vSetKey("emulator_type", EmulatorAuto ); + m_poCoreConfig->vSetKey("screenshot_format", "png" ); + + // Display section + // + m_poDisplayConfig = m_oConfig.poAddSection("Display"); + m_poDisplayConfig->vSetKey("scale", 1 ); + m_poDisplayConfig->vSetKey("show_speed", ShowPercentage ); + m_poDisplayConfig->vSetKey("pause_when_inactive", true ); + m_poDisplayConfig->vSetKey("filter2x", FilterNone ); + m_poDisplayConfig->vSetKey("filterIB", FilterIBNone ); +#ifdef MMX + m_poDisplayConfig->vSetKey("filter_disable_mmx", false ); +#endif // MMX + + // Sound section + // + m_poSoundConfig = m_oConfig.poAddSection("Sound"); + m_poSoundConfig->vSetKey("status", "on" ); + m_poSoundConfig->vSetKey("echo", false ); + m_poSoundConfig->vSetKey("low_pass", false ); + m_poSoundConfig->vSetKey("reverse_stereo", false ); + m_poSoundConfig->vSetKey("channel_1", true ); + m_poSoundConfig->vSetKey("channel_2", true ); + m_poSoundConfig->vSetKey("channel_3", true ); + m_poSoundConfig->vSetKey("channel_4", true ); + m_poSoundConfig->vSetKey("channel_A", true ); + m_poSoundConfig->vSetKey("channel_B", true ); + m_poSoundConfig->vSetKey("quality", Sound22K ); + m_poSoundConfig->vSetKey("volume", Sound100 ); + + // Input section + // + JoypadConfig oJoypadConfig; + oJoypadConfig.vSetDefault(); + m_poInputConfig = m_oConfig.poAddSection("Input"); + m_poInputConfig->vSetKey("active_joypad", m_iJoypadMin ); + for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++) + { + char csPrefix[20]; + snprintf(csPrefix, sizeof(csPrefix), "joypad%d_", i); + std::string sPrefix(csPrefix); + m_poInputConfig->vSetKey(sPrefix + "up", oJoypadConfig.m_uiUp ); + m_poInputConfig->vSetKey(sPrefix + "down", oJoypadConfig.m_uiDown ); + m_poInputConfig->vSetKey(sPrefix + "left", oJoypadConfig.m_uiLeft ); + m_poInputConfig->vSetKey(sPrefix + "right", oJoypadConfig.m_uiRight ); + m_poInputConfig->vSetKey(sPrefix + "A", oJoypadConfig.m_uiA ); + m_poInputConfig->vSetKey(sPrefix + "B", oJoypadConfig.m_uiB ); + m_poInputConfig->vSetKey(sPrefix + "L", oJoypadConfig.m_uiL ); + m_poInputConfig->vSetKey(sPrefix + "R", oJoypadConfig.m_uiR ); + m_poInputConfig->vSetKey(sPrefix + "select", oJoypadConfig.m_uiSelect ); + m_poInputConfig->vSetKey(sPrefix + "start", oJoypadConfig.m_uiStart ); + m_poInputConfig->vSetKey(sPrefix + "speed", oJoypadConfig.m_uiSpeed ); + m_poInputConfig->vSetKey(sPrefix + "capture", oJoypadConfig.m_uiCapture ); + } + m_poInputConfig->vSetKey("autofire_A", false ); + m_poInputConfig->vSetKey("autofire_B", false ); + m_poInputConfig->vSetKey("autofire_L", false ); + m_poInputConfig->vSetKey("autofire_R", false ); +} + +void Window::vCheckConfig() +{ + int iValue; + int iAdjusted; + std::string sValue; + + // Directories section + // + sValue = m_poDirConfig->sGetKey("gb_roms"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("gb_roms", ""); + } + sValue = m_poDirConfig->sGetKey("gba_roms"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("gba_roms", ""); + } + sValue = m_poDirConfig->sGetKey("batteries"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("batteries", ""); + } + sValue = m_poDirConfig->sGetKey("saves"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("saves", ""); + } + sValue = m_poDirConfig->sGetKey("captures"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR)) + { + m_poDirConfig->vSetKey("captures", ""); + } + + // Core section + // + if (m_poCoreConfig->sGetKey("frameskip") != "auto") + { + iValue = m_poCoreConfig->oGetKey("frameskip"); + iAdjusted = CLAMP(iValue, m_iFrameskipMin, m_iFrameskipMax); + if (iValue != iAdjusted) + { + m_poCoreConfig->vSetKey("frameskip", iAdjusted); + } + } + + iValue = m_poCoreConfig->oGetKey("throttle"); + if (iValue != 0) + { + iAdjusted = CLAMP(iValue, m_iThrottleMin, m_iThrottleMax); + if (iValue != iAdjusted) + { + m_poCoreConfig->vSetKey("throttle", iAdjusted); + } + } + + sValue = m_poCoreConfig->sGetKey("bios_file"); + if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_REGULAR)) + { + m_poCoreConfig->vSetKey("bios_file", ""); + } + if (m_poCoreConfig->sGetKey("bios_file") == "") + { + m_poCoreConfig->vSetKey("use_bios_file", false); + } + + iValue = m_poCoreConfig->oGetKey("save_type"); + if (iValue != 0) + { + iAdjusted = CLAMP(iValue, m_iSaveTypeMin, m_iSaveTypeMax); + if (iValue != iAdjusted) + { + m_poCoreConfig->vSetKey("save_type", iAdjusted); + } + } + + iValue = m_poCoreConfig->oGetKey("flash_size"); + if (iValue != 64 && iValue != 128) + { + m_poCoreConfig->vSetKey("flash_size", 64); + } + + iValue = m_poCoreConfig->oGetKey("emulator_type"); + iAdjusted = CLAMP(iValue, m_iEmulatorTypeMin, m_iEmulatorTypeMax); + if (iValue != iAdjusted) + { + m_poCoreConfig->vSetKey("emulator_type", iAdjusted); + } + + sValue = m_poCoreConfig->sGetKey("screenshot_format"); + if (sValue != "png" && sValue != "bmp") + { + sValue = "png"; + } + + // Display section + // + iValue = m_poDisplayConfig->oGetKey("scale"); + iAdjusted = CLAMP(iValue, m_iScaleMin, m_iScaleMax); + if (iValue != iAdjusted) + { + m_poDisplayConfig->vSetKey("scale", iAdjusted); + } + + iValue = m_poDisplayConfig->oGetKey("show_speed"); + iAdjusted = CLAMP(iValue, m_iShowSpeedMin, m_iShowSpeedMax); + if (iValue != iAdjusted) + { + m_poDisplayConfig->vSetKey("show_speed", iAdjusted); + } + + iValue = m_poDisplayConfig->oGetKey("filter2x"); + iAdjusted = CLAMP(iValue, m_iFilter2xMin, m_iFilter2xMax); + if (iValue != iAdjusted) + { + m_poDisplayConfig->vSetKey("filter2x", iAdjusted); + } + + iValue = m_poDisplayConfig->oGetKey("filterIB"); + iAdjusted = CLAMP(iValue, m_iFilterIBMin, m_iFilterIBMax); + if (iValue != iAdjusted) + { + m_poDisplayConfig->vSetKey("filterIB", iAdjusted); + } + + // Sound section + // + sValue = m_poSoundConfig->sGetKey("status"); + if (sValue != "off" && sValue != "on" && sValue != "mute") + { + m_poSoundConfig->vSetKey("status", "on"); + } + + iValue = m_poSoundConfig->oGetKey("quality"); + iAdjusted = CLAMP(iValue, m_iSoundQualityMin, m_iSoundQualityMax); + if (iValue != iAdjusted) + { + m_poSoundConfig->vSetKey("quality", iAdjusted); + } + + iValue = m_poSoundConfig->oGetKey("volume"); + iAdjusted = CLAMP(iValue, m_iSoundVolumeMin, m_iSoundVolumeMax); + if (iValue != iAdjusted) + { + m_poSoundConfig->vSetKey("volume", iAdjusted); + } + + // Input section + // + iValue = m_poInputConfig->oGetKey("active_joypad"); + iAdjusted = CLAMP(iValue, m_iJoypadMin, m_iJoypadMax); + if (iValue != iAdjusted) + { + m_poInputConfig->vSetKey("active_joypad", iAdjusted); + } +} + +void Window::vLoadConfig(const std::string & _rsFile) +{ + try + { + m_oConfig.vLoad(_rsFile, false, false); + } + catch (const Glib::Error & e) + { + vPopupError(e.what().c_str()); + } +} + +void Window::vSaveConfig(const std::string & _rsFile) +{ + try + { + m_oConfig.vSave(_rsFile); + } + catch (const Glib::Error & e) + { + vPopupError(e.what().c_str()); + } +} + +void Window::vLoadHistoryFromConfig() +{ + char csKey[] = "0"; + for (int i = 0; i < 10; i++, csKey[0]++) + { + std::string sFile = m_poHistoryConfig->sGetKey(csKey); + if (sFile == "") + { + break; + } + m_listHistory.push_back(sFile); + } +} + +void Window::vSaveHistoryToConfig() +{ + char csKey[] = "0"; + for (std::list::const_iterator it = m_listHistory.begin(); + it != m_listHistory.end(); + it++, csKey[0]++) + { + m_poHistoryConfig->vSetKey(csKey, *it); + } +} + +void Window::vHistoryAdd(const std::string & _rsFile) +{ + if (m_poHistoryConfig->oGetKey("freeze")) + { + return; + } + + m_listHistory.remove(_rsFile); + m_listHistory.push_front(_rsFile); + if (m_listHistory.size() > 10) + { + m_listHistory.pop_back(); + } + + vUpdateHistoryMenu(); +} + +void Window::vClearHistoryMenu() +{ + Gtk::Menu_Helpers::MenuList::iterator it = m_poRecentMenu->items().begin(); + for (int i = 0; i < 3; i++, it++) + ; + + m_poRecentMenu->items().erase(it, m_poRecentMenu->items().end()); +} + +void Window::vUpdateHistoryMenu() +{ + vClearHistoryMenu(); + + guint uiAccelKey = GDK_F1; + for (std::list::const_iterator it = m_listHistory.begin(); + it != m_listHistory.end(); + it++, uiAccelKey++) + { + Gtk::Image * poImage = Gtk::manage(new Gtk::Image(Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU)); + Glib::ustring sLabel = Glib::path_get_basename(*it); + VBA::ImageMenuItem * poIMI = Gtk::manage(new VBA::ImageMenuItem(*poImage, sLabel)); + + m_oTooltips.set_tip(*poIMI, *it); + + poIMI->signal_activate().connect(SigC::bind( + SigC::slot(*this, &Window::vOnRecentFile), + *it)); + + poIMI->set_accel_key(Gtk::AccelKey(uiAccelKey, Gdk::CONTROL_MASK)); + poIMI->accelerate(*this); + + poIMI->show(); + m_poRecentMenu->items().push_back(*poIMI); + } +} + +void Window::vLoadJoypadsFromConfig() +{ + m_oJoypads.clear(); + + for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++) + { + char csPrefix[20]; + snprintf(csPrefix, sizeof(csPrefix), "joypad%d_", i); + std::string sPrefix(csPrefix); + + JoypadConfig oJoypadConfig; + oJoypadConfig.m_uiUp = m_poInputConfig->oGetKey(sPrefix + "up"); + oJoypadConfig.m_uiDown = m_poInputConfig->oGetKey(sPrefix + "down"); + oJoypadConfig.m_uiLeft = m_poInputConfig->oGetKey(sPrefix + "left"); + oJoypadConfig.m_uiRight = m_poInputConfig->oGetKey(sPrefix + "right"); + oJoypadConfig.m_uiA = m_poInputConfig->oGetKey(sPrefix + "A"); + oJoypadConfig.m_uiB = m_poInputConfig->oGetKey(sPrefix + "B"); + oJoypadConfig.m_uiL = m_poInputConfig->oGetKey(sPrefix + "L"); + oJoypadConfig.m_uiR = m_poInputConfig->oGetKey(sPrefix + "R"); + oJoypadConfig.m_uiSelect = m_poInputConfig->oGetKey(sPrefix + "select"); + oJoypadConfig.m_uiStart = m_poInputConfig->oGetKey(sPrefix + "start"); + oJoypadConfig.m_uiSpeed = m_poInputConfig->oGetKey(sPrefix + "speed"); + oJoypadConfig.m_uiCapture = m_poInputConfig->oGetKey(sPrefix + "capture"); + + m_oJoypads.push_back(oJoypadConfig); + } +} + +void Window::vSaveJoypadsToConfig() +{ + for (int i = m_iJoypadMin; i <= m_iJoypadMax; i++) + { + char csPrefix[20]; + snprintf(csPrefix, sizeof(csPrefix), "joypad%d_", i); + std::string sPrefix(csPrefix); + + m_poInputConfig->vSetKey(sPrefix + "up", m_oJoypads[i - 1].m_uiUp ); + m_poInputConfig->vSetKey(sPrefix + "down", m_oJoypads[i - 1].m_uiDown ); + m_poInputConfig->vSetKey(sPrefix + "left", m_oJoypads[i - 1].m_uiLeft ); + m_poInputConfig->vSetKey(sPrefix + "right", m_oJoypads[i - 1].m_uiRight ); + m_poInputConfig->vSetKey(sPrefix + "A", m_oJoypads[i - 1].m_uiA ); + m_poInputConfig->vSetKey(sPrefix + "B", m_oJoypads[i - 1].m_uiB ); + m_poInputConfig->vSetKey(sPrefix + "L", m_oJoypads[i - 1].m_uiL ); + m_poInputConfig->vSetKey(sPrefix + "R", m_oJoypads[i - 1].m_uiR ); + m_poInputConfig->vSetKey(sPrefix + "select", m_oJoypads[i - 1].m_uiSelect ); + m_poInputConfig->vSetKey(sPrefix + "start", m_oJoypads[i - 1].m_uiStart ); + m_poInputConfig->vSetKey(sPrefix + "speed", m_oJoypads[i - 1].m_uiSpeed ); + m_poInputConfig->vSetKey(sPrefix + "capture", m_oJoypads[i - 1].m_uiCapture ); + } +} + +void Window::vUpdateScreen() +{ + if (m_eCartridge == CartridgeGB) + { + if (gbBorderOn) + { + m_iScreenWidth = m_iSGBScreenWidth; + m_iScreenHeight = m_iSGBScreenHeight; + gbBorderLineSkip = m_iSGBScreenWidth; + gbBorderColumnSkip = (m_iSGBScreenWidth - m_iGBScreenWidth) / 2; + gbBorderRowSkip = (m_iSGBScreenHeight - m_iGBScreenHeight) / 2; + } + else + { + m_iScreenWidth = m_iGBScreenWidth; + m_iScreenHeight = m_iGBScreenHeight; + gbBorderLineSkip = m_iGBScreenWidth; + gbBorderColumnSkip = 0; + gbBorderRowSkip = 0; + } + } + else if (m_eCartridge == CartridgeGBA) + { + m_iScreenWidth = m_iGBAScreenWidth; + m_iScreenHeight = m_iGBAScreenHeight; + } + + g_return_if_fail(m_iScreenWidth >= 1 && m_iScreenHeight >= 1); + + m_poScreenArea->vSetSize(m_iScreenWidth, m_iScreenHeight); + m_poScreenArea->vSetScale(m_poDisplayConfig->oGetKey("scale")); + + resize(1, 1); + + if (emulating) + { + vDrawScreen(); + } + else + { + vDrawDefaultScreen(); + } +} + +bool Window::bLoadROM(const std::string & _rsFile) +{ + vOnFileClose(); + + m_sRomFile = _rsFile; + const char * csFile = _rsFile.c_str(); + + IMAGE_TYPE eType = utilFindType(csFile); + if (eType == IMAGE_UNKNOWN) + { + vPopupError(_("Unknown file type %s"), csFile); + return false; + } + + bool bLoaded = false; + if (eType == IMAGE_GB) + { + bLoaded = gbLoadRom(csFile); + if (bLoaded) + { + m_eCartridge = CartridgeGB; + m_stEmulator = GBSystem; + } + } + else if (eType == IMAGE_GBA) + { + int iSize = CPULoadRom(csFile); + bLoaded = (iSize > 0); + if (bLoaded) + { + m_eCartridge = CartridgeGBA; + m_stEmulator = GBASystem; + + useBios = m_poCoreConfig->oGetKey("use_bios_file"); + CPUInit(m_poCoreConfig->sGetKey("bios_file").c_str(), useBios); + CPUReset(); + + // If the bios file was rejected by CPUInit + if (m_poCoreConfig->oGetKey("use_bios_file") && ! useBios) + { + m_poUseBiosItem->set_active(false); + m_poUseBiosItem->set_sensitive(false); + m_poCoreConfig->vSetKey("bios_file", ""); + } + } + } + + if (! bLoaded) + { + return false; + } + + vLoadBattery(); + vUpdateScreen(); + + debugger = false; // May cause conflicts + emulating = 1; + m_bWasEmulating = false; + m_uiThrottleDelay = 0; + + if (m_eCartridge == CartridgeGBA) + { + soundSetQuality(m_eSoundQuality); + } + else + { + gbSoundSetQuality(m_eSoundQuality); + } + + vUpdateGameSlots(); + vHistoryAdd(_rsFile); + + for (std::list::iterator it = m_listSensitiveWhenPlaying.begin(); + it != m_listSensitiveWhenPlaying.end(); + it++) + { + (*it)->set_sensitive(); + } + + if (m_poCoreConfig->oGetKey("load_game_auto")) + { + vOnLoadGameMostRecent(); + } + + vStartEmu(); + + return true; +} + +void Window::vPopupError(const char * _csFormat, ...) +{ + va_list args; + va_start(args, _csFormat); + char * csMsg = g_strdup_vprintf(_csFormat, args); + va_end(args); + + Gtk::MessageDialog oDialog(*this, + csMsg, +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK); + oDialog.run(); + g_free(csMsg); +} + +void Window::vPopupErrorV(const char * _csFormat, va_list _args) +{ + char * csMsg = g_strdup_vprintf(_csFormat, _args); + + Gtk::MessageDialog oDialog(*this, + csMsg, +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK); + oDialog.run(); + g_free(csMsg); +} + +void Window::vDrawScreen() +{ + m_poScreenArea->vDrawPixels(pix); +} + +void Window::vDrawDefaultScreen() +{ + m_poScreenArea->vDrawColor(0x000000); // Black +} + +void Window::vSetDefaultTitle() +{ + set_title("VBA"); +} + +void Window::vShowSpeed(int _iSpeed) +{ + char csTitle[50]; + + if (m_eShowSpeed == ShowPercentage) + { + snprintf(csTitle, 50, "VBA - %d%%", _iSpeed); + set_title(csTitle); + } + else if (m_eShowSpeed == ShowDetailed) + { + snprintf(csTitle, 50, "VBA - %d%% (%d, %d fps)", + _iSpeed, systemFrameSkip, systemFPS); + set_title(csTitle); + } +} + +void Window::vComputeFrameskip(int _iRate) +{ + static u32 uiLastTime = 0; + static int iFrameskipAdjust = 0; + + u32 uiTime = SDL_GetTicks(); + + if (m_bWasEmulating) + { + int iWantedSpeed = 100; + + if (m_iThrottle > 0) + { + if (! speedup) + { + u32 uiDiff = uiTime - m_uiThrottleLastTime; + int iTarget = 1000000 / (_iRate * m_iThrottle); + int iDelay = iTarget - uiDiff; + if (iDelay > 0) + { + m_uiThrottleDelay = iDelay; + } + } + iWantedSpeed = m_iThrottle; + } + + if (m_bAutoFrameskip) + { + u32 uiDiff = uiTime - uiLastTime; + int iSpeed = iWantedSpeed; + + if (uiDiff != 0) + { + iSpeed = (1000000 / _iRate) / uiDiff; + } + + if (iSpeed >= iWantedSpeed - 2) + { + iFrameskipAdjust++; + if (iFrameskipAdjust >= 3) + { + iFrameskipAdjust = 0; + if (systemFrameSkip > 0) + { + systemFrameSkip--; + } + } + } + else + { + if (iSpeed < iWantedSpeed - 20) + { + iFrameskipAdjust -= ((iWantedSpeed - 10) - iSpeed) / 5; + } + else if (systemFrameSkip < 9) + { + iFrameskipAdjust--; + } + + if (iFrameskipAdjust <= -2) + { + iFrameskipAdjust += 2; + if (systemFrameSkip < 9) + { + systemFrameSkip++; + } + } + } + } + } + else + { + m_bWasEmulating = true; + } + + uiLastTime = uiTime; + m_uiThrottleLastTime = uiTime; +} + +void Window::vCaptureScreen(int _iNum) +{ + std::string sBaseName; + std::string sCaptureDir = m_poDirConfig->sGetKey("captures"); + if (sCaptureDir == "") + { + sBaseName = sCutSuffix(m_sRomFile); + } + else + { + sBaseName = sCaptureDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)); + } + std::string sFormat = m_poCoreConfig->sGetKey("screenshot_format"); + + char * csFile = g_strdup_printf("%s_%02d.%s", + sBaseName.c_str(), + _iNum, + sFormat.c_str()); + if (sFormat == "png") + { + m_stEmulator.emuWritePNG(csFile); + } + else + { + m_stEmulator.emuWriteBMP(csFile); + } + g_free(csFile); +} + +u32 Window::uiReadJoypad() +{ + u32 uiJoypad = m_uiJoypadState; + + if (m_uiAutofireState != 0) + { + uiJoypad &= ~m_uiAutofireState; + if (m_bAutofireToggle) + { + uiJoypad |= m_uiAutofireState; + } + m_bAutofireToggle = ! m_bAutofireToggle; + } + + return uiJoypad; +} + +void Window::vCreateFileOpenDialog() +{ + if (m_poFileOpenDialog != NULL) + { + return; + } + + std::string sGBDir = m_poDirConfig->sGetKey("gb_roms"); + std::string sGBADir = m_poDirConfig->sGetKey("gba_roms"); + +#ifdef GTKMM20 + + Gtk::FileSelection * poDialog = new Gtk::FileSelection(_("Open")); + poDialog->set_transient_for(*this); + + if (sGBADir != "") + { + poDialog->set_filename(sGBADir + "/"); + } + else if (sGBDir != "") + { + poDialog->set_filename(sGBDir + "/"); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog * poDialog = new Gtk::FileChooserDialog(*this, _("Open")); + poDialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + poDialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + if (sGBDir != "") + { + poDialog->add_shortcut_folder(sGBDir); + poDialog->set_current_folder(sGBDir); + } + + if (sGBADir != "" && sGBADir != sGBDir) + { + poDialog->add_shortcut_folder(sGBADir); + poDialog->set_current_folder(sGBADir); + } + + const char * acsPattern[] = + { + // GBA + "*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]", + // GB + "*.[gG][bB]", "*.[sS][gG][bB]", "*.[cC][gG][bB]", "*.[gG][bB][cC]", + // Both + "*.[mM][bB]", "*.[eE][lL][fF]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]" + }; + + Gtk::FileFilter oAllGBAFilter; + oAllGBAFilter.set_name(_("All Gameboy Advance files")); + for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) + { + oAllGBAFilter.add_pattern(acsPattern[i]); + } + + Gtk::FileFilter oGBAFilter; + oGBAFilter.set_name(_("Gameboy Advance files")); + for (int i = 0; i < 3; i++) + { + oGBAFilter.add_pattern(acsPattern[i]); + } + + Gtk::FileFilter oGBFilter; + oGBFilter.set_name(_("Gameboy files")); + for (int i = 3; i < 7; i++) + { + oGBFilter.add_pattern(acsPattern[i]); + } + + poDialog->add_filter(oAllGBAFilter); + poDialog->add_filter(oGBAFilter); + poDialog->add_filter(oGBFilter); + +#endif // ! GTKMM20 + + m_poFileOpenDialog = poDialog; +} + +void Window::vLoadBattery() +{ + std::string sBattery; + std::string sDir = m_poDirConfig->sGetKey("batteries"); + if (sDir == "") + { + sBattery = sCutSuffix(m_sRomFile) + ".sav"; + } + else + { + sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav"; + } + + if (m_stEmulator.emuReadBattery(sBattery.c_str())) + { + systemScreenMessage(_("Loaded battery")); + } +} + +void Window::vSaveBattery() +{ + std::string sBattery; + std::string sDir = m_poDirConfig->sGetKey("batteries"); + if (sDir == "") + { + sBattery = sCutSuffix(m_sRomFile) + ".sav"; + } + else + { + sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav"; + } + + if (m_stEmulator.emuWriteBattery(sBattery.c_str())) + { + systemScreenMessage(_("Saved battery")); + } +} + +void Window::vStartEmu() +{ + if (m_oEmuSig.connected()) + { + return; + } + + m_oEmuSig = Glib::signal_idle().connect(SigC::slot(*this, &Window::bOnEmuIdle), + Glib::PRIORITY_DEFAULT_IDLE); +} + +void Window::vStopEmu() +{ + m_oEmuSig.disconnect(); + m_bWasEmulating = false; +} + +void Window::vSetThrottle(int _iPercent) +{ + m_iThrottle = _iPercent; + m_poCoreConfig->vSetKey("throttle", _iPercent); +} + +void Window::vSelectBestThrottleItem() +{ + struct + { + const char * m_csName; + const int m_iThrottle; + } + astThrottle[] = + { + { "ThrottleNoThrottle", 0 }, + { "Throttle25", 25 }, + { "Throttle50", 50 }, + { "Throttle100", 100 }, + { "Throttle150", 150 }, + { "Throttle200", 200 } + }; + for (guint i = 0; i < G_N_ELEMENTS(astThrottle); i++) + { + Gtk::CheckMenuItem * poCMI; + poCMI = dynamic_cast(m_poXml->get_widget(astThrottle[i].m_csName)); + if (astThrottle[i].m_iThrottle == m_iThrottle) + { + poCMI->set_active(); + } + } +} + +void Window::vUpdateGameSlots() +{ + if (m_eCartridge == CartridgeNone) + { + std::string sDateTime = _("----/--/-- --:--:--"); + + for (int i = 0; i < 10; i++) + { + char csPrefix[10]; + snprintf(csPrefix, sizeof(csPrefix), "%2d ", i + 1); + + Gtk::Label * poLabel; + poLabel = dynamic_cast(m_apoLoadGameItem[i]->get_child()); + poLabel->set_text(csPrefix + sDateTime); + m_apoLoadGameItem[i]->set_sensitive(false); + + poLabel = dynamic_cast(m_apoSaveGameItem[i]->get_child()); + poLabel->set_text(csPrefix + sDateTime); + m_apoSaveGameItem[i]->set_sensitive(false); + + m_astGameSlot[i].m_bEmpty = true; + } + } + else + { + std::string sFileBase; + std::string sDir = m_poDirConfig->sGetKey("saves"); + if (sDir == "") + { + sFileBase = sCutSuffix(m_sRomFile); + } + else + { + sFileBase = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)); + } + + const char * csDateFormat = _("%Y/%m/%d %H:%M:%S"); + + for (int i = 0; i < 10; i++) + { + char csPrefix[10]; + snprintf(csPrefix, sizeof(csPrefix), "%2d ", i + 1); + + char csSlot[10]; + snprintf(csSlot, sizeof(csSlot), "%d", i + 1); + m_astGameSlot[i].m_sFile = sFileBase + csSlot + ".sgm"; + + std::string sDateTime; + struct stat stStat; + if (stat(m_astGameSlot[i].m_sFile.c_str(), &stStat) == -1) + { + sDateTime = _("----/--/-- --:--:--"); + m_astGameSlot[i].m_bEmpty = true; + } + else + { + char csDateTime[30]; + strftime(csDateTime, sizeof(csDateTime), csDateFormat, + localtime(&stStat.st_mtime)); + sDateTime = csDateTime; + m_astGameSlot[i].m_bEmpty = false; + m_astGameSlot[i].m_uiTime = stStat.st_mtime; + } + + Gtk::Label * poLabel; + poLabel = dynamic_cast(m_apoLoadGameItem[i]->get_child()); + poLabel->set_text(csPrefix + sDateTime); + m_apoLoadGameItem[i]->set_sensitive(! m_astGameSlot[i].m_bEmpty); + + poLabel = dynamic_cast(m_apoSaveGameItem[i]->get_child()); + poLabel->set_text(csPrefix + sDateTime); + m_apoSaveGameItem[i]->set_sensitive(); + } + } +} + +} // VBA namespace diff --git a/src/gtk/window.h b/src/gtk/window.h new file mode 100644 index 0000000..dee8e9e --- /dev/null +++ b/src/gtk/window.h @@ -0,0 +1,322 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __VBA_WINDOW_H__ +#define __VBA_WINDOW_H__ + +#include +#include + +#include +#include + +#ifndef GTKMM20 +# include "sigccompat.h" +#endif // ! GTKMM20 + +#include +#include +#include + +#include "../System.h" + +#include "configfile.h" +#include "screenarea.h" +#include "filters.h" +#include "input.h" +#include "joypadconfig.h" + +namespace VBA +{ + +class Window : public Gtk::Window +{ + friend class Gnome::Glade::Xml; + +public: + virtual ~Window(); + + inline static Window * poGetInstance() { return m_poInstance; } + + enum ECartridge + { + CartridgeNone, + CartridgeGB, + CartridgeGBA + }; + + // GB/GBA screen sizes + const int m_iGBScreenWidth; + const int m_iGBScreenHeight; + const int m_iSGBScreenWidth; + const int m_iSGBScreenHeight; + const int m_iGBAScreenWidth; + const int m_iGBAScreenHeight; + + bool bLoadROM(const std::string & _rsFile); + void vPopupError(const char * _csFormat, ...); + void vPopupErrorV(const char * _csFormat, va_list _args); + void vDrawScreen(); + void vComputeFrameskip(int _iRate); + void vShowSpeed(int _iSpeed); + void vCaptureScreen(int _iNum); + u32 uiReadJoypad(); + + inline ECartridge eGetCartridge() const { return m_eCartridge; } + inline int iGetThrottle() const { return m_iThrottle; } + +protected: + Window(GtkWindow * _pstWindow, + const Glib::RefPtr & _poXml); + + enum EShowSpeed + { + ShowNone, + ShowPercentage, + ShowDetailed + }; + + enum ESaveType + { + SaveAuto, + SaveEEPROM, + SaveSRAM, + SaveFlash, + SaveEEPROMSensor, + SaveNone + }; + + enum ESoundStatus + { + SoundOff, + SoundMute, + SoundOn + }; + + enum ESoundQuality + { + Sound44K = 1, + Sound22K = 2, + Sound11K = 4 + }; + + enum ESoundVolume + { + Sound100, + Sound200, + Sound300, + Sound400, + Sound25, + Sound50 + }; + + enum EEmulatorType + { + EmulatorAuto, + EmulatorCGB, + EmulatorSGB, + EmulatorGB, + EmulatorGBA, + EmulatorSGB2 + }; + + virtual void vOnFileOpen(); + virtual void vOnFileLoad(); + virtual void vOnFileSave(); + virtual void vOnLoadGameMostRecent(); + virtual void vOnLoadGameAutoToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnLoadGame(int _iSlot); + virtual void vOnSaveGameOldest(); + virtual void vOnSaveGame(int _iSlot); + virtual void vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnFileReset(); + virtual void vOnRecentReset(); + virtual void vOnRecentFreezeToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnRecentFile(std::string _sFile); + virtual void vOnImportBatteryFile(); + virtual void vOnExportBatteryFile(); + virtual void vOnFileScreenCapture(); + virtual void vOnFileClose(); + virtual void vOnFileExit(); + virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue); + virtual void vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent); + virtual void vOnThrottleOther(Gtk::CheckMenuItem * _poCMI); + virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); + virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer); + virtual void vOnDirectories(); + virtual void vOnDirectoryReset(Gtk::Entry * _poEntry); + virtual void vOnDirectorySelect(Gtk::Entry * _poEntry); + virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnSelectBios(); + virtual void vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed); + virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType); + virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize); + virtual void vOnScreenshotFormatToggled(Gtk::CheckMenuItem * _poCMI, std::string _sFormat); + virtual void vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus); + virtual void vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnSoundReverseToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnSoundChannelToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundChannel); + virtual void vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality); + virtual void vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundVolume); + virtual void vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnGBPrinterToggled(Gtk::CheckMenuItem * _poCMI); + virtual void vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorType); + virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x); + virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB); +#ifdef MMX + virtual void vOnDisableMMXToggled(Gtk::CheckMenuItem * _poCMI); +#endif // MMX + virtual void vOnJoypadConfigure(int _iJoypad); + virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad); + virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag); + virtual void vOnGDBWait(); + virtual void vOnGDBLoadAndWait(); + virtual void vOnGDBBreak(); + virtual void vOnGDBDisconnect(); + virtual void vOnHelpAbout(); + virtual bool bOnEmuIdle(); + + virtual bool on_focus_in_event(GdkEventFocus * _pstEvent); + virtual bool on_focus_out_event(GdkEventFocus * _pstEvent); + virtual bool on_key_press_event(GdkEventKey * _pstEvent); + virtual bool on_key_release_event(GdkEventKey * _pstEvent); + +private: + // Config limits + const int m_iFrameskipMin; + const int m_iFrameskipMax; + const int m_iThrottleMin; + const int m_iThrottleMax; + const int m_iScaleMin; + const int m_iScaleMax; + const int m_iShowSpeedMin; + const int m_iShowSpeedMax; + const int m_iSaveTypeMin; + const int m_iSaveTypeMax; + const int m_iSoundQualityMin; + const int m_iSoundQualityMax; + const int m_iSoundVolumeMin; + const int m_iSoundVolumeMax; + const int m_iEmulatorTypeMin; + const int m_iEmulatorTypeMax; + const int m_iFilter2xMin; + const int m_iFilter2xMax; + const int m_iFilterIBMin; + const int m_iFilterIBMax; + const int m_iJoypadMin; + const int m_iJoypadMax; + + static Window * m_poInstance; + + Glib::RefPtr m_poXml; + + std::string m_sUserDataDir; + std::string m_sConfigFile; + Config::File m_oConfig; + Config::Section * m_poHistoryConfig; + Config::Section * m_poDirConfig; + Config::Section * m_poCoreConfig; + Config::Section * m_poDisplayConfig; + Config::Section * m_poSoundConfig; + Config::Section * m_poInputConfig; + +#ifdef GTKMM20 + Gtk::FileSelection * m_poFileOpenDialog; +#else // ! GTKMM20 + Gtk::FileChooserDialog * m_poFileOpenDialog; +#endif // ! GTKMM20 + ScreenArea * m_poScreenArea; + Gtk::Menu * m_poRecentMenu; + Gtk::MenuItem * m_poRecentResetItem; + Gtk::CheckMenuItem * m_poFilePauseItem; + Gtk::CheckMenuItem * m_poUseBiosItem; + Gtk::CheckMenuItem * m_poSoundOffItem; + + struct SGameSlot + { + bool m_bEmpty; + std::string m_sFile; + time_t m_uiTime; + }; + + Gtk::MenuItem * m_apoLoadGameItem[10]; + Gtk::MenuItem * m_apoSaveGameItem[10]; + SGameSlot m_astGameSlot[10]; + + std::list m_listHistory; + + std::list m_listSensitiveWhenPlaying; + + Gtk::Tooltips m_oTooltips; + + SigC::Connection m_oEmuSig; + + std::vector m_oJoypads; + Keymap * m_poKeymap; + + int m_iScreenWidth; + int m_iScreenHeight; + + std::string m_sRomFile; + ECartridge m_eCartridge; + EmulatedSystem m_stEmulator; + u32 m_uiJoypadState; + u32 m_uiAutofireState; + bool m_bAutofireToggle; + bool m_bPaused; + bool m_bWasEmulating; + bool m_bAutoFrameskip; + int m_iThrottle; + u32 m_uiThrottleLastTime; + u32 m_uiThrottleDelay; + EShowSpeed m_eShowSpeed; + ESoundQuality m_eSoundQuality; + + void vInitSystem(); + void vInitSDL(); + void vInitConfig(); + void vCheckConfig(); + void vLoadConfig(const std::string & _rsFile); + void vSaveConfig(const std::string & _rsFile); + void vLoadHistoryFromConfig(); + void vSaveHistoryToConfig(); + void vHistoryAdd(const std::string & _rsFile); + void vClearHistoryMenu(); + void vUpdateHistoryMenu(); + void vLoadJoypadsFromConfig(); + void vSaveJoypadsToConfig(); + void vUpdateScreen(); + void vDrawDefaultScreen(); + void vSetDefaultTitle(); + void vCreateFileOpenDialog(); + void vLoadBattery(); + void vSaveBattery(); + void vStartEmu(); + void vStopEmu(); + void vSetThrottle(int _iPercent); + void vSelectBestThrottleItem(); + void vUpdateGameSlots(); +}; + +} // namespace VBA + + +#endif // __VBA_WINDOW_H__ diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp new file mode 100644 index 0000000..3d5dc91 --- /dev/null +++ b/src/gtk/windowcallbacks.cpp @@ -0,0 +1,1579 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "window.h" + +#include + +#include +#include + +#include + +#include "../GBA.h" +#include "../gb/GB.h" +#include "../gb/gbGlobals.h" +#include "../gb/gbPrinter.h" +#include "../Sound.h" +#include "../Util.h" + +#include "tools.h" +#include "intl.h" + +extern int systemRenderedFrames; +extern int systemFPS; +extern bool debugger; +extern int RGB_LOW_BITS_MASK; +extern void (*dbgMain)(); +extern void (*dbgSignal)(int, int); +extern void (*dbgOutput)(char *, u32); +extern void remoteInit(); +extern void remoteCleanUp(); +extern void remoteStubMain(); +extern void remoteStubSignal(int, int); +extern void remoteOutput(char *, u32); +extern void remoteSetProtocol(int); +extern void remoteSetPort(int); + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif // MMX + +namespace VBA +{ + +using Gnome::Glade::Xml; + +void Window::vOnFileOpen() +{ + while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK) + { + if (bLoadROM(m_poFileOpenDialog->get_filename())) + { + break; + } + } + m_poFileOpenDialog->hide(); +} + +void Window::vOnFileLoad() +{ + std::string sSaveDir = m_poDirConfig->sGetKey("saves"); + +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Load game")); + oDialog.set_transient_for(*this); + + if (sSaveDir == "") + { + oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); + } + else + { + oDialog.set_filename(sSaveDir + "/"); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Load game")); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + if (sSaveDir == "") + { + oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); + } + else + { + oDialog.set_current_folder(sSaveDir); + oDialog.add_shortcut_folder(sSaveDir); + } + + Gtk::FileFilter oSaveFilter; + oSaveFilter.set_name(_("VisualBoyAdvance save game")); + oSaveFilter.add_pattern("*.[sS][gG][mM]"); + + oDialog.add_filter(oSaveFilter); + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + if (m_stEmulator.emuReadState(oDialog.get_filename().c_str())) + { + break; + } + } +} + +void Window::vOnFileSave() +{ + Glib::ustring sSaveDir = m_poDirConfig->sGetKey("saves"); + +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Save game")); + oDialog.set_transient_for(*this); + + if (sSaveDir == "") + { + oDialog.set_filename(sCutSuffix(m_sRomFile)); + } + else + { + oDialog.set_filename(sSaveDir + "/" + + sCutSuffix(Glib::path_get_basename(m_sRomFile))); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Save game"), + Gtk::FILE_CHOOSER_ACTION_SAVE); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); + + if (sSaveDir == "") + { + oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); + } + else + { + oDialog.set_current_folder(sSaveDir); + oDialog.add_shortcut_folder(sSaveDir); + } + oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile))); + + Gtk::FileFilter oSaveFilter; + oSaveFilter.set_name(_("VisualBoyAdvance save game")); + oSaveFilter.add_pattern("*.[sS][gG][mM]"); + + oDialog.add_filter(oSaveFilter); + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + Glib::ustring sFile = oDialog.get_filename(); + if (! bHasSuffix(sFile, ".sgm", false)) + { + sFile += ".sgm"; + } + + if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS)) + { + Gtk::MessageDialog oConfirmDialog(*this, + _("File already exists. Overwrite it?"), +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_YES_NO); + if (oConfirmDialog.run() != Gtk::RESPONSE_YES) + { + continue; + } + } + + if (m_stEmulator.emuWriteState(sFile.c_str())) + { + break; + } + } +} + +void Window::vOnLoadGameMostRecent() +{ + int iMostRecent = -1; + time_t uiTimeMax; + + for (int i = 0; i < 10; i++) + { + if (! m_astGameSlot[i].m_bEmpty + && (iMostRecent < 0 || m_astGameSlot[i].m_uiTime > uiTimeMax)) + { + iMostRecent = i; + uiTimeMax = m_astGameSlot[i].m_uiTime; + } + } + + if (iMostRecent >= 0) + { + vOnLoadGame(iMostRecent + 1); + } +} + +void Window::vOnLoadGameAutoToggled(Gtk::CheckMenuItem * _poCMI) +{ + m_poCoreConfig->vSetKey("load_game_auto", _poCMI->get_active()); +} + +void Window::vOnLoadGame(int _iSlot) +{ + int i = _iSlot - 1; + if (! m_astGameSlot[i].m_bEmpty) + { + m_stEmulator.emuReadState(m_astGameSlot[i].m_sFile.c_str()); + m_poFilePauseItem->set_active(false); + } +} + +void Window::vOnSaveGameOldest() +{ + int iOldest = -1; + time_t uiTimeMin; + + for (int i = 0; i < 10; i++) + { + if (! m_astGameSlot[i].m_bEmpty + && (iOldest < 0 || m_astGameSlot[i].m_uiTime < uiTimeMin)) + { + iOldest = i; + uiTimeMin = m_astGameSlot[i].m_uiTime; + } + } + + if (iOldest >= 0) + { + vOnSaveGame(iOldest + 1); + } + else + { + vOnSaveGame(1); + } +} + +void Window::vOnSaveGame(int _iSlot) +{ + int i = _iSlot - 1; + m_stEmulator.emuWriteState(m_astGameSlot[i].m_sFile.c_str()); + vUpdateGameSlots(); +} + +void Window::vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI) +{ + m_bPaused = _poCMI->get_active(); + if (emulating) + { + if (m_bPaused) + { + vStopEmu(); + soundPause(); + } + else + { + vStartEmu(); + soundResume(); + } + } +} + +void Window::vOnFileReset() +{ + if (emulating) + { + m_stEmulator.emuReset(); + m_poFilePauseItem->set_active(false); + } +} + +void Window::vOnRecentReset() +{ + m_listHistory.clear(); + vClearHistoryMenu(); +} + +void Window::vOnRecentFreezeToggled(Gtk::CheckMenuItem * _poCMI) +{ + m_poRecentResetItem->set_sensitive(! _poCMI->get_active()); + m_poHistoryConfig->vSetKey("freeze", _poCMI->get_active()); +} + +void Window::vOnRecentFile(std::string _sFile) +{ + bLoadROM(_sFile); +} + +void Window::vOnImportBatteryFile() +{ + std::string BatteryDir = m_poDirConfig->sGetKey("batteries"); + +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Import battery file")); + oDialog.set_transient_for(*this); + + if (BatteryDir == "") + { + oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); + } + else + { + oDialog.set_filename(BatteryDir + "/"); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Import battery file")); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + if (BatteryDir == "") + { + oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); + } + else + { + oDialog.set_current_folder(BatteryDir); + oDialog.add_shortcut_folder(BatteryDir); + } + + Gtk::FileFilter oBatteryFilter; + oBatteryFilter.set_name(_("Battery file")); + oBatteryFilter.add_pattern("*.[sS][aA][vV]"); + + Gtk::FileFilter oFlashFilter; + oFlashFilter.set_name(_("Flash save")); + oFlashFilter.add_pattern("*.[dD][aA][tT]"); + + oDialog.add_filter(oBatteryFilter); + oDialog.add_filter(oFlashFilter); + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + Gtk::MessageDialog oConfirmDialog(*this, + _("Importing a battery file will erase any saved games and reset the emulator. Do you want to continue?"), +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_YES_NO); + if (oConfirmDialog.run() != Gtk::RESPONSE_YES) + { + continue; + } + + if (m_stEmulator.emuReadBattery(oDialog.get_filename().c_str())) + { + m_stEmulator.emuReset(); + break; + } + else + { + vPopupError(_("Failed to import battery file %s."), + oDialog.get_filename().c_str()); + } + } +} + +void Window::vOnExportBatteryFile() +{ + std::string sBatteryDir = m_poDirConfig->sGetKey("batteries"); + +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Export battery file")); + oDialog.set_transient_for(*this); + + if (sBatteryDir == "") + { + oDialog.set_filename(sCutSuffix(m_sRomFile)); + } + else + { + oDialog.set_filename(sBatteryDir + "/" + + sCutSuffix(Glib::path_get_basename(m_sRomFile))); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Export battery file"), + Gtk::FILE_CHOOSER_ACTION_SAVE); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); + + if (sBatteryDir == "") + { + oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); + } + else + { + oDialog.set_current_folder(sBatteryDir); + oDialog.add_shortcut_folder(sBatteryDir); + } + oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile))); + + Gtk::FileFilter oBatteryFilter; + oBatteryFilter.set_name(_("Battery file")); + oBatteryFilter.add_pattern("*.[sS][aA][vV]"); + + Gtk::FileFilter oFlashFilter; + oFlashFilter.set_name(_("Flash save")); + oFlashFilter.add_pattern("*.[dD][aA][tT]"); + + oDialog.add_filter(oBatteryFilter); + oDialog.add_filter(oFlashFilter); + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + Glib::ustring sFile = oDialog.get_filename(); + Glib::ustring sExt; + +#ifdef GTKMM20 + + sExt = ".sav"; + +#else // ! GTKMM20 + + if (oDialog.get_filter() == &oBatteryFilter) + { + sExt = ".sav"; + } + else + { + sExt = ".dat"; + } + +#endif // ! GTKMM20 + + if (! bHasSuffix(sFile, sExt, false)) + { + sFile += sExt; + } + + if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS)) + { + Gtk::MessageDialog oConfirmDialog(*this, + _("File already exists. Overwrite it?"), +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_YES_NO); + if (oConfirmDialog.run() != Gtk::RESPONSE_YES) + { + continue; + } + } + + bool bResult; + if (m_eCartridge == CartridgeGB) + { + bResult = gbWriteBatteryFile(sFile.c_str(), false); + } + else + { + bResult = m_stEmulator.emuWriteBattery(sFile.c_str()); + } + + if (bResult) + { + break; + } + else + { + vPopupError(_("Failed to export battery file %s."), + sFile.c_str()); + } + } +} + +void Window::vOnFileScreenCapture() +{ + std::string sCaptureDir = m_poDirConfig->sGetKey("captures"); + +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Save screenshot")); + oDialog.set_transient_for(*this); + + if (sCaptureDir == "") + { + oDialog.set_filename(sCutSuffix(m_sRomFile)); + } + else + { + oDialog.set_filename(sCaptureDir + "/" + + sCutSuffix(Glib::path_get_basename(m_sRomFile))); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Save screenshot"), + Gtk::FILE_CHOOSER_ACTION_SAVE); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); + + if (sCaptureDir == "") + { + oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); + } + else + { + oDialog.set_current_folder(sCaptureDir); + oDialog.add_shortcut_folder(sCaptureDir); + } + oDialog.set_current_name(sCutSuffix(Glib::path_get_basename(m_sRomFile))); + + Gtk::FileFilter oPngFilter; + oPngFilter.set_name(_("PNG image")); + oPngFilter.add_pattern("*.[pP][nN][gG]"); + + Gtk::FileFilter oBmpFilter; + oBmpFilter.set_name(_("BMP image")); + oBmpFilter.add_pattern("*.[bB][mM][pP]"); + + oDialog.add_filter(oPngFilter); + oDialog.add_filter(oBmpFilter); + + if (m_poCoreConfig->sGetKey("screenshot_format") == "bmp") + { + oDialog.set_filter(oBmpFilter); + } + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + Glib::ustring sFile = oDialog.get_filename(); + Glib::ustring sExt; + +#ifdef GTKMM20 + + sExt = "." + m_poCoreConfig->sGetKey("screenshot_format"); + +#else // ! GTKMM20 + + if (oDialog.get_filter() == &oPngFilter) + { + sExt = ".png"; + } + else + { + sExt = ".bmp"; + } + +#endif // ! GTKMM20 + + if (! bHasSuffix(sFile, sExt, false)) + { + sFile += sExt; + } + + if (Glib::file_test(sFile, Glib::FILE_TEST_EXISTS)) + { + Gtk::MessageDialog oConfirmDialog(*this, + _("File already exists. Overwrite it?"), +#ifndef GTKMM20 + false, +#endif // ! GTKMM20 + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_YES_NO); + if (oConfirmDialog.run() != Gtk::RESPONSE_YES) + { + continue; + } + } + + bool bResult; + if (sExt == ".png") + { + bResult = m_stEmulator.emuWritePNG(sFile.c_str()); + } + else + { + bResult = m_stEmulator.emuWriteBMP(sFile.c_str()); + } + + if (bResult) + { + break; + } + } +} + +void Window::vOnFileClose() +{ + if (m_eCartridge != CartridgeNone) + { + soundPause(); + vStopEmu(); + vSetDefaultTitle(); + vDrawDefaultScreen(); + vSaveBattery(); + m_stEmulator.emuCleanUp(); + m_eCartridge = CartridgeNone; + emulating = 0; + + vUpdateGameSlots(); + + for (std::list::iterator it = m_listSensitiveWhenPlaying.begin(); + it != m_listSensitiveWhenPlaying.end(); + it++) + { + (*it)->set_sensitive(false); + } + + m_poFilePauseItem->set_active(false); + } +} + +void Window::vOnFileExit() +{ + hide(); +} + +void Window::vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue) +{ + if (! _poCMI->get_active()) + { + return; + } + + if (_iValue >= 0 && _iValue <= 9) + { + m_poCoreConfig->vSetKey("frameskip", _iValue); + gbFrameSkip = _iValue; + systemFrameSkip = _iValue; + m_bAutoFrameskip = false; + } + else + { + m_poCoreConfig->vSetKey("frameskip", "auto"); + gbFrameSkip = 0; + systemFrameSkip = 0; + m_bAutoFrameskip = true; + } +} + +void Window::vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent) +{ + if (! _poCMI->get_active()) + { + return; + } + + vSetThrottle(_iPercent); + + // Initialize the frameskip adjustment each time throttle is changed + if (m_bAutoFrameskip) + { + systemFrameSkip = 0; + } +} + +void Window::vOnThrottleOther(Gtk::CheckMenuItem * _poCMI) +{ + if (! _poCMI->get_active()) + { + return; + } + + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "ThrottleDialog"); + + Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("ThrottleDialog")); + Gtk::SpinButton * poSpin = dynamic_cast(poXml->get_widget("ThrottleSpin")); + + poDialog->set_transient_for(*this); + + if (m_iThrottle != 0) + { + poSpin->set_value(m_iThrottle); + } + else + { + poSpin->set_value(100); + } + + if (poDialog->run() == Gtk::RESPONSE_OK) + { + vSetThrottle(poSpin->get_value_as_int()); + } + + delete poDialog; + vSelectBestThrottleItem(); +} + +void Window::vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_poDisplayConfig->vSetKey("scale", _iScale); + vUpdateScreen(); +} + +void Window::vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer) +{ + int iMask = (0x0100 << _iLayer); + if (_poCMI->get_active()) + { + layerSettings |= iMask; + } + else + { + layerSettings &= ~iMask; + } + layerEnable = DISPCNT & layerSettings; + + const char * acsLayers[] = + { + "layer_bg0", + "layer_bg1", + "layer_bg2", + "layer_bg3", + "layer_obj", + "layer_win0", + "layer_win1", + "layer_objwin" + }; + m_poCoreConfig->vSetKey(acsLayers[_iLayer], _poCMI->get_active()); +} + +void Window::vOnDirectories() +{ + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "DirectoriesDialog"); + + struct + { + const char * m_csKey; + const char * m_csEntry; + const char * m_csResetButton; + const char * m_csSelectButton; + } + astRow[] = + { + { "gba_roms", "GBARomsDirEntry", "GBARomsDirResetButton", "GBARomsDirSelectButton" }, + { "gb_roms", "GBRomsDirEntry", "GBRomsDirResetButton", "GBRomsDirSelectButton" }, + { "batteries", "BatteriesDirEntry", "BatteriesDirResetButton", "BatteriesDirSelectButton" }, + { "saves", "SavesDirEntry", "SavesDirResetButton", "SavesDirSelectButton" }, + { "captures", "CapturesDirEntry", "CapturesDirResetButton", "CapturesDirSelectButton" } + }; + + for (guint i = 0; i < G_N_ELEMENTS(astRow); i++) + { + Gtk::Entry * poEntry = dynamic_cast(poXml->get_widget(astRow[i].m_csEntry)); + Gtk::Button * poReset = dynamic_cast(poXml->get_widget(astRow[i].m_csResetButton)); + Gtk::Button * poSelect = dynamic_cast(poXml->get_widget(astRow[i].m_csSelectButton)); + + poEntry->set_text(m_poDirConfig->sGetKey(astRow[i].m_csKey)); + + poReset->signal_clicked().connect(SigC::bind( + SigC::slot(*this, &Window::vOnDirectoryReset), + poEntry)); + poSelect->signal_clicked().connect(SigC::bind( + SigC::slot(*this, &Window::vOnDirectorySelect), + poEntry)); + } + + Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("DirectoriesDialog")); + poDialog->set_transient_for(*this); + + if (poDialog->run() == Gtk::RESPONSE_OK) + { + for (guint i = 0; i < G_N_ELEMENTS(astRow); i++) + { + Gtk::Entry * poEntry = dynamic_cast(poXml->get_widget(astRow[i].m_csEntry)); + Glib::ustring sDir = poEntry->get_text(); + if (! Glib::file_test(sDir, Glib::FILE_TEST_IS_DIR)) + { + sDir = ""; + } + m_poDirConfig->vSetKey(astRow[i].m_csKey, sDir); + } + + // Needed if saves dir changed + vUpdateGameSlots(); + } + + delete poDialog; +} + +void Window::vOnDirectoryReset(Gtk::Entry * _poEntry) +{ + _poEntry->set_text(""); +} + +void Window::vOnDirectorySelect(Gtk::Entry * _poEntry) +{ +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Select directory")); + oDialog.set_transient_for(*this); + + if (_poEntry->get_text() != "") + { + oDialog.set_filename(_poEntry->get_text() + "/"); + } + + if (oDialog.run() == Gtk::RESPONSE_OK) + { + std::string sFile = oDialog.get_filename(); + if (! Glib::file_test(sFile, Glib::FILE_TEST_IS_DIR)) + { + sFile = Glib::path_get_dirname(sFile); + } + _poEntry->set_text(sFile); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Select directory"), + Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); + + if (_poEntry->get_text() != "") + { + oDialog.add_shortcut_folder(_poEntry->get_text()); + oDialog.set_current_folder(_poEntry->get_text()); + } + + if (oDialog.run() == Gtk::RESPONSE_OK) + { + _poEntry->set_text(oDialog.get_filename()); + } + +#endif // ! GTKMM20 +} + +void Window::vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI) +{ + m_poDisplayConfig->vSetKey("pause_when_inactive", _poCMI->get_active()); +} + +void Window::vOnSelectBios() +{ +#ifdef GTKMM20 + + Gtk::FileSelection oDialog(_("Select BIOS file")); + oDialog.set_transient_for(*this); + + if (m_poCoreConfig->sGetKey("bios_file") != "") + { + oDialog.set_filename(m_poCoreConfig->sGetKey("bios_file")); + } + +#else // ! GTKMM20 + + Gtk::FileChooserDialog oDialog(*this, _("Select BIOS file")); + oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + if (m_poCoreConfig->sGetKey("bios_file") != "") + { + oDialog.set_filename(m_poCoreConfig->sGetKey("bios_file")); + } + + const char * acsPattern[] = + { + "*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]", + "*.[bB][iI][oO][sS]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]" + }; + + Gtk::FileFilter oAllFilter; + oAllFilter.set_name(_("All files")); + oAllFilter.add_pattern("*"); + + Gtk::FileFilter oBiosFilter; + oBiosFilter.set_name(_("Gameboy Advance BIOS")); + for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) + { + oBiosFilter.add_pattern(acsPattern[i]); + } + + oDialog.add_filter(oAllFilter); + oDialog.add_filter(oBiosFilter); + + oDialog.set_filter(oBiosFilter); + +#endif // ! GTKMM20 + + while (oDialog.run() == Gtk::RESPONSE_OK) + { + if (Glib::file_test(oDialog.get_filename(), Glib::FILE_TEST_IS_REGULAR)) + { + m_poCoreConfig->vSetKey("bios_file", oDialog.get_filename()); + m_poUseBiosItem->set_sensitive(); + break; + } + } +} + +void Window::vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI) +{ + m_poCoreConfig->vSetKey("use_bios_file", _poCMI->get_active()); +} + +void Window::vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_eShowSpeed = (EShowSpeed)_iShowSpeed; + if (m_eShowSpeed == ShowNone) + { + vSetDefaultTitle(); + } + m_poDisplayConfig->vSetKey("show_speed", _iShowSpeed); +} + +void Window::vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType) +{ + if (! _poCMI->get_active()) + { + return; + } + + cpuSaveType = _iSaveType; + m_poCoreConfig->vSetKey("save_type", _iSaveType); +} + +void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize) +{ + if (! _poCMI->get_active()) + { + return; + } + + if (_iFlashSize == 64) + { + flashSetSize(0x10000); + } + else + { + flashSetSize(0x20000); + } + m_poCoreConfig->vSetKey("flash_size", _iFlashSize); +} + +void Window::vOnScreenshotFormatToggled(Gtk::CheckMenuItem * _poCMI, std::string _sFormat) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_poCoreConfig->vSetKey("screenshot_format", _sFormat); +} + +void Window::vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus) +{ + if (! _poCMI->get_active()) + { + return; + } + + std::string sSoundStatus; + switch (_iSoundStatus) + { + case SoundOff: + soundOffFlag = true; + if (systemSoundOn) + { + soundShutdown(); + } + sSoundStatus = "off"; + break; + case SoundMute: + soundDisable(0x30f); + sSoundStatus = "mute"; + break; + case SoundOn: + if (soundOffFlag) + { + soundOffFlag = false; + if (! soundInit()) + { + m_poSoundOffItem->set_active(); + return; + } + } + soundEnable(0x30f); + sSoundStatus = "on"; + break; + } + m_poSoundConfig->vSetKey("status", sSoundStatus); +} + +void Window::vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI) +{ + soundEcho = _poCMI->get_active(); + m_poSoundConfig->vSetKey("echo", soundEcho); +} + +void Window::vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI) +{ + soundLowPass = _poCMI->get_active(); + m_poSoundConfig->vSetKey("low_pass", soundLowPass); +} + +void Window::vOnSoundReverseToggled(Gtk::CheckMenuItem * _poCMI) +{ + soundReverse = _poCMI->get_active(); + m_poSoundConfig->vSetKey("reverse_stereo", soundReverse); +} + +void Window::vOnSoundChannelToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundChannel) +{ + int iShift = _iSoundChannel; + if (_iSoundChannel > 3) + { + iShift += 4; + } + int iFlag = 1 << iShift; + int iActive = soundGetEnable() & 0x30f; + if (_poCMI->get_active()) + { + iActive |= iFlag; + } + else + { + iActive &= ~iFlag; + } + soundEnable(iActive); + soundDisable(~iActive & 0x30f); + + const char * acsChannels[] = + { + "channel_1", + "channel_2", + "channel_3", + "channel_4", + "channel_A", + "channel_B" + }; + m_poSoundConfig->vSetKey(acsChannels[_iSoundChannel], _poCMI->get_active()); +} + +void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_eSoundQuality = (ESoundQuality)_iSoundQuality; + if (m_eCartridge == CartridgeGBA) + { + soundSetQuality(_iSoundQuality); + } + else if (m_eCartridge == CartridgeGB) + { + gbSoundSetQuality(_iSoundQuality); + } + m_poSoundConfig->vSetKey("quality", _iSoundQuality); +} + +void Window::vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundVolume) +{ + if (! _poCMI->get_active()) + { + return; + } + + soundVolume = _iSoundVolume; + m_poSoundConfig->vSetKey("volume", _iSoundVolume); +} + +void Window::vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI) +{ + gbBorderOn = _poCMI->get_active(); + if (emulating && m_eCartridge == CartridgeGB && _poCMI->get_active()) + { + gbSgbRenderBorder(); + } + vUpdateScreen(); + m_poCoreConfig->vSetKey("gb_border", _poCMI->get_active()); +} + +void Window::vOnGBPrinterToggled(Gtk::CheckMenuItem * _poCMI) +{ + if (_poCMI->get_active()) + { + gbSerialFunction = gbPrinterSend; + } + else + { + gbSerialFunction = NULL; + } + m_poCoreConfig->vSetKey("gb_printer", _poCMI->get_active()); +} + +void Window::vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorType) +{ + gbEmulatorType = _iEmulatorType; + m_poCoreConfig->vSetKey("emulator_type", _iEmulatorType); +} + +void Window::vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_poScreenArea->vSetFilter2x((EFilter2x)_iFilter2x); + if (emulating) + { + vDrawScreen(); + } + m_poDisplayConfig->vSetKey("filter2x", _iFilter2x); +} + +void Window::vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB) +{ + if (! _poCMI->get_active()) + { + return; + } + + m_poScreenArea->vSetFilterIB((EFilterIB)_iFilterIB); + if (emulating) + { + vDrawScreen(); + } + m_poDisplayConfig->vSetKey("filterIB", _iFilterIB); +} + +#ifdef MMX +void Window::vOnDisableMMXToggled(Gtk::CheckMenuItem * _poCMI) +{ + cpu_mmx = ! _poCMI->get_active(); + m_poDisplayConfig->vSetKey("filter_disable_mmx", _poCMI->get_active()); +} +#endif // MMX + +void Window::vOnJoypadConfigure(int _iJoypad) +{ + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "JoypadConfigDialog"); + + JoypadConfigDialog * poDialog = NULL; + poXml->get_widget_derived("JoypadConfigDialog", poDialog); + poDialog->set_transient_for(*this); + poDialog->vSetConfig(m_oJoypads[_iJoypad - 1]); + + if (poDialog->run() == Gtk::RESPONSE_OK) + { + m_oJoypads[_iJoypad - 1] = poDialog->stGetConfig(); + if (_iJoypad == m_poInputConfig->oGetKey("active_joypad")) + { + if (m_poKeymap != NULL) + { + delete m_poKeymap; + } + m_poKeymap = m_oJoypads[_iJoypad - 1].poCreateKeymap(); + } + } + + delete poDialog; +} + +void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad) +{ + if (! _poCMI->get_active()) + { + return; + } + + if (m_poKeymap != NULL) + { + delete m_poKeymap; + } + m_poKeymap = m_oJoypads[_iJoypad - 1].poCreateKeymap(); + + m_poInputConfig->vSetKey("active_joypad", _iJoypad); +} + +void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag) +{ + if (_poCMI->get_active()) + { + m_uiAutofireState |= _uiKeyFlag; + } + else + { + m_uiAutofireState &= ~_uiKeyFlag; + } + + std::string sKey; + if (_uiKeyFlag == KeyFlagA) + { + sKey = "autofire_A"; + } + else if (_uiKeyFlag == KeyFlagB) + { + sKey = "autofire_B"; + } + else if (_uiKeyFlag == KeyFlagL) + { + sKey = "autofire_L"; + } + else if (_uiKeyFlag == KeyFlagR) + { + sKey = "autofire_R"; + } + m_poInputConfig->vSetKey(sKey, _poCMI->get_active()); +} + +void Window::vOnGDBWait() +{ + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "TcpPortDialog"); + + Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("TcpPortDialog")); + Gtk::SpinButton * poSpin = dynamic_cast(poXml->get_widget("TcpPortSpin")); + + poDialog->set_transient_for(*this); + + int iPort = 55555; + poSpin->set_value(iPort); + + bool bOk = false; + if (poDialog->run() == Gtk::RESPONSE_OK) + { + bOk = true; + iPort = poSpin->get_value_as_int(); + } + delete poDialog; + + if (! bOk) + { + return; + } + + m_eCartridge = CartridgeGBA; + m_sRomFile = "gnu_stub"; + m_stEmulator = GBASystem; + + rom = (u8 *) malloc(0x2000000); + workRAM = (u8 *) calloc(1, 0x40000); + bios = (u8 *) calloc(1, 0x4000); + internalRAM = (u8 *) calloc(1, 0x8000); + paletteRAM = (u8 *) calloc(1, 0x400); + vram = (u8 *) calloc(1, 0x20000); + oam = (u8 *) calloc(1, 0x400); + pix = (u8 *) calloc(1, 4 * m_iGBAScreenWidth * m_iGBAScreenHeight); + ioMem = (u8 *) calloc(1, 0x400); + + useBios = m_poCoreConfig->oGetKey("use_bios_file"); + CPUInit(m_poCoreConfig->sGetKey("bios_file").c_str(), useBios); + CPUReset(); + + for (std::list::iterator it = m_listSensitiveWhenPlaying.begin(); + it != m_listSensitiveWhenPlaying.end(); + it++) + { + (*it)->set_sensitive(); + } + + if (m_poCoreConfig->oGetKey("load_game_auto")) + { + vOnLoadGameMostRecent(); + } + + vStartEmu(); + + emulating = 1; + + dbgMain = remoteStubMain; + dbgSignal = remoteStubSignal; + dbgOutput = remoteOutput; + debugger = true; + + remoteSetProtocol(0); + remoteSetPort(iPort); + remoteInit(); +} + +void Window::vOnGDBLoadAndWait() +{ + bool bLoaded = false; + + while (m_poFileOpenDialog->run() == Gtk::RESPONSE_OK) + { + if (bLoadROM(m_poFileOpenDialog->get_filename())) + { + bLoaded = true; + break; + } + } + m_poFileOpenDialog->hide(); + + if (! bLoaded) + { + return; + } + + if (m_eCartridge != CartridgeGBA) + { + vPopupError(_("Only GBA images are supported.")); + vOnFileClose(); + return; + } + + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "TcpPortDialog"); + + Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("TcpPortDialog")); + Gtk::SpinButton * poSpin = dynamic_cast(poXml->get_widget("TcpPortSpin")); + + poDialog->set_transient_for(*this); + + int iPort = 55555; + poSpin->set_value(iPort); + + bool bOk = false; + if (poDialog->run() == Gtk::RESPONSE_OK) + { + bOk = true; + iPort = poSpin->get_value_as_int(); + } + delete poDialog; + + if (! bOk) + { + return; + } + + dbgMain = remoteStubMain; + dbgSignal = remoteStubSignal; + dbgOutput = remoteOutput; + debugger = true; + + remoteSetProtocol(0); + remoteSetPort(iPort); + remoteInit(); +} + +void Window::vOnGDBBreak() +{ + if (armState) + { + armNextPC -= 4; + reg[15].I -= 4; + } + else + { + armNextPC -= 2; + reg[15].I -= 2; + } + + debugger = true; +} + +void Window::vOnGDBDisconnect() +{ + remoteCleanUp(); + debugger = false; +} + +void Window::vOnHelpAbout() +{ + Glib::RefPtr poXml; + poXml = Xml::create(PKGDATADIR "/vba.glade", "AboutDialog"); + + Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("AboutDialog")); + poDialog->set_transient_for(*this); + + Gtk::Image oIcon(PKGDATADIR "/vba-64.png"); + oIcon.show(); + Gtk::Container * poIconContainer = dynamic_cast(poXml->get_widget("AboutIconContainer")); + poIconContainer->add(oIcon); + + Gtk::Label * poLabel = dynamic_cast(poXml->get_widget("VersionLabel")); + poLabel->set_markup("" PACKAGE " " VERSION ""); + + poDialog->run(); + delete poDialog; +} + +bool Window::bOnEmuIdle() +{ + if (debugger && m_stEmulator.emuHasDebugger) + { + dbgMain(); + return true; + } + + if (m_uiThrottleDelay != 0) + { + u32 uiTime = SDL_GetTicks(); + if (uiTime - m_uiThrottleLastTime >= m_uiThrottleDelay) + { + m_uiThrottleDelay = 0; + m_uiThrottleLastTime = uiTime; + } + else + { + return true; + } + } + + m_stEmulator.emuMain(m_stEmulator.emuCount); + return true; +} + +bool Window::on_focus_in_event(GdkEventFocus * _pstEvent) +{ + if (emulating + && ! m_bPaused + && m_poDisplayConfig->oGetKey("pause_when_inactive")) + { + vStartEmu(); + soundResume(); + } + return false; +} + +bool Window::on_focus_out_event(GdkEventFocus * _pstEvent) +{ + if (emulating + && ! m_bPaused + && m_poDisplayConfig->oGetKey("pause_when_inactive")) + { + vStopEmu(); + soundPause(); + } + return false; +} + +bool Window::on_key_press_event(GdkEventKey * _pstEvent) +{ + EKey eKey; + + if ((_pstEvent->state & Gtk::AccelGroup::get_default_mod_mask()) + || (eKey = m_poKeymap->eGetKey(_pstEvent->hardware_keycode)) == KeyNone) + { + return Gtk::Window::on_key_press_event(_pstEvent); + } + + switch (eKey) + { + case KeyA: + m_uiJoypadState |= KeyFlagA; + break; + case KeyB: + m_uiJoypadState |= KeyFlagB; + break; + case KeySelect: + m_uiJoypadState |= KeyFlagSelect; + break; + case KeyStart: + m_uiJoypadState |= KeyFlagStart; + break; + case KeyRight: + m_uiJoypadState |= KeyFlagRight; + m_uiJoypadState &= ~KeyFlagLeft; + break; + case KeyLeft: + m_uiJoypadState |= KeyFlagLeft; + m_uiJoypadState &= ~KeyFlagRight; + break; + case KeyUp: + m_uiJoypadState |= KeyFlagUp; + m_uiJoypadState &= ~KeyFlagDown; + break; + case KeyDown: + m_uiJoypadState |= KeyFlagDown; + m_uiJoypadState &= ~KeyFlagUp; + break; + case KeyR: + m_uiJoypadState |= KeyFlagR; + break; + case KeyL: + m_uiJoypadState |= KeyFlagL; + break; + case KeySpeed: + m_uiJoypadState |= KeyFlagSpeed; + break; + case KeyCapture: + m_uiJoypadState |= KeyFlagCapture; + break; + case KeyNone: + break; + } + return true; +} + +bool Window::on_key_release_event(GdkEventKey * _pstEvent) +{ + EKey eKey; + + if ((_pstEvent->state & Gtk::AccelGroup::get_default_mod_mask()) + || (eKey = m_poKeymap->eGetKey(_pstEvent->hardware_keycode)) == KeyNone) + { + return Gtk::Window::on_key_release_event(_pstEvent); + } + + switch (eKey) + { + case KeyA: + m_uiJoypadState &= ~KeyFlagA; + break; + case KeyB: + m_uiJoypadState &= ~KeyFlagB; + break; + case KeySelect: + m_uiJoypadState &= ~KeyFlagSelect; + break; + case KeyStart: + m_uiJoypadState &= ~KeyFlagStart; + break; + case KeyRight: + m_uiJoypadState &= ~KeyFlagRight; + break; + case KeyLeft: + m_uiJoypadState &= ~KeyFlagLeft; + break; + case KeyUp: + m_uiJoypadState &= ~KeyFlagUp; + break; + case KeyDown: + m_uiJoypadState &= ~KeyFlagDown; + break; + case KeyR: + m_uiJoypadState &= ~KeyFlagR; + break; + case KeyL: + m_uiJoypadState &= ~KeyFlagL; + break; + case KeySpeed: + m_uiJoypadState &= ~KeyFlagSpeed; + break; + case KeyCapture: + m_uiJoypadState &= ~KeyFlagCapture; + break; + case KeyNone: + break; + } + return true; +} + +} // namespace VBA diff --git a/src/hq2x.cpp b/src/hq2x.cpp new file mode 100644 index 0000000..39293f9 --- /dev/null +++ b/src/hq2x.cpp @@ -0,0 +1,920 @@ +/* + * This file is part of the Advance project. + * + * Copyright (C) 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * In addition, as a special exception, Andrea Mazzoleni + * gives permission to link the code of this program with + * the MAME library (or with modified versions of MAME that use the + * same license as MAME), and distribute linked combinations including + * the two. You must obey the GNU General Public License in all + * respects for all of the code used other than MAME. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ +#include "System.h" +#include "interp.h" + +unsigned interp_mask[2]; +unsigned interp_bits_per_pixel; + +/***************************************************************************/ +/* HQ2x C implementation */ + +/* + * This effect is a rewritten implementation of the hq2x effect made by Maxim Stepin + */ + +static void hq2x_16_def(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) +{ + unsigned i; + + for(i=0;i0) { + c[0] = src0[-1]; + c[3] = src1[-1]; + c[6] = src2[-1]; + } else { + c[0] = c[1]; + c[3] = c[4]; + c[6] = c[7]; + } + + if (i0) { + c[0] = src0[-1]; + c[3] = src1[-1]; + c[6] = src2[-1]; + } else { + c[0] = c[1]; + c[3] = c[4]; + c[6] = c[7]; + } + + if (i> 3; + r = (int)((c[j] & 0xF800)) >> 8; + } else { + b = (int)((c[j] & 0x1F)) << 3; + g = (int)((c[j] & 0x3E0)) >> 2; + r = (int)((c[j] & 0x7C00)) >> 7; + } + const int bright = r+r+r + g+g+g + b+b; + if(bright > maxBright) maxBright = bright; + if(bright < minBright) minBright = bright; + + brightArray[j] = bright; + } + int diffBright = ((maxBright - minBright) * 7) >> 4; + if(diffBright > 7) + { + #define ABS(x) ((x) < 0 ? -(x) : (x)) + + const int centerBright = brightArray[4]; + if(ABS(brightArray[0] - centerBright) > diffBright) + mask |= 1 << 0; + if(ABS(brightArray[1] - centerBright) > diffBright) + mask |= 1 << 1; + if(ABS(brightArray[2] - centerBright) > diffBright) + mask |= 1 << 2; + if(ABS(brightArray[3] - centerBright) > diffBright) + mask |= 1 << 3; + if(ABS(brightArray[5] - centerBright) > diffBright) + mask |= 1 << 4; + if(ABS(brightArray[6] - centerBright) > diffBright) + mask |= 1 << 5; + if(ABS(brightArray[7] - centerBright) > diffBright) + mask |= 1 << 6; + if(ABS(brightArray[8] - centerBright) > diffBright) + mask |= 1 << 7; + } + +#define P0 dst0[0] +#define P1 dst0[1] +#define P2 dst1[0] +#define P3 dst1[1] +#define MUR false//(ABS(brightArray[1] - brightArray[5]) > diffBright) // top-right +#define MDR false//(ABS(brightArray[5] - brightArray[7]) > diffBright) // bottom-right +#define MDL false//(ABS(brightArray[7] - brightArray[3]) > diffBright) // bottom-left +#define MUL false//(ABS(brightArray[3] - brightArray[1]) > diffBright) // top-left +#define IC(p0) c[p0] +#define I11(p0,p1) interp_16_11(c[p0], c[p1]) +#define I211(p0,p1,p2) interp_16_211(c[p0], c[p1], c[p2]) +#define I31(p0,p1) interp_16_31(c[p0], c[p1]) +#define I332(p0,p1,p2) interp_16_332(c[p0], c[p1], c[p2]) +#define I431(p0,p1,p2) interp_16_431(c[p0], c[p1], c[p2]) +#define I521(p0,p1,p2) interp_16_521(c[p0], c[p1], c[p2]) +#define I53(p0,p1) interp_16_53(c[p0], c[p1]) +#define I611(p0,p1,p2) interp_16_611(c[p0], c[p1], c[p2]) +#define I71(p0,p1) interp_16_71(c[p0], c[p1]) +#define I772(p0,p1,p2) interp_16_772(c[p0], c[p1], c[p2]) +#define I97(p0,p1) interp_16_97(c[p0], c[p1]) +#define I1411(p0,p1,p2) interp_16_1411(c[p0], c[p1], c[p2]) +#define I151(p0,p1) interp_16_151(c[p0], c[p1]) + + switch (mask) { +#include "hq2x.h" + } + +#undef P0 +#undef P1 +#undef P2 +#undef P3 +#undef MUR +#undef MDR +#undef MDL +#undef MUL +#undef IC +#undef I11 +#undef I211 +#undef I31 +#undef I332 +#undef I431 +#undef I521 +#undef I53 +#undef I611 +#undef I71 +#undef I772 +#undef I97 +#undef I1411 +#undef I151 + + src0 += 1; + src1 += 1; + src2 += 1; + dst0 += 2; + dst1 += 2; + } +} + +static void hq2xS_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count) +{ + unsigned i; + + for(i=0;i> 8; + const int r = (int)((c[j] & 0xF80000)) >> 16; + const int bright = r+r+r + g+g+g + b+b; + if(bright > maxBright) maxBright = bright; + if(bright < minBright) minBright = bright; + + brightArray[j] = bright; + } + int diffBright = ((maxBright - minBright) * 7) >> 4; + if(diffBright > 7) + { + #define ABS(x) ((x) < 0 ? -(x) : (x)) + + const int centerBright = brightArray[4]; + if(ABS(brightArray[0] - centerBright) > diffBright) + mask |= 1 << 0; + if(ABS(brightArray[1] - centerBright) > diffBright) + mask |= 1 << 1; + if(ABS(brightArray[2] - centerBright) > diffBright) + mask |= 1 << 2; + if(ABS(brightArray[3] - centerBright) > diffBright) + mask |= 1 << 3; + if(ABS(brightArray[5] - centerBright) > diffBright) + mask |= 1 << 4; + if(ABS(brightArray[6] - centerBright) > diffBright) + mask |= 1 << 5; + if(ABS(brightArray[7] - centerBright) > diffBright) + mask |= 1 << 6; + if(ABS(brightArray[8] - centerBright) > diffBright) + mask |= 1 << 7; + } + +#define P0 dst0[0] +#define P1 dst0[1] +#define P2 dst1[0] +#define P3 dst1[1] +#define MUR false//(ABS(brightArray[1] - brightArray[5]) > diffBright) // top-right +#define MDR false//(ABS(brightArray[5] - brightArray[7]) > diffBright) // bottom-right +#define MDL false//(ABS(brightArray[7] - brightArray[3]) > diffBright) // bottom-left +#define MUL false//(ABS(brightArray[3] - brightArray[1]) > diffBright) // top-left +#define IC(p0) c[p0] +#define I11(p0,p1) interp_32_11(c[p0], c[p1]) +#define I211(p0,p1,p2) interp_32_211(c[p0], c[p1], c[p2]) +#define I31(p0,p1) interp_32_31(c[p0], c[p1]) +#define I332(p0,p1,p2) interp_32_332(c[p0], c[p1], c[p2]) +#define I431(p0,p1,p2) interp_32_431(c[p0], c[p1], c[p2]) +#define I521(p0,p1,p2) interp_32_521(c[p0], c[p1], c[p2]) +#define I53(p0,p1) interp_32_53(c[p0], c[p1]) +#define I611(p0,p1,p2) interp_32_611(c[p0], c[p1], c[p2]) +#define I71(p0,p1) interp_32_71(c[p0], c[p1]) +#define I772(p0,p1,p2) interp_32_772(c[p0], c[p1], c[p2]) +#define I97(p0,p1) interp_32_97(c[p0], c[p1]) +#define I1411(p0,p1,p2) interp_32_1411(c[p0], c[p1], c[p2]) +#define I151(p0,p1) interp_32_151(c[p0], c[p1]) + + switch (mask) { +#include "hq2x.h" + } + +#undef P0 +#undef P1 +#undef P2 +#undef P3 +#undef MUR +#undef MDR +#undef MDL +#undef MUL +#undef IC +#undef I11 +#undef I211 +#undef I31 +#undef I332 +#undef I431 +#undef I521 +#undef I53 +#undef I611 +#undef I71 +#undef I772 +#undef I97 +#undef I1411 +#undef I151 + + src0 += 1; + src1 += 1; + src2 += 1; + dst0 += 2; + dst1 += 2; + } +} + +/***************************************************************************/ +/* LQ2x C implementation */ + +/* + * This effect is derived from the hq2x effect made by Maxim Stepin + */ + +static void lq2x_16_def(u16* dst0, u16* dst1, const u16* src0, const u16* src1, const u16* src2, unsigned count) +{ + unsigned i; + + for(i=0;i0) { + c[0] = src0[-1]; + c[3] = src1[-1]; + c[6] = src2[-1]; + } else { + c[0] = c[1]; + c[3] = c[4]; + c[6] = c[7]; + } + + if (i0) { + c[0] = src0[-1]; + c[3] = src1[-1]; + c[6] = src2[-1]; + } else { + c[0] = c[1]; + c[3] = c[4]; + c[6] = c[7]; + } + + if (i> 1); + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = src0 + (srcPitch >> 1); + u16 *src2 = src1 + (srcPitch >> 1); + + hq2x_16_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch; + dst1 += dstPitch; + hq2x_16_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 1; + --count; + } + dst0 += dstPitch; + dst1 += dstPitch; + hq2x_16_def(dst0, dst1, src0, src1, src1, width); +} + +void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dst0 = (u32 *)dstPtr; + u32 *dst1 = dst0 + (dstPitch >> 2); + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = src0 + (srcPitch >> 2); + u32 *src2 = src1 + (srcPitch >> 2); + hq2x_32_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + hq2x_32_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 2; + --count; + } + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + hq2x_32_def(dst0, dst1, src0, src1, src1, width); +} + +void hq2xS(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u16 *dst0 = (u16 *)dstPtr; + u16 *dst1 = dst0 + (dstPitch >> 1); + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = src0 + (srcPitch >> 1); + u16 *src2 = src1 + (srcPitch >> 1); + + hq2xS_16_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch; + dst1 += dstPitch; + hq2xS_16_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 1; + --count; + } + dst0 += dstPitch; + dst1 += dstPitch; + hq2xS_16_def(dst0, dst1, src0, src1, src1, width); +} + +void hq2xS32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dst0 = (u32 *)dstPtr; + u32 *dst1 = dst0 + (dstPitch >> 2); + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = src0 + (srcPitch >> 2); + u32 *src2 = src1 + (srcPitch >> 2); + hq2xS_32_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + hq2xS_32_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 2; + --count; + } + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + hq2xS_32_def(dst0, dst1, src0, src1, src1, width); +} + +void lq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u16 *dst0 = (u16 *)dstPtr; + u16 *dst1 = dst0 + (dstPitch >> 1); + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = src0 + (srcPitch >> 1); + u16 *src2 = src1 + (srcPitch >> 1); + + lq2x_16_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch; + dst1 += dstPitch; + lq2x_16_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 1; + --count; + } + dst0 += dstPitch; + dst1 += dstPitch; + lq2x_16_def(dst0, dst1, src0, src1, src1, width); +} + +void lq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u32 *dst0 = (u32 *)dstPtr; + u32 *dst1 = dst0 + (dstPitch >> 2); + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = src0 + (srcPitch >> 2); + u32 *src2 = src1 + (srcPitch >> 2); + lq2x_32_def(dst0, dst1, src0, src0, src1, width); + + int count = height; + + count -= 2; + while(count) { + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + lq2x_32_def(dst0, dst1, src0, src1, src2, width); + src0 = src1; + src1 = src2; + src2 += srcPitch >> 2; + --count; + } + dst0 += dstPitch >> 1; + dst1 += dstPitch >> 1; + lq2x_32_def(dst0, dst1, src0, src1, src1, width); +} + +void hq2x_init(unsigned bits_per_pixel) +{ + interp_set(bits_per_pixel); +} diff --git a/src/hq2x.h b/src/hq2x.h new file mode 100644 index 0000000..64c5778 --- /dev/null +++ b/src/hq2x.h @@ -0,0 +1,1824 @@ +case 0 : +case 1 : +case 4 : +case 5 : +case 32 : +case 33 : +case 36 : +case 37 : +case 128 : +case 129 : +case 132 : +case 133 : +case 160 : +case 161 : +case 164 : +case 165 : +{ + P0 = I211(4, 1, 3); + P1 = I211(4, 1, 5); + P2 = I211(4, 3, 7); + P3 = I211(4, 5, 7); +} break; +case 2 : +case 34 : +case 130 : +case 162 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I211(4, 3, 7); + P3 = I211(4, 5, 7); +} break; +case 3 : +case 35 : +case 131 : +case 163 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I211(4, 3, 7); + P3 = I211(4, 5, 7); +} break; +case 6 : +case 38 : +case 134 : +case 166 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P2 = I211(4, 3, 7); + P3 = I211(4, 5, 7); +} break; +case 7 : +case 39 : +case 135 : +case 167 : +{ + P0 = I31(4, 3); + P1 = I31(4, 5); + P2 = I211(4, 3, 7); + P3 = I211(4, 5, 7); +} break; +case 8 : +case 12 : +case 136 : +case 140 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + P2 = I31(4, 6); + P3 = I211(4, 5, 7); +} break; +case 9 : +case 13 : +case 137 : +case 141 : +{ + P0 = I31(4, 1); + P1 = I211(4, 1, 5); + P2 = I31(4, 6); + P3 = I211(4, 5, 7); +} break; +case 10 : +case 138 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 11 : +case 139 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 14 : +case 142 : +{ + P2 = I31(4, 6); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = I31(4, 0); + P1 = I31(4, 5); + } else { + P0 = I332(1, 3, 4); + P1 = I521(4, 1, 5); + } +} break; +case 15 : +case 143 : +{ + P2 = I31(4, 6); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = IC(4); + P1 = I31(4, 5); + } else { + P0 = I332(1, 3, 4); + P1 = I521(4, 1, 5); + } +} break; +case 16 : +case 17 : +case 48 : +case 49 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + P2 = I211(4, 3, 7); + P3 = I31(4, 8); +} break; +case 18 : +case 50 : +{ + P0 = I31(4, 0); + P2 = I211(4, 3, 7); + P3 = I31(4, 8); + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 19 : +case 51 : +{ + P2 = I211(4, 3, 7); + P3 = I31(4, 8); + if (MUR) { + P0 = I31(4, 3); + P1 = I31(4, 2); + } else { + P0 = I521(4, 1, 3); + P1 = I332(1, 5, 4); + } +} break; +case 20 : +case 21 : +case 52 : +case 53 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 1); + P2 = I211(4, 3, 7); + P3 = I31(4, 8); +} break; +case 22 : +case 54 : +{ + P0 = I31(4, 0); + P2 = I211(4, 3, 7); + P3 = I31(4, 8); + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 23 : +case 55 : +{ + P2 = I211(4, 3, 7); + P3 = I31(4, 8); + if (MUR) { + P0 = I31(4, 3); + P1 = IC(4); + } else { + P0 = I521(4, 1, 3); + P1 = I332(1, 5, 4); + } +} break; +case 24 : +case 66 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 25 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 26 : +case 31 : +case 95 : +{ + P2 = I31(4, 6); + P3 = I31(4, 8); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 27 : +case 75 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 8); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 28 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 29 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 30 : +case 86 : +{ + P0 = I31(4, 0); + P2 = I31(4, 6); + P3 = I31(4, 8); + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 40 : +case 44 : +case 168 : +case 172 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + P2 = I31(4, 7); + P3 = I211(4, 5, 7); +} break; +case 41 : +case 45 : +case 169 : +case 173 : +{ + P0 = I31(4, 1); + P1 = I211(4, 1, 5); + P2 = I31(4, 7); + P3 = I211(4, 5, 7); +} break; +case 42 : +case 170 : +{ + P1 = I31(4, 2); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = I31(4, 0); + P2 = I31(4, 7); + } else { + P0 = I332(1, 3, 4); + P2 = I521(4, 3, 7); + } +} break; +case 43 : +case 171 : +{ + P1 = I31(4, 2); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = IC(4); + P2 = I31(4, 7); + } else { + P0 = I332(1, 3, 4); + P2 = I521(4, 3, 7); + } +} break; +case 46 : +case 174 : +{ + P1 = I31(4, 5); + P2 = I31(4, 7); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } +} break; +case 47 : +case 175 : +{ + P1 = I31(4, 5); + P2 = I31(4, 7); + P3 = I211(4, 5, 7); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 56 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 7); + P3 = I31(4, 8); +} break; +case 57 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + P2 = I31(4, 7); + P3 = I31(4, 8); +} break; +case 58 : +{ + P2 = I31(4, 7); + P3 = I31(4, 8); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 59 : +{ + P2 = I31(4, 7); + P3 = I31(4, 8); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 60 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + P2 = I31(4, 7); + P3 = I31(4, 8); +} break; +case 61 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + P2 = I31(4, 7); + P3 = I31(4, 8); +} break; +case 62 : +{ + P0 = I31(4, 0); + P2 = I31(4, 7); + P3 = I31(4, 8); + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 63 : +{ + P2 = I31(4, 7); + P3 = I31(4, 8); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 64 : +case 65 : +case 68 : +case 69 : +{ + P0 = I211(4, 1, 3); + P1 = I211(4, 1, 5); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 67 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 70 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 71 : +{ + P0 = I31(4, 3); + P1 = I31(4, 5); + P2 = I31(4, 6); + P3 = I31(4, 8); +} break; +case 72 : +case 76 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I211(4, 3, 7); + } +} break; +case 73 : +case 77 : +{ + P1 = I211(4, 1, 5); + P3 = I31(4, 8); + if (MDL) { + P0 = I31(4, 1); + P2 = I31(4, 6); + } else { + P0 = I521(4, 3, 1); + P2 = I332(3, 7, 4); + } +} break; +case 74 : +case 107 : +case 123 : +{ + P1 = I31(4, 2); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 78 : +{ + P1 = I31(4, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } +} break; +case 79 : +{ + P1 = I31(4, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 80 : +case 81 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 82 : +case 214 : +case 222 : +{ + P0 = I31(4, 0); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 83 : +{ + P0 = I31(4, 3); + P2 = I31(4, 6); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 84 : +case 85 : +{ + P0 = I211(4, 1, 3); + P2 = I31(4, 6); + if (MDR) { + P1 = I31(4, 1); + P3 = I31(4, 8); + } else { + P1 = I521(4, 5, 1); + P3 = I332(5, 7, 4); + } +} break; +case 87 : +{ + P0 = I31(4, 3); + P2 = I31(4, 6); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 88 : +case 248 : +case 250 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 89 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } +} break; +case 90 : +{ + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 91 : +{ + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 92 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } +} break; +case 93 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } +} break; +case 94 : +{ + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 96 : +case 97 : +case 100 : +case 101 : +{ + P0 = I211(4, 1, 3); + P1 = I211(4, 1, 5); + P2 = I31(4, 3); + P3 = I31(4, 8); +} break; +case 98 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 3); + P3 = I31(4, 8); +} break; +case 99 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I31(4, 3); + P3 = I31(4, 8); +} break; +case 102 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P2 = I31(4, 3); + P3 = I31(4, 8); +} break; +case 103 : +{ + P0 = I31(4, 3); + P1 = I31(4, 5); + P2 = I31(4, 3); + P3 = I31(4, 8); +} break; +case 104 : +case 108 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } +} break; +case 105 : +case 109 : +{ + P1 = I211(4, 1, 5); + P3 = I31(4, 8); + if (MDL) { + P0 = I31(4, 1); + P2 = IC(4); + } else { + P0 = I521(4, 3, 1); + P2 = I332(3, 7, 4); + } +} break; +case 106 : +case 120 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } +} break; +case 110 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } +} break; +case 111 : +{ + P1 = I31(4, 5); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 112 : +case 113 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + if (MDR) { + P2 = I31(4, 3); + P3 = I31(4, 8); + } else { + P2 = I521(4, 7, 3); + P3 = I332(5, 7, 4); + } +} break; +case 114 : +{ + P0 = I31(4, 0); + P2 = I31(4, 3); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 115 : +{ + P0 = I31(4, 3); + P2 = I31(4, 3); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 116 : +case 117 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 1); + P2 = I31(4, 3); + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } +} break; +case 118 : +{ + P0 = I31(4, 0); + P2 = I31(4, 3); + P3 = I31(4, 8); + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 119 : +{ + P2 = I31(4, 3); + P3 = I31(4, 8); + if (MUR) { + P0 = I31(4, 3); + P1 = IC(4); + } else { + P0 = I521(4, 1, 3); + P1 = I332(1, 5, 4); + } +} break; +case 121 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } +} break; +case 122 : +{ + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MDR) { + P3 = I31(4, 8); + } else { + P3 = I611(4, 5, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 124 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } +} break; +case 125 : +{ + P1 = I31(4, 1); + P3 = I31(4, 8); + if (MDL) { + P0 = I31(4, 1); + P2 = IC(4); + } else { + P0 = I521(4, 3, 1); + P2 = I332(3, 7, 4); + } +} break; +case 126 : +{ + P0 = I31(4, 0); + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 127 : +{ + P3 = I31(4, 8); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 144 : +case 145 : +case 176 : +case 177 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + P2 = I211(4, 3, 7); + P3 = I31(4, 7); +} break; +case 146 : +case 178 : +{ + P0 = I31(4, 0); + P2 = I211(4, 3, 7); + if (MUR) { + P1 = I31(4, 2); + P3 = I31(4, 7); + } else { + P1 = I332(1, 5, 4); + P3 = I521(4, 5, 7); + } +} break; +case 147 : +case 179 : +{ + P0 = I31(4, 3); + P2 = I211(4, 3, 7); + P3 = I31(4, 7); + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 148 : +case 149 : +case 180 : +case 181 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 1); + P2 = I211(4, 3, 7); + P3 = I31(4, 7); +} break; +case 150 : +case 182 : +{ + P0 = I31(4, 0); + P2 = I211(4, 3, 7); + if (MUR) { + P1 = IC(4); + P3 = I31(4, 7); + } else { + P1 = I332(1, 5, 4); + P3 = I521(4, 5, 7); + } +} break; +case 151 : +case 183 : +{ + P0 = I31(4, 3); + P2 = I211(4, 3, 7); + P3 = I31(4, 7); + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 152 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 7); +} break; +case 153 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 7); +} break; +case 154 : +{ + P2 = I31(4, 6); + P3 = I31(4, 7); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 155 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 7); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 156 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + P2 = I31(4, 6); + P3 = I31(4, 7); +} break; +case 157 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + P2 = I31(4, 6); + P3 = I31(4, 7); +} break; +case 158 : +{ + P2 = I31(4, 6); + P3 = I31(4, 7); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 159 : +{ + P2 = I31(4, 6); + P3 = I31(4, 7); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 184 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 7); + P3 = I31(4, 7); +} break; +case 185 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + P2 = I31(4, 7); + P3 = I31(4, 7); +} break; +case 186 : +{ + P2 = I31(4, 7); + P3 = I31(4, 7); + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 187 : +{ + P1 = I31(4, 2); + P3 = I31(4, 7); + if (MUL) { + P0 = IC(4); + P2 = I31(4, 7); + } else { + P0 = I332(1, 3, 4); + P2 = I521(4, 3, 7); + } +} break; +case 188 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + P2 = I31(4, 7); + P3 = I31(4, 7); +} break; +case 189 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + P2 = I31(4, 7); + P3 = I31(4, 7); +} break; +case 190 : +{ + P0 = I31(4, 0); + P2 = I31(4, 7); + if (MUR) { + P1 = IC(4); + P3 = I31(4, 7); + } else { + P1 = I332(1, 5, 4); + P3 = I521(4, 5, 7); + } +} break; +case 191 : +{ + P2 = I31(4, 7); + P3 = I31(4, 7); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 192 : +case 193 : +case 196 : +case 197 : +{ + P0 = I211(4, 1, 3); + P1 = I211(4, 1, 5); + P2 = I31(4, 6); + P3 = I31(4, 5); +} break; +case 194 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 5); +} break; +case 195 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 5); +} break; +case 198 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P2 = I31(4, 6); + P3 = I31(4, 5); +} break; +case 199 : +{ + P0 = I31(4, 3); + P1 = I31(4, 5); + P2 = I31(4, 6); + P3 = I31(4, 5); +} break; +case 200 : +case 204 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + if (MDL) { + P2 = I31(4, 6); + P3 = I31(4, 5); + } else { + P2 = I332(3, 7, 4); + P3 = I521(4, 7, 5); + } +} break; +case 201 : +case 205 : +{ + P0 = I31(4, 1); + P1 = I211(4, 1, 5); + P3 = I31(4, 5); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } +} break; +case 202 : +{ + P1 = I31(4, 2); + P3 = I31(4, 5); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } +} break; +case 203 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + P3 = I31(4, 5); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 206 : +{ + P1 = I31(4, 5); + P3 = I31(4, 5); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } +} break; +case 207 : +{ + P2 = I31(4, 6); + P3 = I31(4, 5); + if (MUL) { + P0 = IC(4); + P1 = I31(4, 5); + } else { + P0 = I332(1, 3, 4); + P1 = I521(4, 1, 5); + } +} break; +case 208 : +case 209 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 210 : +case 216 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 211 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 212 : +case 213 : +{ + P0 = I211(4, 1, 3); + P2 = I31(4, 6); + if (MDR) { + P1 = I31(4, 1); + P3 = IC(4); + } else { + P1 = I521(4, 5, 1); + P3 = I332(5, 7, 4); + } +} break; +case 215 : +{ + P0 = I31(4, 3); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 217 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 218 : +{ + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 219 : +{ + P1 = I31(4, 2); + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 220 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + if (MDL) { + P2 = I31(4, 6); + } else { + P2 = I611(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 221 : +{ + P0 = I31(4, 1); + P2 = I31(4, 6); + if (MDR) { + P1 = I31(4, 1); + P3 = IC(4); + } else { + P1 = I521(4, 5, 1); + P3 = I332(5, 7, 4); + } +} break; +case 223 : +{ + P2 = I31(4, 6); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 224 : +case 225 : +case 228 : +case 229 : +{ + P0 = I211(4, 1, 3); + P1 = I211(4, 1, 5); + P2 = I31(4, 3); + P3 = I31(4, 5); +} break; +case 226 : +{ + P0 = I31(4, 0); + P1 = I31(4, 2); + P2 = I31(4, 3); + P3 = I31(4, 5); +} break; +case 227 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + P2 = I31(4, 3); + P3 = I31(4, 5); +} break; +case 230 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + P2 = I31(4, 3); + P3 = I31(4, 5); +} break; +case 231 : +{ + P0 = I31(4, 3); + P1 = I31(4, 5); + P2 = I31(4, 3); + P3 = I31(4, 5); +} break; +case 232 : +case 236 : +{ + P0 = I31(4, 0); + P1 = I211(4, 1, 5); + if (MDL) { + P2 = IC(4); + P3 = I31(4, 5); + } else { + P2 = I332(3, 7, 4); + P3 = I521(4, 7, 5); + } +} break; +case 233 : +case 237 : +{ + P0 = I31(4, 1); + P1 = I211(4, 1, 5); + P3 = I31(4, 5); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } +} break; +case 234 : +{ + P1 = I31(4, 2); + P3 = I31(4, 5); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = I31(4, 0); + } else { + P0 = I611(4, 1, 3); + } +} break; +case 235 : +{ + P1 = I31(4, 2); + P3 = I31(4, 5); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 238 : +{ + P0 = I31(4, 0); + P1 = I31(4, 5); + if (MDL) { + P2 = IC(4); + P3 = I31(4, 5); + } else { + P2 = I332(3, 7, 4); + P3 = I521(4, 7, 5); + } +} break; +case 239 : +{ + P1 = I31(4, 5); + P3 = I31(4, 5); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 240 : +case 241 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 2); + if (MDR) { + P2 = I31(4, 3); + P3 = IC(4); + } else { + P2 = I521(4, 7, 3); + P3 = I332(5, 7, 4); + } +} break; +case 242 : +{ + P0 = I31(4, 0); + P2 = I31(4, 3); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUR) { + P1 = I31(4, 2); + } else { + P1 = I611(4, 1, 5); + } +} break; +case 243 : +{ + P0 = I31(4, 3); + P1 = I31(4, 2); + if (MDR) { + P2 = I31(4, 3); + P3 = IC(4); + } else { + P2 = I521(4, 7, 3); + P3 = I332(5, 7, 4); + } +} break; +case 244 : +case 245 : +{ + P0 = I211(4, 1, 3); + P1 = I31(4, 1); + P2 = I31(4, 3); + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } +} break; +case 246 : +{ + P0 = I31(4, 0); + P2 = I31(4, 3); + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 247 : +{ + P0 = I31(4, 3); + P2 = I31(4, 3); + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 249 : +{ + P0 = I31(4, 1); + P1 = I31(4, 2); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } +} break; +case 251 : +{ + P1 = I31(4, 2); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 252 : +{ + P0 = I31(4, 0); + P1 = I31(4, 1); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } +} break; +case 253 : +{ + P0 = I31(4, 1); + P1 = I31(4, 1); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } +} break; +case 254 : +{ + P0 = I31(4, 0); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 255 : +{ + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; diff --git a/src/hq3x32.cpp b/src/hq3x32.cpp new file mode 100644 index 0000000..993bbbf --- /dev/null +++ b/src/hq3x32.cpp @@ -0,0 +1,462 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "hq_shared32.h" +#include "System.h" +#include "interp.h" + +#define SIZE_PIXEL 2 // 16bit = 2 bytes +#define PIXELTYPE unsigned short +#define Interp1 Interp1_16 +#define Interp2 Interp2_16 +#define Interp3 Interp3_16 +#define Interp4 Interp4_16 +#define Interp5 Interp5_16 + +void hq3x(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + int i, j; + unsigned int line; + PIXELTYPE c[10]; + + // +----+----+----+ + // | | | | + // | c1 | c2 | c3 | + // +----+----+----+ + // | | | | + // | c4 | c5 | c6 | + // +----+----+----+ + // | | | | + // | c7 | c8 | c9 | + // +----+----+----+ + + for (j=0; j0) || (j0) + { + c[1] = *((PIXELTYPE*)(pIn - line - SIZE_PIXEL)); + c[4] = *((PIXELTYPE*)(pIn - SIZE_PIXEL)); + c[7] = *((PIXELTYPE*)(pIn + line - SIZE_PIXEL)); + } + else + { + c[1] = c[2]; + c[4] = c[5]; + c[7] = c[8]; + } + + if (i> 3; + r = (int)((c[j] & 0xF800)) >> 8; + } else { + b = (int)((c[j] & 0x1F)) << 3; + g = (int)((c[j] & 0x3E0)) >> 2; + r = (int)((c[j] & 0x7C00)) >> 7; + } + const int bright = r+r+r + g+g+g + b+b; + if(bright > maxBright) maxBright = bright; + if(bright < minBright) minBright = bright; + + brightArray[j] = bright; + } + const int diffBright = ((maxBright - minBright) * 7) >> 4; + if(diffBright > 7) + { + #define ABS(x) ((x) < 0 ? -(x) : (x)) + + const int centerBright = brightArray[5]; + if(ABS(brightArray[1] - centerBright) > diffBright) + pattern |= 1 << 0; + if(ABS(brightArray[2] - centerBright) > diffBright) + pattern |= 1 << 1; + if(ABS(brightArray[3] - centerBright) > diffBright) + pattern |= 1 << 2; + if(ABS(brightArray[4] - centerBright) > diffBright) + pattern |= 1 << 3; + if(ABS(brightArray[6] - centerBright) > diffBright) + pattern |= 1 << 4; + if(ABS(brightArray[7] - centerBright) > diffBright) + pattern |= 1 << 5; + if(ABS(brightArray[8] - centerBright) > diffBright) + pattern |= 1 << 6; + if(ABS(brightArray[9] - centerBright) > diffBright) + pattern |= 1 << 7; + } + +#define Diff(x,y) false//(ABS((x) - (y)) > diffBright) +#undef cget +#define cget(x) brightArray[x] +#include "hq3x32.h" +#undef cget +#undef Diff + pIn+=SIZE_PIXEL; + pOut+=3<<1; + } + pIn+=srcPitch-(Xres<<1); + pOut+=dstPitch-(3*Xres<<1); + pOut+=dstPitch<<1; + // pIn+=SIZE_PIXEL; + // pOut+=3*SIZE_PIXEL; + //} + //pIn+=srcPitch-(4*Xres); + //pOut+=dstPitch-(3*Xres*SIZE_PIXEL); + //pOut+=2*dstPitch; + } +} + +#undef Interp1 +#undef Interp2 +#undef Interp3 +#undef Interp4 +#undef Interp5 +#undef SIZE_PIXEL +#undef PIXELTYPE +#define SIZE_PIXEL 4 // 32bit = 4 bytes +#define PIXELTYPE unsigned int + +void hq3x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + unsigned int YUV1, YUV2; + int i, j, k; + unsigned int line; + PIXELTYPE c[10]; + + // +----+----+----+ + // | | | | + // | c1 | c2 | c3 | + // +----+----+----+ + // | | | | + // | c4 | c5 | c6 | + // +----+----+----+ + // | | | | + // | c7 | c8 | c9 | + // +----+----+----+ + + for (j=0; j0) && (j0) + { + c[1] = *((PIXELTYPE*)(pIn - line - SIZE_PIXEL)); + c[4] = *((PIXELTYPE*)(pIn - SIZE_PIXEL)); + c[7] = *((PIXELTYPE*)(pIn + line - SIZE_PIXEL)); + } + else + { + c[1] = c[2]; + c[4] = c[5]; + c[7] = c[8]; + } + + if (i trY ) || + ( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || + ( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) + ) + pattern |= flag; + } + flag <<= 1; + } + +#include "hq3x32.h" + pIn+=SIZE_PIXEL; + pOut+=3<<2; + } + pIn+=srcPitch-(Xres<<2); + pOut+=dstPitch-(3*Xres<<2); + pOut+=dstPitch<<1; + // pIn+=SIZE_PIXEL; + // pOut+=3*SIZE_PIXEL; + //} + //pIn+=srcPitch-(4*Xres); + //pOut+=dstPitch-(3*Xres*SIZE_PIXEL); + //pOut+=2*dstPitch; + } +} + + +void hq3xS32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + int i, j; + unsigned int line; + PIXELTYPE c[10]; + + // +----+----+----+ + // | | | | + // | c1 | c2 | c3 | + // +----+----+----+ + // | | | | + // | c4 | c5 | c6 | + // +----+----+----+ + // | | | | + // | c7 | c8 | c9 | + // +----+----+----+ + + for (j=0; j0) && (j0) + { + c[1] = *((PIXELTYPE*)(pIn - line - SIZE_PIXEL)); + c[4] = *((PIXELTYPE*)(pIn - SIZE_PIXEL)); + c[7] = *((PIXELTYPE*)(pIn + line - SIZE_PIXEL)); + } + else + { + c[1] = c[2]; + c[4] = c[5]; + c[7] = c[8]; + } + + if (i> 8; + const int r = (int)((c[j] & 0xF80000)) >> 16; + const int bright = r+r+r + g+g+g + b+b; + if(bright > maxBright) maxBright = bright; + if(bright < minBright) minBright = bright; + + brightArray[j] = bright; + } + int diffBright = ((maxBright - minBright) * 7) >> 4; + if(diffBright > 7) + { + #define ABS(x) ((x) < 0 ? -(x) : (x)) + + const int centerBright = brightArray[5]; + if(ABS(brightArray[1] - centerBright) > diffBright) + pattern |= 1 << 0; + if(ABS(brightArray[2] - centerBright) > diffBright) + pattern |= 1 << 1; + if(ABS(brightArray[3] - centerBright) > diffBright) + pattern |= 1 << 2; + if(ABS(brightArray[4] - centerBright) > diffBright) + pattern |= 1 << 3; + if(ABS(brightArray[6] - centerBright) > diffBright) + pattern |= 1 << 4; + if(ABS(brightArray[7] - centerBright) > diffBright) + pattern |= 1 << 5; + if(ABS(brightArray[8] - centerBright) > diffBright) + pattern |= 1 << 6; + if(ABS(brightArray[9] - centerBright) > diffBright) + pattern |= 1 << 7; + } + +#define Diff(x,y) false//(ABS((x) - (y)) > diffBright) +#undef cget +#define cget(x) brightArray[x] +#include "hq3x32.h" +#undef cget +#undef Diff + pIn+=SIZE_PIXEL; + pOut+=3<<2; + } + pIn+=srcPitch-(Xres<<2); + pOut+=dstPitch-(3*Xres<<2); + pOut+=dstPitch<<1; + // pIn+=SIZE_PIXEL; + // pOut+=3*SIZE_PIXEL; + //} + //pIn+=srcPitch-(4*Xres); + //pOut+=dstPitch-(3*Xres*SIZE_PIXEL); + //pOut+=2*dstPitch; + } +} \ No newline at end of file diff --git a/src/hq3x32.h b/src/hq3x32.h new file mode 100644 index 0000000..d8a6874 --- /dev/null +++ b/src/hq3x32.h @@ -0,0 +1,3692 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#define PIXEL00_1M Interp1( pOut, c[5], c[1] ); +#define PIXEL00_1U Interp1( pOut, c[5], c[2] ); +#define PIXEL00_1L Interp1( pOut, c[5], c[4] ); +#define PIXEL00_2 Interp2( pOut, c[5], c[4], c[2] ); +#define PIXEL00_4 Interp4( pOut, c[5], c[4], c[2] ); +#define PIXEL00_5 Interp5( pOut, c[4], c[2] ); +#define PIXEL00_C *((PIXELTYPE*)(pOut)) = c[5]; + +#define PIXEL01_1 Interp1( pOut+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL01_3 Interp3( pOut+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL01_6 Interp1( pOut+SIZE_PIXEL, c[2], c[5] ); +#define PIXEL01_C *((PIXELTYPE*)(pOut+SIZE_PIXEL)) = c[5]; + +#define PIXEL02_1M Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3] ); +#define PIXEL02_1U Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL02_1R Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL02_2 Interp2( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] ); +#define PIXEL02_4 Interp4( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] ); +#define PIXEL02_5 Interp5( pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6] ); +#define PIXEL02_C *((PIXELTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#define PIXEL10_1 Interp1( pOut+dstPitch, c[5], c[4] ); +#define PIXEL10_3 Interp3( pOut+dstPitch, c[5], c[4] ); +#define PIXEL10_6 Interp1( pOut+dstPitch, c[4], c[5] ); +#define PIXEL10_C *((PIXELTYPE*)(pOut+dstPitch)) = c[5]; + +#define PIXEL11 *((PIXELTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5]; + +#define PIXEL12_1 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL12_3 Interp3( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL12_6 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5] ); +#define PIXEL12_C *((PIXELTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#define PIXEL20_1M Interp1( pOut+dstPitch+dstPitch, c[5], c[7] ); +#define PIXEL20_1D Interp1( pOut+dstPitch+dstPitch, c[5], c[8] ); +#define PIXEL20_1L Interp1( pOut+dstPitch+dstPitch, c[5], c[4] ); +#define PIXEL20_2 Interp2( pOut+dstPitch+dstPitch, c[5], c[8], c[4] ); +#define PIXEL20_4 Interp4( pOut+dstPitch+dstPitch, c[5], c[8], c[4] ); +#define PIXEL20_5 Interp5( pOut+dstPitch+dstPitch, c[8], c[4] ); +#define PIXEL20_C *((PIXELTYPE*)(pOut+dstPitch+dstPitch)) = c[5]; + +#define PIXEL21_1 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL21_3 Interp3( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL21_6 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5] ); +#define PIXEL21_C *((PIXELTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5]; + +#define PIXEL22_1M Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9] ); +#define PIXEL22_1D Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL22_1R Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL22_2 Interp2( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] ); +#define PIXEL22_4 Interp4( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] ); +#define PIXEL22_5 Interp5( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8] ); +#define PIXEL22_C *((PIXELTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#ifndef cget +#define cget(x) c[x] +#endif + + switch (pattern) + { + case 0: + case 1: + case 4: + case 32: + case 128: + case 5: + case 132: + case 160: + case 33: + case 129: + case 36: + case 133: + case 164: + case 161: + case 37: + case 165: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 2: + case 34: + case 130: + case 162: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 16: + case 17: + case 48: + case 49: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 64: + case 65: + case 68: + case 69: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 8: + case 12: + case 136: + case 140: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 3: + case 35: + case 131: + case 163: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 6: + case 38: + case 134: + case 166: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 20: + case 21: + case 52: + case 53: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 144: + case 145: + case 176: + case 177: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } + case 192: + case 193: + case 196: + case 197: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 96: + case 97: + case 100: + case 101: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 40: + case 44: + case 168: + case 172: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } + case 9: + case 13: + case 137: + case 141: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 18: + case 50: + { + PIXEL00_1M + + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_1M + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 80: + case 81: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 72: + case 76: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_1M + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 10: + case 138: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 66: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 24: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 7: + case 39: + case 135: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 148: + case 149: + case 180: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } + case 224: + case 228: + case 225: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 41: + case 169: + case 45: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } + case 22: + case 54: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 208: + case 209: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 104: + case 108: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 11: + case 139: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 19: + case 51: + { + if (Diff(cget(2), cget(6))) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 146: + case 178: + { + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_1M + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + break; + } + case 84: + case 85: + { + if (Diff(cget(6), cget(8))) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + break; + } + case 112: + case 113: + { + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } + case 200: + case 204: + { + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + break; + } + case 73: + case 77: + { + if (Diff(cget(8), cget(4))) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_1M + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + break; + } + case 42: + case 170: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + break; + } + case 14: + case 142: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 67: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 70: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 28: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 152: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 194: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 98: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 56: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 25: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 26: + case 31: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 82: + case 214: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 88: + case 248: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 74: + case 107: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 27: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 86: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 216: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 106: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 30: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 210: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 120: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 75: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 29: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } + case 198: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 184: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 99: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 57: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 71: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 156: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 226: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 60: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 195: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 102: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 153: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 58: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 83: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 92: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 202: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 78: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } + case 154: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 114: + { + PIXEL00_1M + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 89: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 90: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 55: + case 23: + { + if (Diff(cget(2), cget(6))) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } + case 182: + case 150: + { + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + break; + } + case 213: + case 212: + { + if (Diff(cget(6), cget(8))) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + break; + } + case 241: + case 240: + { + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } + case 236: + case 232: + { + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + break; + } + case 109: + case 105: + { + if (Diff(cget(8), cget(4))) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + break; + } + case 171: + case 43: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + break; + } + case 143: + case 15: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } + case 124: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 203: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 62: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 211: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 118: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 217: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 110: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 155: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 188: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 185: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 61: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 157: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 103: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 227: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 230: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 199: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 220: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 158: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 234: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1R + break; + } + case 242: + { + PIXEL00_1M + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 59: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 121: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 87: + { + PIXEL00_1L + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 79: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1R + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } + case 122: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 94: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 218: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 91: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 229: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 167: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } + case 173: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } + case 181: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } + case 186: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 115: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 93: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 206: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 205: + case 201: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 174: + case 46: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } + case 179: + case 147: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } + case 117: + case 116: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 189: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 231: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } + case 126: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 219: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 125: + { + if (Diff(cget(8), cget(4))) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + PIXEL22_1M + break; + } + case 221: + { + if (Diff(cget(6), cget(8))) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_1U + PIXEL01_1 + PIXEL10_C + PIXEL11 + PIXEL20_1M + break; + } + case 207: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } + case 238: + { + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + break; + } + case 190: + { + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + break; + } + case 187: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL21_1 + PIXEL22_1D + break; + } + case 243: + { + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } + case 119: + { + if (Diff(cget(2), cget(6))) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } + case 237: + case 233: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 175: + case 47: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } + case 183: + case 151: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } + case 245: + case 244: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 250: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 123: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 95: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 222: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 252: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 249: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 235: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 111: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 63: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 159: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 215: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 246: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 254: + { + PIXEL00_1M + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_2 + } + break; + } + case 253: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 251: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_2 + PIXEL21_3 + } + if (Diff(cget(6), cget(8))) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 239: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 127: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_2 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 191: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 223: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + if (Diff(cget(2), cget(6))) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_2 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + if (Diff(cget(6), cget(8))) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 247: + { + PIXEL00_1L + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 255: + { + if (Diff(cget(4), cget(2))) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(cget(2), cget(6))) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(cget(8), cget(4))) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(cget(6), cget(8))) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + } diff --git a/src/hq_shared32.cpp b/src/hq_shared32.cpp new file mode 100644 index 0000000..cca2127 --- /dev/null +++ b/src/hq_shared32.cpp @@ -0,0 +1,414 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "hq_shared32.h" + +const unsigned __int64 reg_blank = 0x0000000000000000; +const unsigned __int64 const7 = 0x0000000700070007; +const unsigned __int64 treshold = 0x0000000000300706; + +void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2) +{ + //*((int*)pc) = (c1*3+c2)/4; + +#ifdef MMX + __asm + { + mov eax, pc + movd mm1, c1 + movd mm2, c2 + movq mm0, mm1 + pslld mm0, 2 + psubd mm0, mm1 + paddd mm0, mm2 + psrld mm0, 2 + movd [eax], mm0 + EMMS + } +#else + __asm + { + mov eax, pc + mov edx, c1 + shl edx, 2 + add edx, c2 + sub edx, c1 + shr edx, 2 + mov [eax], edx + } +#endif +} + +void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) +{ + //*((int*)pc) = (c1*2+c2+c3)/4; + +#ifdef MMX + __asm + { + mov eax, pc + movd mm0, c1 + movd mm1, c2 + movd mm2, c3 + pslld mm0, 1 + paddd mm0, mm1 + paddd mm0, mm2 + psrad mm0, 2 + movd [eax], mm0 + EMMS + } +#else + __asm + { + mov eax, pc + mov edx, c1 + shl edx, 1 + add edx, c2 + add edx, c3 + shr edx, 2 + mov [eax], edx + } +#endif +} + +void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2) +{ + //*((int*)pc) = (c1*7+c2)/8; + //*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) + + // (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3; + +#ifdef MMX + __asm + { + mov eax, pc + movd mm1, c1 + movd mm2, c2 + punpcklbw mm1, reg_blank + punpcklbw mm2, reg_blank + pmullw mm1, const7 + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, reg_blank + movd [eax], mm1 + EMMS + } +#else + __asm + { + mov eax, c1 + mov ebx, c2 + mov ecx, eax + shl ecx, 3 + sub ecx, eax + add ecx, ebx + shr ecx, 3 + mov eax, pc + mov [eax], ecx + } +#endif +} + +void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) +{ + //*((int*)pc) = (c1*2+(c2+c3)*7)/16; + //*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) + + // (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4; + +#ifdef MMX + __asm + { + mov eax, pc + movd mm1, c1 + movd mm2, c2 + movd mm3, c3 + punpcklbw mm1, reg_blank + punpcklbw mm2, reg_blank + punpcklbw mm3, reg_blank + psllw mm1, 1 + paddw mm2, mm3 + pmullw mm2, const7 + paddw mm1, mm2 + psrlw mm1, 4 + packuswb mm1, reg_blank + movd [eax], mm1 + EMMS + } +#else + + __asm + { + mov eax, [c1] + and eax, 0FF00h + shl eax, 1 + mov ecx, [c2] + and ecx, 0FF00h + mov edx, [c3] + and edx, 0FF00h + add ecx, edx + imul ecx, ecx,7 + add eax, ecx + and eax, 0FF000h + + mov ebx, [c1] + and ebx, 0FF00FFh + shl ebx, 1 + mov ecx, [c2] + and ecx, 0FF00FFh + mov edx, [c3] + and edx, 0FF00FFh + add ecx, edx + imul ecx, ecx,7 + add ebx, ecx + and ebx, 0FF00FF0h + + add eax, ebx + shr eax, 4 + + mov ebx, pc + mov [ebx], eax + } +#endif +} + +void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2) +{ + //*((int*)pc) = (c1+c2)/2; + +#ifdef MMX + __asm + { + mov eax, pc + movd mm0, c1 + movd mm1, c2 + paddd mm0, mm1 + psrad mm0, 1 + movd [eax], mm0 + EMMS + } +#else + __asm + { + mov eax, pc + mov edx, c1 + add edx, c2 + shr edx, 1 + mov [eax], edx + } +#endif +} + + +#include "System.h" +#include "interp.h" + +void Interp1_16(unsigned char * pc, unsigned short c1, unsigned short c2) +{ + *((unsigned short*)pc) = interp_16_31(c1, c2); + //*((int*)pc) = (c1*3+c2)/4; +} + +void Interp2_16(unsigned char * pc, unsigned short c1, unsigned short c2, unsigned short c3) +{ + *((unsigned short*)pc) = interp_16_211(c1, c2, c3); + //*((int*)pc) = (c1*2+c2+c3)/4; +} + +void Interp3_16(unsigned char * pc, unsigned short c1, unsigned short c2) +{ + *((unsigned short*)pc) = interp_16_71(c1, c2); +// *((unsigned short*)pc) = (c1*7+c2)/8; +// *((unsigned short*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) + +// (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3; +} + +void Interp4_16(unsigned char * pc, unsigned short c1, unsigned short c2, unsigned short c3) +{ + *((unsigned short*)pc) = interp_16_772(c2, c3, c1); +// *((unsigned short*)pc) = (c1*2+(c2+c3)*7)/16; +// *((unsigned short*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) + +// (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4; +} + +void Interp5_16(unsigned char * pc, unsigned short c1, unsigned short c2) +{ + *((unsigned short*)pc) = interp_16_11(c1, c2); +} + + + + +bool Diff(unsigned int c1, unsigned int c2) +{ + unsigned int + YUV1 = RGBtoYUV(c1), + YUV2 = RGBtoYUV(c2); + + if (YUV1 == YUV2) return false; // Save some processing power + +#ifdef MMX + unsigned int retval; + __asm + { + mov eax, 0x7FFFFFFF + movd mm7, eax ;mm7 = ABS_MASK = 0x7FFFFFFF + + ; Copy source colors in first reg + movd mm0, YUV1 + movd mm1, YUV2 + + mov eax, 0x00FF0000 + movd mm6, eax ;mm6 = Ymask = 0x00FF0000 + + ; Calculate color Y difference + movq mm2, mm0 + movq mm3, mm1 + pand mm2, mm6 + pand mm3, mm6 + psubd mm2, mm3 + pand mm2, mm7 + + mov eax, 0x0000FF00 + movd mm6, eax ;mm6 = Umask = 0x0000FF00 + + ; Calculate color U difference + movq mm3, mm0 + movq mm4, mm1 + pand mm3, mm6 + pand mm4, mm6 + psubd mm3, mm4 + pand mm3, mm7 + + mov eax, 0x000000FF + movd mm6, eax ;mm6 = Vmask = 0x000000FF + + ; Calculate color V difference + movq mm4, mm0 + movq mm5, mm1 + pand mm4, mm6 + pand mm5, mm6 + psubd mm4, mm5 + pand mm4, mm7 + + mov eax, 0x00300000 + movd mm5, eax ;mm5 = trY = 0x00300000 + mov eax, 0x00000700 + movd mm6, eax ;mm6 = trU = 0x00000700 + mov eax, 0x00000006 + movd mm7, eax ;mm7 = trV = 0x00000006 + + ; Compare the results + pcmpgtd mm2, trY + pcmpgtd mm3, trU + pcmpgtd mm4, trV + por mm2, mm3 + por mm2, mm4 + + movd retval, mm2 + + EMMS + } + return (retval != 0); +#else + return + ( abs32((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) || + ( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || + ( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ); +#endif +} + + +unsigned int RGBtoYUV(unsigned int c) +{ // Division through 3 slows down the emulation about 10% !!! +#ifdef MMX + unsigned int retval; + __asm + { + movd mm0, c + movq mm1, mm0 + movq mm2, mm0 ;mm0=mm1=mm2=c + + mov eax, 0x000000FF + movd mm5, eax ;mm5 = REDMASK = 0x000000FF + mov eax, 0x0000FF00 + movd mm6, eax ;mm6 = GREENMASK = 0x0000FF00 + mov eax, 0x00FF0000 + movd mm7, eax ;mm7 = BLUEMASK = 0x00FF0000 + + + pand mm0, mm5 + pand mm1, mm6 + pand mm2, mm7 ;mm0=R mm1=G mm2=B + + movq mm3, mm0 + paddd mm3, mm1 + paddd mm3, mm2 +; psrld mm3, 2 ;mm3=Y +; pslld mm3, 16 + pslld mm3, 14 ;mm3=Y<<16 + + mov eax, 512 + movd mm7, eax ;mm7 = 128 << 2 = 512 + + movq mm4, mm0 + psubd mm4, mm2 +; psrld mm4, 2 +; paddd mm4, mm7 ;mm4=U +; pslld mm4, 8 ;mm4=U<<8 + paddd mm4, mm7 + pslld mm4, 6 + + mov eax, 128 + movd mm7, eax ;mm7 = 128 + + movq mm5, mm1 + pslld mm5, 1 + psubd mm5, mm0 + psubd mm5, mm2 + psrld mm5, 3 + paddd mm5, mm7 ;mm5=V + + paddd mm5, mm4 + paddd mm5, mm3 + + movd retval, mm5 + + EMMS + } + return retval; +#else + unsigned char r, g, b, Y, u, v; + r = (c & 0x000000FF); + g = (c & 0x0000FF00) >> 8; + b = (c & 0x00FF0000) >> 16; + Y = (r + g + b) >> 2; + u = 128 + ((r - b) >> 2); + v = 128 + ((-r + 2*g -b)>>3); + return (Y<<16) + (u<<8) + v; + + // Extremely High Quality Code + //unsigned char r, g, b; + //r = c & 0xFF; + //g = (c >> 8) & 0xFF; + //b = (c >> 16) & 0xFF; + //unsigned char y, u, v; + //y = (0.256788 * r + 0.504129 * g + 0.097906 * b) + 16; + //u = (-0.148223 * r - 0.290993 * g + 0.439216 * b) + 128; + //v = (0.439216 * r - 0.367788 * g - 0.071427 * b) + 128; + //return (y << 16) + (u << 8) + v; +#endif +} \ No newline at end of file diff --git a/src/hq_shared32.h b/src/hq_shared32.h new file mode 100644 index 0000000..2fb46e0 --- /dev/null +++ b/src/hq_shared32.h @@ -0,0 +1,41 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#define abs32(value) (value & 0x7FFFFFFF) +#define abs16(value) (value & 0x7FFF) + +const int Ymask = 0x00FF0000; +const int Umask = 0x0000FF00; +const int Vmask = 0x000000FF; +const int trY = 0x00300000; +const int trU = 0x00000700; +const int trV = 0x00000006; + +void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2); +void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3); +void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2); +void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3); +void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2); +void Interp1_16(unsigned char * pc, unsigned short c1, unsigned short c2); +void Interp2_16(unsigned char * pc, unsigned short c1, unsigned short c2, unsigned short c3); +void Interp3_16(unsigned char * pc, unsigned short c1, unsigned short c2); +void Interp4_16(unsigned char * pc, unsigned short c1, unsigned short c2, unsigned short c3); +void Interp5_16(unsigned char * pc, unsigned short c1, unsigned short c2); +bool Diff(unsigned int c1, unsigned int c2); +unsigned int RGBtoYUV(unsigned int c); \ No newline at end of file diff --git a/src/i386/2xSaImmx.asm b/src/i386/2xSaImmx.asm new file mode 100644 index 0000000..6bef810 --- /dev/null +++ b/src/i386/2xSaImmx.asm @@ -0,0 +1,2109 @@ +;/*---------------------------------------------------------------------* +; * The following (piece of) code, (part of) the 2xSaI engine, * +; * copyright (c) 1999 - 2001 by Derek Liauw Kie Fa. * +; * Non-Commercial use of this software is allowed and is encouraged, * +; * provided that appropriate credit be given. * +; * You may freely modify this code, but I request * +; * that any improvements to the engine be submitted to me, so * +; * that I can implement these improvements in newer versions of * +; * the software. * +; * If you need more information, have any comments or suggestions, * +; * you can e-mail me. My e-mail: derek-liauw@usa.net. * +; *---------------------------------------------------------------------*/ + +;---------------------- +; 2xSaI version 0.59 WIP, soon to become version 0.60 +;---------------------- + +;%define FAR_POINTER + + + + BITS 32 +%ifdef __DJGPP__ + GLOBAL __2xSaILine + GLOBAL __2xSaISuperEagleLine + GLOBAL __2xSaISuper2xSaILine + GLOBAL _Init_2xSaIMMX +%else + GLOBAL _2xSaILine + GLOBAL _2xSaISuperEagleLine + GLOBAL _2xSaISuper2xSaILine + GLOBAL Init_2xSaIMMX +%endif + SECTION .text ALIGN = 32 + +%ifdef FAR_POINTER +;EXTERN_C void _2xSaILine (uint8 *srcPtr, uint32 srcPitch, uint32 width, +; uint8 *dstPtr, uint32 dstPitch, uint16 dstSegment); +%else +;EXTERN_C void _2xSaILine (uint8 *srcPtr, uint32 srcPitch, uint32 width, +; uint8 *dstPtr, uint32 dstPitch); +%endif + +srcPtr equ 8 +deltaPtr equ 12 +srcPitch equ 16 +width equ 20 +dstOffset equ 24 +dstPitch equ 28 +dstSegment equ 32 + + + + +colorB0 equ -2 +colorB1 equ 0 +colorB2 equ 2 +colorB3 equ 4 + +color7 equ -2 +color8 equ 0 +color9 equ 2 + +color4 equ -2 +color5 equ 0 +color6 equ 2 +colorS2 equ 4 + +color1 equ -2 +color2 equ 0 +color3 equ 2 +colorS1 equ 4 + +colorA0 equ -2 +colorA1 equ 0 +colorA2 equ 2 +colorA3 equ 4 + + + + +%ifdef __DJGPP__ +__2xSaISuper2xSaILine: +%else +_2xSaISuper2xSaILine: +%endif +; Store some stuff + push ebp + mov ebp, esp + pushad + +; Prepare the destination +%ifdef FAR_POINTER + ; Set the selector + mov eax, [ebp+dstSegment] + mov fs, ax +%endif + mov edx, [ebp+dstOffset] ; edx points to the screen +; Prepare the source + ; eax points to colorA + mov eax, [ebp+srcPtr] ;eax points to colorA + mov ebx, [ebp+srcPitch] ;ebx contains the source pitch + mov ecx, [ebp+width] ;ecx contains the number of pixels to process + ; eax now points to colorB1 + sub eax, ebx ;eax points to B1 which is the base + +; Main Loop +.Loop: push ecx + + ;-----Check Delta------------------ + mov ecx, [ebp+deltaPtr] + + + ;load source img + movq mm0, [eax+colorB0] + movq mm1, [eax+colorB3] + movq mm2, [eax+ebx+color4] + movq mm3, [eax+ebx+colorS2] + movq mm4, [eax+ebx+ebx+color1] + movq mm5, [eax+ebx+ebx+colorS1] + push eax + add eax, ebx + movq mm6, [eax+ebx+ebx+colorA0] + movq mm7, [eax+ebx+ebx+colorA3] + pop eax + + ;compare to delta + pcmpeqw mm0, [ecx+2+colorB0] + pcmpeqw mm1, [ecx+2+colorB3] + pcmpeqw mm2, [ecx+ebx+2+color4] + pcmpeqw mm3, [ecx+ebx+2+colorS2] + pcmpeqw mm4, [ecx+ebx+ebx+2+color1] + pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] + add ecx, ebx + pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] + pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] + sub ecx, ebx + + + ;compose results + pand mm0, mm1 + pand mm2, mm3 + pand mm4, mm5 + pand mm6, mm7 + pand mm0, mm2 + pand mm4, mm6 + pxor mm7, mm7 + pand mm0, mm4 + movq mm6, [eax+colorB0] + pcmpeqw mm7, mm0 ;did any compare give us a zero ? + + movq [ecx+2+colorB0], mm6 + + packsswb mm7, mm7 + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_PROCESS ;no, so we can skip + + ;End Delta + + ;--------------------------------- + movq mm0, [eax+ebx+color5] + movq mm1, [eax+ebx+color6] + movq mm2, mm0 + movq mm3, mm1 + movq mm4, mm0 + movq mm5, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + movq [I56Pixel], mm0 + movq mm7, mm0 + + ;------------------- + movq mm0, mm7 + movq mm1, mm4 ;5,5,5,6 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + movq [I5556Pixel], mm0 + ;-------------------- + + movq mm0, mm7 + movq mm1, mm5 ;6,6,6,5 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [I5666Pixel], mm0 + + ;------------------------- + ;------------------------- + movq mm0, [eax+ebx+ebx+color2] + movq mm1, [eax+ebx+ebx+color3] + movq mm2, mm0 + movq mm3, mm1 + movq mm4, mm0 + movq mm5, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [I23Pixel], mm0 + movq mm7, mm0 + + ;--------------------- + movq mm0, mm7 + movq mm1, mm4 ;2,2,2,3 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [I2223Pixel], mm0 + + ;---------------------- + movq mm0, mm7 + movq mm1, mm5 ;3,3,3,2 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [I2333Pixel], mm0 + + + ;-------------------- +;//////////////////////////////// +; Decide which "branch" to take +;-------------------------------- + movq mm0, [eax+ebx+color5] + movq mm1, [eax+ebx+color6] + movq mm6, mm0 + movq mm7, mm1 + pcmpeqw mm0, [eax+ebx+ebx+color3] + pcmpeqw mm1, [eax+ebx+ebx+color2] + pcmpeqw mm6, mm7 + + movq mm2, mm0 + movq mm3, mm0 + + pand mm0, mm1 ;colorA == colorD && colorB == colorC + pxor mm7, mm7 + + pcmpeqw mm2, mm7 + pand mm6, mm0 + pand mm2, mm1 ;colorA != colorD && colorB == colorC + + pcmpeqw mm1, mm7 + + pand mm1, mm3 ;colorA == colorD && colorB != colorC + pxor mm0, mm6 + por mm1, mm6 + movq mm7, mm0 + movq [Mask26], mm2 + packsswb mm7, mm7 + movq [Mask35], mm1 + + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_GUESS + +;--------------------------------------------- + movq mm6, mm0 + movq mm4, [eax+ebx+colorA] + movq mm5, [eax+ebx+colorB] + pxor mm7, mm7 + pand mm6, [ONE] + + movq mm0, [eax+colorE] + movq mm1, [eax+ebx+colorG] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+colorF] + movq mm1, [eax+ebx+colorK] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + push eax + add eax, ebx + movq mm0, [eax+ebx+colorH] + movq mm1, [eax+ebx+ebx+colorN] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+ebx+colorL] + movq mm1, [eax+ebx+ebx+colorO] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + pop eax + movq mm1, mm7 + pxor mm0, mm0 + pcmpgtw mm7, mm0 + pcmpgtw mm0, mm1 + + por mm7, [Mask35] + por mm0, [Mask26] + movq [Mask35], mm7 + movq [Mask26], mm0 + +.SKIP_GUESS: + + ;Start the ASSEMBLY !!! eh... compose all the results together to form the final image... + + + movq mm0, [eax+ebx+color5] + movq mm1, [eax+ebx+ebx+color2] + movq mm2, mm0 + movq mm3, mm1 + movq mm4, mm0 + movq mm5, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + ;--------------------------- + + + +%ifdef dfhsdfhsdahdsfhdsfh + + if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) + product2a = INTERPOLATE (color2, color5); + else + if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0) + product2a = INTERPOLATE(color2, color5); + else + product2a = color2; + + if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) + product1a = INTERPOLATE (color2, color5); + else + if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0) + product1a = INTERPOLATE(color2, color5); + else + product1a = color5; + +%endif + + + movq mm7, [Mask26] + movq mm6, [eax+colorB2] + movq mm5, [eax+ebx+ebx+color2] + movq mm4, [eax+ebx+ebx+color1] + pcmpeqw mm4, mm5 + pcmpeqw mm6, mm5 + pxor mm5, mm5 + pand mm7, mm4 + pcmpeqw mm6, mm5 + pand mm7, mm6 + + + + movq mm6, [eax+ebx+ebx+color3] + movq mm5, [eax+ebx+ebx+color2] + movq mm4, [eax+ebx+ebx+color1] + movq mm2, [eax+ebx+color5] + movq mm1, [eax+ebx+color4] + movq mm3, [eax+colorB0] + + pcmpeqw mm2, mm4 + pcmpeqw mm6, mm5 + pcmpeqw mm1, mm5 + pcmpeqw mm3, mm5 + pxor mm5, mm5 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm6, mm1 + pand mm2, mm3 + pand mm6, mm2 + por mm7, mm6 + + + movq mm6, mm7 + pcmpeqw mm6, mm5 + pand mm7, mm0 + + movq mm1, [eax+ebx+color5] + pand mm6, mm1 + por mm7, mm6 + movq [final1a], mm7 ;finished 1a + + + + ;-------------------------------- + + movq mm7, [Mask35] + push eax + add eax, ebx + movq mm6, [eax+ebx+ebx+colorA2] + pop eax + movq mm5, [eax+ebx+color5] + movq mm4, [eax+ebx+color4] + pcmpeqw mm4, mm5 + pcmpeqw mm6, mm5 + pxor mm5, mm5 + pand mm7, mm4 + pcmpeqw mm6, mm5 + pand mm7, mm6 + + + + movq mm6, [eax+ebx+color6] + movq mm5, [eax+ebx+color5] + movq mm4, [eax+ebx+color4] + movq mm2, [eax+ebx+ebx+color2] + movq mm1, [eax+ebx+ebx+color1] + push eax + add eax, ebx + movq mm3, [eax+ebx+ebx+colorA0] + pop eax + + pcmpeqw mm2, mm4 + pcmpeqw mm6, mm5 + pcmpeqw mm1, mm5 + pcmpeqw mm3, mm5 + pxor mm5, mm5 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm6, mm1 + pand mm2, mm3 + pand mm6, mm2 + por mm7, mm6 + + + movq mm6, mm7 + pcmpeqw mm6, mm5 + pand mm7, mm0 + + movq mm1, [eax+ebx+ebx+color2] + pand mm6, mm1 + por mm7, mm6 + movq [final2a], mm7 ;finished 2a + + + ;-------------------------------------------- + + +%ifdef dfhsdfhsdahdsfhdsfh + if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) + product2b = Q_INTERPOLATE (color3, color3, color3, color2); + else + if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3) + product2b = Q_INTERPOLATE (color2, color2, color2, color3); + else + product2b = INTERPOLATE (color2, color3); + + if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) + product1b = Q_INTERPOLATE (color6, color6, color6, color5); + else + if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3) + product1b = Q_INTERPOLATE (color6, color5, color5, color5); + else + product1b = INTERPOLATE (color5, color6); +%endif + + push eax + add eax, ebx + pxor mm7, mm7 + movq mm0, [eax+ebx+ebx+colorA0] + movq mm1, [eax+ebx+ebx+colorA1] + movq mm2, [eax+ebx+ebx+colorA2] + movq mm3, [eax+ebx+ebx+colorA3] + pop eax + movq mm4, [eax+ebx+ebx+color2] + movq mm5, [eax+ebx+ebx+color3] + movq mm6, [eax+ebx+color6] + + pcmpeqw mm6, mm5 + pcmpeqw mm1, mm5 + pcmpeqw mm4, mm2 + pcmpeqw mm0, mm5 + pcmpeqw mm4, mm7 + pcmpeqw mm0, mm7 + pand mm0, mm4 + pand mm6, mm1 + pand mm0, mm6 + + + push eax + add eax, ebx + movq mm1, [eax+ebx+ebx+colorA1] + pop eax + movq mm4, [eax+ebx+ebx+color2] + movq mm5, [eax+ebx+color5] + movq mm6, [eax+ebx+ebx+color3] + + pcmpeqw mm5, mm4 + pcmpeqw mm2, mm4 + pcmpeqw mm1, mm6 + pcmpeqw mm3, mm4 + pcmpeqw mm1, mm7 + pcmpeqw mm3, mm7 + pand mm2, mm5 + pand mm1, mm3 + pand mm1, mm2 + + + movq mm7, mm0 + por mm7, mm1 + + movq mm4, [Mask35] + movq mm3, [Mask26] + + movq mm6, mm4 + pand mm6, mm7 + pxor mm4, mm6 + + movq mm6, mm3 + pand mm6, mm7 + pxor mm3, mm6 + + movq mm2, mm0 + movq mm7, [I2333Pixel] + movq mm6, [I2223Pixel] + movq mm5, [I23Pixel] + + + por mm2, mm4 + pand mm4, [eax+ebx+ebx+color3] + por mm2, mm3 + pand mm3, [eax+ebx+ebx+color2] + por mm2, mm1 + pand mm0, mm7 + pand mm1, mm6 + pxor mm7, mm7 + pcmpeqw mm2, mm7 + por mm0, mm1 + por mm3, mm4 + pand mm2, mm5 + por mm0, mm3 + por mm0, mm2 + movq [final2b], mm0 + + ;----------------------------------- + + + pxor mm7, mm7 + movq mm0, [eax+colorB0] + movq mm1, [eax+colorB1] + movq mm2, [eax+colorB2] + movq mm3, [eax+colorB3] + movq mm4, [eax+ebx+color5] + movq mm5, [eax+ebx+color6] + movq mm6, [eax+ebx+ebx+color3] + + pcmpeqw mm6, mm5 + pcmpeqw mm1, mm5 + pcmpeqw mm4, mm2 + pcmpeqw mm0, mm5 + pcmpeqw mm4, mm7 + pcmpeqw mm0, mm7 + pand mm0, mm4 + pand mm6, mm1 + pand mm0, mm6 + + movq mm1, [eax+colorB1] + movq mm4, [eax+ebx+color5] + movq mm5, [eax+ebx+ebx+color2] + movq mm6, [eax+ebx+color6] + + pcmpeqw mm5, mm4 + pcmpeqw mm2, mm4 + pcmpeqw mm1, mm6 + pcmpeqw mm3, mm4 + pcmpeqw mm1, mm7 + pcmpeqw mm3, mm7 + pand mm2, mm5 + pand mm1, mm3 + pand mm1, mm2 + + + movq mm7, mm0 + por mm7, mm1 + + movq mm4, [Mask35] + movq mm3, [Mask26] + + movq mm6, mm4 + pand mm6, mm7 + pxor mm4, mm6 + + movq mm6, mm3 + pand mm6, mm7 + pxor mm3, mm6 + + movq mm2, mm0 + movq mm7, [I5666Pixel] + movq mm6, [I5556Pixel] + movq mm5, [I56Pixel] + + + por mm2, mm4 + pand mm4, [eax+ebx+color5] + por mm2, mm3 + pand mm3, [eax+ebx+color6] + por mm2, mm1 + pand mm0, mm7 + pand mm1, mm6 + pxor mm7, mm7 + pcmpeqw mm2, mm7 + por mm0, mm1 + por mm3, mm4 + pand mm2, mm5 + por mm0, mm3 + por mm0, mm2 + movq [final1b], mm0 + + ;--------- + + movq mm0, [final1a] + movq mm4, [final2a] + movq mm2, [final1b] + movq mm6, [final2b] + + + movq mm1, mm0 + movq mm5, mm4 + + + punpcklwd mm0, mm2 + punpckhwd mm1, mm2 + + punpcklwd mm4, mm6 + punpckhwd mm5, mm6 + + +%ifdef FAR_POINTER + movq [fs:edx], mm0 + movq [fs:edx+8], mm1 + push edx + add edx, [ebp+dstPitch] + movq [fs:edx], mm4 + movq [fs:edx+8], mm5 + pop edx +%else + movq [edx], mm0 + movq [edx+8], mm1 + push edx + add edx, [ebp+dstPitch] + movq [edx], mm4 + movq [edx+8], mm5 + pop edx +%endif +.SKIP_PROCESS: + mov ecx, [ebp+deltaPtr] + add ecx, 8 + mov [ebp+deltaPtr], ecx + add edx, 16 + add eax, 8 + + pop ecx + sub ecx, 4 + cmp ecx, 0 + jg near .Loop + +; Restore some stuff + popad + mov esp, ebp + pop ebp + emms + ret + + +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- + + + +%ifdef __DJGPP__ +__2xSaISuperEagleLine: +%else +_2xSaISuperEagleLine: +%endif +; Store some stuff + push ebp + mov ebp, esp + pushad + +; Prepare the destination +%ifdef FAR_POINTER + ; Set the selector + mov eax, [ebp+dstSegment] + mov fs, ax +%endif + mov edx, [ebp+dstOffset] ; edx points to the screen +; Prepare the source + ; eax points to colorA + mov eax, [ebp+srcPtr] + mov ebx, [ebp+srcPitch] + mov ecx, [ebp+width] + ; eax now points to colorB1 + sub eax, ebx + +; Main Loop +.Loop: push ecx + + ;-----Check Delta------------------ + mov ecx, [ebp+deltaPtr] + + movq mm0, [eax+colorB0] + movq mm1, [eax+colorB3] + movq mm2, [eax+ebx+color4] + movq mm3, [eax+ebx+colorS2] + movq mm4, [eax+ebx+ebx+color1] + movq mm5, [eax+ebx+ebx+colorS1] + push eax + add eax, ebx + movq mm6, [eax+ebx+ebx+colorA0] + movq mm7, [eax+ebx+ebx+colorA3] + pop eax + + pcmpeqw mm0, [ecx+2+colorB0] + pcmpeqw mm1, [ecx+2+colorB3] + pcmpeqw mm2, [ecx+ebx+2+color4] + pcmpeqw mm3, [ecx+ebx+2+colorS2] + pcmpeqw mm4, [ecx+ebx+ebx+2+color1] + pcmpeqw mm5, [ecx+ebx+ebx+2+colorS1] + add ecx, ebx + pcmpeqw mm6, [ecx+ebx+ebx+2+colorA0] + pcmpeqw mm7, [ecx+ebx+ebx+2+colorA3] + sub ecx, ebx + + + pand mm0, mm1 + pand mm2, mm3 + pand mm4, mm5 + pand mm6, mm7 + pand mm0, mm2 + pand mm4, mm6 + pxor mm7, mm7 + pand mm0, mm4 + movq mm6, [eax+colorB0] + pcmpeqw mm7, mm0 + + movq [ecx+2+colorB0], mm6 + + packsswb mm7, mm7 + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_PROCESS + + ;End Delta + + ;--------------------------------- + movq mm0, [eax+ebx+color5] + movq mm1, [eax+ebx+color6] + movq mm2, mm0 + movq mm3, mm1 + movq mm4, mm0 + movq mm5, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + movq [I56Pixel], mm0 + movq mm7, mm0 + + ;------------------- + movq mm0, mm7 + movq mm1, mm4 ;5,5,5,6 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + movq [product1a], mm0 + ;-------------------- + + movq mm0, mm7 + movq mm1, mm5 ;6,6,6,5 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [product1b], mm0 + + ;------------------------- + ;------------------------- + movq mm0, [eax+ebx+ebx+color2] + movq mm1, [eax+ebx+ebx+color3] + movq mm2, mm0 + movq mm3, mm1 + movq mm4, mm0 + movq mm5, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [I23Pixel], mm0 + movq mm7, mm0 + + ;--------------------- + movq mm0, mm7 + movq mm1, mm4 ;2,2,2,3 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [product2a], mm0 + + ;---------------------- + movq mm0, mm7 + movq mm1, mm5 ;3,3,3,2 + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 + movq [product2b], mm0 + + + ;//////////////////////////////// + ; Decide which "branch" to take + ;-------------------------------- + movq mm4, [eax+ebx+color5] + movq mm5, [eax+ebx+color6] + movq mm6, [eax+ebx+ebx+color3] + movq mm7, [eax+ebx+ebx+color2] + + pxor mm3, mm3 + movq mm0, mm4 + movq mm1, mm5 + + pcmpeqw mm0, mm6 + pcmpeqw mm1, mm7 + pcmpeqw mm1, mm3 + pand mm0, mm1 + movq [Mask35], mm0 + + movq mm0, [eax+ebx+ebx+colorS1] + movq mm1, [eax+ebx+color4] + push eax + add eax, ebx + movq mm2, [eax+ebx+ebx+colorA2] + pop eax + movq mm3, [eax+colorB1] + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm4 + pcmpeqw mm3, mm4 + pand mm0, mm1 + pand mm2, mm3 + por mm0, mm2 + pand mm0, [Mask35] + movq [Mask35b], mm0 + + ;----------- + pxor mm3, mm3 + movq mm0, mm4 + movq mm1, mm5 + + pcmpeqw mm0, mm6 + pcmpeqw mm1, mm7 + pcmpeqw mm0, mm3 + pand mm0, mm1 + movq [Mask26], mm0 + + movq mm0, [eax+ebx+ebx+color1] + movq mm1, [eax+ebx+colorS2] + push eax + add eax, ebx + movq mm2, [eax+ebx+ebx+colorA1] + pop eax + movq mm3, [eax+colorB2] + pcmpeqw mm0, mm5 + pcmpeqw mm1, mm5 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm1 + pand mm2, mm3 + por mm0, mm2 + pand mm0, [Mask26] + movq [Mask26b], mm0 + + ;-------------------- + movq mm0, mm4 + movq mm1, mm5 + movq mm2, mm0 + + pcmpeqw mm2, mm1 + pcmpeqw mm0, mm6 + pcmpeqw mm1, mm7 + pand mm0, mm1 + pand mm2, mm0 + pxor mm0, mm2 + movq mm7, mm0 + + ;------------------ + packsswb mm7, mm7 + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_GUESS + +;--------------------------------------------- +; Map of the pixels: I|E F|J +; G|A B|K +; H|C D|L +; M|N O|P + movq mm6, mm0 + movq mm4, [eax+ebx+color5] + movq mm5, [eax+ebx+color6] + pxor mm7, mm7 + pand mm6, [ONE] + + movq mm0, [eax+colorB1] + movq mm1, [eax+ebx+color4] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+colorB2] + movq mm1, [eax+ebx+colorS2] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + push eax + add eax, ebx + movq mm0, [eax+ebx+color1] + movq mm1, [eax+ebx+ebx+colorA1] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+ebx+colorS1] + movq mm1, [eax+ebx+ebx+colorA2] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + pop eax + movq mm1, mm7 + pxor mm0, mm0 + pcmpgtw mm7, mm0 + pcmpgtw mm0, mm1 + + por mm7, [Mask35] + por mm0, [Mask26] + movq [Mask35], mm7 + movq [Mask26], mm0 + +.SKIP_GUESS: + ;Start the ASSEMBLY !!! + + movq mm4, [Mask35] + movq mm5, [Mask26] + movq mm6, [Mask35b] + movq mm7, [Mask26b] + + movq mm0, [eax+ebx+color5] + movq mm1, [eax+ebx+color6] + movq mm2, [eax+ebx+ebx+color2] + movq mm3, [eax+ebx+ebx+color3] + pcmpeqw mm0, mm2 + pcmpeqw mm1, mm3 + movq mm2, mm4 + movq mm3, mm5 + por mm0, mm1 + por mm2, mm3 + pand mm2, mm0 + pxor mm0, mm2 + movq mm3, mm0 + + movq mm2, mm0 + pxor mm0, mm0 + por mm2, mm4 + pxor mm4, mm6 + por mm2, mm5 + pxor mm5, mm7 + pcmpeqw mm2, mm0 + ;---------------- + + movq mm0, [eax+ebx+color5] + movq mm1, mm3 + por mm1, mm4 + por mm1, mm6 + pand mm0, mm1 + movq mm1, mm5 + pand mm1, [I56Pixel] + por mm0, mm1 + movq mm1, mm7 + pand mm1, [product1b] + por mm0, mm1 + movq mm1, mm2 + pand mm1, [product1a] + por mm0, mm1 + movq [final1a], mm0 + + movq mm0, [eax+ebx+color6] + movq mm1, mm3 + por mm1, mm5 + por mm1, mm7 + pand mm0, mm1 + movq mm1, mm4 + pand mm1, [I56Pixel] + por mm0, mm1 + movq mm1, mm6 + pand mm1, [product1a] + por mm0, mm1 + movq mm1, mm2 + pand mm1, [product1b] + por mm0, mm1 + movq [final1b], mm0 + + movq mm0, [eax+ebx+ebx+color2] + movq mm1, mm3 + por mm1, mm5 + por mm1, mm7 + pand mm0, mm1 + movq mm1, mm4 + pand mm1, [I23Pixel] + por mm0, mm1 + movq mm1, mm6 + pand mm1, [product2b] + por mm0, mm1 + movq mm1, mm2 + pand mm1, [product2a] + por mm0, mm1 + movq [final2a], mm0 + + movq mm0, [eax+ebx+ebx+color3] + movq mm1, mm3 + por mm1, mm4 + por mm1, mm6 + pand mm0, mm1 + movq mm1, mm5 + pand mm1, [I23Pixel] + por mm0, mm1 + movq mm1, mm7 + pand mm1, [product2a] + por mm0, mm1 + movq mm1, mm2 + pand mm1, [product2b] + por mm0, mm1 + movq [final2b], mm0 + + + movq mm0, [final1a] + movq mm2, [final1b] + movq mm1, mm0 + movq mm4, [final2a] + movq mm6, [final2b] + movq mm5, mm4 + punpcklwd mm0, mm2 + punpckhwd mm1, mm2 + punpcklwd mm4, mm6 + punpckhwd mm5, mm6 + + + + +%ifdef FAR_POINTER + movq [fs:edx], mm0 + movq [fs:edx+8], mm1 + push edx + add edx, [ebp+dstPitch] + movq [fs:edx], mm4 + movq [fs:edx+8], mm5 + pop edx +%else + movq [edx], mm0 + movq [edx+8], mm1 + push edx + add edx, [ebp+dstPitch] + movq [edx], mm4 + movq [edx+8], mm5 + pop edx +%endif +.SKIP_PROCESS: + mov ecx, [ebp+deltaPtr] + add ecx, 8 + mov [ebp+deltaPtr], ecx + add edx, 16 + add eax, 8 + + pop ecx + sub ecx, 4 + cmp ecx, 0 + jg near .Loop + +; Restore some stuff + popad + mov esp, ebp + pop ebp + emms + ret + + +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- + + +;This is version 0.50 +colorI equ -2 +colorE equ 0 +colorF equ 2 +colorJ equ 4 + +colorG equ -2 +colorA equ 0 +colorB equ 2 +colorK equ 4 + +colorH equ -2 +colorC equ 0 +colorD equ 2 +colorL equ 4 + +colorM equ -2 +colorN equ 0 +colorO equ 2 +colorP equ 4 + +%ifdef __DJGPP__ +__2xSaILine: +%else +_2xSaILine: +%endif +; Store some stuff + push ebp + mov ebp, esp + pushad + +; Prepare the destination +%ifdef FAR_POINTER + ; Set the selector + mov eax, [ebp+dstSegment] + mov fs, ax +%endif + mov edx, [ebp+dstOffset] ; edx points to the screen +; Prepare the source + ; eax points to colorA + mov eax, [ebp+srcPtr] + mov ebx, [ebp+srcPitch] + mov ecx, [ebp+width] + ; eax now points to colorE + sub eax, ebx + + +; Main Loop +.Loop: push ecx + + ;-----Check Delta------------------ + mov ecx, [ebp+deltaPtr] + + movq mm0, [eax+colorI] + movq mm1, [eax+colorJ] + movq mm2, [eax+ebx+colorG] + movq mm3, [eax+ebx+colorK] + movq mm4, [eax+ebx+ebx+colorH] + movq mm5, [eax+ebx+ebx+colorL] + push eax + add eax, ebx + movq mm6, [eax+ebx+ebx+colorM] + movq mm7, [eax+ebx+ebx+colorP] + pop eax + + pcmpeqw mm0, [ecx+2+colorI] + pcmpeqw mm1, [ecx+2+colorK] + pcmpeqw mm2, [ecx+ebx+2+colorG] + pcmpeqw mm3, [ecx+ebx+2+colorK] + pcmpeqw mm4, [ecx+ebx+ebx+2+colorH] + pcmpeqw mm5, [ecx+ebx+ebx+2+colorL] + add ecx, ebx + pcmpeqw mm6, [ecx+ebx+ebx+2+colorM] + pcmpeqw mm7, [ecx+ebx+ebx+2+colorP] + sub ecx, ebx + + + pand mm0, mm1 + pand mm2, mm3 + pand mm4, mm5 + pand mm6, mm7 + pand mm0, mm2 + pand mm4, mm6 + pxor mm7, mm7 + pand mm0, mm4 + movq mm6, [eax+colorI] + pcmpeqw mm7, mm0 + + movq [ecx+2+colorI], mm6 + + packsswb mm7, mm7 + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_PROCESS + + ;End Delta + + ;--------------------------------- + + +;1 + ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorE) && (colorB == colorL) + movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA + movq mm2, [eax+ebx+colorB] ;mm2 and mm3 contain colorB + + movq mm1, mm0 + movq mm3, mm2 + + pcmpeqw mm0, [eax+ebx+ebx+colorD] + pcmpeqw mm1, [eax+colorE] + pcmpeqw mm2, [eax+ebx+ebx+colorL] + pcmpeqw mm3, [eax+ebx+ebx+colorC] + + pand mm0, mm1 + pxor mm1, mm1 + pand mm0, mm2 + pcmpeqw mm3, mm1 + pand mm0, mm3 ;result in mm0 + + ;if ((colorA == colorC) && (colorB != colorE) && (colorA == colorF) && (colorB == colorJ) + movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA + movq mm6, [eax+ebx+colorB] ;mm6 and mm7 contain colorB + movq mm5, mm4 + movq mm7, mm6 + + pcmpeqw mm4, [eax+ebx+ebx+colorC] + pcmpeqw mm5, [eax+colorF] + pcmpeqw mm6, [eax+colorJ] + pcmpeqw mm7, [eax+colorE] + + pand mm4, mm5 + pxor mm5, mm5 + pand mm4, mm6 + pcmpeqw mm7, mm5 + pand mm4, mm7 ;result in mm4 + + por mm0, mm4 ;combine the masks + movq [Mask1], mm0 + + ;-------------------------------------------- + +;2 + ;if ((colorB == colorC) && (colorA != colorD) && (colorB == colorF) && (colorA == colorH) + movq mm0, [eax+ebx+colorB] ;mm0 and mm1 contain colorB + movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA + movq mm1, mm0 + movq mm3, mm2 + + pcmpeqw mm0, [eax+ebx+ebx+colorC] + pcmpeqw mm1, [eax+colorF] + pcmpeqw mm2, [eax+ebx+ebx+colorH] + pcmpeqw mm3, [eax+ebx+ebx+colorD] + + pand mm0, mm1 + pxor mm1, mm1 + pand mm0, mm2 + pcmpeqw mm3, mm1 + pand mm0, mm3 ;result in mm0 + + ;if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI) + movq mm4, [eax+ebx+colorB] ;mm4 and mm5 contain colorB + movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA + movq mm5, mm4 + movq mm7, mm6 + + pcmpeqw mm4, [eax+ebx+ebx+colorD] + pcmpeqw mm5, [eax+colorE] + pcmpeqw mm6, [eax+colorI] + pcmpeqw mm7, [eax+colorF] + + pand mm4, mm5 + pxor mm5, mm5 + pand mm4, mm6 + pcmpeqw mm7, mm5 + pand mm4, mm7 ;result in mm4 + + por mm0, mm4 ;combine the masks + movq [Mask2], mm0 + + +;interpolate colorA and colorB + movq mm0, [eax+ebx+colorA] + movq mm1, [eax+ebx+colorB] + + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + + ;assemble the pixels + movq mm1, [eax+ebx+colorA] + movq mm2, [eax+ebx+colorB] + + movq mm3, [Mask1] + movq mm5, mm1 + movq mm4, [Mask2] + movq mm6, mm1 + + pand mm1, mm3 + por mm3, mm4 + pxor mm7, mm7 + pand mm2, mm4 + + pcmpeqw mm3, mm7 + por mm1, mm2 + pand mm0, mm3 + + por mm0, mm1 + + punpcklwd mm5, mm0 + punpckhwd mm6, mm0 + +%ifdef FAR_POINTER + movq [fs:edx], mm5 + movq [fs:edx+8], mm6 +%else + movq [edx], mm5 + movq [edx+8], mm6 +%endif + +;------------------------------------------------ +; Create the Nextline +;------------------------------------------------ +;3 ;if ((colorA == colorD) && (colorB != colorC) && (colorA == colorG) && (colorC == colorO) + movq mm0, [eax+ebx+colorA] ;mm0 and mm1 contain colorA + movq mm2, [eax+ebx+ebx+colorC] ;mm2 and mm3 contain colorC + movq mm1, mm0 + movq mm3, mm2 + + push eax + add eax, ebx + pcmpeqw mm0, [eax+ebx+colorD] + pcmpeqw mm1, [eax+colorG] + pcmpeqw mm2, [eax+ebx+ebx+colorO] + pcmpeqw mm3, [eax+colorB] + pop eax + + pand mm0, mm1 + pxor mm1, mm1 + pand mm0, mm2 + pcmpeqw mm3, mm1 + pand mm0, mm3 ;result in mm0 + + ;if ((colorA == colorB) && (colorG != colorC) && (colorA == colorH) && (colorC == colorM) + movq mm4, [eax+ebx+colorA] ;mm4 and mm5 contain colorA + movq mm6, [eax+ebx+ebx+colorC] ;mm6 and mm7 contain colorC + movq mm5, mm4 + movq mm7, mm6 + + push eax + add eax, ebx + pcmpeqw mm4, [eax+ebx+colorH] + pcmpeqw mm5, [eax+colorB] + pcmpeqw mm6, [eax+ebx+ebx+colorM] + pcmpeqw mm7, [eax+colorG] + pop eax + + pand mm4, mm5 + pxor mm5, mm5 + pand mm4, mm6 + pcmpeqw mm7, mm5 + pand mm4, mm7 ;result in mm4 + + por mm0, mm4 ;combine the masks + movq [Mask1], mm0 + ;-------------------------------------------- + +;4 + ;if ((colorB == colorC) && (colorA != colorD) && (colorC == colorH) && (colorA == colorF) + movq mm0, [eax+ebx+ebx+colorC] ;mm0 and mm1 contain colorC + movq mm2, [eax+ebx+colorA] ;mm2 and mm3 contain colorA + movq mm1, mm0 + movq mm3, mm2 + + pcmpeqw mm0, [eax+ebx+colorB] + pcmpeqw mm1, [eax+ebx+ebx+colorH] + pcmpeqw mm2, [eax+colorF] + pcmpeqw mm3, [eax+ebx+ebx+colorD] + + pand mm0, mm1 + pxor mm1, mm1 + pand mm0, mm2 + pcmpeqw mm3, mm1 + pand mm0, mm3 ;result in mm0 + + ;if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI) + movq mm4, [eax+ebx+ebx+colorC] ;mm4 and mm5 contain colorC + movq mm6, [eax+ebx+colorA] ;mm6 and mm7 contain colorA + movq mm5, mm4 + movq mm7, mm6 + + pcmpeqw mm4, [eax+ebx+ebx+colorD] + pcmpeqw mm5, [eax+ebx+colorG] + pcmpeqw mm6, [eax+colorI] + pcmpeqw mm7, [eax+ebx+ebx+colorH] + + pand mm4, mm5 + pxor mm5, mm5 + pand mm4, mm6 + pcmpeqw mm7, mm5 + pand mm4, mm7 ;result in mm4 + + por mm0, mm4 ;combine the masks + movq [Mask2], mm0 + ;---------------------------------------------- + +;interpolate colorA and colorC + movq mm0, [eax+ebx+colorA] + movq mm1, [eax+ebx+ebx+colorC] + + movq mm2, mm0 + movq mm3, mm1 + + pand mm0, [colorMask] + pand mm1, [colorMask] + + psrlw mm0, 1 + psrlw mm1, 1 + + pand mm3, [lowPixelMask] + paddw mm0, mm1 + + pand mm3, mm2 + paddw mm0, mm3 ;mm0 contains the interpolated values + ;------------- + + ;assemble the pixels + movq mm1, [eax+ebx+colorA] + movq mm2, [eax+ebx+ebx+colorC] + + movq mm3, [Mask1] + movq mm4, [Mask2] + + pand mm1, mm3 + pand mm2, mm4 + + por mm3, mm4 + pxor mm7, mm7 + por mm1, mm2 + + pcmpeqw mm3, mm7 + pand mm0, mm3 + por mm0, mm1 + movq [ACPixel], mm0 + +;//////////////////////////////// +; Decide which "branch" to take +;-------------------------------- + movq mm0, [eax+ebx+colorA] + movq mm1, [eax+ebx+colorB] + movq mm6, mm0 + movq mm7, mm1 + pcmpeqw mm0, [eax+ebx+ebx+colorD] + pcmpeqw mm1, [eax+ebx+ebx+colorC] + pcmpeqw mm6, mm7 + + movq mm2, mm0 + movq mm3, mm0 + + pand mm0, mm1 ;colorA == colorD && colorB == colorC + pxor mm7, mm7 + + pcmpeqw mm2, mm7 + pand mm6, mm0 + pand mm2, mm1 ;colorA != colorD && colorB == colorC + + pcmpeqw mm1, mm7 + + pand mm1, mm3 ;colorA == colorD && colorB != colorC + pxor mm0, mm6 + por mm1, mm6 + movq mm7, mm0 + movq [Mask2], mm2 + packsswb mm7, mm7 + movq [Mask1], mm1 + + movd ecx, mm7 + test ecx, ecx + jz near .SKIP_GUESS + +;--------------------------------------------- +; Map of the pixels: I|E F|J +; G|A B|K +; H|C D|L +; M|N O|P + movq mm6, mm0 + movq mm4, [eax+ebx+colorA] + movq mm5, [eax+ebx+colorB] + pxor mm7, mm7 + pand mm6, [ONE] + + movq mm0, [eax+colorE] + movq mm1, [eax+ebx+colorG] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+colorF] + movq mm1, [eax+ebx+colorK] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + push eax + add eax, ebx + movq mm0, [eax+ebx+colorH] + movq mm1, [eax+ebx+ebx+colorN] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + movq mm0, [eax+ebx+colorL] + movq mm1, [eax+ebx+ebx+colorO] + movq mm2, mm0 + movq mm3, mm1 + pcmpeqw mm0, mm4 + pcmpeqw mm1, mm4 + pcmpeqw mm2, mm5 + pcmpeqw mm3, mm5 + pand mm0, mm6 + pand mm1, mm6 + pand mm2, mm6 + pand mm3, mm6 + paddw mm0, mm1 + paddw mm2, mm3 + + pxor mm3, mm3 + pcmpgtw mm0, mm6 + pcmpgtw mm2, mm6 + pcmpeqw mm0, mm3 + pcmpeqw mm2, mm3 + pand mm0, mm6 + pand mm2, mm6 + paddw mm7, mm0 + psubw mm7, mm2 + + pop eax + movq mm1, mm7 + pxor mm0, mm0 + pcmpgtw mm7, mm0 + pcmpgtw mm0, mm1 + + por mm7, [Mask1] + por mm0, [Mask2] + movq [Mask1], mm7 + movq [Mask2], mm0 + +.SKIP_GUESS: + ;---------------------------- + ;interpolate A, B, C and D + movq mm0, [eax+ebx+colorA] + movq mm1, [eax+ebx+colorB] + movq mm4, mm0 + movq mm2, [eax+ebx+ebx+colorC] + movq mm5, mm1 + movq mm3, [qcolorMask] + movq mm6, mm2 + movq mm7, [qlowpixelMask] + + pand mm0, mm3 + pand mm1, mm3 + pand mm2, mm3 + pand mm3, [eax+ebx+ebx+colorD] + + psrlw mm0, 2 + pand mm4, mm7 + psrlw mm1, 2 + pand mm5, mm7 + psrlw mm2, 2 + pand mm6, mm7 + psrlw mm3, 2 + pand mm7, [eax+ebx+ebx+colorD] + + paddw mm0, mm1 + paddw mm2, mm3 + + paddw mm4, mm5 + paddw mm6, mm7 + + paddw mm4, mm6 + paddw mm0, mm2 + psrlw mm4, 2 + pand mm4, [qlowpixelMask] + paddw mm0, mm4 ;mm0 contains the interpolated value of A, B, C and D + +;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + ;assemble the pixels + movq mm1, [Mask1] + movq mm2, [Mask2] + movq mm4, [eax+ebx+colorA] + movq mm5, [eax+ebx+colorB] + pand mm4, mm1 + pand mm5, mm2 + + pxor mm7, mm7 + por mm1, mm2 + por mm4, mm5 + pcmpeqw mm1, mm7 + pand mm0, mm1 + por mm4, mm0 ;mm4 contains the diagonal pixels + + movq mm0, [ACPixel] + movq mm1, mm0 + punpcklwd mm0, mm4 + punpckhwd mm1, mm4 + + push edx + add edx, [ebp+dstPitch] + +%ifdef FAR_POINTER + movq [fs:edx], mm0 + movq [fs:edx+8], mm1 +%else + movq [edx], mm0 + movq [edx+8], mm1 +%endif + pop edx + +.SKIP_PROCESS: + mov ecx, [ebp+deltaPtr] + add ecx, 8 + mov [ebp+deltaPtr], ecx + add edx, 16 + add eax, 8 + + pop ecx + sub ecx, 4 + cmp ecx, 0 + jg near .Loop + +; Restore some stuff + popad + mov esp, ebp + pop ebp + emms + ret + +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- + +%ifdef __DJGPP__ +_Init_2xSaIMMX: +%else +Init_2xSaIMMX: +%endif +; Store some stuff + push ebp + mov ebp, esp + push edx + + +;Damn thing doesn't work +; mov eax,1 +; cpuid +; test edx, 0x00800000 ;test bit 23 +; jz end2 ;bit not set => no MMX detected + + mov eax, [ebp+8] ;PixelFormat + cmp eax, 555 + jz Bits555 + cmp eax, 565 + jz Bits565 +end2: + mov eax, 1 + jmp end3 +Bits555: + mov edx, 0x7BDE7BDE + mov eax, colorMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0x04210421 + mov eax, lowPixelMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0x739C739C + mov eax, qcolorMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0x0C630C63 + mov eax, qlowpixelMask + mov [eax], edx + mov [eax+4], edx + mov eax, 0 + jmp end3 +Bits565: + mov edx, 0xF7DEF7DE + mov eax, colorMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0x08210821 + mov eax, lowPixelMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0xE79CE79C + mov eax, qcolorMask + mov [eax], edx + mov [eax+4], edx + mov edx, 0x18631863 + mov eax, qlowpixelMask + mov [eax], edx + mov [eax+4], edx + mov eax, 0 + jmp end3 +end3: + pop edx + mov esp, ebp + pop ebp + ret + + +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- +;------------------------------------------------------------------------- + + SECTION .data ALIGN = 32 +;Some constants +colorMask dd 0xF7DEF7DE,0xF7DEF7DE +lowPixelMask dd 0x08210821,0x08210821 + +qcolorMask dd 0xE79CE79C,0xE79CE79C +qlowpixelMask dd 0x18631863,0x18631863 + +darkenMask dd 0xC718C718,0xC718C718 +GreenMask dd 0x07E007E0,0x07E007E0 +RedBlueMask dd 0xF81FF81F,0xF81FF81F + +FALSE dd 0x00000000,0x00000000 +TRUE dd 0xffffffff,0xffffffff +ONE dd 0x00010001,0x00010001 + + + SECTION .bss ALIGN = 32 +ACPixel resb 8 +Mask1 resb 8 +Mask2 resb 8 + +I56Pixel resb 8 +I23Pixel resb 8 +I5556Pixel resb 8 +I2223Pixel resb 8 +I5666Pixel resb 8 +I2333Pixel resb 8 +Mask26 resb 8 +Mask35 resb 8 +Mask26b resb 8 +Mask35b resb 8 +product1a resb 8 +product1b resb 8 +product2a resb 8 +product2b resb 8 +final1a resb 8 +final1b resb 8 +final2a resb 8 +final2b resb 8 diff --git a/src/i386/Makefile.am b/src/i386/Makefile.am new file mode 100644 index 0000000..c82cac3 --- /dev/null +++ b/src/i386/Makefile.am @@ -0,0 +1,8 @@ +SUFFIXES = .asm + +noinst_LIBRARIES = lib386.a + +lib386_a_SOURCES = 2xSaImmx.asm + +.asm.o: + $(NASM) -f elf -o $@ $< diff --git a/src/i386/Makefile.in b/src/i386/Makefile.in new file mode 100644 index 0000000..15cd97f --- /dev/null +++ b/src/i386/Makefile.in @@ -0,0 +1,327 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUFFIXES = .asm + +noinst_LIBRARIES = lib386.a + +lib386_a_SOURCES = 2xSaImmx.asm +subdir = src/i386 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +lib386_a_AR = $(AR) cru +lib386_a_LIBADD = +am_lib386_a_OBJECTS = 2xSaImmx.$(OBJEXT) +lib386_a_OBJECTS = $(am_lib386_a_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) +DIST_SOURCES = $(lib386_a_SOURCES) +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +SOURCES = $(lib386_a_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .asm .o +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/i386/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +lib386.a: $(lib386_a_OBJECTS) $(lib386_a_DEPENDENCIES) + -rm -f lib386.a + $(lib386_a_AR) lib386.a $(lib386_a_OBJECTS) $(lib386_a_LIBADD) + $(RANLIB) lib386.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-generic distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-info-am + + +.asm.o: + $(NASM) -f elf -o $@ $< +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/inputGlobal.h b/src/inputGlobal.h new file mode 100644 index 0000000..9a3ad6e --- /dev/null +++ b/src/inputGlobal.h @@ -0,0 +1,39 @@ +#ifndef _INCLUDED_INPUT_GLOBAL_ + +# define _INCLUDED_INPUT_GLOBAL_ + + enum { + KEY_LEFT, KEY_RIGHT, + KEY_UP, KEY_DOWN, + KEY_BUTTON_A, KEY_BUTTON_B, + KEY_BUTTON_START, KEY_BUTTON_SELECT, + KEY_BUTTON_L, KEY_BUTTON_R, + KEY_BUTTON_SPEED, KEY_BUTTON_CAPTURE, + KEY_BUTTON_GS + }; + +# define BUTTON_MASK_A (0x0001) +# define BUTTON_MASK_B (0x0002) +# define BUTTON_MASK_SELECT (0x0004) +# define BUTTON_MASK_START (0x0008) +# define BUTTON_MASK_RIGHT (0x0010) +# define BUTTON_MASK_LEFT (0x0020) +# define BUTTON_MASK_UP (0x0040) +# define BUTTON_MASK_DOWN (0x0080) +# define BUTTON_MASK_R (0x0100) +# define BUTTON_MASK_L (0x0200) +# define BUTTON_REGULAR_MASK (BUTTON_MASK_A|BUTTON_MASK_B|BUTTON_MASK_SELECT|BUTTON_MASK_START|BUTTON_MASK_RIGHT|BUTTON_MASK_LEFT|BUTTON_MASK_UP|BUTTON_MASK_DOWN|BUTTON_MASK_R|BUTTON_MASK_L) +# define BUTTON_MASK_RESET (0x0400) +# define BUTTON_MASK_UNUSED (0x0800) +# define BUTTON_MASK_LEFT_MOTION (0x1000) +# define BUTTON_MASK_RIGHT_MOTION (0x2000) +# define BUTTON_MASK_DOWN_MOTION (0x4000) +# define BUTTON_MASK_UP_MOTION (0x8000) +# define BUTTON_MOTION_MASK (BUTTON_MASK_LEFT_MOTION|BUTTON_MASK_RIGHT_MOTION|BUTTON_MASK_DOWN_MOTION|BUTTON_MASK_UP_MOTION) +# define BUTTON_RECORDINGONLY_MASK (BUTTON_MASK_RESET|BUTTON_MASK_UNUSED|BUTTON_MASK_LEFT_MOTION|BUTTON_MASK_RIGHT_MOTION|BUTTON_MASK_RIGHT_MOTION|BUTTON_MASK_DOWN_MOTION|BUTTON_MASK_UP_MOTION) +# define BUTTON_MASK_SPEED (0x0400) +# define BUTTON_MASK_CAPTURE (0x0800) +# define BUTTON_MASK_GAMESHARK (0x1000) +# define BUTTON_NONRECORDINGONLY_MASK (BUTTON_MASK_SPEED|BUTTON_MASK_CAPTURE|BUTTON_MASK_GAMESHARK) + +#endif \ No newline at end of file diff --git a/src/interframe.cpp b/src/interframe.cpp new file mode 100644 index 0000000..585c0fd --- /dev/null +++ b/src/interframe.cpp @@ -0,0 +1,620 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" +#include +#include + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif + +/* + * Thanks to Kawaks' Mr. K for the code + + Incorporated into vba by Anthony Di Franco +*/ + +static u8 *frm1 = NULL; +static u8 *frm2 = NULL; +static u8 *frm3 = NULL; + +extern int RGB_LOW_BITS_MASK; +extern u32 qRGB_COLOR_MASK[2]; + +static void Init() +{ + frm1 = (u8 *)calloc(322*242,4); + // 1 frame ago + frm2 = (u8 *)calloc(322*242,4); + // 2 frames ago + frm3 = (u8 *)calloc(322*242,4); + // 3 frames ago +} + +void InterframeCleanup() +{ + if(frm1) + free(frm1); + if(frm2) + free(frm2); + if(frm3) + free(frm3); + frm1 = frm2 = frm3 = NULL; +} + +#ifdef MMX +static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = (u16 *)frm1; + u16 *src2 = (u16 *)frm2; + u16 *src3 = (u16 *)frm3; + + int count = width >> 2; + + for(int i = 0; i < height; i++) { +#ifdef __GNUC__ + asm volatile ( + "push %4\n" + "movq 0(%5), %%mm7\n" // colorMask + "0:\n" + "movq 0(%0), %%mm0\n" // src0 + "movq 0(%1), %%mm1\n" // src1 + "movq 0(%2), %%mm2\n" // src2 + "movq 0(%3), %%mm3\n" // src3 + "movq %%mm0, 0(%3)\n" // src3 = src0 + "movq %%mm0, %%mm4\n" + "movq %%mm1, %%mm5\n" + "pcmpeqw %%mm2, %%mm5\n" // src1 == src2 (A) + "pcmpeqw %%mm3, %%mm4\n" // src3 == src0 (B) + "por %%mm5, %%mm4\n" // A | B + "movq %%mm2, %%mm5\n" + "pcmpeqw %%mm0, %%mm5\n" // src0 == src2 (C) + "pcmpeqw %%mm1, %%mm3\n" // src1 == src3 (D) + "por %%mm3, %%mm5\n" // C|D + "pandn %%mm5, %%mm4\n" // (!(A|B))&(C|D) + "movq %%mm0, %%mm2\n" + "pand %%mm7, %%mm2\n" // color & colorMask + "pand %%mm7, %%mm1\n" // src1 & colorMask + "psrlw $1, %%mm2\n" // (color & colorMask) >> 1 (E) + "psrlw $1, %%mm1\n" // (src & colorMask) >> 1 (F) + "paddw %%mm2, %%mm1\n" // E+F + "pand %%mm4, %%mm1\n" // (E+F) & res + "pandn %%mm0, %%mm4\n" // color& !res + + "por %%mm1, %%mm4\n" + "movq %%mm4, 0(%0)\n" // src0 = res + + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $8, %3\n" + + "decl %4\n" + "jnz 0b\n" + "pop %4\n" + "emms\n" + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (src3) + : "r" (count), "r" (qRGB_COLOR_MASK) + ); +#else + __asm { + movq mm7, qword ptr [qRGB_COLOR_MASK]; + mov eax, src0; + mov ebx, src1; + mov ecx, src2; + mov edx, src3; + mov edi, count; + label0: + movq mm0, qword ptr [eax]; // src0 + movq mm1, qword ptr [ebx]; // src1 + movq mm2, qword ptr [ecx]; // src2 + movq mm3, qword ptr [edx]; // src3 + movq qword ptr [edx], mm0; // src3 = src0 + movq mm4, mm0; + movq mm5, mm1; + pcmpeqw mm5, mm2; // src1 == src2 (A) + pcmpeqw mm4, mm3; // src3 == src0 (B) + por mm4, mm5; // A | B + movq mm5, mm2; + pcmpeqw mm5, mm0; // src0 == src2 (C) + pcmpeqw mm3, mm1; // src1 == src3 (D) + por mm5, mm3; // C|D + pandn mm4, mm5; // (!(A|B))&(C|D) + movq mm2, mm0; + pand mm2, mm7; // color & colorMask + pand mm1, mm7; // src1 & colorMask + psrlw mm2, 1; // (color & colorMask) >> 1 (E) + psrlw mm1, 1; // (src & colorMask) >> 1 (F) + paddw mm1, mm2; // E+F + pand mm1, mm4; // (E+F) & res + pandn mm4, mm0; // color & !res + + por mm4, mm1; + movq qword ptr [eax], mm4; // src0 = res + + add eax, 8; + add ebx, 8; + add ecx, 8; + add edx, 8; + + dec edi; + jnz label0; + mov src0, eax; + mov src1, ebx; + mov src2, ecx; + mov src3, edx; + emms; + } +#endif + src0+=2; + src1+=2; + src2+=2; + src3+=2; + } + + /* Swap buffers around */ + u8 *temp = frm1; + frm1 = frm3; + frm3 = frm2; + frm2 = temp; +} +#endif + +void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + if(frm1 == NULL) { + Init(); + } +#ifdef MMX + if(cpu_mmx) { + SmartIB_MMX(srcPtr, srcPitch, width, height); + return; + } +#endif + + u16 colorMask = ~RGB_LOW_BITS_MASK; + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = (u16 *)frm1; + u16 *src2 = (u16 *)frm2; + u16 *src3 = (u16 *)frm3; + + int sPitch = srcPitch >> 1; + + int pos = 0; + for (int j = 0; j < height; j++) + for (int i = 0; i < sPitch; i++) { + u16 color = src0[pos]; + src0[pos] = + (src1[pos] != src2[pos]) && + (src3[pos] != color) && + ((color == src2[pos]) || (src1[pos] == src3[pos])) + ? (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)) : + color; + src3[pos] = color; /* oldest buffer now holds newest frame */ + pos++; + } + + /* Swap buffers around */ + u8 *temp = frm1; + frm1 = frm3; + frm3 = frm2; + frm2 = temp; +} + +#ifdef MMX +static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = (u32 *)frm1; + u32 *src2 = (u32 *)frm2; + u32 *src3 = (u32 *)frm3; + + int count = width >> 1; + + for(int i = 0; i < height; i++) { +#ifdef __GNUC__ + asm volatile ( + "push %4\n" + "movq 0(%5), %%mm7\n" // colorMask + "0:\n" + "movq 0(%0), %%mm0\n" // src0 + "movq 0(%1), %%mm1\n" // src1 + "movq 0(%2), %%mm2\n" // src2 + "movq 0(%3), %%mm3\n" // src3 + "movq %%mm0, 0(%3)\n" // src3 = src0 + "movq %%mm0, %%mm4\n" + "movq %%mm1, %%mm5\n" + "pcmpeqd %%mm2, %%mm5\n" // src1 == src2 (A) + "pcmpeqd %%mm3, %%mm4\n" // src3 == src0 (B) + "por %%mm5, %%mm4\n" // A | B + "movq %%mm2, %%mm5\n" + "pcmpeqd %%mm0, %%mm5\n" // src0 == src2 (C) + "pcmpeqd %%mm1, %%mm3\n" // src1 == src3 (D) + "por %%mm3, %%mm5\n" // C|D + "pandn %%mm5, %%mm4\n" // (!(A|B))&(C|D) + "movq %%mm0, %%mm2\n" + "pand %%mm7, %%mm2\n" // color & colorMask + "pand %%mm7, %%mm1\n" // src1 & colorMask + "psrld $1, %%mm2\n" // (color & colorMask) >> 1 (E) + "psrld $1, %%mm1\n" // (src & colorMask) >> 1 (F) + "paddd %%mm2, %%mm1\n" // E+F + "pand %%mm4, %%mm1\n" // (E+F) & res + "pandn %%mm0, %%mm4\n" // color& !res + + "por %%mm1, %%mm4\n" + "movq %%mm4, 0(%0)\n" // src0 = res + + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $8, %3\n" + + "decl %4\n" + "jnz 0b\n" + "pop %4\n" + "emms\n" + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (src3) + : "r" (count), "r" (qRGB_COLOR_MASK) + ); +#else + __asm { + movq mm7, qword ptr [qRGB_COLOR_MASK]; + mov eax, src0; + mov ebx, src1; + mov ecx, src2; + mov edx, src3; + mov edi, count; + label0: + movq mm0, qword ptr [eax]; // src0 + movq mm1, qword ptr [ebx]; // src1 + movq mm2, qword ptr [ecx]; // src2 + movq mm3, qword ptr [edx]; // src3 + movq qword ptr [edx], mm0; // src3 = src0 + movq mm4, mm0; + movq mm5, mm1; + pcmpeqd mm5, mm2; // src1 == src2 (A) + pcmpeqd mm4, mm3; // src3 == src0 (B) + por mm4, mm5; // A | B + movq mm5, mm2; + pcmpeqd mm5, mm0; // src0 == src2 (C) + pcmpeqd mm3, mm1; // src1 == src3 (D) + por mm5, mm3; // C|D + pandn mm4, mm5; // (!(A|B))&(C|D) + movq mm2, mm0; + pand mm2, mm7; // color & colorMask + pand mm1, mm7; // src1 & colorMask + psrld mm2, 1; // (color & colorMask) >> 1 (E) + psrld mm1, 1; // (src & colorMask) >> 1 (F) + paddd mm1, mm2; // E+F + pand mm1, mm4; // (E+F) & res + pandn mm4, mm0; // color & !res + + por mm4, mm1; + movq qword ptr [eax], mm4; // src0 = res + + add eax, 8; + add ebx, 8; + add ecx, 8; + add edx, 8; + + dec edi; + jnz label0; + mov src0, eax; + mov src1, ebx; + mov src2, ecx; + mov src3, edx; + emms; + } +#endif + + src0++; + src1++; + src2++; + src3++; + } + /* Swap buffers around */ + u8 *temp = frm1; + frm1 = frm3; + frm3 = frm2; + frm2 = temp; +} +#endif + +void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + if(frm1 == NULL) { + Init(); + } +#ifdef MMX + if(cpu_mmx) { + SmartIB32_MMX(srcPtr, srcPitch, width, height); + return; + } +#endif + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = (u32 *)frm1; + u32 *src2 = (u32 *)frm2; + u32 *src3 = (u32 *)frm3; + + u32 colorMask = 0xfefefe; + + int sPitch = srcPitch >> 2; + int pos = 0; + + for (int j = 0; j < height; j++) + for (int i = 0; i < sPitch; i++) { + u32 color = src0[pos]; + src0[pos] = + (src1[pos] != src2[pos]) && + (src3[pos] != color) && + ((color == src2[pos]) || (src1[pos] == src3[pos])) + ? (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)) : + color; + src3[pos] = color; /* oldest buffer now holds newest frame */ + pos++; + } + + /* Swap buffers around */ + u8 *temp = frm1; + frm1 = frm3; + frm3 = frm2; + frm2 = temp; +} + +#ifdef MMX +static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = (u16 *)frm1; + + int count = width >> 2; + + for(int i = 0; i < height; i++) { +#ifdef __GNUC__ + asm volatile ( + "push %2\n" + "movq 0(%3), %%mm7\n" // colorMask + "0:\n" + "movq 0(%0), %%mm0\n" // src0 + "movq 0(%1), %%mm1\n" // src1 + "movq %%mm0, 0(%1)\n" // src1 = src0 + "pand %%mm7, %%mm0\n" // color & colorMask + "pand %%mm7, %%mm1\n" // src1 & colorMask + "psrlw $1, %%mm0\n" // (color & colorMask) >> 1 (E) + "psrlw $1, %%mm1\n" // (src & colorMask) >> 1 (F) + "paddw %%mm1, %%mm0\n" // E+F + + "movq %%mm0, 0(%0)\n" // src0 = res + + "addl $8, %0\n" + "addl $8, %1\n" + + "decl %2\n" + "jnz 0b\n" + "pop %2\n" + "emms\n" + : "+r" (src0), "+r" (src1) + : "r" (count), "r" (qRGB_COLOR_MASK) + ); +#else + __asm { + movq mm7, qword ptr [qRGB_COLOR_MASK]; + mov eax, src0; + mov ebx, src1; + mov edi, count; + label0: + movq mm0, qword ptr [eax]; // src0 + movq mm1, qword ptr [ebx]; // src1 + movq qword ptr [ebx], mm0; // src1 = src0 + pand mm0, mm7; // color & colorMask + pand mm1, mm7; // src1 & colorMask + psrlw mm0, 1; // (color & colorMask) >> 1 (E) + psrlw mm1, 1; // (src & colorMask) >> 1 (F) + paddw mm0, mm1; // E+F + + movq qword ptr [eax], mm0; // src0 = res + + add eax, 8; + add ebx, 8; + + dec edi; + jnz label0; + mov src0, eax; + mov src1, ebx; + emms; + } +#endif + src0+=2; + src1+=2; + } +} +#endif + +void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + if(frm1 == NULL) { + Init(); + } + +#ifdef MMX + if(cpu_mmx) { + MotionBlurIB_MMX(srcPtr, srcPitch, width, height); + return; + } +#endif + + u16 colorMask = ~RGB_LOW_BITS_MASK; + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = (u16 *)frm1; + + int sPitch = srcPitch >> 1; + + int pos = 0; + for (int j = 0; j < height; j++) + for (int i = 0; i < sPitch; i++) { + u16 color = src0[pos]; + src0[pos] = + (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)); + src1[pos] = color; + pos++; + } +} + +#ifdef MMX +static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = (u32 *)frm1; + + int count = width >> 1; + + for(int i = 0; i < height; i++) { +#ifdef __GNUC__ + asm volatile ( + "push %2\n" + "movq 0(%3), %%mm7\n" // colorMask + "0:\n" + "movq 0(%0), %%mm0\n" // src0 + "movq 0(%1), %%mm1\n" // src1 + "movq %%mm0, 0(%1)\n" // src1 = src0 + "pand %%mm7, %%mm0\n" // color & colorMask + "pand %%mm7, %%mm1\n" // src1 & colorMask + "psrld $1, %%mm0\n" // (color & colorMask) >> 1 (E) + "psrld $1, %%mm1\n" // (src & colorMask) >> 1 (F) + "paddd %%mm1, %%mm0\n" // E+F + + "movq %%mm0, 0(%0)\n" // src0 = res + + "addl $8, %0\n" + "addl $8, %1\n" + + "decl %2\n" + "jnz 0b\n" + "pop %2\n" + "emms\n" + : "+r" (src0), "+r" (src1) + : "r" (count), "r" (qRGB_COLOR_MASK) + ); +#else + __asm { + movq mm7, qword ptr [qRGB_COLOR_MASK]; + mov eax, src0; + mov ebx, src1; + mov edi, count; + label0: + movq mm0, qword ptr [eax]; // src0 + movq mm1, qword ptr [ebx]; // src1 + movq qword ptr [ebx], mm0; // src1 = src0 + pand mm0, mm7; // color & colorMask + pand mm1, mm7; // src1 & colorMask + psrld mm0, 1; // (color & colorMask) >> 1 (E) + psrld mm1, 1; // (src & colorMask) >> 1 (F) + paddd mm0, mm1; // E+F + + movq qword ptr [eax], mm0; // src0 = res + + add eax, 8; + add ebx, 8; + + dec edi; + jnz label0; + mov src0, eax; + mov src1, ebx; + emms; + } +#endif + src0++; + src1++; + } +} +#endif + +void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + if(frm1 == NULL) { + Init(); + } + +#ifdef MMX + if(cpu_mmx) { + MotionBlurIB32_MMX(srcPtr, srcPitch, width, height); + return; + } +#endif + + u32 *src0 = (u32 *)srcPtr; + u32 *src1 = (u32 *)frm1; + + u32 colorMask = 0xfefefe; + + int sPitch = srcPitch >> 2; + int pos = 0; + + for (int j = 0; j < height; j++) + for (int i = 0; i < sPitch; i++) { + u32 color = src0[pos]; + src0[pos] = (((color & colorMask) >> 1) + + ((src1[pos] & colorMask) >> 1)); + src1[pos] = color; + pos++; + } +} + +static int count = 0; + +void InterlaceIB(u8 *srcPtr, u32 srcPitch, int width, int height) +{ + if(frm1 == NULL) { + Init(); + } + + u16 colorMask = ~RGB_LOW_BITS_MASK; + + u16 *src0 = (u16 *)srcPtr; + u16 *src1 = (u16 *)frm1; + + int sPitch = srcPitch >> 1; + + int pos = 0; + for (int j = 0; j < height; j++) { + bool render = count ? (j & 1) != 0 : (j & 1) == 0; + if(render) { + for (int i = 0; i < sPitch; i++) { + u16 color = src0[pos]; + src0[pos] = + (((color & colorMask) >> 1) + ((((src1[pos] & colorMask) >> 1) & colorMask) >> 1)); + src1[pos] = color; + pos++; + } + } else { + for (int i = 0; i < sPitch; i++) { + u16 color = src0[pos]; + src0[pos] = + (((((color & colorMask) >> 1) & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)); + src1[pos] = color; + pos++; + } + } + } + count = count ^ 1; +} diff --git a/src/interp.h b/src/interp.h new file mode 100644 index 0000000..21d4529 --- /dev/null +++ b/src/interp.h @@ -0,0 +1,351 @@ +/* + * This file is part of the Advance project. + * + * Copyright (C) 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * In addition, as a special exception, Andrea Mazzoleni + * gives permission to link the code of this program with + * the MAME library (or with modified versions of MAME that use the + * same license as MAME), and distribute linked combinations including + * the two. You must obey the GNU General Public License in all + * respects for all of the code used other than MAME. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + +#ifndef __INTERP_H +#define __INTERP_H + +/***************************************************************************/ +/* Basic types */ + +/***************************************************************************/ +/* interpolation */ + +extern unsigned interp_mask[2]; +extern unsigned interp_bits_per_pixel; + +#define INTERP_16_MASK_1(v) (v & interp_mask[0]) +#define INTERP_16_MASK_2(v) (v & interp_mask[1]) + +static inline u16 interp_16_521(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*2 + INTERP_16_MASK_1(p3)*1) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*2 + INTERP_16_MASK_2(p3)*1) / 8); +} + +static inline u16 interp_16_332(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)*2) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)*2) / 8); +} + +static inline u16 interp_16_611(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*6 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*6 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 8); +} + +static inline u16 interp_16_71(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*7 + INTERP_16_MASK_1(p2)) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*7 + INTERP_16_MASK_2(p2)) / 8); +} + +static inline u16 interp_16_211(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*2 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 4) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*2 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 4); +} + +static inline u16 interp_16_772(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1(((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2))*7 + INTERP_16_MASK_1(p3)*2) / 16) + | INTERP_16_MASK_2(((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2))*7 + INTERP_16_MASK_2(p3)*2) / 16); +} + +static inline u16 interp_16_11(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) / 2) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2)) / 2); +} + +static inline u16 interp_16_31(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)) / 4) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)) / 4); +} + +static inline u16 interp_16_1411(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*14 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 16) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*14 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 16); +} + +static inline u16 interp_16_431(u16 p1, u16 p2, u16 p3) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*4 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*4 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)) / 8); +} + +static inline u16 interp_16_53(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*3) / 8) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*3) / 8); +} + +static inline u16 interp_16_151(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*15 + INTERP_16_MASK_1(p2)) / 16) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*15 + INTERP_16_MASK_2(p2)) / 16); +} + +static inline u16 interp_16_97(u16 p1, u16 p2) +{ + return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*9 + INTERP_16_MASK_1(p2)*7) / 16) + | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*9 + INTERP_16_MASK_2(p2)*7) / 16); +} + +#define INTERP_32_MASK_1(v) (v & 0xFF00FF) +#define INTERP_32_MASK_2(v) (v & 0x00FF00) + +static inline u32 interp_32_521(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*2 + INTERP_32_MASK_1(p3)*1) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*2 + INTERP_32_MASK_2(p3)*1) / 8); +} + +static inline u32 interp_32_332(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)*2) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)*2) / 8); +} + +static inline u32 interp_32_211(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*2 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 4) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*2 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 4); +} + +static inline u32 interp_32_611(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*6 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*6 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 8); +} + +static inline u32 interp_32_71(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*7 + INTERP_32_MASK_1(p2)) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*7 + INTERP_32_MASK_2(p2)) / 8); +} + +static inline u32 interp_32_772(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1(((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2))*7 + INTERP_32_MASK_1(p3)*2) / 16) + | INTERP_32_MASK_2(((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2))*7 + INTERP_32_MASK_2(p3)*2) / 16); +} + +static inline u32 interp_32_11(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) / 2) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2)) / 2); +} + +static inline u32 interp_32_31(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)) / 4) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)) / 4); +} + +static inline u32 interp_32_1411(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*14 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 16) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*14 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 16); +} + +static inline u32 interp_32_431(u32 p1, u32 p2, u32 p3) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*4 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*4 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)) / 8); +} + +static inline u32 interp_32_53(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*3) / 8) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*3) / 8); +} + +static inline u32 interp_32_151(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*15 + INTERP_32_MASK_1(p2)) / 16) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*15 + INTERP_32_MASK_2(p2)) / 16); +} + +static inline u32 interp_32_97(u32 p1, u32 p2) +{ + return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*9 + INTERP_32_MASK_1(p2)*7) / 16) + | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*9 + INTERP_32_MASK_2(p2)*7) / 16); +} + +/***************************************************************************/ +/* diff */ + +#define INTERP_Y_LIMIT (0x30*4) +#define INTERP_U_LIMIT (0x07*4) +#define INTERP_V_LIMIT (0x06*8) + +static int interp_16_diff(u16 p1, u16 p2) +{ + int r, g, b; + int y, u, v; + + if (p1 == p2) + return 0; + + if (interp_bits_per_pixel == 16) { + b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; + g = (int)((p1 & 0x7E0) - (p2 & 0x7E0)) >> 3; + r = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8; + } else { + b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; + g = (int)((p1 & 0x3E0) - (p2 & 0x3E0)) >> 2; + r = (int)((p1 & 0x7C00) - (p2 & 0x7C00)) >> 7; + } + + y = r + g + b; + u = r - b; + v = -r + 2*g - b; + + if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) + return 1; + + if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) + return 1; + + if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) + return 1; + +return 0; +} + +static int interp_32_diff(u32 p1, u32 p2) +{ + int r, g, b; + int y, u, v; + + if ((p1 & 0xF8F8F8) == (p2 & 0xF8F8F8)) + return 0; + + b = (int)((p1 & 0xFF) - (p2 & 0xFF)); + g = (int)((p1 & 0xFF00) - (p2 & 0xFF00)) >> 8; + r = (int)((p1 & 0xFF0000) - (p2 & 0xFF0000)) >> 16; + + y = r + g + b; + u = r - b; + v = -r + 2*g - b; + + if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) + return 1; + + if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) + return 1; + + if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) + return 1; + + return 0; +} + + +#define INTERP_LIMIT2 (96000) +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define MIN(x,y) ((x) < (y) ? (x) : (y)) + +static int interp_16_diff2(u16 p1, u16 p2) +{ + int r, g, b; + int y, u, v; + + if ((p1 & 0xF79E) == (p2 & 0xF79E)) + return 0; + + if (interp_bits_per_pixel == 16) { + b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; + g = (int)((p1 & 0x7E0) - (p2 & 0x7E0)) >> 3; + r = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8; + } else { + b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; + g = (int)((p1 & 0x3E0) - (p2 & 0x3E0)) >> 2; + r = (int)((p1 & 0x7C00) - (p2 & 0x7C00)) >> 7; + } + +// yb = 30*r + 58*g + 12*b; + y = 33*r + 36*g + 31*b; + u = -14*r - 29*g + 44*b; + v = 62*r - 51*g - 10*b; + + if (11*ABS(y) + 8*ABS(u) + 6*ABS(v) > INTERP_LIMIT2) + return 1; + return 0; +} + +static int interp_32_diff2(u32 p1, u32 p2) +{ + int r, g, b; + int y, u, v; + + if ((p1 & 0xF0F0F0) == (p2 & 0xF0F0F0)) + return 0; + + b = (int)((p1 & 0xF8) - (p2 & 0xF8)); + g = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8; + r = (int)((p1 & 0xF80000) - (p2 & 0xF80000)) >> 16; + +// y = 30*r + 58*g + 12*b; + y = 33*r + 36*g + 31*b; + u = -14*r - 29*g + 44*b; + v = 62*r - 51*g - 10*b; + + if (11*ABS(y) + 8*ABS(u) + 6*ABS(v) > INTERP_LIMIT2) + return 1; + + return 0; +} + +static void interp_set(unsigned bits_per_pixel) +{ + interp_bits_per_pixel = bits_per_pixel; + + switch (bits_per_pixel) { + case 15 : + interp_mask[0] = 0x7C1F; + interp_mask[1] = 0x03E0; + break; + case 16 : + interp_mask[0] = 0xF81F; + interp_mask[1] = 0x07E0; + break; + case 32 : + interp_mask[0] = 0xFF00FF; + interp_mask[1] = 0x00FF00; + break; + } +} + +#endif diff --git a/src/lq2x.h b/src/lq2x.h new file mode 100644 index 0000000..b005355 --- /dev/null +++ b/src/lq2x.h @@ -0,0 +1,1284 @@ +case 0 : +case 2 : +case 4 : +case 6 : +case 8 : +case 12 : +case 16 : +case 20 : +case 24 : +case 28 : +case 32 : +case 34 : +case 36 : +case 38 : +case 40 : +case 44 : +case 48 : +case 52 : +case 56 : +case 60 : +case 64 : +case 66 : +case 68 : +case 70 : +case 96 : +case 98 : +case 100 : +case 102 : +case 128 : +case 130 : +case 132 : +case 134 : +case 136 : +case 140 : +case 144 : +case 148 : +case 152 : +case 156 : +case 160 : +case 162 : +case 164 : +case 166 : +case 168 : +case 172 : +case 176 : +case 180 : +case 184 : +case 188 : +case 192 : +case 194 : +case 196 : +case 198 : +case 224 : +case 226 : +case 228 : +case 230 : +{ + P0 = IC(0); + P1 = IC(0); + P2 = IC(0); + P3 = IC(0); +} break; +case 1 : +case 5 : +case 9 : +case 13 : +case 17 : +case 21 : +case 25 : +case 29 : +case 33 : +case 37 : +case 41 : +case 45 : +case 49 : +case 53 : +case 57 : +case 61 : +case 65 : +case 69 : +case 97 : +case 101 : +case 129 : +case 133 : +case 137 : +case 141 : +case 145 : +case 149 : +case 153 : +case 157 : +case 161 : +case 165 : +case 169 : +case 173 : +case 177 : +case 181 : +case 185 : +case 189 : +case 193 : +case 197 : +case 225 : +case 229 : +{ + P0 = IC(1); + P1 = IC(1); + P2 = IC(1); + P3 = IC(1); +} break; +case 3 : +case 35 : +case 67 : +case 99 : +case 131 : +case 163 : +case 195 : +case 227 : +{ + P0 = IC(2); + P1 = IC(2); + P2 = IC(2); + P3 = IC(2); +} break; +case 7 : +case 39 : +case 71 : +case 103 : +case 135 : +case 167 : +case 199 : +case 231 : +{ + P0 = IC(3); + P1 = IC(3); + P2 = IC(3); + P3 = IC(3); +} break; +case 10 : +case 138 : +{ + P1 = IC(0); + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + } else { + P0 = I211(0, 1, 3); + } +} break; +case 11 : +case 27 : +case 75 : +case 139 : +case 155 : +case 203 : +{ + P1 = IC(2); + P2 = IC(2); + P3 = IC(2); + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } +} break; +case 14 : +case 142 : +{ + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + P1 = IC(0); + } else { + P0 = I332(1, 3, 0); + P1 = I31(0, 1); + } +} break; +case 15 : +case 143 : +case 207 : +{ + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + P1 = IC(4); + } else { + P0 = I332(1, 3, 4); + P1 = I31(4, 1); + } +} break; +case 18 : +case 22 : +case 30 : +case 50 : +case 54 : +case 62 : +case 86 : +case 118 : +{ + P0 = IC(0); + P2 = IC(0); + P3 = IC(0); + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 19 : +case 51 : +{ + P2 = IC(2); + P3 = IC(2); + if (MUR) { + P0 = IC(2); + P1 = IC(2); + } else { + P0 = I31(2, 1); + P1 = I332(1, 5, 2); + } +} break; +case 23 : +case 55 : +case 119 : +{ + P2 = IC(3); + P3 = IC(3); + if (MUR) { + P0 = IC(3); + P1 = IC(3); + } else { + P0 = I31(3, 1); + P1 = I332(1, 5, 3); + } +} break; +case 26 : +{ + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + } else { + P0 = I211(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 31 : +case 95 : +{ + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 42 : +case 170 : +{ + P1 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + P2 = IC(0); + } else { + P0 = I332(1, 3, 0); + P2 = I31(0, 3); + } +} break; +case 43 : +case 171 : +case 187 : +{ + P1 = IC(2); + P3 = IC(2); + if (MUL) { + P0 = IC(2); + P2 = IC(2); + } else { + P0 = I332(1, 3, 2); + P2 = I31(2, 3); + } +} break; +case 46 : +case 174 : +{ + P1 = IC(0); + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } +} break; +case 47 : +case 175 : +{ + P1 = IC(4); + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 58 : +case 154 : +case 186 : +{ + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 59 : +{ + P2 = IC(2); + P3 = IC(2); + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } + if (MUR) { + P1 = IC(2); + } else { + P1 = I611(2, 1, 5); + } +} break; +case 63 : +{ + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 72 : +case 76 : +case 104 : +case 106 : +case 108 : +case 110 : +case 120 : +case 124 : +{ + P0 = IC(0); + P1 = IC(0); + P3 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } +} break; +case 73 : +case 77 : +case 105 : +case 109 : +case 125 : +{ + P1 = IC(1); + P3 = IC(1); + if (MDL) { + P0 = IC(1); + P2 = IC(1); + } else { + P0 = I31(1, 3); + P2 = I332(3, 7, 1); + } +} break; +case 74 : +{ + P1 = IC(0); + P3 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I211(0, 1, 3); + } +} break; +case 78 : +case 202 : +case 206 : +{ + P1 = IC(0); + P3 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } +} break; +case 79 : +{ + P1 = IC(4); + P3 = IC(4); + if (MDL) { + P2 = IC(4); + } else { + P2 = I611(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } +} break; +case 80 : +case 208 : +case 210 : +case 216 : +{ + P0 = IC(0); + P1 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } +} break; +case 81 : +case 209 : +case 217 : +{ + P0 = IC(1); + P1 = IC(1); + P2 = IC(1); + if (MDR) { + P3 = IC(1); + } else { + P3 = I211(1, 5, 7); + } +} break; +case 82 : +case 214 : +case 222 : +{ + P0 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 83 : +case 115 : +{ + P0 = IC(2); + P2 = IC(2); + if (MDR) { + P3 = IC(2); + } else { + P3 = I611(2, 5, 7); + } + if (MUR) { + P1 = IC(2); + } else { + P1 = I611(2, 1, 5); + } +} break; +case 84 : +case 212 : +{ + P0 = IC(0); + P2 = IC(0); + if (MDR) { + P1 = IC(0); + P3 = IC(0); + } else { + P1 = I31(0, 5); + P3 = I332(5, 7, 0); + } +} break; +case 85 : +case 213 : +case 221 : +{ + P0 = IC(1); + P2 = IC(1); + if (MDR) { + P1 = IC(1); + P3 = IC(1); + } else { + P1 = I31(1, 5); + P3 = I332(5, 7, 1); + } +} break; +case 87 : +{ + P0 = IC(3); + P2 = IC(3); + if (MDR) { + P3 = IC(3); + } else { + P3 = I611(3, 5, 7); + } + if (MUR) { + P1 = IC(3); + } else { + P1 = I211(3, 1, 5); + } +} break; +case 88 : +case 248 : +case 250 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } +} break; +case 89 : +case 93 : +{ + P0 = IC(1); + P1 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I611(1, 3, 7); + } + if (MDR) { + P3 = IC(1); + } else { + P3 = I611(1, 5, 7); + } +} break; +case 90 : +{ + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 91 : +{ + if (MDL) { + P2 = IC(2); + } else { + P2 = I611(2, 3, 7); + } + if (MDR) { + P3 = IC(2); + } else { + P3 = I611(2, 5, 7); + } + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } + if (MUR) { + P1 = IC(2); + } else { + P1 = I611(2, 1, 5); + } +} break; +case 92 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } +} break; +case 94 : +{ + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 107 : +case 123 : +{ + P1 = IC(2); + P3 = IC(2); + if (MDL) { + P2 = IC(2); + } else { + P2 = I211(2, 3, 7); + } + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } +} break; +case 111 : +{ + P1 = IC(4); + P3 = IC(4); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 112 : +case 240 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDR) { + P2 = IC(0); + P3 = IC(0); + } else { + P2 = I31(0, 7); + P3 = I332(5, 7, 0); + } +} break; +case 113 : +case 241 : +{ + P0 = IC(1); + P1 = IC(1); + if (MDR) { + P2 = IC(1); + P3 = IC(1); + } else { + P2 = I31(1, 7); + P3 = I332(5, 7, 1); + } +} break; +case 114 : +{ + P0 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 116 : +{ + P0 = IC(0); + P1 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } +} break; +case 117 : +{ + P0 = IC(1); + P1 = IC(1); + P2 = IC(1); + if (MDR) { + P3 = IC(1); + } else { + P3 = I611(1, 5, 7); + } +} break; +case 121 : +{ + P0 = IC(1); + P1 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I211(1, 3, 7); + } + if (MDR) { + P3 = IC(1); + } else { + P3 = I611(1, 5, 7); + } +} break; +case 122 : +{ + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I611(0, 5, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 126 : +{ + P0 = IC(0); + P3 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 127 : +{ + P3 = IC(4); + if (MDL) { + P2 = IC(4); + } else { + P2 = I211(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I211(4, 1, 5); + } +} break; +case 146 : +case 150 : +case 178 : +case 182 : +case 190 : +{ + P0 = IC(0); + P2 = IC(0); + if (MUR) { + P1 = IC(0); + P3 = IC(0); + } else { + P1 = I332(1, 5, 0); + P3 = I31(0, 5); + } +} break; +case 147 : +case 179 : +{ + P0 = IC(2); + P2 = IC(2); + P3 = IC(2); + if (MUR) { + P1 = IC(2); + } else { + P1 = I611(2, 1, 5); + } +} break; +case 151 : +case 183 : +{ + P0 = IC(3); + P2 = IC(3); + P3 = IC(3); + if (MUR) { + P1 = IC(3); + } else { + P1 = I1411(3, 1, 5); + } +} break; +case 158 : +{ + P2 = IC(0); + P3 = IC(0); + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 159 : +{ + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 191 : +{ + P2 = IC(4); + P3 = IC(4); + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 200 : +case 204 : +case 232 : +case 236 : +case 238 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDL) { + P2 = IC(0); + P3 = IC(0); + } else { + P2 = I332(3, 7, 0); + P3 = I31(0, 7); + } +} break; +case 201 : +case 205 : +{ + P0 = IC(1); + P1 = IC(1); + P3 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I611(1, 3, 7); + } +} break; +case 211 : +{ + P0 = IC(2); + P1 = IC(2); + P2 = IC(2); + if (MDR) { + P3 = IC(2); + } else { + P3 = I211(2, 5, 7); + } +} break; +case 215 : +{ + P0 = IC(3); + P2 = IC(3); + if (MDR) { + P3 = IC(3); + } else { + P3 = I211(3, 5, 7); + } + if (MUR) { + P1 = IC(3); + } else { + P1 = I1411(3, 1, 5); + } +} break; +case 218 : +{ + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 219 : +{ + P1 = IC(2); + P2 = IC(2); + if (MDR) { + P3 = IC(2); + } else { + P3 = I211(2, 5, 7); + } + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } +} break; +case 220 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I611(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } +} break; +case 223 : +{ + P2 = IC(4); + if (MDR) { + P3 = IC(4); + } else { + P3 = I211(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I211(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; +case 233 : +case 237 : +{ + P0 = IC(1); + P1 = IC(1); + P3 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I1411(1, 3, 7); + } +} break; +case 234 : +{ + P1 = IC(0); + P3 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MUL) { + P0 = IC(0); + } else { + P0 = I611(0, 1, 3); + } +} break; +case 235 : +{ + P1 = IC(2); + P3 = IC(2); + if (MDL) { + P2 = IC(2); + } else { + P2 = I1411(2, 3, 7); + } + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } +} break; +case 239 : +{ + P1 = IC(4); + P3 = IC(4); + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } +} break; +case 242 : +{ + P0 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I211(0, 5, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I611(0, 1, 5); + } +} break; +case 243 : +{ + P0 = IC(2); + P1 = IC(2); + if (MDR) { + P2 = IC(2); + P3 = IC(2); + } else { + P2 = I31(2, 7); + P3 = I332(5, 7, 2); + } +} break; +case 244 : +{ + P0 = IC(0); + P1 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I1411(0, 5, 7); + } +} break; +case 245 : +{ + P0 = IC(1); + P1 = IC(1); + P2 = IC(1); + if (MDR) { + P3 = IC(1); + } else { + P3 = I1411(1, 5, 7); + } +} break; +case 246 : +{ + P0 = IC(0); + P2 = IC(0); + if (MDR) { + P3 = IC(0); + } else { + P3 = I1411(0, 5, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 247 : +{ + P0 = IC(3); + P2 = IC(3); + if (MDR) { + P3 = IC(3); + } else { + P3 = I1411(3, 5, 7); + } + if (MUR) { + P1 = IC(3); + } else { + P1 = I1411(3, 1, 5); + } +} break; +case 249 : +{ + P0 = IC(1); + P1 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I1411(1, 3, 7); + } + if (MDR) { + P3 = IC(1); + } else { + P3 = I211(1, 5, 7); + } +} break; +case 251 : +{ + P1 = IC(2); + if (MDL) { + P2 = IC(2); + } else { + P2 = I1411(2, 3, 7); + } + if (MDR) { + P3 = IC(2); + } else { + P3 = I211(2, 5, 7); + } + if (MUL) { + P0 = IC(2); + } else { + P0 = I211(2, 1, 3); + } +} break; +case 252 : +{ + P0 = IC(0); + P1 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I1411(0, 5, 7); + } +} break; +case 253 : +{ + P0 = IC(1); + P1 = IC(1); + if (MDL) { + P2 = IC(1); + } else { + P2 = I1411(1, 3, 7); + } + if (MDR) { + P3 = IC(1); + } else { + P3 = I1411(1, 5, 7); + } +} break; +case 254 : +{ + P0 = IC(0); + if (MDL) { + P2 = IC(0); + } else { + P2 = I211(0, 3, 7); + } + if (MDR) { + P3 = IC(0); + } else { + P3 = I1411(0, 5, 7); + } + if (MUR) { + P1 = IC(0); + } else { + P1 = I211(0, 1, 5); + } +} break; +case 255 : +{ + if (MDL) { + P2 = IC(4); + } else { + P2 = I1411(4, 3, 7); + } + if (MDR) { + P3 = IC(4); + } else { + P3 = I1411(4, 5, 7); + } + if (MUL) { + P0 = IC(4); + } else { + P0 = I1411(4, 1, 3); + } + if (MUR) { + P1 = IC(4); + } else { + P1 = I1411(4, 1, 5); + } +} break; diff --git a/src/memgzio.c b/src/memgzio.c new file mode 100644 index 0000000..32f6776 --- /dev/null +++ b/src/memgzio.c @@ -0,0 +1,681 @@ +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-2002 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Compile this file with -DNO_DEFLATE to avoid the compression code. + */ + +/* memgzio.c - IO on .gz files in memory + * Adapted from original gzio.c from zlib library by Forgotten + */ + +/* @(#) $Id: memgzio.c,v 1.3 2004/01/17 23:07:32 kxu Exp $ */ + +#include +#include +#include + +#include "memgzio.h" + +/*struct internal_state {int dummy;};*/ /* for buggy compilers */ + +#ifndef Z_BUFSIZE +# ifdef MAXSEG_64K +# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ +# else +# define Z_BUFSIZE 16384 +# endif +#endif +#ifndef Z_PRINTF_BUFSIZE +# define Z_PRINTF_BUFSIZE 4096 +#endif + +#define ALLOC(size) malloc(size) +#define TRYFREE(p) {if (p) free(p);} + +static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +typedef struct _MemFile { + char *memory; + char *next; + int available; + int error; + char mode; +} MEMFILE; + +typedef struct mem_stream { + z_stream stream; + int z_err; /* error code for last stream operation */ + int z_eof; /* set if end of input file */ + MEMFILE *file; /* memoru file */ + Byte *inbuf; /* input buffer */ + Byte *outbuf; /* output buffer */ + uLong crc; /* crc32 of uncompressed data */ + char *msg; /* error message */ + int transparent; /* 1 if input file is not a .gz file */ + char mode; /* 'w' or 'r' */ + long startpos; /* start of compressed data in file (header skipped) */ +} mem_stream; + + +local gzFile gz_open OF((char *memory, const int available, const char *mode)); +local int do_flush OF((gzFile file, int flush)); +local int get_byte OF((mem_stream *s)); +local void check_header OF((mem_stream *s)); +local int destroy OF((mem_stream *s)); +local void putLong OF((MEMFILE *file, uLong x)); +local uLong getLong OF((mem_stream *s)); + +local MEMFILE *memOpen(char *memory, int available, char mode) +{ + MEMFILE *f; + + if(available <= 8) + return NULL; + + if(mode != 'w' && mode != 'r') + return NULL; + + f = (MEMFILE *)malloc(sizeof(MEMFILE)); + + f->memory = memory; + f->mode = mode; + f->error = 0; + + if(mode == 'w') { + f->available = available - 8; + f->next = memory + 8; + memory[0] = 'V'; + memory[1] = 'B'; + memory[2] = 'A'; + memory[3] = ' '; + *((int *)(memory+4)) = 0; + } else { + if(memory[0] != 'V' || memory[1] != 'B' || memory[2] != 'A' || + memory[3] != ' ') { + free(f); + return NULL; + } + f->available = *((int *)(memory+4)); + f->next = memory+8; + } + + return f; +} + +local size_t memWrite(const void *buffer, size_t size, size_t count, + MEMFILE *file) +{ + size_t total = size*count; + + if(file->mode != 'w') { + file->error = 1; + return 0; + } + + if(total > (size_t)file->available) { + total = file->available; + } + memcpy(file->next, buffer, total); + file->available -= total; + file->next += total; + return total; +} + +local size_t memRead(void *buffer, size_t size, size_t count, + MEMFILE *file) +{ + size_t total = size*count; + + if(file->mode != 'r') { + file->error = 1; + return 0; + } + + if(file->available == 0) + return -1; + + if(total > (size_t)file->available) { + total = file->available; + } + memcpy(buffer, file->next, total); + file->available -= total; + file->next += total; + return total; +} + +local int memPutc(int c, MEMFILE *file) +{ + if(file->mode != 'w') { + file->error = 1; + return -1; + } + + if(file->available >= 1) { + *file->next++ = c; + file->available--; + } else + return -1; + + return c; +} + +local long memTell(MEMFILE *f) +{ + return (f->next - f->memory) - 8; +} + +local int memError(MEMFILE *f) +{ + return f->error; +} + +local int memClose(MEMFILE *f) +{ + if(f->mode == 'w') { + *((int *)(f->memory+4)) = memTell(f); + } + free(f); + return 0; +} + +local int memPrintf(MEMFILE *f, const char *format, ...) +{ + char buffer[80]; + va_list list; + int len; + + va_start(list, format); + len = vsprintf(buffer, format, list); + va_end(list); + + return memWrite(buffer, 1, len, f); +} + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb"). The file is given either by file descriptor + or path name (if fd == -1). + gz_open return NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). +*/ +local gzFile gz_open (memory, available, mode) + char *memory; + const int available; + const char *mode; +{ + int err; + int level = Z_DEFAULT_COMPRESSION; /* compression level */ + int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ + char *p = (char*)mode; + mem_stream *s; + char fmode[80]; /* copy of mode, without the compression level */ + char *m = fmode; + + s = (mem_stream *)ALLOC(sizeof(mem_stream)); + if (!s) return Z_NULL; + + s->stream.zalloc = (alloc_func)0; + s->stream.zfree = (free_func)0; + s->stream.opaque = (voidpf)0; + s->stream.next_in = s->inbuf = Z_NULL; + s->stream.next_out = s->outbuf = Z_NULL; + s->stream.avail_in = s->stream.avail_out = 0; + s->z_err = Z_OK; + s->z_eof = 0; + s->crc = crc32(0L, Z_NULL, 0); + s->msg = NULL; + s->transparent = 0; + s->file = NULL; + + s->mode = '\0'; + do { + if (*p == 'r') s->mode = 'r'; + if (*p == 'w' || *p == 'a') s->mode = 'w'; + if (*p >= '0' && *p <= '9') { + level = *p - '0'; + } else if (*p == 'f') { + strategy = Z_FILTERED; + } else if (*p == 'h') { + strategy = Z_HUFFMAN_ONLY; + } else { + *m++ = *p; /* copy the mode */ + } + } while (*p++ && m != fmode + sizeof(fmode)); + if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; + + if (s->mode == 'w') { +#ifdef NO_DEFLATE + err = Z_STREAM_ERROR; +#else + err = deflateInit2(&(s->stream), level, + Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); + /* windowBits is passed < 0 to suppress zlib header */ + + s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); +#endif + if (err != Z_OK || s->outbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } else { + s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); + + err = inflateInit2(&(s->stream), -MAX_WBITS); + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are + * present after the compressed stream. + */ + if (err != Z_OK || s->inbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } + s->stream.avail_out = Z_BUFSIZE; + + errno = 0; + s->file = memOpen(memory, available, s->mode); + + if (s->file == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + + if (s->mode == 'w') { + /* Write a very simple .gz header: + */ + memPrintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], + Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); + s->startpos = 10L; + /* We use 10L instead of ftell(s->file) to because ftell causes an + * fflush on some systems. This version of the library doesn't use + * startpos anyway in write mode, so this initialization is not + * necessary. + */ + } else { + check_header(s); /* skip the .gz header */ + s->startpos = (memTell(s->file) - s->stream.avail_in); + } + + return (gzFile)s; +} + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. +*/ +gzFile ZEXPORT memgzopen (memory, available, mode) + char *memory; + int available; + const char *mode; +{ + return gz_open (memory, available, mode); +} + +/* =========================================================================== + Read a byte from a mem_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ +local int get_byte(s) + mem_stream *s; +{ + if (s->z_eof) return EOF; + if (s->stream.avail_in == 0) { + errno = 0; + s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (memError(s->file)) s->z_err = Z_ERRNO; + return EOF; + } + s->stream.next_in = s->inbuf; + } + s->stream.avail_in--; + return *(s->stream.next_in)++; +} + +/* =========================================================================== + Check the gzip header of a mem_stream opened for reading. Set the stream + mode to transparent if the gzip magic header is not present; set s->err + to Z_DATA_ERROR if the magic header is present but the rest of the header + is incorrect. + IN assertion: the stream s has already been created sucessfully; + s->stream.avail_in is zero for the first time, but may be non-zero + for concatenated .gz files. +*/ +local void check_header(s) + mem_stream *s; +{ + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + int c; + + /* Check the gzip magic header */ + for (len = 0; len < 2; len++) { + c = get_byte(s); + if (c != gz_magic[len]) { + if (len != 0) s->stream.avail_in++, s->stream.next_in--; + if (c != EOF) { + s->stream.avail_in++, s->stream.next_in--; + s->transparent = 1; + } + s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; + return; + } + } + method = get_byte(s); + flags = get_byte(s); + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + s->z_err = Z_DATA_ERROR; + return; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(s); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + len = (uInt)get_byte(s); + len += ((uInt)get_byte(s))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(s) != EOF) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(s); + } + s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; +} + + /* =========================================================================== + * Cleanup then free the given mem_stream. Return a zlib error code. + Try freeing in the reverse order of allocations. + */ +local int destroy (s) + mem_stream *s; +{ + int err = Z_OK; + + if (!s) return Z_STREAM_ERROR; + + TRYFREE(s->msg); + + if (s->stream.state != NULL) { + if (s->mode == 'w') { +#ifdef NO_DEFLATE + err = Z_STREAM_ERROR; +#else + err = deflateEnd(&(s->stream)); +#endif + } else if (s->mode == 'r') { + err = inflateEnd(&(s->stream)); + } + } + if (s->file != NULL && memClose(s->file)) { +#ifdef ESPIPE + if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ +#endif + err = Z_ERRNO; + } + if (s->z_err < 0) err = s->z_err; + + TRYFREE(s->inbuf); + TRYFREE(s->outbuf); + TRYFREE(s); + return err; +} + +/* =========================================================================== + Reads the given number of uncompressed bytes from the compressed file. + gzread returns the number of bytes actually read (0 for end of file). +*/ +int ZEXPORT memgzread (file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + mem_stream *s = (mem_stream*)file; + Bytef *start = (Bytef*)buf; /* starting point for crc computation */ + Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ + + if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; + + if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; + if (s->z_err == Z_STREAM_END) return 0; /* EOF */ + + next_out = (Byte*)buf; + s->stream.next_out = (Bytef*)buf; + s->stream.avail_out = len; + + while (s->stream.avail_out != 0) { + + if (s->transparent) { + /* Copy first the lookahead bytes: */ + uInt n = s->stream.avail_in; + if (n > s->stream.avail_out) n = s->stream.avail_out; + if (n > 0) { + zmemcpy(s->stream.next_out, s->stream.next_in, n); + next_out += n; + s->stream.next_out = next_out; + s->stream.next_in += n; + s->stream.avail_out -= n; + s->stream.avail_in -= n; + } + if (s->stream.avail_out > 0) { + s->stream.avail_out -= memRead(next_out, 1, s->stream.avail_out, + s->file); + } + len -= s->stream.avail_out; + s->stream.total_in += (uLong)len; + s->stream.total_out += (uLong)len; + if (len == 0) s->z_eof = 1; + return (int)len; + } + if (s->stream.avail_in == 0 && !s->z_eof) { + + errno = 0; + s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (memError(s->file)) { + s->z_err = Z_ERRNO; + break; + } + } + s->stream.next_in = s->inbuf; + } + s->z_err = inflate(&(s->stream), Z_NO_FLUSH); + + if (s->z_err == Z_STREAM_END) { + /* Check CRC and original size */ + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + start = s->stream.next_out; + + if (getLong(s) != s->crc) { + s->z_err = Z_DATA_ERROR; + } else { + (void)getLong(s); + /* The uncompressed length returned by above getlong() may + * be different from s->stream.total_out) in case of + * concatenated .gz files. Check for such files: + */ + check_header(s); + if (s->z_err == Z_OK) { + uLong total_in = s->stream.total_in; + uLong total_out = s->stream.total_out; + + inflateReset(&(s->stream)); + s->stream.total_in = total_in; + s->stream.total_out = total_out; + s->crc = crc32(0L, Z_NULL, 0); + } + } + } + if (s->z_err != Z_OK || s->z_eof) break; + } + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + + return (int)(len - s->stream.avail_out); +} + + +#ifndef NO_DEFLATE +/* =========================================================================== + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of bytes actually written (0 in case of error). +*/ +int ZEXPORT memgzwrite (file, buf, len) + gzFile file; + const voidp buf; + unsigned len; +{ + mem_stream *s = (mem_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.next_in = (Bytef*)buf; + s->stream.avail_in = len; + + while (s->stream.avail_in != 0) { + + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (memWrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + break; + } + s->stream.avail_out = Z_BUFSIZE; + } + s->z_err = deflate(&(s->stream), Z_NO_FLUSH); + if (s->z_err != Z_OK) break; + } + s->crc = crc32(s->crc, (const Bytef *)buf, len); + + return (int)(len - s->stream.avail_in); +} +#endif +/* =========================================================================== + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. +*/ +local int do_flush (file, flush) + gzFile file; + int flush; +{ + uInt len; + int done = 0; + mem_stream *s = (mem_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.avail_in = 0; /* should be zero already anyway */ + + for (;;) { + len = Z_BUFSIZE - s->stream.avail_out; + + if (len != 0) { + if ((uInt)memWrite(s->outbuf, 1, len, s->file) != len) { + s->z_err = Z_ERRNO; + return Z_ERRNO; + } + s->stream.next_out = s->outbuf; + s->stream.avail_out = Z_BUFSIZE; + } + if (done) break; + s->z_err = deflate(&(s->stream), flush); + + /* Ignore the second of two consecutive flushes: */ + if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; + + /* deflate has finished flushing only when it hasn't used up + * all the available space in the output buffer: + */ + done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); + + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; + } + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} + +/* =========================================================================== + Outputs a long in LSB order to the given file +*/ +local void putLong (file, x) + MEMFILE *file; + uLong x; +{ + int n; + for (n = 0; n < 4; n++) { + memPutc((int)(x & 0xff), file); + x >>= 8; + } +} + +/* =========================================================================== + Reads a long in LSB order from the given mem_stream. Sets z_err in case + of error. +*/ +local uLong getLong (s) + mem_stream *s; +{ + uLong x = (uLong)get_byte(s); + int c; + + x += ((uLong)get_byte(s))<<8; + x += ((uLong)get_byte(s))<<16; + c = get_byte(s); + if (c == EOF) s->z_err = Z_DATA_ERROR; + x += ((uLong)c)<<24; + return x; +} + +/* =========================================================================== + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. +*/ +int ZEXPORT memgzclose (file) + gzFile file; +{ + int err; + mem_stream *s = (mem_stream*)file; + + if (s == NULL) return Z_STREAM_ERROR; + + if (s->mode == 'w') { +#ifdef NO_DEFLATE + return Z_STREAM_ERROR; +#else + err = do_flush (file, Z_FINISH); + if (err != Z_OK) return destroy((mem_stream*)file); + + putLong (s->file, s->crc); + putLong (s->file, s->stream.total_in); +#endif + } + return destroy((mem_stream*)file); +} + +long ZEXPORT memtell(file) + gzFile file; +{ + mem_stream *s = (mem_stream*)file; + + if (s == NULL) return Z_STREAM_ERROR; + + return memTell(s->file); +} diff --git a/src/memgzio.h b/src/memgzio.h new file mode 100644 index 0000000..2ca74cb --- /dev/null +++ b/src/memgzio.h @@ -0,0 +1,21 @@ +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-2002 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Compile this file with -DNO_DEFLATE to avoid the compression code. + */ + +/* memgzio.c - IO on .gz files in memory + * Adapted from original gzio.c from zlib library by Forgotten + */ +#ifndef HAVE_ZUTIL_H +#include "../win32/include/zlib/zutil.h" +#else +#include +#endif + +gzFile ZEXPORT memgzopen(char *memory, int, const char *); +int ZEXPORT memgzread(gzFile, voidp, unsigned); +int ZEXPORT memgzwrite(gzFile, const voidp, unsigned); +int ZEXPORT memgzclose(gzFile); +long ZEXPORT memtell(gzFile); diff --git a/src/motionblur.cpp b/src/motionblur.cpp new file mode 100644 index 0000000..35beb88 --- /dev/null +++ b/src/motionblur.cpp @@ -0,0 +1,192 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" + +extern int RGB_LOW_BITS_MASK; + +void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); + u32 lowPixelMask = RGB_LOW_BITS_MASK; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *xP = (u32 *) deltaPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + u32 currentDelta; + u32 nextDelta; + + finish = (u8 *) bP + ((width+2) << 1); + nextPixel = *bP++; + nextDelta = *xP++; + + do { + currentPixel = nextPixel; + currentDelta = nextDelta; + nextPixel = *bP++; + nextDelta = *xP++; + + if(currentPixel != currentDelta) { + u32 colorA, product, colorB; + + *(xP - 2) = currentPixel; +#ifdef WORDS_BIGENDIAN + colorA = currentPixel >> 16; + colorB = currentDelta >> 16; +#else + colorA = currentPixel & 0xffff; + colorB = currentDelta & 0xffff; +#endif + + product = ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1) + + (colorA & colorB & lowPixelMask))); + + *(dP) = product | product << 16; + *(nL) = product | product << 16; + +#ifdef WORDS_BIGENDIAN + colorA = (currentPixel & 0xffff); + colorB = (currentDelta & 0xffff); +#else + colorA = currentPixel >> 16; + colorB = currentDelta >> 16; +#endif + product = ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1) + + (colorA & colorB & lowPixelMask))); + + *(dP + 1) = product | product << 16; + *(nL + 1) = product | product << 16; + } else { + u32 colorA, product; + + *(xP - 2) = currentPixel; +#ifdef WORDS_BIGENDIAN + colorA = currentPixel >> 16; +#else + colorA = currentPixel & 0xffff; +#endif + + product = colorA; + + *(dP) = product | product << 16; + *(nL) = product | product << 16; +#ifdef WORDS_BIGENDIAN + colorA = (currentPixel & 0xffff); +#else + colorA = currentPixel >> 16; +#endif + product = colorA; + + *(dP + 1) = product | product << 16; + *(nL + 1) = product | product << 16; + } + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + deltaPtr += srcPitch; + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~RGB_LOW_BITS_MASK; + u32 lowPixelMask = RGB_LOW_BITS_MASK; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *xP = (u32 *) deltaPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + u32 currentDelta; + u32 nextDelta; + + finish = (u8 *) bP + ((width+1) << 2); + nextPixel = *bP++; + nextDelta = *xP++; + + do { + currentPixel = nextPixel; + currentDelta = nextDelta; + nextPixel = *bP++; + nextDelta = *xP++; + + u32 colorA, product, colorB; + + *(xP - 2) = currentPixel; + colorA = currentPixel; + colorB = currentDelta; + + product = ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1) + + (colorA & colorB & lowPixelMask))); + + *(dP) = product; + *(dP+1) = product; + *(nL) = product; + *(nL+1) = product; + + *(xP - 1) = nextPixel; + + colorA = nextPixel; + colorB = nextDelta; + + product = ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1) + + (colorA & colorB & lowPixelMask))); + + *(dP + 2) = product; + *(dP + 3) = product; + *(nL + 2) = product; + *(nL + 3) = product; + + nextPixel = *bP++; + nextDelta = *xP++; + + dP += 4; + nL += 4; + } while ((u8 *) bP < finish); + + deltaPtr += srcPitch; + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} diff --git a/src/movie.cpp b/src/movie.cpp new file mode 100644 index 0000000..63aca95 --- /dev/null +++ b/src/movie.cpp @@ -0,0 +1,1409 @@ + +#include +#ifdef HAVE_STRINGS_H +# include +#endif +#include +#include + +#if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) +# include +# include +# include +# include +# define stricmp strcasecmp +# define _MAX_PATH 128 +#endif + +#include + +#ifdef WIN32 +# include +# ifndef W_OK +# define W_OK 2 +# endif +#endif + +#include + +#include "movie.h" + +#if (defined(WIN32) && !defined(SDL)) +# include "win32/stdafx.h" +# include "win32/vba.h" +# include "win32/resource.h" +# include "win32/WinResUtil.h" +# include "win32/MainWnd.h" + +# define theEmulator (theApp.emulator) + +#else + + + extern struct EmulatedSystem emulator; +# define theEmulator (emulator) + +#endif + +#include "GBA.h" +#include "Globals.h" +#include "System.h" +#include "unzip.h" +#include "Util.h" + +#include "inputGlobal.h" +#include "gb/gbGlobals.h" +#include "RTC.h" + +extern int emulating; // from VBA.cpp + +SMovie Movie; +bool loadingMovie = false; + +#if (defined(WIN32) && !defined(SDL)) + extern u32 currentButtons [4]; // from DirectInput.cpp +#else + u32 currentButtons [4]; +#endif +static bool resetSignaled = false; +static bool ignoreNextReset = false; + +static int controllersLeftThisFrame = 0; +static int prevBorder, prevWinBorder, prevBorderAuto; + +static int bytes_per_frame(SMovie & mov) +{ + int num_controllers = 0; + + for(int i = 0 ; i < MOVIE_NUM_OF_POSSIBLE_CONTROLLERS ; i++) + if(mov.header.controllerFlags & MOVIE_CONTROLLER(i)) + num_controllers++; + + return CONTROLLER_DATA_SIZE*num_controllers; +} + + +// little-endian integer read/write functions: +static inline uint32 Read32(const uint8*& ptr) +{ + uint32 v=(ptr[0] | (ptr[1]<<8) | (ptr[2]<<16) | (ptr[3]<<24)); + ptr += 4; + return v; +} +static inline uint16 Read16(const uint8*& ptr) /* const version */ +{ + uint16 v=(ptr[0] | (ptr[1]<<8)); + ptr += 2; + return v; +} +static inline uint16 Read16(uint8*& ptr) /* non-const version */ +{ + uint16 v=(ptr[0] | (ptr[1]<<8)); + ptr += 2; + return v; +} +#define Read8(ptr) (*(ptr)++) +static void Write32(uint32 v, uint8*& ptr) +{ + ptr[0]=(uint8)(v&0xff); + ptr[1]=(uint8)((v>>8)&0xff); + ptr[2]=(uint8)((v>>16)&0xff); + ptr[3]=(uint8)((v>>24)&0xff); + ptr += 4; +} +static void Write16(uint16 v, uint8*& ptr) +{ + ptr[0]=(uint8)(v&0xff); + ptr[1]=(uint8)((v>>8)&0xff); + ptr += 2; +} +#define Write8(v, ptr) (*ptr++=v) + +static int read_movie_header(FILE * file, SMovie & movie) +{ + assert(file != NULL); + assert(VBM_HEADER_SIZE == sizeof(SMovieFileHeader)); // sanity check on the header type definition + + uint8 headerData [VBM_HEADER_SIZE]; + + if(fread(headerData, 1, VBM_HEADER_SIZE, file) != VBM_HEADER_SIZE) + return WRONG_FORMAT; // if we failed to read in all VBM_HEADER_SIZE bytes of the header + + const uint8* ptr = headerData; + SMovieFileHeader & header = movie.header; + + header.magic = Read32(ptr); + if(header.magic != VBM_MAGIC) + return WRONG_FORMAT; + + header.version = Read32(ptr); + if(header.version != VBM_VERSION) + return WRONG_VERSION; + + header.uid = Read32(ptr); + header.length_frames = Read32(ptr); + header.rerecord_count = Read32(ptr); + + header.startFlags = Read8(ptr); + header.controllerFlags = Read8(ptr); + header.typeFlags = Read8(ptr); + header.optionFlags = Read8(ptr); + + header.saveType = Read32(ptr); + header.flashSize = Read32(ptr); + header.gbEmulatorType = Read32(ptr); + + for(int i = 0 ; i < 12 ; i++) + header.romTitle[i] = Read8(ptr); + + header.reservedByte = Read8(ptr); + + header.romCRC = Read8(ptr); + header.romOrBiosChecksum = Read16(ptr); + header.romGameCode = Read32(ptr); + + header.offset_to_savestate = Read32(ptr); + header.offset_to_controller_data = Read32(ptr); + + return SUCCESS; +} + + +static void write_movie_header(FILE * file, const SMovie & movie) +{ + assert(ftell(file) == 0); // we assume file points to beginning of movie file + + uint8 headerData [VBM_HEADER_SIZE]; + uint8* ptr = headerData; + const SMovieFileHeader & header = movie.header; + + Write32(header.magic, ptr); + Write32(header.version, ptr); + + Write32(header.uid, ptr); + Write32(header.length_frames, ptr); + Write32(header.rerecord_count, ptr); + + Write8(header.startFlags, ptr); + Write8(header.controllerFlags, ptr); + Write8(header.typeFlags, ptr); + Write8(header.optionFlags, ptr); + + Write32(header.saveType, ptr); + Write32(header.flashSize, ptr); + Write32(header.gbEmulatorType, ptr); + + for(int i = 0 ; i < 12 ; i++) + Write8(header.romTitle[i], ptr); + + Write8(header.reservedByte, ptr); + + Write8(header.romCRC, ptr); + Write16(header.romOrBiosChecksum, ptr); + Write32(header.romGameCode, ptr); + + Write32(header.offset_to_savestate, ptr); + Write32(header.offset_to_controller_data, ptr); + + fwrite(headerData, 1, VBM_HEADER_SIZE, file); +} + +static void flush_movie() +{ + if(Movie.state != MOVIE_STATE_RECORD) + return; + + // (over-)write the header + fseek(Movie.file, 0, SEEK_SET); + write_movie_header(Movie.file, Movie); + + // (over-)write the controller data + fseek(Movie.file, Movie.header.offset_to_controller_data, SEEK_SET); + fwrite(Movie.inputBuffer, 1, Movie.bytesPerFrame*(Movie.header.length_frames+1), Movie.file); + + fflush(Movie.file); +} + +static void truncateMovie() +{ + // truncate movie to header.length_frames length + // NOTE: it's certain that the savestate block is never after the + // controller data block, because the VBM format decrees it. + + long truncLen = Movie.header.offset_to_controller_data + Movie.bytesPerFrame*(Movie.header.length_frames+1); + +# if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) + truncate(Movie.filename, truncLen); +# else +# if (defined(WIN32) && !defined(SDL)) + HANDLE fileHandle = CreateFile(Movie.filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + if(fileHandle != NULL) + { + SetFilePointer(fileHandle, truncLen, 0, FILE_BEGIN); + SetEndOfFile(fileHandle); + CloseHandle(fileHandle); + } +# endif +# endif +} + +static void change_state(MovieState new_state) +{ + if(new_state == Movie.state) + return; + + flush_movie(); + + Movie.state = new_state; + +#if (defined(WIN32) && !defined(SDL)) + theApp.frameSearching = false; + theApp.frameSearchSkipping = false; +#endif + + if(new_state == MOVIE_STATE_NONE) + { + fclose(Movie.file); + Movie.file = NULL; + Movie.currentFrame = 0; + + truncateMovie(); + +#if (defined(WIN32) && !defined(SDL)) + // undo changes to border settings + { + theApp.winGbBorderOn = prevWinBorder; + gbBorderAutomatic = prevBorderAuto; + } +#endif + extern int gbDMASpeedVersion; + gbDMASpeedVersion = 1; + + if(Movie.inputBuffer) + { + free(Movie.inputBuffer); + Movie.inputBuffer = NULL; + } + } +} + +static void reserve_buffer_space(uint32 space_needed) +{ + if(space_needed > Movie.inputBufferSize) + { + uint32 ptr_offset = Movie.inputBufferPtr - Movie.inputBuffer; + uint32 alloc_chunks = space_needed / BUFFER_GROWTH_SIZE; + Movie.inputBufferSize = BUFFER_GROWTH_SIZE * (alloc_chunks+1); + Movie.inputBuffer = (uint8*)realloc(Movie.inputBuffer, Movie.inputBufferSize); + Movie.inputBufferPtr = Movie.inputBuffer + ptr_offset; + } +} + + +static void read_frame_controller_data(int i) +{ + if(i < 0 || i >= MOVIE_NUM_OF_POSSIBLE_CONTROLLERS) + { + assert(0); + return; + } + + // the number of controllers an SGB game checks per frame is not constant throughout the entire game + // so fill in the gaps with blank data when we hit a duplicate check when other controllers remain unchecked + if((controllersLeftThisFrame & MOVIE_CONTROLLER(i)) == 0) + { + if(controllersLeftThisFrame) + { + // already requested, fill in others first + for(int controller = 0 ; controller < MOVIE_NUM_OF_POSSIBLE_CONTROLLERS ; controller++) + if((controllersLeftThisFrame & MOVIE_CONTROLLER(controller)) != 0) + read_frame_controller_data(controller); + } + } + else + controllersLeftThisFrame ^= MOVIE_CONTROLLER(i); + + if(!controllersLeftThisFrame) + controllersLeftThisFrame = Movie.header.controllerFlags; + + + + if(Movie.header.controllerFlags & MOVIE_CONTROLLER(i)) + { + currentButtons[i]=Read16(Movie.inputBufferPtr); + } + else + { + currentButtons[i]=0; // pretend the controller is disconnected + } + + extern bool sensorOn; + if(!sensorOn) + { + // ignore motion sensor input if the current game doesn't support it + if((currentButtons[i] & BUTTON_MOTION_MASK) != 0) + currentButtons[i] &= ~BUTTON_MOTION_MASK; + } + + if(resetSignaled) + currentButtons[i] |= BUTTON_MASK_RESET; + + if(i == 0) + { + if((currentButtons[i] & BUTTON_MASK_RESET) != 0) + { + // 'soft' reset: + theEmulator.emuReset(); + } + + resetSignaled = false; + } +/* // apparently implemented from the other end, in systemReadJoypad +#if (!(defined(WIN32) && !defined(SDL))) + // convert from currentButtons input format + extern void systemWriteJoypad(int which, u32 buttons); + systemWriteJoypad(i, currentButtons[i]); +#endif +*/ +} + +static void write_frame_controller_data(int i) +{ + if(i < 0 || i >= MOVIE_NUM_OF_POSSIBLE_CONTROLLERS) + { + assert(0); + return; + } + + + // the number of controllers an SGB game checks per frame is not constant throughout the entire game + // so fill in the gaps with blank data when we hit a duplicate check when other controllers remain unchecked + if((controllersLeftThisFrame & MOVIE_CONTROLLER(i)) == 0) + { + if(controllersLeftThisFrame) + { + // already requested, fill in others first + for(int controller = 0 ; controller < MOVIE_NUM_OF_POSSIBLE_CONTROLLERS ; controller++) + if((controllersLeftThisFrame & MOVIE_CONTROLLER(controller)) != 0) + write_frame_controller_data(controller); + } + } + else + controllersLeftThisFrame ^= MOVIE_CONTROLLER(i); + + if(!controllersLeftThisFrame) + controllersLeftThisFrame = Movie.header.controllerFlags; + + + if(i == 0) + { + reserve_buffer_space((uint32)((Movie.inputBufferPtr+Movie.bytesPerFrame)-Movie.inputBuffer)); + } + + if(Movie.header.controllerFlags & MOVIE_CONTROLLER(i)) + { +/* // apparently implemented from the other end, in systemReadJoypad +#if (!(defined(WIN32) && !defined(SDL))) + // convert to currentButtons input format + currentButtons[i] = systemReadJoypad(i,false); +#endif +*/ + // get the current controller data + uint16 buttonData = (uint16)currentButtons[i]; + + // mask away the irrelevent bits + buttonData &= BUTTON_REGULAR_MASK; + +# if (defined(WIN32) && !defined(SDL)) + // add in the motion sensor bits + extern BOOL checkKey(int key); // from Input.cpp + extern USHORT motion[4]; // from DirectInput.cpp + if(checkKey(motion[KEY_LEFT])) buttonData |= BUTTON_MASK_LEFT_MOTION; + if(checkKey(motion[KEY_RIGHT])) buttonData |= BUTTON_MASK_RIGHT_MOTION; + if(checkKey(motion[KEY_DOWN])) buttonData |= BUTTON_MASK_DOWN_MOTION; + if(checkKey(motion[KEY_UP])) buttonData |= BUTTON_MASK_UP_MOTION; +# else +# ifdef SDL + extern bool sdlCheckJoyKey(int key); // from SDL.cpp + extern u16 motion[4]; // from SDL.cpp + if(sdlCheckJoyKey(motion[KEY_LEFT])) buttonData |= BUTTON_MASK_LEFT_MOTION; + if(sdlCheckJoyKey(motion[KEY_RIGHT])) buttonData |= BUTTON_MASK_RIGHT_MOTION; + if(sdlCheckJoyKey(motion[KEY_DOWN])) buttonData |= BUTTON_MASK_DOWN_MOTION; + if(sdlCheckJoyKey(motion[KEY_UP])) buttonData |= BUTTON_MASK_UP_MOTION; +# endif +# endif + + // soft-reset "button" for 1 frame if the game is reset while recording + if(resetSignaled) + buttonData |= BUTTON_MASK_RESET; + + // write it to file + Write16(buttonData, Movie.inputBufferPtr); + + // and for display + currentButtons[i] = buttonData; + } + else + { + // pretend the controller is disconnected (otherwise input it gives could cause desync since we're not writing it to the movie) + currentButtons[i] = 0; + } + + if(i == 0) + { + resetSignaled = false; + } +} + +void VBAMovieInit () +{ + memset(&Movie, 0, sizeof(Movie)); + Movie.state = MOVIE_STATE_NONE; + Movie.pauseFrame = -1; + for(int i=0; igetDirFromFile(theApp.filename); + + if(((MainWnd *)theApp.m_pMainWnd)->isDriveRoot(saveDir)) + filename.Format("%s%s.sav", saveDir, buffer); + else + filename.Format("%s\\%s.sav", saveDir, buffer); + } + +#else +# ifdef SDL + static void GetBatterySaveName(char * buffer) + { + extern char batteryDir[2048], filename[2048]; // from SDL.cpp + extern char *sdlGetFilename(char *name); // from SDL.cpp + if(batteryDir[0]) + sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); + else + sprintf(buffer, "%s.sav", filename); + } +# endif +#endif + +static void SetPlayEmuSettings () +{ + gbEmulatorType = Movie.header.gbEmulatorType; + extern void SetPrefetchHack(bool); +# if (defined(WIN32) && !defined(SDL)) + if(theApp.cartridgeType == 0) // lag disablement applies only to GBA + SetPrefetchHack((Movie.header.optionFlags & MOVIE_SETTING_LAGHACK) != 0); + + ((MainWnd *)theApp.m_pMainWnd)->OnOptionsSound44khz(); // some GB/GBC games depend on the sound rate, so just use the highest one + theApp.useOldGBTiming = false; + theApp.removeIntros = false; + theApp.skipBiosFile = (Movie.header.optionFlags & MOVIE_SETTING_SKIPBIOSFILE) != 0; + theApp.useBiosFile = (Movie.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) != 0; + rtcEnable((Movie.header.optionFlags & MOVIE_SETTING_RTCENABLE) != 0); + theApp.winSaveType = Movie.header.saveType; + theApp.winFlashSize = Movie.header.flashSize; + + extern int gbDMASpeedVersion; + if((Movie.header.optionFlags & MOVIE_SETTING_GBCFF55FIX) != 0) + gbDMASpeedVersion = 1; + else + gbDMASpeedVersion = 0; // old CGB HDMA5 timing was used + + prevBorder = gbBorderOn; + prevWinBorder = theApp.winGbBorderOn; + prevBorderAuto = gbBorderAutomatic; + if((gbEmulatorType == 2 || gbEmulatorType == 5) + && !theApp.hideMovieBorder) // games played in SGB mode can have a border + { + gbBorderOn = true; + theApp.winGbBorderOn = true; + gbBorderAutomatic = false; + theApp.updateWindowSize(theApp.videoOption); + } + else + { + gbBorderOn = false; + theApp.winGbBorderOn = false; + gbBorderAutomatic = false; + theApp.updateWindowSize(theApp.videoOption); + if(theApp.hideMovieBorder) + { + theApp.hideMovieBorder = false; + prevBorder = false; // it might be expected behaviour that it stays hidden after the movie + } + } + +# else + extern int saveType, sdlRtcEnable, sdlFlashSize; // from SDL.cpp + extern bool useBios, skipBios, removeIntros; // from SDL.cpp + useBios = (Movie.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) != 0; + skipBios = (Movie.header.optionFlags & MOVIE_SETTING_SKIPBIOSFILE) != 0; + removeIntros = (Movie.header.optionFlags & MOVIE_SETTING_REMOVEINTROS) != 0; + sdlRtcEnable = (Movie.header.optionFlags & MOVIE_SETTING_RTCENABLE) != 0; + saveType = Movie.header.saveType; + sdlFlashSize = Movie.header.flashSize; + + extern int cartridgeType; // from SDL.cpp + if(cartridgeType == 0) // lag disablement applies only to GBA + SetPrefetchHack((Movie.header.optionFlags & MOVIE_SETTING_LAGHACK) != 0); +# endif +} + +static void HardResetAndSRAMClear () +{ +# if (defined(WIN32) && !defined(SDL)) + CString filename; + GetBatterySaveName(filename); + remove(filename); // delete the damn SRAM file + theEmulator.emuCleanUp(); // keep it from being resurrected from RAM + ((MainWnd *)theApp.m_pMainWnd)->FileRun(); // start running the game +# else + char fname [1024]; + GetBatterySaveName(fname); + remove(fname); // delete the damn SRAM file + + // Henceforth, emuCleanUp means "clear out SRAM" + theEmulator.emuCleanUp(); // keep it from being resurrected from RAM + + /// FIXME the correct SDL code to call for a full restart isn't in a function yet + theEmulator.emuReset(); +# endif +} + +int VBAMovieOpen (const char* filename, bool8 read_only) +{ + loadingMovie = true; + + FILE* file; + STREAM stream; + int result; + int fn; + + if(filename[0] == '\0') + {loadingMovie = false; return FILE_NOT_FOUND;} + + if(!emulating) + {loadingMovie = false; return UNKNOWN_ERROR;} + + bool alreadyOpen = (Movie.file != NULL && _stricmp(filename, Movie.filename) == 0); + + if(alreadyOpen) + change_state(MOVIE_STATE_NONE); // have to stop current movie before trying to re-open it + + if(filename[0] == '\0' || !(file = fopen(filename, read_only ? "rb" : "rb+"))) + {loadingMovie = false; return FILE_NOT_FOUND;} + else + fclose(file); + + if(!alreadyOpen) + change_state(MOVIE_STATE_NONE); // stop current movie when we're able to open the other one + + file = fopen(filename, read_only ? "rb" : "rb+"); + + // clear out the current movie + VBAMovieInit(); + + // read header + if((result = read_movie_header(file, Movie)) != SUCCESS) + { + fclose(file); + {loadingMovie = false; return result;} + } + + // set emulator settings that make the movie more likely to stay synchronized + SetPlayEmuSettings(); + + // read the metadata / author info from file + fread(Movie.authorInfo, 1, sizeof(char) * MOVIE_METADATA_SIZE, file); + fn = _dup(_fileno(file)); // XXX: why does this fail?? it returns -1 but errno == 0 + fclose(file); + + // apparently this lseek is necessary + _lseek(fn, Movie.header.offset_to_savestate, SEEK_SET); + if(!(stream = utilGzReopen(fn, "rb"))) + if(!(stream = utilGzOpen(filename, "rb"))) + {loadingMovie = false; return FILE_NOT_FOUND;} + else + fn = _dup(_fileno(file)); // in case the above dup failed but opening the file normally doesn't fail + + if(Movie.header.startFlags & MOVIE_START_FROM_SNAPSHOT) + { + // load the snapshot + result = theEmulator.emuReadStateFromStream(stream) ? SUCCESS : WRONG_FORMAT; + } + else if(Movie.header.startFlags & MOVIE_START_FROM_SRAM) + { + // 'soft' reset: + theEmulator.emuReset(); + + // load the SRAM + result = theEmulator.emuReadBatteryFromStream(stream) ? SUCCESS : WRONG_FORMAT; + } + else + { + HardResetAndSRAMClear(); + } + + resetSignaled = false; + controllersLeftThisFrame = Movie.header.controllerFlags; + + utilGzClose(stream); + + if(result != SUCCESS) + {loadingMovie = false; return result;} + + if(!(file = fopen(filename, /*read_only ? "rb" :*/ "rb+"))) // want to be able to switch out of read-only later + { + if(!Movie.readOnly || !(file = fopen(filename, "rb"))) // try read-only if failed + return FILE_NOT_FOUND; + } + + // recalculate length of movie from the file size + Movie.bytesPerFrame = bytes_per_frame(Movie); + fseek(file, 0, SEEK_END); + int fileSize = ftell(file); + Movie.header.length_frames = (fileSize - Movie.header.offset_to_controller_data) / Movie.bytesPerFrame - 1; + + if(fseek(file, Movie.header.offset_to_controller_data, SEEK_SET)) + {loadingMovie = false; return WRONG_FORMAT;} + + // read controller data + Movie.file = file; + Movie.inputBufferPtr = Movie.inputBuffer; + uint32 to_read = Movie.bytesPerFrame * (Movie.header.length_frames+1); + reserve_buffer_space(to_read); + fread(Movie.inputBufferPtr, 1, to_read, file); + + // read "baseline" controller data + read_frame_controller_data(0); // correct if we can assume the first controller is active, which we can on all GBx/xGB systems + Movie.currentFrame = 0; + + strncpy(Movie.filename, filename, _MAX_PATH); + Movie.filename[_MAX_PATH-1] = '\0'; + Movie.readOnly = read_only; + change_state(MOVIE_STATE_PLAY); + + if(Movie.readOnly) + systemScreenMessage("Movie replay (read)"); + else + systemScreenMessage("Movie replay (edit)"); + + {loadingMovie = false; return SUCCESS;} +} + +static void CalcROMInfo () +{ +#if (defined(WIN32) && !defined(SDL)) + if(theApp.cartridgeType == 0) // GBA +#else + extern int cartridgeType; // from SDL.cpp + if(cartridgeType == 0) // GBA +#endif + { + extern u8 *bios, *rom; + memcpy(Movie.header.romTitle, (const char *)&rom[0xa0], 12); // GBA TITLE + memcpy(&Movie.header.romGameCode, &rom[0xac], 4); // GBA ROM GAME CODE + + extern u16 checksumBIOS(); + Movie.header.romOrBiosChecksum = checksumBIOS(); // GBA BIOS CHECKSUM + Movie.header.romCRC = rom[0xbd]; // GBA ROM CRC + } + else // non-GBA + { + extern u8 *gbRom; + memcpy(Movie.header.romTitle, (const char *)&gbRom[0x134], 12); // GB TITLE (note this can be 15 but is truncated to 12) + Movie.header.romGameCode = (uint32)gbRom[0x146]; // GB ROM UNIT CODE + + Movie.header.romOrBiosChecksum = (gbRom[0x14e]<<8)|gbRom[0x14f]; // GB ROM CHECKSUM + Movie.header.romCRC = gbRom[0x14d]; // GB ROM CRC + } +} + +static void SetRecordEmuSettings () +{ + Movie.header.optionFlags = 0; +# if (defined(WIN32) && !defined(SDL)) + if(theApp.useBiosFile) Movie.header.optionFlags |= MOVIE_SETTING_USEBIOSFILE; + if(theApp.skipBiosFile) Movie.header.optionFlags |= MOVIE_SETTING_SKIPBIOSFILE; + if(rtcIsEnabled()) Movie.header.optionFlags |= MOVIE_SETTING_RTCENABLE; + Movie.header.saveType = theApp.winSaveType; + Movie.header.flashSize = theApp.winFlashSize; +# else + extern int saveType, sdlRtcEnable, sdlFlashSize; // from SDL.cpp + extern bool useBios, skipBios; // from SDL.cpp + if(useBios) Movie.header.optionFlags |= MOVIE_SETTING_USEBIOSFILE; + if(skipBios) Movie.header.optionFlags |= MOVIE_SETTING_SKIPBIOSFILE; + if(sdlRtcEnable) Movie.header.optionFlags |= MOVIE_SETTING_RTCENABLE; + Movie.header.saveType = saveType; + Movie.header.flashSize = sdlFlashSize; +# endif +#if (defined(WIN32) && !defined(SDL)) + if(GetAsyncKeyState(VK_CONTROL) == 0) +#endif + if(!memLagTempEnabled) Movie.header.optionFlags |= MOVIE_SETTING_LAGHACK; + Movie.header.gbEmulatorType = gbEmulatorType; + + Movie.header.optionFlags |= MOVIE_SETTING_GBCFF55FIX; + extern int gbDMASpeedVersion; + gbDMASpeedVersion = 1; + +# if (defined(WIN32) && !defined(SDL)) + ((MainWnd *)theApp.m_pMainWnd)->OnOptionsSound44khz(); // some GB/GBC games depend on the sound rate, so just use the highest one + theApp.useOldGBTiming = false; + theApp.removeIntros = false; + + prevBorder = gbBorderOn; + prevWinBorder = theApp.winGbBorderOn; + prevBorderAuto = gbBorderAutomatic; + if(gbEmulatorType == 2 || gbEmulatorType == 5) // only games played in SGB mode will have a border + { + gbBorderOn = true; + theApp.winGbBorderOn = true; + gbBorderAutomatic = false; + theApp.updateWindowSize(theApp.videoOption); + } + else + { + gbBorderOn = false; + theApp.winGbBorderOn = false; + gbBorderAutomatic = false; + theApp.updateWindowSize(theApp.videoOption); + } + + +# else + /// FIXME +# endif +} + +int VBAMovieCreate (const char* filename, const char* authorInfo, uint8 startFlags, uint8 controllerFlags, uint8 typeFlags) +{ + // make sure at least one controller is enabled + if((controllerFlags & MOVIE_CONTROLLERS_ANY_MASK) == 0) + return WRONG_FORMAT; + + if(!emulating) + return UNKNOWN_ERROR; + + loadingMovie = true; + + FILE* file; + STREAM stream; + int fn; + + bool alreadyOpen = (Movie.file != NULL && _stricmp(filename, Movie.filename) == 0); + + if(alreadyOpen) + change_state(MOVIE_STATE_NONE); // have to stop current movie before trying to re-open it + + if(filename[0]=='\0' || !(file = fopen(filename, "wb"))) + {loadingMovie = false; return FILE_NOT_FOUND;} + + if(!alreadyOpen) + change_state(MOVIE_STATE_NONE); // stop current movie when we're able to open the other one + + // clear out the current movie + VBAMovieInit(); + + // fill in the movie's header + Movie.header.uid = (uint32)time(NULL); + Movie.header.magic = VBM_MAGIC; + Movie.header.version = VBM_VERSION; + Movie.header.rerecord_count = 0; + Movie.header.length_frames = 0; + Movie.header.startFlags = startFlags; + Movie.header.controllerFlags = controllerFlags; + Movie.header.typeFlags = typeFlags; + + Movie.header.reservedByte = 0; + + // set emulator settings that make the movie more likely to stay synchronized when it's later played back + SetRecordEmuSettings(); + + // set ROM and BIOS checksums and stuff + CalcROMInfo(); + + // write the header to file + write_movie_header(file, Movie); + + // copy over the metadata / author info + VBAMovieSetMetadata(authorInfo); + + // write the metadata / author info to file + fwrite(Movie.authorInfo, 1, sizeof(char) * MOVIE_METADATA_SIZE, file); + + // write snapshot or SRAM if applicable + if(Movie.header.startFlags & MOVIE_START_FROM_SNAPSHOT + || Movie.header.startFlags & MOVIE_START_FROM_SRAM) + { + Movie.header.offset_to_savestate = (uint32)ftell(file); + + // close the file and reopen it as a stream: + + fn=_dup(_fileno(file)); + fclose(file); + + if(!(stream = utilGzReopen(fn, "ab"))) // append mode to start at end, no seek necessary + {loadingMovie = false; return FILE_NOT_FOUND;} + + // write the save data: + if(Movie.header.startFlags & MOVIE_START_FROM_SNAPSHOT) + { + // save snapshot + if(!theEmulator.emuWriteStateToStream(stream)) + { + utilGzClose(stream); + {loadingMovie = false; return UNKNOWN_ERROR;} + } + } + else if(Movie.header.startFlags & MOVIE_START_FROM_SRAM) + { + // save SRAM + if(!theEmulator.emuWriteBatteryToStream(stream)) + { + utilGzClose(stream); + {loadingMovie = false; return UNKNOWN_ERROR;} + } + + // 'soft' reset: + theEmulator.emuReset(); + } + + utilGzClose(stream); + + + // reopen the file and seek back to the end + + if(!(file = fopen(filename, "rb+"))) + {loadingMovie = false; return FILE_NOT_FOUND;} + + fseek(file, 0, SEEK_END); + } + else // no snapshot or SRAM + { + HardResetAndSRAMClear(); + } + + Movie.header.offset_to_controller_data = (uint32)ftell(file); + + resetSignaled = false; + controllersLeftThisFrame = Movie.header.controllerFlags; + + // write controller data + Movie.file = file; + Movie.bytesPerFrame = bytes_per_frame(Movie); + Movie.inputBufferPtr = Movie.inputBuffer; + + // write "baseline" controller data + write_frame_controller_data(0); // correct if we can assume the first controller is active, which we can on all GBx/xGB systems + Movie.currentFrame = 0; + + strncpy(Movie.filename, filename, _MAX_PATH); + Movie.filename[_MAX_PATH-1] = '\0'; + Movie.readOnly = false; + change_state(MOVIE_STATE_RECORD); + + systemScreenMessage("Recording movie..."); + {loadingMovie = false; return SUCCESS;} +} + + +void DisplayPressedKeys () +{ + uint32 keys = currentButtons[0] & (BUTTON_REGULAR_MASK|BUTTON_RECORDINGONLY_MASK); + + const static char KeyMap[]= {'A','B','s','S','>','<','^','v','R','L','!','?','{','}','v','^'}; + const static int KeyOrder[]= {5,6,4,7, 0,1, 9,8, 3,2, 12,15,13,14, 10}; // < ^ > v A B L R S s { = } _ ! + char string[256]; + sprintf(string, " "); + + #ifndef WIN32 + + // don't bother color-coding autofire and such + int i; + for (i=0; i < 15; i++) + { + int j = KeyOrder[i]; + int mask = (1 << (j)); + string[strlen(" ")+i] = ((keys & mask)!=0) ? KeyMap[j] : ' '; + } + + systemScreenMessage(string,2,20); + + #else + + const bool eraseAll = !theApp.inputDisplay; + uint32 autoHeldKeys = eraseAll ? 0 : theApp.autoHold & (BUTTON_REGULAR_MASK|BUTTON_RECORDINGONLY_MASK); + uint32 autoFireKeys = eraseAll ? 0 : (theApp.autoFire|theApp.autoFire2) & (BUTTON_REGULAR_MASK|BUTTON_RECORDINGONLY_MASK); + uint32 pressedKeys = eraseAll ? 0 : keys; + + char colorList[64]; + memset(colorList, 1, strlen(string)); + + static int lastKeys = 0; + + int i; + for (i=0; i < 15; i++) + { + const int j = KeyOrder[i]; + const int mask = (1 << (j)); + bool pressed = ((pressedKeys & mask)!=0); + const bool autoHeld = (autoHeldKeys & mask)!=0; + const bool autoFired = (autoFireKeys & mask)!=0; + const bool erased = (lastKeys & mask)!=0 && (!pressed && !autoHeld && !(autoFired&&!pressed)); + extern int textMethod; + if(textMethod != 2 && (autoHeld || (autoFired&&!pressed) || erased)) + { + int colorNum = 1; // default is white + if(autoHeld) + colorNum += (pressed ? 2 : 1); // yellow if pressed, red if not + else if(autoFired) + colorNum += 5; // blue if autofired and not currently pressed + else if(erased) + colorNum += 8; // black on black + + colorList[strlen(" ")+i] = colorNum; + pressed = true; + } + string[strlen(" ")+i] = pressed ? KeyMap[j] : ' '; + } + lastKeys = currentButtons[0]; + lastKeys |= theApp.autoHold & (BUTTON_REGULAR_MASK|BUTTON_RECORDINGONLY_MASK); + lastKeys |= (theApp.autoFire|theApp.autoFire2) & (BUTTON_REGULAR_MASK|BUTTON_RECORDINGONLY_MASK); + + systemScreenMessage(string,2,20, colorList); + + #endif +} + +void VBAUpdateFrameCountDisplay () +{ + char frameDisplayString [64]; + + switch(Movie.state) + { + case MOVIE_STATE_PLAY: + { +# if (defined(WIN32) && !defined(SDL)) + if(theApp.frameCounter) +# else + if(false) /// SDL FIXME +# endif + { + sprintf(frameDisplayString, "%d / %d", Movie.currentFrame, Movie.header.length_frames); + systemScreenMessage(frameDisplayString,1,600); + } + } + break; + + case MOVIE_STATE_RECORD: + { +# if (defined(WIN32) && !defined(SDL)) + if(theApp.frameCounter) +# else + if(false) /// SDL FIXME +# endif + { + sprintf(frameDisplayString, "%d", Movie.currentFrame); + systemScreenMessage(frameDisplayString,1,600); + } + } + break; + + default: + { +# if (defined(WIN32) && !defined(SDL)) + if(theApp.frameCounter) + { + sprintf(frameDisplayString, "%d (no movie)", theApp.globalFrameCount); + systemScreenMessage(frameDisplayString,1,600); + } +# else + /// SDL FIXME +# endif + } + break; + } +} + +void VBAMovieUpdate (int controllerNum) +{ + switch(Movie.state) + { + case MOVIE_STATE_PLAY: + { + if((Movie.header.controllerFlags & MOVIE_CONTROLLER(controllerNum)) == 0) + break; // not a controller we're recognizing + + if(Movie.currentFrame>=Movie.header.length_frames) + { + change_state(MOVIE_STATE_NONE); + systemScreenMessage("Movie end"); + return; + } + else + { + read_frame_controller_data(controllerNum); + ++Movie.currentFrame; + } + } + break; + + case MOVIE_STATE_RECORD: + { + if((Movie.header.controllerFlags & MOVIE_CONTROLLER(controllerNum)) == 0) + break; // not a controller we're recognizing + + write_frame_controller_data(controllerNum); + ++Movie.currentFrame; + Movie.header.length_frames=Movie.currentFrame; + fwrite((Movie.inputBufferPtr - Movie.bytesPerFrame), 1, Movie.bytesPerFrame, Movie.file); + } + break; + + default: + break; + } + + VBAUpdateFrameCountDisplay(); + +#if (defined(WIN32) && !defined(SDL)) + if(theApp.inputDisplay) +#else + if(false) /// SDL FIXME +#endif + DisplayPressedKeys(); + + // if the movie's been set to pause at a certain frame + if(VBAMovieActive() && Movie.pauseFrame >= 0 && Movie.currentFrame >= (uint32)Movie.pauseFrame) + { +# if (defined(WIN32) && !defined(SDL)) + theApp.paused = true; + if(theApp.sound) + theApp.sound->pause(); + theApp.speedupToggle = false; +# else + extern bool paused; // from SDL.cpp + paused = true; + systemSoundPause(); +# endif + Movie.pauseFrame = -1; + } +} + +void VBAMovieStop (bool8 suppress_message) +{ + if(Movie.state!=MOVIE_STATE_NONE) + { + change_state(MOVIE_STATE_NONE); + if(!suppress_message) + systemScreenMessage("Movie stop"); + } +} + +int VBAMovieGetInfo (const char* filename, SMovie* info) +{ + flush_movie(); + + assert(info != NULL); + if(info == NULL) + return -1; + + FILE* file; + int result; + SMovie & local_movie = *info; + + memset(info, 0, sizeof(*info)); + if(filename[0]=='\0' || !(file=fopen(filename, "rb"))) + return FILE_NOT_FOUND; + + // read header + if((result=(read_movie_header(file, local_movie)))!=SUCCESS) + return result; + + // read the metadata / author info from file + fread(local_movie.authorInfo, 1, sizeof(char) * MOVIE_METADATA_SIZE, file); + + + strncpy(local_movie.filename, filename, _MAX_PATH); + local_movie.filename[_MAX_PATH-1] = '\0'; + + if(Movie.file != NULL && _stricmp(local_movie.filename, Movie.filename) == 0) // alreadyOpen + { + local_movie.bytesPerFrame = Movie.bytesPerFrame; + local_movie.header.length_frames = Movie.header.length_frames; + } + else + { + // recalculate length of movie from the file size + local_movie.bytesPerFrame = bytes_per_frame(local_movie); + fseek(file, 0, SEEK_END); + int fileSize = ftell(file); + local_movie.header.length_frames = (fileSize - local_movie.header.offset_to_controller_data) / local_movie.bytesPerFrame - 1; + } + + fclose(file); + + if(_access(filename, W_OK)) + info->readOnly = true; + + return SUCCESS; +} + +bool8 VBAMovieActive () +{ + return (Movie.state != MOVIE_STATE_NONE); +} + +bool8 VBAMovieLoading () +{ + return loadingMovie; +} + +bool8 VBAMovieReadOnly () +{ + if(!VBAMovieActive()) + return false; + + return Movie.readOnly; +} + +void VBAMovieToggleReadOnly () +{ + if(!VBAMovieActive()) + return; + + Movie.readOnly = !Movie.readOnly; + + systemScreenMessage(Movie.readOnly ? "Movie now read-only" : "Movie now editable"); +} + +uint32 VBAMovieGetId () +{ + if(!VBAMovieActive()) + return 0; + + return Movie.header.uid; +} + +uint32 VBAMovieGetLength () +{ + if(!VBAMovieActive()) + return 0; + + return Movie.header.length_frames; +} + +uint32 VBAMovieGetFrameCounter () +{ + if(!VBAMovieActive()) + return 0; + + return Movie.currentFrame; +} + +void VBAMovieFreeze (uint8** buf, uint32* size) +{ + // sanity check + if(!VBAMovieActive()) + { + return; + } + + *buf = NULL; + *size = 0; + + // compute size needed for the buffer + uint32 size_needed = sizeof(Movie.header.uid) + sizeof(Movie.currentFrame) + sizeof(Movie.header.length_frames); // room for header.uid, currentFrame, and header.length_frames + size_needed += (uint32)(Movie.bytesPerFrame * (Movie.header.length_frames+1)); + *buf=new uint8[size_needed]; + *size=size_needed; + + uint8* ptr = *buf; + if(!ptr) + { + return; + } + + Write32(Movie.header.uid, ptr); + Write32(Movie.currentFrame, ptr); + Write32(Movie.header.length_frames, ptr); + + memcpy(ptr, Movie.inputBuffer, Movie.bytesPerFrame * (Movie.header.length_frames+1)); +} + +bool8 VBAMovieSwitchToRecording () +{ + if(Movie.state != MOVIE_STATE_PLAY || Movie.readOnly) + return false; + + change_state(MOVIE_STATE_RECORD); + systemScreenMessage("Movie re-record"); + + Movie.header.length_frames = Movie.currentFrame; + ++Movie.header.rerecord_count; + + flush_movie(); + + return true; +} + +int VBAMovieUnfreeze (const uint8* buf, uint32 size) +{ + // sanity check + if(!VBAMovieActive()) + { + return NOT_FROM_A_MOVIE; + } + + const uint8* ptr = buf; + if(size < sizeof(Movie.header.uid) + sizeof(Movie.currentFrame) + sizeof(Movie.header.length_frames)) + { + return WRONG_FORMAT; + } + + uint32 movie_id = Read32(ptr); + uint32 current_frame = Read32(ptr); + uint32 max_frame = Read32(ptr); + uint32 space_needed = (Movie.bytesPerFrame * (max_frame+1)); + + if(movie_id != Movie.header.uid) + return NOT_FROM_THIS_MOVIE; + + if(current_frame > max_frame) + return INVALID_FRAME; + + if(space_needed > size) + return WRONG_FORMAT; + + if(!Movie.readOnly) + { + // here, we are going to take the input data from the savestate + // and make it the input data for the current movie, then continue + // writing new input data at the currentFrame pointer + change_state(MOVIE_STATE_RECORD); +/// systemScreenMessage("Movie re-record"); + + Movie.currentFrame = current_frame; + Movie.header.length_frames = max_frame; + ++Movie.header.rerecord_count; + + reserve_buffer_space(space_needed); + memcpy(Movie.inputBuffer, ptr, space_needed); + flush_movie(); + fseek(Movie.file, Movie.header.offset_to_controller_data+(Movie.bytesPerFrame * (Movie.currentFrame+1)), SEEK_SET); + } + else + { + // here, we are going to keep the input data from the movie file + // and simply rewind to the currentFrame pointer + // this will cause a desync if the savestate is not in sync + // with the on-disk recording data, but it's easily solved + // by loading another savestate or playing the movie from the beginning + + // and older savestate might have a currentFrame pointer past + // the end of the input data, so check for that here + if(current_frame > Movie.header.length_frames) + return INVALID_FRAME; + + change_state(MOVIE_STATE_PLAY); +/// systemScreenMessage("Movie rewind"); + + Movie.currentFrame = current_frame; + } + + Movie.inputBufferPtr = Movie.inputBuffer + (Movie.bytesPerFrame * Movie.currentFrame); + +/// for(int controller = 0 ; controller < MOVIE_NUM_OF_POSSIBLE_CONTROLLERS ; controller++) +/// if((Movie.header.controllerFlags & MOVIE_CONTROLLER(controller)) != 0) +/// read_frame_controller_data(controller); + read_frame_controller_data(0); // correct if we can assume the first controller is active, which we can on all GBx/xGB systems + + return SUCCESS; +} + +uint32 VBAGetCurrentInputOf (int controllerNum, bool normalOnly) +{ + if(controllerNum < 0 || controllerNum >= MOVIE_NUM_OF_POSSIBLE_CONTROLLERS) + return 0; + + return normalOnly ? (currentButtons[controllerNum] & BUTTON_REGULAR_MASK) : currentButtons[controllerNum]; +} + +uint32 VBAMovieGetState () +{ + if(!VBAMovieActive()) + return MOVIE_STATE_NONE; + + return Movie.state; +} + +void VBAMovieSignalReset () +{ + if(ignoreNextReset) + { + ignoreNextReset = false; + return; + } + + if(Movie.state == MOVIE_STATE_RECORD) + resetSignaled = true; +} + +void VBAMovieSignalIgnoreNextReset () +{ + ignoreNextReset = true; +} + +void VBAMovieSetMetadata (const char * info) +{ + memcpy(Movie.authorInfo, info, MOVIE_METADATA_SIZE); // strncpy would omit post-0 bytes + Movie.authorInfo[MOVIE_METADATA_SIZE-1] = '\0'; + + if(Movie.file) + { + // (over-)write the header + fseek(Movie.file, 0, SEEK_SET); + write_movie_header(Movie.file, Movie); + + // write the metadata / author info to file + fwrite(Movie.authorInfo, 1, sizeof(char) * MOVIE_METADATA_SIZE, Movie.file); + + fflush(Movie.file); + } +} + +void VBAMovieRestart () +{ + if(VBAMovieActive()) + { + VBAMovieStop(true); + + char movieName [_MAX_PATH]; + strcpy(movieName, Movie.filename); + VBAMovieOpen(movieName, Movie.readOnly); // can't just pass in Movie.filename, since VBAMovieOpen clears out Movie's variables + } +} + +void VBAMovieSetPauseAt (int at) +{ + Movie.pauseFrame = at; +} diff --git a/src/movie.h b/src/movie.h new file mode 100644 index 0000000..5753ba0 --- /dev/null +++ b/src/movie.h @@ -0,0 +1,169 @@ +#ifndef _MOVIE_H_ +#define _MOVIE_H_ + +#include +#include +#include + +#ifndef SUCCESS +# define SUCCESS 1 +# define WRONG_FORMAT (-1) +# define WRONG_VERSION (-2) +# define FILE_NOT_FOUND (-3) +# define NOT_FROM_THIS_MOVIE (-4) +# define NOT_FROM_A_MOVIE (-5) +# define INVALID_FRAME (-6) +# define UNKNOWN_ERROR (-7) +#endif + + +#define VBM_MAGIC (0x1a4D4256) // VBM0x1a +#define VBM_VERSION (1) +#define VBM_HEADER_SIZE (64) +#define CONTROLLER_DATA_SIZE (2) +#define BUFFER_GROWTH_SIZE (4096) +#define MOVIE_METADATA_SIZE (192) +#define MOVIE_METADATA_AUTHOR_SIZE (64) + +#define MOVIE_START_FROM_SNAPSHOT (1<<0) +#define MOVIE_START_FROM_SRAM (1<<1) + +#define MOVIE_CONTROLLER(i) (1<<(i)) +#define MOVIE_CONTROLLERS_ANY_MASK (MOVIE_CONTROLLER(0)|MOVIE_CONTROLLER(1)|MOVIE_CONTROLLER(2)|MOVIE_CONTROLLER(3)) +#define MOVIE_NUM_OF_POSSIBLE_CONTROLLERS (4) + +#define MOVIE_TYPE_GBA (1<<0) +#define MOVIE_TYPE_GBC (1<<1) +#define MOVIE_TYPE_SGB (1<<2) + +#define MOVIE_SETTING_USEBIOSFILE (1<<0) +#define MOVIE_SETTING_SKIPBIOSFILE (1<<1) +#define MOVIE_SETTING_RTCENABLE (1<<2) +#define MOVIE_SETTING_UNSUPPORTED1 (1<<3) +#define MOVIE_SETTING_LAGHACK (1<<4) +#define MOVIE_SETTING_GBCFF55FIX (1<<5) + + +#define ZLIB + +///#ifdef ZLIB +#ifndef WIN32 +#include "zlib.h" +#endif +#define STREAM gzFile +/*#define READ_STREAM(p,l,s) gzread (s,p,l) +#define WRITE_STREAM(p,l,s) gzwrite (s,p,l) +#define OPEN_STREAM(f,m) gzopen (f,m) +#define REOPEN_STREAM(f,m) gzdopen (f,m) +#define FIND_STREAM(f) gztell(f) +#define REVERT_STREAM(f,o,s) gzseek(f,o,s) +#define CLOSE_STREAM(s) gzclose (s) +#else +#define STREAM FILE * +#define READ_STREAM(p,l,s) fread (p,1,l,s) +#define WRITE_STREAM(p,l,s) fwrite (p,1,l,s) +#define OPEN_STREAM(f,m) fopen (f,m) +#define REOPEN_STREAM(f,m) fdopen (f,m) +#define FIND_STREAM(f) ftell(f) +#define REVERT_STREAM(f,o,s) fseek(f,o,s) +#define CLOSE_STREAM(s) fclose (s) +#endif*/ + +typedef unsigned char uint8; +typedef signed char bool8; +typedef char int8; + +typedef unsigned short uint16; +typedef short int16; + +typedef unsigned long uint32; +typedef long int32; + +typedef unsigned long long uint64; +typedef long long int64; + + +enum MovieState +{ + MOVIE_STATE_NONE=0, + MOVIE_STATE_PLAY, + MOVIE_STATE_RECORD +}; + +struct SMovieFileHeader +{ + uint32 magic; // VBM0x1a + uint32 version; // 1 + int32 uid; // used to match savestates to a particular movie + uint32 length_frames; + uint32 rerecord_count; + uint8 startFlags; + uint8 controllerFlags; + uint8 typeFlags; + uint8 optionFlags; + uint32 saveType; // emulator setting value + uint32 flashSize; // emulator setting value + uint32 gbEmulatorType; // emulator setting value + char romTitle [12]; + uint8 reservedByte; + uint8 romCRC; // the CRC of the ROM used while recording + uint16 romOrBiosChecksum; // the Checksum of the ROM used while recording, or a CRC of the BIOS if GBA + uint32 romGameCode; // the Game Code of the ROM used while recording, or "\0\0\0\0" if not GBA + uint32 offset_to_savestate; // offset to the savestate or SRAM inside file, set to 0 if unused + uint32 offset_to_controller_data; // offset to the controller data inside file +}; + +struct SMovie +{ + enum MovieState state; + char filename [/*_MAX_PATH*/260]; + FILE* file; + bool8 readOnly; + int pauseFrame; + + SMovieFileHeader header; + char authorInfo [MOVIE_METADATA_SIZE]; + + uint32 currentFrame; // should = length_frames when recording, and be < length_frames when playing + uint32 bytesPerFrame; + uint8* inputBuffer; + uint32 inputBufferSize; + uint8* inputBufferPtr; +}; + +// methods used by the user-interface code +int VBAMovieOpen (const char* filename, bool8 read_only); +int VBAMovieCreate (const char* filename, const char* authorInfo, uint8 startFlags, uint8 controllerFlags, uint8 typeFlags); +int VBAMovieGetInfo (const char* filename, SMovie* info); +void VBAMovieStop (bool8 suppress_message); +const char *VBAChooseMovieFilename(bool8 read_only); + +// methods used by the emulation +void VBAMovieInit (); +void VBAMovieUpdate (int controllerNum=0); +void VBAUpdateFrameCountDisplay (); +//bool8 VBAMovieRewind (uint32 at_frame); +void VBAMovieFreeze (uint8** buf, uint32* size); +int VBAMovieUnfreeze (const uint8* buf, uint32 size); +void VBAMovieRestart (); + +// accessor functions +bool8 VBAMovieActive (); +bool8 VBAMovieLoading (); +// the following accessors return 0/false if !VBAMovieActive() +bool8 VBAMovieReadOnly (); +uint32 VBAMovieGetId (); +uint32 VBAMovieGetLength (); +uint32 VBAMovieGetFrameCounter (); +uint32 VBAMovieGetState (); + +uint32 VBAGetCurrentInputOf (int controllerNum, bool normalOnly=true); +void VBAMovieSignalReset (); +void VBAMovieSignalIgnoreNextReset (); +void VBAMovieSetMetadata (const char * info); +void VBAMovieToggleReadOnly (); +bool8 VBAMovieSwitchToRecording (); +void VBAMovieSetPauseAt (); +void VBAMovieSetPauseAt (int at); + +#endif diff --git a/src/nesvideos-piece.cpp b/src/nesvideos-piece.cpp new file mode 100644 index 0000000..2003114 --- /dev/null +++ b/src/nesvideos-piece.cpp @@ -0,0 +1,515 @@ +#include +#include +#include +#include + +/* Note: This module assumes everyone uses RGB15 as display depth */ + +static std::string VIDEO_CMD = + "mencoder - -o test0.avi" + " -noskip -mc 0" + " -ovc lavc" + " -oac mp3lame" + " -lameopts preset=256:aq=2:mode=3" + " -lavcopts vcodec=ffv1:context=0:format=BGR32:coder=0:vstrict=-1" + " >& mencoder.log"; + +static void FlushWrite(FILE* fp, const unsigned char*buf, unsigned length); + +#define BGR24 (0x42475218) // BGR24 fourcc +#define BGR16 (0x42475210) // BGR16 fourcc +#define BGR15 (0x4247520F) // BGR15 fourcc + +static FILE* (*openFunc) (const char*, const char*) = NULL; +static int (*closeFunc) (FILE*) = NULL; + +#if (defined(WIN32) || defined(win32)) // capital is standard, but check for either + #include + #define popen _popen; + #define pclose _pclose; +#endif + +#define u32(n) (n)&255,((n)>>8)&255,((n)>>16)&255,((n)>>24)&255 +#define u16(n) (n)&255,((n)>>8)&255 +#define s4(s) s[0],s[1],s[2],s[3] + +static const unsigned FPS_SCALE = (0x1000000); + +// general-purpose A/V sync debugging, ignored unless explicitly enabled with NESVideoEnableDebugging +static void (*debugVideoMessageFunc)(const char *msg) = NULL; +static void (*debugAudioMessageFunc)(const char *msg) = NULL; +static unsigned audioFramesWritten=0, videoFramesWritten=1; // logo adds 1 "frame" to audio, so offset that (A/V frames shouldn't necessarily match up depending on the rates, but should at least make them start out matching in case they do) +static double audioSecondsWritten=0, videoSecondsWritten=0; + + +static class AVI +{ + FILE* avifp; + + bool KnowVideo; + unsigned width; + unsigned height; + unsigned fps_scaled; + std::vector VideoBuffer; + + bool KnowAudio; + unsigned rate; + unsigned chans; + unsigned bits; + std::vector AudioBuffer; + +public: + AVI() : + avifp(NULL), + KnowVideo(false), + KnowAudio(false) + { + } + ~AVI() + { + if(avifp) closeFunc(avifp); + } + + void Audio(unsigned r,unsigned b,unsigned c, + const unsigned char*d, unsigned nsamples) + { + if(!KnowAudio) + { + rate = r; + chans = c; + bits = b; + KnowAudio = true; + CheckFlushing(); + } + unsigned bytes = nsamples*chans*(bits/8); + + if(debugAudioMessageFunc) + { + audioFramesWritten++; + audioSecondsWritten += (double)nsamples / (double)rate; // += bytes times seconds per byte + char temp [64]; + sprintf(temp, "A: %.2lf s, %d f", audioSecondsWritten, audioFramesWritten); + debugAudioMessageFunc(temp); + } + + if(KnowVideo) + SendAudioFrame(d, bytes); + else + { + AudioBuffer.insert(AudioBuffer.end(), d, d+bytes); + fprintf(stderr, "Buffering %u bytes of audio\n", bytes); + } + } + void Video(unsigned w,unsigned h,unsigned f, const unsigned char*d) + { + if(!KnowVideo) + { + width=w; + height=h; + fps_scaled=f; + KnowVideo = true; + CheckFlushing(); + } + + unsigned bytes = width*height*2; + + //std::vector tmp(bytes, 'k'); + //d = &tmp[0]; + + if(debugVideoMessageFunc) + { + videoFramesWritten++; + videoSecondsWritten += (double)FPS_SCALE / (double)fps_scaled; // += seconds per frame + char temp [64]; + sprintf(temp, "V: %.2lf s, %d f", videoSecondsWritten, videoFramesWritten); + debugVideoMessageFunc(temp); + } + + if(KnowAudio) + SendVideoFrame(d, bytes); + else + { + VideoBuffer.insert(VideoBuffer.end(), d, d+bytes); + fprintf(stderr, "Buffering %u bytes of video\n", bytes); + } + } + +private: + void CheckFlushing() + { + //AudioBuffer.clear(); + //VideoBuffer.clear(); + + if(KnowAudio && KnowVideo) + { + unsigned last_offs; + + // Flush Audio + + last_offs = 0; + while(last_offs < AudioBuffer.size()) + { + unsigned bytes = rate / (fps_scaled / FPS_SCALE); + bytes *= chans*(bits/8); + + unsigned remain = AudioBuffer.size() - last_offs; + if(bytes > remain) bytes = remain; + if(!bytes) break; + + unsigned begin = last_offs; + last_offs += bytes; + SendAudioFrame(&AudioBuffer[begin], bytes); + } + AudioBuffer.erase(AudioBuffer.begin(), AudioBuffer.begin()+last_offs); + + // Flush Video + + last_offs = 0; + while(last_offs < VideoBuffer.size()) + { + unsigned bytes = width*height*2; + unsigned remain = VideoBuffer.size() - last_offs; + if(bytes > remain) bytes = remain; + if(!bytes)break; + + unsigned begin = last_offs; + last_offs += bytes; + SendVideoFrame(&VideoBuffer[begin], bytes); + } + VideoBuffer.erase(VideoBuffer.begin(), VideoBuffer.begin()+last_offs); + } + } + + void SendVideoFrame(const unsigned char* vidbuf, unsigned framesize) + { + CheckBegin(); + + //fprintf(stderr, "Writing 00dc of %u bytes\n", framesize); + + const unsigned char header[] = { s4("00dc"), u32(framesize) }; + FlushWrite(avifp, header, sizeof(header)); + FlushWrite(avifp, vidbuf, framesize); + } + + void SendAudioFrame(const unsigned char* audbuf, unsigned framesize) + { + CheckBegin(); + + //fprintf(stderr, "Writing 01wb of %u bytes\n", framesize); + + const unsigned char header[] = { s4("01wb"), u32(framesize) }; + FlushWrite(avifp, header, sizeof(header)); + FlushWrite(avifp, audbuf, framesize); + } + + void CheckBegin() + { + if(avifp) return; + + if(!openFunc) openFunc = popen; // default + if(!closeFunc) closeFunc = pclose; // default + + avifp = openFunc(VIDEO_CMD.c_str(), "wb"); + if(!avifp) return; + + const unsigned fourcc = BGR16; + const unsigned framesize = width*height*2; + + const unsigned aud_rate = rate; + const unsigned aud_chans = chans; + const unsigned aud_bits = bits; + + const unsigned nframes = 0; //unknown + const unsigned scale = FPS_SCALE; + const unsigned scaled_fps = fps_scaled; + + const unsigned SIZE_strh_vids = 4 + 4*2 + 2*2 + 8*4 + 2*4; + const unsigned SIZE_strf_vids = 4*3 + 2*2 + 4*6; + const unsigned SIZE_strl_vids = 4+ 4+(4+SIZE_strh_vids) + 4+(4+SIZE_strf_vids); + + const unsigned SIZE_strh_auds = 4 + 4*3 + 2*2 + 4*8 + 2*4; + const unsigned SIZE_strf_auds = 2*2 + 4*2 + 2*3; + const unsigned SIZE_strl_auds = 4+ 4+(4+SIZE_strh_auds) + 4+(4+SIZE_strf_auds); + + const unsigned SIZE_avih = 4*12; + const unsigned SIZE_hdrl = 4+4+ (4+SIZE_avih) + 4 + (4+SIZE_strl_vids) + 4 + (4+SIZE_strl_auds); + const unsigned SIZE_movi = 4 + nframes*(4+4+framesize); + const unsigned SIZE_avi = 4+4+ (4+SIZE_hdrl) + 4 + (4+SIZE_movi); + + const unsigned char AVIheader[] = + { + s4("RIFF"), + u32(SIZE_avi), + s4("AVI "), + + // HEADER + + s4("LIST"), + u32(SIZE_hdrl), + s4("hdrl"), + + s4("avih"), + u32(SIZE_avih), + u32(0), + u32(0), + u32(0), + u32(0), + u32(nframes), + u32(0), + u32(2), // two streams + u32(0), + u32(0), + u32(0), + u32(0), + u32(0), + + // VIDEO HEADER + + s4("LIST"), + u32(SIZE_strl_vids), + s4("strl"), + + s4("strh"), + u32(SIZE_strh_vids), + s4("vids"), + u32(0), + u32(0), + u16(0), + u16(0), + u32(0), + u32(scale), + u32(scaled_fps), + u32(0), + u32(0), + u32(0), + u32(0), + u32(0), + u16(0), + u16(0), + u16(0), + u16(0), + + s4("strf"), + u32(SIZE_strf_vids), + u32(0), + u32(width), + u32(height), + u16(0), + u16(0), + u32(fourcc), + u32(0), + u32(0), + u32(0), + u32(0), + u32(0), + + // AUDIO HEADER + + s4("LIST"), + u32(SIZE_strl_auds), + s4("strl"), + + s4("strh"), + u32(SIZE_strh_auds), + s4("auds"), + u32(0), //fourcc + u32(0), //handler + u32(0), //flags + u16(0), //prio + u16(0), //lang + u32(0), //init frames + u32(1), //scale + u32(aud_rate), + u32(0), //start + u32(0), //rate*length + u32(1048576), //suggested bufsize + u32(0), //quality + u32(aud_chans * (aud_bits / 8)), //sample size + u16(0), //frame size + u16(0), + u16(0), + u16(0), + + s4("strf"), + u32(SIZE_strf_auds), + u16(1), // pcm format + u16(aud_chans), + u32(aud_rate), + u32(aud_rate * aud_chans * (aud_bits/8)), // samples per second + u16(aud_chans * (aud_bits/8)), //block align + u16(aud_bits), //bits + u16(0), //cbSize + + // MOVIE + + s4("LIST"), + u32(SIZE_movi), + s4("movi") + }; + + FlushWrite(avifp, AVIheader, sizeof(AVIheader)); + } +} AVI; + +extern "C" +{ + int LoggingEnabled = 0; /* 0=no, 1=yes, 2=recording! */ + + const char* NESVideoGetVideoCmd() + { + return VIDEO_CMD.c_str(); + } + void NESVideoSetVideoCmd(const char *cmd) + { + VIDEO_CMD = cmd; + } + void NESVideoEnableDebugging( void videoMessageFunc(const char *msg), void audioMessageFunc(const char *msg) ) + { + debugVideoMessageFunc = videoMessageFunc; + debugAudioMessageFunc = audioMessageFunc; + } + void NESVideoSetFileFuncs( FILE* open(const char *,const char *), int close(FILE*) ) + { + openFunc = open; + closeFunc = close; + } + + void NESVideoLoggingVideo + (const void*data, unsigned width,unsigned height, + unsigned fps_scaled + ) + { + if(LoggingEnabled < 2) return; + + unsigned LogoFrames = fps_scaled >> 24; + + static bool First = true; + if(First) + { + First=false; + /* Bisqwit's logo addition routine. */ + /* If you don't have his files, this function does nothing + * and it does not matter at all. + */ + + const char *background = + width==320 ? "logo320_240" + : width==160 ? "logo160_144" + : width==240 ? "logo240_160" + : height>224 ? "logo256_240" + : "logo256_224"; + + /* Note: This should be 1 second long. */ + for(unsigned frame = 0; frame < LogoFrames; ++frame) + { + char Buf[4096]; + sprintf(Buf, "/shares/home/bisqwit/povray/nesvlogo/%s_f%u.tga", + background, frame); + + FILE*fp = fopen(Buf, "rb"); + if(!fp) // write blackness when missing frames to keep the intro 1 second long: + { + unsigned bytes = width*height*2; + unsigned char* buf = (unsigned char*)malloc(bytes); + if(buf) + { + memset(buf,0,bytes); + AVI.Video(width,height,fps_scaled, buf); + if(debugVideoMessageFunc) videoFramesWritten--; + free(buf); + } + } + else // write 1 frame of the logo: + { + int idlen = fgetc(fp); + /* Silently ignore all other header data. + * These files are assumed to be uncompressed BGR24 tga files with Y swapped. + * Even their geometry is assumed to match perfectly. + */ + fseek(fp, 1+1+2+2+1+ /*org*/2+2+ /*geo*/2+2+ 1+1+idlen, SEEK_CUR); + + bool yflip=true; + std::vector data(width*height*3); + for(unsigned y=height; y-->0; ) + fread(&data[y*width*3], 1, width*3, fp); + fclose(fp); + + std::vector result(width*height); + for(unsigned pos=0, max=result.size(); pos 0) + { + unsigned bytes = n*chans*(bits/8); + unsigned char* buf = (unsigned char*)malloc(bytes); + if(buf) + { + memset(buf,0,bytes); + AVI.Audio(rate,bits,chans, buf, n); + free(buf); + } + } + } + + AVI.Audio(rate,bits,chans, (const unsigned char*) data, nsamples); + } +} /* extern "C" */ + + + +static void FlushWrite(FILE* fp, const unsigned char*buf, unsigned length) +{ +/// unsigned failures = 0; +/// const static int FAILURE_THRESH = 8092; // don't want to loop infinitely if we keep failing to make progress - actually maybe you would want this, so the checking is disabled + while(length > 0 /*&& failures < FAILURE_THRESH*/) + { + unsigned written = fwrite(buf, 1, length, fp); +/// if(written == 0) +/// failures++; +/// else +/// { + length -= written; + buf += written; +/// failures = 0; +/// } + } +/// if(failures >= FAILURE_THRESH) +/// { +/// fprintf(stderr, "FlushWrite() failed to write %d bytes %d times - giving up.", length, failures); +/// LoggingEnabled = 0; +/// } +} diff --git a/src/nesvideos-piece.h b/src/nesvideos-piece.h new file mode 100644 index 0000000..9c62c7d --- /dev/null +++ b/src/nesvideos-piece.h @@ -0,0 +1,48 @@ +#ifndef NESVPIECEhh +#define NESVPIECEhh + +#define NESVIDEOS_LOGGING 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Is video logging enabled? 0=no, 1=yes, 2=active. Default value: 0 */ +extern int LoggingEnabled; + +/* Get and set the video recording command (shell command) */ +extern const char* NESVideoGetVideoCmd(); +extern void NESVideoSetVideoCmd(const char *cmd); + +/* Tells to use these functions for obtaining/releasing FILE pointers for writing - if not specified, popen/pclose are used. */ +extern void NESVideoSetFileFuncs( FILE* openFunc(const char *,const char *), int closeFunc(FILE*) ); + +/* Tells to call these functions per frame with amounts (seconds and frames) of video and audio progress */ +extern void NESVideoEnableDebugging( void videoMessageFunc(const char *msg), void audioMessageFunc(const char *msg) ); + +/* Save 1 frame of video. (Assumed to be 16-bit RGB) */ +/* FPS is scaled by 24 bits (*0x1000000) */ +/* Does not do anything if LoggingEnabled<2. */ +extern void NESVideoLoggingVideo + (const void*data, unsigned width, unsigned height, + unsigned fps_scaled); + +/* Save N bytes of audio. bytes_per_second is required on the first call. */ +/* Does not do anything if LoggingEnabled<2. */ +/* The interval of calling this function is not important, as long as all the audio + * data is eventually written without too big delay (5 seconds is too big) + * This function may be called multiple times per video frame, or once per a few video + * frames, or anything in between. Just that all audio data must be written exactly once, + * and in order. */ +extern void NESVideoLoggingAudio + (const void*data, + unsigned rate, unsigned bits, unsigned chans, + unsigned nsamples); +/* nsamples*chans*(bits/8) = bytes in *data. */ +/* rate*chans*(bits/8) = bytes per second. */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/pixel.cpp b/src/pixel.cpp new file mode 100644 index 0000000..5673ed2 --- /dev/null +++ b/src/pixel.cpp @@ -0,0 +1,150 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" + +extern int RGB_LOW_BITS_MASK; + +void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *xP = (u32 *) deltaPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + u32 currentDelta; + u32 nextDelta; + + finish = (u8 *) bP + ((width+2) << 1); + nextPixel = *bP++; + nextDelta = *xP++; + + do { + currentPixel = nextPixel; + currentDelta = nextDelta; + nextPixel = *bP++; + nextDelta = *xP++; + + if ((nextPixel != nextDelta) || (currentPixel != currentDelta)) { + u32 colorA, colorB, product; + + *(xP - 2) = currentPixel; +#ifdef WORDS_BIGENDIAN + colorA = currentPixel >> 16; + colorB = currentPixel & 0xffff; +#else + colorA = currentPixel & 0xffff; + colorB = currentPixel >> 16; +#endif + product = (((colorA & colorMask) >> 1) & colorMask) >> 1; + +#ifdef WORDS_BIGENDIAN + *(nL) = (product << 16) | (product); + *(dP) = (colorA << 16) | product; +#else + *(nL) = product | (product << 16); + *(dP) = colorA | (product << 16); +#endif + +#ifdef WORDS_BIGENDIAN + colorA = nextPixel >> 16; +#else + colorA = nextPixel & 0xffff; +#endif + product = (((colorB & colorMask) >> 1) & colorMask) >> 1; +#ifdef WORDS_BIGENDIAN + *(nL + 1) = (product << 16) | (product); + *(dP + 1) = (colorB << 16) | (product); +#else + *(nL + 1) = (product) | (product << 16); + *(dP + 1) = (colorB) | (product << 16); +#endif + } + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + deltaPtr += srcPitch; + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~RGB_LOW_BITS_MASK; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + // u32 *xP = (u32 *) deltaPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + + finish = (u8 *) bP + ((width+1) << 2); + nextPixel = *bP++; + + do { + currentPixel = nextPixel; + nextPixel = *bP++; + + u32 colorA, colorB, product; + + colorA = currentPixel; + colorB = nextPixel; + + product = (((colorA & colorMask) >> 1) & colorMask) >> 1; + *(nL) = product; + *(nL+1) = product; + *(dP) = colorA; + *(dP+1) = product; + + nextPixel = *bP++; + colorA = nextPixel; + product = (((colorB & colorMask) >> 1) & colorMask) >> 1; + *(nL + 2) = product; + *(nL + 3) = product; + *(dP + 2) = colorB; + *(dP + 3) = product; + + dP += 4; + nL += 4; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} diff --git a/src/prof/Makefile.am b/src/prof/Makefile.am new file mode 100644 index 0000000..d1ae6fc --- /dev/null +++ b/src/prof/Makefile.am @@ -0,0 +1,7 @@ +noinst_LIBRARIES = libprof.a + +libprof_a_SOURCES = \ + gmon.h \ + gmon_out.h \ + prof.cpp \ + prof.h diff --git a/src/prof/Makefile.in b/src/prof/Makefile.in new file mode 100644 index 0000000..cff82d0 --- /dev/null +++ b/src/prof/Makefile.in @@ -0,0 +1,414 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +noinst_LIBRARIES = libprof.a + +libprof_a_SOURCES = \ + gmon.h \ + gmon_out.h \ + prof.cpp \ + prof.h + +subdir = src/prof +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libprof_a_AR = $(AR) cru +libprof_a_LIBADD = +am_libprof_a_OBJECTS = prof.$(OBJEXT) +libprof_a_OBJECTS = $(am_libprof_a_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/prof.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libprof_a_SOURCES) +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +SOURCES = $(libprof_a_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/prof/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libprof.a: $(libprof_a_OBJECTS) $(libprof_a_DEPENDENCIES) + -rm -f libprof.a + $(libprof_a_AR) libprof.a $(libprof_a_OBJECTS) $(libprof_a_LIBADD) + $(RANLIB) libprof.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prof.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/prof/gmon.h b/src/prof/gmon.h new file mode 100644 index 0000000..7f1c333 --- /dev/null +++ b/src/prof/gmon.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1983, 1991, 1993, 2001 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef gmon_h +#define gmon_h + +/* Size of the 4.4BSD gmon header */ +#define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4)) +#define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4)) + +#if 0 /* For documentation purposes only. */ + struct raw_phdr + { + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ + char ncnt[4]; /* size of sample buffer (plus this + header) */ + + char version[4]; /* version number */ + char profrate[4]; /* profiling clock rate */ + char spare[3*4]; /* reserved */ + }; +#endif + +#define GMONVERSION 0x00051879 + +/* Size of the old BSD gmon header */ +#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4) + +/* FIXME: Checking host compiler defines here means that we can't + use a cross gprof alpha OSF. */ +#if defined(__alpha__) && defined (__osf__) +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4) +#else +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4) +#endif + +#if 0 /* For documentation purposes only. */ + struct old_raw_phdr + { + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ + char ncnt[4]; /* size of sample buffer (plus this + header) */ +#if defined (__alpha__) && defined (__osf__) + /* + * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to + * a size that is a multiple of 8. + */ + char pad[4]; +#endif + }; +#endif + +/* + * Histogram counters are unsigned shorts: + */ +#define HISTCOUNTER unsigned short + +/* + * Fraction of text space to allocate for histogram counters here, 1/2: + */ +#define HISTFRACTION 2 + +/* + * Fraction of text space to allocate for from hash buckets. The + * value of HASHFRACTION is based on the minimum number of bytes of + * separation between two subroutine call points in the object code. + * Given MIN_SUBR_SEPARATION bytes of separation the value of + * HASHFRACTION is calculated as: + * + * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); + * + * For the VAX, the shortest two call sequence is: + * + * calls $0,(r0) + * calls $0,(r0) + * + * which is separated by only three bytes, thus HASHFRACTION is + * calculated as: + * + * HASHFRACTION = 3 / (2 * 2 - 1) = 1 + * + * Note that the division above rounds down, thus if MIN_SUBR_FRACTION + * is less than three, this algorithm will not work! + */ +#define HASHFRACTION 1 + +/* + * Percent of text space to allocate for tostructs with a minimum: + */ +#define ARCDENSITY 2 +#define MINARCS 50 + +struct tostruct + { + char *selfpc; + int count; + unsigned short link; + }; + +/* + * A raw arc, with pointers to the calling site and the called site + * and a count. Everything is defined in terms of characters so + * as to get a packed representation (otherwise, different compilers + * might introduce different padding): + */ +#if 0 /* For documentation purposes only. */ + struct raw_arc + { + char from_pc[sizeof(void *)]; + char self_pc[sizeof(void *)]; + char count[sizeof(long)]; + }; +#endif + +/* + * General rounding functions: + */ +#define ROUNDDOWN(x,y) (((x)/(y))*(y)) +#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) + +#endif /* gmon_h */ diff --git a/src/prof/gmon_out.h b/src/prof/gmon_out.h new file mode 100644 index 0000000..25dce59 --- /dev/null +++ b/src/prof/gmon_out.h @@ -0,0 +1,45 @@ +/* gmon_out.h + + Copyright 2000, 2001 Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* A gmon.out file consists of a header (defined by gmon_hdr) followed + by a sequence of records. Each record starts with a one-byte tag + identifying the type of records, followed by records specific data. */ +#ifndef gmon_out_h +#define gmon_out_h + +#define GMON_MAGIC "gmon" /* magic cookie */ +#define GMON_VERSION 1 /* version number */ + +/* Raw header as it appears on file (without padding). */ +struct gmon_hdr + { + char cookie[4]; + char version[4]; + char spare[3 * 4]; + }; + +/* Types of records in this file. */ +typedef enum + { + GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2 + } +GMON_Record_Tag; + +#endif /* gmon_out_h */ diff --git a/src/prof/prof.cpp b/src/prof/prof.cpp new file mode 100644 index 0000000..3ef7894 --- /dev/null +++ b/src/prof/prof.cpp @@ -0,0 +1,403 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// adapted from gmon.c +/*- + * Copyright (c) 1991, 1998 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. [rescinded 22 July 1999] + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include "gmon.h" +#include "gmon_out.h" + +#include "../GBA.h" +#include "../NLS.h" + +/* + * froms is actually a bunch of unsigned shorts indexing tos + */ +static int profiling = 3; +static unsigned short *froms; +static struct tostruct *tos = 0; +static long tolimit = 0; +static u32 s_lowpc = 0; +static u32 s_highpc = 0; +static unsigned long s_textsize = 0; + +static int ssiz; +static char *sbuf; +static int s_scale; + +static int hz = 0; +static int hist_num_bins = 0; +static char hist_dimension[16] = "seconds"; +static char hist_dimension_abbrev = 's'; + +/* see profil(2) where this is describe (incorrectly) */ +#define SCALE_1_TO_1 0x10000L + +void profPut32(char *b, u32 v) +{ + b[0] = v & 255; + b[1] = (v >> 8) & 255; + b[2] = (v >> 16) & 255; + b[3] = (v >> 24) & 255; +} + +void profPut16(char *b, u16 v) +{ + b[0] = v & 255; + b[1] = (v >> 8) & 255; +} + +int profWrite8(FILE *f, u8 b) +{ + if(fwrite(&b, 1, 1, f) != 1) + return 1; + return 0; +} + +int profWrite32(FILE *f, u32 v) +{ + char buf[4]; + + profPut32(buf, v); + if(fwrite(buf, 1, 4, f) != 4) + return 1; + return 0; +} + +int profWrite(FILE *f, char *buf, unsigned int n) +{ + if(fwrite(buf, 1, n, f) != n) + return 1; + return 0; +} + +/* Control profiling; + profiling is what mcount checks to see if + all the data structures are ready. */ + +void profControl(int mode) +{ + if (mode) { + /* start */ +#ifdef PROFILING + cpuProfil(sbuf, ssiz, (u32)s_lowpc, s_scale); +#endif + profiling = 0; + } else { + /* stop */ +#ifdef PROFILING + cpuProfil(NULL, 0, 0, 0); +#endif + profiling = 3; + } +} + + +#define MSG N_("No space for profiling buffer(s)\n") + +void profStartup(u32 lowpc, u32 highpc) +{ + int monsize; + char *buffer; + int o; + + /* + * round lowpc and highpc to multiples of the density we're using + * so the rest of the scaling (here and in gprof) stays in ints. + */ + lowpc = ROUNDDOWN(lowpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_lowpc = lowpc; + highpc = ROUNDUP(highpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_highpc = highpc; + s_textsize = highpc - lowpc; + monsize = (s_textsize / HISTFRACTION); + buffer = (char *)calloc(1, 2*monsize ); + if ( buffer == NULL ) { + systemMessage(0, MSG); + return; + } + froms = (unsigned short *) calloc(1, 4*s_textsize / HASHFRACTION ); + if ( froms == NULL ) { + systemMessage(0, MSG); + free(buffer); + buffer = NULL; + return; + } + tolimit = s_textsize * ARCDENSITY / 100; + if ( tolimit < MINARCS ) { + tolimit = MINARCS; + } else if ( tolimit > 65534 ) { + tolimit = 65534; + } + tos = (struct tostruct *) calloc(1, tolimit * sizeof( struct tostruct ) ); + if ( tos == NULL ) { + systemMessage(0, MSG); + + free(buffer); + buffer = NULL; + + free(froms); + froms = NULL; + + return; + } + tos[0].link = 0; + sbuf = buffer; + ssiz = monsize; + if ( monsize <= 0 ) + return; + o = highpc - lowpc; + if( monsize < o ) + s_scale = (int)(( (float) monsize / o ) * SCALE_1_TO_1); + else + s_scale = SCALE_1_TO_1; + profControl(1); +} + +void profCleanup() +{ + FILE *fd; + int fromindex; + int endfrom; + u32 frompc; + int toindex; + struct gmon_hdr ghdr; + + profControl(0); + fd = fopen( "gmon.out" , "wb" ); + if ( fd == NULL ) { + systemMessage( 0, "mcount: gmon.out" ); + return; + } + + memcpy(&ghdr.cookie[0], GMON_MAGIC, 4); + profPut32((char *)ghdr.version, GMON_VERSION); + + if(fwrite(&ghdr, sizeof(ghdr), 1, fd) != 1) { + systemMessage(0, "mcount: gmon.out header"); + fclose(fd); + return; + } + + if(hz == 0) + hz = 100; + + hist_num_bins = ssiz; + + if(profWrite8(fd, GMON_TAG_TIME_HIST) || + profWrite32(fd, (u32)s_lowpc) || + profWrite32(fd, (u32)s_highpc) || + profWrite32(fd, hist_num_bins) || + profWrite32(fd, hz) || + profWrite(fd, hist_dimension, 15) || + profWrite(fd, &hist_dimension_abbrev, 1)) { + systemMessage(0, "mcount: gmon.out hist"); + fclose(fd); + return; + } + u16 *hist_sample = (u16 *)sbuf; + + u16 count; + int i; + + for(i = 0; i < hist_num_bins; ++i) { + profPut16((char *)&count, hist_sample[i]); + + if(fwrite(&count, sizeof(count), 1, fd) != 1) { + systemMessage(0, "mcount: gmon.out sample"); + fclose(fd); + return; + } + } + + endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); + for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { + if ( froms[fromindex] == 0 ) { + continue; + } + frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms)); + for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) { + if(profWrite8(fd, GMON_TAG_CG_ARC) || + profWrite32(fd, (u32)frompc) || + profWrite32(fd, (u32)tos[toindex].selfpc) || + profWrite32(fd, tos[toindex].count)) { + systemMessage(0, "mcount: arc"); + fclose(fd); + return; + } + } + } + fclose(fd); +} + +void profCount() +{ + register char *selfpc; + register unsigned short *frompcindex; + register struct tostruct *top; + register struct tostruct *prevtop; + register long toindex; + + /* + * find the return address for mcount, + * and the return address for mcount's caller. + */ + + /* selfpc = pc pushed by mcount call. + This identifies the function that was just entered. */ + selfpc = (char *) reg[14].I; + /* frompcindex = pc in preceding frame. + This identifies the caller of the function just entered. */ + frompcindex = (unsigned short *) reg[12].I; + /* + * check that we are profiling + * and that we aren't recursively invoked. + */ + if (profiling) { + goto out; + } + profiling++; + /* + * check that frompcindex is a reasonable pc value. + * for example: signal catchers get called from the stack, + * not from text space. too bad. + */ + frompcindex = (unsigned short *) ((long) frompcindex - (long) s_lowpc); + if ((unsigned long) frompcindex > s_textsize) { + goto done; + } + frompcindex = + &froms[((long) frompcindex) / (HASHFRACTION * sizeof(*froms))]; + toindex = *frompcindex; + if (toindex == 0) { + /* + * first time traversing this arc + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) { + goto overflow; + } + *frompcindex = (unsigned short)toindex; + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = 0; + goto done; + } + top = &tos[toindex]; + if (top->selfpc == selfpc) { + /* + * arc at front of chain; usual case. + */ + top->count++; + goto done; + } + /* + * have to go looking down chain for it. + * top points to what we are looking at, + * prevtop points to previous top. + * we know it is not at the head of the chain. + */ + for (; /* goto done */; ) { + if (top->link == 0) { + /* + * top is end of the chain and none of the chain + * had top->selfpc == selfpc. + * so we allocate a new tostruct + * and link it to the head of the chain. + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) { + goto overflow; + } + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = *frompcindex; + *frompcindex = (unsigned short)toindex; + goto done; + } + /* + * otherwise, check the next arc on the chain. + */ + prevtop = top; + top = &tos[top->link]; + if (top->selfpc == selfpc) { + /* + * there it is. + * increment its count + * move it to the head of the chain. + */ + top->count++; + toindex = prevtop->link; + prevtop->link = top->link; + top->link = *frompcindex; + *frompcindex = (unsigned short)toindex; + goto done; + } + + } + done: + profiling--; + /* and fall through */ + out: + return; /* normal return restores saved registers */ + + overflow: + profiling++; /* halt further profiling */ +#define TOLIMIT "mcount: tos overflow\n" + systemMessage(0, TOLIMIT); + goto out; +} + +void profSetHertz(int h) +{ + hz = h; +} diff --git a/src/prof/prof.h b/src/prof/prof.h new file mode 100644 index 0000000..5ebb0dc --- /dev/null +++ b/src/prof/prof.h @@ -0,0 +1,34 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_PROF_PROF_H +#define VBA_PROF_PROF_H + +/* Control profiling; + profiling is what mcount checks to see if + all the data structures are ready. */ + +extern void profControl(int mode); +extern void profStartup(u32 lowpc, u32 highpc); +extern void profCleanup(); +extern void profCount(); + +extern void profSetHertz(int hertz); +#endif + diff --git a/src/remote.cpp b/src/remote.cpp new file mode 100644 index 0000000..40fdb3d --- /dev/null +++ b/src/remote.cpp @@ -0,0 +1,698 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#ifndef WIN32 +# include +# include +# include +# ifdef HAVE_NETINET_IN_H +# include +# endif // HAVE_NETINET_IN_H +# ifdef HAVE_ARPA_INET_H +# include +# else // ! HAVE_ARPA_INET_H +# define socklen_t int +# endif // ! HAVE_ARPA_INET_H +#else // WIN32 +# include +# include +# define socklen_t int +# define close closesocket +# define read _read +# define write _write +#endif // WIN32 + +#include "GBA.h" + +extern bool debugger; +extern void CPUUpdateCPSR(); +#ifdef SDL +extern void (*dbgMain)(); +extern void (*dbgSignal)(int,int); +extern void debuggerMain(); +extern void debuggerSignal(int,int); +#endif + +int remotePort = 55555; +int remoteSignal = 5; +int remoteSocket = -1; +int remoteListenSocket = -1; +bool remoteConnected = false; +bool remoteResumed = false; + +int (*remoteSendFnc)(char *, int) = NULL; +int (*remoteRecvFnc)(char *, int) = NULL; +bool (*remoteInitFnc)() = NULL; +void (*remoteCleanUpFnc)() = NULL; + +#ifndef SDL +void remoteSetSockets(SOCKET l, SOCKET r) +{ + remoteSocket = r; + remoteListenSocket = l; +} +#endif + +int remoteTcpSend(char *data, int len) +{ + return send(remoteSocket, data, len, 0); +} + +int remoteTcpRecv(char *data, int len) +{ + return recv(remoteSocket, data, len, 0); +} + +bool remoteTcpInit() +{ + if(remoteSocket == -1) { +#ifdef WIN32 + WSADATA wsaData; + int error = WSAStartup(MAKEWORD(1,1),&wsaData); +#endif // WIN32 + int s = socket(PF_INET, SOCK_STREAM, 0); + + remoteListenSocket = s; + + if(s < 0) { + fprintf(stderr,"Error opening socket\n"); + exit(-1); + } + int tmp = 1; + setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)); + + // char hostname[256]; + // gethostname(hostname, 256); + + // hostent *ent = gethostbyname(hostname); + // unsigned long a = *((unsigned long *)ent->h_addr); + + sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(remotePort); + addr.sin_addr.s_addr = htonl(0); + int count = 0; + while(count < 3) { + if(bind(s, (sockaddr *)&addr, sizeof(addr))) { + addr.sin_port = htons(ntohs(addr.sin_port)+1); + } else + break; + } + if(count == 3) { + fprintf(stderr,"Error binding \n"); + exit(-1); + } + + fprintf(stderr,"Listening for a connection at port %d\n", + ntohs(addr.sin_port)); + + if(listen(s, 1)) { + fprintf(stderr, "Error listening\n"); + exit(-1); + } + socklen_t len = sizeof(addr); + +#ifdef WIN32 + int flag = 0; + ioctlsocket(s, FIONBIO, (unsigned long *)&flag); +#endif // WIN32 + int s2 = accept(s, (sockaddr *)&addr, &len); + if(s2 > 0) { + fprintf(stderr, "Got a connection from %s %d\n", + inet_ntoa((in_addr)addr.sin_addr), + ntohs(addr.sin_port)); + } else { +#ifdef WIN32 + int error = WSAGetLastError(); +#endif // WIN32 + } + char dummy; + recv(s2, &dummy, 1, 0); + if(dummy != '+') { + fprintf(stderr, "ACK not received\n"); + exit(-1); + } + remoteSocket = s2; + // close(s); + } + return true; +} + +void remoteTcpCleanUp() +{ + if(remoteSocket > 0) { + fprintf(stderr, "Closing remote socket\n"); + close(remoteSocket); + remoteSocket = -1; + } + if(remoteListenSocket > 0) { + fprintf(stderr, "Closing listen socket\n"); + close(remoteListenSocket); + remoteListenSocket = -1; + } +} + +int remotePipeSend(char *data, int len) +{ + int res = write(1, data, len); + return res; +} + +int remotePipeRecv(char *data, int len) +{ + int res = read(0, data, len); + return res; +} + +bool remotePipeInit() +{ + char dummy; + read(0, &dummy, 1); + if(dummy != '+') { + fprintf(stderr, "ACK not received\n"); + exit(-1); + } + + return true; +} + +void remotePipeCleanUp() +{ +} + +void remoteSetPort(int port) +{ + remotePort = port; +} + +void remoteSetProtocol(int p) +{ + if(p == 0) { + remoteSendFnc = remoteTcpSend; + remoteRecvFnc = remoteTcpRecv; + remoteInitFnc = remoteTcpInit; + remoteCleanUpFnc = remoteTcpCleanUp; + } else { + remoteSendFnc = remotePipeSend; + remoteRecvFnc = remotePipeRecv; + remoteInitFnc = remotePipeInit; + remoteCleanUpFnc = remotePipeCleanUp; + } +} + +void remoteInit() +{ + if(remoteInitFnc) + remoteInitFnc(); +} + +void remotePutPacket(char *packet) +{ + char *hex = "0123456789abcdef"; + char buffer[1024]; + + int count = strlen(packet); + + unsigned char csum = 0; + + char *p = buffer; + *p++ = '$'; + + for(int i = 0 ;i < count; i++) { + csum += packet[i]; + *p++ = packet[i]; + } + *p++ = '#'; + *p++ = hex[csum>>4]; + *p++ = hex[csum & 15]; + *p++ = 0; + // printf("Sending %s\n", buffer); + remoteSendFnc(buffer, count + 4); + + char c = 0; + remoteRecvFnc(&c, 1); + /* + if(c == '+') + printf("ACK\n"); + else if(c=='-') + printf("NACK\n"); + */ +} + +#define debuggerReadMemory(addr) \ + (*(u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]) + +#define debuggerReadHalfWord(addr) \ + (*(u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]) + +#define debuggerReadByte(addr) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] + +#define debuggerWriteMemory(addr, value) \ + *(u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] = (value) + +#define debuggerWriteHalfWord(addr, value) \ + *(u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] = (value) + +#define debuggerWriteByte(addr, value) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] = (value) + +void remoteOutput(char *s, u32 addr) +{ + char buffer[16384]; + + char *d = buffer; + *d++ = 'O'; + + if(s) { + char c = *s++; + while(c) { + sprintf(d, "%02x", c); + d += 2; + c = *s++; + } + } else { + char c= debuggerReadByte(addr); + addr++; + while(c) { + sprintf(d, "%02x", c); + d += 2; + c = debuggerReadByte(addr); + addr++; + } + } + remotePutPacket(buffer); + // fprintf(stderr, "Output sent %s\n", buffer); +} + +void remoteSendSignal() +{ + char buffer[1024]; + sprintf(buffer, "S%02x", remoteSignal); + remotePutPacket(buffer); +} + +void remoteSendStatus() +{ + char buffer[1024]; + sprintf(buffer, "T%02x", remoteSignal); + char *s = buffer; + s += 3; + for(int i = 0; i < 15; i++) { + u32 v = reg[i].I; + sprintf(s, "%02x:%02x%02x%02x%02x;",i, + (v & 255), + (v >> 8) & 255, + (v >> 16) & 255, + (v >> 24) & 255); + s += 12; + } + u32 v = armNextPC; + sprintf(s, "0f:%02x%02x%02x%02x;", (v & 255), + (v >> 8) & 255, + (v >> 16) & 255, + (v >> 24) & 255); + s += 12; + CPUUpdateCPSR(); + v = reg[16].I; + sprintf(s, "19:%02x%02x%02x%02x;", (v & 255), + (v >> 8) & 255, + (v >> 16) & 255, + (v >> 24) & 255); + s += 12; + *s = 0; + // printf("Sending %s\n", buffer); + remotePutPacket(buffer); +} + +void remoteBinaryWrite(char *p) +{ + u32 address; + int count; + sscanf(p,"%x,%x:", &address, &count); + // printf("Binary write for %08x %d\n", address, count); + + p = strchr(p, ':'); + p++; + for(int i = 0; i < count; i++) { + u8 b = *p++; + switch(b) { + case 0x7d: + b = *p++; + debuggerWriteByte(address, (b^0x20)); + address++; + break; + default: + debuggerWriteByte(address, b); + address++; + break; + } + } + // printf("ROM is %08x\n", debuggerReadMemory(0x8000254)); + remotePutPacket("OK"); +} + +void remoteMemoryWrite(char *p) +{ + u32 address; + int count; + sscanf(p,"%x,%x:", &address, &count); + // printf("Memory write for %08x %d\n", address, count); + + p = strchr(p, ':'); + p++; + for(int i = 0; i < count; i++) { + u8 v = 0; + char c = *p++; + if(c <= '9') + v = (c - '0') << 4; + else + v = (c + 10 - 'a') << 4; + c = *p++; + if(c <= '9') + v += (c - '0'); + else + v += (c + 10 - 'a'); + debuggerWriteByte(address, v); + address++; + } + // printf("ROM is %08x\n", debuggerReadMemory(0x8000254)); + remotePutPacket("OK"); +} + +void remoteMemoryRead(char *p) +{ + u32 address; + int count; + sscanf(p,"%x,%x:", &address, &count); + // printf("Memory read for %08x %d\n", address, count); + + char buffer[1024]; + + char *s = buffer; + for(int i = 0; i < count; i++) { + u8 b = debuggerReadByte(address); + sprintf(s, "%02x", b); + address++; + s += 2; + } + *s = 0; + remotePutPacket(buffer); +} + +void remoteStepOverRange(char *p) +{ + u32 address; + u32 final; + sscanf(p, "%x,%x", &address, &final); + + remotePutPacket("OK"); + + remoteResumed = true; + do { + CPULoop(1); + if(debugger) + break; + } while(armNextPC >= address && armNextPC < final); + + remoteResumed = false; + + remoteSendStatus(); +} + +void remoteWriteWatch(char *p, bool active) +{ + u32 address; + int count; + sscanf(p, ",%x,%x#", &address, &count); + + fprintf(stderr, "Write watch for %08x %d\n", address, count); + + if(address < 0x2000000 || address > 0x3007fff) { + remotePutPacket("E01"); + return; + } + + if(address > 0x203ffff && address < 0x3000000) { + remotePutPacket("E01"); + return; + } + + u32 final = address + count; + + if(address < 0x2040000 && final > 0x2040000) { + remotePutPacket("E01"); + return; + } else if(address < 0x3008000 && final > 0x3008000) { + remotePutPacket("E01"); + return; + } + + for(int i = 0; i < count; i++) { + if((address >> 24) == 2) + freezeWorkRAM[address & 0x3ffff] = active; + else + freezeInternalRAM[address & 0x7fff] = active; + address++; + } + + remotePutPacket("OK"); +} + +void remoteReadRegisters(char *p) +{ + char buffer[1024]; + + char *s = buffer; + int i; + // regular registers + for(i = 0; i < 15; i++) { + u32 v = reg[i].I; + sprintf(s, "%02x%02x%02x%02x", v & 255, (v >> 8) & 255, + (v >> 16) & 255, (v >> 24) & 255); + s += 8; + } + // PC + u32 pc = armNextPC; + sprintf(s, "%02x%02x%02x%02x", pc & 255, (pc >> 8) & 255, + (pc >> 16) & 255, (pc >> 24) & 255); + s += 8; + + // floating point registers (24-bit) + for(i = 0; i < 8; i++) { + sprintf(s, "000000000000000000000000"); + s += 24; + } + + // FP status register + sprintf(s, "00000000"); + s += 8; + // CPSR + CPUUpdateCPSR(); + u32 v = reg[16].I; + sprintf(s, "%02x%02x%02x%02x", v & 255, (v >> 8) & 255, + (v >> 16) & 255, (v >> 24) & 255); + s += 8; + *s = 0; + remotePutPacket(buffer); +} + +void remoteWriteRegister(char *p) +{ + int r; + + sscanf(p, "%x=", &r); + + p = strchr(p, '='); + p++; + + char c = *p++; + + u32 v = 0; + + u8 data[4] = {0,0,0,0}; + + int i = 0; + + while(c != '#') { + u8 b = 0; + if(c <= '9') + b = (c - '0') << 4; + else + b = (c + 10 - 'a') << 4; + c = *p++; + if(c <= '9') + b += (c - '0'); + else + b += (c + 10 - 'a'); + data[i++] = b; + c = *p++; + } + + v = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); + + // printf("Write register %d=%08x\n", r, v); + reg[r].I = v; + if(r == 15) { + armNextPC = v; + if(armState) + reg[15].I = v + 4; + else + reg[15].I = v + 2; + } + remotePutPacket("OK"); +} + +extern int emulating; + +void remoteStubMain() +{ + if(!debugger) + return; + + if(remoteResumed) { + remoteSendStatus(); + remoteResumed = false; + } + + while(1) { + char buffer[1024]; + int res = remoteRecvFnc(buffer, 1024); + + if(res == -1) { + fprintf(stderr, "GDB connection lost\n"); +#ifdef SDL + dbgMain = debuggerMain; + dbgSignal = debuggerSignal; +#endif + debugger = false; + break; + } + + // fprintf(stderr, "Received %s\n", buffer); + char *p = buffer; + char c = *p++; + char pp = '+'; + remoteSendFnc(&pp, 1); + + if(c != '$') + continue; + c= *p++; + switch(c) { + case '?': + remoteSendSignal(); + break; + case 'D': + remotePutPacket("OK"); +#ifdef SDL + dbgMain = debuggerMain; + dbgSignal = debuggerSignal; +#endif + remoteResumed = true; + debugger = false; + return; + case 'e': + remoteStepOverRange(p); + break; + case 'k': + remotePutPacket("OK"); +#ifdef SDL + dbgMain = debuggerMain; + dbgSignal = debuggerSignal; +#endif + debugger = false; + emulating = false; + return; + case 'C': + remoteResumed = true; + debugger = false; + return; + case 'c': + remoteResumed = true; + debugger = false; + return; + case 's': + remoteResumed = true; + remoteSignal = 5; + CPULoop(1); + if(remoteResumed) { + remoteResumed = false; + remoteSendStatus(); + } + break; + case 'g': + remoteReadRegisters(p); + break; + case 'P': + remoteWriteRegister(p); + break; + case 'M': + remoteMemoryWrite(p); + break; + case 'm': + remoteMemoryRead(p); + break; + case 'X': + remoteBinaryWrite(p); + break; + case 'H': + remotePutPacket("OK"); + break; + case 'q': + remotePutPacket(""); + break; + case 'Z': + if(*p++ == '2') { + remoteWriteWatch(p, true); + } else + remotePutPacket(""); + break; + case 'z': + if(*p++ == '2') { + remoteWriteWatch(p, false); + } else + remotePutPacket(""); + break; + default: + { + *(strchr(p, '#') + 3) = 0; + fprintf(stderr, "Unknown packet %s\n", --p); + remotePutPacket(""); + } + break; + } + } +} + +void remoteStubSignal(int sig, int number) +{ + remoteSignal = sig; + remoteResumed = false; + remoteSendStatus(); + debugger = true; +} + +void remoteCleanUp() +{ + if(remoteCleanUpFnc) + remoteCleanUpFnc(); +} diff --git a/src/scanline.cpp b/src/scanline.cpp new file mode 100644 index 0000000..21610a8 --- /dev/null +++ b/src/scanline.cpp @@ -0,0 +1,230 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" + +extern int RGB_LOW_BITS_MASK; + +void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + + finish = (u8 *) bP + ((width+2) << 1); + nextPixel = *bP++; + + do { + currentPixel = nextPixel; + nextPixel = *bP++; + u32 colorA, colorB; + +#ifdef WORDS_BIGENDIAN + colorA = currentPixel >> 16; + colorB = currentPixel & 0xffff; +#else + colorA = currentPixel & 0xffff; + colorB = currentPixel >> 16; +#endif + + *(dP) = colorA | colorA<<16; + *(nL) = 0; + +#ifdef WORDS_BIGENDIAN + colorA = nextPixel >> 16; +#else + colorA = nextPixel & 0xffff; +#endif + + *(dP + 1) = colorB | (colorB << 16); + *(nL + 1) = 0; + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + + finish = (u8 *) bP + ((width+1) << 2); + nextPixel = *bP++; + + do { + currentPixel = nextPixel; + nextPixel = *bP++; + + u32 colorA, colorB; + + colorA = currentPixel; + colorB = nextPixel; + + *(dP) = colorA; + *(dP+1) = colorA; + *(nL) = 0; + *(nL+1) = 0; + + *(dP + 2) = colorB; + *(dP + 3) = colorB; + *(nL+2) = 0; + *(nL+3) = 0; + + nextPixel = *bP++; + + dP += 4; + nL += 4; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + + finish = (u8 *) bP + ((width+2) << 1); + nextPixel = *bP++; + + do { + currentPixel = nextPixel; + nextPixel = *bP++; + + u32 colorA, colorB; + +#ifdef WORDS_BIGENDIAN + colorA = currentPixel >> 16; + colorB = currentPixel & 0xFFFF; +#else + colorA = currentPixel & 0xFFFF; + colorB = currentPixel >> 16; +#endif + + *(dP) = colorA = colorA | ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1))) << 16; + colorA = ((colorA & colorMask) >> 1); + colorA += ((colorA & colorMask) >> 1); + *(nL) = colorA; + + colorA = nextPixel & 0xFFFF; + + *(dP + 1) = colorB = colorB | ((((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1))) << 16; + colorB = ((colorB & colorMask) >> 1); + colorB += ((colorB & colorMask) >> 1); + + *(nL + 1) = colorB; + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + u32 colorMask = ~RGB_LOW_BITS_MASK; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + u32 nextPixel; + + finish = (u8 *) bP + ((width+1) << 2); + nextPixel = *bP++; + + do { + currentPixel = nextPixel; + nextPixel = *bP++; + + u32 colorA, colorB, temp; + + colorA = currentPixel; + colorB = nextPixel; + + *(dP) = colorA; + *(dP+1) = temp = ((colorA & colorMask) >> 1) + + ((colorB & colorMask) >> 1); + temp = ((temp & colorMask) >> 1); + temp += ((temp & colorMask) >> 1); + colorA = ((colorA & colorMask) >> 1); + colorA += ((colorA & colorMask) >> 1); + + *(nL) = colorA; + *(nL+1) = temp; + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} diff --git a/src/sdl/Makefile.am b/src/sdl/Makefile.am new file mode 100644 index 0000000..bcc9f92 --- /dev/null +++ b/src/sdl/Makefile.am @@ -0,0 +1,159 @@ +bin_PROGRAMS = VisualBoyAdvance + +noinst_PROGRAMS = TestEmu + +VisualBoyAdvance_SOURCES = \ + SDL.cpp \ + debugger.cpp \ + debugger.h \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bilinear.cpp \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../expr-lex.cpp \ + ../expr.cpp \ + ../expr.cpp.h \ + ../exprNode.cpp \ + ../exprNode.h \ + ../getopt.c \ + ../getopt.h \ + ../getopt1.c \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interframe.cpp \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + +VisualBoyAdvance_LDADD = @VBA_LIBS@ @SDL_LIBS@ + +VisualBoyAdvance_DEPENDENCIES = @VBA_LIBS@ + +TestEmu_SOURCES = \ + TestEmu.cpp \ + debugger.cpp \ + debugger.h \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../expr-lex.cpp \ + ../expr.cpp \ + ../expr.cpp.h \ + ../exprNode.cpp \ + ../exprNode.h \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + +TestEmu_LDADD = @VBA_LIBS@ @SDL_LIBS@ + +TestEmu_DEPENDENCIES = @VBA_LIBS@ + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -DSDL \ + -DSYSCONFDIR=\"$(sysconfdir)\" + +AM_CXXFLAGS = -fno-exceptions @SDL_CFLAGS@ diff --git a/src/sdl/Makefile.in b/src/sdl/Makefile.in new file mode 100644 index 0000000..59aee5e --- /dev/null +++ b/src/sdl/Makefile.in @@ -0,0 +1,1538 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +bin_PROGRAMS = VisualBoyAdvance + +noinst_PROGRAMS = TestEmu + +VisualBoyAdvance_SOURCES = \ + SDL.cpp \ + debugger.cpp \ + debugger.h \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bilinear.cpp \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../expr-lex.cpp \ + ../expr.cpp \ + ../expr.cpp.h \ + ../exprNode.cpp \ + ../exprNode.h \ + ../getopt.c \ + ../getopt.h \ + ../getopt1.c \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interframe.cpp \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + + +VisualBoyAdvance_LDADD = @VBA_LIBS@ @SDL_LIBS@ + +VisualBoyAdvance_DEPENDENCIES = @VBA_LIBS@ + +TestEmu_SOURCES = \ + TestEmu.cpp \ + debugger.cpp \ + debugger.h \ + ../2xSaI.cpp \ + ../AutoBuild.h \ + ../Cheats.cpp \ + ../Cheats.h \ + ../EEprom.cpp \ + ../EEprom.h \ + ../Flash.cpp \ + ../Flash.h \ + ../GBA.cpp \ + ../GBA.h \ + ../GBAinline.h \ + ../Gfx.cpp \ + ../Gfx.h \ + ../Globals.cpp \ + ../Globals.h \ + ../Mode0.cpp \ + ../Mode1.cpp \ + ../Mode2.cpp \ + ../Mode3.cpp \ + ../Mode4.cpp \ + ../Mode5.cpp \ + ../NLS.h \ + ../Port.h \ + ../RTC.cpp \ + ../RTC.h \ + ../Sound.cpp \ + ../Sound.h \ + ../Sram.cpp \ + ../Sram.h \ + ../System.h \ + ../Text.cpp \ + ../Text.h \ + ../Util.cpp \ + ../Util.h \ + ../admame.cpp \ + ../agbprint.cpp \ + ../agbprint.h \ + ../arm-new.h \ + ../armdis.cpp \ + ../armdis.h \ + ../bios.cpp \ + ../bios.h \ + ../elf.cpp \ + ../elf.h \ + ../expr-lex.cpp \ + ../expr.cpp \ + ../expr.cpp.h \ + ../exprNode.cpp \ + ../exprNode.h \ + ../hq2x.cpp \ + ../hq2x.h \ + ../interp.h \ + ../lq2x.h \ + ../memgzio.c \ + ../memgzio.h \ + ../motionblur.cpp \ + ../pixel.cpp \ + ../remote.cpp \ + ../scanline.cpp \ + ../simple2x.cpp \ + ../thumb.h \ + ../unzip.cpp \ + ../unzip.h + + +TestEmu_LDADD = @VBA_LIBS@ @SDL_LIBS@ + +TestEmu_DEPENDENCIES = @VBA_LIBS@ + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + -DSDL \ + -DSYSCONFDIR=\"$(sysconfdir)\" + + +AM_CXXFLAGS = -fno-exceptions @SDL_CFLAGS@ +subdir = src/sdl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +bin_PROGRAMS = VisualBoyAdvance$(EXEEXT) +noinst_PROGRAMS = TestEmu$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + +am_TestEmu_OBJECTS = TestEmu.$(OBJEXT) debugger.$(OBJEXT) \ + 2xSaI.$(OBJEXT) Cheats.$(OBJEXT) EEprom.$(OBJEXT) \ + Flash.$(OBJEXT) GBA.$(OBJEXT) Gfx.$(OBJEXT) Globals.$(OBJEXT) \ + Mode0.$(OBJEXT) Mode1.$(OBJEXT) Mode2.$(OBJEXT) Mode3.$(OBJEXT) \ + Mode4.$(OBJEXT) Mode5.$(OBJEXT) RTC.$(OBJEXT) Sound.$(OBJEXT) \ + Sram.$(OBJEXT) Text.$(OBJEXT) Util.$(OBJEXT) admame.$(OBJEXT) \ + agbprint.$(OBJEXT) armdis.$(OBJEXT) bios.$(OBJEXT) \ + elf.$(OBJEXT) expr-lex.$(OBJEXT) expr.$(OBJEXT) \ + exprNode.$(OBJEXT) hq2x.$(OBJEXT) memgzio.$(OBJEXT) \ + motionblur.$(OBJEXT) pixel.$(OBJEXT) remote.$(OBJEXT) \ + scanline.$(OBJEXT) simple2x.$(OBJEXT) unzip.$(OBJEXT) +TestEmu_OBJECTS = $(am_TestEmu_OBJECTS) +TestEmu_LDFLAGS = +am_VisualBoyAdvance_OBJECTS = SDL.$(OBJEXT) debugger.$(OBJEXT) \ + 2xSaI.$(OBJEXT) Cheats.$(OBJEXT) EEprom.$(OBJEXT) \ + Flash.$(OBJEXT) GBA.$(OBJEXT) Gfx.$(OBJEXT) Globals.$(OBJEXT) \ + Mode0.$(OBJEXT) Mode1.$(OBJEXT) Mode2.$(OBJEXT) Mode3.$(OBJEXT) \ + Mode4.$(OBJEXT) Mode5.$(OBJEXT) RTC.$(OBJEXT) Sound.$(OBJEXT) \ + Sram.$(OBJEXT) Text.$(OBJEXT) Util.$(OBJEXT) admame.$(OBJEXT) \ + agbprint.$(OBJEXT) armdis.$(OBJEXT) bilinear.$(OBJEXT) \ + bios.$(OBJEXT) elf.$(OBJEXT) expr-lex.$(OBJEXT) expr.$(OBJEXT) \ + exprNode.$(OBJEXT) getopt.$(OBJEXT) getopt1.$(OBJEXT) \ + hq2x.$(OBJEXT) interframe.$(OBJEXT) memgzio.$(OBJEXT) \ + motionblur.$(OBJEXT) pixel.$(OBJEXT) remote.$(OBJEXT) \ + scanline.$(OBJEXT) simple2x.$(OBJEXT) unzip.$(OBJEXT) +VisualBoyAdvance_OBJECTS = $(am_VisualBoyAdvance_OBJECTS) +VisualBoyAdvance_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/2xSaI.Po ./$(DEPDIR)/Cheats.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/EEprom.Po ./$(DEPDIR)/Flash.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/GBA.Po ./$(DEPDIR)/Gfx.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Globals.Po ./$(DEPDIR)/Mode0.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Mode1.Po ./$(DEPDIR)/Mode2.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Mode3.Po ./$(DEPDIR)/Mode4.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Mode5.Po ./$(DEPDIR)/RTC.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/SDL.Po ./$(DEPDIR)/Sound.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Sram.Po ./$(DEPDIR)/TestEmu.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Text.Po ./$(DEPDIR)/Util.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/admame.Po ./$(DEPDIR)/agbprint.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/armdis.Po ./$(DEPDIR)/bilinear.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/bios.Po ./$(DEPDIR)/debugger.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/elf.Po ./$(DEPDIR)/expr-lex.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/expr.Po ./$(DEPDIR)/exprNode.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/hq2x.Po ./$(DEPDIR)/interframe.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/memgzio.Po ./$(DEPDIR)/motionblur.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/pixel.Po ./$(DEPDIR)/remote.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/scanline.Po ./$(DEPDIR)/simple2x.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/unzip.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +DIST_SOURCES = $(TestEmu_SOURCES) $(VisualBoyAdvance_SOURCES) +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +SOURCES = $(TestEmu_SOURCES) $(VisualBoyAdvance_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/sdl/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +TestEmu$(EXEEXT): $(TestEmu_OBJECTS) $(TestEmu_DEPENDENCIES) + @rm -f TestEmu$(EXEEXT) + $(CXXLINK) $(TestEmu_LDFLAGS) $(TestEmu_OBJECTS) $(TestEmu_LDADD) $(LIBS) +VisualBoyAdvance$(EXEEXT): $(VisualBoyAdvance_OBJECTS) $(VisualBoyAdvance_DEPENDENCIES) + @rm -f VisualBoyAdvance$(EXEEXT) + $(CXXLINK) $(VisualBoyAdvance_LDFLAGS) $(VisualBoyAdvance_OBJECTS) $(VisualBoyAdvance_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/2xSaI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cheats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EEprom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Flash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GBA.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gfx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Globals.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode0.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mode5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RTC.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDL.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sound.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestEmu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Text.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/admame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agbprint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/armdis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bilinear.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debugger.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expr-lex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprNode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hq2x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interframe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memgzio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motionblur.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple2x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzip.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +memgzio.o: ../memgzio.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT memgzio.o -MD -MP -MF "$(DEPDIR)/memgzio.Tpo" \ +@am__fastdepCC_TRUE@ -c -o memgzio.o `test -f '../memgzio.c' || echo '$(srcdir)/'`../memgzio.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/memgzio.Tpo" "$(DEPDIR)/memgzio.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/memgzio.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../memgzio.c' object='memgzio.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/memgzio.Po' tmpdepfile='$(DEPDIR)/memgzio.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memgzio.o `test -f '../memgzio.c' || echo '$(srcdir)/'`../memgzio.c + +memgzio.obj: ../memgzio.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT memgzio.obj -MD -MP -MF "$(DEPDIR)/memgzio.Tpo" \ +@am__fastdepCC_TRUE@ -c -o memgzio.obj `if test -f '../memgzio.c'; then $(CYGPATH_W) '../memgzio.c'; else $(CYGPATH_W) '$(srcdir)/../memgzio.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/memgzio.Tpo" "$(DEPDIR)/memgzio.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/memgzio.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../memgzio.c' object='memgzio.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/memgzio.Po' tmpdepfile='$(DEPDIR)/memgzio.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o memgzio.obj `if test -f '../memgzio.c'; then $(CYGPATH_W) '../memgzio.c'; else $(CYGPATH_W) '$(srcdir)/../memgzio.c'; fi` + +getopt.o: ../getopt.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.o -MD -MP -MF "$(DEPDIR)/getopt.Tpo" \ +@am__fastdepCC_TRUE@ -c -o getopt.o `test -f '../getopt.c' || echo '$(srcdir)/'`../getopt.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/getopt.Tpo" "$(DEPDIR)/getopt.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/getopt.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt.c' object='getopt.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/getopt.Po' tmpdepfile='$(DEPDIR)/getopt.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.o `test -f '../getopt.c' || echo '$(srcdir)/'`../getopt.c + +getopt.obj: ../getopt.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.obj -MD -MP -MF "$(DEPDIR)/getopt.Tpo" \ +@am__fastdepCC_TRUE@ -c -o getopt.obj `if test -f '../getopt.c'; then $(CYGPATH_W) '../getopt.c'; else $(CYGPATH_W) '$(srcdir)/../getopt.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/getopt.Tpo" "$(DEPDIR)/getopt.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/getopt.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt.c' object='getopt.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/getopt.Po' tmpdepfile='$(DEPDIR)/getopt.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.obj `if test -f '../getopt.c'; then $(CYGPATH_W) '../getopt.c'; else $(CYGPATH_W) '$(srcdir)/../getopt.c'; fi` + +getopt1.o: ../getopt1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt1.o -MD -MP -MF "$(DEPDIR)/getopt1.Tpo" \ +@am__fastdepCC_TRUE@ -c -o getopt1.o `test -f '../getopt1.c' || echo '$(srcdir)/'`../getopt1.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/getopt1.Tpo" "$(DEPDIR)/getopt1.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/getopt1.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt1.c' object='getopt1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/getopt1.Po' tmpdepfile='$(DEPDIR)/getopt1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt1.o `test -f '../getopt1.c' || echo '$(srcdir)/'`../getopt1.c + +getopt1.obj: ../getopt1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt1.obj -MD -MP -MF "$(DEPDIR)/getopt1.Tpo" \ +@am__fastdepCC_TRUE@ -c -o getopt1.obj `if test -f '../getopt1.c'; then $(CYGPATH_W) '../getopt1.c'; else $(CYGPATH_W) '$(srcdir)/../getopt1.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/getopt1.Tpo" "$(DEPDIR)/getopt1.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/getopt1.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../getopt1.c' object='getopt1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/getopt1.Po' tmpdepfile='$(DEPDIR)/getopt1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt1.obj `if test -f '../getopt1.c'; then $(CYGPATH_W) '../getopt1.c'; else $(CYGPATH_W) '$(srcdir)/../getopt1.c'; fi` + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +2xSaI.o: ../2xSaI.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 2xSaI.o -MD -MP -MF "$(DEPDIR)/2xSaI.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o 2xSaI.o `test -f '../2xSaI.cpp' || echo '$(srcdir)/'`../2xSaI.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/2xSaI.Tpo" "$(DEPDIR)/2xSaI.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/2xSaI.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../2xSaI.cpp' object='2xSaI.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/2xSaI.Po' tmpdepfile='$(DEPDIR)/2xSaI.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 2xSaI.o `test -f '../2xSaI.cpp' || echo '$(srcdir)/'`../2xSaI.cpp + +2xSaI.obj: ../2xSaI.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT 2xSaI.obj -MD -MP -MF "$(DEPDIR)/2xSaI.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o 2xSaI.obj `if test -f '../2xSaI.cpp'; then $(CYGPATH_W) '../2xSaI.cpp'; else $(CYGPATH_W) '$(srcdir)/../2xSaI.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/2xSaI.Tpo" "$(DEPDIR)/2xSaI.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/2xSaI.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../2xSaI.cpp' object='2xSaI.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/2xSaI.Po' tmpdepfile='$(DEPDIR)/2xSaI.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o 2xSaI.obj `if test -f '../2xSaI.cpp'; then $(CYGPATH_W) '../2xSaI.cpp'; else $(CYGPATH_W) '$(srcdir)/../2xSaI.cpp'; fi` + +Cheats.o: ../Cheats.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Cheats.o -MD -MP -MF "$(DEPDIR)/Cheats.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Cheats.o `test -f '../Cheats.cpp' || echo '$(srcdir)/'`../Cheats.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Cheats.Tpo" "$(DEPDIR)/Cheats.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Cheats.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Cheats.cpp' object='Cheats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Cheats.Po' tmpdepfile='$(DEPDIR)/Cheats.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Cheats.o `test -f '../Cheats.cpp' || echo '$(srcdir)/'`../Cheats.cpp + +Cheats.obj: ../Cheats.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Cheats.obj -MD -MP -MF "$(DEPDIR)/Cheats.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Cheats.obj `if test -f '../Cheats.cpp'; then $(CYGPATH_W) '../Cheats.cpp'; else $(CYGPATH_W) '$(srcdir)/../Cheats.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Cheats.Tpo" "$(DEPDIR)/Cheats.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Cheats.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Cheats.cpp' object='Cheats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Cheats.Po' tmpdepfile='$(DEPDIR)/Cheats.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Cheats.obj `if test -f '../Cheats.cpp'; then $(CYGPATH_W) '../Cheats.cpp'; else $(CYGPATH_W) '$(srcdir)/../Cheats.cpp'; fi` + +EEprom.o: ../EEprom.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT EEprom.o -MD -MP -MF "$(DEPDIR)/EEprom.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o EEprom.o `test -f '../EEprom.cpp' || echo '$(srcdir)/'`../EEprom.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/EEprom.Tpo" "$(DEPDIR)/EEprom.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/EEprom.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../EEprom.cpp' object='EEprom.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/EEprom.Po' tmpdepfile='$(DEPDIR)/EEprom.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o EEprom.o `test -f '../EEprom.cpp' || echo '$(srcdir)/'`../EEprom.cpp + +EEprom.obj: ../EEprom.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT EEprom.obj -MD -MP -MF "$(DEPDIR)/EEprom.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o EEprom.obj `if test -f '../EEprom.cpp'; then $(CYGPATH_W) '../EEprom.cpp'; else $(CYGPATH_W) '$(srcdir)/../EEprom.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/EEprom.Tpo" "$(DEPDIR)/EEprom.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/EEprom.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../EEprom.cpp' object='EEprom.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/EEprom.Po' tmpdepfile='$(DEPDIR)/EEprom.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o EEprom.obj `if test -f '../EEprom.cpp'; then $(CYGPATH_W) '../EEprom.cpp'; else $(CYGPATH_W) '$(srcdir)/../EEprom.cpp'; fi` + +Flash.o: ../Flash.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Flash.o -MD -MP -MF "$(DEPDIR)/Flash.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Flash.o `test -f '../Flash.cpp' || echo '$(srcdir)/'`../Flash.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Flash.Tpo" "$(DEPDIR)/Flash.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Flash.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Flash.cpp' object='Flash.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Flash.Po' tmpdepfile='$(DEPDIR)/Flash.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Flash.o `test -f '../Flash.cpp' || echo '$(srcdir)/'`../Flash.cpp + +Flash.obj: ../Flash.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Flash.obj -MD -MP -MF "$(DEPDIR)/Flash.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Flash.obj `if test -f '../Flash.cpp'; then $(CYGPATH_W) '../Flash.cpp'; else $(CYGPATH_W) '$(srcdir)/../Flash.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Flash.Tpo" "$(DEPDIR)/Flash.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Flash.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Flash.cpp' object='Flash.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Flash.Po' tmpdepfile='$(DEPDIR)/Flash.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Flash.obj `if test -f '../Flash.cpp'; then $(CYGPATH_W) '../Flash.cpp'; else $(CYGPATH_W) '$(srcdir)/../Flash.cpp'; fi` + +GBA.o: ../GBA.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GBA.o -MD -MP -MF "$(DEPDIR)/GBA.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o GBA.o `test -f '../GBA.cpp' || echo '$(srcdir)/'`../GBA.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GBA.Tpo" "$(DEPDIR)/GBA.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/GBA.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../GBA.cpp' object='GBA.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/GBA.Po' tmpdepfile='$(DEPDIR)/GBA.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GBA.o `test -f '../GBA.cpp' || echo '$(srcdir)/'`../GBA.cpp + +GBA.obj: ../GBA.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GBA.obj -MD -MP -MF "$(DEPDIR)/GBA.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o GBA.obj `if test -f '../GBA.cpp'; then $(CYGPATH_W) '../GBA.cpp'; else $(CYGPATH_W) '$(srcdir)/../GBA.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GBA.Tpo" "$(DEPDIR)/GBA.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/GBA.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../GBA.cpp' object='GBA.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/GBA.Po' tmpdepfile='$(DEPDIR)/GBA.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GBA.obj `if test -f '../GBA.cpp'; then $(CYGPATH_W) '../GBA.cpp'; else $(CYGPATH_W) '$(srcdir)/../GBA.cpp'; fi` + +Gfx.o: ../Gfx.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Gfx.o -MD -MP -MF "$(DEPDIR)/Gfx.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Gfx.o `test -f '../Gfx.cpp' || echo '$(srcdir)/'`../Gfx.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Gfx.Tpo" "$(DEPDIR)/Gfx.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Gfx.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Gfx.cpp' object='Gfx.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Gfx.Po' tmpdepfile='$(DEPDIR)/Gfx.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Gfx.o `test -f '../Gfx.cpp' || echo '$(srcdir)/'`../Gfx.cpp + +Gfx.obj: ../Gfx.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Gfx.obj -MD -MP -MF "$(DEPDIR)/Gfx.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Gfx.obj `if test -f '../Gfx.cpp'; then $(CYGPATH_W) '../Gfx.cpp'; else $(CYGPATH_W) '$(srcdir)/../Gfx.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Gfx.Tpo" "$(DEPDIR)/Gfx.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Gfx.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Gfx.cpp' object='Gfx.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Gfx.Po' tmpdepfile='$(DEPDIR)/Gfx.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Gfx.obj `if test -f '../Gfx.cpp'; then $(CYGPATH_W) '../Gfx.cpp'; else $(CYGPATH_W) '$(srcdir)/../Gfx.cpp'; fi` + +Globals.o: ../Globals.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Globals.o -MD -MP -MF "$(DEPDIR)/Globals.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Globals.o `test -f '../Globals.cpp' || echo '$(srcdir)/'`../Globals.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Globals.Tpo" "$(DEPDIR)/Globals.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Globals.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Globals.cpp' object='Globals.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Globals.Po' tmpdepfile='$(DEPDIR)/Globals.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Globals.o `test -f '../Globals.cpp' || echo '$(srcdir)/'`../Globals.cpp + +Globals.obj: ../Globals.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Globals.obj -MD -MP -MF "$(DEPDIR)/Globals.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Globals.obj `if test -f '../Globals.cpp'; then $(CYGPATH_W) '../Globals.cpp'; else $(CYGPATH_W) '$(srcdir)/../Globals.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Globals.Tpo" "$(DEPDIR)/Globals.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Globals.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Globals.cpp' object='Globals.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Globals.Po' tmpdepfile='$(DEPDIR)/Globals.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Globals.obj `if test -f '../Globals.cpp'; then $(CYGPATH_W) '../Globals.cpp'; else $(CYGPATH_W) '$(srcdir)/../Globals.cpp'; fi` + +Mode0.o: ../Mode0.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode0.o -MD -MP -MF "$(DEPDIR)/Mode0.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode0.o `test -f '../Mode0.cpp' || echo '$(srcdir)/'`../Mode0.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode0.Tpo" "$(DEPDIR)/Mode0.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode0.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode0.cpp' object='Mode0.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode0.Po' tmpdepfile='$(DEPDIR)/Mode0.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode0.o `test -f '../Mode0.cpp' || echo '$(srcdir)/'`../Mode0.cpp + +Mode0.obj: ../Mode0.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode0.obj -MD -MP -MF "$(DEPDIR)/Mode0.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode0.obj `if test -f '../Mode0.cpp'; then $(CYGPATH_W) '../Mode0.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode0.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode0.Tpo" "$(DEPDIR)/Mode0.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode0.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode0.cpp' object='Mode0.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode0.Po' tmpdepfile='$(DEPDIR)/Mode0.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode0.obj `if test -f '../Mode0.cpp'; then $(CYGPATH_W) '../Mode0.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode0.cpp'; fi` + +Mode1.o: ../Mode1.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode1.o -MD -MP -MF "$(DEPDIR)/Mode1.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode1.o `test -f '../Mode1.cpp' || echo '$(srcdir)/'`../Mode1.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode1.Tpo" "$(DEPDIR)/Mode1.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode1.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode1.cpp' object='Mode1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode1.Po' tmpdepfile='$(DEPDIR)/Mode1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode1.o `test -f '../Mode1.cpp' || echo '$(srcdir)/'`../Mode1.cpp + +Mode1.obj: ../Mode1.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode1.obj -MD -MP -MF "$(DEPDIR)/Mode1.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode1.obj `if test -f '../Mode1.cpp'; then $(CYGPATH_W) '../Mode1.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode1.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode1.Tpo" "$(DEPDIR)/Mode1.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode1.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode1.cpp' object='Mode1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode1.Po' tmpdepfile='$(DEPDIR)/Mode1.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode1.obj `if test -f '../Mode1.cpp'; then $(CYGPATH_W) '../Mode1.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode1.cpp'; fi` + +Mode2.o: ../Mode2.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode2.o -MD -MP -MF "$(DEPDIR)/Mode2.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode2.o `test -f '../Mode2.cpp' || echo '$(srcdir)/'`../Mode2.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode2.Tpo" "$(DEPDIR)/Mode2.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode2.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode2.cpp' object='Mode2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode2.Po' tmpdepfile='$(DEPDIR)/Mode2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode2.o `test -f '../Mode2.cpp' || echo '$(srcdir)/'`../Mode2.cpp + +Mode2.obj: ../Mode2.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode2.obj -MD -MP -MF "$(DEPDIR)/Mode2.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode2.obj `if test -f '../Mode2.cpp'; then $(CYGPATH_W) '../Mode2.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode2.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode2.Tpo" "$(DEPDIR)/Mode2.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode2.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode2.cpp' object='Mode2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode2.Po' tmpdepfile='$(DEPDIR)/Mode2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode2.obj `if test -f '../Mode2.cpp'; then $(CYGPATH_W) '../Mode2.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode2.cpp'; fi` + +Mode3.o: ../Mode3.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode3.o -MD -MP -MF "$(DEPDIR)/Mode3.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode3.o `test -f '../Mode3.cpp' || echo '$(srcdir)/'`../Mode3.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode3.Tpo" "$(DEPDIR)/Mode3.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode3.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode3.cpp' object='Mode3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode3.Po' tmpdepfile='$(DEPDIR)/Mode3.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode3.o `test -f '../Mode3.cpp' || echo '$(srcdir)/'`../Mode3.cpp + +Mode3.obj: ../Mode3.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode3.obj -MD -MP -MF "$(DEPDIR)/Mode3.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode3.obj `if test -f '../Mode3.cpp'; then $(CYGPATH_W) '../Mode3.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode3.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode3.Tpo" "$(DEPDIR)/Mode3.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode3.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode3.cpp' object='Mode3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode3.Po' tmpdepfile='$(DEPDIR)/Mode3.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode3.obj `if test -f '../Mode3.cpp'; then $(CYGPATH_W) '../Mode3.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode3.cpp'; fi` + +Mode4.o: ../Mode4.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode4.o -MD -MP -MF "$(DEPDIR)/Mode4.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode4.o `test -f '../Mode4.cpp' || echo '$(srcdir)/'`../Mode4.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode4.Tpo" "$(DEPDIR)/Mode4.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode4.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode4.cpp' object='Mode4.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode4.Po' tmpdepfile='$(DEPDIR)/Mode4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode4.o `test -f '../Mode4.cpp' || echo '$(srcdir)/'`../Mode4.cpp + +Mode4.obj: ../Mode4.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode4.obj -MD -MP -MF "$(DEPDIR)/Mode4.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode4.obj `if test -f '../Mode4.cpp'; then $(CYGPATH_W) '../Mode4.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode4.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode4.Tpo" "$(DEPDIR)/Mode4.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode4.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode4.cpp' object='Mode4.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode4.Po' tmpdepfile='$(DEPDIR)/Mode4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode4.obj `if test -f '../Mode4.cpp'; then $(CYGPATH_W) '../Mode4.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode4.cpp'; fi` + +Mode5.o: ../Mode5.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode5.o -MD -MP -MF "$(DEPDIR)/Mode5.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode5.o `test -f '../Mode5.cpp' || echo '$(srcdir)/'`../Mode5.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode5.Tpo" "$(DEPDIR)/Mode5.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode5.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode5.cpp' object='Mode5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode5.Po' tmpdepfile='$(DEPDIR)/Mode5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode5.o `test -f '../Mode5.cpp' || echo '$(srcdir)/'`../Mode5.cpp + +Mode5.obj: ../Mode5.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Mode5.obj -MD -MP -MF "$(DEPDIR)/Mode5.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Mode5.obj `if test -f '../Mode5.cpp'; then $(CYGPATH_W) '../Mode5.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode5.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Mode5.Tpo" "$(DEPDIR)/Mode5.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Mode5.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Mode5.cpp' object='Mode5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Mode5.Po' tmpdepfile='$(DEPDIR)/Mode5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Mode5.obj `if test -f '../Mode5.cpp'; then $(CYGPATH_W) '../Mode5.cpp'; else $(CYGPATH_W) '$(srcdir)/../Mode5.cpp'; fi` + +RTC.o: ../RTC.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT RTC.o -MD -MP -MF "$(DEPDIR)/RTC.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o RTC.o `test -f '../RTC.cpp' || echo '$(srcdir)/'`../RTC.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/RTC.Tpo" "$(DEPDIR)/RTC.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/RTC.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../RTC.cpp' object='RTC.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/RTC.Po' tmpdepfile='$(DEPDIR)/RTC.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o RTC.o `test -f '../RTC.cpp' || echo '$(srcdir)/'`../RTC.cpp + +RTC.obj: ../RTC.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT RTC.obj -MD -MP -MF "$(DEPDIR)/RTC.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o RTC.obj `if test -f '../RTC.cpp'; then $(CYGPATH_W) '../RTC.cpp'; else $(CYGPATH_W) '$(srcdir)/../RTC.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/RTC.Tpo" "$(DEPDIR)/RTC.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/RTC.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../RTC.cpp' object='RTC.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/RTC.Po' tmpdepfile='$(DEPDIR)/RTC.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o RTC.obj `if test -f '../RTC.cpp'; then $(CYGPATH_W) '../RTC.cpp'; else $(CYGPATH_W) '$(srcdir)/../RTC.cpp'; fi` + +Sound.o: ../Sound.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Sound.o -MD -MP -MF "$(DEPDIR)/Sound.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Sound.o `test -f '../Sound.cpp' || echo '$(srcdir)/'`../Sound.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Sound.Tpo" "$(DEPDIR)/Sound.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Sound.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sound.cpp' object='Sound.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Sound.Po' tmpdepfile='$(DEPDIR)/Sound.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Sound.o `test -f '../Sound.cpp' || echo '$(srcdir)/'`../Sound.cpp + +Sound.obj: ../Sound.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Sound.obj -MD -MP -MF "$(DEPDIR)/Sound.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Sound.obj `if test -f '../Sound.cpp'; then $(CYGPATH_W) '../Sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sound.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Sound.Tpo" "$(DEPDIR)/Sound.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Sound.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sound.cpp' object='Sound.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Sound.Po' tmpdepfile='$(DEPDIR)/Sound.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Sound.obj `if test -f '../Sound.cpp'; then $(CYGPATH_W) '../Sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sound.cpp'; fi` + +Sram.o: ../Sram.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Sram.o -MD -MP -MF "$(DEPDIR)/Sram.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Sram.o `test -f '../Sram.cpp' || echo '$(srcdir)/'`../Sram.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Sram.Tpo" "$(DEPDIR)/Sram.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Sram.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sram.cpp' object='Sram.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Sram.Po' tmpdepfile='$(DEPDIR)/Sram.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Sram.o `test -f '../Sram.cpp' || echo '$(srcdir)/'`../Sram.cpp + +Sram.obj: ../Sram.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Sram.obj -MD -MP -MF "$(DEPDIR)/Sram.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Sram.obj `if test -f '../Sram.cpp'; then $(CYGPATH_W) '../Sram.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sram.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Sram.Tpo" "$(DEPDIR)/Sram.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Sram.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Sram.cpp' object='Sram.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Sram.Po' tmpdepfile='$(DEPDIR)/Sram.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Sram.obj `if test -f '../Sram.cpp'; then $(CYGPATH_W) '../Sram.cpp'; else $(CYGPATH_W) '$(srcdir)/../Sram.cpp'; fi` + +Text.o: ../Text.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Text.o -MD -MP -MF "$(DEPDIR)/Text.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Text.o `test -f '../Text.cpp' || echo '$(srcdir)/'`../Text.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Text.Tpo" "$(DEPDIR)/Text.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Text.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Text.cpp' object='Text.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Text.Po' tmpdepfile='$(DEPDIR)/Text.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Text.o `test -f '../Text.cpp' || echo '$(srcdir)/'`../Text.cpp + +Text.obj: ../Text.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Text.obj -MD -MP -MF "$(DEPDIR)/Text.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Text.obj `if test -f '../Text.cpp'; then $(CYGPATH_W) '../Text.cpp'; else $(CYGPATH_W) '$(srcdir)/../Text.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Text.Tpo" "$(DEPDIR)/Text.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Text.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Text.cpp' object='Text.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Text.Po' tmpdepfile='$(DEPDIR)/Text.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Text.obj `if test -f '../Text.cpp'; then $(CYGPATH_W) '../Text.cpp'; else $(CYGPATH_W) '$(srcdir)/../Text.cpp'; fi` + +Util.o: ../Util.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Util.o -MD -MP -MF "$(DEPDIR)/Util.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Util.o `test -f '../Util.cpp' || echo '$(srcdir)/'`../Util.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Util.Tpo" "$(DEPDIR)/Util.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Util.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Util.cpp' object='Util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Util.Po' tmpdepfile='$(DEPDIR)/Util.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Util.o `test -f '../Util.cpp' || echo '$(srcdir)/'`../Util.cpp + +Util.obj: ../Util.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Util.obj -MD -MP -MF "$(DEPDIR)/Util.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o Util.obj `if test -f '../Util.cpp'; then $(CYGPATH_W) '../Util.cpp'; else $(CYGPATH_W) '$(srcdir)/../Util.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Util.Tpo" "$(DEPDIR)/Util.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/Util.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../Util.cpp' object='Util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/Util.Po' tmpdepfile='$(DEPDIR)/Util.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Util.obj `if test -f '../Util.cpp'; then $(CYGPATH_W) '../Util.cpp'; else $(CYGPATH_W) '$(srcdir)/../Util.cpp'; fi` + +admame.o: ../admame.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT admame.o -MD -MP -MF "$(DEPDIR)/admame.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o admame.o `test -f '../admame.cpp' || echo '$(srcdir)/'`../admame.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/admame.Tpo" "$(DEPDIR)/admame.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/admame.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../admame.cpp' object='admame.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/admame.Po' tmpdepfile='$(DEPDIR)/admame.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o admame.o `test -f '../admame.cpp' || echo '$(srcdir)/'`../admame.cpp + +admame.obj: ../admame.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT admame.obj -MD -MP -MF "$(DEPDIR)/admame.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o admame.obj `if test -f '../admame.cpp'; then $(CYGPATH_W) '../admame.cpp'; else $(CYGPATH_W) '$(srcdir)/../admame.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/admame.Tpo" "$(DEPDIR)/admame.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/admame.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../admame.cpp' object='admame.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/admame.Po' tmpdepfile='$(DEPDIR)/admame.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o admame.obj `if test -f '../admame.cpp'; then $(CYGPATH_W) '../admame.cpp'; else $(CYGPATH_W) '$(srcdir)/../admame.cpp'; fi` + +agbprint.o: ../agbprint.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT agbprint.o -MD -MP -MF "$(DEPDIR)/agbprint.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o agbprint.o `test -f '../agbprint.cpp' || echo '$(srcdir)/'`../agbprint.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/agbprint.Tpo" "$(DEPDIR)/agbprint.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/agbprint.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../agbprint.cpp' object='agbprint.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/agbprint.Po' tmpdepfile='$(DEPDIR)/agbprint.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o agbprint.o `test -f '../agbprint.cpp' || echo '$(srcdir)/'`../agbprint.cpp + +agbprint.obj: ../agbprint.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT agbprint.obj -MD -MP -MF "$(DEPDIR)/agbprint.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o agbprint.obj `if test -f '../agbprint.cpp'; then $(CYGPATH_W) '../agbprint.cpp'; else $(CYGPATH_W) '$(srcdir)/../agbprint.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/agbprint.Tpo" "$(DEPDIR)/agbprint.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/agbprint.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../agbprint.cpp' object='agbprint.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/agbprint.Po' tmpdepfile='$(DEPDIR)/agbprint.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o agbprint.obj `if test -f '../agbprint.cpp'; then $(CYGPATH_W) '../agbprint.cpp'; else $(CYGPATH_W) '$(srcdir)/../agbprint.cpp'; fi` + +armdis.o: ../armdis.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT armdis.o -MD -MP -MF "$(DEPDIR)/armdis.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o armdis.o `test -f '../armdis.cpp' || echo '$(srcdir)/'`../armdis.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/armdis.Tpo" "$(DEPDIR)/armdis.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/armdis.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../armdis.cpp' object='armdis.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/armdis.Po' tmpdepfile='$(DEPDIR)/armdis.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o armdis.o `test -f '../armdis.cpp' || echo '$(srcdir)/'`../armdis.cpp + +armdis.obj: ../armdis.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT armdis.obj -MD -MP -MF "$(DEPDIR)/armdis.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o armdis.obj `if test -f '../armdis.cpp'; then $(CYGPATH_W) '../armdis.cpp'; else $(CYGPATH_W) '$(srcdir)/../armdis.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/armdis.Tpo" "$(DEPDIR)/armdis.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/armdis.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../armdis.cpp' object='armdis.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/armdis.Po' tmpdepfile='$(DEPDIR)/armdis.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o armdis.obj `if test -f '../armdis.cpp'; then $(CYGPATH_W) '../armdis.cpp'; else $(CYGPATH_W) '$(srcdir)/../armdis.cpp'; fi` + +bios.o: ../bios.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bios.o -MD -MP -MF "$(DEPDIR)/bios.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o bios.o `test -f '../bios.cpp' || echo '$(srcdir)/'`../bios.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/bios.Tpo" "$(DEPDIR)/bios.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/bios.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bios.cpp' object='bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/bios.Po' tmpdepfile='$(DEPDIR)/bios.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bios.o `test -f '../bios.cpp' || echo '$(srcdir)/'`../bios.cpp + +bios.obj: ../bios.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bios.obj -MD -MP -MF "$(DEPDIR)/bios.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o bios.obj `if test -f '../bios.cpp'; then $(CYGPATH_W) '../bios.cpp'; else $(CYGPATH_W) '$(srcdir)/../bios.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/bios.Tpo" "$(DEPDIR)/bios.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/bios.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bios.cpp' object='bios.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/bios.Po' tmpdepfile='$(DEPDIR)/bios.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bios.obj `if test -f '../bios.cpp'; then $(CYGPATH_W) '../bios.cpp'; else $(CYGPATH_W) '$(srcdir)/../bios.cpp'; fi` + +elf.o: ../elf.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT elf.o -MD -MP -MF "$(DEPDIR)/elf.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o elf.o `test -f '../elf.cpp' || echo '$(srcdir)/'`../elf.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/elf.Tpo" "$(DEPDIR)/elf.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/elf.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../elf.cpp' object='elf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/elf.Po' tmpdepfile='$(DEPDIR)/elf.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o elf.o `test -f '../elf.cpp' || echo '$(srcdir)/'`../elf.cpp + +elf.obj: ../elf.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT elf.obj -MD -MP -MF "$(DEPDIR)/elf.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o elf.obj `if test -f '../elf.cpp'; then $(CYGPATH_W) '../elf.cpp'; else $(CYGPATH_W) '$(srcdir)/../elf.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/elf.Tpo" "$(DEPDIR)/elf.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/elf.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../elf.cpp' object='elf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/elf.Po' tmpdepfile='$(DEPDIR)/elf.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o elf.obj `if test -f '../elf.cpp'; then $(CYGPATH_W) '../elf.cpp'; else $(CYGPATH_W) '$(srcdir)/../elf.cpp'; fi` + +expr-lex.o: ../expr-lex.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT expr-lex.o -MD -MP -MF "$(DEPDIR)/expr-lex.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o expr-lex.o `test -f '../expr-lex.cpp' || echo '$(srcdir)/'`../expr-lex.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/expr-lex.Tpo" "$(DEPDIR)/expr-lex.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/expr-lex.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../expr-lex.cpp' object='expr-lex.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/expr-lex.Po' tmpdepfile='$(DEPDIR)/expr-lex.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o expr-lex.o `test -f '../expr-lex.cpp' || echo '$(srcdir)/'`../expr-lex.cpp + +expr-lex.obj: ../expr-lex.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT expr-lex.obj -MD -MP -MF "$(DEPDIR)/expr-lex.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o expr-lex.obj `if test -f '../expr-lex.cpp'; then $(CYGPATH_W) '../expr-lex.cpp'; else $(CYGPATH_W) '$(srcdir)/../expr-lex.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/expr-lex.Tpo" "$(DEPDIR)/expr-lex.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/expr-lex.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../expr-lex.cpp' object='expr-lex.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/expr-lex.Po' tmpdepfile='$(DEPDIR)/expr-lex.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o expr-lex.obj `if test -f '../expr-lex.cpp'; then $(CYGPATH_W) '../expr-lex.cpp'; else $(CYGPATH_W) '$(srcdir)/../expr-lex.cpp'; fi` + +expr.o: ../expr.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT expr.o -MD -MP -MF "$(DEPDIR)/expr.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o expr.o `test -f '../expr.cpp' || echo '$(srcdir)/'`../expr.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/expr.Tpo" "$(DEPDIR)/expr.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/expr.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../expr.cpp' object='expr.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/expr.Po' tmpdepfile='$(DEPDIR)/expr.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o expr.o `test -f '../expr.cpp' || echo '$(srcdir)/'`../expr.cpp + +expr.obj: ../expr.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT expr.obj -MD -MP -MF "$(DEPDIR)/expr.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o expr.obj `if test -f '../expr.cpp'; then $(CYGPATH_W) '../expr.cpp'; else $(CYGPATH_W) '$(srcdir)/../expr.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/expr.Tpo" "$(DEPDIR)/expr.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/expr.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../expr.cpp' object='expr.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/expr.Po' tmpdepfile='$(DEPDIR)/expr.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o expr.obj `if test -f '../expr.cpp'; then $(CYGPATH_W) '../expr.cpp'; else $(CYGPATH_W) '$(srcdir)/../expr.cpp'; fi` + +exprNode.o: ../exprNode.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exprNode.o -MD -MP -MF "$(DEPDIR)/exprNode.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o exprNode.o `test -f '../exprNode.cpp' || echo '$(srcdir)/'`../exprNode.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exprNode.Tpo" "$(DEPDIR)/exprNode.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/exprNode.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../exprNode.cpp' object='exprNode.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/exprNode.Po' tmpdepfile='$(DEPDIR)/exprNode.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o exprNode.o `test -f '../exprNode.cpp' || echo '$(srcdir)/'`../exprNode.cpp + +exprNode.obj: ../exprNode.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT exprNode.obj -MD -MP -MF "$(DEPDIR)/exprNode.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o exprNode.obj `if test -f '../exprNode.cpp'; then $(CYGPATH_W) '../exprNode.cpp'; else $(CYGPATH_W) '$(srcdir)/../exprNode.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/exprNode.Tpo" "$(DEPDIR)/exprNode.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/exprNode.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../exprNode.cpp' object='exprNode.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/exprNode.Po' tmpdepfile='$(DEPDIR)/exprNode.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o exprNode.obj `if test -f '../exprNode.cpp'; then $(CYGPATH_W) '../exprNode.cpp'; else $(CYGPATH_W) '$(srcdir)/../exprNode.cpp'; fi` + +hq2x.o: ../hq2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hq2x.o -MD -MP -MF "$(DEPDIR)/hq2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o hq2x.o `test -f '../hq2x.cpp' || echo '$(srcdir)/'`../hq2x.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/hq2x.Tpo" "$(DEPDIR)/hq2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/hq2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hq2x.cpp' object='hq2x.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/hq2x.Po' tmpdepfile='$(DEPDIR)/hq2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hq2x.o `test -f '../hq2x.cpp' || echo '$(srcdir)/'`../hq2x.cpp + +hq2x.obj: ../hq2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hq2x.obj -MD -MP -MF "$(DEPDIR)/hq2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o hq2x.obj `if test -f '../hq2x.cpp'; then $(CYGPATH_W) '../hq2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../hq2x.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/hq2x.Tpo" "$(DEPDIR)/hq2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/hq2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../hq2x.cpp' object='hq2x.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/hq2x.Po' tmpdepfile='$(DEPDIR)/hq2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hq2x.obj `if test -f '../hq2x.cpp'; then $(CYGPATH_W) '../hq2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../hq2x.cpp'; fi` + +motionblur.o: ../motionblur.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT motionblur.o -MD -MP -MF "$(DEPDIR)/motionblur.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o motionblur.o `test -f '../motionblur.cpp' || echo '$(srcdir)/'`../motionblur.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/motionblur.Tpo" "$(DEPDIR)/motionblur.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/motionblur.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../motionblur.cpp' object='motionblur.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/motionblur.Po' tmpdepfile='$(DEPDIR)/motionblur.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o motionblur.o `test -f '../motionblur.cpp' || echo '$(srcdir)/'`../motionblur.cpp + +motionblur.obj: ../motionblur.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT motionblur.obj -MD -MP -MF "$(DEPDIR)/motionblur.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o motionblur.obj `if test -f '../motionblur.cpp'; then $(CYGPATH_W) '../motionblur.cpp'; else $(CYGPATH_W) '$(srcdir)/../motionblur.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/motionblur.Tpo" "$(DEPDIR)/motionblur.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/motionblur.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../motionblur.cpp' object='motionblur.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/motionblur.Po' tmpdepfile='$(DEPDIR)/motionblur.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o motionblur.obj `if test -f '../motionblur.cpp'; then $(CYGPATH_W) '../motionblur.cpp'; else $(CYGPATH_W) '$(srcdir)/../motionblur.cpp'; fi` + +pixel.o: ../pixel.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pixel.o -MD -MP -MF "$(DEPDIR)/pixel.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o pixel.o `test -f '../pixel.cpp' || echo '$(srcdir)/'`../pixel.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/pixel.Tpo" "$(DEPDIR)/pixel.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/pixel.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../pixel.cpp' object='pixel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/pixel.Po' tmpdepfile='$(DEPDIR)/pixel.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pixel.o `test -f '../pixel.cpp' || echo '$(srcdir)/'`../pixel.cpp + +pixel.obj: ../pixel.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pixel.obj -MD -MP -MF "$(DEPDIR)/pixel.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o pixel.obj `if test -f '../pixel.cpp'; then $(CYGPATH_W) '../pixel.cpp'; else $(CYGPATH_W) '$(srcdir)/../pixel.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/pixel.Tpo" "$(DEPDIR)/pixel.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/pixel.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../pixel.cpp' object='pixel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/pixel.Po' tmpdepfile='$(DEPDIR)/pixel.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pixel.obj `if test -f '../pixel.cpp'; then $(CYGPATH_W) '../pixel.cpp'; else $(CYGPATH_W) '$(srcdir)/../pixel.cpp'; fi` + +remote.o: ../remote.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote.o -MD -MP -MF "$(DEPDIR)/remote.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o remote.o `test -f '../remote.cpp' || echo '$(srcdir)/'`../remote.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/remote.Tpo" "$(DEPDIR)/remote.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/remote.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../remote.cpp' object='remote.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/remote.Po' tmpdepfile='$(DEPDIR)/remote.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote.o `test -f '../remote.cpp' || echo '$(srcdir)/'`../remote.cpp + +remote.obj: ../remote.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT remote.obj -MD -MP -MF "$(DEPDIR)/remote.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o remote.obj `if test -f '../remote.cpp'; then $(CYGPATH_W) '../remote.cpp'; else $(CYGPATH_W) '$(srcdir)/../remote.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/remote.Tpo" "$(DEPDIR)/remote.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/remote.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../remote.cpp' object='remote.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/remote.Po' tmpdepfile='$(DEPDIR)/remote.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o remote.obj `if test -f '../remote.cpp'; then $(CYGPATH_W) '../remote.cpp'; else $(CYGPATH_W) '$(srcdir)/../remote.cpp'; fi` + +scanline.o: ../scanline.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scanline.o -MD -MP -MF "$(DEPDIR)/scanline.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o scanline.o `test -f '../scanline.cpp' || echo '$(srcdir)/'`../scanline.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/scanline.Tpo" "$(DEPDIR)/scanline.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/scanline.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../scanline.cpp' object='scanline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/scanline.Po' tmpdepfile='$(DEPDIR)/scanline.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scanline.o `test -f '../scanline.cpp' || echo '$(srcdir)/'`../scanline.cpp + +scanline.obj: ../scanline.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scanline.obj -MD -MP -MF "$(DEPDIR)/scanline.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o scanline.obj `if test -f '../scanline.cpp'; then $(CYGPATH_W) '../scanline.cpp'; else $(CYGPATH_W) '$(srcdir)/../scanline.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/scanline.Tpo" "$(DEPDIR)/scanline.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/scanline.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../scanline.cpp' object='scanline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/scanline.Po' tmpdepfile='$(DEPDIR)/scanline.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scanline.obj `if test -f '../scanline.cpp'; then $(CYGPATH_W) '../scanline.cpp'; else $(CYGPATH_W) '$(srcdir)/../scanline.cpp'; fi` + +simple2x.o: ../simple2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simple2x.o -MD -MP -MF "$(DEPDIR)/simple2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o simple2x.o `test -f '../simple2x.cpp' || echo '$(srcdir)/'`../simple2x.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/simple2x.Tpo" "$(DEPDIR)/simple2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/simple2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../simple2x.cpp' object='simple2x.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/simple2x.Po' tmpdepfile='$(DEPDIR)/simple2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simple2x.o `test -f '../simple2x.cpp' || echo '$(srcdir)/'`../simple2x.cpp + +simple2x.obj: ../simple2x.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simple2x.obj -MD -MP -MF "$(DEPDIR)/simple2x.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o simple2x.obj `if test -f '../simple2x.cpp'; then $(CYGPATH_W) '../simple2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../simple2x.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/simple2x.Tpo" "$(DEPDIR)/simple2x.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/simple2x.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../simple2x.cpp' object='simple2x.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/simple2x.Po' tmpdepfile='$(DEPDIR)/simple2x.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simple2x.obj `if test -f '../simple2x.cpp'; then $(CYGPATH_W) '../simple2x.cpp'; else $(CYGPATH_W) '$(srcdir)/../simple2x.cpp'; fi` + +unzip.o: ../unzip.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT unzip.o -MD -MP -MF "$(DEPDIR)/unzip.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o unzip.o `test -f '../unzip.cpp' || echo '$(srcdir)/'`../unzip.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/unzip.Tpo" "$(DEPDIR)/unzip.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/unzip.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../unzip.cpp' object='unzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/unzip.Po' tmpdepfile='$(DEPDIR)/unzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o unzip.o `test -f '../unzip.cpp' || echo '$(srcdir)/'`../unzip.cpp + +unzip.obj: ../unzip.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT unzip.obj -MD -MP -MF "$(DEPDIR)/unzip.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o unzip.obj `if test -f '../unzip.cpp'; then $(CYGPATH_W) '../unzip.cpp'; else $(CYGPATH_W) '$(srcdir)/../unzip.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/unzip.Tpo" "$(DEPDIR)/unzip.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/unzip.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../unzip.cpp' object='unzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/unzip.Po' tmpdepfile='$(DEPDIR)/unzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o unzip.obj `if test -f '../unzip.cpp'; then $(CYGPATH_W) '../unzip.cpp'; else $(CYGPATH_W) '$(srcdir)/../unzip.cpp'; fi` + +bilinear.o: ../bilinear.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bilinear.o -MD -MP -MF "$(DEPDIR)/bilinear.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o bilinear.o `test -f '../bilinear.cpp' || echo '$(srcdir)/'`../bilinear.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/bilinear.Tpo" "$(DEPDIR)/bilinear.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/bilinear.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bilinear.cpp' object='bilinear.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/bilinear.Po' tmpdepfile='$(DEPDIR)/bilinear.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bilinear.o `test -f '../bilinear.cpp' || echo '$(srcdir)/'`../bilinear.cpp + +bilinear.obj: ../bilinear.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bilinear.obj -MD -MP -MF "$(DEPDIR)/bilinear.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o bilinear.obj `if test -f '../bilinear.cpp'; then $(CYGPATH_W) '../bilinear.cpp'; else $(CYGPATH_W) '$(srcdir)/../bilinear.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/bilinear.Tpo" "$(DEPDIR)/bilinear.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/bilinear.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../bilinear.cpp' object='bilinear.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/bilinear.Po' tmpdepfile='$(DEPDIR)/bilinear.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bilinear.obj `if test -f '../bilinear.cpp'; then $(CYGPATH_W) '../bilinear.cpp'; else $(CYGPATH_W) '$(srcdir)/../bilinear.cpp'; fi` + +interframe.o: ../interframe.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT interframe.o -MD -MP -MF "$(DEPDIR)/interframe.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o interframe.o `test -f '../interframe.cpp' || echo '$(srcdir)/'`../interframe.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/interframe.Tpo" "$(DEPDIR)/interframe.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/interframe.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../interframe.cpp' object='interframe.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/interframe.Po' tmpdepfile='$(DEPDIR)/interframe.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o interframe.o `test -f '../interframe.cpp' || echo '$(srcdir)/'`../interframe.cpp + +interframe.obj: ../interframe.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT interframe.obj -MD -MP -MF "$(DEPDIR)/interframe.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o interframe.obj `if test -f '../interframe.cpp'; then $(CYGPATH_W) '../interframe.cpp'; else $(CYGPATH_W) '$(srcdir)/../interframe.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/interframe.Tpo" "$(DEPDIR)/interframe.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/interframe.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../interframe.cpp' object='interframe.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/interframe.Po' tmpdepfile='$(DEPDIR)/interframe.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o interframe.obj `if test -f '../interframe.cpp'; then $(CYGPATH_W) '../interframe.cpp'; else $(CYGPATH_W) '$(srcdir)/../interframe.cpp'; fi` +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp new file mode 100644 index 0000000..095b3c4 --- /dev/null +++ b/src/sdl/SDL.cpp @@ -0,0 +1,3516 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include +#include +#include + +#include "AutoBuild.h" + +#include "SDL.h" +#include "GBA.h" +#include "agbprint.h" +#include "Flash.h" +#include "Port.h" +#include "debugger.h" +#include "RTC.h" +#include "Sound.h" +#include "Text.h" +#include "unzip.h" +#include "Util.h" +#include "gb/GB.h" +#include "gb/gbGlobals.h" +#include "movie.h" + +#define GBC_CAPABLE ((gbRom[0x143] & 0x80) != 0) +#define SGB_CAPABLE (gbRom[0x146] == 0x03) + +#ifndef WIN32 +# include +# define GETCWD getcwd +#else // WIN32 +# include +# define GETCWD _getcwd +#endif // WIN32 + +#ifndef __GNUC__ +# define HAVE_DECL_GETOPT 0 +# define __STDC__ 1 +# include "getopt.h" +#else // ! __GNUC__ +# define HAVE_DECL_GETOPT 1 +# include "getopt.h" +#endif // ! __GNUC__ + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif +extern bool soundEcho; +extern bool soundLowPass; +extern bool soundReverse; +extern int Init_2xSaI(u32); +extern void _2xSaI(u8*,u32,u8*,u8*,u32,int,int); +extern void _2xSaI32(u8*,u32,u8*,u8*,u32,int,int); +extern void Super2xSaI(u8*,u32,u8*,u8*,u32,int,int); +extern void Super2xSaI32(u8*,u32,u8*,u8*,u32,int,int); +extern void SuperEagle(u8*,u32,u8*,u8*,u32,int,int); +extern void SuperEagle32(u8*,u32,u8*,u8*,u32,int,int); +extern void Pixelate(u8*,u32,u8*,u8*,u32,int,int); +extern void Pixelate32(u8*,u32,u8*,u8*,u32,int,int); +extern void MotionBlur(u8*,u32,u8*,u8*,u32,int,int); +extern void MotionBlur32(u8*,u32,u8*,u8*,u32,int,int); +extern void AdMame2x(u8*,u32,u8*,u8*,u32,int,int); +extern void AdMame2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void Simple2x(u8*,u32,u8*,u8*,u32,int,int); +extern void Simple2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void Bilinear(u8*,u32,u8*,u8*,u32,int,int); +extern void Bilinear32(u8*,u32,u8*,u8*,u32,int,int); +extern void BilinearPlus(u8*,u32,u8*,u8*,u32,int,int); +extern void BilinearPlus32(u8*,u32,u8*,u8*,u32,int,int); +extern void Scanlines(u8*,u32,u8*,u8*,u32,int,int); +extern void Scanlines32(u8*,u32,u8*,u8*,u32,int,int); +extern void ScanlinesTV(u8*,u32,u8*,u8*,u32,int,int); +extern void ScanlinesTV32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2x(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void lq2x(u8*,u32,u8*,u8*,u32,int,int); +extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int); + +extern void SmartIB(u8*,u32,int,int); +extern void SmartIB32(u8*,u32,int,int); +extern void MotionBlurIB(u8*,u32,int,int); +extern void MotionBlurIB32(u8*,u32,int,int); + +void Init_Overlay(SDL_Surface *surface, int overlaytype); +void Quit_Overlay(void); +void Draw_Overlay(SDL_Surface *surface, int size); + +extern void remoteInit(); +extern void remoteCleanUp(); +extern void remoteStubMain(); +extern void remoteStubSignal(int,int); +extern void remoteOutput(char *, u32); +extern void remoteSetProtocol(int); +extern void remoteSetPort(int); +extern void debuggerOutput(char *, u32); + +extern void CPUUpdateRenderBuffers(bool); + +struct EmulatedSystem emulator = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + false, + 0 +}; + +SDL_Surface *surface = NULL; +SDL_Overlay *overlay = NULL; +SDL_Rect overlay_rect; + +int systemSpeed = 0; +int systemRedShift = 0; +int systemBlueShift = 0; +int systemGreenShift = 0; +int systemColorDepth = 0; +int systemDebug = 0; +int systemVerbose = 0; +int systemFrameSkip = 0; +int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + +int srcPitch = 0; +int srcWidth = 0; +int srcHeight = 0; +int destWidth = 0; +int destHeight = 0; + +int sensorX = 2047; +int sensorY = 2047; + +int filter = 0; +u8 *delta = NULL; + +int sdlPrintUsage = 0; +int disableMMX = 0; + +int cartridgeType = 3; +int sizeOption = 0; +int captureFormat = 0; +int useMovie = 0; + +int pauseWhenInactive = 0; +int active = 1; +int emulating = 0; +int RGB_LOW_BITS_MASK=0x821; +u32 systemColorMap32[0x10000]; +u16 systemColorMap16[0x10000]; +u16 systemGbPalette[24]; +void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int) = NULL; +void (*ifbFunction)(u8*,u32,int,int) = NULL; +int ifbType = 0; +char filename[2048]; +char ipsname[2048]; +char biosFileName[2048]; +char movieFileName[2048]; +char captureDir[2048]; +char saveDir[2048]; +char batteryDir[2048]; + +static char *rewindMemory = NULL; +static int rewindPos = 0; +static int rewindTopPos = 0; +static int rewindCounter = 0; +static int rewindCount = 0; +static bool rewindSaveNeeded = false; +static int rewindTimer = 0; + +#define REWIND_SIZE 400000 + +#define _stricmp strcasecmp + +bool sdlButtons[4][12] = { + { false, false, false, false, false, false, + false, false, false, false, false, false }, + { false, false, false, false, false, false, + false, false, false, false, false, false }, + { false, false, false, false, false, false, + false, false, false, false, false, false }, + { false, false, false, false, false, false, + false, false, false, false, false, false } +}; + +bool sdlMotionButtons[4] = { false, false, false, false }; + +int sdlNumDevices = 0; +SDL_Joystick **sdlDevices = NULL; + +bool wasPaused = false; +int autoFrameSkip = 0; +int frameskipadjust = 0; +int showRenderedFrames = 0; +int renderedFrames = 0; + +int throttle = 0; +u32 throttleLastTime = 0; +u32 autoFrameSkipLastTime = 0; + +int showSpeed = 1; +int showSpeedTransparent = 1; +bool disableStatusMessages = false; +bool paused = false; +bool pauseNextFrame = false; +bool debugger = false; +bool debuggerStub = false; +int fullscreen = 0; +bool systemSoundOn = false; +bool yuv = false; +int yuvType = 0; +bool removeIntros = false; +int sdlFlashSize = 0; +int sdlAutoIPS = 1; +int sdlRtcEnable = 0; +int sdlAgbPrint = 0; + +int sdlDefaultJoypad = 0; + +extern void debuggerSignal(int,int); + +void (*dbgMain)() = debuggerMain; +void (*dbgSignal)(int,int) = debuggerSignal; +void (*dbgOutput)(char *, u32) = debuggerOutput; + +int mouseCounter = 0; +int autoFire = 0; +bool autoFireToggle = false; + +bool screenMessage[8] = {false,false,false,false,false,false,false,false}; +char screenMessageBuffer[8][21]; +u32 screenMessageTime[8] = {0,0,0,0,0,0,0,0}; +u32 screenMessageDuration[8] = {0,0,0,0,0,0,0,0}; + +SDL_cond *cond = NULL; +SDL_mutex *mutex = NULL; +u8 sdlBuffer[4096]; +int sdlSoundLen = 0; + +char *arg0; + +#ifndef C_CORE +u8 sdlStretcher[16384]; +int sdlStretcherPos; +#else +void (*sdlStretcher)(u8 *, u8*) = NULL; +#endif + +#include "inputGlobal.h" + +u16 joypad[4][12] = { + { SDLK_LEFT, SDLK_RIGHT, + SDLK_UP, SDLK_DOWN, + SDLK_z, SDLK_x, + SDLK_RETURN,SDLK_BACKSPACE, + SDLK_a, SDLK_s, + SDLK_SPACE, SDLK_F12 + }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +u16 defaultJoypad[12] = { + SDLK_LEFT, SDLK_RIGHT, + SDLK_UP, SDLK_DOWN, + SDLK_z, SDLK_x, + SDLK_RETURN,SDLK_BACKSPACE, + SDLK_a, SDLK_s, + SDLK_SPACE, SDLK_F12 +}; + +u16 motion[4] = { + SDLK_KP4, SDLK_KP6, SDLK_KP8, SDLK_KP2 +}; + +u16 defaultMotion[4] = { + SDLK_KP4, SDLK_KP6, SDLK_KP8, SDLK_KP2 +}; + +struct option sdlOptions[] = { + { "agb-print", no_argument, &sdlAgbPrint, 1 }, + { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, + { "bios", required_argument, 0, 'b' }, + { "config", required_argument, 0, 'c' }, + { "debug", no_argument, 0, 'd' }, + { "filter", required_argument, 0, 'f' }, + { "filter-normal", no_argument, &filter, 0 }, + { "filter-tv-mode", no_argument, &filter, 1 }, + { "filter-2xsai", no_argument, &filter, 2 }, + { "filter-super-2xsai", no_argument, &filter, 3 }, + { "filter-super-eagle", no_argument, &filter, 4 }, + { "filter-pixelate", no_argument, &filter, 5 }, + { "filter-motion-blur", no_argument, &filter, 6 }, + { "filter-advmame", no_argument, &filter, 7 }, + { "filter-simple2x", no_argument, &filter, 8 }, + { "filter-bilinear", no_argument, &filter, 9 }, + { "filter-bilinear+", no_argument, &filter, 10 }, + { "filter-scanlines", no_argument, &filter, 11 }, + { "filter-hq2x", no_argument, &filter, 12 }, + { "filter-lq2x", no_argument, &filter, 13 }, + { "flash-size", required_argument, 0, 'S' }, + { "flash-64k", no_argument, &sdlFlashSize, 0 }, + { "flash-128k", no_argument, &sdlFlashSize, 1 }, + { "frameskip", required_argument, 0, 's' }, + { "fullscreen", no_argument, &fullscreen, 1 }, + { "gdb", required_argument, 0, 'G' }, + { "help", no_argument, &sdlPrintUsage, 1 }, + { "ifb-none", no_argument, &ifbType, 0 }, + { "ifb-motion-blur", no_argument, &ifbType, 1 }, + { "ifb-smart", no_argument, &ifbType, 2 }, + { "ips", required_argument, 0, 'i' }, + { "no-agb-print", no_argument, &sdlAgbPrint, 0 }, + { "no-auto-frameskip", no_argument, &autoFrameSkip, 0 }, + { "no-debug", no_argument, 0, 'N' }, + { "no-ips", no_argument, &sdlAutoIPS, 0 }, + { "no-mmx", no_argument, &disableMMX, 1 }, + { "no-pause-when-inactive", no_argument, &pauseWhenInactive, 0 }, + { "no-rtc", no_argument, &sdlRtcEnable, 0 }, + { "no-show-speed", no_argument, &showSpeed, 0 }, + { "no-throttle", no_argument, &throttle, 0 }, + { "pause-when-inactive", no_argument, &pauseWhenInactive, 1 }, + { "profile", optional_argument, 0, 'P' }, + { "rtc", no_argument, &sdlRtcEnable, 1 }, + { "save-type", required_argument, 0, 't' }, + { "save-auto", no_argument, &cpuSaveType, 0 }, + { "save-eeprom", no_argument, &cpuSaveType, 1 }, + { "save-sram", no_argument, &cpuSaveType, 2 }, + { "save-flash", no_argument, &cpuSaveType, 3 }, + { "save-sensor", no_argument, &cpuSaveType, 4 }, + { "save-none", no_argument, &cpuSaveType, 5 }, + { "show-speed-normal", no_argument, &showSpeed, 1 }, + { "show-speed-detailed", no_argument, &showSpeed, 2 }, + { "throttle", required_argument, 0, 'T' }, + { "verbose", required_argument, 0, 'v' }, + { "video-1x", no_argument, &sizeOption, 0 }, + { "video-2x", no_argument, &sizeOption, 1 }, + { "video-3x", no_argument, &sizeOption, 2 }, + { "video-4x", no_argument, &sizeOption, 3 }, + { "yuv", required_argument, 0, 'Y' }, + { "recordmovie", required_argument, 0, 'r' }, + { "playmovie", required_argument, 0, 'p' }, + { "watchmovie", required_argument, 0, 'w' }, + { NULL, no_argument, NULL, 0 } +}; + +extern bool CPUIsGBAImage(char *); +extern bool gbIsGameboyRom(char *); + +#ifndef C_CORE +#define SDL_LONG(val) \ + *((u32 *)&sdlStretcher[sdlStretcherPos]) = val;\ + sdlStretcherPos+=4; + +#define SDL_AND_EAX(val) \ + sdlStretcher[sdlStretcherPos++] = 0x25;\ + SDL_LONG(val); + +#define SDL_AND_EBX(val) \ + sdlStretcher[sdlStretcherPos++] = 0x81;\ + sdlStretcher[sdlStretcherPos++] = 0xe3;\ + SDL_LONG(val); + +#define SDL_OR_EAX_EBX \ + sdlStretcher[sdlStretcherPos++] = 0x09;\ + sdlStretcher[sdlStretcherPos++] = 0xd8; + +#define SDL_LOADL_EBX \ + sdlStretcher[sdlStretcherPos++] = 0x8b;\ + sdlStretcher[sdlStretcherPos++] = 0x1f; + +#define SDL_LOADW \ + sdlStretcher[sdlStretcherPos++] = 0x66;\ + sdlStretcher[sdlStretcherPos++] = 0x8b;\ + sdlStretcher[sdlStretcherPos++] = 0x06;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc6;\ + sdlStretcher[sdlStretcherPos++] = 0x02; + +#define SDL_LOADL \ + sdlStretcher[sdlStretcherPos++] = 0x8b;\ + sdlStretcher[sdlStretcherPos++] = 0x06;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc6;\ + sdlStretcher[sdlStretcherPos++] = 0x04; + +#define SDL_LOADL2 \ + sdlStretcher[sdlStretcherPos++] = 0x8b;\ + sdlStretcher[sdlStretcherPos++] = 0x06;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc6;\ + sdlStretcher[sdlStretcherPos++] = 0x03; + +#define SDL_STOREW \ + sdlStretcher[sdlStretcherPos++] = 0x66;\ + sdlStretcher[sdlStretcherPos++] = 0x89;\ + sdlStretcher[sdlStretcherPos++] = 0x07;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc7;\ + sdlStretcher[sdlStretcherPos++] = 0x02; + +#define SDL_STOREL \ + sdlStretcher[sdlStretcherPos++] = 0x89;\ + sdlStretcher[sdlStretcherPos++] = 0x07;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc7;\ + sdlStretcher[sdlStretcherPos++] = 0x04; + +#define SDL_STOREL2 \ + sdlStretcher[sdlStretcherPos++] = 0x89;\ + sdlStretcher[sdlStretcherPos++] = 0x07;\ + sdlStretcher[sdlStretcherPos++] = 0x83;\ + sdlStretcher[sdlStretcherPos++] = 0xc7;\ + sdlStretcher[sdlStretcherPos++] = 0x03; + +#define SDL_RET \ + sdlStretcher[sdlStretcherPos++] = 0xc3; + +#define SDL_PUSH_EAX \ + sdlStretcher[sdlStretcherPos++] = 0x50; + +#define SDL_PUSH_ECX \ + sdlStretcher[sdlStretcherPos++] = 0x51; + +#define SDL_PUSH_EBX \ + sdlStretcher[sdlStretcherPos++] = 0x53; + +#define SDL_PUSH_ESI \ + sdlStretcher[sdlStretcherPos++] = 0x56; + +#define SDL_PUSH_EDI \ + sdlStretcher[sdlStretcherPos++] = 0x57; + +#define SDL_POP_EAX \ + sdlStretcher[sdlStretcherPos++] = 0x58; + +#define SDL_POP_ECX \ + sdlStretcher[sdlStretcherPos++] = 0x59; + +#define SDL_POP_EBX \ + sdlStretcher[sdlStretcherPos++] = 0x5b; + +#define SDL_POP_ESI \ + sdlStretcher[sdlStretcherPos++] = 0x5e; + +#define SDL_POP_EDI \ + sdlStretcher[sdlStretcherPos++] = 0x5f; + +#define SDL_MOV_ECX(val) \ + sdlStretcher[sdlStretcherPos++] = 0xb9;\ + SDL_LONG(val); + +#define SDL_REP_MOVSB \ + sdlStretcher[sdlStretcherPos++] = 0xf3;\ + sdlStretcher[sdlStretcherPos++] = 0xa4; + +#define SDL_REP_MOVSW \ + sdlStretcher[sdlStretcherPos++] = 0xf3;\ + sdlStretcher[sdlStretcherPos++] = 0x66;\ + sdlStretcher[sdlStretcherPos++] = 0xa5; + +#define SDL_REP_MOVSL \ + sdlStretcher[sdlStretcherPos++] = 0xf3;\ + sdlStretcher[sdlStretcherPos++] = 0xa5; + +void sdlMakeStretcher(int width) +{ + sdlStretcherPos = 0; + switch(systemColorDepth) { + case 16: + if(sizeOption) { + SDL_PUSH_EAX; + SDL_PUSH_ESI; + SDL_PUSH_EDI; + for(int i = 0; i < width; i++) { + SDL_LOADW; + SDL_STOREW; + SDL_STOREW; + if(sizeOption > 1) { + SDL_STOREW; + } + if(sizeOption > 2) { + SDL_STOREW; + } + } + SDL_POP_EDI; + SDL_POP_ESI; + SDL_POP_EAX; + SDL_RET; + } else { + SDL_PUSH_ESI; + SDL_PUSH_EDI; + SDL_PUSH_ECX; + SDL_MOV_ECX(width); + SDL_REP_MOVSW; + SDL_POP_ECX; + SDL_POP_EDI; + SDL_POP_ESI; + SDL_RET; + } + break; + case 24: + if(sizeOption) { + SDL_PUSH_EAX; + SDL_PUSH_ESI; + SDL_PUSH_EDI; + int w = width - 1; + for(int i = 0; i < w; i++) { + SDL_LOADL2; + SDL_STOREL2; + SDL_STOREL2; + if(sizeOption > 1) { + SDL_STOREL2; + } + if(sizeOption > 2) { + SDL_STOREL2; + } + } + // need to write the last one + SDL_LOADL2; + SDL_STOREL2; + if(sizeOption > 1) { + SDL_STOREL2; + } + if(sizeOption > 2) { + SDL_STOREL2; + } + SDL_AND_EAX(0x00ffffff); + SDL_PUSH_EBX; + SDL_LOADL_EBX; + SDL_AND_EBX(0xff000000); + SDL_OR_EAX_EBX; + SDL_POP_EBX; + SDL_STOREL2; + SDL_POP_EDI; + SDL_POP_ESI; + SDL_POP_EAX; + SDL_RET; + } else { + SDL_PUSH_ESI; + SDL_PUSH_EDI; + SDL_PUSH_ECX; + SDL_MOV_ECX(3*width); + SDL_REP_MOVSB; + SDL_POP_ECX; + SDL_POP_EDI; + SDL_POP_ESI; + SDL_RET; + } + break; + case 32: + if(sizeOption) { + SDL_PUSH_EAX; + SDL_PUSH_ESI; + SDL_PUSH_EDI; + for(int i = 0; i < width; i++) { + SDL_LOADL; + SDL_STOREL; + SDL_STOREL; + if(sizeOption > 1) { + SDL_STOREL; + } + if(sizeOption > 2) { + SDL_STOREL; + } + } + SDL_POP_EDI; + SDL_POP_ESI; + SDL_POP_EAX; + SDL_RET; + } else { + SDL_PUSH_ESI; + SDL_PUSH_EDI; + SDL_PUSH_ECX; + SDL_MOV_ECX(width); + SDL_REP_MOVSL; + SDL_POP_ECX; + SDL_POP_EDI; + SDL_POP_ESI; + SDL_RET; + } + break; + } +} + +#ifdef _MSC_VER +#define SDL_CALL_STRETCHER \ + {\ + __asm mov eax, stretcher\ + __asm mov edi, dest\ + __asm mov esi, src\ + __asm call eax\ + } +#else +#define SDL_CALL_STRETCHER \ + asm volatile("call *%%eax"::"a" (stretcher),"S" (src),"D" (dest)) +#endif +#else +#define SDL_CALL_STRETCHER \ + sdlStretcher(src, dest) + +void sdlStretch16x1(u8 *src, u8 *dest) +{ + u16 *s = (u16 *)src; + u16 *d = (u16 *)dest; + for(int i = 0; i < srcWidth; i++) + *d++ = *s++; +} + +void sdlStretch16x2(u8 *src, u8 *dest) +{ + u16 *s = (u16 *)src; + u16 *d = (u16 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s++; + } +} + +void sdlStretch16x3(u8 *src, u8 *dest) +{ + u16 *s = (u16 *)src; + u16 *d = (u16 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s; + *d++ = *s++; + } +} + +void sdlStretch16x4(u8 *src, u8 *dest) +{ + u16 *s = (u16 *)src; + u16 *d = (u16 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s; + *d++ = *s; + *d++ = *s++; + } +} + +void (*sdlStretcher16[4])(u8 *, u8 *) = { + sdlStretch16x1, + sdlStretch16x2, + sdlStretch16x3, + sdlStretch16x4 +}; + +void sdlStretch32x1(u8 *src, u8 *dest) +{ + u32 *s = (u32 *)src; + u32 *d = (u32 *)dest; + for(int i = 0; i < srcWidth; i++) + *d++ = *s++; +} + +void sdlStretch32x2(u8 *src, u8 *dest) +{ + u32 *s = (u32 *)src; + u32 *d = (u32 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s++; + } +} + +void sdlStretch32x3(u8 *src, u8 *dest) +{ + u32 *s = (u32 *)src; + u32 *d = (u32 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s; + *d++ = *s++; + } +} + +void sdlStretch32x4(u8 *src, u8 *dest) +{ + u32 *s = (u32 *)src; + u32 *d = (u32 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *s; + *d++ = *s; + *d++ = *s++; + } +} + +void (*sdlStretcher32[4])(u8 *, u8 *) = { + sdlStretch32x1, + sdlStretch32x2, + sdlStretch32x3, + sdlStretch32x4 +}; + +void sdlStretch24x1(u8 *src, u8 *dest) +{ + u8 *s = src; + u8 *d = dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + } +} + +void sdlStretch24x2(u8 *src, u8 *dest) +{ + u8 *s = (u8 *)src; + u8 *d = (u8 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + } +} + +void sdlStretch24x3(u8 *src, u8 *dest) +{ + u8 *s = (u8 *)src; + u8 *d = (u8 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + } +} + +void sdlStretch24x4(u8 *src, u8 *dest) +{ + u8 *s = (u8 *)src; + u8 *d = (u8 *)dest; + for(int i = 0; i < srcWidth; i++) { + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + *d++ = *s; + *d++ = *(s+1); + *d++ = *(s+2); + s += 3; + } +} + +void (*sdlStretcher24[4])(u8 *, u8 *) = { + sdlStretch24x1, + sdlStretch24x2, + sdlStretch24x3, + sdlStretch24x4 +}; + +#endif + +u32 sdlFromHex(char *s) +{ + u32 value; + sscanf(s, "%x", &value); + return value; +} + +#ifdef __MSC__ +#define stat _stat +#define S_IFDIR _S_IFDIR +#endif + +void sdlCheckDirectory(char *dir) +{ + struct stat buf; + + int len = strlen(dir); + + char *p = dir + len - 1; + + if(*p == '/' || + *p == '\\') + *p = 0; + + if(stat(dir, &buf) == 0) { + if(!(buf.st_mode & S_IFDIR)) { + fprintf(stderr, "Error: %s is not a directory\n", dir); + dir[0] = 0; + } + } else { + fprintf(stderr, "Error: %s does not exist\n", dir); + dir[0] = 0; + } +} + +char *sdlGetFilename(char *name) +{ + static char filebuffer[2048]; + + int len = strlen(name); + + char *p = name + len - 1; + + while(true) { + if(*p == '/' || + *p == '\\') { + p++; + break; + } + len--; + p--; + if(len == 0) + break; + } + + if(len == 0) + strcpy(filebuffer, name); + else + strcpy(filebuffer, p); + return filebuffer; +} + +FILE *sdlFindFile(const char *name) +{ + char buffer[4096]; + char path[2048]; + +#ifdef WIN32 +#define PATH_SEP ";" +#define FILE_SEP '\\' +#define EXE_NAME "VisualBoyAdvance-SDL.exe" +#else // ! WIN32 +#define PATH_SEP ":" +#define FILE_SEP '/' +#define EXE_NAME "VisualBoyAdvance" +#endif // ! WIN32 + + fprintf(stderr, "Searching for file %s\n", name); + + if(GETCWD(buffer, 2048)) { + fprintf(stderr, "Searching current directory: %s\n", buffer); + } + + FILE *f = fopen(name, "r"); + if(f != NULL) { + return f; + } + + char *home = getenv("HOME"); + + if(home != NULL) { + fprintf(stderr, "Searching home directory: %s\n", home); + sprintf(path, "%s%c%s", home, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; + } + +#ifdef WIN32 + home = getenv("USERPROFILE"); + if(home != NULL) { + fprintf(stderr, "Searching user profile directory: %s\n", home); + sprintf(path, "%s%c%s", home, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; + } +#else // ! WIN32 + fprintf(stderr, "Searching system config directory: %s\n", SYSCONFDIR); + sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; +#endif // ! WIN32 + + if(!strchr(arg0, '/') && + !strchr(arg0, '\\')) { + char *path = getenv("PATH"); + + if(path != NULL) { + fprintf(stderr, "Searching PATH\n"); + strncpy(buffer, path, 4096); + buffer[4095] = 0; + char *tok = strtok(buffer, PATH_SEP); + + while(tok) { + sprintf(path, "%s%c%s", tok, FILE_SEP, EXE_NAME); + f = fopen(path, "r"); + if(f != NULL) { + char path2[2048]; + fclose(f); + sprintf(path2, "%s%c%s", tok, FILE_SEP, name); + f = fopen(path2, "r"); + if(f != NULL) { + fprintf(stderr, "Found at %s\n", path2); + return f; + } + } + tok = strtok(NULL, PATH_SEP); + } + } + } else { + // executable is relative to some directory + fprintf(stderr, "Searching executable directory\n"); + strcpy(buffer, arg0); + char *p = strrchr(buffer, FILE_SEP); + if(p) { + *p = 0; + sprintf(path, "%s%c%s", buffer, FILE_SEP, name); + f = fopen(path, "r"); + if(f != NULL) + return f; + } + } + return NULL; +} + +void sdlReadPreferences(FILE *f) +{ + char buffer[2048]; + + while(1) { + char *s = fgets(buffer, 2048, f); + + if(s == NULL) + break; + + char *p = strchr(s, '#'); + + if(p) + *p = 0; + + char *token = strtok(s, " \t\n\r="); + + if(!token) + continue; + + if(strlen(token) == 0) + continue; + + char *key = token; + char *value = strtok(NULL, "\t\n\r"); + + if(value == NULL) { + fprintf(stderr, "Empty value for key %s\n", key); + continue; + } + + if(!strcmp(key,"Joy0_Left")) { + joypad[0][KEY_LEFT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Right")) { + joypad[0][KEY_RIGHT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Up")) { + joypad[0][KEY_UP] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Down")) { + joypad[0][KEY_DOWN] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_A")) { + joypad[0][KEY_BUTTON_A] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_B")) { + joypad[0][KEY_BUTTON_B] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_L")) { + joypad[0][KEY_BUTTON_L] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_R")) { + joypad[0][KEY_BUTTON_R] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Start")) { + joypad[0][KEY_BUTTON_START] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Select")) { + joypad[0][KEY_BUTTON_SELECT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Speed")) { + joypad[0][KEY_BUTTON_SPEED] = sdlFromHex(value); + } else if(!strcmp(key, "Joy0_Capture")) { + joypad[0][KEY_BUTTON_CAPTURE] = sdlFromHex(value); + } else if(!strcmp(key,"Joy1_Left")) { + joypad[1][KEY_LEFT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Right")) { + joypad[1][KEY_RIGHT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Up")) { + joypad[1][KEY_UP] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Down")) { + joypad[1][KEY_DOWN] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_A")) { + joypad[1][KEY_BUTTON_A] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_B")) { + joypad[1][KEY_BUTTON_B] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_L")) { + joypad[1][KEY_BUTTON_L] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_R")) { + joypad[1][KEY_BUTTON_R] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Start")) { + joypad[1][KEY_BUTTON_START] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Select")) { + joypad[1][KEY_BUTTON_SELECT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Speed")) { + joypad[1][KEY_BUTTON_SPEED] = sdlFromHex(value); + } else if(!strcmp(key, "Joy1_Capture")) { + joypad[1][KEY_BUTTON_CAPTURE] = sdlFromHex(value); + } else if(!strcmp(key,"Joy2_Left")) { + joypad[2][KEY_LEFT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Right")) { + joypad[2][KEY_RIGHT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Up")) { + joypad[2][KEY_UP] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Down")) { + joypad[2][KEY_DOWN] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_A")) { + joypad[2][KEY_BUTTON_A] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_B")) { + joypad[2][KEY_BUTTON_B] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_L")) { + joypad[2][KEY_BUTTON_L] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_R")) { + joypad[2][KEY_BUTTON_R] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Start")) { + joypad[2][KEY_BUTTON_START] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Select")) { + joypad[2][KEY_BUTTON_SELECT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Speed")) { + joypad[2][KEY_BUTTON_SPEED] = sdlFromHex(value); + } else if(!strcmp(key, "Joy2_Capture")) { + joypad[2][KEY_BUTTON_CAPTURE] = sdlFromHex(value); + } else if(!strcmp(key,"Joy4_Left")) { + joypad[4][KEY_LEFT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Right")) { + joypad[4][KEY_RIGHT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Up")) { + joypad[4][KEY_UP] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Down")) { + joypad[4][KEY_DOWN] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_A")) { + joypad[4][KEY_BUTTON_A] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_B")) { + joypad[4][KEY_BUTTON_B] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_L")) { + joypad[4][KEY_BUTTON_L] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_R")) { + joypad[4][KEY_BUTTON_R] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Start")) { + joypad[4][KEY_BUTTON_START] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Select")) { + joypad[4][KEY_BUTTON_SELECT] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Speed")) { + joypad[4][KEY_BUTTON_SPEED] = sdlFromHex(value); + } else if(!strcmp(key, "Joy4_Capture")) { + joypad[4][KEY_BUTTON_CAPTURE] = sdlFromHex(value); + } else if(!strcmp(key, "Motion_Left")) { + motion[KEY_LEFT] = sdlFromHex(value); + } else if(!strcmp(key, "Motion_Right")) { + motion[KEY_RIGHT] = sdlFromHex(value); + } else if(!strcmp(key, "Motion_Up")) { + motion[KEY_UP] = sdlFromHex(value); + } else if(!strcmp(key, "Motion_Down")) { + motion[KEY_DOWN] = sdlFromHex(value); + } else if(!strcmp(key, "frameSkip")) { + frameSkip = sdlFromHex(value); + if(frameSkip < 0 || frameSkip > 9) + frameSkip = 2; + } else if(!strcmp(key, "gbFrameSkip")) { + gbFrameSkip = sdlFromHex(value); + if(gbFrameSkip < 0 || gbFrameSkip > 9) + gbFrameSkip = 0; + } else if(!strcmp(key, "video")) { + sizeOption = sdlFromHex(value); + if(sizeOption < 0 || sizeOption > 3) + sizeOption = 1; + } else if(!strcmp(key, "fullScreen")) { + fullscreen = sdlFromHex(value) ? 1 : 0; + } else if(!strcmp(key, "useBios")) { + useBios = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "skipBios")) { + skipBios = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "biosFile")) { + strcpy(biosFileName, value); + } else if(!strcmp(key, "filter")) { + filter = sdlFromHex(value); + if(filter < 0 || filter > 13) + filter = 0; + } else if(!strcmp(key, "disableStatus")) { + disableStatusMessages = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "borderOn")) { + gbBorderOn = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "borderAutomatic")) { + gbBorderAutomatic = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "emulatorType")) { + gbEmulatorType = sdlFromHex(value); + if(gbEmulatorType < 0 || gbEmulatorType > 5) + gbEmulatorType = 1; + } else if(!strcmp(key, "colorOption")) { + gbColorOption = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "captureDir")) { + sdlCheckDirectory(value); + strcpy(captureDir, value); + } else if(!strcmp(key, "saveDir")) { + sdlCheckDirectory(value); + strcpy(saveDir, value); + } else if(!strcmp(key, "batteryDir")) { + sdlCheckDirectory(value); + strcpy(batteryDir, value); + } else if(!strcmp(key, "captureFormat")) { + captureFormat = sdlFromHex(value); + } else if(!strcmp(key, "soundQuality")) { + soundQuality = sdlFromHex(value); + switch(soundQuality) { + case 1: + case 2: + case 4: + break; + default: + fprintf(stderr, "Unknown sound quality %d. Defaulting to 22Khz\n", + soundQuality); + soundQuality = 2; + break; + } + } else if(!strcmp(key, "soundOff")) { + soundOffFlag = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "soundEnable")) { + int res = sdlFromHex(value) & 0x30f; + soundEnable(res); + soundDisable(~res); + } else if(!strcmp(key, "soundEcho")) { + soundEcho = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "soundLowPass")) { + soundLowPass = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "soundReverse")) { + soundReverse = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "soundVolume")) { + soundVolume = sdlFromHex(value); + if(soundVolume < 0 || soundVolume > 3) + soundVolume = 0; + } else if(!strcmp(key, "removeIntros")) { + removeIntros = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "saveType")) { + cpuSaveType = sdlFromHex(value); + if(cpuSaveType < 0 || cpuSaveType > 5) + cpuSaveType = 0; + } else if(!strcmp(key, "flashSize")) { + sdlFlashSize = sdlFromHex(value); + if(sdlFlashSize != 0 && sdlFlashSize != 1) + sdlFlashSize = 0; + } else if(!strcmp(key, "ifbType")) { + ifbType = sdlFromHex(value); + if(ifbType < 0 || ifbType > 2) + ifbType = 0; + } else if(!strcmp(key, "showSpeed")) { + showSpeed = sdlFromHex(value); + if(showSpeed < 0 || showSpeed > 2) + showSpeed = 1; + } else if(!strcmp(key, "showSpeedTransparent")) { + showSpeedTransparent = sdlFromHex(value); + } else if(!strcmp(key, "autoFrameSkip")) { + autoFrameSkip = sdlFromHex(value); + } else if(!strcmp(key, "throttle")) { + throttle = sdlFromHex(value); + if(throttle != 0 && (throttle < 5 || throttle > 1000)) + throttle = 0; + } else if(!strcmp(key, "disableMMX")) { +#ifdef MMX + cpu_mmx = sdlFromHex(value) ? false : true; +#endif + } else if(!strcmp(key, "pauseWhenInactive")) { + pauseWhenInactive = sdlFromHex(value) ? true : false; + } else if(!strcmp(key, "agbPrint")) { + sdlAgbPrint = sdlFromHex(value); + } else if(!strcmp(key, "rtcEnabled")) { + sdlRtcEnable = sdlFromHex(value); + } else if(!strcmp(key, "rewindTimer")) { + rewindTimer = sdlFromHex(value); + if(rewindTimer < 0 || rewindTimer > 600) + rewindTimer = 0; + rewindTimer *= 6; // convert value to 10 frames multiple + } else if(!strcmp(key, "enhancedDetection")) { + cpuEnhancedDetection = sdlFromHex(value) ? true : false; + } else { + fprintf(stderr, "Unknown configuration key %s\n", key); + } + } +} + +void sdlReadPreferences() +{ + FILE *f = sdlFindFile("VisualBoyAdvance.cfg"); + + if(f == NULL) { + fprintf(stderr, "Configuration file NOT FOUND (using defaults)\n"); + return; + } else + fprintf(stderr, "Reading configuration file.\n"); + + sdlReadPreferences(f); + + fclose(f); +} + +static void sdlApplyPerImagePreferences() +{ + FILE *f = sdlFindFile("vba-over.ini"); + if(!f) { + fprintf(stderr, "vba-over.ini NOT FOUND (using emulator settings)\n"); + return; + } else + fprintf(stderr, "Reading vba-over.ini\n"); + + char buffer[7]; + buffer[0] = '['; + buffer[1] = rom[0xac]; + buffer[2] = rom[0xad]; + buffer[3] = rom[0xae]; + buffer[4] = rom[0xaf]; + buffer[5] = ']'; + buffer[6] = 0; + + char readBuffer[2048]; + + bool found = false; + + while(1) { + char *s = fgets(readBuffer, 2048, f); + + if(s == NULL) + break; + + char *p = strchr(s, ';'); + + if(p) + *p = 0; + + char *token = strtok(s, " \t\n\r="); + + if(!token) + continue; + if(strlen(token) == 0) + continue; + + if(!strcmp(token, buffer)) { + found = true; + break; + } + } + + if(found) { + while(1) { + char *s = fgets(readBuffer, 2048, f); + + if(s == NULL) + break; + + char *p = strchr(s, ';'); + if(p) + *p = 0; + + char *token = strtok(s, " \t\n\r="); + if(!token) + continue; + if(strlen(token) == 0) + continue; + + if(token[0] == '[') // starting another image settings + break; + char *value = strtok(NULL, "\t\n\r="); + if(value == NULL) + continue; + + if(!strcmp(token, "rtcEnabled")) + rtcEnable(atoi(value) == 0 ? false : true); + else if(!strcmp(token, "flashSize")) { + int size = atoi(value); + if(size == 0x10000 || size == 0x20000) + flashSetSize(size); + } else if(!strcmp(token, "saveType")) { + int save = atoi(value); + if(save >= 0 && save <= 5) + cpuSaveType = save; + } + } + } + fclose(f); +} + +static int sdlCalculateShift(u32 mask) +{ + int m = 0; + + while(mask) { + m++; + mask >>= 1; + } + + return m-5; +} + +static int sdlCalculateMaskWidth(u32 mask) +{ + int m = 0; + int mask2 = mask; + + while(mask2) { + m++; + mask2 >>= 1; + } + + int m2 = 0; + mask2 = mask; + while(!(mask2 & 1)) { + m2++; + mask2 >>= 1; + } + + return m - m2; +} + +void sdlWriteState(int num) +{ + char stateName[2048]; + + if(saveDir[0]) + sprintf(stateName, "%s/%s%d.sgm", saveDir, sdlGetFilename(filename), + num+1); + else + sprintf(stateName,"%s%d.sgm", filename, num+1); + if(emulator.emuWriteState) + emulator.emuWriteState(stateName); + sprintf(stateName, "Wrote state %d", num+1); + systemScreenMessage(stateName); +} + +void sdlReadState(int num) +{ + char stateName[2048]; + + if(saveDir[0]) + sprintf(stateName, "%s/%s%d.sgm", saveDir, sdlGetFilename(filename), + num+1); + else + sprintf(stateName,"%s%d.sgm", filename, num+1); + + if(emulator.emuReadState) + emulator.emuReadState(stateName); + + sprintf(stateName, "Loaded state %d", num+1); + systemScreenMessage(stateName); +} + +void sdlWriteBattery() +{ + char buffer[1048]; + + if(batteryDir[0]) + sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); + else + sprintf(buffer, "%s.sav", filename); + + emulator.emuWriteBattery(buffer); + + systemScreenMessage("Wrote battery"); +} + +void sdlReadBattery() +{ + char buffer[1048]; + + if(batteryDir[0]) + sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); + else + sprintf(buffer, "%s.sav", filename); + + bool res = false; + + res = emulator.emuReadBattery(buffer); + + if(res) + systemScreenMessage("Loaded battery"); +} + +#define MOD_KEYS (KMOD_CTRL|KMOD_SHIFT|KMOD_ALT|KMOD_META) +#define MOD_NOCTRL (KMOD_SHIFT|KMOD_ALT|KMOD_META) +#define MOD_NOALT (KMOD_CTRL|KMOD_SHIFT|KMOD_META) +#define MOD_NOSHIFT (KMOD_CTRL|KMOD_ALT|KMOD_META) + +void sdlUpdateKey(int key, bool down) +{ + int i; + for(int j = 0; j < 4; j++) { + for(i = 0 ; i < 12; i++) { + if((joypad[j][i] & 0xf000) == 0) { + if(key == joypad[j][i]) + sdlButtons[j][i] = down; + } + } + } + for(i = 0 ; i < 4; i++) { + if((motion[i] & 0xf000) == 0) { + if(key == motion[i]) + sdlMotionButtons[i] = down; + } + } +} + +void sdlUpdateJoyButton(int which, + int button, + bool pressed) +{ + int i; + for(int j = 0; j < 4; j++) { + for(i = 0; i < 12; i++) { + int dev = (joypad[j][i] >> 12); + int b = joypad[j][i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (b >= 128) && (b == (button+128))) { + sdlButtons[j][i] = pressed; + } + } + } + } + for(i = 0; i < 4; i++) { + int dev = (motion[i] >> 12); + int b = motion[i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (b >= 128) && (b == (button+128))) { + sdlMotionButtons[i] = pressed; + } + } + } +} + +void sdlUpdateJoyHat(int which, + int hat, + int value) +{ + int i; + for(int j = 0; j < 4; j++) { + for(i = 0; i < 12; i++) { + int dev = (joypad[j][i] >> 12); + int a = joypad[j][i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (a>=32) && (a < 48) && (((a&15)>>2) == hat)) { + int dir = a & 3; + int v = 0; + switch(dir) { + case 0: + v = value & SDL_HAT_UP; + break; + case 1: + v = value & SDL_HAT_DOWN; + break; + case 2: + v = value & SDL_HAT_RIGHT; + break; + case 3: + v = value & SDL_HAT_LEFT; + break; + } + sdlButtons[j][i] = (v ? true : false); + } + } + } + } + for(i = 0; i < 4; i++) { + int dev = (motion[i] >> 12); + int a = motion[i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (a>=32) && (a < 48) && (((a&15)>>2) == hat)) { + int dir = a & 3; + int v = 0; + switch(dir) { + case 0: + v = value & SDL_HAT_UP; + break; + case 1: + v = value & SDL_HAT_DOWN; + break; + case 2: + v = value & SDL_HAT_RIGHT; + break; + case 3: + v = value & SDL_HAT_LEFT; + break; + } + sdlMotionButtons[i] = (v ? true : false); + } + } + } +} + +void sdlUpdateJoyAxis(int which, + int axis, + int value) +{ + int i; + for(int j = 0; j < 4; j++) { + for(i = 0; i < 12; i++) { + int dev = (joypad[j][i] >> 12); + int a = joypad[j][i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (a < 32) && ((a>>1) == axis)) { + sdlButtons[j][i] = (a & 1) ? (value > 16384) : (value < -16384); + } + } + } + } + for(i = 0; i < 4; i++) { + int dev = (motion[i] >> 12); + int a = motion[i] & 0xfff; + if(dev) { + dev--; + + if((dev == which) && (a < 32) && ((a>>1) == axis)) { + sdlMotionButtons[i] = (a & 1) ? (value > 16384) : (value < -16384); + } + } + } +} + +bool sdlCheckJoyKey(int key) +{ + int dev = (key >> 12) - 1; + int what = key & 0xfff; + + if(what >= 128) { + // joystick button + int button = what - 128; + + if(button >= SDL_JoystickNumButtons(sdlDevices[dev])) + return false; + } else if (what < 0x20) { + // joystick axis + what >>= 1; + if(what >= SDL_JoystickNumAxes(sdlDevices[dev])) + return false; + } else if (what < 0x30) { + // joystick hat + what = (what & 15); + what >>= 2; + if(what >= SDL_JoystickNumHats(sdlDevices[dev])) + return false; + } + + // no problem found + return true; +} + +void sdlCheckKeys() +{ + sdlNumDevices = SDL_NumJoysticks(); + + if(sdlNumDevices) + sdlDevices = (SDL_Joystick **)calloc(1,sdlNumDevices * + sizeof(SDL_Joystick **)); + int i; + + bool usesJoy = false; + + for(int j = 0; j < 4; j++) { + for(i = 0; i < 12; i++) { + int dev = joypad[j][i] >> 12; + if(dev) { + dev--; + bool ok = false; + + if(sdlDevices) { + if(dev < sdlNumDevices) { + if(sdlDevices[dev] == NULL) { + sdlDevices[dev] = SDL_JoystickOpen(dev); + } + + ok = sdlCheckJoyKey(joypad[j][i]); + } else + ok = false; + } + + if(!ok) + joypad[j][i] = defaultJoypad[i]; + else + usesJoy = true; + } + } + } + + for(i = 0; i < 4; i++) { + int dev = motion[i] >> 12; + if(dev) { + dev--; + bool ok = false; + + if(sdlDevices) { + if(dev < sdlNumDevices) { + if(sdlDevices[dev] == NULL) { + sdlDevices[dev] = SDL_JoystickOpen(dev); + } + + ok = sdlCheckJoyKey(motion[i]); + } else + ok = false; + } + + if(!ok) + motion[i] = defaultMotion[i]; + else + usesJoy = true; + } + } + + if(usesJoy) + SDL_JoystickEventState(SDL_ENABLE); +} + +void sdlPollEvents() +{ + SDL_Event event; + while(SDL_PollEvent(&event)) { + switch(event.type) { + case SDL_QUIT: + emulating = 0; + break; + case SDL_ACTIVEEVENT: + if(pauseWhenInactive && (event.active.state & SDL_APPINPUTFOCUS)) { + active = event.active.gain; + if(active) { + if(!paused) { + if(emulating) + soundResume(); + } + } else { + wasPaused = true; + if(pauseWhenInactive) { + if(emulating) + soundPause(); + } + + memset(delta,255,sizeof(delta)); + } + } + break; + case SDL_MOUSEMOTION: + case SDL_MOUSEBUTTONUP: + case SDL_MOUSEBUTTONDOWN: + if(fullscreen) { + SDL_ShowCursor(SDL_ENABLE); + mouseCounter = 120; + } + break; + case SDL_JOYHATMOTION: + sdlUpdateJoyHat(event.jhat.which, + event.jhat.hat, + event.jhat.value); + break; + case SDL_JOYBUTTONDOWN: + case SDL_JOYBUTTONUP: + sdlUpdateJoyButton(event.jbutton.which, + event.jbutton.button, + event.jbutton.state == SDL_PRESSED); + break; + case SDL_JOYAXISMOTION: + sdlUpdateJoyAxis(event.jaxis.which, + event.jaxis.axis, + event.jaxis.value); + break; + case SDL_KEYDOWN: + sdlUpdateKey(event.key.keysym.sym, true); + break; + case SDL_KEYUP: + switch(event.key.keysym.sym) { + case SDLK_r: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + if(emulating) { + emulator.emuReset(); + + systemScreenMessage("Reset"); + } + } + break; + case SDLK_b: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + if(emulating && emulator.emuReadMemState && rewindMemory + && rewindCount) { + rewindPos = --rewindPos & 7; + emulator.emuReadMemState(&rewindMemory[REWIND_SIZE*rewindPos], + REWIND_SIZE); + rewindCount--; + rewindCounter = 0; + systemScreenMessage("Rewind"); + } + } + break; + case SDLK_p: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + paused = !paused; + SDL_PauseAudio(paused); + if(paused) + wasPaused = true; + } + break; + case SDLK_ESCAPE: + emulating = 0; + break; + case SDLK_f: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + int flags = 0; + fullscreen = !fullscreen; + if(fullscreen) + flags |= SDL_FULLSCREEN; + SDL_SetVideoMode(destWidth, destHeight, systemColorDepth, flags); + // if(SDL_WM_ToggleFullScreen(surface)) + // fullscreen = !fullscreen; + } + break; + case SDLK_F11: + if(dbgMain != debuggerMain) { + if(armState) { + armNextPC -= 4; + reg[15].I -= 4; + } else { + armNextPC -= 2; + reg[15].I -= 2; + } + } + debugger = true; + break; + case SDLK_F1: + case SDLK_F2: + case SDLK_F3: + case SDLK_F4: + case SDLK_F5: + case SDLK_F6: + case SDLK_F7: + case SDLK_F8: + case SDLK_F9: + case SDLK_F10: + if(!(event.key.keysym.mod & MOD_NOSHIFT) && + (event.key.keysym.mod & KMOD_SHIFT)) { + sdlWriteState(event.key.keysym.sym-SDLK_F1); + } else if(!(event.key.keysym.mod & MOD_KEYS)) { + sdlReadState(event.key.keysym.sym-SDLK_F1); + } + break; + case SDLK_1: + case SDLK_2: + case SDLK_3: + case SDLK_4: + if(!(event.key.keysym.mod & MOD_NOALT) && + (event.key.keysym.mod & KMOD_ALT)) { + char *disableMessages[4] = + { "autofire A disabled", + "autofire B disabled", + "autofire R disabled", + "autofire L disabled"}; + char *enableMessages[4] = + { "autofire A", + "autofire B", + "autofire R", + "autofire L"}; + int mask = 1 << (event.key.keysym.sym - SDLK_1); + if(event.key.keysym.sym > SDLK_2) + mask <<= 6; + if(autoFire & mask) { + autoFire &= ~mask; + systemScreenMessage(disableMessages[event.key.keysym.sym - SDLK_1]); + } else { + autoFire |= mask; + systemScreenMessage(enableMessages[event.key.keysym.sym - SDLK_1]); + } + } if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + int mask = 0x0100 << (event.key.keysym.sym - SDLK_1); + layerSettings ^= mask; + layerEnable = DISPCNT & layerSettings; + CPUUpdateRenderBuffers(false); + } + break; + case SDLK_5: + case SDLK_6: + case SDLK_7: + case SDLK_8: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + int mask = 0x0100 << (event.key.keysym.sym - SDLK_1); + layerSettings ^= mask; + layerEnable = DISPCNT & layerSettings; + } + break; + case SDLK_n: + if(!(event.key.keysym.mod & MOD_NOCTRL) && + (event.key.keysym.mod & KMOD_CTRL)) { + if(paused) + paused = false; + pauseNextFrame = true; + } + break; + default: + break; + } + sdlUpdateKey(event.key.keysym.sym, false); + break; + } + } +} + +void usage(char *cmd) +{ + printf("%s [option ...] file\n", cmd); + printf("\ +\n\ +Options:\n\ + -1, --video-1x 1x\n\ + -2, --video-2x 2x\n\ + -3, --video-3x 3x\n\ + -4, --video-4x 4x\n\ + -F, --fullscreen Full screen\n\ + -G, --gdb=PROTOCOL GNU Remote Stub mode:\n\ + tcp - use TCP at port 55555\n\ + tcp:PORT - use TCP at port PORT\n\ + pipe - use pipe transport\n\ + -N, --no-debug Don't parse debug information\n\ + -S, --flash-size=SIZE Set the Flash size\n\ + --flash-64k 0 - 64K Flash\n\ + --flash-128k 1 - 128K Flash\n\ + -T, --throttle=THROTTLE Set the desired throttle (5...1000)\n\ + -Y, --yuv=TYPE Use YUV overlay for drawing:\n\ + 0 - YV12\n\ + 1 - UYVY\n\ + 2 - YVYU\n\ + 3 - YUY2\n\ + 4 - IYUV\n\ + -b, --bios=BIOS Use given bios file\n\ + -c, --config=FILE Read the given configuration file\n\ + -d, --debug Enter debugger\n\ + -f, --filter=FILTER Select filter:\n\ + --filter-normal 0 - normal mode\n\ + --filter-tv-mode 1 - TV Mode\n\ + --filter-2xsai 2 - 2xSaI\n\ + --filter-super-2xsai 3 - Super 2xSaI\n\ + --filter-super-eagle 4 - Super Eagle\n\ + --filter-pixelate 5 - Pixelate\n\ + --filter-motion-blur 6 - Motion Blur\n\ + --filter-advmame 7 - AdvanceMAME Scale2x\n\ + --filter-simple2x 8 - Simple2x\n\ + --filter-bilinear 9 - Bilinear\n\ + --filter-bilinear+ 10 - Bilinear Plus\n\ + --filter-scanlines 11 - Scanlines\n\ + --filter-hq2x 12 - hq2x\n\ + --filter-lq2x 13 - lq2x\n\ + -h, --help Print this help\n\ + -i, --ips=PATCH Apply given IPS patch\n\ + -P, --profile=[HERTZ] Enable profiling\n\ + -s, --frameskip=FRAMESKIP Set frame skip (0...9)\n\ +"); + printf("\ + -t, --save-type=TYPE Set the available save type\n\ + --save-auto 0 - Automatic (EEPROM, SRAM, FLASH)\n\ + --save-eeprom 1 - EEPROM\n\ + --save-sram 2 - SRAM\n\ + --save-flash 3 - FLASH\n\ + --save-sensor 4 - EEPROM+Sensor\n\ + --save-none 5 - NONE\n\ + -v, --verbose=VERBOSE Set verbose logging (trace.log)\n\ + 1 - SWI\n\ + 2 - Unaligned memory access\n\ + 4 - Illegal memory write\n\ + 8 - Illegal memory read\n\ + 16 - DMA 0\n\ + 32 - DMA 1\n\ + 64 - DMA 2\n\ + 128 - DMA 3\n\ + 256 - Undefined instruction\n\ + 512 - AGBPrint messages\n\ +\n\ +Long options only:\n\ + --agb-print Enable AGBPrint support\n\ + --auto-frameskip Enable auto frameskipping\n\ + --ifb-none No interframe blending\n\ + --ifb-motion-blur Interframe motion blur\n\ + --ifb-smart Smart interframe blending\n\ + --no-agb-print Disable AGBPrint support\n\ + --no-auto-frameskip Disable auto frameskipping\n\ + --no-ips Do not apply IPS patch\n\ + --no-mmx Disable MMX support\n\ + --no-pause-when-inactive Don't pause when inactive\n\ + --no-rtc Disable RTC support\n\ + --no-show-speed Don't show emulation speed\n\ + --no-throttle Disable thrrotle\n\ + --pause-when-inactive Pause when inactive\n\ + --rtc Enable RTC support\n\ + --show-speed-normal Show emulation speed\n\ + --show-speed-detailed Show detailed speed data\n\ +"); + printf("\ + -r, --recordmovie=filename Start recording input movie\n\ + -p, --playmovie=filename Play input movie non-read-only\n\ + -w, --watchmovie=filename Play input movie in read-only mode\n\ +"); +} + +int main(int argc, char **argv) +{ + fprintf(stderr, "VisualBoyAdvance version %s [SDL]\n", VERSION); + + arg0 = argv[0]; + + captureDir[0] = 0; + saveDir[0] = 0; + batteryDir[0] = 0; + ipsname[0] = 0; + + int op = -1; + + frameSkip = 2; + gbBorderOn = 0; + + parseDebug = true; + + sdlReadPreferences(); + + sdlPrintUsage = 0; + + while((op = getopt_long(argc, + argv, + "FNT:Y:G:D:b:c:df:hi:p::s:t:v:1234", + sdlOptions, + NULL)) != -1) { + switch(op) { + case 0: + // long option already processed by getopt_long + break; + case 'b': + useBios = true; + if(optarg == NULL) { + fprintf(stderr, "Missing BIOS file name\n"); + exit(-1); + } + strcpy(biosFileName, optarg); + break; + case 'c': + { + if(optarg == NULL) { + fprintf(stderr, "Missing config file name\n"); + exit(-1); + } + FILE *f = fopen(optarg, "r"); + if(f == NULL) { + fprintf(stderr, "File not found %s\n", optarg); + exit(-1); + } + sdlReadPreferences(f); + fclose(f); + } + break; + case 'd': + debugger = true; + break; + case 'h': + sdlPrintUsage = 1; + break; + case 'i': + if(optarg == NULL) { + fprintf(stderr, "Missing IPS name\n"); + exit(-1); + strcpy(ipsname, optarg); + } + break; + case 'Y': + yuv = true; + if(optarg) { + yuvType = atoi(optarg); + switch(yuvType) { + case 0: + yuvType = SDL_YV12_OVERLAY; + break; + case 1: + yuvType = SDL_UYVY_OVERLAY; + break; + case 2: + yuvType = SDL_YVYU_OVERLAY; + break; + case 3: + yuvType = SDL_YUY2_OVERLAY; + break; + case 4: + yuvType = SDL_IYUV_OVERLAY; + break; + default: + yuvType = SDL_YV12_OVERLAY; + } + } else + yuvType = SDL_YV12_OVERLAY; + break; + case 'G': + dbgMain = remoteStubMain; + dbgSignal = remoteStubSignal; + dbgOutput = remoteOutput; + debugger = true; + debuggerStub = true; + if(optarg) { + char *s = optarg; + if(strncmp(s,"tcp:", 4) == 0) { + s+=4; + int port = atoi(s); + remoteSetProtocol(0); + remoteSetPort(port); + } else if(strcmp(s,"tcp") == 0) { + remoteSetProtocol(0); + } else if(strcmp(s, "pipe") == 0) { + remoteSetProtocol(1); + } else { + fprintf(stderr, "Unknown protocol %s\n", s); + exit(-1); + } + } else { + remoteSetProtocol(0); + } + break; + case 'N': + parseDebug = false; + break; + case 'D': + if(optarg) { + systemDebug = atoi(optarg); + } else { + systemDebug = 1; + } + break; + case 'F': + fullscreen = 1; + mouseCounter = 120; + break; + case 'f': + if(optarg) { + filter = atoi(optarg); + } else { + filter = 0; + } + break; + + case 'r': + if(optarg == NULL) { + fprintf(stderr, "ERROR: --recordMovie ('r') needs movie filename as option\n"); + exit(-1); + } + strcpy(movieFileName, optarg); + useMovie = 1; + break; + case 'p': // play without read-only (editable) + if(optarg == NULL) { + fprintf(stderr, "ERROR: --playMovie ('p') needs movie filename as option\n"); + exit(-1); + } + strcpy(movieFileName, optarg); + useMovie = 2; + break; + case 'w': // play with read-only + if(optarg == NULL) { + fprintf(stderr, "ERROR: --watchMovie ('w') needs movie filename as option\n"); + exit(-1); + } + strcpy(movieFileName, optarg); + useMovie = 3; + break; + + case 'P': +#ifdef PROFILING + if(optarg) { + cpuEnableProfiling(atoi(optarg)); + } else + cpuEnableProfiling(100); +#endif + break; + case 'S': + sdlFlashSize = atoi(optarg); + if(sdlFlashSize < 0 || sdlFlashSize > 1) + sdlFlashSize = 0; + break; + case 's': + if(optarg) { + int a = atoi(optarg); + if(a >= 0 && a <= 9) { + gbFrameSkip = a; + frameSkip = a; + } + } else { + frameSkip = 2; + gbFrameSkip = 0; + } + break; + case 't': + if(optarg) { + int a = atoi(optarg); + if(a < 0 || a > 5) + a = 0; + cpuSaveType = a; + } + break; + case 'T': + if(optarg) { + int t = atoi(optarg); + if(t < 5 || t > 1000) + t = 0; + throttle = t; + } + break; + case 'v': + if(optarg) { + systemVerbose = atoi(optarg); + } else + systemVerbose = 0; + break; + case '1': + sizeOption = 0; + break; + case '2': + sizeOption = 1; + break; + case '3': + sizeOption = 2; + break; + case '4': + sizeOption = 3; + break; + case '?': + sdlPrintUsage = 1; + break; + } + } + + if(sdlPrintUsage) { + usage(argv[0]); + exit(-1); + } + +#ifdef MMX + if(disableMMX) + cpu_mmx = 0; +#endif + + if(rewindTimer) + rewindMemory = (char *)malloc(8*REWIND_SIZE); + + if(sdlFlashSize == 0) + flashSetSize(0x10000); + else + flashSetSize(0x20000); + + rtcEnable(sdlRtcEnable ? true : false); + agbPrintEnable(sdlAgbPrint ? true : false); + + if(!debuggerStub) { + if(optind >= argc) { + systemMessage(0,"Missing image name"); + usage(argv[0]); + exit(-1); + } + } + + if(filter) { + sizeOption = 1; + } + + for(int i = 0; i < 24;) { + systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + systemGbPalette[i++] = (0x15) | (0x15 << 5) | (0x15 << 10); + systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + systemGbPalette[i++] = 0; + } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + if(optind < argc) { + char *szFile = argv[optind]; + + utilGetBaseName(szFile, filename); + char *p = strrchr(filename, '.'); + + if(p) + *p = 0; + + if(ipsname[0] == 0) + sprintf(ipsname, "%s.ips", filename); + + bool failed = false; + + IMAGE_TYPE type = utilFindType(szFile); + + if(type == IMAGE_UNKNOWN) { + systemMessage(0, "Unknown file type %s", szFile); + exit(-1); + } + cartridgeType = (int)type; + + if(type == IMAGE_GB) { + failed = !gbLoadRom(szFile); + if(!failed) { + cartridgeType = 1; + emulator = GBSystem; + if(sdlAutoIPS) { + int size = gbRomSize; + utilApplyIPS(ipsname, &gbRom, &size); + if(size != gbRomSize) { + extern bool gbUpdateSizes(); + gbUpdateSizes(); + gbReset(); + } + } + } + } else if(type == IMAGE_GBA) { + int size = CPULoadRom(szFile); + failed = (size == 0); + if(!failed) { + // if(cpuEnhancedDetection && cpuSaveType == 0) { + // utilGBAFindSave(rom, size); + // } + + sdlApplyPerImagePreferences(); + + cartridgeType = 0; + emulator = GBASystem; + + /* disabled due to problems + if(removeIntros && rom != NULL) { + WRITE32LE(&rom[0], 0xea00002e); + } + */ + + CPUInit(biosFileName, useBios); + CPUReset(); + if(sdlAutoIPS) { + int size = 0x2000000; + utilApplyIPS(ipsname, &rom, &size); + if(size != 0x2000000) { + CPUReset(); + } + } + } + } + + if(failed) { + systemMessage(0, "Failed to load file %s", szFile); + exit(-1); + } + } else { + cartridgeType = 0; + strcpy(filename, "gnu_stub"); + rom = (u8 *)malloc(0x2000000); + workRAM = (u8 *)calloc(1, 0x40000); + bios = (u8 *)calloc(1,0x4000); + internalRAM = (u8 *)calloc(1,0x8000); + paletteRAM = (u8 *)calloc(1,0x400); + vram = (u8 *)calloc(1, 0x20000); + oam = (u8 *)calloc(1, 0x400); + pix = (u8 *)calloc(1, 4 * 240 * 160); + ioMem = (u8 *)calloc(1, 0x400); + + emulator = GBASystem; + + CPUInit(biosFileName, useBios); + CPUReset(); + } + + sdlReadBattery(); + + if(debuggerStub) + remoteInit(); + + int flags = SDL_INIT_VIDEO|SDL_INIT_AUDIO| + SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE; + + if(soundOffFlag) + flags ^= SDL_INIT_AUDIO; + + if(SDL_Init(flags)) { + systemMessage(0, "Failed to init SDL: %s", SDL_GetError()); + exit(-1); + } + + if(SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { + systemMessage(0, "Failed to init joystick support: %s", SDL_GetError()); + } + + sdlCheckKeys(); + + if(cartridgeType == 0) { + srcWidth = 240; + srcHeight = 160; + systemFrameSkip = frameSkip; + } else if (cartridgeType == 1) { + if(gbBorderOn) { + srcWidth = 256; + srcHeight = 224; + gbBorderLineSkip = 256; + gbBorderColumnSkip = 48; + gbBorderRowSkip = 40; + } else { + srcWidth = 160; + srcHeight = 144; + gbBorderLineSkip = 160; + gbBorderColumnSkip = 0; + gbBorderRowSkip = 0; + } + systemFrameSkip = gbFrameSkip; + } else { + srcWidth = 320; + srcHeight = 240; + } + + destWidth = (sizeOption+1)*srcWidth; + destHeight = (sizeOption+1)*srcHeight; + + surface = SDL_SetVideoMode(destWidth, destHeight, 16, + SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF| + (fullscreen ? SDL_FULLSCREEN : 0)); + + if(surface == NULL) { + systemMessage(0, "Failed to set video mode"); + SDL_Quit(); + exit(-1); + } + + systemRedShift = sdlCalculateShift(surface->format->Rmask); + systemGreenShift = sdlCalculateShift(surface->format->Gmask); + systemBlueShift = sdlCalculateShift(surface->format->Bmask); + + systemColorDepth = surface->format->BitsPerPixel; + if(systemColorDepth == 15) + systemColorDepth = 16; + + if(yuv) { + Init_Overlay(surface, yuvType); + systemColorDepth = 32; + systemRedShift = 3; + systemGreenShift = 11; + systemBlueShift = 19; + } + + if(systemColorDepth != 16 && systemColorDepth != 24 && + systemColorDepth != 32) { + fprintf(stderr,"Unsupported color depth '%d'.\nOnly 16, 24 and 32 bit color depths are supported\n", systemColorDepth); + exit(-1); + } + +#ifndef C_CORE + sdlMakeStretcher(srcWidth); +#else + switch(systemColorDepth) { + case 16: + sdlStretcher = sdlStretcher16[sizeOption]; + break; + case 24: + sdlStretcher = sdlStretcher24[sizeOption]; + break; + case 32: + sdlStretcher = sdlStretcher32[sizeOption]; + break; + default: + fprintf(stderr, "Unsupported resolution: %d\n", systemColorDepth); + exit(-1); + } +#endif + + fprintf(stderr,"Color depth: %d\n", systemColorDepth); + + if(systemColorDepth == 16) { + if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) { + Init_2xSaI(565); + RGB_LOW_BITS_MASK = 0x821; + } else { + Init_2xSaI(555); + RGB_LOW_BITS_MASK = 0x421; + } + if(cartridgeType == 2) { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = (((i >> 1) & 0x1f) << systemBlueShift) | + (((i & 0x7c0) >> 6) << systemGreenShift) | + (((i & 0xf800) >> 11) << systemRedShift); + } + } else { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + srcPitch = srcWidth * 2+4; + } else { + if(systemColorDepth != 32) + filterFunction = NULL; + RGB_LOW_BITS_MASK = 0x010101; + if(systemColorDepth == 32) { + Init_2xSaI(32); + } + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + if(systemColorDepth == 32) + srcPitch = srcWidth*4 + 4; + else + srcPitch = srcWidth*3; + } + + if(systemColorDepth != 32) { + switch(filter) { + case 0: + filterFunction = NULL; + break; + case 1: + filterFunction = ScanlinesTV; + break; + case 2: + filterFunction = _2xSaI; + break; + case 3: + filterFunction = Super2xSaI; + break; + case 4: + filterFunction = SuperEagle; + break; + case 5: + filterFunction = Pixelate; + break; + case 6: + filterFunction = MotionBlur; + break; + case 7: + filterFunction = AdMame2x; + break; + case 8: + filterFunction = Simple2x; + break; + case 9: + filterFunction = Bilinear; + break; + case 10: + filterFunction = BilinearPlus; + break; + case 11: + filterFunction = Scanlines; + break; + case 12: + filterFunction = hq2x; + break; + case 13: + filterFunction = lq2x; + break; + default: + filterFunction = NULL; + break; + } + } else { + switch(filter) { + case 0: + filterFunction = NULL; + break; + case 1: + filterFunction = ScanlinesTV32; + break; + case 2: + filterFunction = _2xSaI32; + break; + case 3: + filterFunction = Super2xSaI32; + break; + case 4: + filterFunction = SuperEagle32; + break; + case 5: + filterFunction = Pixelate32; + break; + case 6: + filterFunction = MotionBlur32; + break; + case 7: + filterFunction = AdMame2x32; + break; + case 8: + filterFunction = Simple2x32; + break; + case 9: + filterFunction = Bilinear32; + break; + case 10: + filterFunction = BilinearPlus32; + break; + case 11: + filterFunction = Scanlines32; + break; + case 12: + filterFunction = hq2x32; + break; + case 13: + filterFunction = lq2x32; + break; + default: + filterFunction = NULL; + break; + } + } + + if(systemColorDepth == 16) { + switch(ifbType) { + case 0: + default: + ifbFunction = NULL; + break; + case 1: + ifbFunction = MotionBlurIB; + break; + case 2: + ifbFunction = SmartIB; + break; + } + } else if(systemColorDepth == 32) { + switch(ifbType) { + case 0: + default: + ifbFunction = NULL; + break; + case 1: + ifbFunction = MotionBlurIB32; + break; + case 2: + ifbFunction = SmartIB32; + break; + } + } else + ifbFunction = NULL; + + if(delta == NULL) { + delta = (u8*)malloc(322*242*4); + memset(delta, 255, 322*242*4); + } + + emulating = 1; + renderedFrames = 0; + + if(!soundOffFlag) + soundInit(); + + autoFrameSkipLastTime = throttleLastTime = systemGetClock(); + + switch(useMovie) + { + case 1: // --recordMovie + VBAMovieCreate(movieFileName, + /*authorInfo*/"", + /*startFlags*/0, + /*controllerFlags*/MOVIE_CONTROLLER(0), + /*typeFlags*/(cartridgeType==IMAGE_GBA)?(MOVIE_TYPE_GBA):(GBC_CAPABLE?MOVIE_TYPE_GBC:MOVIE_TYPE_SGB)); + break; + case 2: // --playMovie + VBAMovieOpen(movieFileName, false); + break; + case 3: // --watchMovie + VBAMovieOpen(movieFileName, true); + break; + default: + break; + } + + SDL_WM_SetCaption("VisualBoyAdvance", NULL); + + while(emulating) { + if(!paused && active) { + if(debugger && emulator.emuHasDebugger) + dbgMain(); + else { + emulator.emuMain(emulator.emuCount); + if(rewindSaveNeeded && rewindMemory && emulator.emuWriteMemState) { + rewindCount++; + if(rewindCount > 8) + rewindCount = 8; + if(emulator.emuWriteMemState && + emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], + REWIND_SIZE)) { + rewindPos = ++rewindPos & 7; + if(rewindCount == 8) + rewindTopPos = ++rewindTopPos & 7; + } + } + + rewindSaveNeeded = false; + } + } else { + SDL_Delay(500); + } + sdlPollEvents(); + if(mouseCounter) { + mouseCounter--; + if(mouseCounter == 0) + SDL_ShowCursor(SDL_DISABLE); + } + } + + emulating = 0; + fprintf(stderr,"Shutting down\n"); + remoteCleanUp(); + soundShutdown(); + + if(gbRom != NULL || rom != NULL) { + sdlWriteBattery(); + emulator.emuCleanUp(); + } + + if(delta) { + free(delta); + delta = NULL; + } + + SDL_Quit(); + return 0; +} + +void systemMessage(int num, const char *msg, ...) +{ + char buffer[2048]; + va_list valist; + + va_start(valist, msg); + vsprintf(buffer, msg, valist); + + fprintf(stderr, "%s\n", buffer); + va_end(valist); +} + +void systemDrawScreen() +{ + renderedFrames++; + + if(yuv) { + Draw_Overlay(surface, sizeOption+1); + return; + } + + SDL_LockSurface(surface); + + for(int slot = 0 ; slot < 8 ; slot++) + { + if(screenMessage[slot]) { + if(cartridgeType == 1 && gbBorderOn) { + gbSgbRenderBorder(); + } + if(((systemGetClock() - screenMessageTime[slot]) < screenMessageDuration[slot]) && + !disableStatusMessages) { + drawText(pix, srcPitch, 10, srcHeight - 20*(slot+1), + screenMessageBuffer[slot]); + } else { + screenMessage[slot] = false; + } + } + } + + if(ifbFunction) { + if(systemColorDepth == 16) + ifbFunction(pix+destWidth+4, destWidth+4, srcWidth, srcHeight); + else + ifbFunction(pix+destWidth*2+4, destWidth*2+4, srcWidth, srcHeight); + } + + if(filterFunction) { + if(systemColorDepth == 16) + filterFunction(pix+destWidth+4,destWidth+4, delta, + (u8*)surface->pixels,surface->pitch, + srcWidth, + srcHeight); + else + filterFunction(pix+destWidth*2+4, + destWidth*2+4, + delta, + (u8*)surface->pixels, + surface->pitch, + srcWidth, + srcHeight); + } else { + int destPitch = surface->pitch; + u8 *src = pix; + u8 *dest = (u8*)surface->pixels; + int i; + u32 *stretcher = (u32 *)sdlStretcher; + if(systemColorDepth == 16) + src += srcPitch; + int option = sizeOption; + if(yuv) + option = 0; + switch(sizeOption) { + case 0: + for(i = 0; i < srcHeight; i++) { + SDL_CALL_STRETCHER; + src += srcPitch; + dest += destPitch; + } + break; + case 1: + for(i = 0; i < srcHeight; i++) { + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + src += srcPitch; + dest += destPitch; + } + break; + case 2: + for(i = 0; i < srcHeight; i++) { + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + src += srcPitch; + dest += destPitch; + } + break; + case 3: + for(i = 0; i < srcHeight; i++) { + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + dest += destPitch; + SDL_CALL_STRETCHER; + src += srcPitch; + dest += destPitch; + } + break; + } + } + + if(showSpeed && fullscreen) { + char buffer[50]; + if(showSpeed == 1) + sprintf(buffer, "%d%%", systemSpeed); + else + sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + showRenderedFrames); + if(showSpeedTransparent) + drawTextTransp((u8*)surface->pixels, + surface->pitch, + 10, + surface->h-20, + buffer); + else + drawText((u8*)surface->pixels, + surface->pitch, + 10, + surface->h-20, + buffer); + } + + SDL_UnlockSurface(surface); + // SDL_UpdateRect(surface, 0, 0, destWidth, destHeight); + SDL_Flip(surface); +} + +bool systemReadJoypads() +{ + return true; +} + +u32 systemReadJoypad(int which, bool sensor) +{ + if(which < 0 || which > 3) + which = sdlDefaultJoypad; + + u32 res = 0; + + if(sdlButtons[which][KEY_BUTTON_A]) + res |= 1; + if(sdlButtons[which][KEY_BUTTON_B]) + res |= 2; + if(sdlButtons[which][KEY_BUTTON_SELECT]) + res |= 4; + if(sdlButtons[which][KEY_BUTTON_START]) + res |= 8; + if(sdlButtons[which][KEY_RIGHT]) + res |= 16; + if(sdlButtons[which][KEY_LEFT]) + res |= 32; + if(sdlButtons[which][KEY_UP]) + res |= 64; + if(sdlButtons[which][KEY_DOWN]) + res |= 128; + if(sdlButtons[which][KEY_BUTTON_R]) + res |= 256; + if(sdlButtons[which][KEY_BUTTON_L]) + res |= 512; +/* + // disallow L+R or U+D of being pressed at the same time + if((res & 48) == 48) + res &= ~16; + if((res & 192) == 192) + res &= ~128; +*/ + if(sdlButtons[which][KEY_BUTTON_SPEED]) + res |= 1024; + if(sdlButtons[which][KEY_BUTTON_CAPTURE]) + res |= 2048; + + if(autoFire) { + res &= (~autoFire); + if(autoFireToggle) + res |= autoFire; + autoFireToggle = !autoFireToggle; + } + + return res; +} + +void systemWriteJoypad(int which, u32 buttons) +{ + if(which < 0 || which > 3) + which = sdlDefaultJoypad; + + sdlButtons[which][KEY_BUTTON_A] = (buttons & 1) != 0; + sdlButtons[which][KEY_BUTTON_B] = (buttons & 2) != 0; + sdlButtons[which][KEY_BUTTON_SELECT] = (buttons & 4) != 0; + sdlButtons[which][KEY_BUTTON_START] = (buttons & 8) != 0; + sdlButtons[which][KEY_RIGHT] = (buttons & 16) != 0; + sdlButtons[which][KEY_LEFT] = (buttons & 32) != 0; + sdlButtons[which][KEY_UP] = (buttons & 64) != 0; + sdlButtons[which][KEY_DOWN] = (buttons & 128) != 0; + sdlButtons[which][KEY_BUTTON_R] = (buttons & 256) != 0; + sdlButtons[which][KEY_BUTTON_L] = (buttons & 512) != 0; +} + +void systemSetTitle(const char *title) +{ + SDL_WM_SetCaption(title, NULL); +} + +void systemShowSpeed(int speed) +{ + systemSpeed = speed; + + showRenderedFrames = renderedFrames; + renderedFrames = 0; + + if(!fullscreen && showSpeed) { + char buffer[80]; + if(showSpeed == 1) + sprintf(buffer, "VisualBoyAdvance-%3d%%", systemSpeed); + else + sprintf(buffer, "VisualBoyAdvance-%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + showRenderedFrames); + + systemSetTitle(buffer); + } +} + +void systemFrame() +{ +} + +void system10Frames(int rate) +{ + u32 time = systemGetClock(); + if(!wasPaused && autoFrameSkip && !throttle) { + u32 diff = time - autoFrameSkipLastTime; + int speed = 100; + + if(diff) + speed = (1000000/rate)/diff; + + if(speed >= 98) { + frameskipadjust++; + + if(frameskipadjust >= 3) { + frameskipadjust=0; + if(systemFrameSkip > 0) + systemFrameSkip--; + } + } else { + if(speed < 80) + frameskipadjust -= (90 - speed)/5; + else if(systemFrameSkip < 9) + frameskipadjust--; + + if(frameskipadjust <= -2) { + frameskipadjust += 2; + if(systemFrameSkip < 9) + systemFrameSkip++; + } + } + } + if(!wasPaused && throttle) { + if(!speedup) { + u32 diff = time - throttleLastTime; + + int target = (1000000/(rate*throttle)); + int d = (target - diff); + + if(d > 0) { + SDL_Delay(d); + } + } + throttleLastTime = systemGetClock(); + } + if(rewindMemory) { + if(++rewindCounter >= rewindTimer) { + rewindSaveNeeded = true; + rewindCounter = 0; + } + } + + if(systemSaveUpdateCounter) { + if(--systemSaveUpdateCounter <= SYSTEM_SAVE_NOT_UPDATED) { + sdlWriteBattery(); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + } + } + + wasPaused = false; + autoFrameSkipLastTime = time; +} + +void systemScreenCapture(int a) +{ + char buffer[2048]; + + if(captureFormat) { + if(captureDir[0]) + sprintf(buffer, "%s/%s%02d.bmp", captureDir, sdlGetFilename(filename), a); + else + sprintf(buffer, "%s%02d.bmp", filename, a); + + emulator.emuWriteBMP(buffer); + } else { + if(captureDir[0]) + sprintf(buffer, "%s/%s%02d.png", captureDir, sdlGetFilename(filename), a); + else + sprintf(buffer, "%s%02d.png", filename, a); + emulator.emuWritePNG(buffer); + } + + systemScreenMessage("Screen capture"); +} + +void soundCallback(void *,u8 *stream,int len) +{ + if(!emulating) + return; + SDL_mutexP(mutex); + // printf("Locked mutex\n"); + if(!speedup && !throttle) { + while(sdlSoundLen < 2048*2) { + if(emulating) + SDL_CondWait(cond, mutex); + else + break; + } + } + if(emulating) { + // printf("Copying data\n"); + memcpy(stream, sdlBuffer, len); + } + sdlSoundLen = 0; + if(mutex) + SDL_mutexV(mutex); +} + +void systemWriteDataToSoundBuffer() +{ + if(SDL_GetAudioStatus() != SDL_AUDIO_PLAYING) + SDL_PauseAudio(0); + bool cont = true; + while(cont && !speedup && !throttle) { + SDL_mutexP(mutex); + // printf("Waiting for len < 2048 (speed up %d)\n", speedup); + if(sdlSoundLen < 2048*2) + cont = false; + SDL_mutexV(mutex); + } + + int len = soundBufferLen; + int copied = 0; + if((sdlSoundLen+len) >= 2048*2) { + // printf("Case 1\n"); + memcpy(&sdlBuffer[sdlSoundLen],soundFinalWave, 2048*2-sdlSoundLen); + copied = 2048*2 - sdlSoundLen; + sdlSoundLen = 2048*2; + SDL_CondSignal(cond); + cont = true; + if(!speedup && !throttle) { + while(cont) { + SDL_mutexP(mutex); + if(sdlSoundLen < 2048*2) + cont = false; + SDL_mutexV(mutex); + } + memcpy(&sdlBuffer[0],&(((u8 *)soundFinalWave)[copied]), + soundBufferLen-copied); + sdlSoundLen = soundBufferLen-copied; + } else { + memcpy(&sdlBuffer[0], &(((u8 *)soundFinalWave)[copied]), +soundBufferLen); + } + } else { + // printf("case 2\n"); + memcpy(&sdlBuffer[sdlSoundLen], soundFinalWave, soundBufferLen); + sdlSoundLen += soundBufferLen; + } +} + +bool systemSoundInit() +{ + SDL_AudioSpec audio; + + switch(soundQuality) { + case 1: + audio.freq = 44100; + soundBufferLen = 1470*2; + break; + case 2: + audio.freq = 22050; + soundBufferLen = 736*2; + break; + case 4: + audio.freq = 11025; + soundBufferLen = 368*2; + break; + } + audio.format=AUDIO_S16SYS; + audio.channels = 2; + audio.samples = 1024; + audio.callback = soundCallback; + audio.userdata = NULL; + if(SDL_OpenAudio(&audio, NULL)) { + fprintf(stderr,"Failed to open audio: %s\n", SDL_GetError()); + return false; + } + soundBufferTotalLen = soundBufferLen*10; + cond = SDL_CreateCond(); + mutex = SDL_CreateMutex(); + sdlSoundLen = 0; + systemSoundOn = true; + return true; +} + +void systemSoundShutdown() +{ + SDL_mutexP(mutex); + SDL_CondSignal(cond); + SDL_mutexV(mutex); + SDL_DestroyCond(cond); + cond = NULL; + SDL_DestroyMutex(mutex); + mutex = NULL; + SDL_CloseAudio(); +} + +void systemSoundPause() +{ + SDL_PauseAudio(1); +} + +void systemSoundResume() +{ + SDL_PauseAudio(0); +} + +void systemSoundReset() +{ +} + +u32 systemGetClock() +{ + return SDL_GetTicks(); +} + +void systemUpdateMotionSensor() +{ + if(sdlMotionButtons[KEY_LEFT]) { + sensorX += 3; + if(sensorX > 2197) + sensorX = 2197; + if(sensorX < 2047) + sensorX = 2057; + } else if(sdlMotionButtons[KEY_RIGHT]) { + sensorX -= 3; + if(sensorX < 1897) + sensorX = 1897; + if(sensorX > 2047) + sensorX = 2037; + } else if(sensorX > 2047) { + sensorX -= 2; + if(sensorX < 2047) + sensorX = 2047; + } else { + sensorX += 2; + if(sensorX > 2047) + sensorX = 2047; + } + + if(sdlMotionButtons[KEY_UP]) { + sensorY += 3; + if(sensorY > 2197) + sensorY = 2197; + if(sensorY < 2047) + sensorY = 2057; + } else if(sdlMotionButtons[KEY_DOWN]) { + sensorY -= 3; + if(sensorY < 1897) + sensorY = 1897; + if(sensorY > 2047) + sensorY = 2037; + } else if(sensorY > 2047) { + sensorY -= 2; + if(sensorY < 2047) + sensorY = 2047; + } else { + sensorY += 2; + if(sensorY > 2047) + sensorY = 2047; + } +} + +int systemGetSensorX() +{ + return sensorX; +} + +int systemGetSensorY() +{ + return sensorY; +} + +void systemGbPrint(u8 *data,int pages,int feed,int palette, int contrast) +{ +} + +void systemScreenMessage(const char *msg, int slot, int duration, const char *colorList) +{ + screenMessage[slot] = true; + screenMessageTime[slot] = systemGetClock(); + screenMessageDuration[slot] = duration; + if(strlen(msg) > 20) { + strncpy(screenMessageBuffer[slot], msg, 20); + screenMessageBuffer[slot][20] = 0; + } else + strcpy(screenMessageBuffer[slot], msg); +} + +bool systemCanChangeSoundQuality() +{ + return false; +} + +bool systemPauseOnFrame() +{ + if(pauseNextFrame) { + paused = true; + pauseNextFrame = false; + return true; + } + return false; +} + +// Code donated by Niels Wagenaar (BoycottAdvance) + +// GBA screensize. +#define GBA_WIDTH 240 +#define GBA_HEIGHT 160 + +void Init_Overlay(SDL_Surface *gbascreen, int overlaytype) +{ + + overlay = SDL_CreateYUVOverlay( GBA_WIDTH, + GBA_HEIGHT, + overlaytype, gbascreen); + fprintf(stderr, "Created %dx%dx%d %s %s overlay\n", + overlay->w,overlay->h,overlay->planes, + overlay->hw_overlay?"hardware":"software", + overlay->format==SDL_YV12_OVERLAY?"YV12": + overlay->format==SDL_IYUV_OVERLAY?"IYUV": + overlay->format==SDL_YUY2_OVERLAY?"YUY2": + overlay->format==SDL_UYVY_OVERLAY?"UYVY": + overlay->format==SDL_YVYU_OVERLAY?"YVYU": + "Unknown"); +} + +void Quit_Overlay(void) +{ + + SDL_FreeYUVOverlay(overlay); +} + +/* NOTE: These RGB conversion functions are not intended for speed, + only as examples. +*/ +inline void RGBtoYUV(Uint8 *rgb, int *yuv) +{ + yuv[0] = (int)((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16); + yuv[1] = (int)(128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2])); + yuv[2] = (int)(128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2])); +} + +inline void ConvertRGBtoYV12(SDL_Overlay *o) +{ + int x,y; + int yuv[3]; + Uint8 *p,*op[3]; + + SDL_LockYUVOverlay(o); + + /* Black initialization */ + /* + memset(o->pixels[0],0,o->pitches[0]*o->h); + memset(o->pixels[1],128,o->pitches[1]*((o->h+1)/2)); + memset(o->pixels[2],128,o->pitches[2]*((o->h+1)/2)); + */ + + /* Convert */ + for(y=0; y<160 && yh; y++) { + p=(Uint8 *)pix+srcPitch*y; + op[0]=o->pixels[0]+o->pitches[0]*y; + op[1]=o->pixels[1]+o->pitches[1]*(y/2); + op[2]=o->pixels[2]+o->pitches[2]*(y/2); + for(x=0; x<240 && xw; x++) { + RGBtoYUV(p,yuv); + *(op[0]++)=yuv[0]; + if(x%2==0 && y%2==0) { + *(op[1]++)=yuv[2]; + *(op[2]++)=yuv[1]; + } + p+=4;//s->format->BytesPerPixel; + } + } + + SDL_UnlockYUVOverlay(o); +} + +inline void ConvertRGBtoIYUV(SDL_Overlay *o) +{ + int x,y; + int yuv[3]; + Uint8 *p,*op[3]; + + SDL_LockYUVOverlay(o); + + /* Black initialization */ + /* + memset(o->pixels[0],0,o->pitches[0]*o->h); + memset(o->pixels[1],128,o->pitches[1]*((o->h+1)/2)); + memset(o->pixels[2],128,o->pitches[2]*((o->h+1)/2)); + */ + + /* Convert */ + for(y=0; y<160 && yh; y++) { + p=(Uint8 *)pix+srcPitch*y; + op[0]=o->pixels[0]+o->pitches[0]*y; + op[1]=o->pixels[1]+o->pitches[1]*(y/2); + op[2]=o->pixels[2]+o->pitches[2]*(y/2); + for(x=0; x<240 && xw; x++) { + RGBtoYUV(p,yuv); + *(op[0]++)=yuv[0]; + if(x%2==0 && y%2==0) { + *(op[1]++)=yuv[1]; + *(op[2]++)=yuv[2]; + } + p+=4; //s->format->BytesPerPixel; + } + } + + SDL_UnlockYUVOverlay(o); +} + +inline void ConvertRGBtoUYVY(SDL_Overlay *o) +{ + int x,y; + int yuv[3]; + Uint8 *p,*op; + + SDL_LockYUVOverlay(o); + + for(y=0; y<160 && yh; y++) { + p=(Uint8 *)pix+srcPitch*y; + op=o->pixels[0]+o->pitches[0]*y; + for(x=0; x<240 && xw; x++) { + RGBtoYUV(p,yuv); + if(x%2==0) { + *(op++)=yuv[1]; + *(op++)=yuv[0]; + *(op++)=yuv[2]; + } else + *(op++)=yuv[0]; + + p+=4; //s->format->BytesPerPixel; + } + } + + SDL_UnlockYUVOverlay(o); +} + +inline void ConvertRGBtoYVYU(SDL_Overlay *o) +{ + int x,y; + int yuv[3]; + Uint8 *p,*op; + + SDL_LockYUVOverlay(o); + + for(y=0; y<160 && yh; y++) { + p=(Uint8 *)pix+srcPitch*y; + op=o->pixels[0]+o->pitches[0]*y; + for(x=0; x<240 && xw; x++) { + RGBtoYUV(p,yuv); + if(x%2==0) { + *(op++)=yuv[0]; + *(op++)=yuv[2]; + op[1]=yuv[1]; + } else { + *op=yuv[0]; + op+=2; + } + + p+=4; //s->format->BytesPerPixel; + } + } + + SDL_UnlockYUVOverlay(o); +} + +inline void ConvertRGBtoYUY2(SDL_Overlay *o) +{ + int x,y; + int yuv[3]; + Uint8 *p,*op; + + SDL_LockYUVOverlay(o); + + for(y=0; y<160 && yh; y++) { + p=(Uint8 *)pix+srcPitch*y; + op=o->pixels[0]+o->pitches[0]*y; + for(x=0; x<240 && xw; x++) { + RGBtoYUV(p,yuv); + if(x%2==0) { + *(op++)=yuv[0]; + *(op++)=yuv[1]; + op[1]=yuv[2]; + } else { + *op=yuv[0]; + op+=2; + } + + p+=4; //s->format->BytesPerPixel; + } + } + + SDL_UnlockYUVOverlay(o); +} + +inline void Convert32bit(SDL_Surface *display) +{ + switch(overlay->format) { + case SDL_YV12_OVERLAY: + ConvertRGBtoYV12(overlay); + break; + case SDL_UYVY_OVERLAY: + ConvertRGBtoUYVY(overlay); + break; + case SDL_YVYU_OVERLAY: + ConvertRGBtoYVYU(overlay); + break; + case SDL_YUY2_OVERLAY: + ConvertRGBtoYUY2(overlay); + break; + case SDL_IYUV_OVERLAY: + ConvertRGBtoIYUV(overlay); + break; + default: + fprintf(stderr, "cannot convert RGB picture to obtained YUV format!\n"); + exit(1); + break; + } + +} + + +inline void Draw_Overlay(SDL_Surface *display, int size) +{ + SDL_LockYUVOverlay(overlay); + + Convert32bit(display); + + overlay_rect.x = 0; + overlay_rect.y = 0; + overlay_rect.w = GBA_WIDTH * size; + overlay_rect.h = GBA_HEIGHT * size; + + SDL_DisplayYUVOverlay(overlay, &overlay_rect); + SDL_UnlockYUVOverlay(overlay); +} + +void systemGbBorderOn() +{ + srcWidth = 256; + srcHeight = 224; + gbBorderLineSkip = 256; + gbBorderColumnSkip = 48; + gbBorderRowSkip = 40; + + destWidth = (sizeOption+1)*srcWidth; + destHeight = (sizeOption+1)*srcHeight; + + surface = SDL_SetVideoMode(destWidth, destHeight, 16, + SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF| + (fullscreen ? SDL_FULLSCREEN : 0)); +#ifndef C_CORE + sdlMakeStretcher(srcWidth); +#else + switch(systemColorDepth) { + case 16: + sdlStretcher = sdlStretcher16[sizeOption]; + break; + case 24: + sdlStretcher = sdlStretcher24[sizeOption]; + break; + case 32: + sdlStretcher = sdlStretcher32[sizeOption]; + break; + default: + fprintf(stderr, "Unsupported resolution: %d\n", systemColorDepth); + exit(-1); + } +#endif + + if(systemColorDepth == 16) { + if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) { + Init_2xSaI(565); + RGB_LOW_BITS_MASK = 0x821; + } else { + Init_2xSaI(555); + RGB_LOW_BITS_MASK = 0x421; + } + if(cartridgeType == 2) { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = (((i >> 1) & 0x1f) << systemBlueShift) | + (((i & 0x7c0) >> 6) << systemGreenShift) | + (((i & 0xf800) >> 11) << systemRedShift); + } + } else { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + srcPitch = srcWidth * 2+4; + } else { + if(systemColorDepth != 32) + filterFunction = NULL; + RGB_LOW_BITS_MASK = 0x010101; + if(systemColorDepth == 32) { + Init_2xSaI(32); + } + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + if(systemColorDepth == 32) + srcPitch = srcWidth*4 + 4; + else + srcPitch = srcWidth*3; + } +} diff --git a/src/sdl/TestEmu.cpp b/src/sdl/TestEmu.cpp new file mode 100644 index 0000000..5c96bb9 --- /dev/null +++ b/src/sdl/TestEmu.cpp @@ -0,0 +1,448 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include +#include +#include + +#include "AutoBuild.h" + +#include "GBA.h" +#include "debugger.h" +#include "Sound.h" +#include "unzip.h" +#include "Util.h" +#include "gb/GB.h" +#include "gb/gbGlobals.h" + +#ifndef WIN32 +# include +# define GETCWD getcwd +#else // WIN32 +# include +# define GETCWD _getcwd +#endif // WIN32 + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif +extern bool soundEcho; +extern bool soundLowPass; +extern bool soundReverse; + +extern void remoteInit(); +extern void remoteCleanUp(); +extern void remoteStubMain(); +extern void remoteStubSignal(int,int); +extern void remoteOutput(char *, u32); +extern void remoteSetProtocol(int); +extern void remoteSetPort(int); +extern void debuggerOutput(char *, u32); + +struct EmulatedSystem emulator; + +int systemRedShift = 0; +int systemBlueShift = 16; +int systemGreenShift = 8; +int systemColorDepth = 32; +int systemDebug = 0; +int systemVerbose = 0; +int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + +int cartridgeType = 3; +int captureFormat = 0; + +int emulating = 0; +int RGB_LOW_BITS_MASK=0x821; +int systemFrameSkip = 0; +u32 systemColorMap32[0x10000]; +u16 systemColorMap16[0x10000]; +u16 systemGbPalette[24]; +char filename[2048]; +char biosFileName[2048]; +char captureDir[2048]; +char saveDir[2048]; +char batteryDir[2048]; + +bool paused = false; +bool debugger = true; +bool debuggerStub = false; +bool systemSoundOn = false; +bool removeIntros = false; + +extern void debuggerSignal(int,int); + +void (*dbgMain)() = debuggerMain; +void (*dbgSignal)(int,int) = debuggerSignal; +void (*dbgOutput)(char *, u32) = debuggerOutput; + +char *sdlGetFilename(char *name) +{ + static char filebuffer[2048]; + + int len = strlen(name); + + char *p = name + len - 1; + + while(true) { + if(*p == '/' || + *p == '\\') { + p++; + break; + } + len--; + p--; + if(len == 0) + break; + } + + if(len == 0) + strcpy(filebuffer, name); + else + strcpy(filebuffer, p); + return filebuffer; +} + +void usage(char *cmd) +{ + printf("%s file-name\n",cmd); +} + +int main(int argc, char **argv) +{ + fprintf(stderr,"VisualBoyAdvance-Test version %s\n", VERSION); + + captureDir[0] = 0; + saveDir[0] = 0; + batteryDir[0] = 0; + + char buffer[1024]; + + systemFrameSkip = frameSkip = 2; + gbBorderOn = 0; + + parseDebug = true; + + if(!debuggerStub) { + if(argc <= 1) { + systemMessage(0,"Missing image name"); + usage(argv[0]); + exit(-1); + } + } + + for(int i = 0; i < 24;) { + systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + systemGbPalette[i++] = (0x15) | (0x15 << 5) | (0x15 << 10); + systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + systemGbPalette[i++] = 0; + } + + if(argc == 2) { + char *szFile = argv[optind]; + bool failed = false; + if(CPUIsZipFile(szFile)) { + unzFile unz = unzOpen(szFile); + + if(unz == NULL) { + systemMessage(0, "Cannot open file %s", szFile); + exit(-1); + } + int r = unzGoToFirstFile(unz); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(0, "Bad ZIP file %s", szFile); + exit(-1); + } + + bool found = false; + + unz_file_info info; + + while(true) { + r = unzGetCurrentFileInfo(unz, + &info, + buffer, + sizeof(buffer), + NULL, + 0, + NULL, + 0); + + if(r != UNZ_OK) { + unzClose(unz); + systemMessage(0,"Bad ZIP file %s", szFile); + exit(-1); + } + + if(utilIsGBImage(buffer)) { + found = true; + cartridgeType = 1; + break; + } + if(utilIsGBAImage(buffer)) { + found = true; + cartridgeType = 0; + break; + } + + r = unzGoToNextFile(unz); + + if(r != UNZ_OK) + break; + } + + if(!found) { + unzClose(unz); + systemMessage(0, "No image found on ZIP file %s", szFile); + exit(-1); + } + + unzClose(unz); + } + + if(utilIsGBImage(szFile) || cartridgeType == 1) { + failed = !gbLoadRom(szFile); + cartridgeType = 1; + emulator = GBSystem; + } else if(utilIsGBAImage(szFile) || cartridgeType == 0) { + failed = !CPULoadRom(szFile); + cartridgeType = 0; + emulator = GBASystem; + + CPUInit(biosFileName, useBios); + CPUReset(); + } else { + systemMessage(0, "Unknown file type %s", szFile); + exit(-1); + } + + if(failed) { + systemMessage(0, "Failed to load file %s", szFile); + exit(-1); + } + strcpy(filename, szFile); + char *p = strrchr(filename, '.'); + + if(p) + *p = 0; + } else { + cartridgeType = 0; + strcpy(filename, "gnu_stub"); + rom = (u8 *)malloc(0x2000000); + workRAM = (u8 *)calloc(1, 0x40000); + bios = (u8 *)calloc(1,0x4000); + internalRAM = (u8 *)calloc(1,0x8000); + paletteRAM = (u8 *)calloc(1,0x400); + vram = (u8 *)calloc(1, 0x20000); + oam = (u8 *)calloc(1, 0x400); + pix = (u8 *)calloc(1, 4 * 240 * 160); + ioMem = (u8 *)calloc(1, 0x400); + + emulator = GBASystem; + + CPUInit(biosFileName, useBios); + CPUReset(); + } + + if(debuggerStub) + remoteInit(); + + if(cartridgeType == 0) { + } else if (cartridgeType == 1) { + if(gbBorderOn) { + gbBorderLineSkip = 256; + gbBorderColumnSkip = 48; + gbBorderRowSkip = 40; + } else { + gbBorderLineSkip = 160; + gbBorderColumnSkip = 0; + gbBorderRowSkip = 0; + } + } else { + } + + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + + emulating = 1; + soundInit(); + + while(emulating) { + if(!paused) { + if(debugger && emulator.emuHasDebugger) + dbgMain(); + else + emulator.emuMain(emulator.emuCount); + } + } + emulating = 0; + fprintf(stderr,"Shutting down\n"); + remoteCleanUp(); + soundShutdown(); + + if(gbRom != NULL || rom != NULL) { + emulator.emuCleanUp(); + } + + return 0; +} + +void systemMessage(int num, const char *msg, ...) +{ + char buffer[2048]; + va_list valist; + + va_start(valist, msg); + vsprintf(buffer, msg, valist); + + fprintf(stderr, "%s\n", buffer); + va_end(valist); +} + +void systemDrawScreen() +{ +} + +bool systemReadJoypads() +{ + return true; +} + +u32 systemReadJoypad(int,bool) +{ + return 0; +} + +void systemShowSpeed(int speed) +{ +} + +void system10Frames(int rate) +{ +} + +void systemFrame() +{ +} + +void systemSetTitle(const char *title) +{ +} + +void systemScreenCapture(int a) +{ + char buffer[2048]; + + if(captureFormat) { + if(captureDir[0]) + sprintf(buffer, "%s/%s%02d.bmp", captureDir, sdlGetFilename(filename), a); + else + sprintf(buffer, "%s%02d.bmp", filename, a); + + emulator.emuWriteBMP(buffer); + } else { + if(captureDir[0]) + sprintf(buffer, "%s/%s%02d.png", captureDir, sdlGetFilename(filename), a); + else + sprintf(buffer, "%s%02d.png", filename, a); + emulator.emuWritePNG(buffer); + } + + systemScreenMessage("Screen capture"); +} + +u32 systemReadJoypadExtended() +{ + return 0; +} + +void systemWriteDataToSoundBuffer() +{ +} + +bool systemSoundInit() +{ + return true; +} + +void systemSoundShutdown() +{ +} + +void systemSoundPause() +{ +} + +void systemSoundResume() +{ +} + +void systemSoundReset() +{ +} + +static int ticks = 0; + +u32 systemGetClock() +{ + return ticks++; +} + +void systemUpdateMotionSensor() +{ +} + +int systemGetSensorX() +{ + return 0; +} + +int systemGetSensorY() +{ + return 0; +} + +void systemGbPrint(u8 *data,int pages,int feed,int palette, int contrast) +{ +} + +void systemScreenMessage(const char *msg, int slot, int duration, const char *colorList) +{ +} + +bool systemCanChangeSoundQuality() +{ + return false; +} + +bool systemPauseOnFrame() +{ + return false; +} + +void systemGbBorderOn() +{ +} diff --git a/src/sdl/debugger.cpp b/src/sdl/debugger.cpp new file mode 100644 index 0000000..31ec557 --- /dev/null +++ b/src/sdl/debugger.cpp @@ -0,0 +1,1454 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + +#include "GBA.h" +#include "Port.h" +#include "armdis.h" +#include "elf.h" +#include "exprNode.h" + +extern bool debugger; +extern int emulating; + +extern struct EmulatedSystem emulator; + +#define debuggerReadMemory(addr) \ + READ32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define debuggerReadHalfWord(addr) \ + READ16LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) + +#define debuggerReadByte(addr) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] + +#define debuggerWriteMemory(addr, value) \ + WRITE32LE(&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], value) + +#define debuggerWriteHalfWord(addr, value) \ + WRITE16LE(&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], value) + +#define debuggerWriteByte(addr, value) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] = (value) + +struct breakpointInfo { + u32 address; + u32 value; + int size; +}; + +struct DebuggerCommand { + char *name; + void (*function)(int,char **); + char *help; + char *syntax; +}; + +void debuggerContinueAfterBreakpoint(); + +void debuggerHelp(int,char **); +void debuggerNext(int,char **); +void debuggerContinue(int, char **); +void debuggerRegisters(int, char **); +void debuggerBreak(int, char **); +void debuggerBreakDelete(int, char **); +void debuggerBreakList(int, char **); +void debuggerBreakArm(int, char **); +void debuggerBreakWriteClear(int, char **); +void debuggerBreakThumb(int, char **); +void debuggerBreakWrite(int, char **); +void debuggerDebug(int, char **); +void debuggerDisassemble(int, char **); +void debuggerDisassembleArm(int, char **); +void debuggerDisassembleThumb(int, char **); +void debuggerEditByte(int, char **); +void debuggerEditHalfWord(int, char **); +void debuggerEdit(int, char **); +void debuggerIo(int, char **); +void debuggerLocals(int, char **); +void debuggerMemoryByte(int, char **); +void debuggerMemoryHalfWord(int, char **); +void debuggerMemory(int, char **); +void debuggerPrint(int, char **); +void debuggerQuit(int, char **); +void debuggerSetRadix(int, char **); +void debuggerSymbols(int, char **); +void debuggerVerbose(int, char **); +void debuggerWhere(int, char **); + +DebuggerCommand debuggerCommands[] = { + { "?", debuggerHelp, "Shows this help information. Type ? for command help", "[]" }, + { "ba", debuggerBreakArm, "Adds an ARM breakpoint", "
" }, + { "bd", debuggerBreakDelete,"Deletes a breakpoint", "" }, + { "bl", debuggerBreakList, "Lists breakpoints" }, + { "bpw", debuggerBreakWrite, "Break on write", "
" }, + { "bpwc", debuggerBreakWriteClear, "Clear break on write", NULL }, + { "break", debuggerBreak, "Adds a breakpoint on the given function", "||" }, + { "bt", debuggerBreakThumb, "Adds a THUMB breakpoint", "
" }, + { "c", debuggerContinue, "Continues execution" , NULL }, + { "d", debuggerDisassemble, "Disassembles instructions", "[
[]]" }, + { "da", debuggerDisassembleArm, "Disassembles ARM instructions", "[
[]]" }, + { "dt", debuggerDisassembleThumb, "Disassembles THUMB instructions", "[
[]]" }, + { "eb", debuggerEditByte, "Modify memory location (byte)", "
" }, + { "eh", debuggerEditHalfWord,"Modify memory location (half-word)","
" }, + { "ew", debuggerEdit, "Modify memory location (word)", "
for command help", "[]" }, + { "io", debuggerIo, "Show I/O registers status", "[video|video2|dma|timer|misc]" }, + { "locals", debuggerLocals, "Shows local variables", NULL }, + { "mb", debuggerMemoryByte, "Shows memory contents (bytes)", "
" }, + { "mh", debuggerMemoryHalfWord, "Shows memory contents (half-words)", "
"}, + { "mw", debuggerMemory, "Shows memory contents (words)", "
" }, + { "n", debuggerNext, "Executes the next instruction", "[]" }, + { "print", debuggerPrint, "Print the value of a expression (if known)", "[/x|/o|/d] " }, + { "q", debuggerQuit, "Quits the emulator", NULL }, + { "r", debuggerRegisters, "Shows ARM registers", NULL }, + { "radix", debuggerSetRadix, "Sets the print radix", "" }, + { "symbols", debuggerSymbols, "List symbols", "[]" }, +#ifndef FINAL_VERSION + { "trace", debuggerDebug, "Sets the trace level", "" }, +#endif +#ifdef DEV_VERSION + { "verbose", debuggerVerbose, "Change verbose setting", "" }, +#endif + { "where", debuggerWhere, "Shows call chain", NULL }, + { NULL, NULL, NULL, NULL} // end marker +}; + +breakpointInfo debuggerBreakpointList[100]; + +int debuggerNumOfBreakpoints = 0; +bool debuggerAtBreakpoint = false; +int debuggerBreakpointNumber = 0; +int debuggerRadix = 0; + +void debuggerApplyBreakpoint(u32 address, int num, int size) +{ + if(size) + debuggerWriteMemory(address, (u32)(0xe1200070 | + (num & 0xf) | + ((num<<4)&0xf0))); + else + debuggerWriteHalfWord(address, + (u16)(0xbe00 | num)); +} + +void debuggerDisableBreakpoints() +{ + for(int i = 0; i < debuggerNumOfBreakpoints; i++) { + if(debuggerBreakpointList[i].size) + debuggerWriteMemory(debuggerBreakpointList[i].address, + debuggerBreakpointList[i].value); + else + debuggerWriteHalfWord(debuggerBreakpointList[i].address, + debuggerBreakpointList[i].value); + } +} + +void debuggerEnableBreakpoints(bool skipPC) +{ + for(int i = 0; i < debuggerNumOfBreakpoints; i++) { + if(debuggerBreakpointList[i].address == armNextPC && skipPC) + continue; + + debuggerApplyBreakpoint(debuggerBreakpointList[i].address, + i, + debuggerBreakpointList[i].size); + } +} + +void debuggerUsage(char *cmd) +{ + for(int i = 0; ; i++) { + if(debuggerCommands[i].name) { + if(!strcmp(debuggerCommands[i].name, cmd)) { + printf("%s %s\t%s\n", + debuggerCommands[i].name, + debuggerCommands[i].syntax ? debuggerCommands[i].syntax : "", + debuggerCommands[i].help); + break; + } + } else { + printf("Unrecognized command '%s'.", cmd); + break; + } + } +} + +void debuggerPrintBaseType(Type *t, u32 value, u32 location, + LocationType type, + int bitSize, int bitOffset) +{ + if(bitSize) { + if(bitOffset) + value >>= ((t->size*8)-bitOffset-bitSize); + value &= (1 << bitSize)-1; + } else { + if(t->size == 2) + value &= 0xFFFF; + else if(t->size == 1) + value &= 0xFF; + } + + if(t->size == 8) { + u64 value = 0; + if(type == LOCATION_memory) { + value = debuggerReadMemory(location) | + ((u64)debuggerReadMemory(location+4)<<32); + } else if(type == LOCATION_register) { + value = reg[location].I | ((u64)reg[location+1].I << 32); + } + switch(t->encoding) { + case DW_ATE_signed: + switch(debuggerRadix) { + case 0: + printf("%lld", value); + break; + case 1: + printf("0x%llx", value); + break; + case 2: + printf("0%llo", value); + break; + } + break; + case DW_ATE_unsigned: + switch(debuggerRadix) { + case 0: + printf("%llu", value); + break; + case 1: + printf("0x%llx", value); + break; + case 2: + printf("0%llo", value); + break; + } + break; + default: + printf("Unknowing 64-bit encoding\n"); + } + return; + } + + switch(t->encoding) { + case DW_ATE_boolean: + if(value) + printf("true"); + else + printf("false"); + break; + case DW_ATE_signed: + switch(debuggerRadix) { + case 0: + printf("%d", value); + break; + case 1: + printf("0x%x", value); + break; + case 2: + printf("0%o", value); + break; + } + break; + case DW_ATE_unsigned: + case DW_ATE_unsigned_char: + switch(debuggerRadix) { + case 0: + printf("%u", value); + break; + case 1: + printf("0x%x", value); + break; + case 2: + printf("0%o", value); + break; + } + break; + default: + printf("UNKNOWN BASE %d %08x", t->encoding, value); + } +} + +char *debuggerPrintType(Type *t) +{ + char buffer[1024]; + static char buffer2[1024]; + + if(t->type == TYPE_pointer) { + if(t->pointer) + strcpy(buffer, debuggerPrintType(t->pointer)); + else + strcpy(buffer, "void"); + sprintf(buffer2, "%s *", buffer); + return buffer2; + } else if(t->type == TYPE_reference) { + strcpy(buffer, debuggerPrintType(t->pointer)); + sprintf(buffer2, "%s &", buffer); + return buffer2; + } + return t->name; +} + +void debuggerPrintValueInternal(Function *, Type *, ELFBlock *, int, int, u32); +void debuggerPrintValueInternal(Function *f, Type *t, + int bitSize, int bitOffset, + u32 objLocation, LocationType type); + +u32 debuggerGetValue(u32 location, LocationType type) +{ + switch(type) { + case LOCATION_memory: + return debuggerReadMemory(location); + case LOCATION_register: + return reg[location].I; + case LOCATION_value: + return location; + } + return 0; +} + +void debuggerPrintPointer(Type *t, u32 value) +{ + printf("(%s)0x%08x", debuggerPrintType(t), value); +} + +void debuggerPrintReference(Type *t, u32 value) +{ + printf("(%s)0x%08x", debuggerPrintType(t), value); +} + +void debuggerPrintFunction(Type *t, u32 value) +{ + printf("(%s)0x%08x", debuggerPrintType(t), value); +} + +void debuggerPrintArray(Type *t, u32 value) +{ + // todo + printf("(%s[])0x%08x", debuggerPrintType(t->array->type), value); +} + +void debuggerPrintMember(Function *f, + Member *m, + u32 objLocation, + u32 location) +{ + int bitSize = m->bitSize; + if(bitSize) { + u32 value = 0; + int off = m->bitOffset; + int size = m->byteSize; + u32 v = 0; + if(size == 1) + v = debuggerReadByte(location); + else if(size == 2) + v = debuggerReadHalfWord(location); + else if(size == 4) + v = debuggerReadMemory(location); + + while(bitSize) { + int top = size*8 - off; + int bot = top - bitSize; + top--; + if(bot >= 0) { + value = (v >> (size*8 - bitSize - off)) & ((1 << bitSize)-1); + bitSize = 0; + } else { + value |= (v & ((1 << top)-1)) << (bitSize - top); + bitSize -= (top+1); + location -= size; + off = 0; + if(size == 1) + v = debuggerReadByte(location); + else if(size == 2) + v = debuggerReadHalfWord(location); + else + v = debuggerReadMemory(location); + } + } + debuggerPrintBaseType(m->type, value, location, LOCATION_memory, + bitSize, 0); + } else { + debuggerPrintValueInternal(f, m->type, m->location, m->bitSize, + m->bitOffset, objLocation); + } +} + +void debuggerPrintStructure(Function *f, Type *t, u32 objLocation) +{ + printf("{"); + int count = t->structure->memberCount; + int i = 0; + while(i < count) { + Member *m = &t->structure->members[i]; + printf("%s=", m->name); + LocationType type; + u32 location = elfDecodeLocation(f, m->location, &type, objLocation); + debuggerPrintMember(f, m, objLocation, location); + i++; + if(i < count) + printf(","); + } + printf("}"); +} + +void debuggerPrintUnion(Function *f, Type *t, u32 objLocation) +{ + // todo + printf("{"); + int count = t->structure->memberCount; + int i = 0; + while(i < count) { + Member *m = &t->structure->members[i]; + printf("%s=", m->name); + debuggerPrintMember(f, m, objLocation, 0); + i++; + if(i < count) + printf(","); + } + printf("}"); +} + +void debuggerPrintEnum(Type *t, u32 value) +{ + int i; + for(i = 0; i < t->enumeration->count; i++) { + EnumMember *m = (EnumMember *)&t->enumeration->members[i]; + if(value == m->value) { + printf(m->name); + return; + } + } + printf("(UNKNOWN VALUE) %d", value); +} + +void debuggerPrintValueInternal(Function *f, Type *t, + int bitSize, int bitOffset, + u32 objLocation, LocationType type) +{ + u32 value = debuggerGetValue(objLocation, type); + if(!t) { + printf("void"); + return; + } + switch(t->type) { + case TYPE_base: + debuggerPrintBaseType(t, value, objLocation, type, bitSize, bitOffset); + break; + case TYPE_pointer: + debuggerPrintPointer(t, value); + break; + case TYPE_reference: + debuggerPrintReference(t, value); + break; + case TYPE_function: + debuggerPrintFunction(t, value); + break; + case TYPE_array: + debuggerPrintArray(t, objLocation); + break; + case TYPE_struct: + debuggerPrintStructure(f, t, objLocation); + break; + case TYPE_union: + debuggerPrintUnion(f, t, objLocation); + break; + case TYPE_enum: + debuggerPrintEnum(t, value); + break; + default: + printf("%08x", value); + break; + } +} + +void debuggerPrintValueInternal(Function *f, Type *t, ELFBlock *loc, + int bitSize, int bitOffset, u32 objLocation) +{ + LocationType type; + u32 location; + if(loc) { + if(objLocation) + location = elfDecodeLocation(f, loc, &type, objLocation); + else + location = elfDecodeLocation(f, loc,&type); + } else { + location = objLocation; + type = LOCATION_memory; + } + + debuggerPrintValueInternal(f, t, bitSize, bitOffset, location, type); +} + +void debuggerPrintValue(Function *f, Object *o) +{ + debuggerPrintValueInternal(f, o->type, o->location, 0, 0, 0); + + printf("\n"); +} + +void debuggerSymbols(int argc, char **argv) +{ + int i = 0; + u32 value; + u32 size; + int type; + bool match = false; + int matchSize = 0; + char *matchStr = NULL; + + if(argc == 2) { + match = true; + matchSize = strlen(argv[1]); + matchStr = argv[1]; + } + printf("Symbol Value Size Type \n"); + printf("-------------------- ------- -------- -------\n"); + char *s = NULL; + while((s = elfGetSymbol(i, &value, &size, &type))) { + if(*s) { + if(match) { + if(strncmp(s, matchStr, matchSize) != 0) { + i++; + continue; + } + } + char *ts = "?"; + switch(type) { + case 2: + ts = "ARM"; + break; + case 0x0d: + ts = "THUMB"; + break; + case 1: + ts = "DATA"; + break; + } + printf("%-20s %08x %08x %-7s\n", + s, value, size, ts); + } + i++; + } +} + +void debuggerSetRadix(int argc, char **argv) +{ + if(argc != 2) + debuggerUsage(argv[0]); + else { + int r = atoi(argv[1]); + + bool error = false; + switch(r) { + case 10: + debuggerRadix = 0; + break; + case 8: + debuggerRadix = 2; + break; + case 16: + debuggerRadix = 1; + break; + default: + error = true; + printf("Unknown radix %d. Valid values are 8, 10 and 16.\n", r); + break; + } + if(!error) + printf("Radix set to %d\n", r); + } +} + +void debuggerPrint(int argc, char **argv) +{ + if(argc != 2 && argc != 3) { + debuggerUsage(argv[0]); + } else { + u32 pc = armNextPC; + Function *f = NULL; + CompileUnit *u = NULL; + + elfGetCurrentFunction(pc, + &f, &u); + + int oldRadix = debuggerRadix; + if(argc == 3) { + if(argv[1][0] == '/') { + if(argv[1][1] == 'x') + debuggerRadix = 1; + else if(argv[1][1] == 'o') + debuggerRadix = 2; + else if(argv[1][1] == 'd') + debuggerRadix = 0; + else { + printf("Unknown format %c\n", argv[1][1]); + return; + } + } else { + printf("Unknown option %s\n", argv[1]); + return; + } + } + + char *s = argc == 2 ? argv[1] : argv[2]; + + extern char *exprString; + extern int exprCol; + extern int yyparse(); + exprString = s; + exprCol = 0; + if(!yyparse()) { + extern Node *result; + if(result->resolve(result, f, u)) { + if(result->member) + debuggerPrintMember(f, + result->member, + result->objLocation, + result->location); + else + debuggerPrintValueInternal(f, result->type, 0, 0, + result->location, + result->locType); + printf("\n"); + } else { + printf("Error resolving expression\n"); + } + } else { + printf("Error parsing expression:\n"); + printf("%s\n", s); + exprCol--; + for(int i = 0; i < exprCol; i++) + printf(" "); + printf("^\n"); + } + extern void exprCleanBuffer(); + exprCleanBuffer(); + exprNodeCleanUp(); + debuggerRadix = oldRadix; + } +} + +void debuggerHelp(int n, char **args) +{ + if(n == 2) { + debuggerUsage(args[1]); + } else { + for(int i = 0; ; i++) { + if(debuggerCommands[i].name) { + printf("%s\t%s\n", debuggerCommands[i].name, debuggerCommands[i].help); + } else + break; + } + } +} + +void debuggerDebug(int n, char **args) +{ + if(n == 2) { + int v = 0; + sscanf(args[1], "%d", &v); + systemDebug = v; + printf("Debug level set to %d\n", systemDebug); + } else + debuggerUsage("trace"); +} + +void debuggerVerbose(int n, char **args) +{ + if(n == 2) { + int v = 0; + sscanf(args[1], "%d", &v); + systemVerbose = v; + printf("Verbose level set to %d\n", systemVerbose); + } else + debuggerUsage("verbose"); +} + +void debuggerWhere(int n, char **args) +{ + void elfPrintCallChain(u32); + elfPrintCallChain(armNextPC); +} + +void debuggerLocals(int n, char **args) +{ + Function *f = NULL; + CompileUnit *u = NULL; + u32 pc = armNextPC; + if(elfGetCurrentFunction(pc, + &f, &u)) { + Object *o = f->parameters; + while(o) { + printf("%s=", o->name); + debuggerPrintValue(f, o); + o = o->next; + } + + o = f->variables; + while(o) { + bool visible = o->startScope ? pc>=o->startScope : true; + if(visible) + visible = o->endScope ? pc < o->endScope : true; + if(visible) { + printf("%s=", o->name); + debuggerPrintValue(f, o); + } + o = o->next; + } + } else { + printf("No information for current address\n"); + } +} + +void debuggerNext(int n, char **args) +{ + int count = 1; + if(n == 2) { + sscanf(args[1], "%d", &count); + } + for(int i = 0; i < count; i++) { + if(debuggerAtBreakpoint) { + debuggerContinueAfterBreakpoint(); + debuggerEnableBreakpoints(false); + } else + emulator.emuMain(1); + } + debuggerDisableBreakpoints(); + Function *f = NULL; + CompileUnit *u = NULL; + u32 a = armNextPC; + if(elfGetCurrentFunction(a, &f, &u)) { + char *file; + int line = elfFindLine(u, f, a, &file); + + printf("File %s, function %s, line %d\n", file, f->name, + line); + } + debuggerRegisters(0, NULL); +} + +void debuggerContinue(int n, char **args) +{ + if(debuggerAtBreakpoint) + debuggerContinueAfterBreakpoint(); + debuggerEnableBreakpoints(false); + debugger = false; +} + +void debuggerSignal(int sig,int number) +{ + switch(sig) { + case 4: + { + printf("Illegal instruction at %08x\n", armNextPC); + debugger = true; + } + break; + case 5: + { + printf("Breakpoint %d reached\n", number); + debugger = true; + debuggerAtBreakpoint = true; + debuggerBreakpointNumber = number; + debuggerDisableBreakpoints(); + + Function *f = NULL; + CompileUnit *u = NULL; + + if(elfGetCurrentFunction(armNextPC, &f, &u)) { + char *file; + int line = elfFindLine(u,f,armNextPC,&file); + printf("File %s, function %s, line %d\n", file, f->name, + line); + } + } + break; + default: + printf("Unknown signal %d\n", sig); + break; + } +} + +void debuggerBreakList(int, char **) +{ + printf("Num Address Type Symbol\n"); + printf("--- -------- ----- ------\n"); + for(int i = 0; i < debuggerNumOfBreakpoints; i++) { + printf("%3d %08x %s %s\n",i, debuggerBreakpointList[i].address, + debuggerBreakpointList[i].size ? "ARM" : "THUMB", + elfGetAddressSymbol(debuggerBreakpointList[i].address)); + } +} + +void debuggerBreakDelete(int n, char **args) +{ + if(n == 2) { + int n = 0; + sscanf(args[1], "%d", &n); + printf("Deleting breakpoint %d (%d)\n", n, debuggerNumOfBreakpoints); + if(n >= 0 && n < debuggerNumOfBreakpoints) { + n++; + if(n < debuggerNumOfBreakpoints) { + for(int i = n; i < debuggerNumOfBreakpoints; i++) { + debuggerBreakpointList[i-1].address = + debuggerBreakpointList[i].address; + debuggerBreakpointList[i-1].value = + debuggerBreakpointList[i].value; + debuggerBreakpointList[i-1].size = + debuggerBreakpointList[i].size; + } + } + debuggerNumOfBreakpoints--; + } + } else + debuggerUsage("bd"); +} + +void debuggerBreak(int n, char **args) +{ + if(n == 2) { + u32 address = 0; + u32 value = 0; + int type = 0; + char *s = args[1]; + char c = *s; + if(strchr(s, ':')) { + char *name = s; + char *l = strchr(s, ':'); + *l++ = 0; + int line = atoi(l); + + u32 addr; + Function *f; + CompileUnit *u; + + if(elfFindLineInModule(&addr, name, line)) { + if(elfGetCurrentFunction(addr, &f, &u)) { + u32 addr2; + if(elfGetSymbolAddress(f->name, &addr2, &value, &type)) { + address = addr; + } else { + printf("Unable to get function symbol data\n"); + return; + } + } else { + printf("Unable to find function for address\n"); + return; + } + } else { + printf("Unable to find module or line\n"); + return; + } + } else if(c >= '0' && c <= '9') { + int line = atoi(s); + Function *f; + CompileUnit *u; + u32 addr; + + if(elfGetCurrentFunction(armNextPC, &f, &u)) { + if(elfFindLineInUnit(&addr, u, line)) { + if(elfGetCurrentFunction(addr, &f, &u)) { + u32 addr2; + if(elfGetSymbolAddress(f->name, &addr2, &value, &type)) { + address = addr; + } else { + printf("Unable to get function symbol data\n"); + return; + } + } else { + printf("Unable to find function for address\n"); + return; + } + } else { + printf("Unable to find line\n"); + return; + } + } else { + printf("Cannot find current function\n"); + return; + } + } else { + if(!elfGetSymbolAddress(s, &address, &value, &type)) { + printf("Function %s not found\n", args[1]); + return; + } + } + if(type == 0x02 || type == 0x0d) { + int i = debuggerNumOfBreakpoints; + int size = 0; + if(type == 2) + size = 1; + debuggerBreakpointList[i].address = address; + debuggerBreakpointList[i].value = type == 0x02 ? + debuggerReadMemory(address) : debuggerReadHalfWord(address); + debuggerBreakpointList[i].size = size; + // debuggerApplyBreakpoint(address, i, size); + debuggerNumOfBreakpoints++; + if(size) + printf("Added ARM breakpoint at %08x\n", address); + else + printf("Added THUMB breakpoint at %08x\n", address); + } else { + printf("%s is not a function symbol\n", args[1]); + } + } else + debuggerUsage("break"); +} + +void debuggerBreakThumb(int n, char **args) +{ + if(n == 2) { + u32 address = 0; + sscanf(args[1],"%x", &address); + int i = debuggerNumOfBreakpoints; + debuggerBreakpointList[i].address = address; + debuggerBreakpointList[i].value = debuggerReadHalfWord(address); + debuggerBreakpointList[i].size = 0; + // debuggerApplyBreakpoint(address, i, 0); + debuggerNumOfBreakpoints++; + printf("Added THUMB breakpoint at %08x\n", address); + } else + debuggerUsage("bt"); +} + +void debuggerBreakArm(int n, char **args) +{ + if(n == 2) { + u32 address = 0; + sscanf(args[1],"%x", &address); + int i = debuggerNumOfBreakpoints; + debuggerBreakpointList[i].address = address; + debuggerBreakpointList[i].value = debuggerReadMemory(address); + debuggerBreakpointList[i].size = 1; + // debuggerApplyBreakpoint(address, i, 1); + debuggerNumOfBreakpoints++; + printf("Added ARM breakpoint at %08x\n", address); + } else + debuggerUsage("ba"); +} + +void debuggerBreakOnWrite(u32 *mem, u32 oldvalue, u32 value, int size) +{ + u32 address = 0; + if(mem >= (u32*)&workRAM[0] && mem <= (u32*)&workRAM[0x3ffff]) + address = 0x2000000 + ((u32)mem - (u32)&workRAM[0]); + else + address = 0x3000000 + ((u32)mem - (u32)&internalRAM[0]); + + if(size == 2) + printf("Breakpoint (on write) address %08x old:%08x new:%08x\n", + address, oldvalue, value); + else if(size == 1) + printf("Breakpoint (on write) address %08x old:%04x new:%04x\n", + address, (u16)oldvalue,(u16)value); + else + printf("Breakpoint (on write) address %08x old:%02x new:%02x\n", + address, (u8)oldvalue, (u8)value); + debugger = true; +} + +void debuggerBreakWriteClear(int n, char **args) +{ + memset(freezeWorkRAM, false, 0x40000); + memset(freezeInternalRAM, false, 0x8000); + printf("Cleared all break on write\n"); +} + +void debuggerBreakWrite(int n, char **args) +{ + if(n == 3) { + if(cheatsNumber != 0) { + printf("Cheats are enabled. Cannot continue.\n"); + return; + } + u32 address = 0; + sscanf(args[1], "%x", &address); + int n = 0; + sscanf(args[2], "%d", &n); + + if(address < 0x2000000 || address > 0x3007fff) { + printf("Invalid address: %08x\n", address); + return; + } + + if(address > 0x203ffff && address < 0x3000000) { + printf("Invalid address: %08x\n", address); + return; + } + + u32 final = address + n; + + if(address < 0x2040000 && final > 0x2040000) { + printf("Invalid byte count: %d\n", n); + return; + } else if(address < 0x3008000 && final > 0x3008000) { + printf("Invalid byte count: %d\n", n); + return; + } + printf("Added break on write at %08x for %d bytes\n", address, n); + for(int i = 0; i < n; i++) { + if((address >> 24) == 2) + freezeWorkRAM[address & 0x3ffff] = true; + else + freezeInternalRAM[address & 0x7fff] = true; + address++; + } + } else + debuggerUsage("bpw"); +} + +void debuggerDisassembleArm(int n, char **args) +{ + char buffer[80]; + u32 pc = reg[15].I; + pc -= 4; + int count = 20; + if(n >= 2) { + sscanf(args[1], "%x", &pc); + } + if(pc & 3) { + printf("Misaligned address %08x\n", pc); + pc &= 0xfffffffc; + } + if(n >= 3) { + sscanf(args[2], "%d", &count); + } + int i = 0; + int len = 0; + char format[30]; + for(i = 0; i < count; i++) { + int l = strlen(elfGetAddressSymbol(pc+4*i)); + if(l > len) + len = l; + } + sprintf(format, "%%08x %%-%ds %%s\n", len); + for(i = 0; i < count; i++) { + u32 addr = pc; + pc += disArm(pc, buffer, 2); + printf(format, addr, elfGetAddressSymbol(addr), buffer); + } +} + +void debuggerDisassembleThumb(int n, char **args) +{ + char buffer[80]; + u32 pc = reg[15].I; + pc -= 2; + int count = 20; + if(n >= 2) { + sscanf(args[1], "%x", &pc); + } + if(pc & 1) { + printf("Misaligned address %08x\n", pc); + pc &= 0xfffffffe; + } + if(n >= 3) { + sscanf(args[2], "%d", &count); + } + + int i = 0; + int len = 0; + char format[30]; + for(i = 0; i < count; i++) { + int l = strlen(elfGetAddressSymbol(pc+2*i)); + if(l > len) + len = l; + } + sprintf(format, "%%08x %%-%ds %%s\n", len); + + for(i = 0; i < count; i++) { + u32 addr = pc; + pc += disThumb(pc, buffer, 2); + printf(format, addr, elfGetAddressSymbol(addr), buffer); + } +} + +void debuggerDisassemble(int n, char **args) +{ + if(armState) + debuggerDisassembleArm(n, args); + else + debuggerDisassembleThumb(n, args); +} + +void debuggerContinueAfterBreakpoint() +{ + printf("Continuing after breakpoint\n"); + debuggerEnableBreakpoints(true); + emulator.emuMain(1); + debuggerAtBreakpoint = false; +} + +void debuggerRegisters(int, char **) +{ + char *command[3]; + char buffer[10]; + + printf("R00=%08x R04=%08x R08=%08x R12=%08x\n", + reg[0].I, reg[4].I, reg[8].I, reg[12].I); + printf("R01=%08x R05=%08x R09=%08x R13=%08x\n", + reg[1].I, reg[5].I, reg[9].I, reg[13].I); + printf("R02=%08x R06=%08x R10=%08x R14=%08x\n", + reg[2].I, reg[6].I, reg[10].I, reg[14].I); + printf("R03=%08x R07=%08x R11=%08x R15=%08x\n", + reg[3].I, reg[7].I, reg[11].I, reg[15].I); + printf("CPSR=%08x (%c%c%c%c%c%c%c Mode: %02x)\n", + reg[16].I, + (N_FLAG ? 'N' : '.'), + (Z_FLAG ? 'Z' : '.'), + (C_FLAG ? 'C' : '.'), + (V_FLAG ? 'V' : '.'), + (armIrqEnable ? '.' : 'I'), + ((!(reg[16].I & 0x40)) ? '.' : 'F'), + (armState ? '.' : 'T'), + armMode); + sprintf(buffer,"%08x", armState ? reg[15].I - 4 : reg[15].I - 2); + command[0]="m"; + command[1]=buffer; + command[2]="1"; + debuggerDisassemble(3, command); +} + +void debuggerIoVideo() +{ + printf("DISPCNT = %04x\n", DISPCNT); + printf("DISPSTAT = %04x\n", DISPSTAT); + printf("VCOUNT = %04x\n", VCOUNT); + printf("BG0CNT = %04x\n", BG0CNT); + printf("BG1CNT = %04x\n", BG1CNT); + printf("BG2CNT = %04x\n", BG2CNT); + printf("BG3CNT = %04x\n", BG3CNT); + printf("WIN0H = %04x\n", WIN0H); + printf("WIN0V = %04x\n", WIN0V); + printf("WIN1H = %04x\n", WIN1H); + printf("WIN1V = %04x\n", WIN1V); + printf("WININ = %04x\n", WININ); + printf("WINOUT = %04x\n", WINOUT); + printf("MOSAIC = %04x\n", MOSAIC); + printf("BLDMOD = %04x\n", BLDMOD); + printf("COLEV = %04x\n", COLEV); + printf("COLY = %04x\n", COLY); +} + +void debuggerIoVideo2() +{ + printf("BG0HOFS = %04x\n", BG0HOFS); + printf("BG0VOFS = %04x\n", BG0VOFS); + printf("BG1HOFS = %04x\n", BG1HOFS); + printf("BG1VOFS = %04x\n", BG1VOFS); + printf("BG2HOFS = %04x\n", BG2HOFS); + printf("BG2VOFS = %04x\n", BG2VOFS); + printf("BG3HOFS = %04x\n", BG3HOFS); + printf("BG3VOFS = %04x\n", BG3VOFS); + printf("BG2PA = %04x\n", BG2PA); + printf("BG2PB = %04x\n", BG2PB); + printf("BG2PC = %04x\n", BG2PC); + printf("BG2PD = %04x\n", BG2PD); + printf("BG2X = %08x\n", (BG2X_H<<16)|BG2X_L); + printf("BG2Y = %08x\n", (BG2Y_H<<16)|BG2Y_L); + printf("BG3PA = %04x\n", BG3PA); + printf("BG3PB = %04x\n", BG3PB); + printf("BG3PC = %04x\n", BG3PC); + printf("BG3PD = %04x\n", BG3PD); + printf("BG3X = %08x\n", (BG3X_H<<16)|BG3X_L); + printf("BG3Y = %08x\n", (BG3Y_H<<16)|BG3Y_L); +} + +void debuggerIoDMA() +{ + printf("DM0SAD = %08x\n", (DM0SAD_H<<16)|DM0SAD_L); + printf("DM0DAD = %08x\n", (DM0DAD_H<<16)|DM0DAD_L); + printf("DM0CNT = %08x\n", (DM0CNT_H<<16)|DM0CNT_L); + printf("DM1SAD = %08x\n", (DM1SAD_H<<16)|DM1SAD_L); + printf("DM1DAD = %08x\n", (DM1DAD_H<<16)|DM1DAD_L); + printf("DM1CNT = %08x\n", (DM1CNT_H<<16)|DM1CNT_L); + printf("DM2SAD = %08x\n", (DM2SAD_H<<16)|DM2SAD_L); + printf("DM2DAD = %08x\n", (DM2DAD_H<<16)|DM2DAD_L); + printf("DM2CNT = %08x\n", (DM2CNT_H<<16)|DM2CNT_L); + printf("DM3SAD = %08x\n", (DM3SAD_H<<16)|DM3SAD_L); + printf("DM3DAD = %08x\n", (DM3DAD_H<<16)|DM3DAD_L); + printf("DM3CNT = %08x\n", (DM3CNT_H<<16)|DM3CNT_L); +} + +void debuggerIoTimer() +{ + printf("TM0D = %04x\n", TM0D); + printf("TM0CNT = %04x\n", TM0CNT); + printf("TM1D = %04x\n", TM1D); + printf("TM1CNT = %04x\n", TM1CNT); + printf("TM2D = %04x\n", TM2D); + printf("TM2CNT = %04x\n", TM2CNT); + printf("TM3D = %04x\n", TM3D); + printf("TM3CNT = %04x\n", TM3CNT); +} + +void debuggerIoMisc() +{ + printf("P1 = %04x\n", P1); + printf("IE = %04x\n", IE); + printf("IF = %04x\n", IF); + printf("IME = %04x\n", IME); +} + +void debuggerIo(int n, char **args) +{ + if(n == 1) { + debuggerIoVideo(); + return; + } + if(!strcmp(args[1], "video")) + debuggerIoVideo(); + else if(!strcmp(args[1], "video2")) + debuggerIoVideo2(); + else if(!strcmp(args[1], "dma")) + debuggerIoDMA(); + else if(!strcmp(args[1], "timer")) + debuggerIoTimer(); + else if(!strcmp(args[1], "misc")) + debuggerIoMisc(); + else printf("Unrecognized option %s\n", args[1]); +} + +void debuggerEditByte(int n, char **args) +{ + if(n == 3) { + u32 address; + u32 byte; + sscanf(args[1], "%x", &address); + sscanf(args[2], "%x", &byte); + debuggerWriteByte(address, (u8)byte); + } else + debuggerUsage("eb"); +} + +void debuggerEditHalfWord(int n, char **args) +{ + if(n == 3) { + u32 address; + u32 byte; + sscanf(args[1], "%x", &address); + if(address & 1) { + printf("Error: address must be half-word aligned\n"); + return; + } + sscanf(args[2], "%x", &byte); + debuggerWriteHalfWord(address, (u16)byte); + } else + debuggerUsage("eh"); +} + +void debuggerEdit(int n, char **args) +{ + if(n == 3) { + u32 address; + u32 byte; + sscanf(args[1], "%x", &address); + if(address & 3) { + printf("Error: address must be word aligned\n"); + return; + } + sscanf(args[2], "%x", &byte); + debuggerWriteMemory(address, (u32)byte); + } else + debuggerUsage("ew"); +} + + +#define ASCII(c) (c) < 32 ? '.' : (c) > 127 ? '.' : (c) + +void debuggerMemoryByte(int n, char **args) +{ + if(n == 2) { + u32 addr = 0; + sscanf(args[1], "%x", &addr); + for(int ii = 0; ii < 16; ii++) { + int a = debuggerReadByte(addr); + int b = debuggerReadByte(addr+1); + int c = debuggerReadByte(addr+2); + int d = debuggerReadByte(addr+3); + int e = debuggerReadByte(addr+4); + int f = debuggerReadByte(addr+5); + int g = debuggerReadByte(addr+6); + int h = debuggerReadByte(addr+7); + int i = debuggerReadByte(addr+8); + int j = debuggerReadByte(addr+9); + int k = debuggerReadByte(addr+10); + int l = debuggerReadByte(addr+11); + int m = debuggerReadByte(addr+12); + int n = debuggerReadByte(addr+13); + int o = debuggerReadByte(addr+14); + int p = debuggerReadByte(addr+15); + + printf("%08x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", + addr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p, + ASCII(a),ASCII(b),ASCII(c),ASCII(d), + ASCII(e),ASCII(f),ASCII(g),ASCII(h), + ASCII(i),ASCII(j),ASCII(k),ASCII(l), + ASCII(m),ASCII(n),ASCII(o),ASCII(p)); + addr += 16; + } + } else + debuggerUsage("mb"); +} + +void debuggerMemoryHalfWord(int n, char **args) +{ + if(n == 2) { + u32 addr = 0; + sscanf(args[1], "%x", &addr); + addr = addr & 0xfffffffe; + for(int ii = 0; ii < 16; ii++) { + int a = debuggerReadByte(addr); + int b = debuggerReadByte(addr+1); + int c = debuggerReadByte(addr+2); + int d = debuggerReadByte(addr+3); + int e = debuggerReadByte(addr+4); + int f = debuggerReadByte(addr+5); + int g = debuggerReadByte(addr+6); + int h = debuggerReadByte(addr+7); + int i = debuggerReadByte(addr+8); + int j = debuggerReadByte(addr+9); + int k = debuggerReadByte(addr+10); + int l = debuggerReadByte(addr+11); + int m = debuggerReadByte(addr+12); + int n = debuggerReadByte(addr+13); + int o = debuggerReadByte(addr+14); + int p = debuggerReadByte(addr+15); + + printf("%08x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", + addr,b,a,d,c,f,e,h,g,j,i,l,k,n,m,p,o, + ASCII(a),ASCII(b),ASCII(c),ASCII(d), + ASCII(e),ASCII(f),ASCII(g),ASCII(h), + ASCII(i),ASCII(j),ASCII(k),ASCII(l), + ASCII(m),ASCII(n),ASCII(o),ASCII(p)); + addr += 16; + } + } else + debuggerUsage("mh"); +} + +void debuggerMemory(int n, char **args) +{ + if(n == 2) { + u32 addr = 0; + sscanf(args[1], "%x", &addr); + addr = addr & 0xfffffffc; + for(int ii = 0; ii < 16; ii++) { + int a = debuggerReadByte(addr); + int b = debuggerReadByte(addr+1); + int c = debuggerReadByte(addr+2); + int d = debuggerReadByte(addr+3); + + int e = debuggerReadByte(addr+4); + int f = debuggerReadByte(addr+5); + int g = debuggerReadByte(addr+6); + int h = debuggerReadByte(addr+7); + + int i = debuggerReadByte(addr+8); + int j = debuggerReadByte(addr+9); + int k = debuggerReadByte(addr+10); + int l = debuggerReadByte(addr+11); + + int m = debuggerReadByte(addr+12); + int n = debuggerReadByte(addr+13); + int o = debuggerReadByte(addr+14); + int p = debuggerReadByte(addr+15); + + printf("%08x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", + addr,d,c,b,a,h,g,f,e,l,k,j,i,p,o,n,m, + ASCII(a),ASCII(b),ASCII(c),ASCII(d), + ASCII(e),ASCII(f),ASCII(g),ASCII(h), + ASCII(i),ASCII(j),ASCII(k),ASCII(l), + ASCII(m),ASCII(n),ASCII(o),ASCII(p)); + addr += 16; + } + } else + debuggerUsage("mw"); +} + +void debuggerQuit(int, char **) +{ + char buffer[10]; + printf("Are you sure you want to quit (y/n)? "); + fgets(buffer, 1024, stdin); + + if(buffer[0] == 'y' || buffer[0] == 'Y') { + debugger = false; + emulating = false; + } +} + +void debuggerOutput(char *s, u32 addr) +{ + if(s) + printf(s); + else { + char c; + + c = debuggerReadByte(addr); + addr++; + while(c) { + putchar(c); + c = debuggerReadByte(addr); + addr++; + } + } +} + +void debuggerMain() +{ + char buffer[1024]; + char *commands[10]; + int commandCount = 0; + + if(emulator.emuUpdateCPSR) + emulator.emuUpdateCPSR(); + debuggerRegisters(0, NULL); + + while(debugger) { + systemSoundPause(); + printf("debugger> "); + commandCount = 0; + char *s = fgets(buffer, 1024, stdin); + + commands[0] = strtok(s, " \t\n"); + if(commands[0] == NULL) + continue; + commandCount++; + while((s = strtok(NULL, " \t\n"))) { + commands[commandCount++] = s; + if(commandCount == 10) + break; + } + + for(int j = 0; ; j++) { + if(debuggerCommands[j].name == NULL) { + printf("Unrecognized command %s. Type h for help.\n", commands[0]); + break; + } + if(!strcmp(commands[0], debuggerCommands[j].name)) { + debuggerCommands[j].function(commandCount, commands); + break; + } + } + } +} diff --git a/src/sdl/debugger.h b/src/sdl/debugger.h new file mode 100644 index 0000000..695ed21 --- /dev/null +++ b/src/sdl/debugger.h @@ -0,0 +1,20 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +extern void debuggerMain(); diff --git a/src/simple2x.cpp b/src/simple2x.cpp new file mode 100644 index 0000000..17b3f04 --- /dev/null +++ b/src/simple2x.cpp @@ -0,0 +1,106 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "System.h" + +void Simple2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + + finish = (u8 *) bP + ((width+2) << 1); + currentPixel = *bP++; + + do { +#ifdef WORDS_BIGENDIAN + u32 color = currentPixel >> 16; +#else + u32 color = currentPixel & 0xffff; +#endif + + color = color | (color << 16); + + *(dP) = color; + *(nL) = color; + +#ifdef WORDS_BIGENDIAN + color = currentPixel & 0xffff; +#else + color = currentPixel >> 16; +#endif + color = color| (color << 16); + *(dP + 1) = color; + *(nL + 1) = color; + + currentPixel = *bP++; + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} + +void Simple2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ + u8 *nextLine, *finish; + + nextLine = dstPtr + dstPitch; + + do { + u32 *bP = (u32 *) srcPtr; + u32 *dP = (u32 *) dstPtr; + u32 *nL = (u32 *) nextLine; + u32 currentPixel; + + finish = (u8 *) bP + ((width+1) << 2); + currentPixel = *bP++; + + do { + u32 color = currentPixel; + + *(dP) = color; + *(dP+1) = color; + *(nL) = color; + *(nL + 1) = color; + + currentPixel = *bP++; + + dP += 2; + nL += 2; + } while ((u8 *) bP < finish); + + srcPtr += srcPitch; + dstPtr += dstPitch << 1; + nextLine += dstPitch << 1; + } + while (--height); +} diff --git a/src/thumb.h b/src/thumb.h new file mode 100644 index 0000000..41333a2 --- /dev/null +++ b/src/thumb.h @@ -0,0 +1,2474 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifdef C_CORE +#define NEG(i) ((i) >> 31) +#define POS(i) ((~(i)) >> 31) +#define ADDCARRY(a, b, c) \ + C_FLAG = ((NEG(a) & NEG(b)) |\ + (NEG(a) & POS(c)) |\ + (NEG(b) & POS(c))) ? true : false; +#define ADDOVERFLOW(a, b, c) \ + V_FLAG = ((NEG(a) & NEG(b) & POS(c)) |\ + (POS(a) & POS(b) & NEG(c))) ? true : false; +#define SUBCARRY(a, b, c) \ + C_FLAG = ((NEG(a) & POS(b)) |\ + (NEG(a) & POS(c)) |\ + (POS(b) & POS(c))) ? true : false; +#define SUBOVERFLOW(a, b, c)\ + V_FLAG = ((NEG(a) & POS(b) & POS(c)) |\ + (POS(a) & NEG(b) & NEG(c))) ? true : false; +#define ADD_RD_RS_RN \ + {\ + u32 lhs = reg[source].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define ADD_RD_RS_O3 \ + {\ + u32 lhs = reg[source].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define ADD_RN_O8(d) \ + {\ + u32 lhs = reg[(d)].I;\ + u32 rhs = (opcode & 255);\ + u32 res = lhs + rhs;\ + reg[(d)].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define CMN_RD_RS \ + {\ + u32 lhs = reg[dest].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define ADC_RD_RS \ + {\ + u32 lhs = reg[dest].I;\ + u32 rhs = value;\ + u32 res = lhs + rhs + (u32)C_FLAG;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + ADDCARRY(lhs, rhs, res);\ + ADDOVERFLOW(lhs, rhs, res);\ + } +#define SUB_RD_RS_RN \ + {\ + u32 lhs = reg[source].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define SUB_RD_RS_O3 \ + {\ + u32 lhs = reg[source].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define SUB_RN_O8(d) \ + {\ + u32 lhs = reg[(d)].I;\ + u32 rhs = (opcode & 255);\ + u32 res = lhs - rhs;\ + reg[(d)].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define CMP_RN_O8(d) \ + {\ + u32 lhs = reg[(d)].I;\ + u32 rhs = (opcode & 255);\ + u32 res = lhs - rhs;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define SBC_RD_RS \ + {\ + u32 lhs = reg[dest].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs - !((u32)C_FLAG);\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#define LSL_RD_RM_I5 \ + {\ + C_FLAG = (reg[source].I >> (32 - shift)) & 1 ? true : false;\ + value = reg[source].I << shift;\ + } +#define LSL_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (32 - value)) & 1 ? true : false;\ + value = reg[dest].I << value;\ + } +#define LSR_RD_RM_I5 \ + {\ + C_FLAG = (reg[source].I >> (shift - 1)) & 1 ? true : false;\ + value = reg[source].I >> shift;\ + } +#define LSR_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (value - 1)) & 1 ? true : false;\ + value = reg[dest].I >> value;\ + } +#define ASR_RD_RM_I5 \ + {\ + C_FLAG = ((s32)reg[source].I >> (int)(shift - 1)) & 1 ? true : false;\ + value = (s32)reg[source].I >> (int)shift;\ + } +#define ASR_RD_RS \ + {\ + C_FLAG = ((s32)reg[dest].I >> (int)(value - 1)) & 1 ? true : false;\ + value = (s32)reg[dest].I >> (int)value;\ + } +#define ROR_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (value - 1)) & 1 ? true : false;\ + value = ((reg[dest].I << (32 - value)) |\ + (reg[dest].I >> value));\ + } +#define NEG_RD_RS \ + {\ + u32 lhs = reg[source].I;\ + u32 rhs = 0;\ + u32 res = rhs - lhs;\ + reg[dest].I = res;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(rhs, lhs, res);\ + SUBOVERFLOW(rhs, lhs, res);\ + } +#define CMP_RD_RS \ + {\ + u32 lhs = reg[dest].I;\ + u32 rhs = value;\ + u32 res = lhs - rhs;\ + Z_FLAG = (res == 0) ? true : false;\ + N_FLAG = NEG(res) ? true : false;\ + SUBCARRY(lhs, rhs, res);\ + SUBOVERFLOW(lhs, rhs, res);\ + } +#else +#ifdef __GNUC__ +#ifdef __POWERPC__ + #define ADD_RD_RS_RN \ + { \ + register int Flags; \ + register int Result; \ + asm volatile("addco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[source].I), \ + "r" (value) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define ADD_RD_RS_O3 ADD_RD_RS_RN + #define ADD_RN_O8(d) \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("addco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[(d)].I), \ + "r" (opcode & 255) \ + ); \ + reg[(d)].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define CMN_RD_RS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("addco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[dest].I), \ + "r" (value) \ + ); \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define ADC_RD_RS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("mtspr xer, %4\n" \ + "addeo. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[dest].I), \ + "r" (value), \ + "r" (C_FLAG << 29) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define SUB_RD_RS_RN \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[source].I), \ + "r" (value) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define SUB_RD_RS_O3 SUB_RD_RS_RN + #define SUB_RN_O8(d) \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[(d)].I), \ + "r" (opcode & 255) \ + ); \ + reg[(d)].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define CMP_RN_O8(d) \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[(d)].I), \ + "r" (opcode & 255) \ + ); \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define SBC_RD_RS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("mtspr xer, %4\n" \ + "subfeo. %0, %3, %2\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[dest].I), \ + "r" (value), \ + "r" (C_FLAG << 29) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define LSL_RD_RM_I5 \ + {\ + C_FLAG = (reg[source].I >> (32 - shift)) & 1 ? true : false;\ + value = reg[source].I << shift;\ + } + #define LSL_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (32 - value)) & 1 ? true : false;\ + value = reg[dest].I << value;\ + } + #define LSR_RD_RM_I5 \ + {\ + C_FLAG = (reg[source].I >> (shift - 1)) & 1 ? true : false;\ + value = reg[source].I >> shift;\ + } + #define LSR_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (value - 1)) & 1 ? true : false;\ + value = reg[dest].I >> value;\ + } + #define ASR_RD_RM_I5 \ + {\ + C_FLAG = ((s32)reg[source].I >> (int)(shift - 1)) & 1 ? true : false;\ + value = (s32)reg[source].I >> (int)shift;\ + } + #define ASR_RD_RS \ + {\ + C_FLAG = ((s32)reg[dest].I >> (int)(value - 1)) & 1 ? true : false;\ + value = (s32)reg[dest].I >> (int)value;\ + } + #define ROR_RD_RS \ + {\ + C_FLAG = (reg[dest].I >> (value - 1)) & 1 ? true : false;\ + value = ((reg[dest].I << (32 - value)) |\ + (reg[dest].I >> value));\ + } + #define NEG_RD_RS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subfco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[source].I), \ + "r" (0) \ + ); \ + reg[dest].I = Result; \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } + #define CMP_RD_RS \ + {\ + register int Flags; \ + register int Result; \ + asm volatile("subco. %0, %2, %3\n" \ + "mcrxr cr1\n" \ + "mfcr %1\n" \ + : "=r" (Result), \ + "=r" (Flags) \ + : "r" (reg[dest].I), \ + "r" (value) \ + ); \ + Z_FLAG = (Flags >> 29) & 1; \ + N_FLAG = (Flags >> 31) & 1; \ + C_FLAG = (Flags >> 25) & 1; \ + V_FLAG = (Flags >> 26) & 1; \ + } +#else +#define ADD_RD_RS_RN \ + asm ("add %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[source].I)); +#define ADD_RD_RS_O3 \ + asm ("add %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[source].I)); +#define ADD_RN_O8(d) \ + asm ("add %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[(d)].I)\ + : "r" (opcode & 255), "b" (reg[(d)].I)); +#define CMN_RD_RS \ + asm ("add %0, %1;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : \ + : "r" (value), "r" (reg[dest].I):"1"); +#define ADC_RD_RS \ + asm ("bt $0, C_FLAG;"\ + "adc %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setcb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[dest].I)); +#define SUB_RD_RS_RN \ + asm ("sub %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[source].I)); +#define SUB_RD_RS_O3 \ + asm ("sub %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[source].I)); +#define SUB_RN_O8(d) \ + asm ("sub %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[(d)].I)\ + : "r" (opcode & 255), "b" (reg[(d)].I)); +#define CMP_RN_O8(d) \ + asm ("sub %0, %1;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : \ + : "r" (opcode & 255), "r" (reg[(d)].I) : "1"); +#define SBC_RD_RS \ + asm volatile ("bt $0, C_FLAG;"\ + "cmc;"\ + "sbb %1, %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "r" (value), "b" (reg[dest].I) : "cc", "memory"); +#define LSL_RD_RM_I5 \ + asm ("shl %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[source].I), "c" (shift)); +#define LSL_RD_RS \ + asm ("shl %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[dest].I), "c" (value)); +#define LSR_RD_RM_I5 \ + asm ("shr %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[source].I), "c" (shift)); +#define LSR_RD_RS \ + asm ("shr %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[dest].I), "c" (value)); +#define ASR_RD_RM_I5 \ + asm ("sar %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[source].I), "c" (shift)); +#define ASR_RD_RS \ + asm ("sar %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[dest].I), "c" (value)); +#define ROR_RD_RS \ + asm ("ror %%cl, %%eax;"\ + "setcb C_FLAG;"\ + : "=a" (value)\ + : "a" (reg[dest].I), "c" (value)); +#define NEG_RD_RS \ + asm ("neg %%ebx;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : "=b" (reg[dest].I)\ + : "b" (reg[source].I)); +#define CMP_RD_RS \ + asm ("sub %0, %1;"\ + "setsb N_FLAG;"\ + "setzb Z_FLAG;"\ + "setncb C_FLAG;"\ + "setob V_FLAG;"\ + : \ + : "r" (value), "r" (reg[dest].I):"1"); +#endif +#else +#define ADD_RD_RS_RN \ + {\ + __asm mov eax, source\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm add ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define ADD_RD_RS_O3 \ + {\ + __asm mov eax, source\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm add ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define ADD_RN_O8(d) \ + {\ + __asm mov ebx, opcode\ + __asm and ebx, 255\ + __asm add dword ptr [OFFSET reg+4*(d)], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define CMN_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm add ebx, value\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define ADC_RD_RS \ + {\ + __asm mov ebx, dest\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm bt word ptr C_FLAG, 0\ + __asm adc ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define SUB_RD_RS_RN \ + {\ + __asm mov eax, source\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm sub ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define SUB_RD_RS_O3 \ + {\ + __asm mov eax, source\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm sub ebx, value\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define SUB_RN_O8(d) \ + {\ + __asm mov ebx, opcode\ + __asm and ebx, 255\ + __asm sub dword ptr [OFFSET reg + 4*(d)], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define CMP_RN_O8(d) \ + {\ + __asm mov eax, dword ptr [OFFSET reg+4*(d)]\ + __asm mov ebx, opcode\ + __asm and ebx, 255\ + __asm sub eax, ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define SBC_RD_RS \ + {\ + __asm mov ebx, dest\ + __asm mov ebx, dword ptr [OFFSET reg + 4*ebx]\ + __asm mov eax, value\ + __asm bt word ptr C_FLAG, 0\ + __asm cmc\ + __asm sbb ebx, eax\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg + 4*eax], ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define LSL_RD_RM_I5 \ + {\ + __asm mov eax, source\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shl eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define LSL_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr value\ + __asm shl eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define LSR_RD_RM_I5 \ + {\ + __asm mov eax, source\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr shift\ + __asm shr eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define LSR_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov eax, dword ptr [OFFSET reg + 4 * eax]\ + __asm mov cl, byte ptr value\ + __asm shr eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define ASR_RD_RM_I5 \ + {\ + __asm mov eax, source\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm mov cl, byte ptr shift\ + __asm sar eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define ASR_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm mov cl, byte ptr value\ + __asm sar eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define ROR_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov eax, dword ptr [OFFSET reg + 4*eax]\ + __asm mov cl, byte ptr value\ + __asm ror eax, cl\ + __asm mov value, eax\ + __asm setc byte ptr C_FLAG\ + } +#define NEG_RD_RS \ + {\ + __asm mov ebx, source\ + __asm mov ebx, dword ptr [OFFSET reg+4*ebx]\ + __asm neg ebx\ + __asm mov eax, dest\ + __asm mov dword ptr [OFFSET reg+4*eax],ebx\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#define CMP_RD_RS \ + {\ + __asm mov eax, dest\ + __asm mov ebx, dword ptr [OFFSET reg+4*eax]\ + __asm sub ebx, value\ + __asm sets byte ptr N_FLAG\ + __asm setz byte ptr Z_FLAG\ + __asm setnc byte ptr C_FLAG\ + __asm seto byte ptr V_FLAG\ + } +#endif +#endif + +u32 opcode = CPUReadHalfWordQuick(armNextPC); +clockTicks = thumbCycles[opcode >> 8] + memoryWaitFetch[(armNextPC >> 24) & 15]; +#ifndef FINAL_VERSION +if(armNextPC == stop) { + armNextPC = armNextPC++; +} +#endif + +armNextPC = reg[15].I; +reg[15].I += 2; + +switch(opcode >> 8) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + { + // LSL Rd, Rm, #Imm 5 + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + int shift = (opcode >> 6) & 0x1f; + u32 value; + + if(shift) { + LSL_RD_RM_I5; + } else { + value = reg[source].I; + } + reg[dest].I = value; + // C_FLAG set above + N_FLAG = (value & 0x80000000 ? true : false); + Z_FLAG = (value ? false : true); + } + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + { + // LSR Rd, Rm, #Imm 5 + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + int shift = (opcode >> 6) & 0x1f; + u32 value; + + if(shift) { + LSR_RD_RM_I5; + } else { + C_FLAG = reg[source].I & 0x80000000 ? true : false; + value = 0; + } + reg[dest].I = value; + // C_FLAG set above + N_FLAG = (value & 0x80000000 ? true : false); + Z_FLAG = (value ? false : true); + } + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + { + // ASR Rd, Rm, #Imm 5 + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + int shift = (opcode >> 6) & 0x1f; + u32 value; + + if(shift) { + ASR_RD_RM_I5; + } else { + if(reg[source].I & 0x80000000) { + value = 0xFFFFFFFF; + C_FLAG = true; + } else { + value = 0; + C_FLAG = false; + } + } + reg[dest].I = value; + // C_FLAG set above + N_FLAG = (value & 0x80000000 ? true : false); + Z_FLAG = (value ? false :true); + } + break; + case 0x18: + case 0x19: + { + // ADD Rd, Rs, Rn + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + u32 value = reg[(opcode>>6)& 0x07].I; + ADD_RD_RS_RN; + } + break; + case 0x1a: + case 0x1b: + { + // SUB Rd, Rs, Rn + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + u32 value = reg[(opcode>>6)& 0x07].I; + SUB_RD_RS_RN; + } + break; + case 0x1c: + case 0x1d: + { + // ADD Rd, Rs, #Offset3 + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + u32 value = (opcode >> 6) & 7; + ADD_RD_RS_O3; + } + break; + case 0x1e: + case 0x1f: + { + // SUB Rd, Rs, #Offset3 + int dest = opcode & 0x07; + int source = (opcode >> 3) & 0x07; + u32 value = (opcode >> 6) & 7; + SUB_RD_RS_O3; + } + break; + case 0x20: + // MOV R0, #Offset8 + reg[0].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[0].I ? false : true); + break; + case 0x21: + // MOV R1, #Offset8 + reg[1].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[1].I ? false : true); + break; + case 0x22: + // MOV R2, #Offset8 + reg[2].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[2].I ? false : true); + break; + case 0x23: + // MOV R3, #Offset8 + reg[3].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[3].I ? false : true); + break; + case 0x24: + // MOV R4, #Offset8 + reg[4].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[4].I ? false : true); + break; + case 0x25: + // MOV R5, #Offset8 + reg[5].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[5].I ? false : true); + break; + case 0x26: + // MOV R6, #Offset8 + reg[6].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[6].I ? false : true); + break; + case 0x27: + // MOV R7, #Offset8 + reg[7].I = opcode & 255; + N_FLAG = false; + Z_FLAG = (reg[7].I ? false : true); + break; + case 0x28: + // CMP R0, #Offset8 + CMP_RN_O8(0); + break; + case 0x29: + // CMP R1, #Offset8 + CMP_RN_O8(1); + break; + case 0x2a: + // CMP R2, #Offset8 + CMP_RN_O8(2); + break; + case 0x2b: + // CMP R3, #Offset8 + CMP_RN_O8(3); + break; + case 0x2c: + // CMP R4, #Offset8 + CMP_RN_O8(4); + break; + case 0x2d: + // CMP R5, #Offset8 + CMP_RN_O8(5); + break; + case 0x2e: + // CMP R6, #Offset8 + CMP_RN_O8(6); + break; + case 0x2f: + // CMP R7, #Offset8 + CMP_RN_O8(7); + break; + case 0x30: + // ADD R0,#Offset8 + ADD_RN_O8(0); + break; + case 0x31: + // ADD R1,#Offset8 + ADD_RN_O8(1); + break; + case 0x32: + // ADD R2,#Offset8 + ADD_RN_O8(2); + break; + case 0x33: + // ADD R3,#Offset8 + ADD_RN_O8(3); + break; + case 0x34: + // ADD R4,#Offset8 + ADD_RN_O8(4); + break; + case 0x35: + // ADD R5,#Offset8 + ADD_RN_O8(5); + break; + case 0x36: + // ADD R6,#Offset8 + ADD_RN_O8(6); + break; + case 0x37: + // ADD R7,#Offset8 + ADD_RN_O8(7); + break; + case 0x38: + // SUB R0,#Offset8 + SUB_RN_O8(0); + break; + case 0x39: + // SUB R1,#Offset8 + SUB_RN_O8(1); + break; + case 0x3a: + // SUB R2,#Offset8 + SUB_RN_O8(2); + break; + case 0x3b: + // SUB R3,#Offset8 + SUB_RN_O8(3); + break; + case 0x3c: + // SUB R4,#Offset8 + SUB_RN_O8(4); + break; + case 0x3d: + // SUB R5,#Offset8 + SUB_RN_O8(5); + break; + case 0x3e: + // SUB R6,#Offset8 + SUB_RN_O8(6); + break; + case 0x3f: + // SUB R7,#Offset8 + SUB_RN_O8(7); + break; + case 0x40: + switch((opcode >> 6) & 3) { + case 0x00: + { + // AND Rd, Rs + int dest = opcode & 7; + reg[dest].I &= reg[(opcode >> 3)&7].I; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; +#ifdef BKPT_SUPPORT +#define THUMB_CONSOLE_OUTPUT(a,b) \ + if((opcode == 0x4000) && (reg[0].I == 0xC0DED00D)) {\ + extern void (*dbgOutput)(char *, u32);\ + dbgOutput((a), (b));\ + } +#else +#define THUMB_CONSOLE_OUTPUT(a,b) +#endif + THUMB_CONSOLE_OUTPUT(NULL, reg[2].I); + } + break; + case 0x01: + // EOR Rd, Rs + { + int dest = opcode & 7; + reg[dest].I ^= reg[(opcode >> 3)&7].I; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; + } + break; + case 0x02: + // LSL Rd, Rs + { + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].B.B0; + if(value) { + if(value == 32) { + value = 0; + C_FLAG = (reg[dest].I & 1 ? true : false); + } else if(value < 32) { + LSL_RD_RS; + } else { + value = 0; + C_FLAG = false; + } + reg[dest].I = value; + } + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; + clockTicks++; + } + break; + case 0x03: + { + // LSR Rd, Rs + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].B.B0; + if(value) { + if(value == 32) { + value = 0; + C_FLAG = (reg[dest].I & 0x80000000 ? true : false); + } else if(value < 32) { + LSR_RD_RS; + } else { + value = 0; + C_FLAG = false; + } + reg[dest].I = value; + } + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; + clockTicks++; + } + break; + } + break; + case 0x41: + switch((opcode >> 6) & 3) { + case 0x00: + { + // ASR Rd, Rs + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].B.B0; + // ASR + if(value) { + if(value < 32) { + ASR_RD_RS; + reg[dest].I = value; + } else { + if(reg[dest].I & 0x80000000){ + reg[dest].I = 0xFFFFFFFF; + C_FLAG = true; + } else { + reg[dest].I = 0x00000000; + C_FLAG = false; + } + } + } + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; + clockTicks++; + } + break; + case 0x01: + { + // ADC Rd, Rs + int dest = opcode & 0x07; + u32 value = reg[(opcode >> 3)&7].I; + // ADC + ADC_RD_RS; + } + break; + case 0x02: + { + // SBC Rd, Rs + int dest = opcode & 0x07; + u32 value = reg[(opcode >> 3)&7].I; + + // SBC + SBC_RD_RS; + } + break; + case 0x03: + // ROR Rd, Rs + { + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].B.B0; + + if(value) { + value = value & 0x1f; + if(value == 0) { + C_FLAG = (reg[dest].I & 0x80000000 ? true : false); + } else { + ROR_RD_RS; + reg[dest].I = value; + } + } + clockTicks++; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + Z_FLAG = reg[dest].I ? false : true; + } + break; + } + break; + case 0x42: + switch((opcode >> 6) & 3) { + case 0x00: + { + // TST Rd, Rs + u32 value = reg[opcode & 7].I & reg[(opcode >> 3) & 7].I; + N_FLAG = value & 0x80000000 ? true : false; + Z_FLAG = value ? false : true; + } + break; + case 0x01: + { + // NEG Rd, Rs + int dest = opcode & 7; + int source = (opcode >> 3) & 7; + NEG_RD_RS; + } + break; + case 0x02: + { + // CMP Rd, Rs + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].I; + CMP_RD_RS; + } + break; + case 0x03: + { + // CMN Rd, Rs + int dest = opcode & 7; + u32 value = reg[(opcode >> 3)&7].I; + // CMN + CMN_RD_RS; + } + break; + } + break; + case 0x43: + switch((opcode >> 6) & 3) { + case 0x00: + { + // ORR Rd, Rs + int dest = opcode & 7; + reg[dest].I |= reg[(opcode >> 3) & 7].I; + Z_FLAG = reg[dest].I ? false : true; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + } + break; + case 0x01: + { + // MUL Rd, Rs + int dest = opcode & 7; + u32 rm = reg[(opcode >> 3) & 7].I; + reg[dest].I = reg[dest].I * rm; + if (((s32)rm) < 0) + rm = ~rm; + if ((rm & 0xFFFFFF00) == 0) + clockTicks += 1; + else if ((rm & 0xFFFF0000) == 0) + clockTicks += 2; + else if ((rm & 0xFF000000) == 0) + clockTicks += 3; + else + clockTicks += 4; + Z_FLAG = reg[dest].I ? false : true; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + } + break; + case 0x02: + { + // BIC Rd, Rs + int dest = opcode & 7; + reg[dest].I &= (~reg[(opcode >> 3) & 7].I); + Z_FLAG = reg[dest].I ? false : true; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + } + break; + case 0x03: + { + // MVN Rd, Rs + int dest = opcode & 7; + reg[dest].I = ~reg[(opcode >> 3) & 7].I; + Z_FLAG = reg[dest].I ? false : true; + N_FLAG = reg[dest].I & 0x80000000 ? true : false; + } + break; + } + break; + case 0x44: + { + int dest = opcode & 7; + int base = (opcode >> 3) & 7; + switch((opcode >> 6)& 3) { + default: + goto unknown_thumb; + case 1: + // ADD Rd, Hs + reg[dest].I += reg[base+8].I; + break; + case 2: + // ADD Hd, Rs + reg[dest+8].I += reg[base].I; + if(dest == 7) { + reg[15].I &= 0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks++; + } + break; + case 3: + // ADD Hd, Hs + reg[dest+8].I += reg[base+8].I; + if(dest == 7) { + reg[15].I &= 0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks++; + } + break; + } + } + break; + case 0x45: + { + int dest = opcode & 7; + int base = (opcode >> 3) & 7; + u32 value; + switch((opcode >> 6) & 3) { + case 0: + // CMP Rd, Hs + value = reg[base].I; + CMP_RD_RS; + break; + case 1: + // CMP Rd, Hs + value = reg[base+8].I; + CMP_RD_RS; + break; + case 2: + // CMP Hd, Rs + value = reg[base].I; + dest += 8; + CMP_RD_RS; + break; + case 3: + // CMP Hd, Hs + value = reg[base+8].I; + dest += 8; + CMP_RD_RS; + break; + } + } + break; + case 0x46: + { + int dest = opcode & 7; + int base = (opcode >> 3) & 7; + switch((opcode >> 6) & 3) { + case 0: + // this form should not be used... + // MOV Rd, Rs + reg[dest].I = reg[base].I; + break; + case 1: + // MOV Rd, Hs + reg[dest].I = reg[base+8].I; + break; + case 2: + // MOV Hd, Rs + reg[dest+8].I = reg[base].I; + if(dest == 7) { + reg[15].I &= 0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks++; + } + break; + case 3: + // MOV Hd, Hs + reg[dest+8].I = reg[base+8].I; + if(dest == 7) { + reg[15].I &= 0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks++; + } + break; + } + } + break; + case 0x47: + { + int base = (opcode >> 3) & 7; + switch((opcode >>6) & 3) { + case 0: + // BX Rs + reg[15].I = (reg[base].I) & 0xFFFFFFFE; + if(reg[base].I & 1) { + armState = false; + armNextPC = reg[15].I; + reg[15].I += 2; + } else { + armState = true; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + break; + case 1: + // BX Hs + reg[15].I = (reg[8+base].I) & 0xFFFFFFFE; + if(reg[8+base].I & 1) { + armState = false; + armNextPC = reg[15].I; + reg[15].I += 2; + } else { + armState = true; + reg[15].I &= 0xFFFFFFFC; + armNextPC = reg[15].I; + reg[15].I += 4; + } + break; + default: + goto unknown_thumb; + } + } + break; + case 0x48: + // LDR R0,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[0].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x49: + // LDR R1,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[1].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4a: + // LDR R2,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[2].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4b: + // LDR R3,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[3].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4c: + // LDR R4,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[4].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4d: + // LDR R5,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[5].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4e: + // LDR R6,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[6].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x4f: + // LDR R7,[PC, #Imm] + { + u32 address = (reg[15].I & 0xFFFFFFFC) + ((opcode & 0xFF) << 2); + reg[7].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x50: + case 0x51: + // STR Rd, [Rs, Rn] + { + u32 + address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + CPUWriteMemory(address, + reg[opcode & 7].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x52: + case 0x53: + // STRH Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + CPUWriteHalfWord(address, + reg[opcode&7].W.W0); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x54: + case 0x55: + // STRB Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode >>6)&7].I; + CPUWriteByte(address, + reg[opcode & 7].B.B0); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x56: + case 0x57: + // LDSB Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + reg[opcode&7].I = (s8)CPUReadByte(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x58: + case 0x59: + // LDR Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + reg[opcode&7].I = CPUReadMemory(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x5a: + case 0x5b: + // LDRH Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + reg[opcode&7].I = CPUReadHalfWord(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x5c: + case 0x5d: + // LDRB Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + reg[opcode&7].I = CPUReadByte(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x5e: + case 0x5f: + // LDSH Rd, [Rs, Rn] + { + u32 address = reg[(opcode>>3)&7].I + reg[(opcode>>6)&7].I; + reg[opcode&7].I = (s16)CPUReadHalfWordSigned(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + // STR Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)<<2); + CPUWriteMemory(address, + reg[opcode&7].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + // LDR Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)<<2); + reg[opcode&7].I = CPUReadMemory(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + // STRB Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)); + CPUWriteByte(address, + reg[opcode&7].B.B0); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x78: + case 0x79: + case 0x7a: + case 0x7b: + case 0x7c: + case 0x7d: + case 0x7e: + case 0x7f: + // LDRB Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)); + reg[opcode&7].I = CPUReadByte(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x80: + case 0x81: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + // STRH Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)<<1); + CPUWriteHalfWord(address, + reg[opcode&7].W.W0); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x88: + case 0x89: + case 0x8a: + case 0x8b: + case 0x8c: + case 0x8d: + case 0x8e: + case 0x8f: + // LDRH Rd, [Rs, #Imm] + { + u32 address = reg[(opcode>>3)&7].I + (((opcode>>6)&31)<<1); + reg[opcode&7].I = CPUReadHalfWord(address); + clockTicks += CPUUpdateTicksAccess16(address); + } + break; + case 0x90: + // STR R0, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[0].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x91: + // STR R1, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[1].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x92: + // STR R2, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[2].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x93: + // STR R3, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[3].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x94: + // STR R4, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[4].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x95: + // STR R5, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[5].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x96: + // STR R6, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[6].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x97: + // STR R7, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + CPUWriteMemory(address, reg[7].I); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x98: + // LDR R0, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[0].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x99: + // LDR R1, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[1].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9a: + // LDR R2, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[2].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9b: + // LDR R3, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[3].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9c: + // LDR R4, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[4].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9d: + // LDR R5, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[5].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9e: + // LDR R6, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[6].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0x9f: + // LDR R7, [SP, #Imm] + { + u32 address = reg[13].I + ((opcode&255)<<2); + reg[7].I = CPUReadMemoryQuick(address); + clockTicks += CPUUpdateTicksAccess32(address); + } + break; + case 0xa0: + // ADD R0, PC, Imm + reg[0].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa1: + // ADD R1, PC, Imm + reg[1].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa2: + // ADD R2, PC, Imm + reg[2].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa3: + // ADD R3, PC, Imm + reg[3].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa4: + // ADD R4, PC, Imm + reg[4].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa5: + // ADD R5, PC, Imm + reg[5].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa6: + // ADD R6, PC, Imm + reg[6].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa7: + // ADD R7, PC, Imm + reg[7].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); + break; + case 0xa8: + // ADD R0, SP, Imm + reg[0].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xa9: + // ADD R1, SP, Imm + reg[1].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xaa: + // ADD R2, SP, Imm + reg[2].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xab: + // ADD R3, SP, Imm + reg[3].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xac: + // ADD R4, SP, Imm + reg[4].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xad: + // ADD R5, SP, Imm + reg[5].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xae: + // ADD R6, SP, Imm + reg[6].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xaf: + // ADD R7, SP, Imm + reg[7].I = reg[13].I + ((opcode&255)<<2); + break; + case 0xb0: + { + // ADD SP, Imm + int offset = (opcode & 127) << 2; + if(opcode & 0x80) + offset = -offset; + reg[13].I += offset; + } + break; +#define PUSH_REG(val, r) \ + if(opcode & (val)) {\ + CPUWriteMemory(address, reg[(r)].I);\ + if(offset)\ + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address);\ + else\ + clockTicks += 1 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + address += 4;\ + } + case 0xb4: + // PUSH {Rlist} + { + int offset = 0; + u32 temp = reg[13].I - 4 * cpuBitsSet[opcode & 0xff]; + u32 address = temp & 0xFFFFFFFC; + PUSH_REG(1, 0); + PUSH_REG(2, 1); + PUSH_REG(4, 2); + PUSH_REG(8, 3); + PUSH_REG(16, 4); + PUSH_REG(32, 5); + PUSH_REG(64, 6); + PUSH_REG(128, 7); + reg[13].I = temp; + } + break; + case 0xb5: + // PUSH {Rlist, LR} + { + int offset = 0; + u32 temp = reg[13].I - 4 - 4 * cpuBitsSet[opcode & 0xff]; + u32 address = temp & 0xFFFFFFFC; + PUSH_REG(1, 0); + PUSH_REG(2, 1); + PUSH_REG(4, 2); + PUSH_REG(8, 3); + PUSH_REG(16, 4); + PUSH_REG(32, 5); + PUSH_REG(64, 6); + PUSH_REG(128, 7); + PUSH_REG(256, 14); + reg[13].I = temp; + } + break; +#define POP_REG(val, r) \ + if(opcode & (val)) {\ + reg[(r)].I = CPUReadMemory(address);\ + if(offset)\ + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address);\ + else\ + clockTicks += 2 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + address += 4;\ + } + case 0xbc: + // POP {Rlist} + { + int offset = 0; + u32 address = reg[13].I & 0xFFFFFFFC; + u32 temp = reg[13].I + 4*cpuBitsSet[opcode & 0xFF]; + POP_REG(1, 0); + POP_REG(2, 1); + POP_REG(4, 2); + POP_REG(8, 3); + POP_REG(16, 4); + POP_REG(32, 5); + POP_REG(64, 6); + POP_REG(128, 7); + reg[13].I = temp; + } + break; + case 0xbd: + // POP {Rlist, PC} + { + int offset = 0; + u32 address = reg[13].I & 0xFFFFFFFC; + u32 temp = reg[13].I + 4 + 4*cpuBitsSet[opcode & 0xFF]; + POP_REG(1, 0); + POP_REG(2, 1); + POP_REG(4, 2); + POP_REG(8, 3); + POP_REG(16, 4); + POP_REG(32, 5); + POP_REG(64, 6); + POP_REG(128, 7); + reg[15].I = (CPUReadMemory(address) & 0xFFFFFFFE); + if(offset) + clockTicks += CPUUpdateTicksAccessSeq32(address); + else + clockTicks += CPUUpdateTicksAccess32(address); + armNextPC = reg[15].I; + reg[15].I += 2; + reg[13].I = temp; + } + break; +#define THUMB_STM_REG(val,r,b) \ + if(opcode & (val)) {\ + CPUWriteMemory(address, reg[(r)].I);\ + if(!offset) {\ + reg[(b)].I = temp;\ + clockTicks += 1 + CPUUpdateTicksAccess32(address);\ + } else \ + clockTicks += 1 + CPUUpdateTicksAccessSeq32(address);\ + offset = 1;\ + address += 4;\ + } + case 0xc0: + { + // STM R0!, {Rlist} + u32 address = reg[0].I & 0xFFFFFFFC; + u32 temp = reg[0].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 0); + THUMB_STM_REG(2, 1, 0); + THUMB_STM_REG(4, 2, 0); + THUMB_STM_REG(8, 3, 0); + THUMB_STM_REG(16, 4, 0); + THUMB_STM_REG(32, 5, 0); + THUMB_STM_REG(64, 6, 0); + THUMB_STM_REG(128, 7, 0); + } + break; + case 0xc1: + { + // STM R1!, {Rlist} + u32 address = reg[1].I & 0xFFFFFFFC; + u32 temp = reg[1].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 1); + THUMB_STM_REG(2, 1, 1); + THUMB_STM_REG(4, 2, 1); + THUMB_STM_REG(8, 3, 1); + THUMB_STM_REG(16, 4, 1); + THUMB_STM_REG(32, 5, 1); + THUMB_STM_REG(64, 6, 1); + THUMB_STM_REG(128, 7, 1); + } + break; + case 0xc2: + { + // STM R2!, {Rlist} + u32 address = reg[2].I & 0xFFFFFFFC; + u32 temp = reg[2].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 2); + THUMB_STM_REG(2, 1, 2); + THUMB_STM_REG(4, 2, 2); + THUMB_STM_REG(8, 3, 2); + THUMB_STM_REG(16, 4, 2); + THUMB_STM_REG(32, 5, 2); + THUMB_STM_REG(64, 6, 2); + THUMB_STM_REG(128, 7, 2); + } + break; + case 0xc3: + { + // STM R3!, {Rlist} + u32 address = reg[3].I & 0xFFFFFFFC; + u32 temp = reg[3].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 3); + THUMB_STM_REG(2, 1, 3); + THUMB_STM_REG(4, 2, 3); + THUMB_STM_REG(8, 3, 3); + THUMB_STM_REG(16, 4, 3); + THUMB_STM_REG(32, 5, 3); + THUMB_STM_REG(64, 6, 3); + THUMB_STM_REG(128, 7, 3); + } + break; + case 0xc4: + { + // STM R4!, {Rlist} + u32 address = reg[4].I & 0xFFFFFFFC; + u32 temp = reg[4].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 4); + THUMB_STM_REG(2, 1, 4); + THUMB_STM_REG(4, 2, 4); + THUMB_STM_REG(8, 3, 4); + THUMB_STM_REG(16, 4, 4); + THUMB_STM_REG(32, 5, 4); + THUMB_STM_REG(64, 6, 4); + THUMB_STM_REG(128, 7, 4); + } + break; + case 0xc5: + { + // STM R5!, {Rlist} + u32 address = reg[5].I & 0xFFFFFFFC; + u32 temp = reg[5].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 5); + THUMB_STM_REG(2, 1, 5); + THUMB_STM_REG(4, 2, 5); + THUMB_STM_REG(8, 3, 5); + THUMB_STM_REG(16, 4, 5); + THUMB_STM_REG(32, 5, 5); + THUMB_STM_REG(64, 6, 5); + THUMB_STM_REG(128, 7, 5); + } + break; + case 0xc6: + { + // STM R6!, {Rlist} + u32 address = reg[6].I & 0xFFFFFFFC; + u32 temp = reg[6].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 6); + THUMB_STM_REG(2, 1, 6); + THUMB_STM_REG(4, 2, 6); + THUMB_STM_REG(8, 3, 6); + THUMB_STM_REG(16, 4, 6); + THUMB_STM_REG(32, 5, 6); + THUMB_STM_REG(64, 6, 6); + THUMB_STM_REG(128, 7, 6); + } + break; + case 0xc7: + { + // STM R7!, {Rlist} + u32 address = reg[7].I & 0xFFFFFFFC; + u32 temp = reg[7].I + 4*cpuBitsSet[opcode & 0xff]; + int offset = 0; + // store + THUMB_STM_REG(1, 0, 7); + THUMB_STM_REG(2, 1, 7); + THUMB_STM_REG(4, 2, 7); + THUMB_STM_REG(8, 3, 7); + THUMB_STM_REG(16, 4, 7); + THUMB_STM_REG(32, 5, 7); + THUMB_STM_REG(64, 6, 7); + THUMB_STM_REG(128, 7, 7); + } + break; +#define THUMB_LDM_REG(val,r) \ + if(opcode & (val)) {\ + reg[(r)].I = CPUReadMemory(address);\ + if(offset)\ + clockTicks += 2 + CPUUpdateTicksAccessSeq32(address);\ + else\ + clockTicks += 2 + CPUUpdateTicksAccess32(address);\ + offset = 1;\ + address += 4;\ + } + case 0xc8: + { + // LDM R0!, {Rlist} + u32 address = reg[0].I & 0xFFFFFFFC; + u32 temp = reg[0].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 1)) + reg[0].I = temp; + } + break; + case 0xc9: + { + // LDM R1!, {Rlist} + u32 address = reg[1].I & 0xFFFFFFFC; + u32 temp = reg[1].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 2)) + reg[1].I = temp; + } + break; + case 0xca: + { + // LDM R2!, {Rlist} + u32 address = reg[2].I & 0xFFFFFFFC; + u32 temp = reg[2].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 4)) + reg[2].I = temp; + } + break; + case 0xcb: + { + // LDM R3!, {Rlist} + u32 address = reg[3].I & 0xFFFFFFFC; + u32 temp = reg[3].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 8)) + reg[3].I = temp; + } + break; + case 0xcc: + { + // LDM R4!, {Rlist} + u32 address = reg[4].I & 0xFFFFFFFC; + u32 temp = reg[4].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 16)) + reg[4].I = temp; + } + break; + case 0xcd: + { + // LDM R5!, {Rlist} + u32 address = reg[5].I & 0xFFFFFFFC; + u32 temp = reg[5].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 32)) + reg[5].I = temp; + } + break; + case 0xce: + { + // LDM R6!, {Rlist} + u32 address = reg[6].I & 0xFFFFFFFC; + u32 temp = reg[6].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 64)) + reg[6].I = temp; + } + break; + case 0xcf: + { + // LDM R7!, {Rlist} + u32 address = reg[7].I & 0xFFFFFFFC; + u32 temp = reg[7].I + 4*cpuBitsSet[opcode & 0xFF]; + int offset = 0; + // load + THUMB_LDM_REG(1, 0); + THUMB_LDM_REG(2, 1); + THUMB_LDM_REG(4, 2); + THUMB_LDM_REG(8, 3); + THUMB_LDM_REG(16, 4); + THUMB_LDM_REG(32, 5); + THUMB_LDM_REG(64, 6); + THUMB_LDM_REG(128, 7); + if(!(opcode & 128)) + reg[7].I = temp; + } + break; + case 0xd0: + // BEQ offset + if(Z_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd1: + // BNE offset + if(!Z_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd2: + // BCS offset + if(C_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd3: + // BCC offset + if(!C_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd4: + // BMI offset + if(N_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd5: + // BPL offset + if(!N_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd6: + // BVS offset + if(V_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd7: + // BVC offset + if(!V_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd8: + // BHI offset + if(C_FLAG && !Z_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xd9: + // BLS offset + if(!C_FLAG || Z_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xda: + // BGE offset + if(N_FLAG == V_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xdb: + // BLT offset + if(N_FLAG != V_FLAG) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xdc: + // BGT offset + if(!Z_FLAG && (N_FLAG == V_FLAG)) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xdd: + // BLE offset + if(Z_FLAG || (N_FLAG != V_FLAG)) { + reg[15].I += ((s8)(opcode & 0xFF)) << 1; + armNextPC = reg[15].I; + reg[15].I += 2; + clockTicks = 3; + } + break; + case 0xdf: + // SWI #comment + CPUSoftwareInterrupt(opcode & 0xFF); + break; + case 0xe0: + case 0xe1: + case 0xe2: + case 0xe3: + case 0xe4: + case 0xe5: + case 0xe6: + case 0xe7: + { + // B offset + int offset = (opcode & 0x3FF) << 1; + if(opcode & 0x0400) + offset |= 0xFFFFF800; + reg[15].I += offset; + armNextPC = reg[15].I; + reg[15].I += 2; + } + break; + case 0xf0: + case 0xf1: + case 0xf2: + case 0xf3: + { + // BLL #offset + int offset = (opcode & 0x7FF); + reg[14].I = reg[15].I + (offset << 12); + } + break; + case 0xf4: + case 0xf5: + case 0xf6: + case 0xf7: + { + // BLL #offset + int offset = (opcode & 0x7FF); + reg[14].I = reg[15].I + ((offset << 12) | 0xFF800000); + } + break; + case 0xf8: + case 0xf9: + case 0xfa: + case 0xfb: + case 0xfc: + case 0xfd: + case 0xfe: + case 0xff: + { + // BLH #offset + int offset = (opcode & 0x7FF); + u32 temp = reg[15].I-2; + reg[15].I = (reg[14].I + (offset<<1))&0xFFFFFFFE; + armNextPC = reg[15].I; + reg[15].I += 2; + reg[14].I = temp|1; + } + break; +#ifdef BKPT_SUPPORT + case 0xbe: + // BKPT #comment + extern void (*dbgSignal)(int,int); + reg[15].I -= 2; + armNextPC -= 2; + dbgSignal(5, opcode & 255); + return; +#endif + case 0xb1: + case 0xb2: + case 0xb3: + case 0xb6: + case 0xb7: + case 0xb8: + case 0xb9: + case 0xba: + case 0xbb: +#ifndef BKPT_SUPPORT + case 0xbe: +#endif + case 0xbf: + case 0xde: + default: + unknown_thumb: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_UNDEFINED) + log("Undefined THUMB instruction %04x at %08x\n", opcode, armNextPC-2); +#endif + CPUUndefinedException(); + break; +} diff --git a/src/unzip.cpp b/src/unzip.cpp new file mode 100644 index 0000000..98c50e9 --- /dev/null +++ b/src/unzip.cpp @@ -0,0 +1,1270 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/* unzip.c -- IO on .zip files using zlib + Version 0.15 beta, Mar 19th, 1998, + + Read unzip.h for more info +*/ + + +#include +#include +#include +#include "zlib.h" +#include "unzip.h" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + + + +#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ + !defined(CASESENSITIVITYDEFAULT_NO) +#define CASESENSITIVITYDEFAULT_NO +#endif + + +#ifndef UNZ_BUFSIZE +#define UNZ_BUFSIZE (16384) +#endif + +#ifndef UNZ_MAXFILENAMEINZIP +#define UNZ_MAXFILENAMEINZIP (256) +#endif + +#ifndef ALLOC +# define ALLOC(size) (malloc(size)) +#endif +#ifndef TRYFREE +# define TRYFREE(p) {if (p) free(p);} +#endif + +#define SIZECENTRALDIRITEM (0x2e) +#define SIZEZIPLOCALHEADER (0x1e) + + +/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef SEEK_END +#define SEEK_END 2 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +const char unz_copyright[] = + " unzip 0.15 Copyright 1998 Gilles Vollant "; + +/* unz_file_info_interntal contain internal info about a file in zipfile*/ +typedef struct unz_file_info_internal_s +{ + uLong offset_curfile;/* relative offset of local header 4 bytes */ +} unz_file_info_internal; + + +/* file_in_zip_read_info_s contain internal information about a file in zipfile, + when reading and decompress it */ +typedef struct +{ + char *read_buffer; /* internal buffer for compressed data */ + z_stream stream; /* zLib stream structure for inflate */ + + uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ + uLong stream_initialised; /* flag set if stream structure is initialised*/ + + uLong offset_local_extrafield;/* offset of the local extra field */ + uInt size_local_extrafield;/* size of the local extra field */ + uLong pos_local_extrafield; /* position in the local extra field in read*/ + + uLong crc32; /* crc32 of all data uncompressed */ + uLong crc32_wait; /* crc32 we must obtain after decompress all */ + uLong rest_read_compressed; /* number of byte to be decompressed */ + uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ + FILE* file; /* io structore of the zipfile */ + uLong compression_method; /* compression method (0==store) */ + uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ +} file_in_zip_read_info_s; + + +/* unz_s contain internal information about the zipfile +*/ +typedef struct +{ + FILE* file; /* io structore of the zipfile */ + unz_global_info gi; /* public global information */ + uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + uLong num_file; /* number of the current file in the zipfile*/ + uLong pos_in_central_dir; /* pos of the current file in the central dir*/ + uLong current_file_ok; /* flag about the usability of the current file*/ + uLong central_pos; /* position of the beginning of the central dir*/ + + uLong size_central_dir; /* size of the central directory */ + uLong offset_central_dir; /* offset of start of central directory with + respect to the starting disk number */ + + unz_file_info cur_file_info; /* public info about the current file in zip*/ + unz_file_info_internal cur_file_info_internal; /* private info about it*/ + file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current + file if we are decompressing it */ +} unz_s; + + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ + + +local int unzlocal_getByte(FILE *fin,int *pi) +{ + unsigned char c; + int err = fread(&c, 1, 1, fin); + if (err==1) + { + *pi = (int)c; + return UNZ_OK; + } + else + { + if (ferror(fin)) + return UNZ_ERRNO; + else + return UNZ_EOF; + } +} + + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets +*/ +local int unzlocal_getShort (FILE *fin,uLong *pX) +{ + uLong x ; + int i; + int err; + + err = unzlocal_getByte(fin,&i); + x = (uLong)i; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<8; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int unzlocal_getLong (FILE *fin,uLong *pX) +{ + uLong x ; + int i; + int err; + + err = unzlocal_getByte(fin,&i); + x = (uLong)i; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<8; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<16; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<24; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + + +/* My own strcmpi / strcasecmp */ +local int strcmpcasenosensitive_internal (const char *fileName1, + const char *fileName2) +{ + for (;;) + { + char c1=*(fileName1++); + char c2=*(fileName2++); + if ((c1>='a') && (c1<='z')) + c1 -= 0x20; + if ((c2>='a') && (c2<='z')) + c2 -= 0x20; + if (c1=='\0') + return ((c2=='\0') ? 0 : -1); + if (c2=='\0') + return 1; + if (c1c2) + return 1; + } +} + + +#ifdef CASESENSITIVITYDEFAULT_NO +#define CASESENSITIVITYDEFAULTVALUE 2 +#else +#define CASESENSITIVITYDEFAULTVALUE 1 +#endif + +#ifndef STRCMPCASENOSENTIVEFUNCTION +#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal +#endif + +/* + Compare two filename (fileName1,fileName2). + If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) + If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi + or strcasecmp) + If iCaseSenisivity = 0, case sensitivity is defaut of your operating system + (like 1 on Unix, 2 on Windows) + +*/ +extern int ZEXPORT unzStringFileNameCompare (const char *fileName1, + const char *fileName2, + int iCaseSensitivity) +{ + if (iCaseSensitivity==0) + iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; + + if (iCaseSensitivity==1) + return strcmp(fileName1,fileName2); + + return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); +} + +#define BUFREADCOMMENT (0x400) + +/* + Locate the Central directory of a zipfile (at the end, just before + the global comment) +*/ +local uLong unzlocal_SearchCentralDir(FILE *fin) +{ + unsigned char* buf; + uLong uSizeFile; + uLong uBackRead; + uLong uMaxBack=0xffff; /* maximum size of global comment */ + uLong uPosFound=0; + + if (fseek(fin,0,SEEK_END) != 0) + return 0; + + + uSizeFile = ftell( fin ); + + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); + if (fseek(fin,uReadPos,SEEK_SET)!=0) + break; + + if (fread(buf,(uInt)uReadSize,1,fin)!=1) + break; + + for (i=(int)uReadSize-3; (i--)>0;) + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } + + if (uPosFound!=0) + break; + } + TRYFREE(buf); + return uPosFound; +} + +/* + Open a Zip file. path contain the full pathname (by example, + on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer + "zlib/zlib109.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. + Else, the return value is a unzFile Handle, usable with other function + of this unzip package. +*/ +extern unzFile ZEXPORT unzOpen (const char *path) +{ + unz_s us; + unz_s *s; + uLong central_pos,uL; + FILE * fin ; + + uLong number_disk; /* number of the current dist, used for + spaning ZIP, unsupported, always 0*/ + uLong number_disk_with_CD; /* number the the disk with central dir, used + for spaning ZIP, unsupported, always 0*/ + uLong number_entry_CD; /* total number of entries in + the central dir + (same than number_entry on nospan) */ + + int err=UNZ_OK; + + if (unz_copyright[0]!=' ') + return NULL; + + fin=fopen(path,"rb"); + if (fin==NULL) + return NULL; + + central_pos = unzlocal_SearchCentralDir(fin); + if (central_pos==0) + err=UNZ_ERRNO; + + if (fseek(fin,central_pos,SEEK_SET)!=0) + err=UNZ_ERRNO; + + /* the signature, already checked */ + if (unzlocal_getLong(fin,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of this disk */ + if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of the disk with the start of the central directory */ + if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK) + err=UNZ_ERRNO; + + /* total number of entries in the central dir on this disk */ + if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK) + err=UNZ_ERRNO; + + /* total number of entries in the central dir */ + if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK) + err=UNZ_ERRNO; + + if ((number_entry_CD!=us.gi.number_entry) || + (number_disk_with_CD!=0) || + (number_disk!=0)) + err=UNZ_BADZIPFILE; + + /* size of the central directory */ + if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; + + /* offset of start of central directory with respect to the + starting disk number */ + if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; + + /* zipfile comment length */ + if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) + err=UNZ_ERRNO; + + if ((central_pospfile_in_zip_read!=NULL) + unzCloseCurrentFile(file); + + fclose(s->file); + TRYFREE(s); + return UNZ_OK; +} + + +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. */ +extern int ZEXPORT unzGetGlobalInfo (unzFile file, + unz_global_info *pglobal_info) +{ + unz_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + *pglobal_info=s->gi; + return UNZ_OK; +} + + +/* + Translate date/time from Dos format to tm_unz (readable more easilty) +*/ +local void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz *ptm) +{ + uLong uDate; + uDate = (uLong)(ulDosDate>>16); + ptm->tm_mday = (uInt)(uDate&0x1f) ; + ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; + ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; + + ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); + ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; + ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; +} + +/* + Get Info about the current file in the zipfile, with internal only info +*/ +local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, + unz_file_info *pfile_info, + unz_file_info_internal + *pfile_info_internal, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); + +local int unzlocal_GetCurrentFileInfoInternal (unzFile file, + unz_file_info *pfile_info, + unz_file_info_internal *pfile_info_internal, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize) +{ + unz_s* s; + unz_file_info file_info; + unz_file_info_internal file_info_internal; + int err=UNZ_OK; + uLong uMagic; + long lSeek=0; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0) + err=UNZ_ERRNO; + + + /* we check the magic */ + if (err==UNZ_OK) + if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x02014b50) + err=UNZ_BADZIPFILE; + + if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) + err=UNZ_ERRNO; + + unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); + + if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) + err=UNZ_ERRNO; + + lSeek+=file_info.size_filename; + if ((err==UNZ_OK) && (szFileName!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_filename0) && (fileNameBufferSize>0)) + if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek -= uSizeRead; + } + + + if ((err==UNZ_OK) && (extraField!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_file_extrafile,lSeek,SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) + if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek += file_info.size_file_extra - uSizeRead; + } + else + lSeek+=file_info.size_file_extra; + + + if ((err==UNZ_OK) && (szComment!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_file_commentfile,lSeek,SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + if ((file_info.size_file_comment>0) && (commentBufferSize>0)) + if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek+=file_info.size_file_comment - uSizeRead; + } + else + lSeek+=file_info.size_file_comment; + + if ((err==UNZ_OK) && (pfile_info!=NULL)) + *pfile_info=file_info; + + if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) + *pfile_info_internal=file_info_internal; + + return err; +} + + + +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. +*/ +extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, + unz_file_info *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize) +{ + return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, + szFileName,fileNameBufferSize, + extraField,extraFieldBufferSize, + szComment,commentBufferSize); +} + +/* + Set the current file of the zipfile to the first file. + return UNZ_OK if there is no problem +*/ +extern int ZEXPORT unzGoToFirstFile (unzFile file) +{ + int err=UNZ_OK; + unz_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + s->pos_in_central_dir=s->offset_central_dir; + s->num_file=0; + err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; +} + + +/* + Set the current file of the zipfile to the next file. + return UNZ_OK if there is no problem + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. +*/ +extern int ZEXPORT unzGoToNextFile (unzFile file) +{ + unz_s* s; + int err; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + if (s->num_file+1==s->gi.number_entry) + return UNZ_END_OF_LIST_OF_FILE; + + s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + + s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; + s->num_file++; + err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; +} + + +/* + Try locate the file szFileName in the zipfile. + For the iCaseSensitivity signification, see unzipStringFileNameCompare + + return value : + UNZ_OK if the file is found. It becomes the current file. + UNZ_END_OF_LIST_OF_FILE if the file is not found +*/ +extern int ZEXPORT unzLocateFile (unzFile file, + const char *szFileName, + int iCaseSensitivity) +{ + unz_s* s; + int err; + + + uLong num_fileSaved; + uLong pos_in_central_dirSaved; + + + if (file==NULL) + return UNZ_PARAMERROR; + + if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) + return UNZ_PARAMERROR; + + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + + num_fileSaved = s->num_file; + pos_in_central_dirSaved = s->pos_in_central_dir; + + err = unzGoToFirstFile(file); + + while (err == UNZ_OK) + { + char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; + unzGetCurrentFileInfo(file,NULL, + szCurrentFileName,sizeof(szCurrentFileName)-1, + NULL,0,NULL,0); + if (unzStringFileNameCompare(szCurrentFileName, + szFileName,iCaseSensitivity)==0) + return UNZ_OK; + err = unzGoToNextFile(file); + } + + s->num_file = num_fileSaved ; + s->pos_in_central_dir = pos_in_central_dirSaved ; + return err; +} + + +/* + Read the local header of the current zipfile + Check the coherency of the local header and info in the end of central + directory about this file + store in *piSizeVar the size of extra info in local header + (filename and size of extra field data) +*/ +local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s *s, + uInt *piSizeVar, + uLong *poffset_local_extrafield, + uInt *psize_local_extrafield) +{ + uLong uMagic,uData,uFlags; + uLong size_filename; + uLong size_extra_field; + int err=UNZ_OK; + + *piSizeVar = 0; + *poffset_local_extrafield = 0; + *psize_local_extrafield = 0; + + if (fseek(s->file,s->cur_file_info_internal.offset_curfile + + s->byte_before_the_zipfile,SEEK_SET)!=0) + return UNZ_ERRNO; + + + if (err==UNZ_OK) + if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x04034b50) + err=UNZ_BADZIPFILE; + + if (unzlocal_getShort(s->file,&uData) != UNZ_OK) + err=UNZ_ERRNO; +/* + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) + err=UNZ_BADZIPFILE; +*/ + if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) + err=UNZ_ERRNO; + + if (unzlocal_getShort(s->file,&uData) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) + err=UNZ_BADZIPFILE; + + if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && + (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; + + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ + err=UNZ_ERRNO; + + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + + if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) + err=UNZ_BADZIPFILE; + + *piSizeVar += (uInt)size_filename; + + if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK) + err=UNZ_ERRNO; + *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + + SIZEZIPLOCALHEADER + size_filename; + *psize_local_extrafield = (uInt)size_extra_field; + + *piSizeVar += (uInt)size_extra_field; + + return err; +} + +/* + Open for reading data the current file in the zipfile. + If there is no error and the file is opened, the return value is UNZ_OK. +*/ +extern int ZEXPORT unzOpenCurrentFile (unzFile file) +{ + int err=UNZ_OK; + int Store; + uInt iSizeVar; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + uLong offset_local_extrafield; /* offset of the local extra field */ + uInt size_local_extrafield; /* size of the local extra field */ + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_PARAMERROR; + + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); + + if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, + &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) + return UNZ_BADZIPFILE; + + pfile_in_zip_read_info = (file_in_zip_read_info_s*) + ALLOC(sizeof(file_in_zip_read_info_s)); + if (pfile_in_zip_read_info==NULL) + return UNZ_INTERNALERROR; + + pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); + pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; + pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; + pfile_in_zip_read_info->pos_local_extrafield=0; + + if (pfile_in_zip_read_info->read_buffer==NULL) + { + TRYFREE(pfile_in_zip_read_info); + return UNZ_INTERNALERROR; + } + + pfile_in_zip_read_info->stream_initialised=0; + + if ((s->cur_file_info.compression_method!=0) && + (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; + Store = s->cur_file_info.compression_method==0; + + pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; + pfile_in_zip_read_info->crc32=0; + pfile_in_zip_read_info->compression_method = + s->cur_file_info.compression_method; + pfile_in_zip_read_info->file=s->file; + pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; + + pfile_in_zip_read_info->stream.total_out = 0; + + if (!Store) + { + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + + err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised=1; + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * size of both compressed and uncompressed data + */ + } + pfile_in_zip_read_info->rest_read_compressed = + s->cur_file_info.compressed_size ; + pfile_in_zip_read_info->rest_read_uncompressed = + s->cur_file_info.uncompressed_size ; + + + pfile_in_zip_read_info->pos_in_zipfile = + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + iSizeVar; + + pfile_in_zip_read_info->stream.avail_in = (uInt)0; + + + s->pfile_in_zip_read = pfile_in_zip_read_info; + return UNZ_OK; +} + + +/* + Read bytes from the current file. + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error + (UNZ_ERRNO for IO error, or zLib error for uncompress error) +*/ +extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) +{ + int err=UNZ_OK; + uInt iRead = 0; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + + if ((pfile_in_zip_read_info->read_buffer == NULL)) + return UNZ_END_OF_LIST_OF_FILE; + if (len==0) + return 0; + + pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; + + pfile_in_zip_read_info->stream.avail_out = (uInt)len; + + if (len>pfile_in_zip_read_info->rest_read_uncompressed) + pfile_in_zip_read_info->stream.avail_out = + (uInt)pfile_in_zip_read_info->rest_read_uncompressed; + + while (pfile_in_zip_read_info->stream.avail_out>0) + { + if ((pfile_in_zip_read_info->stream.avail_in==0) && + (pfile_in_zip_read_info->rest_read_compressed>0)) + { + uInt uReadThis = UNZ_BUFSIZE; + if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; + if (uReadThis == 0) + return UNZ_EOF; + if (fseek(pfile_in_zip_read_info->file, + pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) + return UNZ_ERRNO; + if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, + pfile_in_zip_read_info->file)!=1) + return UNZ_ERRNO; + pfile_in_zip_read_info->pos_in_zipfile += uReadThis; + + pfile_in_zip_read_info->rest_read_compressed-=uReadThis; + + pfile_in_zip_read_info->stream.next_in = + (Bytef*)pfile_in_zip_read_info->read_buffer; + pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; + } + + if (pfile_in_zip_read_info->compression_method==0) + { + uInt uDoCopy,i ; + if (pfile_in_zip_read_info->stream.avail_out < + pfile_in_zip_read_info->stream.avail_in) + uDoCopy = pfile_in_zip_read_info->stream.avail_out ; + else + uDoCopy = pfile_in_zip_read_info->stream.avail_in ; + + for (i=0;istream.next_out+i) = + *(pfile_in_zip_read_info->stream.next_in+i); + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, + pfile_in_zip_read_info->stream.next_out, + uDoCopy); + pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; + pfile_in_zip_read_info->stream.avail_in -= uDoCopy; + pfile_in_zip_read_info->stream.avail_out -= uDoCopy; + pfile_in_zip_read_info->stream.next_out += uDoCopy; + pfile_in_zip_read_info->stream.next_in += uDoCopy; + pfile_in_zip_read_info->stream.total_out += uDoCopy; + iRead += uDoCopy; + } + else + { + uLong uTotalOutBefore,uTotalOutAfter; + const Bytef *bufBefore; + uLong uOutThis; + int flush=Z_SYNC_FLUSH; + + uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; + bufBefore = pfile_in_zip_read_info->stream.next_out; + + /* + if ((pfile_in_zip_read_info->rest_read_uncompressed == + pfile_in_zip_read_info->stream.avail_out) && + (pfile_in_zip_read_info->rest_read_compressed == 0)) + flush = Z_FINISH; + */ + err=inflate(&pfile_in_zip_read_info->stream,flush); + + uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; + uOutThis = uTotalOutAfter-uTotalOutBefore; + + pfile_in_zip_read_info->crc32 = + crc32(pfile_in_zip_read_info->crc32,bufBefore, + (uInt)(uOutThis)); + + pfile_in_zip_read_info->rest_read_uncompressed -= + uOutThis; + + iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); + + if (err==Z_STREAM_END) + return (iRead==0) ? UNZ_EOF : iRead; + if (err!=Z_OK) + break; + } + } + + if (err==Z_OK) + return iRead; + return err; +} + + +/* + Give the current position in uncompressed data +*/ +extern z_off_t ZEXPORT unztell (unzFile file) +{ + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + return (z_off_t)pfile_in_zip_read_info->stream.total_out; +} + + +/* + return 1 if the end of file was reached, 0 elsewhere +*/ +extern int ZEXPORT unzeof (unzFile file) +{ + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) + return 1; + else + return 0; +} + + + +/* + Read extra field from the current file (opened by unzOpenCurrentFile) + This is the local-header version of the extra field (sometimes, there is + more info in the local-header version than in the central-header) + + if buf==NULL, it return the size of the local extra field that can be read + + if buf!=NULL, len is the size of the buffer, the extra header is copied in + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code +*/ +extern int ZEXPORT unzGetLocalExtrafield (unzFile file,voidp buf,unsigned len) +{ + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + uInt read_now; + uLong size_to_read; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + pfile_in_zip_read_info->pos_local_extrafield); + + if (buf==NULL) + return (int)size_to_read; + + if (len>size_to_read) + read_now = (uInt)size_to_read; + else + read_now = (uInt)len ; + + if (read_now==0) + return 0; + + if (fseek(pfile_in_zip_read_info->file, + pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) + return UNZ_ERRNO; + + if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1) + return UNZ_ERRNO; + + return (int)read_now; +} + +/* + Close the file in zip opened with unzipOpenCurrentFile + Return UNZ_CRCERROR if all the file was read but the CRC is not good +*/ +extern int ZEXPORT unzCloseCurrentFile (unzFile file) +{ + int err=UNZ_OK; + + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) + { + if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) + err=UNZ_CRCERROR; + } + + + TRYFREE(pfile_in_zip_read_info->read_buffer); + pfile_in_zip_read_info->read_buffer = NULL; + if (pfile_in_zip_read_info->stream_initialised) + inflateEnd(&pfile_in_zip_read_info->stream); + + pfile_in_zip_read_info->stream_initialised = 0; + TRYFREE(pfile_in_zip_read_info); + + s->pfile_in_zip_read=NULL; + + return err; +} + + +/* + Get the global comment string of the ZipFile, in the szComment buffer. + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 +*/ +extern int ZEXPORT unzGetGlobalComment (unzFile file, + char *szComment, + uLong uSizeBuf) +{ + //int err=UNZ_OK; + unz_s* s; + uLong uReadThis ; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + + uReadThis = uSizeBuf; + if (uReadThis>s->gi.size_comment) + uReadThis = s->gi.size_comment; + + if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0) + return UNZ_ERRNO; + + if (uReadThis>0) + { + *szComment='\0'; + if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) + return UNZ_ERRNO; + } + + if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) + *(szComment+s->gi.size_comment)='\0'; + return (int)uReadThis; +} diff --git a/src/unzip.h b/src/unzip.h new file mode 100644 index 0000000..003e738 --- /dev/null +++ b/src/unzip.h @@ -0,0 +1,294 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/* unzip.h -- IO for uncompress .zip files using zlib + Version 0.15 beta, Mar 19th, 1998, + + Copyright (C) 1998 Gilles Vollant + + This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g + WinZip, InfoZip tools and compatible. + Encryption and multi volume ZipFile (span) are not supported. + Old compressions used by old PKZip 1.x are not supported + + THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE + CAN CHANGE IN FUTURE VERSION !! + I WAIT FEEDBACK at mail info@winimage.com + Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution + + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + +*/ +/* for more info about .ZIP format, see + ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip + PkWare has also a specification at : + ftp://ftp.pkware.com/probdesc.zip */ + +#ifndef _unz_H +#define _unz_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ZLIB_H +#include "zlib.h" +#endif + +#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagunzFile__ { int unused; } unzFile__; +typedef unzFile__ *unzFile; +#else +typedef voidp unzFile; +#endif + + +#define UNZ_OK (0) +#define UNZ_END_OF_LIST_OF_FILE (-100) +#define UNZ_ERRNO (Z_ERRNO) +#define UNZ_EOF (0) +#define UNZ_PARAMERROR (-102) +#define UNZ_BADZIPFILE (-103) +#define UNZ_INTERNALERROR (-104) +#define UNZ_CRCERROR (-105) + +/* tm_unz contain date/time info */ +typedef struct tm_unz_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_unz; + +/* unz_global_info structure contain global data about the ZIPfile + These data comes from the end of central dir */ +typedef struct unz_global_info_s +{ + uLong number_entry; /* total number of entries in + the central dir on this disk */ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info; + + +/* unz_file_info contain information about a file in the zipfile */ +typedef struct unz_file_info_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; +} unz_file_info; + +extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, + const char* fileName2, + int iCaseSensitivity)); +/* + Compare two filename (fileName1,fileName2). + If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) + If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi + or strcasecmp) + If iCaseSenisivity = 0, case sensitivity is defaut of your operating system + (like 1 on Unix, 2 on Windows) +*/ + + +extern unzFile ZEXPORT unzOpen OF((const char *path)); +/* + Open a Zip file. path contain the full pathname (by example, + on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer + "zlib/zlib111.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. + Else, the return value is a unzFile Handle, usable with other function + of this unzip package. +*/ + +extern int ZEXPORT unzClose OF((unzFile file)); +/* + Close a ZipFile opened with unzipOpen. + If there is files inside the .Zip opened with unzOpenCurrentFile (see later), + these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + return UNZ_OK if there is no problem. */ + +extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, + unz_global_info *pglobal_info)); +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. */ + + +extern int ZEXPORT unzGetGlobalComment OF((unzFile file, + char *szComment, + uLong uSizeBuf)); +/* + Get the global comment string of the ZipFile, in the szComment buffer. + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 +*/ + + +/***************************************************************************/ +/* Unzip package allow you browse the directory of the zipfile */ + +extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); +/* + Set the current file of the zipfile to the first file. + return UNZ_OK if there is no problem +*/ + +extern int ZEXPORT unzGoToNextFile OF((unzFile file)); +/* + Set the current file of the zipfile to the next file. + return UNZ_OK if there is no problem + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. +*/ + +extern int ZEXPORT unzLocateFile OF((unzFile file, + const char *szFileName, + int iCaseSensitivity)); +/* + Try locate the file szFileName in the zipfile. + For the iCaseSensitivity signification, see unzStringFileNameCompare + + return value : + UNZ_OK if the file is found. It becomes the current file. + UNZ_END_OF_LIST_OF_FILE if the file is not found +*/ + + +extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, + unz_file_info *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); +/* + Get Info about the current file + if pfile_info!=NULL, the *pfile_info structure will contain somes info about + the current file + if szFileName!=NULL, the filemane string will be copied in szFileName + (fileNameBufferSize is the size of the buffer) + if extraField!=NULL, the extra field information will be copied in extraField + (extraFieldBufferSize is the size of the buffer). + This is the Central-header version of the extra field + if szComment!=NULL, the comment string of the file will be copied in szComment + (commentBufferSize is the size of the buffer) +*/ + +/***************************************************************************/ +/* for reading the content of the current zipfile, you can open it, read data + from it, and close it (you can close it before reading all the file) + */ + +extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); +/* + Open for reading data the current file in the zipfile. + If there is no error, the return value is UNZ_OK. +*/ + +extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); +/* + Close the file in zip opened with unzOpenCurrentFile + Return UNZ_CRCERROR if all the file was read but the CRC is not good +*/ + + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read bytes from the current file (opened by unzOpenCurrentFile) + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error + (UNZ_ERRNO for IO error, or zLib error for uncompress error) +*/ + +extern z_off_t ZEXPORT unztell OF((unzFile file)); +/* + Give the current position in uncompressed data +*/ + +extern int ZEXPORT unzeof OF((unzFile file)); +/* + return 1 if the end of file was reached, 0 elsewhere +*/ + +extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read extra field from the current file (opened by unzOpenCurrentFile) + This is the local-header version of the extra field (sometimes, there is + more info in the local-header version than in the central-header) + + if buf==NULL, it return the size of the local extra field + + if buf!=NULL, len is the size of the buffer, the extra header is copied in + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _unz_H */ diff --git a/src/win32/.cvsignore b/src/win32/.cvsignore new file mode 100644 index 0000000..5dff38d --- /dev/null +++ b/src/win32/.cvsignore @@ -0,0 +1 @@ +vba.aps diff --git a/src/win32/AVIWrite.cpp b/src/win32/AVIWrite.cpp new file mode 100644 index 0000000..4943224 --- /dev/null +++ b/src/win32/AVIWrite.cpp @@ -0,0 +1,187 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "AVIWrite.h" + +AVIWrite::AVIWrite() +{ + m_failed = false; + m_file = NULL; + m_stream = NULL; + m_streamCompressed = NULL; + m_streamSound = NULL; + m_samplesSound = 0; + + AVIFileInit(); +} + +AVIWrite::~AVIWrite() +{ + if(m_streamSound) + AVIStreamClose(m_streamSound); + + if(m_streamCompressed) + AVIStreamClose(m_streamCompressed); + + if(m_stream) + AVIStreamClose(m_stream); + + if(m_file) + AVIFileClose(m_file); + + AVIFileExit(); +} + +void AVIWrite::SetVideoFormat(BITMAPINFOHEADER *bh) +{ + // force size to 0x28 to avoid extra fields + memcpy(&m_bitmap, bh, 0x28); +} + +void AVIWrite::SetSoundFormat(WAVEFORMATEX *format) +{ + memcpy(&m_soundFormat, format, sizeof(WAVEFORMATEX)); + ZeroMemory(&m_soundHeader, sizeof(AVISTREAMINFO)); + // setup the sound stream header + m_soundHeader.fccType = streamtypeAUDIO; + m_soundHeader.dwQuality = (DWORD)-1; + m_soundHeader.dwScale = format->nBlockAlign; + m_soundHeader.dwInitialFrames = 1; + m_soundHeader.dwRate = format->nAvgBytesPerSec; + m_soundHeader.dwSampleSize = format->nBlockAlign; + + // create the sound stream + if(FAILED(AVIFileCreateStream(m_file, &m_streamSound, &m_soundHeader))) { + m_failed = true; + return; + } + + // setup the sound stream format + if(FAILED(AVIStreamSetFormat(m_streamSound, 0 , (void *)&m_soundFormat, + sizeof(WAVEFORMATEX)))) { + m_failed = true; + return; + } +} + +bool AVIWrite::Open(const char *filename) +{ + // create the AVI file + if(FAILED(AVIFileOpen(&m_file, + filename, + OF_WRITE | OF_CREATE, + NULL))) { + m_failed = true; + return false; + } + // setup the video stream information + ZeroMemory(&m_header, sizeof(AVISTREAMINFO)); + m_header.fccType = streamtypeVIDEO; + m_header.dwScale = 1; + m_header.dwRate = m_fps; + m_header.dwSuggestedBufferSize = m_bitmap.biSizeImage; + + // create the video stream + if(FAILED(AVIFileCreateStream(m_file, + &m_stream, + &m_header))) { + m_failed = true; + return false; + } + + ZeroMemory(&m_options, sizeof(AVICOMPRESSOPTIONS)); + m_arrayOptions[0] = &m_options; + + // call the dialog to setup the compress options to be used + if(!AVISaveOptions(AfxGetApp()->m_pMainWnd->GetSafeHwnd(), 0, 1, &m_stream, m_arrayOptions)) { + m_failed = true; + return false; + } + + // create the compressed stream + if(FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, NULL))) { + m_failed = true; + return false; + } + + // setup the video stream format + if(FAILED( AVIStreamSetFormat(m_streamCompressed, 0, + &m_bitmap, + m_bitmap.biSize + + m_bitmap.biClrUsed * sizeof(RGBQUAD)))) { + m_failed = true; + return false; + } + + return true; +} + +bool AVIWrite::AddSound(const char *sound, int len) +{ + // return if we failed somewhere already + if(m_failed) + return false; + + int samples = len / m_soundFormat.nBlockAlign; + + if(FAILED(AVIStreamWrite(m_streamSound, + m_samplesSound, + samples, + (LPVOID)sound, + len, + 0, + NULL, + NULL))) { + m_failed = true; + return false; + } + m_samplesSound += samples; + + return true; +} + +bool AVIWrite::AddFrame(const int frame, const char *bmp) +{ + if (m_failed) + return false; + + // write the frame to the video stream + if(FAILED(AVIStreamWrite(m_streamCompressed, + frame, + 1, + (LPVOID)bmp, + m_bitmap.biSizeImage, + AVIIF_KEYFRAME, + NULL, + NULL))) { + m_failed = true; + return false; + } + return true; +} + +bool AVIWrite::IsSoundAdded() +{ + return m_streamSound != NULL; +} + +void AVIWrite::SetFPS(int f) +{ + m_fps = f; +} diff --git a/src/win32/AVIWrite.h b/src/win32/AVIWrite.h new file mode 100644 index 0000000..74daab9 --- /dev/null +++ b/src/win32/AVIWrite.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include + +class AVIWrite { + public: + AVIWrite(); + virtual ~AVIWrite(); + + bool Open(const char *filename); + virtual bool AddFrame(const int number, const char * bmp); + void SetFPS(int fps); + void SetVideoFormat(BITMAPINFOHEADER *); + bool IsSoundAdded(); + void SetSoundFormat(WAVEFORMATEX *); + bool AddSound(const char *sound, int len); + + private: + int m_fps; + WAVEFORMATEX m_soundFormat; + BITMAPINFOHEADER m_bitmap; + AVISTREAMINFO m_header; + AVISTREAMINFO m_soundHeader; + PAVIFILE m_file; + PAVISTREAM m_stream; + PAVISTREAM m_streamCompressed; + PAVISTREAM m_streamSound; + AVICOMPRESSOPTIONS m_options; + AVICOMPRESSOPTIONS *m_arrayOptions[1]; + int m_samplesSound; + bool m_failed; +}; diff --git a/src/win32/AboutDialog.cpp b/src/win32/AboutDialog.cpp new file mode 100644 index 0000000..966e9de --- /dev/null +++ b/src/win32/AboutDialog.cpp @@ -0,0 +1,83 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// AboutDialog.cpp : implementation file +// + +#include "AboutDialog.h" +#include "../AutoBuild.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// AboutDialog dialog + + +AboutDialog::AboutDialog(CWnd* pParent /*=NULL*/) + : CDialog(AboutDialog::IDD, pParent) +{ + //{{AFX_DATA_INIT(AboutDialog) + m_version = _T(VERSION); + //}}AFX_DATA_INIT +} + + +void AboutDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AboutDialog) + DDX_Text(pDX, IDC_VERSION, m_version); + DDX_Control(pDX, IDC_URL, m_link); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AboutDialog, CDialog) + //{{AFX_MSG_MAP(AboutDialog) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AboutDialog message handlers + +BOOL AboutDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CWnd *p = GetDlgItem(IDC_TRANSLATOR_URL); + if(p) { + m_translator.SubclassDlgItem(IDC_TRANSLATOR_URL, this); + } + + m_link.SetWindowText("http://vba.ngemu.com"); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void AboutDialog::OnOK() +{ + // TODO: Add extra validation here + + CDialog::OnOK(); +} diff --git a/src/win32/AboutDialog.h b/src/win32/AboutDialog.h new file mode 100644 index 0000000..297dd1f --- /dev/null +++ b/src/win32/AboutDialog.h @@ -0,0 +1,73 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_ABOUTDIALOG_H__48D787B2_0699_4F03_827D_404EC70DDDB2__INCLUDED_) +#define AFX_ABOUTDIALOG_H__48D787B2_0699_4F03_827D_404EC70DDDB2__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// AboutDialog.h : header file +// +#include "stdafx.h" +#include "Hyperlink.h" +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// AboutDialog dialog + +class AboutDialog : public CDialog +{ + Hyperlink m_link; + Hyperlink m_translator; + // Construction + public: + AboutDialog(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AboutDialog) + enum { IDD = IDD_ABOUT }; + CString m_version; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AboutDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AboutDialog) + virtual BOOL OnInitDialog(); + virtual void OnOK(); + //}}AFX_MSG + + + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ABOUTDIALOG_H__48D787B2_0699_4F03_827D_404EC70DDDB2__INCLUDED_) diff --git a/src/win32/AccelEditor.cpp b/src/win32/AccelEditor.cpp new file mode 100644 index 0000000..0acd64e --- /dev/null +++ b/src/win32/AccelEditor.cpp @@ -0,0 +1,363 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// AccelEditor.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "AccelEditor.h" +#include "CmdAccelOb.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// AccelEditor dialog + + +AccelEditor::AccelEditor(CWnd* pParent /*=NULL*/) + : ResizeDlg(AccelEditor::IDD, pParent) +{ + //{{AFX_DATA_INIT(AccelEditor) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + mgr = theApp.winAccelMgr; + m_commonOnly = false; +} + + +void AccelEditor::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AccelEditor) + DDX_Control(pDX, IDC_CURRENTS, m_currents); + DDX_Control(pDX, IDC_ALREADY_AFFECTED, m_alreadyAffected); + DDX_Control(pDX, IDC_COMMANDS, m_commands); + DDX_Control(pDX, IDC_COMMANDS_HIDDEN, m_commands_hidden); + DDX_Control(pDX, IDC_EDIT_KEY, m_key); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AccelEditor, CDialog) + //{{AFX_MSG_MAP(AccelEditor) + ON_BN_CLICKED(ID_OK, OnOk) + ON_LBN_SELCHANGE(IDC_COMMANDS, OnSelchangeCommands) + ON_BN_CLICKED(IDC_RESET, OnReset) + ON_BN_CLICKED(IDC_ASSIGN, OnAssign) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(IDC_REMOVE, OnRemove) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AccelEditor message handlers + +BOOL AccelEditor::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_STATIC1, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_STATIC2, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_STATIC3, DS_MoveX | DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_ALREADY_AFFECTED, DS_MoveY) + DIALOG_SIZER_ENTRY( ID_OK, DS_MoveX) + DIALOG_SIZER_ENTRY( ID_CANCEL, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_ASSIGN, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_REMOVE, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_RESET, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_COMMANDS, DS_SizeX | DS_SizeY) + DIALOG_SIZER_ENTRY( IDC_CURRENTS, DS_MoveX | DS_SizeY) + DIALOG_SIZER_ENTRY( IDC_EDIT_KEY, DS_MoveX | DS_MoveY) + DIALOG_SIZER_END() + + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\AccelEditor", + NULL); + + InitCommands(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void AccelEditor::InitCommands() +{ + m_commands.ResetContent(); + m_commands_hidden.ResetContent(); + m_alreadyAffected.SetWindowText(""); + + POSITION pos = mgr.m_mapAccelString.GetStartPosition(); + + while(pos != NULL) { + CString command; + WORD wID; + mgr.m_mapAccelString.GetNextAssoc(pos, command, wID); + + CString tempStr = command; + int commonMark = tempStr.Find("(!)", 0); + if(commonMark >= 0) + tempStr.Truncate(commonMark); // cut off the (!) + + if(!m_commonOnly || commonMark >= 0) + { + int index = m_commands.AddString(tempStr); + m_commands.SetItemData(index, wID); + } + else + { + int index = m_commands_hidden.AddString(tempStr); + m_commands_hidden.SetItemData(index, wID); + } + } + + // Update the currents accels associated with the selected command + if (m_commands.SetCurSel(0) != LB_ERR) + OnSelchangeCommands(); +} + +void AccelEditor::OnCancel() +{ + EndDialog(FALSE); +} + +void AccelEditor::OnOk() +{ + EndDialog(TRUE); +} + +void AccelEditor::OnSelchangeCommands() +{ + // Check if some commands exist. + int index = m_commands.GetCurSel(); + if (index == LB_ERR) + return; + + WORD wIDCommand = LOWORD(m_commands.GetItemData(index)); + m_currents.ResetContent(); + + CCmdAccelOb* pCmdAccel; + + if (mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel)) { + CAccelsOb* pAccel; + CString szBuffer; + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + + // Add the keys to the 'currents keys' listbox. + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + pAccel->GetString(szBuffer); + index = m_currents.AddString(szBuffer); + // and a pointer to the accel object. + m_currents.SetItemData(index, (DWORD)pAccel); + } + } + // Init the key editor + // m_pKey->ResetKey(); + +} + +void AccelEditor::OnReset() +{ + mgr.Default(); /// FIXME accelerator reset NYI + systemMessage(0,"The \"Reset All Accelerators\" feature is currently unimplemented.\nYou can achieve the same result by closing VBA, opening up your \"vba.ini\" file, deleting the line that starts with \"keyboard\", then reopening VBA."); + InitCommands(); // update the listboxes. +} + +void AccelEditor::OnAssign() +{ + // Control if it's not already affected + CCmdAccelOb* pCmdAccel; + CAccelsOb* pAccel; + WORD wIDCommand; + POSITION pos; + + WORD wKey; + bool bCtrl, bAlt, bShift; + + if (!m_key.GetAccelKey(wKey, bCtrl, bAlt, bShift)) + return; // no valid key, abort + + + // get the currently selected group + int index = m_commands.GetCurSel(); + if (index == LB_ERR) + return; + + // Get the object who manage the accels list, associated to the command. + wIDCommand = LOWORD(m_commands.GetItemData(index)); + + + int count = m_commands.GetCount(); + for (int index2 = 0; index2 < count; index2++) { + + WORD wIDCommand2 = LOWORD(m_commands.GetItemData(index2)); + mgr.m_mapAccelTable.Lookup(wIDCommand2, pCmdAccel); + + pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel->IsEqual(wKey, bCtrl, bAlt, bShift)) { + // the key is already affected (in the same or other command) + // (the parts that are commented out allow for a one-to-many mapping, + // which is only disabled because the MFC stuff that automagically activates the commands + // doesn't seem to be capable of activating more than one command per accelerator...) +// if (wIDCommand != wIDCommand2) { + // the key is already affected by a different command and also not already affected by the same commmand + + CString tempStr = pCmdAccel->m_szCommand; + int commonMark = tempStr.Find("(!)", 0); + if(commonMark >= 0) + tempStr.Truncate(commonMark); // cut off the (!) + + m_alreadyAffected.SetWindowText(tempStr); +// } else { +// // the key is already affected by the same command + m_key.SetSel(0, -1); + mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel); +// m_alreadyAffected.SetWindowText(pCmdAccel->m_szCommand); + return; // abort +// } + } + } + } + + // also check against any currently hidden commands + int count2 = m_commands_hidden.GetCount(); + for (int index3 = 0; index3 < count2; index3++) { + + WORD wIDCommand2 = LOWORD(m_commands_hidden.GetItemData(index3)); + mgr.m_mapAccelTable.Lookup(wIDCommand2, pCmdAccel); + + pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel->IsEqual(wKey, bCtrl, bAlt, bShift)) { + // the key is already affected (in the same or other command) + // (the parts that are commented out allow for a one-to-many mapping, + // which is only disabled because the MFC stuff that automagically activates the commands + // doesn't seem to be capable of activating more than one command per accelerator...) +// if (wIDCommand != wIDCommand2) { + // the key is already affected by a different command and also not already affected by the same commmand + CString tempStr = pCmdAccel->m_szCommand; // store because pCmdAccel changes after this + m_alreadyAffected.SetWindowText(tempStr); +// } else { +// // the key is already affected by the same command + m_key.SetSel(0, -1); + mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel); +// m_alreadyAffected.SetWindowText(pCmdAccel->m_szCommand); + + // unhide the conflicting command + // note that it will also stay in the hidden list, but that doesn't matter + int newIndex = m_commands.AddString(tempStr); + m_commands.SetItemData(newIndex, wIDCommand2); + + return; // abort +// } + } + } + } + + + + + if (mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel) != TRUE) + return; + + BYTE cVirt = 0; + if (bCtrl) + cVirt |= FCONTROL; + if (bAlt) + cVirt |= FALT; + if (bShift) + cVirt |= FSHIFT; + + cVirt |= FVIRTKEY; + + // Create the new key... + pAccel = new CAccelsOb(cVirt, wKey, false); + ASSERT(pAccel != NULL); + // ...and add in the list. + pCmdAccel->m_Accels.AddTail(pAccel); + + // Update the listbox. + CString szBuffer; + pAccel->GetString(szBuffer); + + index = m_currents.AddString(szBuffer); + m_currents.SetItemData(index, (DWORD)pAccel); + + // Reset the key editor. + m_key.ResetKey(); +} + +void AccelEditor::OnRemove() +{ + // Some controls + int indexCurrent = m_currents.GetCurSel(); + if (indexCurrent == LB_ERR) + return; + + // 2nd part. + int indexCmd = m_commands.GetCurSel(); + if (indexCmd == LB_ERR) + return; + + // Ref to the ID command + WORD wIDCommand = LOWORD(m_commands.GetItemData(indexCmd)); + + // Run through the accels,and control if it can be deleted. + CCmdAccelOb* pCmdAccel; + if (mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel) == TRUE) { + CAccelsOb* pAccel; + CAccelsOb* pAccelCurrent = (CAccelsOb*)(m_currents.GetItemData(indexCurrent)); + CString szBuffer; + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + POSITION PrevPos; + while (pos != NULL) { + PrevPos = pos; + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel == pAccelCurrent) { + if (!pAccel->m_bLocked) { + // not locked, so we delete the key + pCmdAccel->m_Accels.RemoveAt(PrevPos); + delete pAccel; + // and update the listboxes/key editor/static text + m_currents.DeleteString(indexCurrent); + m_key.ResetKey(); + m_alreadyAffected.SetWindowText(""); + return; + } else { + systemMessage(0,"Unable to remove this\naccelerator (Locked)"); + return; + } + } + } + systemMessage(0,"internal error (CAccelDlgHelper::Remove : pAccel unavailable)"); + return; + } + systemMessage(0,"internal error (CAccelDlgHelper::Remove : Lookup failed)"); +} diff --git a/src/win32/AccelEditor.h b/src/win32/AccelEditor.h new file mode 100644 index 0000000..a5f9118 --- /dev/null +++ b/src/win32/AccelEditor.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_ACCELEDITOR_H__66F5C854_E28E_40D1_B763_1850374B46A2__INCLUDED_) +#define AFX_ACCELEDITOR_H__66F5C854_E28E_40D1_B763_1850374B46A2__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// AccelEditor.h : header file +// +#include "AcceleratorManager.h" +#include "KeyboardEdit.h" +#include "ResizeDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// AccelEditor dialog + +class AccelEditor : public ResizeDlg +{ + // Construction + public: + CAcceleratorManager mgr; + void InitCommands(); + AccelEditor(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AccelEditor) + enum { IDD = IDD_ACCEL_EDITOR }; + CListBox m_currents; + CStatic m_alreadyAffected; + CListBox m_commands; + CListBox m_commands_hidden; + CKeyboardEdit m_key; + //}}AFX_DATA + bool m_commonOnly; + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AccelEditor) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AccelEditor) + virtual BOOL OnInitDialog(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + afx_msg void OnSelchangeCommands(); + afx_msg void OnReset(); + afx_msg void OnAssign(); + afx_msg void OnRemove(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ACCELEDITOR_H__66F5C854_E28E_40D1_B763_1850374B46A2__INCLUDED_) diff --git a/src/win32/AcceleratorManager.cpp b/src/win32/AcceleratorManager.cpp new file mode 100644 index 0000000..795b6cc --- /dev/null +++ b/src/win32/AcceleratorManager.cpp @@ -0,0 +1,801 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : AcceleratorManager.cpp +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Author : T.Maurel +// Date : 17.08.98 +// +// Remarks : implementation of the CAcceleratorManager class. +// +//////////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +//#include "resource.h" +#include "../System.h" + +#include "AcceleratorManager.h" +#include "Reg.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +#include // MIIM_STRING + + +////////////////////////////////////////////////////////////////////// +// Constructor/Destructor +////////////////////////////////////////////////////////////////////// +// +// +CAcceleratorManager::CAcceleratorManager() +{ + m_hRegKey = HKEY_CURRENT_USER; + m_szRegKey = ""; + m_bAutoSave = FALSE; + m_pWndConnected = NULL; + + m_bDefaultTable = false; +} + + +////////////////////////////////////////////////////////////////////// +// +// +CAcceleratorManager::~CAcceleratorManager() +{ + if ((m_bAutoSave == true) && (m_szRegKey.IsEmpty() != FALSE)) { + // bool bRet = Write(); + // if (!bRet) + // systemMessage(0, "CAcceleratorManager::~CAcceleratorManager\nError in CAcceleratorManager::Write..."); + } + + Reset(); +} + + +////////////////////////////////////////////////////////////////////// +// Internal fcts +////////////////////////////////////////////////////////////////////// +// +// +void CAcceleratorManager::Reset() +{ + CCmdAccelOb* pCmdAccel; + WORD wKey; + POSITION pos = m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + delete pCmdAccel; + } + m_mapAccelTable.RemoveAll(); + m_mapAccelString.RemoveAll(); + + pos = m_mapAccelTableSaved.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTableSaved.GetNextAssoc(pos, wKey, pCmdAccel); + delete pCmdAccel; + } + m_mapAccelTableSaved.RemoveAll(); +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szCommand, bool bLocked) +{ + ASSERT(szCommand != NULL); + + WORD wIDCmd; + if (m_mapAccelString.Lookup(szCommand, wIDCmd) == TRUE) { + if (wIDCmd != wIDCommand) + return false; + } + + CCmdAccelOb* pCmdAccel = NULL; + if (m_mapAccelTable.Lookup(wIDCommand, pCmdAccel) == TRUE) { + if (pCmdAccel->m_szCommand != szCommand) { + return false; + } + CAccelsOb* pAccel; + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel->m_cVirt == cVirt && + pAccel->m_wKey == wKey) + return FALSE; + } + // Adding the accelerator + pCmdAccel->Add(cVirt, wKey, bLocked); + + } else { + pCmdAccel = new CCmdAccelOb(cVirt, wIDCommand, wKey, szCommand, bLocked); + ASSERT(pCmdAccel != NULL); + m_mapAccelTable.SetAt(wIDCommand, pCmdAccel); + } + // 2nd table + m_mapAccelString.SetAt(szCommand, wIDCommand); + return true; +} + + +////////////////////////////////////////////////////////////////////// +// Debug fcts +////////////////////////////////////////////////////////////////////// +// +// +#ifdef _DEBUG +void CAcceleratorManager::AssertValid() const +{ +} + +////////////////////////////////////////////////////////////////////// +// +// +void CAcceleratorManager::Dump(CDumpContext& dc) const +{ + CCmdAccelOb* pCmdAccel; + WORD wKey; + dc << "CAcceleratorManager::Dump :\n"; + dc << "m_mapAccelTable :\n"; + POSITION pos = m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + dc << "a CCmdAccelOb at 0x" << (void*)pCmdAccel << " = {\n"; + dc << pCmdAccel; + dc << "}\n"; + } + dc << "\nm_mapAccelTableSaved\n"; + pos = m_mapAccelTableSaved.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTableSaved.GetNextAssoc(pos, wKey, pCmdAccel); + dc << "a CCmdAccelOb at 0x" << (void*)pCmdAccel << " = {\n"; + dc << pCmdAccel; + dc << "}\n"; + } +} +#endif + + +////////////////////////////////////////////////////////////////////// +// +////////////////////////////////////////////////////////////////////// +// +// +void CAcceleratorManager::Connect(CWnd* pWnd, bool bAutoSave) +{ + ASSERT(m_pWndConnected == NULL); + m_pWndConnected = pWnd; + m_bAutoSave = bAutoSave; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::GetRegKey(HKEY& hRegKey, CString& szRegKey) +{ + if (m_szRegKey.IsEmpty()) + return false; + + hRegKey = m_hRegKey; + szRegKey = m_szRegKey; + return true; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::SetRegKey(HKEY hRegKey, LPCTSTR szRegKey) +{ + ASSERT(hRegKey != NULL); + ASSERT(szRegKey != NULL); + + m_szRegKey = szRegKey; + m_hRegKey = hRegKey; + return true; +} + + +////////////////////////////////////////////////////////////////////// +// Update the application's ACCELs table +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::UpdateWndTable() +{ + int iLoop = 0; + CTypedPtrArray arrayACCEL; + + CCmdAccelOb* pCmdAccel; + WORD wKey; + LPACCEL pACCEL; + CAccelsOb* pAccelOb; + POSITION pos = m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccelOb = pCmdAccel->m_Accels.GetNext(pos); + + pACCEL = new ACCEL; + ASSERT(pACCEL != NULL); + pACCEL->fVirt = pAccelOb->m_cVirt; + pACCEL->key = pAccelOb->m_wKey; + pACCEL->cmd = pCmdAccel->m_wIDCommand; + arrayACCEL.Add(pACCEL); + } + } + + int nAccel = arrayACCEL.GetSize(); + LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL)); + if (!lpAccel) { + for (iLoop = 0; iLoop < nAccel; iLoop++) + delete arrayACCEL.GetAt(iLoop); + arrayACCEL.RemoveAll(); + + return false; + } + + for (iLoop = 0; iLoop < nAccel; iLoop++) { + + pACCEL = arrayACCEL.GetAt(iLoop); + lpAccel[iLoop].fVirt = pACCEL->fVirt; + lpAccel[iLoop].key = pACCEL->key; + lpAccel[iLoop].cmd = pACCEL->cmd; + + delete pACCEL; + } + arrayACCEL.RemoveAll(); + + HACCEL hNewTable = CreateAcceleratorTable(lpAccel, nAccel); + if (!hNewTable) { + ::LocalFree(lpAccel); + return false; + } + HACCEL hOldTable = theApp.hAccel; + if (!::DestroyAcceleratorTable(hOldTable)) { + ::LocalFree(lpAccel); + return false; + } + theApp.hAccel = hNewTable; + ::LocalFree(lpAccel); + + UpdateMenu(GetMenu(*AfxGetApp()->m_pMainWnd)); + + return true; +} + + +////////////////////////////////////////////////////////////////////// +// Create/Destroy accelerators +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::DeleteAccel(BYTE cVirt, WORD wIDCommand, WORD wKey) +{ + CCmdAccelOb* pCmdAccel = NULL; + if (m_mapAccelTable.Lookup(wIDCommand, pCmdAccel) == TRUE) { + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + POSITION PrevPos; + CAccelsOb* pAccel = NULL; + while (pos != NULL) { + PrevPos = pos; + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel->m_bLocked == true) + return false; + + if (pAccel->m_cVirt == cVirt && pAccel->m_wKey == wKey) { + pCmdAccel->m_Accels.RemoveAt(PrevPos); + delete pAccel; + return true; + } + } + } + return false; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::DeleteEntry(WORD wIDCommand) +{ + CCmdAccelOb* pCmdAccel = NULL; + VERIFY(m_mapAccelTable.Lookup(wIDCommand, pCmdAccel) == TRUE); + + CAccelsOb* pAccel; + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (pAccel->m_bLocked == true) + return false; + } + m_mapAccelString.RemoveKey(pCmdAccel->m_szCommand); + m_mapAccelTable.RemoveKey(wIDCommand); + delete pCmdAccel; + + return true; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::DeleteEntry(LPCTSTR szCommand) +{ + ASSERT(szCommand != NULL); + + WORD wIDCommand; + if (m_mapAccelString.Lookup(szCommand, wIDCommand) == TRUE) { + return DeleteEntry(wIDCommand); + } + return true; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::SetAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szCommand, bool bLocked) +{ + ASSERT(szCommand != NULL); + + return AddAccel(cVirt, wIDCommand, wKey, szCommand, bLocked); +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::AddCommandAccel(WORD wIDCommand, LPCTSTR szCommand, bool bLocked) +{ + ASSERT(szCommand != NULL); + + ASSERT(m_pWndConnected != NULL); + HACCEL hOriginalTable = theApp.hAccel; + + int nAccel = ::CopyAcceleratorTable(hOriginalTable, NULL, 0); + LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, (nAccel) * sizeof(ACCEL)); + if (!lpAccel) + return false; + ::CopyAcceleratorTable(hOriginalTable, lpAccel, nAccel); + + bool bRet = false; + for (int i = 0; i < nAccel; i++) { + if (lpAccel[i].cmd == wIDCommand) + bRet = AddAccel(lpAccel[i].fVirt, wIDCommand, lpAccel[i].key, szCommand, bLocked); + } + ::LocalFree(lpAccel); + return bRet; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::CreateEntry(WORD wIDCommand, LPCTSTR szCommand) +{ + ASSERT(szCommand != NULL); + + WORD wIDDummy; + if (m_mapAccelString.Lookup(szCommand, wIDDummy) == TRUE) + return false; + + CCmdAccelOb* pCmdAccel = new CCmdAccelOb(wIDCommand, szCommand); + ASSERT(pCmdAccel != NULL); + m_mapAccelTable.SetAt(wIDCommand, pCmdAccel); + m_mapAccelString.SetAt(szCommand, wIDCommand); + + return false; +} + + +////////////////////////////////////////////////////////////////////// +// Get a string from the ACCEL definition +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::GetStringFromACCEL(ACCEL* pACCEL, CString& szAccel) +{ + ASSERT(pACCEL != NULL); + + CAccelsOb accel(pACCEL); + accel.GetString(szAccel); + + if (szAccel.IsEmpty()) + return false; + else + return true; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::GetStringFromACCEL(BYTE cVirt, WORD nCode, CString& szAccel) +{ + CAccelsOb accel(cVirt, nCode); + accel.GetString(szAccel); + + if (szAccel.IsEmpty()) + return false; + else + return true; +} + + +////////////////////////////////////////////////////////////////////// +// Copy function +// +CAcceleratorManager& CAcceleratorManager::operator=(const CAcceleratorManager& accelmgr) +{ + Reset(); + + CCmdAccelOb* pCmdAccel; + CCmdAccelOb* pNewCmdAccel; + WORD wKey; + // Copy the 2 tables : normal accel table... + POSITION pos = accelmgr.m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + accelmgr.m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + pNewCmdAccel = new CCmdAccelOb; + ASSERT(pNewCmdAccel != NULL); + *pNewCmdAccel = *pCmdAccel; + m_mapAccelTable.SetAt(wKey, pNewCmdAccel); + } + // ... and saved accel table. + pos = accelmgr.m_mapAccelTableSaved.GetStartPosition(); + while (pos != NULL) { + accelmgr.m_mapAccelTableSaved.GetNextAssoc(pos, wKey, pCmdAccel); + pNewCmdAccel = new CCmdAccelOb; + ASSERT(pNewCmdAccel != NULL); + *pNewCmdAccel = *pCmdAccel; + m_mapAccelTableSaved.SetAt(wKey, pNewCmdAccel); + } + + // The Strings-ID table + CString szKey; + pos = accelmgr.m_mapAccelString.GetStartPosition(); + while (pos != NULL) { + accelmgr.m_mapAccelString.GetNextAssoc(pos, szKey, wKey); + m_mapAccelString.SetAt(szKey, wKey); + } + m_bDefaultTable = accelmgr.m_bDefaultTable; + + return *this; +} + +void CAcceleratorManager::UpdateMenu(HMENU menu) +{ + int count = GetMenuItemCount(menu); + + OSVERSIONINFO info; + info.dwOSVersionInfoSize = sizeof(info); + GetVersionEx(&info); + + if(info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + MENUITEMINFO info; + char ss[128]; + ZeroMemory(&info, sizeof(info)); + info.cbSize = sizeof(info) - sizeof(HBITMAP); + info.fMask = MIIM_ID | MIIM_SUBMENU; + for(int i = 0; i < count; i++) { + GetMenuItemInfo(menu, i, TRUE, &info); + + if(info.hSubMenu != NULL) { + UpdateMenu(info.hSubMenu); + } else { + if(info.wID != (UINT)-1) { + MENUITEMINFO info2; + ZeroMemory(&info2, sizeof(info2)); + info2.cbSize = sizeof(info2) - sizeof(HBITMAP); + info2.fMask = MIIM_STRING; + info2.dwTypeData = ss; + info2.cch = 128; + GetMenuItemInfo(menu, i, MF_BYPOSITION, &info2); + CString str = ss; + int index = str.Find('\t'); + if(index != -1) + str = str.Left(index); + + WORD command = info.wID; + + CCmdAccelOb *o; + if(m_mapAccelTable.Lookup(command, o)) { + if(o->m_Accels.GetCount()) { + POSITION pos = o->m_Accels.GetHeadPosition(); + CAccelsOb *accel = o->m_Accels.GetNext(pos); + + CString s; + accel->GetString(s); + str += "\t"; + str += s; + } + } + if(str != ss) + ModifyMenu(menu, i, MF_BYPOSITION | MF_STRING, info.wID, str); + } + } + } + } else { + MENUITEMINFO info; + wchar_t ss[128]; + wchar_t str[512]; + + ZeroMemory(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_ID | MIIM_SUBMENU; + for(int i = 0; i < count; i++) { + GetMenuItemInfo(menu, i, TRUE, &info); + + if(info.hSubMenu != NULL) { + UpdateMenu(info.hSubMenu); + } else { + if(info.wID != (WORD)-1) { + MENUITEMINFOW info2; + ZeroMemory(&info2, sizeof(info2)); + info2.cbSize = sizeof(info2); + info2.fMask = MIIM_STRING; + info2.dwTypeData = ss; + info2.cch = 128; + GetMenuItemInfoW(menu, i, MF_BYPOSITION, &info2); + + wcscpy(str, ss); + + wchar_t *p = wcschr(str, '\t'); + if(p) + *p = 0; + + CCmdAccelOb *o; + WORD command = info.wID; + if(m_mapAccelTable.Lookup(command, o)) { + if(o->m_Accels.GetCount()) { + POSITION pos = o->m_Accels.GetHeadPosition(); + + CAccelsOb *accel = o->m_Accels.GetNext(pos); + + CString s; + accel->GetString(s); + + wchar_t temp[128]; + temp[0] = '\t'; + temp[1] = 0; + wcscat(str, temp); + p = temp; + for(const char *sp = s; *sp; sp++) + *p++ = *sp; + *p = 0; + wcscat(str, temp); + } + } + if(wcscmp(str,ss)) + ModifyMenuW(menu, i, MF_BYPOSITION | MF_STRING, info.wID, str); + } + } + } + } +} + +////////////////////////////////////////////////////////////////////// +// In/Out to the registry +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::Load(HKEY hRegKey, LPCTSTR szRegKey) +{ + ASSERT(szRegKey != NULL); + + m_hRegKey = hRegKey; + m_szRegKey = szRegKey; + + DWORD data[2048/sizeof(DWORD)]; + + DWORD len = sizeof(data); + if(regQueryBinaryValue("keyboard", (char *)data, len)) { + int count = len/sizeof(DWORD); + + CCmdAccelOb* pCmdAccel; + CAccelsOb* pAccel; + DWORD dwIDAccelData, dwAccelData; + BOOL bExistID; + int iIndex = 0; + if(count) { + WORD wKey; + POSITION pos = m_mapAccelTable.GetStartPosition(); + + while(pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + pCmdAccel->DeleteUserAccels(); + } + + while(iIndex < count) { + dwIDAccelData = data[iIndex++]; + + WORD wIDCommand = LOWORD(dwIDAccelData); + bExistID = m_mapAccelTable.Lookup(wIDCommand, pCmdAccel); + + if (bExistID) { + pCmdAccel->DeleteUserAccels(); + } + for (int j = 0; j < HIWORD(dwIDAccelData) && iIndex < count; j++) { + dwAccelData = data[iIndex++]; + if (bExistID) { + pAccel = new CAccelsOb; + ASSERT(pAccel != NULL); + pAccel->SetData(dwAccelData); + pCmdAccel->Add(pAccel); + } + } + } + } + UpdateWndTable(); + return true; + } + return false; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::Load() +{ + BOOL bRet = FALSE; + if (!m_szRegKey.IsEmpty()) + bRet = Load(m_hRegKey, m_szRegKey); + + if (bRet == TRUE) + return true; + else + return false; +} + + +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::Write() +{ + CDWordArray AccelsDatasArray; + CDWordArray CmdDatasArray; + + int iCount = 0; + CCmdAccelOb* pCmdAccel; + CAccelsOb* pAccel; + DWORD dwAccelData; + + WORD wKey; + POSITION pos = m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + CmdDatasArray.RemoveAll(); + + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + // if (!pAccel->m_bLocked) { + dwAccelData = pAccel->GetData(); + CmdDatasArray.Add(dwAccelData); + // } + } + + if (CmdDatasArray.GetSize() > 0) { + CmdDatasArray.InsertAt(0, MAKELONG(pCmdAccel->m_wIDCommand, CmdDatasArray.GetSize())); + + AccelsDatasArray.Append(CmdDatasArray); + iCount++; + } + } + // AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount)); + + int count = AccelsDatasArray.GetSize(); + DWORD *data = (DWORD *)malloc(count * sizeof(DWORD)); + ASSERT(data != NULL); + + for(int index = 0; index < count; index++) + data[index] = AccelsDatasArray[index]; + + regSetBinaryValue("keyboard", (char *)data, count*sizeof(DWORD)); + + AccelsDatasArray.RemoveAll(); + CmdDatasArray.RemoveAll(); + + free(data); + + return true; +} + + +////////////////////////////////////////////////////////////////////// +// Defaults values management. +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::CreateDefaultTable() +{ + if (m_bDefaultTable) + return false; + + CCmdAccelOb* pCmdAccel; + CCmdAccelOb* pNewCmdAccel; + + CAccelsOb* pAccel; + CAccelsOb* pNewAccel; + + WORD wKey; + POSITION pos = m_mapAccelTable.GetStartPosition(); + while (pos != NULL) { + m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + pNewCmdAccel = new CCmdAccelOb; + ASSERT(pNewCmdAccel != NULL); + + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = pCmdAccel->m_Accels.GetNext(pos); + if (!pAccel->m_bLocked) { + pNewAccel = new CAccelsOb; + ASSERT(pNewAccel != NULL); + + *pNewAccel = *pAccel; + pNewCmdAccel->m_Accels.AddTail(pNewAccel); + } + } + if (pNewCmdAccel->m_Accels.GetCount() != 0) { + pNewCmdAccel->m_wIDCommand = pCmdAccel->m_wIDCommand; + pNewCmdAccel->m_szCommand = pCmdAccel->m_szCommand; + + m_mapAccelTableSaved.SetAt(wKey, pNewCmdAccel); + } else + delete pNewCmdAccel; + } + + m_bDefaultTable = true; + return true; +} + +#include "mainwnd.h" +////////////////////////////////////////////////////////////////////// +// +// +bool CAcceleratorManager::Default() +{ + /// this is NYI for some reason, so the "Reset All" button doesn't work + +/* // still doesn't work: + Reset(); + regDeleteValue("keyboard"); + regDeleteValue("keyboardCount"); + Connect((MainWnd *)theApp.m_pMainWnd); + extern void winAccelAddCommands(CAcceleratorManager& mgr); + Load(); + CreateDefaultTable(); + winAccelAddCommands(*this); + UpdateWndTable(); + Write(); + UpdateMenu(theApp.menu); + m_pWndConnected = NULL; +*/ + return true; +} diff --git a/src/win32/AcceleratorManager.h b/src/win32/AcceleratorManager.h new file mode 100644 index 0000000..73d3740 --- /dev/null +++ b/src/win32/AcceleratorManager.h @@ -0,0 +1,144 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : AcceleratorManager.h +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Author : T.Maurel +// Date : 17.08.98 +// +// Remarks : interface for the CAcceleratorManager class. +// +//////////////////////////////////////////////////////////////////////////////// +#if !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_) +#define AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + + + +#include "CmdAccelOb.h" + + +// Helper map +#include // MFC Templates extension +#ifndef CMapStringToWord +typedef CMap< CString, LPCSTR, WORD, WORD& > CMapStringToWord; +#endif + +#ifndef CMapWordToCCmdAccelOb +typedef CMap< WORD, WORD&, CCmdAccelOb*, CCmdAccelOb*& > CMapWordToCCmdAccelOb; +#endif + + +////////////////////////////////////////////////////////////////////// +// +// +class CAcceleratorManager : public CObject { + friend class AccelEditor; + public: + CAcceleratorManager(); + virtual ~CAcceleratorManager(); + + // Operations + public: + void UpdateMenu(HMENU menu); + void UpdateMenu(); + // Connection to the main application wnd + void Connect(CWnd *pWnd, bool bAutoSave = true); + // In/Out with the registry + bool Load(HKEY hRegKey, LPCTSTR szRegKey); + bool Load(); + bool Write(); + // Get the initials accels, not the user's + bool Default(); + // Save a copy in the 2 maps called xxxSaved, which are used in case + // of Default(), to reload the defaults accels. + bool CreateDefaultTable(); + bool IsDefaultTableAvailable() {return m_bDefaultTable;} + bool IsMapStringCommandsEmpty() { + if (m_mapAccelString.IsEmpty()) + return true; + else + return false; + } + + // Registry access configuration + bool GetRegKey(HKEY& hRegKey, CString &szRegKey); + bool SetRegKey(HKEY hRegKey, LPCTSTR szRegKey); + bool IsAutoSave() {return m_bAutoSave;} + void SetAutoSave(bool bAutoSave) {m_bAutoSave = bAutoSave;} + + // Helper fct, used for new menus strings + bool GetStringFromACCEL(ACCEL* pACCEL, CString& szAccel); + bool GetStringFromACCEL(BYTE cVirt, WORD nCode, CString& szAccel); + + // Update the ACCELS table in the application, from the specified + // datas in the manager. + bool UpdateWndTable(); + + // Modification helper fcts + bool SetAccel(BYTE cVirt, WORD wIDCommand, WORD wNewCaract, + LPCTSTR szCommand, bool bLocked = false); + bool AddCommandAccel(WORD wIDCommand, LPCTSTR szCommand, bool bLocked = true); + bool CreateEntry(WORD wIDCommand, LPCTSTR szCommand); + + bool DeleteEntry(LPCTSTR szCommand); + bool DeleteEntry(WORD wIDCommand); + bool DeleteAccel(BYTE cVirt, WORD wIDCommand, WORD wNewCaract); + + // Affectation operator + CAcceleratorManager& operator=(const CAcceleratorManager& accelmgr); + + public: +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + protected: + // Erase all the datas + void Reset(); + // Internal affect fct. + bool AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey, + LPCTSTR szCommand, bool bLocked); + + // Attributes + protected: + CWnd *m_pWndConnected; + + // User datas +/*TEMP HACK*/public: CMapStringToWord m_mapAccelString; +/*TEMP HACK*/public: CMapWordToCCmdAccelOb m_mapAccelTable; + protected: + // Default datas + CMapWordToCCmdAccelOb m_mapAccelTableSaved; + bool m_bDefaultTable; + + // Where the users datas will be saved in the registry + HKEY m_hRegKey; + CString m_szRegKey; + // if true, there is an auto-save in the registry, when the destructor is called + bool m_bAutoSave; + +}; + + +#endif // !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_) diff --git a/src/win32/Associate.cpp b/src/win32/Associate.cpp new file mode 100644 index 0000000..7eca0f8 --- /dev/null +++ b/src/win32/Associate.cpp @@ -0,0 +1,128 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Associate.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Associate.h" +#include "Reg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// Associate dialog + + +Associate::Associate(CWnd* pParent /*=NULL*/) + : CDialog(Associate::IDD, pParent) +{ + //{{AFX_DATA_INIT(Associate) + m_agb = FALSE; + m_bin = FALSE; + m_cgb = FALSE; + m_gb = FALSE; + m_gba = FALSE; + m_gbc = FALSE; + m_sgb = FALSE; + //}}AFX_DATA_INIT +} + + +void Associate::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(Associate) + DDX_Check(pDX, IDC_AGB, m_agb); + DDX_Check(pDX, IDC_BIN, m_bin); + DDX_Check(pDX, IDC_CGB, m_cgb); + DDX_Check(pDX, IDC_GB, m_gb); + DDX_Check(pDX, IDC_GBA, m_gba); + DDX_Check(pDX, IDC_GBC, m_gbc); + DDX_Check(pDX, IDC_SGB, m_sgb); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(Associate, CDialog) + //{{AFX_MSG_MAP(Associate) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Associate message handlers + +BOOL Associate::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void Associate::OnCancel() +{ + EndDialog(FALSE); +} + +void Associate::OnOk() +{ + UpdateData(); + + int mask = 0; + if(m_gb) + mask |= 1; + if(m_sgb) + mask |= 2; + if(m_cgb) + mask |= 4; + if(m_gbc) + mask |= 8; + if(m_gba) + mask |= 16; + if(m_agb) + mask |= 32; + if(m_bin) + mask |= 64; + if(mask) { + char applicationPath[2048]; + CString commandPath; + LPCTSTR types[] = { ".gb", ".sgb", ".cgb", ".gbc", ".gba", ".agb", ".bin" }; + GetModuleFileName(NULL, applicationPath, 2048); + commandPath.Format("\"%s\" \"%%1\"", applicationPath); + regAssociateType("VisualBoyAdvance.Binary", + "Binary", + commandPath); + + for(int i = 0; i < 7; i++) { + if(mask & (1< 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Associate.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// Associate dialog + +class Associate : public CDialog +{ + // Construction + public: + Associate(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(Associate) + enum { IDD = IDD_ASSOCIATIONS }; + BOOL m_agb; + BOOL m_bin; + BOOL m_cgb; + BOOL m_gb; + BOOL m_gba; + BOOL m_gbc; + BOOL m_sgb; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Associate) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(Associate) + virtual BOOL OnInitDialog(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ASSOCIATE_H__3326525B_B405_40A7_82C4_B2594669A930__INCLUDED_) diff --git a/src/win32/BitmapControl.cpp b/src/win32/BitmapControl.cpp new file mode 100644 index 0000000..0aacc57 --- /dev/null +++ b/src/win32/BitmapControl.cpp @@ -0,0 +1,287 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// BitmapControl.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "BitmapControl.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +bool BitmapControl::isRegistered = false; + +///////////////////////////////////////////////////////////////////////////// +// BitmapControl + +IMPLEMENT_DYNCREATE(BitmapControl, CScrollView) + + BitmapControl::BitmapControl() +{ + w = 0; + h = 0; + data = NULL; + bmpInfo = NULL; + stretch = false; + registerClass(); + CSize sizeTotal; + sizeTotal.cx = sizeTotal.cy = 0; + SetScrollSizes(MM_TEXT, sizeTotal); +} + +BitmapControl::~BitmapControl() +{ +} + + +BEGIN_MESSAGE_MAP(BitmapControl, CScrollView) + //{{AFX_MSG_MAP(BitmapControl) + ON_WM_ERASEBKGND() + ON_WM_SIZE() + ON_WM_LBUTTONDOWN() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// BitmapControl drawing + +void BitmapControl::OnInitialUpdate() +{ + CScrollView::OnInitialUpdate(); + + CSize sizeTotal; + // TODO: calculate the total size of this view + sizeTotal.cx = sizeTotal.cy = 100; + SetScrollSizes(MM_TEXT, sizeTotal); +} + +void BitmapControl::OnDraw(CDC* dc) +{ + RECT r; + GetClientRect(&r); + int w1 = r.right - r.left; + int h1 = r.bottom - r.top; + CDC memDC; + memDC.CreateCompatibleDC(dc); + if(!stretch) { + if(w > w1) + w1 = w; + if(h > h1) + h1 = h; + } + CBitmap bitmap, *pOldBitmap; + bitmap.CreateCompatibleBitmap(dc, w1, h1); + pOldBitmap = memDC.SelectObject(&bitmap); + if(stretch) { + bmpInfo->bmiHeader.biWidth = w; + bmpInfo->bmiHeader.biHeight = -h; + + StretchDIBits(memDC.GetSafeHdc(), + 0, + 0, + w1, + h1, + 0, + 0, + w, + h, + data, + bmpInfo, + DIB_RGB_COLORS, + SRCCOPY); + } else { + FillOutsideRect(&memDC, CBrush::FromHandle(GetSysColorBrush(COLOR_BTNFACE))); + + bmpInfo->bmiHeader.biWidth = w; + bmpInfo->bmiHeader.biHeight = -h; + SetDIBitsToDevice(memDC.GetSafeHdc(), + 0, + 0, + w, + h, + 0, + 0, + 0, + h, + data, + bmpInfo, + DIB_RGB_COLORS); + } + + dc->BitBlt(0,0,w1,h1, + &memDC,0,0,SRCCOPY); + memDC.SelectObject(pOldBitmap); + + bitmap.DeleteObject(); + memDC.DeleteDC(); +} + +///////////////////////////////////////////////////////////////////////////// +// BitmapControl diagnostics + +#ifdef _DEBUG +void BitmapControl::AssertValid() const +{ + CScrollView::AssertValid(); +} + +void BitmapControl::Dump(CDumpContext& dc) const +{ + CScrollView::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// BitmapControl message handlers + +BOOL BitmapControl::OnEraseBkgnd(CDC* pDC) +{ + return TRUE; +} + +void BitmapControl::OnSize(UINT nType, int cx, int cy) +{ + if(!stretch) + CScrollView::OnSize(nType, cx, cy); +} + +void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) +{ + if(!data) + return; + int x = pt.x; + int y = pt.y; + + WPARAM point; + + if(stretch) { + RECT rect; + GetClientRect(&rect); + + int height = rect.bottom - rect.top; + int width = rect.right - rect.left; + + int xx = (x * w) / width; + int yy = (y * h) / height; + + point = xx | (yy<<16); + + int xxx = xx / 8; + int yyy = yy / 8; + + for(int i = 0; i < 8; i++) { + memcpy(&colors[i*3*8], &data[xxx * 8 * 3 + + w * yyy * 8 * 3 + + i * w * 3], 8 * 3); + } + } else { + POINT p; + p.x = GetScrollPos(SB_HORZ); + p.y = GetScrollPos(SB_VERT); + + p.x += x; + p.y += y; + + if(p.x >= w || + p.y >= h) + return; + + point = p.x | (p.y<<16); + + int xxx = p.x / 8; + int yyy = p.y / 8; + + for(int i = 0; i < 8; i++) { + memcpy(&colors[i*3*8], &data[xxx * 8 * 3 + + w * yyy * 8 * 3 + + i * w * 3], 8 * 3); + } + } + + GetParent()->SendMessage(WM_MAPINFO, + point, + (LPARAM)colors); +} + +void BitmapControl::setBmpInfo(BITMAPINFO *info) +{ + bmpInfo = info; +} + +void BitmapControl::setData(u8 *d) +{ + data = d; +} + +void BitmapControl::setSize(int w1, int h1) +{ + if(w != w1 || h != h1) { + w = w1; + h = h1; + SIZE s; + s.cx = w; + s.cy = h; + SetScrollSizes(MM_TEXT, s); + } +} + +void BitmapControl::refresh() +{ + Invalidate(); +} + + +void BitmapControl::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaBitmapControl"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} + +void BitmapControl::setStretch(bool b) +{ + if(b != stretch) { + stretch = b; + Invalidate(); + } +} + +bool BitmapControl::getStretch() +{ + return stretch; +} + +void BitmapControl::PostNcDestroy() +{ +} diff --git a/src/win32/BitmapControl.h b/src/win32/BitmapControl.h new file mode 100644 index 0000000..f2f0c4d --- /dev/null +++ b/src/win32/BitmapControl.h @@ -0,0 +1,96 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_) +#define AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// BitmapControl.h : header file +// +#ifndef WM_MAPINFO +#define WM_MAPINFO WM_APP+101 +#endif + +///////////////////////////////////////////////////////////////////////////// +// BitmapControl view + +class BitmapControl : public CScrollView +{ + public: + BitmapControl(); // protected constructor used by dynamic creation + protected: + DECLARE_DYNCREATE(BitmapControl) + + // Attributes + public: + + // Operations + public: + void setStretch(bool b); + void refresh(); + void setSize(int w1, int h1); + void setData(u8 *d); + void setBmpInfo(BITMAPINFO *info); + static bool isRegistered; + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(BitmapControl) + protected: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual void OnInitialUpdate(); // first time after construct + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + public: + bool getStretch(); + virtual ~BitmapControl(); + protected: +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + // Generated message map functions + //{{AFX_MSG(BitmapControl) + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + void registerClass(); + bool stretch; + u8 colors[3*64]; + BITMAPINFO *bmpInfo; + u8 * data; + int h; + int w; +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_) diff --git a/src/win32/BugReport.cpp b/src/win32/BugReport.cpp new file mode 100644 index 0000000..0742b5a --- /dev/null +++ b/src/win32/BugReport.cpp @@ -0,0 +1,249 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// BugReport.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "BugReport.h" + +#include "../agbprint.h" +#include "../AutoBuild.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Port.h" +#include "../RTC.h" +#include "../Sound.h" +#include "../gb/gbCheats.h" +#include "../gb/gbGlobals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// BugReport dialog + + +BugReport::BugReport(CWnd* pParent /*=NULL*/) + : CDialog(BugReport::IDD, pParent) +{ + //{{AFX_DATA_INIT(BugReport) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void BugReport::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(BugReport) + DDX_Control(pDX, IDC_BUG_REPORT, m_report); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(BugReport, CDialog) + //{{AFX_MSG_MAP(BugReport) + ON_BN_CLICKED(IDC_COPY, OnCopy) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// BugReport message handlers + +void BugReport::OnCopy() +{ + OpenClipboard(); + + EmptyClipboard(); + CString report; + m_report.GetWindowText(report); + + HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, + (report.GetLength() + 1) * sizeof(CHAR)); + if (hglbCopy == NULL) { + CloseClipboard(); + return; + } + + // Lock the handle and copy the text to the buffer. + + LPSTR lptstrCopy = (LPSTR)GlobalLock(hglbCopy); + memcpy(lptstrCopy, (const char *)report, + report.GetLength() * sizeof(CHAR)); + lptstrCopy[report.GetLength()] = (TCHAR) 0; // null character + GlobalUnlock(hglbCopy); + + // Place the handle on the clipboard. + + SetClipboardData(CF_TEXT, hglbCopy); + CloseClipboard(); + + systemMessage(IDS_BUG_REPORT, "Bug report has been copied to the Clipboard"); +} + +void BugReport::OnOk() +{ + EndDialog(TRUE); +} + +BOOL BugReport::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CenterWindow(); + + CString report = createReport(); + + m_report.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT))); + + m_report.SetWindowText(report); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + + +static void AppendFormat(CString& report, const char *format, ...) +{ + CString buffer; + va_list valist; + + va_start(valist, format); + buffer.FormatV(format, valist); + va_end(valist); + report += buffer; +} + +CString BugReport::createReport() +{ + theApp.winCheckFullscreen(); + + CString report = ""; + AppendFormat(report, "Emu version : %s\r\n", VERSION); + AppendFormat(report, "Emu Type : %s\r\n", +#ifdef FINAL_VERSION +#ifdef DEV_VERSION + "Development Version" +#else + "Normal Version" +#endif +#else + "Debug Version" +#endif + ); + + if(emulating) { + AppendFormat(report, "File : %s\r\n", theApp.szFile); + + char buffer[20]; + if(theApp.cartridgeType == 0) { + u32 check = 0; + for(int i = 0; i < 0x4000; i += 4) { + check += *((u32 *)&bios[i]); + } + AppendFormat(report, "BIOS Checksum: %08X\r\n", check); + + strncpy(buffer, (const char *)&rom[0xa0], 12); + buffer[12] = 0; + AppendFormat(report, "Internal name: %s\r\n", buffer); + + strncpy(buffer, (const char *)&rom[0xac], 4); + buffer[4] = 0; + AppendFormat(report, "Game code : %s\r\n", buffer); + + CString res = ""; + u32 *p = (u32 *)rom; + u32 *end = (u32 *)((char *)rom+theApp.romSize); + while(p < end) { + u32 d = READ32LE(p); + + if(d == 0x52504545) { + if(memcmp(p, "EEPROM_", 7) == 0) { + res += (const char *)p; + res += ' '; + } + } else if (d == 0x4D415253) { + if(memcmp(p, "SRAM_", 5) == 0) { + res += (const char *)p; + res += ' '; + } + } else if (d == 0x53414C46) { + if(memcmp(p, "FLASH1M_", 8) == 0) { + res += (const char *)p; + res += ' '; + } + } else if(memcmp(p, "FLASH", 5) == 0) { + res += (const char *)p; + res += ' '; + } else if (d == 0x52494953) { + if(memcmp(p, "SIIRTC_V", 8) == 0) { + res += (const char *)p; + res += ' '; + } + } + p++; + } + if(res.GetLength() > 0) + AppendFormat(report, "Cart Save : %s\r\n", res); + } else if(theApp.cartridgeType == 1) { + strncpy(buffer, (const char *)&gbRom[0x134], 15); + buffer[15] = 0; + AppendFormat(report, "Game title : %s\r\n", buffer); + } + } + + AppendFormat(report, "Using BIOS : %d\r\n", theApp.useBiosFile); + AppendFormat(report, "Skip BIOS : %d\r\n", theApp.skipBiosFile); + AppendFormat(report, "Disable SFX : %d\r\n", cpuDisableSfx); + AppendFormat(report, "Skip intro : %d\r\n", theApp.removeIntros); + AppendFormat(report, "Throttle : %d\r\n", theApp.throttle); + AppendFormat(report, "Rewind : %d\r\n", theApp.rewindTimer); +/// AppendFormat(report, "Auto frame : %d\r\n", theApp.autoFrameSkip); + AppendFormat(report, "Video option : %d\r\n", theApp.videoOption); + AppendFormat(report, "Render type : %d\r\n", theApp.renderMethod); + AppendFormat(report, "Color depth : %d\r\n", systemColorDepth); + AppendFormat(report, "Red shift : %08x\r\n", systemRedShift); + AppendFormat(report, "Green shift : %08x\r\n", systemGreenShift); + AppendFormat(report, "Blue shift : %08x\r\n", systemBlueShift); + AppendFormat(report, "Layer setting: %04X\r\n", layerSettings); + AppendFormat(report, "Save type : %d (%d)\r\n", + theApp.winSaveType, cpuSaveType); + AppendFormat(report, "Flash size : %08X (%08x)\r\n", + theApp.winFlashSize, flashSize); + AppendFormat(report, "RTC : %d (%d)\r\n", theApp.winRtcEnable, + rtcIsEnabled()); + AppendFormat(report, "AGBPrint : %d\r\n", agbPrintIsEnabled()); + AppendFormat(report, "Speed toggle : %d\r\n", theApp.speedupToggle); + AppendFormat(report, "Synchronize : %d\r\n", synchronize); + AppendFormat(report, "Sound OFF : %d\r\n", soundOffFlag); + AppendFormat(report, "Channels : %04x\r\n", soundGetEnable() & 0x30f); + AppendFormat(report, "Old Sync : %d\r\n", theApp.useOldSync); + AppendFormat(report, "Priority : %d\r\n", theApp.threadPriority); + AppendFormat(report, "Filters : %d (%d)\r\n", theApp.filterType, theApp.ifbType); + AppendFormat(report, "Cheats : %d\r\n", cheatsNumber); + AppendFormat(report, "GB Cheats : %d\r\n", gbCheatNumber); + AppendFormat(report, "GB Emu Type : %d\r\n", gbEmulatorType); + + return report; +} diff --git a/src/win32/BugReport.h b/src/win32/BugReport.h new file mode 100644 index 0000000..6d5a0cf --- /dev/null +++ b/src/win32/BugReport.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_BUGREPORT_H__DE7BC381_E45D_4200_910C_E5378E6364C9__INCLUDED_) +#define AFX_BUGREPORT_H__DE7BC381_E45D_4200_910C_E5378E6364C9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// BugReport.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// BugReport dialog + +class BugReport : public CDialog +{ + // Construction + public: + BugReport(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(BugReport) + enum { IDD = IDD_BUG_REPORT }; + CEdit m_report; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(BugReport) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + CString createReport(); + + // Generated message map functions + //{{AFX_MSG(BugReport) + afx_msg void OnCopy(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_BUGREPORT_H__DE7BC381_E45D_4200_910C_E5378E6364C9__INCLUDED_) diff --git a/src/win32/CmdAccelOb.cpp b/src/win32/CmdAccelOb.cpp new file mode 100644 index 0000000..828b20d --- /dev/null +++ b/src/win32/CmdAccelOb.cpp @@ -0,0 +1,558 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : CmdAccelOb.cpp +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Author : T.Maurel +// Date : 17.08.98 +// +// Remarks : +// +//////////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CmdAccelOb.h" + +//////////////////////////////////////////////////////////////////////// +// +// +MAPVIRTKEYS mapVirtKeys[] = { + {VK_LBUTTON, "LBUTTON"}, + {VK_RBUTTON, "RBUTTON"}, + {VK_CANCEL, "Cancel"}, + {VK_MBUTTON, "MBUTTON"}, + {VK_BACK, "Backspace"}, + {VK_TAB, "Tab"}, + {VK_CLEAR, "Clear"}, + {VK_RETURN, "Enter"}, + {VK_SHIFT, "Shift"}, + {VK_LSHIFT, "LShift"}, + {VK_RSHIFT, "RShift"}, + {VK_CONTROL, "Control"}, + {VK_LCONTROL, "LControl"}, + {VK_RCONTROL, "RControl"}, + {VK_MENU, "Alt"}, + {VK_LMENU, "LAlt"}, + {VK_RMENU, "RAlt"}, + {VK_PAUSE, "Pause"}, + {VK_CAPITAL, "Caps Lock"}, + {VK_ESCAPE, "Escape"}, + {VK_SPACE, "Space"}, + {VK_PRIOR, "Prior"}, + {VK_NEXT, "Next"}, + {VK_END, "End"}, + {VK_HOME, "Home"}, + {VK_LEFT, "Left"}, + {VK_UP, "Up"}, + {VK_RIGHT, "Right"}, + {VK_DOWN, "Down"}, + {VK_SELECT, "Select"}, + {VK_PRINT, "Print"}, + {VK_EXECUTE, "Execute"}, + {VK_SNAPSHOT, "Snapshot"}, + {VK_INSERT, "Insert"}, + {VK_DELETE, "Delete"}, + {VK_HELP, "Help"}, + {WORD('0'), "0"}, + {WORD('1'), "1"}, + {WORD('2'), "2"}, + {WORD('3'), "3"}, + {WORD('4'), "4"}, + {WORD('5'), "5"}, + {WORD('6'), "6"}, + {WORD('7'), "7"}, + {WORD('8'), "8"}, + {WORD('9'), "9"}, + {WORD('A'), "A"}, + {WORD('B'), "B"}, + {WORD('C'), "C"}, + {WORD('D'), "D"}, + {WORD('E'), "E"}, + {WORD('F'), "F"}, + {WORD('G'), "G"}, + {WORD('H'), "H"}, + {WORD('I'), "I"}, + {WORD('J'), "J"}, + {WORD('K'), "K"}, + {WORD('L'), "L"}, + {WORD('M'), "M"}, + {WORD('N'), "N"}, + {WORD('O'), "O"}, + {WORD('P'), "P"}, + {WORD('Q'), "Q"}, + {WORD('R'), "R"}, + {WORD('S'), "S"}, + {WORD('T'), "T"}, + {WORD('U'), "U"}, + {WORD('V'), "V"}, + {WORD('W'), "W"}, + {WORD('X'), "X"}, + {WORD('Y'), "Y"}, + {WORD('Z'), "Z"}, + {VK_LWIN, "LWIN"}, + {VK_RWIN, "RWIN"}, + {VK_APPS, "APPS"}, + {VK_NUMPAD0, "NumPad0"}, + {VK_NUMPAD1, "NumPad1"}, + {VK_NUMPAD2, "NumPad2"}, + {VK_NUMPAD3, "NumPad3"}, + {VK_NUMPAD4, "NumPad4"}, + {VK_NUMPAD5, "NumPad5"}, + {VK_NUMPAD6, "NumPad6"}, + {VK_NUMPAD7, "NumPad7"}, + {VK_NUMPAD8, "NumPad8"}, + {VK_NUMPAD9, "NumPad9"}, + {VK_MULTIPLY, "NumpadMultiply"}, + {VK_ADD, "NumpadAdd"}, + {VK_SEPARATOR, "Separator"}, + {VK_SUBTRACT, "NumpadSubtract"}, + {VK_DECIMAL, "NumpadDecimal"}, + {VK_DIVIDE, "NumpadDivide"}, + {VK_F1, "F1"}, + {VK_F2, "F2"}, + {VK_F3, "F3"}, + {VK_F4, "F4"}, + {VK_F5, "F5"}, + {VK_F6, "F6"}, + {VK_F7, "F7"}, + {VK_F8, "F8"}, + {VK_F9, "F9"}, + {VK_F10, "F10"}, + {VK_F11, "F11"}, + {VK_F12, "F12"}, + {VK_F13, "F13"}, + {VK_F14, "F14"}, + {VK_F15, "F15"}, + {VK_F16, "F16"}, + {VK_F17, "F17"}, + {VK_F18, "F18"}, + {VK_F19, "F19"}, + {VK_F20, "F20"}, + {VK_F21, "F21"}, + {VK_F22, "F22"}, + {VK_F23, "F23"}, + {VK_F24, "F24"}, + {VK_NUMLOCK, "Num Lock"}, + {VK_SCROLL, "Scroll Lock"}, + {VK_ATTN, "Attention"}, + {VK_CRSEL, "CRSEL"}, + {VK_EXSEL, "EXSEL"}, + {VK_EREOF, "EREOF"}, + {VK_PLAY, "Play"}, + {VK_ZOOM, "Zoom"}, + {VK_NONAME, "No Name"}, + {VK_PA1, "PA1"}, + {VK_OEM_CLEAR, "Clear2"}, + {VK_OEM_1, "Semicolon;"}, + {VK_OEM_2, "Slash/"}, + {VK_OEM_3, "Tilde~"}, + {VK_OEM_4, "LBracket["}, + {VK_OEM_5, "Backslash\\"}, + {VK_OEM_6, "RBracket]"}, + {VK_OEM_7, "Apostrophe'"}, + {VK_OEM_8, "OEM8"}, + {VK_OEM_PLUS, "Plus+"}, + {VK_OEM_MINUS, "Minus-"}, + {VK_OEM_COMMA, "Comma,"}, + {VK_OEM_PERIOD, "Period."}, + {VK_OEM_AX, "Apostrophe`"}, + {VK_OEM_102, "<> or \\|"}, + {VK_ICO_HELP, "ICO Help"}, + {VK_ICO_00, "ICO 00"}, + {VK_OEM_FJ_JISHO, "JISHO"}, + {VK_OEM_FJ_MASSHOU, "MASSHOU"}, + {VK_OEM_FJ_TOUROKU, "TOUROKU"}, + {VK_OEM_FJ_LOYA, "LOYA"}, + {VK_OEM_FJ_ROYA, "ROYA"}, + {VK_OEM_NEC_EQUAL, "Numpad Equals"}, +}; + + +//////////////////////////////////////////////////////////////////////// +// +// +MAPVIRTKEYS mapVirtSysKeys[] = { + {FCONTROL, "Ctrl"}, + {FALT, "Alt"}, + {FSHIFT, "Shift"}, +}; + + +//////////////////////////////////////////////////////////////////////// +// helper fct for external access +//////////////////////////////////////////////////////////////////////// +// +// +TCHAR* mapVirtKeysStringFromWORD(WORD wKey) +{ + for (int index = 0; index < sizeof(mapVirtKeys)/sizeof(mapVirtKeys[0]); index++) { + if (mapVirtKeys[index].wKey == wKey) + return mapVirtKeys[index].szKey; + } + return NULL; +} + + + +//////////////////////////////////////////////////////////////////////// +// +#define DEFAULT_ACCEL 0x01 +#define USER_ACCEL 0x02 + + +//////////////////////////////////////////////////////////////////////// +// +//////////////////////////////////////////////////////////////////////// +// +// +CAccelsOb::CAccelsOb() +{ + m_cVirt = 0; + m_wKey = 0; + m_bLocked = false; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CAccelsOb::CAccelsOb(CAccelsOb* pFrom) +{ + ASSERT(pFrom != NULL); + + m_cVirt = pFrom->m_cVirt; + m_wKey = pFrom->m_wKey; + m_bLocked = pFrom->m_bLocked; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CAccelsOb::CAccelsOb(BYTE cVirt, WORD wKey, bool bLocked) +{ + m_cVirt = cVirt; + m_wKey = wKey; + m_bLocked = bLocked; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CAccelsOb::CAccelsOb(LPACCEL pACCEL) +{ + ASSERT(pACCEL != NULL); + + m_cVirt = pACCEL->fVirt; + m_wKey = pACCEL->key; + m_bLocked = false; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CAccelsOb& CAccelsOb::operator=(const CAccelsOb& from) +{ + m_cVirt = from.m_cVirt; + m_wKey = from.m_wKey; + m_bLocked = from.m_bLocked; + + return *this; +} + + +//////////////////////////////////////////////////////////////////////// +// +//////////////////////////////////////////////////////////////////////// +// +// +void CAccelsOb::GetString(CString& szBuffer) +{ + szBuffer = ""; + + // modifiers part + for (int i = 0; i < sizetable(mapVirtSysKeys); i++) { + if (m_cVirt & mapVirtSysKeys[i].wKey) { + szBuffer += mapVirtSysKeys[i].szKey; + if (m_wKey) + szBuffer += "+"; + } + } + + // in case of the object is not assigned, we avoid error messages + if (m_wKey == 0) + return; + + // and virtual key part + for (int i = 0; i < sizetable(mapVirtKeys); i++) { + if (m_wKey == mapVirtKeys[i].wKey) { + szBuffer += mapVirtKeys[i].szKey; + return; + } + } + + AfxMessageBox("Internal error : (CAccelsOb::GetString) m_wKey invalid"); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +bool CAccelsOb::IsEqual(WORD wKey, bool bCtrl, bool bAlt, bool bShift) +{ + // CString szTemp; + // GetString(szTemp); + + + bool m_bCtrl = (m_cVirt & FCONTROL) ? true : false; + bool bRet = (bCtrl == m_bCtrl); + + bool m_bAlt = (m_cVirt & FALT) ? true : false; + bRet &= (bAlt == m_bAlt); + + bool m_bShift = (m_cVirt & FSHIFT) ? true : false; + bRet &= (bShift == m_bShift); + + bRet &= static_cast(m_wKey == wKey); + + return bRet; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +DWORD CAccelsOb::GetData() +{ + BYTE cLocalCodes = 0; + if (m_bLocked) + cLocalCodes = DEFAULT_ACCEL; + else + cLocalCodes = USER_ACCEL; + + WORD bCodes = MAKEWORD(m_cVirt, cLocalCodes); + return MAKELONG(m_wKey, bCodes); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +bool CAccelsOb::SetData(DWORD dwDatas) +{ + m_wKey = LOWORD(dwDatas); + + WORD bCodes = HIWORD(dwDatas); + m_cVirt = LOBYTE(bCodes); + + BYTE cLocalCodes = HIBYTE(bCodes); + m_bLocked = static_cast(cLocalCodes == DEFAULT_ACCEL); + return true; +} + +//////////////////////////////////////////////////////////////////////// +// +#ifdef _DEBUG +//////////////////////////////////////////////////////////////////////// +// +// +void CAccelsOb::AssertValid() const +{ + CObject::AssertValid(); +} + +//////////////////////////////////////////////////////////////////////// +// +// +void CAccelsOb::Dump(CDumpContext& dc) const +{ + dc << "\t\t"; + CObject::Dump(dc); + dc << "\t\tlocked=" << m_bLocked << ", cVirt=" << m_cVirt << ", wKey=" << m_wKey << "\n\n"; + +} +#endif + +//////////////////////////////////////////////////////////////////////// +// +//////////////////////////////////////////////////////////////////////// +// +// +CCmdAccelOb::CCmdAccelOb() +{ +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CCmdAccelOb::CCmdAccelOb(WORD wIDCommand, LPCTSTR szCommand) +{ + ASSERT(szCommand != NULL); + + m_wIDCommand = wIDCommand; + m_szCommand = szCommand; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CCmdAccelOb::CCmdAccelOb(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szCommand, bool bLocked) +{ + ASSERT(szCommand != NULL); + + m_wIDCommand = wIDCommand; + m_szCommand = szCommand; + + CAccelsOb* pAccel = DEBUG_NEW CAccelsOb(cVirt, wKey, bLocked); + ASSERT(pAccel != NULL); + m_Accels.AddTail(pAccel); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CCmdAccelOb::~CCmdAccelOb() +{ + POSITION pos = m_Accels.GetHeadPosition(); + while (pos != NULL) + delete m_Accels.GetNext(pos); + m_Accels.RemoveAll(); +} + + +//////////////////////////////////////////////////////////////////////// +// +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::Add(BYTE cVirt, WORD wKey, bool bLocked) +{ + CAccelsOb* pAccel = DEBUG_NEW CAccelsOb(cVirt, wKey, bLocked); + ASSERT(pAccel != NULL); + m_Accels.AddTail(pAccel); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::Add(CAccelsOb* pAccel) +{ + ASSERT(pAccel != NULL); + m_Accels.AddTail(pAccel); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +CCmdAccelOb& CCmdAccelOb::operator=(const CCmdAccelOb& from) +{ + Reset(); + + m_wIDCommand = from.m_wIDCommand; + m_szCommand = from.m_szCommand; + + CAccelsOb* pAccel; + POSITION pos = from.m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = DEBUG_NEW CAccelsOb(from.m_Accels.GetNext(pos)); + ASSERT(pAccel != NULL); + m_Accels.AddTail(pAccel); + } + return *this; +} + + +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::DeleteUserAccels() +{ + CAccelsOb* pAccel; + POSITION prevPos; + POSITION pos = m_Accels.GetHeadPosition(); + while (pos != NULL) { + prevPos = pos; + pAccel = m_Accels.GetNext(pos); + if (!pAccel->m_bLocked) { + delete pAccel; + m_Accels.RemoveAt(prevPos); + } + } +} + + +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::Reset() +{ + m_wIDCommand = 0; + m_szCommand = "Empty command"; + + CAccelsOb* pAccel; + POSITION pos = m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = m_Accels.GetNext(pos); + delete pAccel; + } +} + +//////////////////////////////////////////////////////////////////////// +// +#ifdef _DEBUG +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::AssertValid() const +{ + // call base class function first + CObject::AssertValid(); +} + + +//////////////////////////////////////////////////////////////////////// +// +// +void CCmdAccelOb::Dump( CDumpContext& dc ) const +{ + // call base class function first + dc << "\t"; + CObject::Dump( dc ); + + // now do the stuff for our specific class + dc << "\tIDCommand = " << m_wIDCommand; + dc << "\n\tszCommand = " << m_szCommand; + dc << "\n\tAccelerators = {\n"; + + CAccelsOb* pAccel; + POSITION pos = m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccel = m_Accels.GetNext(pos); + dc << pAccel; + } + dc << "\t}\n"; +} +#endif diff --git a/src/win32/CmdAccelOb.h b/src/win32/CmdAccelOb.h new file mode 100644 index 0000000..c8e47ac --- /dev/null +++ b/src/win32/CmdAccelOb.h @@ -0,0 +1,113 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : CmdAccelOb.h +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Author : T.Maurel +// Date : 17.08.98 +// +// Remarks : +// +//////////////////////////////////////////////////////////////////////////////// +#ifndef __CMDACCEL_OB_INCLUDE +#define __CMDACCEL_OB_INCLUDE + +#include // MFC Templates extension + +//////////////////////////////////////////////////////////////////////// +// +// +typedef struct tagMAPVIRTKEYS { + WORD wKey; + TCHAR szKey[15]; +} MAPVIRTKEYS, *PMAPVIRTKEYS; + + +//////////////////////////////////////////////////////////////////////// +// +// +#define sizetable(table) (sizeof(table)/sizeof(table[0])) + + +//////////////////////////////////////////////////////////////////////// +// +// +class CAccelsOb : public CObject { + public: + CAccelsOb(); + CAccelsOb(CAccelsOb* pFrom); + CAccelsOb(BYTE cVirt, WORD wKey, bool bLocked = false); + CAccelsOb(LPACCEL pACCEL); + + public: + CAccelsOb& operator=(const CAccelsOb& from); + + void GetString(CString& szBuffer); + bool IsEqual(WORD wKey, bool bCtrl, bool bAlt, bool bShift); + DWORD GetData(); + bool SetData(DWORD dwDatas); + + public: +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + public: + BYTE m_cVirt; + WORD m_wKey; + bool m_bLocked; +}; + + +////////////////////////////////////////////////////////////////////// +// +// +class CCmdAccelOb : public CObject { + public: + CCmdAccelOb(); + CCmdAccelOb(WORD wIDCommand, LPCTSTR szCommand); + CCmdAccelOb(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szCommand, bool bLocked = false); + ~CCmdAccelOb(); + + public: + void Add(CAccelsOb* pAccel); + void Add(BYTE cVirt, WORD wKey, bool bLocked = false); + void Reset(); + void DeleteUserAccels(); + + CCmdAccelOb& operator=(const CCmdAccelOb& from); + public: +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + public: + WORD m_wIDCommand; + CString m_szCommand; + + CList< CAccelsOb*, CAccelsOb*& > m_Accels; +}; + + +//////////////////////////////////////////////////////////////////////// +#endif // __CMDACCEL_OB_INCLUDE + + diff --git a/src/win32/ColorButton.cpp b/src/win32/ColorButton.cpp new file mode 100644 index 0000000..b6de51f --- /dev/null +++ b/src/win32/ColorButton.cpp @@ -0,0 +1,120 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// ColorButton.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "ColorButton.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +bool ColorButton::isRegistered = false; + +///////////////////////////////////////////////////////////////////////////// +// ColorButton + +ColorButton::ColorButton() +{ + color = 0; + registerClass(); +} + +ColorButton::~ColorButton() +{ +} + + +BEGIN_MESSAGE_MAP(ColorButton, CButton) + //{{AFX_MSG_MAP(ColorButton) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// ColorButton message handlers + +void ColorButton::PreSubclassWindow() +{ + SetWindowLong(m_hWnd, GWL_STYLE, GetStyle() | BS_OWNERDRAW); + CWnd::PreSubclassWindow(); +} + +void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ + ASSERT(lpDrawItemStruct); + + int r = (color & 0x1f) << 3; + int g = (color & 0x3e0) >> 2; + int b = (color & 0x7c00) >> 7; + + HDC dc = lpDrawItemStruct->hDC; + UINT state = lpDrawItemStruct->itemState; + RECT rect = lpDrawItemStruct->rcItem; + + SIZE margins; + margins.cx = ::GetSystemMetrics(SM_CXEDGE); + margins.cy = ::GetSystemMetrics(SM_CYEDGE); + + if(GetState() & BST_PUSHED) + DrawEdge(dc, &rect, EDGE_SUNKEN, BF_RECT); + else + DrawEdge(dc, &rect, EDGE_RAISED, BF_RECT); + + InflateRect(&rect, -margins.cx, -margins.cy); + + HBRUSH br = CreateSolidBrush((state & ODS_DISABLED) ? + ::GetSysColor(COLOR_3DFACE) : RGB(r,g,b)); + + FillRect(dc, &rect, br); + + if(state & ODS_FOCUS) { + InflateRect(&rect, -1, -1); + DrawFocusRect(dc, &rect); + } + + DeleteObject(br); +} + +void ColorButton::setColor(u16 c) +{ + color = c; + Invalidate(); +} + +void ColorButton::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hIcon = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaColorButton"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} diff --git a/src/win32/ColorButton.h b/src/win32/ColorButton.h new file mode 100644 index 0000000..3d12f74 --- /dev/null +++ b/src/win32/ColorButton.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_) +#define AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ColorButton.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// ColorButton window + +class ColorButton : public CButton +{ + // Construction + public: + ColorButton(); + + // Attributes + public: + // Operations + static bool isRegistered; + public: + void PreSubclassWindow(); + void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ColorButton) + //}}AFX_VIRTUAL + + // Implementation + public: + void setColor(u16 c); + u16 color; + virtual ~ColorButton(); + + void registerClass(); + + // Generated message map functions + protected: + //{{AFX_MSG(ColorButton) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_) diff --git a/src/win32/ColorControl.cpp b/src/win32/ColorControl.cpp new file mode 100644 index 0000000..b61d135 --- /dev/null +++ b/src/win32/ColorControl.cpp @@ -0,0 +1,103 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// ColorControl.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "ColorControl.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +bool ColorControl::isRegistered = false; + +///////////////////////////////////////////////////////////////////////////// +// ColorControl + +ColorControl::ColorControl() +{ + color = 0; + registerClass(); +} + +ColorControl::~ColorControl() +{ +} + + +BEGIN_MESSAGE_MAP(ColorControl, CWnd) + //{{AFX_MSG_MAP(ColorControl) + ON_WM_PAINT() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// ColorControl message handlers + +void ColorControl::OnPaint() +{ + CPaintDC dc(this); // device context for painting +} + +BOOL ColorControl::OnEraseBkgnd(CDC* pDC) +{ + int r = (color & 0x1f) << 3; + int g = (color & 0x3e0) >> 2; + int b = (color & 0x7c00) >> 7; + + CBrush br; + br.CreateSolidBrush(RGB(r,g,b)); + + RECT rect; + GetClientRect(&rect); + pDC->FillRect(&rect,&br); + pDC->DrawEdge(&rect, EDGE_SUNKEN, BF_RECT); + br.DeleteObject(); + return TRUE; +} + +void ColorControl::setColor(u16 c) +{ + color = c; + Invalidate(); +} + +void ColorControl::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaColorControl"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} diff --git a/src/win32/ColorControl.h b/src/win32/ColorControl.h new file mode 100644 index 0000000..e66832c --- /dev/null +++ b/src/win32/ColorControl.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_) +#define AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ColorControl.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// ColorControl window + +class ColorControl : public CWnd +{ + // Construction + public: + ColorControl(); + + // Attributes + public: + // Operations + static bool isRegistered; + + // Operations + public: + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ColorControl) + //}}AFX_VIRTUAL + + // Implementation + public: + void setColor(u16 c); + u16 color; + virtual ~ColorControl(); + + // Generated message map functions + protected: + //{{AFX_MSG(ColorControl) + afx_msg void OnPaint(); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + void registerClass(); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_) diff --git a/src/win32/Commands.cpp b/src/win32/Commands.cpp new file mode 100644 index 0000000..d6eb5c9 --- /dev/null +++ b/src/win32/Commands.cpp @@ -0,0 +1,315 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "AcceleratorManager.h" +#include "resource.h" +#include + +#include // MFC Templates extension +#ifndef CMapStringToWord +typedef CMap< CString, LPCSTR, WORD, WORD& > CMapStringToWord; +#endif + +static CMapStringToWord winAccelStrings; +static bool initialized = false; + +struct { + const char *command; + WORD id; +} winAccelCommands[] = { + { "OpenRom(!)", ID_FILE_OPEN }, // a (!) puts it in the "common hotkeys" list + { "Load from file...", ID_FILE_LOAD }, + { "Save to file...", ID_FILE_SAVE }, + { "LoadSlot01(!)", ID_FILE_LOADGAME_SLOT1 }, + { "LoadSlot02(!)", ID_FILE_LOADGAME_SLOT2 }, + { "LoadSlot03(!)", ID_FILE_LOADGAME_SLOT3 }, + { "LoadSlot04(!)", ID_FILE_LOADGAME_SLOT4 }, + { "LoadSlot05(!)", ID_FILE_LOADGAME_SLOT5 }, + { "LoadSlot06(!)", ID_FILE_LOADGAME_SLOT6 }, + { "LoadSlot07(!)", ID_FILE_LOADGAME_SLOT7 }, + { "LoadSlot08(!)", ID_FILE_LOADGAME_SLOT8 }, + { "LoadSlot09(!)", ID_FILE_LOADGAME_SLOT9 }, + { "LoadSlot10(!)", ID_FILE_LOADGAME_SLOT10 }, + { "AutoLoadMostRecent", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT }, + { "MakeRecentOnLoad", ID_FILE_LOADGAME_MAKERECENT }, + { "MakeCurrentOnLoad", ID_FILE_LOADGAME_MAKECURRENT }, + { "LoadMostRecent(!)", ID_FILE_LOADGAME_MOSTRECENT }, + { "CurrentSlotLoad(!)", ID_FILE_LOADGAME_CURRENT }, + { "SaveSlot01(!)", ID_FILE_SAVEGAME_SLOT1 }, + { "SaveSlot02(!)", ID_FILE_SAVEGAME_SLOT2 }, + { "SaveSlot03(!)", ID_FILE_SAVEGAME_SLOT3 }, + { "SaveSlot04(!)", ID_FILE_SAVEGAME_SLOT4 }, + { "SaveSlot05(!)", ID_FILE_SAVEGAME_SLOT5 }, + { "SaveSlot06(!)", ID_FILE_SAVEGAME_SLOT6 }, + { "SaveSlot07(!)", ID_FILE_SAVEGAME_SLOT7 }, + { "SaveSlot08(!)", ID_FILE_SAVEGAME_SLOT8 }, + { "SaveSlot09(!)", ID_FILE_SAVEGAME_SLOT9 }, + { "SaveSlot10(!)", ID_FILE_SAVEGAME_SLOT10 }, + { "SaveOldestSlot(!)", ID_FILE_SAVEGAME_OLDESTSLOT }, + { "CurrentSlotSave(!)", ID_FILE_SAVEGAME_CURRENT }, + { "MakeCurrentOnSave", ID_FILE_SAVEGAME_MAKECURRENT }, + { "CurrentSlotNext(!)", ID_FILE_SAVEGAME_INCREMENTSLOT }, + { "CurrentSlotPrev(!)", ID_FILE_SAVEGAME_DECREMENTSLOT }, + { "ClearRecentRomList", ID_FILE_RECENT_RESET }, + { "LockRecentRomList", ID_FILE_RECENT_FREEZE }, + { "SetCurrentSlot01(!)", ID_SELECT_SLOT1 }, + { "SetCurrentSlot02(!)", ID_SELECT_SLOT2 }, + { "SetCurrentSlot03(!)", ID_SELECT_SLOT3 }, + { "SetCurrentSlot04(!)", ID_SELECT_SLOT4 }, + { "SetCurrentSlot05(!)", ID_SELECT_SLOT5 }, + { "SetCurrentSlot06(!)", ID_SELECT_SLOT6 }, + { "SetCurrentSlot07(!)", ID_SELECT_SLOT7 }, + { "SetCurrentSlot08(!)", ID_SELECT_SLOT8 }, + { "SetCurrentSlot09(!)", ID_SELECT_SLOT9 }, + { "SetCurrentSlot10(!)", ID_SELECT_SLOT10 }, + { "RecentRom01", ID_FILE_MRU_FILE1 }, + { "RecentRom02", ID_FILE_MRU_FILE2 }, + { "RecentRom03", ID_FILE_MRU_FILE3 }, + { "RecentRom04", ID_FILE_MRU_FILE4 }, + { "RecentRom05", ID_FILE_MRU_FILE5 }, + { "RecentRom06", ID_FILE_MRU_FILE6 }, + { "RecentRom07", ID_FILE_MRU_FILE7 }, + { "RecentRom08", ID_FILE_MRU_FILE8 }, + { "RecentRom09", ID_FILE_MRU_FILE9 }, + { "RecentRom10", ID_FILE_MRU_FILE10 }, + { "PauseGame(!)", ID_FILE_PAUSE }, + { "ResetGame(!)", ID_FILE_RESET }, + { "ImportBatteryFile", ID_FILE_IMPORT_BATTERYFILE }, + { "ImportGamesharkCodeFile", ID_FILE_IMPORT_GAMESHARKCODEFILE }, + { "ImportGamesharkSnapshot", ID_FILE_IMPORT_GAMESHARKSNAPSHOT }, + { "ExportBatteryFile", ID_FILE_EXPORT_BATTERYFILE }, + { "ExportGamesharkSnapshot", ID_FILE_EXPORT_GAMESHARKSNAPSHOT }, + { "ScreenCapture", ID_FILE_SCREENCAPTURE }, + { "RomInformation", ID_FILE_ROMINFORMATION }, + { "ToggleMenu", ID_FILE_TOGGLEMENU }, + { "Close", ID_FILE_CLOSE }, + { "Exit", ID_FILE_EXIT }, + { "FrameSkip0", ID_OPTIONS_VIDEO_FRAMESKIP_0 }, + { "FrameSkip1", ID_OPTIONS_VIDEO_FRAMESKIP_1 }, + { "FrameSkip2", ID_OPTIONS_VIDEO_FRAMESKIP_2 }, + { "FrameSkip3", ID_OPTIONS_VIDEO_FRAMESKIP_3 }, + { "FrameSkip4", ID_OPTIONS_VIDEO_FRAMESKIP_4 }, + { "FrameSkip5", ID_OPTIONS_VIDEO_FRAMESKIP_5 }, + { "FrameSkip6", ID_OPTIONS_VIDEO_FRAMESKIP_6 }, + { "FrameSkip7", ID_OPTIONS_VIDEO_FRAMESKIP_7 }, + { "FrameSkip8", ID_OPTIONS_VIDEO_FRAMESKIP_8 }, + { "FrameSkip9", ID_OPTIONS_VIDEO_FRAMESKIP_9 }, + { "Speed006%", ID_OPTIONS_FRAMESKIP_THROTTLE_6 }, + { "Speed015%", ID_OPTIONS_FRAMESKIP_THROTTLE_15 }, + { "Speed025%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 }, + { "Speed037%", ID_OPTIONS_FRAMESKIP_THROTTLE_37 }, + { "Speed050%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 }, + { "Speed075%", ID_OPTIONS_FRAMESKIP_THROTTLE_75 }, + { "Speed087%", ID_OPTIONS_FRAMESKIP_THROTTLE_87 }, + { "Speed100%(!)", ID_OPTIONS_FRAMESKIP_THROTTLE_100 }, + { "Speed112%", ID_OPTIONS_FRAMESKIP_THROTTLE_112 }, + { "Speed125%", ID_OPTIONS_FRAMESKIP_THROTTLE_125 }, + { "Speed150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 }, + { "Speed200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 }, + { "Speed300%", ID_OPTIONS_FRAMESKIP_THROTTLE_300 }, + { "SpeedOther", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER }, + { "SpeedIncrease(!)", ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE }, + { "SpeedDecrease(!)", ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE }, + { "VideoRenderGDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI }, + { "VideoRenderDDRAW", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW }, + { "VideoRenderD3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D }, + { "VideoRenderOGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL }, + { "VideoRenderSelectSkin", ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN }, + { "VideoRenderSkin", ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN }, + { "VideoVsync", ID_OPTIONS_VIDEO_VSYNC }, + { "VideoX1", ID_OPTIONS_VIDEO_X1 }, + { "VideoX2", ID_OPTIONS_VIDEO_X2 }, + { "VideoX3", ID_OPTIONS_VIDEO_X3 }, + { "VideoX4", ID_OPTIONS_VIDEO_X4 }, + { "Video320x240", ID_OPTIONS_VIDEO_FULLSCREEN320X240 }, + { "Video640x480", ID_OPTIONS_VIDEO_FULLSCREEN640X480 }, + { "Video800x600", ID_OPTIONS_VIDEO_FULLSCREEN800X600 }, + { "VideoFullscreen", ID_OPTIONS_VIDEO_FULLSCREEN }, + { "VideoFullscreenMaxScale", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE }, + { "VideoLayersBg0", ID_OPTIONS_VIDEO_LAYERS_BG0 }, + { "VideoLayersBg1", ID_OPTIONS_VIDEO_LAYERS_BG1 }, + { "VideoLayersBg2", ID_OPTIONS_VIDEO_LAYERS_BG2 }, + { "VideoLayersBg3", ID_OPTIONS_VIDEO_LAYERS_BG3 }, + { "VideoLayersOBJ", ID_OPTIONS_VIDEO_LAYERS_OBJ }, + { "VideoLayersWIN0", ID_OPTIONS_VIDEO_LAYERS_WIN0 }, + { "VideoLayersWIN1", ID_OPTIONS_VIDEO_LAYERS_WIN1 }, + { "VideoLayersOBJWIN", ID_OPTIONS_VIDEO_LAYERS_OBJWIN }, + { "EmulatorAssociate", ID_OPTIONS_EMULATOR_ASSOCIATE }, + { "EmulatorDirectories", ID_OPTIONS_EMULATOR_DIRECTORIES }, + { "EmulatorSelectBIOS", ID_OPTIONS_EMULATOR_SELECTBIOSFILE }, + { "EmulatorUseBIOS", ID_OPTIONS_EMULATOR_USEBIOSFILE }, + { "EmulatorUseOldGBTiming", ID_EMULATOR_USEOLDGBTIMING }, + { "EmulatorGBALagging", ID_EMULATOR_GBALAG }, + { "EmulatorSkipBIOS", ID_OPTIONS_EMULATOR_SKIPBIOS }, + { "EmulatorShowSpeedNone", ID_OPTIONS_EMULATOR_SHOWSPEED_NONE }, + { "EmulatorShowSpeedPercentage", ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE }, + { "EmulatorShowSpeedDetailed", ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED }, + { "EmulatorShowSpeedTransparent", ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT }, + { "EmulatorSpeedupToggle", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE }, + { "EmulatorRemoveIntros", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA }, + { "EmulatorAutoHideMenu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU }, + { "EmulatorSaveAuto", ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC }, + { "EmulatorSaveEEPROM", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM }, + { "EmulatorSaveSRAM", ID_OPTIONS_EMULATOR_SAVETYPE_SRAM }, + { "EmulatorSaveFLASH", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH }, + { "EmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR }, + { "EmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K }, + { "EmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M }, + { "EmulatorAutoIPSPatch", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH }, + { "EmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT }, + { "EmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK }, + { "EmulatorRewindSettings", ID_OPTIONS_EMULATOR_REWINDINTERVAL }, + { "SoundOff", ID_OPTIONS_SOUND_OFF }, + { "SoundMute", ID_OPTIONS_SOUND_MUTE }, + { "SoundOn", ID_OPTIONS_SOUND_ON }, + { "SoundChannel1", ID_OPTIONS_SOUND_CHANNEL1 }, + { "SoundChannel2", ID_OPTIONS_SOUND_CHANNEL2 }, + { "SoundChannel3", ID_OPTIONS_SOUND_CHANNEL3 }, + { "SoundChannel4", ID_OPTIONS_SOUND_CHANNEL4 }, + { "SoundDirectSoundA", ID_OPTIONS_SOUND_DIRECTSOUNDA }, + { "SoundDirectSoundB", ID_OPTIONS_SOUND_DIRECTSOUNDB }, + { "Sound11Khz", ID_OPTIONS_SOUND_11KHZ }, + { "Sound22Khz", ID_OPTIONS_SOUND_22KHZ }, + { "Sound44Khz", ID_OPTIONS_SOUND_44KHZ }, + { "SoundEcho", ID_OPTIONS_SOUND_ECHO }, + { "SoundLowPassFilter", ID_OPTIONS_SOUND_LOWPASSFILTER }, + { "SoundReverseStereo", ID_OPTIONS_SOUND_REVERSESTEREO }, + { "SoundMuteFrameAdvance", ID_OPTIONS_SOUND_MUTEFRAMEADVANCE }, + { "SoundVolume1x", ID_OPTIONS_SOUND_VOLUME_1X }, + { "SoundVolume2x", ID_OPTIONS_SOUND_VOLUME_2X }, + { "SoundVolume3x", ID_OPTIONS_SOUND_VOLUME_3X }, + { "SoundVolume4x", ID_OPTIONS_SOUND_VOLUME_4X }, + { "GameboyBorder", ID_OPTIONS_GAMEBOY_BORDER }, + { "GameboyBorderAutomatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC }, + { "GameboyColors", ID_OPTIONS_GAMEBOY_COLORS }, + { "FilterNormal", ID_OPTIONS_FILTER_NORMAL }, + { "FilterTVMode", ID_OPTIONS_FILTER_TVMODE }, + { "Filter2xSaI", ID_OPTIONS_FILTER_2XSAI }, + { "FilterSuper2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI }, + { "FilterSuperEagle", ID_OPTIONS_FILTER_SUPEREAGLE }, + { "FilterPixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL }, + { "FilterMotionBlur", ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL }, + { "FilterAdMameScale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X }, + { "FilterSimple2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X }, + { "FilterBilinear", ID_OPTIONS_FILTER_BILINEAR }, + { "FilterBilinearPlus", ID_OPTIONS_FILTER_BILINEARPLUS }, + { "FilterScanlines", ID_OPTIONS_FILTER_SCANLINES }, + { "FilterHq2x", ID_OPTIONS_FILTER_HQ2X }, + { "FilterHq2x2", ID_OPTIONS_FILTER_HQ2X2 }, + { "FilterLq2x", ID_OPTIONS_FILTER_LQ2X }, + { "FilterHq3x2", ID_OPTIONS_FILTER_HQ3X2 }, + { "FilterIFBNone", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE }, + { "FilterIFBMotionBlur", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR }, + { "FilterIFBSmart", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART }, + { "FilterDisableMMX", ID_OPTIONS_FILTER_DISABLEMMX }, + { "JoypadConfigure1", ID_OPTIONS_JOYPAD_CONFIGURE_1 }, + { "JoypadConfigure2", ID_OPTIONS_JOYPAD_CONFIGURE_2 }, + { "JoypadConfigure3", ID_OPTIONS_JOYPAD_CONFIGURE_3 }, + { "JoypadConfigure4", ID_OPTIONS_JOYPAD_CONFIGURE_4 }, + { "JoypadMotionConfigure", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE }, + { "JoypadMotionAllowLeftPlusRight", ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT }, + { "JoypadAutofireA(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_A }, + { "JoypadAutofireB(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_B }, + { "JoypadAutofireL(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_L }, + { "JoypadAutofireR(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_R }, + { "JoypadAutofireStart(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_START }, + { "JoypadAutofireSelect(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT }, + { "JoypadAutofireUp(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_UP }, + { "JoypadAutofireDown(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN }, + { "JoypadAutofireLeft(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT }, + { "JoypadAutofireRight(!)", ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT }, + { "JoypadAutofireClearAl(!)l", ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR }, + { "JoypadAutoholdA(!)", ID_STICKY_A }, + { "JoypadAutoholdB(!)", ID_STICKY_B }, + { "JoypadAutoholdL(!)", ID_STICKY_L }, + { "JoypadAutoholdR(!)", ID_STICKY_R }, + { "JoypadAutoholdStart(!)", ID_STICKY_START }, + { "JoypadAutoholdSelect(!)", ID_STICKY_SELECT }, + { "JoypadAutoholdUp(!)", ID_STICKY_UP }, + { "JoypadAutoholdDown(!)", ID_STICKY_DOWN }, + { "JoypadAutoholdLeft(!)", ID_STICKY_LEFT }, + { "JoypadAutoholdRight(!)", ID_STICKY_RIGHT }, + { "JoypadAutoholdClearAll(!)", ID_STICKY_CLEAR }, + { "CheatsSearch", ID_CHEATS_SEARCHFORCHEATS }, + { "CheatsList", ID_CHEATS_CHEATLIST }, + { "CheatsLoad", ID_CHEATS_LOADCHEATLIST }, + { "CheatsSave", ID_CHEATS_SAVECHEATLIST }, + { "CheatsDisable", ID_CHEATS_DISABLECHEATS }, + { "DebugGDB", ID_TOOLS_DEBUG_GDB }, + { "DebugGDBLoad", ID_TOOLS_DEBUG_LOADANDWAIT }, + { "DebugGDBBreak", ID_TOOLS_DEBUG_BREAK }, + { "DebugGDBDisconnect", ID_TOOLS_DEBUG_DISCONNECT }, + { "Disassemble", ID_TOOLS_DISASSEMBLE }, + { "IOViewer", ID_TOOLS_IOVIEWER }, + { "Logging", ID_TOOLS_LOGGING }, + { "MapViewer", ID_TOOLS_MAPVIEW }, + { "MemoryViewer", ID_TOOLS_MEMORYVIEWER }, + { "OAMViewer", ID_TOOLS_OAMVIEWER }, + { "PaletteViewer", ID_TOOLS_PALETTEVIEW }, + { "TileViewer", ID_TOOLS_TILEVIEWER }, + { "FrameAdvance(!)", ID_DEBUG_NEXTFRAME }, + { "FrameSearch(!)", ID_DEBUG_FRAMESEARCH }, + { "FrameSearchRewind(!)", ID_DEBUG_FRAMESEARCHPREV }, + { "FrameSearchEnd(!)", ID_DEBUG_FRAMESEARCHLOAD }, + { "FrameCounter(!)", ID_TOOLS_FRAMECOUNTER }, + { "InputDisplay(!)", ID_TOOLS_INPUTDISPLAY }, + { "SoundStartRecording", ID_OPTIONS_SOUND_STARTRECORDING }, + { "SoundStopRecording", ID_OPTIONS_SOUND_STOPRECORDING }, + { "AVIStartRecording", ID_TOOLS_RECORD_STARTAVIRECORDING }, + { "AVIStopRecording", ID_TOOLS_RECORD_STOPAVIRECORDING }, + { "RecordMovieStart", ID_TOOLS_RECORD_STARTMOVIERECORDING }, + { "RecordMovieStop", ID_TOOLS_RECORD_STOPMOVIERECORDING }, + { "PlayMovieStart", ID_TOOLS_PLAY_STARTMOVIEPLAYING }, + { "PlayMovieStop", ID_TOOLS_PLAY_STOPMOVIEPLAYING }, + { "MovieReadOnly(!)", ID_TOOLS_PLAY_READONLY}, + { "MovieContinueRecording", ID_TOOLS_PLAY_CONTINUE}, + { "MoviePlayFromBeginning", ID_TOOLS_PLAY_RESTART}, + { "Rewind(!)", ID_TOOLS_REWIND }, + { "CustomizeAllCommands", ID_TOOLS_CUSTOMIZE }, + { "CustomizeCommonHotkeys", ID_TOOLS_CUSTOMIZE_COMMON }, + { "HelpBugReport", ID_HELP_BUGREPORT }, + { "HelpFAQ", ID_HELP_FAQ }, + { "HelpAbout", ID_HELP_ABOUT }, + { "Minimize", ID_SYSTEM_MINIMIZE }, +}; + +bool winAccelGetID(const char *command, WORD& id) +{ + if(!initialized) { + int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]); + + for(int i = 0; i < count; i++) { + winAccelStrings.SetAt(winAccelCommands[i].command, winAccelCommands[i].id); + } + initialized = true; + } + + return winAccelStrings.Lookup(command, id) ? true : false; +} + +void winAccelAddCommands(CAcceleratorManager& mgr) +{ + int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]); + + for(int i = 0; i < count; i++) { + if(!mgr.AddCommandAccel(winAccelCommands[i].id, winAccelCommands[i].command, false)) + mgr.CreateEntry(winAccelCommands[i].id, winAccelCommands[i].command); + } + +} diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp new file mode 100644 index 0000000..5a45b9a --- /dev/null +++ b/src/win32/Direct3D.cpp @@ -0,0 +1,816 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "vba.h" + +#define DIRECT3D_VERSION 0x0800 +#include "d3d8.h" +#include "d3dx8.h" + +#include "MainWnd.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" +#include "../gb/gbGlobals.h" + +#include "Reg.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#ifdef MMX +extern "C" bool cpu_mmx; + +extern bool detectMMX(); +#endif + +extern int Init_2xSaI(u32); +extern void winlog(const char *,...); +extern int systemSpeed; + +typedef struct _D3DTLVERTEX { + float sx; /* Screen coordinates */ + float sy; + float sz; + float rhw; /* Reciprocal of homogeneous w */ + D3DCOLOR color; /* Vertex color */ + float tu; /* Texture coordinates */ + float tv; + _D3DTLVERTEX() { } + _D3DTLVERTEX(const D3DVECTOR& v, float _rhw, + D3DCOLOR _color, + float _tu, float _tv) + { sx = v.x; sy = v.y; sz = v.z; rhw = _rhw; + color = _color; + tu = _tu; tv = _tv; + } +} D3DTLVERTEX, *LPD3DTLVERTEX; + +#define D3DFVF_TLVERTEX D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1 + +class Direct3DDisplay : public IDisplay { +private: + HINSTANCE d3dDLL; + LPDIRECT3D8 pD3D; + LPDIRECT3DDEVICE8 pDevice; + LPDIRECT3DTEXTURE8 pTexture; + D3DSURFACE_DESC dsdBackBuffer; + D3DPRESENT_PARAMETERS dpp; + D3DFORMAT screenFormat; + int width; + int height; + bool filterDisabled; + ID3DXFont *pFont; + bool failed; + + void restoreDeviceObjects(); + void invalidateDeviceObjects(); + bool initializeOffscreen(int w, int h); + void updateFiltering(int); +public: + Direct3DDisplay(); + virtual ~Direct3DDisplay(); + + virtual bool initialize(); + virtual void cleanup(); + virtual void render(); + virtual void checkFullScreen(); + virtual void renderMenu(); + virtual void clear(); + virtual bool changeRenderSize(int w, int h); + virtual void resize(int w, int h); + virtual DISPLAY_TYPE getType() { return DIRECT_3D; }; + virtual void setOption(const char *, int); + virtual int selectFullScreenMode(GUID **); +}; + +Direct3DDisplay::Direct3DDisplay() +{ + d3dDLL = NULL; + pD3D = NULL; + pDevice = NULL; + pTexture = NULL; + pFont = NULL; + screenFormat = D3DFMT_R5G6B5; + width = 0; + height = 0; + filterDisabled = false; + failed = false; +} + +Direct3DDisplay::~Direct3DDisplay() +{ + cleanup(); +} + +void Direct3DDisplay::cleanup() +{ + if(pD3D != NULL) { + if(pFont) { + pFont->Release(); + pFont = NULL; + } + + if(pTexture) { + pTexture->Release(); + pTexture = NULL; + } + + if(pDevice) { + pDevice->Release(); + pDevice = NULL; + } + + pD3D->Release(); + pD3D = NULL; + + if(d3dDLL != NULL) { + FreeLibrary(d3dDLL); + d3dDLL = NULL; + } + } +} + +bool Direct3DDisplay::initialize() +{ + theApp.sizeX = 240; + theApp.sizeY = 160; + + switch(theApp.videoOption) { + case VIDEO_1X: + theApp.surfaceSizeX = theApp.sizeX; + theApp.surfaceSizeY = theApp.sizeY; + break; + case VIDEO_2X: + theApp.surfaceSizeX = theApp.sizeX * 2; + theApp.surfaceSizeY = theApp.sizeY * 2; + break; + case VIDEO_3X: + theApp.surfaceSizeX = theApp.sizeX * 3; + theApp.surfaceSizeY = theApp.sizeY * 3; + break; + case VIDEO_4X: + theApp.surfaceSizeX = theApp.sizeX * 4; + theApp.surfaceSizeY = theApp.sizeY * 4; + break; + case VIDEO_320x240: + case VIDEO_640x480: + case VIDEO_800x600: + case VIDEO_OTHER: + { + RECT r; + ::GetWindowRect(GetDesktopWindow(), &r); + theApp.fsWidth = r.right - r.left; + theApp.fsHeight = r.bottom - r.top; + + /* Need to fix this code later. For now, Fullscreen takes the whole + screen. + int scaleX = (theApp.fsWidth / theApp.sizeX); + int scaleY = (theApp.fsHeight / theApp.sizeY); + int min = scaleX < scaleY ? scaleX : scaleY; + theApp.surfaceSizeX = theApp.sizeX * min; + theApp.surfaceSizeY = theApp.sizeY * min; + if(theApp.fullScreenStretch) {*/ + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; +// } + } + break; + } + + theApp.rect.left = 0; + theApp.rect.top = 0; + theApp.rect.right = theApp.sizeX; + theApp.rect.bottom = theApp.sizeY; + + theApp.dest.left = 0; + theApp.dest.top = 0; + theApp.dest.right = theApp.surfaceSizeX; + theApp.dest.bottom = theApp.surfaceSizeY; + + DWORD style = WS_POPUP | WS_VISIBLE; + DWORD styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + style |= WS_OVERLAPPEDWINDOW; + else + styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); + else + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + + int winSizeX = theApp.dest.right-theApp.dest.left; + int winSizeY = theApp.dest.bottom-theApp.dest.top; + + if(theApp.videoOption > VIDEO_4X) { + winSizeX = theApp.fsWidth; + winSizeY = theApp.fsHeight; + } + + int x = 0; + int y = 0; + + if(theApp.videoOption <= VIDEO_4X) { + x = theApp.windowPositionX; + y = theApp.windowPositionY; + } + + // Create a window + MainWnd *pWnd = new MainWnd; + theApp.m_pMainWnd = pWnd; + + pWnd->CreateEx(styleEx, + theApp.wndClass, + "VisualBoyAdvance", + style, + x,y,winSizeX,winSizeY, + NULL, + 0); + + if (!(HWND)*pWnd) { + winlog("Error creating Window %08x\n", GetLastError()); + return FALSE; + } + + theApp.updateMenuBar(); + + theApp.adjustDestRect(); + + d3dDLL = LoadLibrary("D3D8.DLL"); + LPDIRECT3D8 (WINAPI *D3DCreate)(UINT); + if(d3dDLL != NULL) { + D3DCreate = (LPDIRECT3D8 (WINAPI *)(UINT)) + GetProcAddress(d3dDLL, "Direct3DCreate8"); + + if(D3DCreate == NULL) { + theApp.directXMessage("Direct3DCreate8"); + return FALSE; + } + } else { + theApp.directXMessage("D3D8.DLL"); + return FALSE; + } + + pD3D = D3DCreate(120); + + if(pD3D == NULL) { + winlog("Error creating Direct3D object\n"); + return FALSE; + } + + theApp.mode320Available = FALSE; + theApp.mode640Available = FALSE; + theApp.mode800Available = FALSE; + + D3DDISPLAYMODE mode; + pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode); + + switch(mode.Format) { + case D3DFMT_R8G8B8: + systemColorDepth = 24; + systemRedShift = 19; + systemGreenShift = 11; + systemBlueShift = 3; + break; + case D3DFMT_X8R8G8B8: + systemColorDepth = 32; + systemRedShift = 19; + systemGreenShift = 11; + systemBlueShift = 3; + Init_2xSaI(32); + break; + case D3DFMT_R5G6B5: + systemColorDepth = 16; + systemRedShift = 11; + systemGreenShift = 6; + systemBlueShift = 0; + Init_2xSaI(565); + break; + case D3DFMT_X1R5G5B5: + systemColorDepth = 16; + systemRedShift = 10; + systemGreenShift = 5; + systemBlueShift = 0; + Init_2xSaI(555); + break; + default: + systemMessage(0,"Unsupport D3D format %d", mode.Format); + return false; + } + theApp.fsColorDepth = systemColorDepth; + +#ifdef MMX + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +#endif + + screenFormat = mode.Format; + + // check for available fullscreen modes + ZeroMemory(&dpp, sizeof(dpp)); + dpp.Windowed = TRUE; + dpp.BackBufferFormat = mode.Format; + dpp.BackBufferCount = 1; + dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + dpp.BackBufferWidth = theApp.surfaceSizeX; + dpp.BackBufferHeight = theApp.surfaceSizeY; + + HRESULT hret = pD3D->CreateDevice(D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, + pWnd->GetSafeHwnd(), + D3DCREATE_SOFTWARE_VERTEXPROCESSING, + &dpp, + &pDevice); + if(!SUCCEEDED(hret)) { + winlog("Error creating Direct3DDevice %08x\n", hret); + return false; + } + + restoreDeviceObjects(); + + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + case 24: + case 32: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + } + + theApp.updateFilter(); + theApp.updateIFB(); + + if(failed) + return false; + + pWnd->DragAcceptFiles(TRUE); + + return TRUE; +} + +bool Direct3DDisplay::initializeOffscreen(int w, int h) +{ + int size = 256; + if(w > 256 || h > 256) + size = 512; + + UINT ww = size; + UINT hh = size; + D3DFORMAT format = screenFormat; + + if(SUCCEEDED(D3DXCheckTextureRequirements(pDevice, + &ww, + &hh, + NULL, + 0, + &format, + D3DPOOL_MANAGED))) { + if((int)ww < w || (int)hh < h) { + if(theApp.filterFunction) { + filterDisabled = true; + theApp.filterFunction = NULL; + systemMessage(0, "3D card cannot support needed texture size for filter function. Disabling it"); + } + } else + filterDisabled = false; + if(SUCCEEDED(D3DXCreateTexture(pDevice, + ww, + hh, + 0, + 0, + format, + D3DPOOL_MANAGED, + &pTexture))) { + width = w; + height = h; + return true; + } + } + return false; +} + +void Direct3DDisplay::updateFiltering(int filter) +{ + switch(filter) { + default: + case 0: + // point filtering + pDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_POINT ); + pDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_POINT ); + pDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_POINT ); + break; + case 1: + // bilinear + pDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); + pDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR ); + pDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_POINT ); + break; + } +} + +void Direct3DDisplay::restoreDeviceObjects() +{ + // Store render target surface desc + LPDIRECT3DSURFACE8 pBackBuffer; + HRESULT hr; + if(SUCCEEDED(hr = pDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer ))) { + pBackBuffer->GetDesc( &dsdBackBuffer ); + pBackBuffer->Release(); + } else + systemMessage(0, "Failed GetBackBuffer %08x", hr); + + // Set up the texture + pDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + pDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + pDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + + int filter = regQueryDwordValue("d3dFilter", 0); + if(filter < 0 || filter > 3) + filter = 0; + updateFiltering(filter); + + // Set miscellaneous render states + pDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE ); + pDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); + + // Set the projection matrix + D3DXMATRIX matProj; + FLOAT fAspect = ((FLOAT)dsdBackBuffer.Width) / dsdBackBuffer.Height; + D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, fAspect, 1.0f, 100.0f ); + pDevice->SetTransform( D3DTS_PROJECTION, &matProj ); + + // turn off lighting + pDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); + + if(pFont) { + pFont->Release(); + pFont = NULL; + } + // Create a D3D font using D3DX + HFONT hFont = CreateFont( 14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, + ANTIALIASED_QUALITY, FF_DONTCARE, "Arial" ); + D3DXCreateFont( pDevice, hFont, &pFont ); +} + +void Direct3DDisplay::clear() +{ +} + +void Direct3DDisplay::renderMenu() +{ + checkFullScreen(); + if(theApp.m_pMainWnd) + theApp.m_pMainWnd->DrawMenuBar(); +} + +void Direct3DDisplay::checkFullScreen() +{ + // if(tripleBuffering) + // pDirect3D->FlipToGDISurface(); +} + +static void BlitRect(LPDIRECT3DDEVICE8 lpDevice, + LPDIRECT3DTEXTURE8 lpSrc, + float left, float top, + float right, float bottom, + D3DCOLOR col,float z) +{ + // calculate rhw + + float rhw=1.0f/(z*990.0f+10.0f); + + // set up rectangle + + D3DTLVERTEX verts[4]; + verts[0]=D3DTLVERTEX(D3DXVECTOR3(left-0.5f, top-0.5f, z),rhw,col,0.0f,0.0f); + verts[1]=D3DTLVERTEX(D3DXVECTOR3(right-0.5f, top-0.5f, z),rhw,col,1.0f,0.0f); + verts[2]=D3DTLVERTEX(D3DXVECTOR3(right-0.5f, bottom-0.5f, z),rhw,col,1.0f,1.0f); + verts[3]=D3DTLVERTEX(D3DXVECTOR3(left-0.5f, bottom-0.5f, z),rhw,col,0.0f,1.0f); + + // set the texture + + lpDevice->SetTexture(0,lpSrc); + + // configure shader for vertex type + + lpDevice->SetVertexShader(D3DFVF_TLVERTEX); + + // draw the rectangle + + lpDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN,2,verts,sizeof(D3DTLVERTEX)); +} + +void Direct3DDisplay::render() +{ + if(!pDevice) + return; + + // Test the cooperative level to see if it's okay to render + if( FAILED( pDevice->TestCooperativeLevel() ) ) + { + return; + } + pDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, 0x000000ff, 1.0f, 0L ); + + if(SUCCEEDED(pDevice->BeginScene())) { + D3DLOCKED_RECT locked; + if(pTexture && SUCCEEDED(pTexture->LockRect(0, &locked, NULL, 0))) + { + + if(textMethod == 0) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + DrawTextMessages((u8*)pix, copyX*(systemColorDepth/8)+(systemColorDepth==24?0:4), 0, copyY); + } + + + if(theApp.filterFunction) { + if(systemColorDepth == 16) + theApp.filterFunction(pix+theApp.filterWidth*2+4, + theApp.filterWidth*2+4, + (u8*)theApp.delta, + (u8*)locked.pBits, + locked.Pitch, + theApp.filterWidth, + theApp.filterHeight); + else + theApp.filterFunction(pix+theApp.filterWidth*4+4, + theApp.filterWidth*4+4, + (u8*)theApp.delta, + (u8*)locked.pBits, + locked.Pitch, + theApp.filterWidth, + theApp.filterHeight); + } else { + int copyX = 240; + int copyY = 160; + + if(theApp.cartridgeType == 1) { + if(gbBorderOn) { + copyX = 256; + copyY = 224; + } else { + copyX = 160; + copyY = 144; + } + } + // MMX doesn't seem to be faster to copy the data + __asm { + mov eax, copyX; + mov ebx, copyY; + + mov esi, pix; + mov edi, locked.pBits; + mov edx, locked.Pitch; + cmp systemColorDepth, 16; + jnz gbaOtherColor; + sub edx, eax; + sub edx, eax; + lea esi,[esi+2*eax+4]; + shr eax, 1; + gbaLoop16bit: + mov ecx, eax; + repz movsd; + inc esi; + inc esi; + inc esi; + inc esi; + add edi, edx; + dec ebx; + jnz gbaLoop16bit; + jmp gbaLoopEnd; + gbaOtherColor: + cmp systemColorDepth, 32; + jnz gbaOtherColor2; + + sub edx, eax; + sub edx, eax; + sub edx, eax; + sub edx, eax; + lea esi, [esi+4*eax+4]; + gbaLoop32bit: + mov ecx, eax; + repz movsd; + add esi, 4; + add edi, edx; + dec ebx; + jnz gbaLoop32bit; + jmp gbaLoopEnd; + gbaOtherColor2: + lea eax, [eax+2*eax]; + sub edx, eax; + gbaLoop24bit: + mov ecx, eax; + shr ecx, 2; + repz movsd; + add edi, edx; + dec ebx; + jnz gbaLoop24bit; + gbaLoopEnd: + } + } + + if(theApp.videoOption > VIDEO_4X && theApp.showSpeed) { + char buffer[30]; + if(theApp.showSpeed == 1) + sprintf(buffer, "%3d%%", systemSpeed); + else + sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + theApp.showRenderedFrames); + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)locked.pBits, + locked.Pitch, + theApp.rect.left+10, + theApp.rect.bottom-10, + buffer); + else + drawText((u8*)locked.pBits, + locked.Pitch, + theApp.rect.left+10, + theApp.rect.bottom-10, + buffer); + } + + if(textMethod == 1) + { + DrawTextMessages((u8*)locked.pBits, locked.Pitch, theApp.rect.left, theApp.rect.bottom); + } + + pTexture->UnlockRect(0); + + float scaleX = (float)theApp.surfaceSizeX / theApp.sizeX; + float scaleY = (float)theApp.surfaceSizeY / theApp.sizeY; + BlitRect(pDevice, pTexture, 0, 0, scaleX*256, scaleY*256, 0xffffff, 0.1f); + } + + + if(textMethod == 2) + { + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2) && pFont) { + pFont->Begin(); + RECT r; + D3DCOLOR color; + + r.left = 10; + r.top = dpp.BackBufferHeight - 20*(slot+1); + r.right = dpp.BackBufferWidth - 10; + r.bottom = r.top + 20; + + if(outlinedText) + { + color = textColor != 7 ? D3DCOLOR_ARGB(255, 0, 0, 0) : D3DCOLOR_ARGB(255,255,255,255); + + // draw outline + const static int xd [8] = {-1,0,1,1,1,0,-1,-1}; + const static int yd [8] = {-1,-1,-1,0,1,1,1,0}; + for(int i = 0 ; i < 8 ; i++) + { + RECT r2 = r; + r2.left+=xd[i]; r2.right+=xd[i]; + r2.top+=yd[i]; r2.bottom+=yd[i]; + + pFont->DrawText(theApp.screenMessageBuffer[slot], -1, &r2, 0, color); + } + } + + // draw center text + switch(textColor) + { + case 0: color = D3DCOLOR_ARGB(255, 255, 255, 255); break; + case 1: color = D3DCOLOR_ARGB(255, 255, 0, 0); break; + case 2: color = D3DCOLOR_ARGB(255, 255, 255, 0); break; + case 3: color = D3DCOLOR_ARGB(255, 0, 255, 0); break; + case 4: color = D3DCOLOR_ARGB(255, 0, 255, 255); break; + case 5: color = D3DCOLOR_ARGB(255, 0, 0, 255); break; + case 6: color = D3DCOLOR_ARGB(255, 255, 0, 255); break; + case 7: color = D3DCOLOR_ARGB(255, 0, 0, 0); break; + } + pFont->DrawText(theApp.screenMessageBuffer[slot], -1, &r, 0, color); + + pFont->End(); + } else { + theApp.screenMessage[slot] = false; + } + } + } + } + + pDevice->EndScene(); + + pDevice->Present( NULL, NULL, NULL, NULL ); + } +} + +void Direct3DDisplay::invalidateDeviceObjects() +{ + if(pFont) + pFont->Release(); + pFont = NULL; +} + +void Direct3DDisplay::resize(int w, int h) +{ + if(pDevice) { + dpp.BackBufferWidth = w; + dpp.BackBufferHeight = h; + HRESULT hr; + invalidateDeviceObjects(); + if(SUCCEEDED(hr = pDevice->Reset(&dpp))) { + restoreDeviceObjects(); + } else + systemMessage(0, "Failed device reset %08x", hr); + } +} + +bool Direct3DDisplay::changeRenderSize(int w, int h) +{ + if(w != width || h != height) { + if(pTexture) { + pTexture->Release(); + pTexture = NULL; + } + if(!initializeOffscreen(w, h)) { + failed = true; + return false; + } + } + if(filterDisabled && theApp.filterFunction) + theApp.filterFunction = NULL; + + return true; +} + +void Direct3DDisplay::setOption(const char *option, int value) +{ + if(!strcmp(option, "d3dFilter")) + updateFiltering(value); +} + +int Direct3DDisplay::selectFullScreenMode(GUID **) +{ + HWND wnd = GetDesktopWindow(); + RECT r; + GetWindowRect(wnd, &r); + int w = (r.right - r.left) & 4095; + int h = (r.bottom - r.top) & 4095; + HDC dc = GetDC(wnd); + int c = GetDeviceCaps(dc, BITSPIXEL); + ReleaseDC(wnd, dc); + + return (c << 24) | (w << 12) | h; +} + +IDisplay *newDirect3DDisplay() +{ + return new Direct3DDisplay(); +} + diff --git a/src/win32/DirectDraw.cpp b/src/win32/DirectDraw.cpp new file mode 100644 index 0000000..4ff0b70 --- /dev/null +++ b/src/win32/DirectDraw.cpp @@ -0,0 +1,980 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" + +#define DIRECTDRAW_VERSION 0x0700 +#include "ddraw.h" + +#include "../System.h" +#include "../gb/gbGlobals.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" + +#include "VBA.h" +#include "MainWnd.h" +#include "Reg.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int Init_2xSaI(u32); +extern int RGB_LOW_BITS_MASK; +extern void winlog(const char *,...); +extern int systemSpeed; +extern int winVideoModeSelect(CWnd *, GUID **); + +class DirectDrawDisplay : public IDisplay { +private: + HINSTANCE ddrawDLL; + LPDIRECTDRAW7 pDirectDraw; + LPDIRECTDRAWSURFACE7 ddsPrimary; + LPDIRECTDRAWSURFACE7 ddsOffscreen; + LPDIRECTDRAWSURFACE7 ddsFlip; + LPDIRECTDRAWCLIPPER ddsClipper; + int width; + int height; + bool failed; + + bool initializeOffscreen(int w, int h); +public: + DirectDrawDisplay(); + virtual ~DirectDrawDisplay(); + + virtual bool initialize(); + virtual void cleanup(); + virtual void render(); + virtual void checkFullScreen(); + virtual void renderMenu(); + virtual void clear(); + virtual bool changeRenderSize(int w, int h); + virtual DISPLAY_TYPE getType() { return DIRECT_DRAW; }; + virtual void setOption(const char *, int) {} + virtual bool isSkinSupported() { return true; } + virtual int selectFullScreenMode(GUID **); +}; + +static HRESULT WINAPI checkModesAvailable(LPDDSURFACEDESC2 surf, LPVOID lpContext) +{ + if(surf->dwWidth == 320 && + surf->dwHeight == 240 && + surf->ddpfPixelFormat.dwRGBBitCount == 16) { + theApp.mode320Available = TRUE; + } + if(surf->dwWidth == 640 && + surf->dwHeight == 480 && + surf->ddpfPixelFormat.dwRGBBitCount == 16) { + theApp.mode640Available = TRUE; + } + if(surf->dwWidth == 800 && + surf->dwHeight == 600 && + surf->ddpfPixelFormat.dwRGBBitCount == 16) { + theApp.mode800Available = TRUE; + } + return DDENUMRET_OK; +} + +static int ffs(UINT mask) +{ + int m = 0; + if (mask) { + while (!(mask & (1 << m))) + m++; + + return (m); + } + + return (0); +} + +DirectDrawDisplay::DirectDrawDisplay() +{ + pDirectDraw = NULL; + ddsPrimary = NULL; + ddsOffscreen = NULL; + ddsFlip = NULL; + ddsClipper = NULL; + ddrawDLL = NULL; + width = 0; + height = 0; + failed = false; +} + +DirectDrawDisplay::~DirectDrawDisplay() +{ + cleanup(); +} + +void DirectDrawDisplay::cleanup() +{ + if(pDirectDraw != NULL) { + if(ddsClipper != NULL) { + ddsClipper->Release(); + ddsClipper = NULL; + } + + if(ddsFlip != NULL) { + ddsFlip->Release(); + ddsFlip = NULL; + } + + if(ddsOffscreen != NULL) { + ddsOffscreen->Release(); + ddsOffscreen = NULL; + } + + if(ddsPrimary != NULL) { + ddsPrimary->Release(); + ddsPrimary = NULL; + } + + pDirectDraw->Release(); + pDirectDraw = NULL; + } + + if(ddrawDLL != NULL) { + /**/AfxFreeLibrary(ddrawDLL); + ddrawDLL = NULL; + } + width = 0; + height = 0; +} + +bool DirectDrawDisplay::initialize() +{ + theApp.sizeX = 240; + theApp.sizeY = 160; + + switch(theApp.videoOption) { + case VIDEO_1X: + theApp.surfaceSizeX = theApp.sizeX; + theApp.surfaceSizeY = theApp.sizeY; + break; + case VIDEO_2X: + theApp.surfaceSizeX = theApp.sizeX * 2; + theApp.surfaceSizeY = theApp.sizeY * 2; + break; + case VIDEO_3X: + theApp.surfaceSizeX = theApp.sizeX * 3; + theApp.surfaceSizeY = theApp.sizeY * 3; + break; + case VIDEO_4X: + theApp.surfaceSizeX = theApp.sizeX * 4; + theApp.surfaceSizeY = theApp.sizeY * 4; + break; + case VIDEO_320x240: + case VIDEO_640x480: + case VIDEO_800x600: + case VIDEO_OTHER: + { + int scaleX = (theApp.fsWidth / theApp.sizeX); + int scaleY = (theApp.fsHeight / theApp.sizeY); + int min = scaleX < scaleY ? scaleX : scaleY; + if(theApp.fsMaxScale) + min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min; + theApp.surfaceSizeX = theApp.sizeX * min; + theApp.surfaceSizeY = theApp.sizeY * min; + if(theApp.fullScreenStretch) { + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; + } + } + break; + } + + theApp.rect.left = 0; + theApp.rect.top = 0; + theApp.rect.right = theApp.sizeX; + theApp.rect.bottom = theApp.sizeY; + + theApp.dest.left = 0; + theApp.dest.top = 0; + theApp.dest.right = theApp.surfaceSizeX; + theApp.dest.bottom = theApp.surfaceSizeY; + + DWORD style = WS_POPUP | WS_VISIBLE; + DWORD styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + style |= WS_OVERLAPPEDWINDOW; + else + styleEx = WS_EX_TOPMOST; + + if(theApp.videoOption <= VIDEO_4X) + AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); + else + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + + int winSizeX = theApp.dest.right-theApp.dest.left; + int winSizeY = theApp.dest.bottom-theApp.dest.top; + + int x = 0; + int y = 0; + + if(theApp.videoOption <= VIDEO_4X) { + x = theApp.windowPositionX; + y = theApp.windowPositionY; + } + + // Create a window + MainWnd *pWnd = new MainWnd; + theApp.m_pMainWnd = pWnd; + + pWnd->CreateEx(styleEx, + theApp.wndClass, + "VisualBoyAdvance", + style, + x,y,winSizeX,winSizeY, + NULL, + 0); + + if (!(HWND)*pWnd) { + winlog("Error creating Window %08x\n", GetLastError()); + return FALSE; + } + + + theApp.updateMenuBar(); + + theApp.adjustDestRect(); + + GUID *guid = NULL; + if(theApp.ddrawEmulationOnly) + guid = (GUID *)DDCREATE_EMULATIONONLY; + + if(theApp.pVideoDriverGUID) + guid = theApp.pVideoDriverGUID; + + ddrawDLL = /**/AfxLoadLibrary("DDRAW.DLL"); + HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); + if(ddrawDLL != NULL) { + DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *)) + GetProcAddress(ddrawDLL, "DirectDrawCreateEx"); + + if(DDrawCreateEx == NULL) { + theApp.directXMessage("DirectDrawCreateEx"); + return FALSE; + } + } else { + theApp.directXMessage("DDRAW.DLL"); + return FALSE; + } + + theApp.ddrawUsingEmulationOnly = theApp.ddrawEmulationOnly; + + HRESULT hret = DDrawCreateEx(guid, + (void **)&pDirectDraw, + IID_IDirectDraw7, + NULL); + + if(hret != DD_OK) { + winlog("Error creating DirectDraw object %08x\n", hret); + if(theApp.ddrawEmulationOnly) { + // disable emulation only setting in case of failure + regSetDwordValue("ddrawEmulationOnly", 0); + } + // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWCREATE), hret); + return FALSE; + } + + if(theApp.ddrawDebug) { + DDCAPS driver; + DDCAPS hel; + ZeroMemory(&driver, sizeof(driver)); + ZeroMemory(&hel, sizeof(hel)); + driver.dwSize = sizeof(driver); + hel.dwSize = sizeof(hel); + pDirectDraw->GetCaps(&driver, &hel); + int i; + DWORD *p = (DWORD *)&driver; + for(i = 0; i < (int)driver.dwSize; i+=4) + winlog("Driver CAPS %2d: %08x\n", i>>2, *p++); + p = (DWORD *)&hel; + for(i = 0; i < (int)hel.dwSize; i+=4) + winlog("HEL CAPS %2d: %08x\n", i>>2, *p++); + } + + theApp.mode320Available = false; + theApp.mode640Available = false; + theApp.mode800Available = false; + // check for available fullscreen modes + pDirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, NULL, + checkModesAvailable); + + DWORD flags = DDSCL_NORMAL; + + if(theApp.videoOption >= VIDEO_320x240) + flags = DDSCL_ALLOWMODEX | + DDSCL_ALLOWREBOOT | + DDSCL_EXCLUSIVE | + DDSCL_FULLSCREEN; + + hret = pDirectDraw->SetCooperativeLevel(pWnd->m_hWnd, + flags); + + if(hret != DD_OK) { + winlog("Error SetCooperativeLevel %08x\n", hret); + // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWLEVEL), hret); + return FALSE; + } + + if(theApp.videoOption > VIDEO_4X) { + hret = pDirectDraw->SetDisplayMode(theApp.fsWidth, + theApp.fsHeight, + theApp.fsColorDepth, + 0, + 0); + if(hret != DD_OK) { + winlog("Error SetDisplayMode %08x\n", hret); + // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWSET), hret); + return FALSE; + } + } + + DDSURFACEDESC2 ddsd; + ZeroMemory(&ddsd,sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + if(theApp.videoOption > VIDEO_4X) { + if(theApp.tripleBuffering) { + // setup triple buffering + ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps |= DDSCAPS_COMPLEX | DDSCAPS_FLIP; + ddsd.dwBackBufferCount = 2; + } + } + + hret = pDirectDraw->CreateSurface(&ddsd, &ddsPrimary, NULL); + if(hret != DD_OK) { + winlog("Error primary CreateSurface %08x\n", hret); + // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWSURFACE), hret); + return FALSE; + } + + if(theApp.ddrawDebug) { + DDSCAPS2 caps; + ZeroMemory(&caps, sizeof(caps)); + ddsPrimary->GetCaps(&caps); + + winlog("Primary CAPS 1: %08x\n", caps.dwCaps); + winlog("Primary CAPS 2: %08x\n", caps.dwCaps2); + winlog("Primary CAPS 3: %08x\n", caps.dwCaps3); + winlog("Primary CAPS 4: %08x\n", caps.dwCaps4); + } + + if(theApp.videoOption > VIDEO_4X && theApp.tripleBuffering) { + DDSCAPS2 caps; + ZeroMemory(&caps, sizeof(caps)); + // this gets the third surface. The front one is the primary, + // the second is the backbuffer and the third is the flip + // surface + caps.dwCaps = DDSCAPS_BACKBUFFER; + + hret = ddsPrimary->GetAttachedSurface(&caps, &ddsFlip); + if(hret != DD_OK) { + winlog("Failed to get attached surface %08x", hret); + return FALSE; + } + + ddsFlip->AddRef(); + clear(); + } + + // create clipper in all modes to avoid paint problems + // if(videoOption <= VIDEO_4X) { + hret = pDirectDraw->CreateClipper(0, &ddsClipper, NULL); + if(hret == DD_OK) { + ddsClipper->SetHWnd(0, pWnd->m_hWnd); + if(theApp.videoOption > VIDEO_4X) { + if(theApp.tripleBuffering) + ddsFlip->SetClipper(ddsClipper); + else + ddsPrimary->SetClipper(ddsClipper); + } else + ddsPrimary->SetClipper(ddsClipper); + } + // } + + DDPIXELFORMAT px; + + px.dwSize = sizeof(px); + + hret = ddsPrimary->GetPixelFormat(&px); + + switch(px.dwRGBBitCount) { + case 15: + case 16: + systemColorDepth = 16; + break; + case 24: + systemColorDepth = 24; + theApp.filterFunction = NULL; + break; + case 32: + systemColorDepth = 32; + break; + default: + systemMessage(IDS_ERROR_DISP_COLOR, "Unsupported display setting for color depth: %d bits. \nWindows desktop must be in either 16-bit, 24-bit or 32-bit mode for this program to work in window mode.",px.dwRGBBitCount); + return FALSE; + } + theApp.updateFilter(); + theApp.updateIFB(); + + if(failed) + return false; + + pWnd->DragAcceptFiles(TRUE); + + return true; +} + +bool DirectDrawDisplay::changeRenderSize(int w, int h) +{ + if(w != width || h != height) { + if(ddsOffscreen) { + ddsOffscreen->Release(); + ddsOffscreen = NULL; + } + if(!initializeOffscreen(w, h)) { + failed = true; + return false; + } + } + return true; +} + +bool DirectDrawDisplay::initializeOffscreen(int w, int h) +{ + DDSURFACEDESC2 ddsd; + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + if(theApp.ddrawUseVideoMemory) + ddsd.ddsCaps.dwCaps |= (DDSCAPS_LOCALVIDMEM|DDSCAPS_VIDEOMEMORY); + ddsd.dwWidth = w; + ddsd.dwHeight = h; + + HRESULT hret = pDirectDraw->CreateSurface(&ddsd, &ddsOffscreen, NULL); + + if(hret != DD_OK) { + winlog("Error offscreen CreateSurface %08x\n", hret); + if(theApp.ddrawUseVideoMemory) { + regSetDwordValue("ddrawUseVideoMemory", 0); + } + // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWSURFACE2), hret); + return false; + } + + if(theApp.ddrawDebug) { + DDSCAPS2 caps; + ZeroMemory(&caps, sizeof(caps)); + ddsOffscreen->GetCaps(&caps); + + winlog("Offscreen CAPS 1: %08x\n", caps.dwCaps); + winlog("Offscreen CAPS 2: %08x\n", caps.dwCaps2); + winlog("Offscreen CAPS 3: %08x\n", caps.dwCaps3); + winlog("Offscreen CAPS 4: %08x\n", caps.dwCaps4); + } + + DDPIXELFORMAT px; + + px.dwSize = sizeof(px); + + hret = ddsOffscreen->GetPixelFormat(&px); + + if(theApp.ddrawDebug) { + DWORD *pdword = (DWORD *)&px; + for(int ii = 0; ii < 8; ii++) { + winlog("Pixel format %d %08x\n", ii, pdword[ii]); + } + } + + switch(px.dwRGBBitCount) { + case 15: + case 16: + systemColorDepth = 16; + break; + case 24: + systemColorDepth = 24; + theApp.filterFunction = NULL; + break; + case 32: + systemColorDepth = 32; + break; + default: + systemMessage(IDS_ERROR_DISP_COLOR, "Unsupported display setting for color depth: %d bits. \nWindows desktop must be in either 16-bit, 24-bit or 32-bit mode for this program to work in window mode.",px.dwRGBBitCount); + return FALSE; + } + if(theApp.ddrawDebug) { + winlog("R Mask: %08x\n", px.dwRBitMask); + winlog("G Mask: %08x\n", px.dwGBitMask); + winlog("B Mask: %08x\n", px.dwBBitMask); + } + + systemRedShift = ffs(px.dwRBitMask); + systemGreenShift = ffs(px.dwGBitMask); + systemBlueShift = ffs(px.dwBBitMask); + +#ifdef MMX + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +#endif + + if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0xF800 && + px.dwGBitMask == 0x07E0 && + px.dwBBitMask == 0x001F) { + systemGreenShift++; + Init_2xSaI(565); + RGB_LOW_BITS_MASK=0x821; + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x7C00 && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x001F) { + Init_2xSaI(555); + RGB_LOW_BITS_MASK=0x421; + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x07E0 && + px.dwBBitMask == 0xF800) { + systemGreenShift++; + Init_2xSaI(565); + RGB_LOW_BITS_MASK=0x821; + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x7C00) { + Init_2xSaI(555); + RGB_LOW_BITS_MASK=0x421; + } else { + // 32-bit or 24-bit + if(systemColorDepth == 32 || systemColorDepth == 24) { + systemRedShift += 3; + systemGreenShift += 3; + systemBlueShift += 3; + if(systemColorDepth == 32) + Init_2xSaI(32); + } + } + + if(theApp.ddrawDebug) { + winlog("R shift: %d\n", systemRedShift); + winlog("G shift: %d\n", systemGreenShift); + winlog("B shift: %d\n", systemBlueShift); + } + + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + case 24: + case 32: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + } + width = w; + height = h; + return true; +} + +void DirectDrawDisplay::clear() +{ + if(theApp.videoOption <= VIDEO_4X || !theApp.tripleBuffering || ddsFlip == NULL) + return; + + DDBLTFX fx; + ZeroMemory(&fx, sizeof(fx)); + fx.dwSize = sizeof(fx); + fx.dwFillColor = 0; + ddsFlip->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ddsPrimary->Flip(NULL, 0); + ddsFlip->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ddsPrimary->Flip(NULL, 0); + ddsFlip->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ddsPrimary->Flip(NULL, 0); +} + +void DirectDrawDisplay::renderMenu() +{ + checkFullScreen(); + theApp.m_pMainWnd->DrawMenuBar(); +} + +void DirectDrawDisplay::checkFullScreen() +{ + if(theApp.tripleBuffering) + pDirectDraw->FlipToGDISurface(); +} + +void DirectDrawDisplay::render() +{ + HRESULT hret; + + if(pDirectDraw == NULL || + ddsOffscreen == NULL || + ddsPrimary == NULL) + return; + + bool fastForward = speedup; +#if (defined(WIN32) && !defined(SDL)) + if(theApp.frameSearchSkipping) + { + if(theApp.frameSearchFirstStep) + fastForward = true; + else + return; // don't render skipped frame search frames + } +#endif + + if(theApp.vsync && !fastForward) { + hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); + } + + DDSURFACEDESC2 ddsDesc; + + ZeroMemory(&ddsDesc, sizeof(ddsDesc)); + + ddsDesc.dwSize = sizeof(ddsDesc); + + hret = ddsOffscreen->Lock(NULL, + &ddsDesc, + DDLOCK_WRITEONLY| +#ifndef FINAL_VERSION + DDLOCK_NOSYSLOCK| +#endif + DDLOCK_SURFACEMEMORYPTR, + NULL); + + if(hret == DDERR_SURFACELOST) { + hret = ddsPrimary->Restore(); + if(hret == DD_OK) { + hret = ddsOffscreen->Restore(); + + if(hret == DD_OK) { + hret = ddsOffscreen->Lock(NULL, + &ddsDesc, + DDLOCK_WRITEONLY| +#ifndef FINAL_VERSION + DDLOCK_NOSYSLOCK| +#endif + DDLOCK_SURFACEMEMORYPTR, + NULL); + + } + } + } + + if(hret == DD_OK) { + + //if(textMethod == 0) + //{ + //int copyX = 240, copyY = 160; + //if(theApp.cartridgeType == 1) + // if(gbBorderOn) copyX = 256, copyY = 224; + // else copyX = 160, copyY = 144; + + //DrawTextMessages((u8*)pix, copyX*(systemColorDepth/8)+(systemColorDepth==24?0:4), 0, copyY); + //} + + if(theApp.filterFunction) { + if(systemColorDepth == 16) +/// (*theApp.filterFunction)(pix+theApp.filterWidth*2+4, + (*theApp.filterFunction)(pix+theApp.filterWidth*2+4, + theApp.filterWidth*2+4, + (u8*)theApp.delta, + (u8*)ddsDesc.lpSurface, + ddsDesc.lPitch, + theApp.filterWidth, + theApp.filterHeight); + else +/// (*theApp.filterFunction)(pix+theApp.filterWidth*4+4, + (*theApp.filterFunction)(pix+theApp.filterWidth*4+4, + theApp.filterWidth*4+4, + (u8*)theApp.delta, + (u8*)ddsDesc.lpSurface, + ddsDesc.lPitch, + theApp.filterWidth, + theApp.filterHeight); + + } else { + int copyX = 240; + int copyY = 160; + + if(theApp.cartridgeType == 1) { + if(gbBorderOn) { + copyX = 256; + copyY = 224; + } else { + copyX = 160; + copyY = 144; + } + } + // MMX doesn't seem to be faster to copy the data + __asm { + mov eax, copyX; + mov ebx, copyY; + + mov esi, pix; + mov edi, ddsDesc.lpSurface; + mov edx, ddsDesc.lPitch; + cmp systemColorDepth, 16; + jnz gbaOtherColor; + sub edx, eax; + sub edx, eax; + lea esi,[esi+2*eax+4]; + shr eax, 1; + gbaLoop16bit: + mov ecx, eax; + repz movsd; + inc esi; + inc esi; + inc esi; + inc esi; + add edi, edx; + dec ebx; + jnz gbaLoop16bit; + jmp gbaLoopEnd; + gbaOtherColor: + cmp systemColorDepth, 32; + jnz gbaOtherColor2; + + sub edx, eax; + sub edx, eax; + sub edx, eax; + sub edx, eax; + lea esi, [esi+4*eax+4]; + gbaLoop32bit: + mov ecx, eax; + repz movsd; + add esi, 4; + add edi, edx; + dec ebx; + jnz gbaLoop32bit; + jmp gbaLoopEnd; + gbaOtherColor2: + lea eax, [eax+2*eax]; + sub edx, eax; + gbaLoop24bit: + mov ecx, eax; + shr ecx, 2; + repz movsd; + add edi, edx; + dec ebx; + jnz gbaLoop24bit; + gbaLoopEnd: + } + } + if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) { + char buffer[30]; + if(theApp.showSpeed == 1) + sprintf(buffer, "%3d%%", systemSpeed); + else + sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + theApp.showRenderedFrames); + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)ddsDesc.lpSurface, + ddsDesc.lPitch, + theApp.rect.left+10, + theApp.rect.bottom-10, + buffer); + else + drawText((u8*)ddsDesc.lpSurface, + ddsDesc.lPitch, + theApp.rect.left+10, + theApp.rect.bottom-10, + buffer); + } + + if(textMethod == 1) + { + DrawTextMessages((u8*)ddsDesc.lpSurface, ddsDesc.lPitch, theApp.rect.left, theApp.rect.bottom); + } + + } else if(theApp.ddrawDebug) + winlog("Error during lock: %08x\n", hret); + + hret = ddsOffscreen->Unlock(NULL); + + if(hret == DD_OK) { + ddsOffscreen->PageLock(0); + if(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) { + hret = ddsFlip->Blt(&theApp.dest, ddsOffscreen, NULL, DDBLT_WAIT, NULL); + if(hret == DD_OK) { + if(theApp.menuToggle || !theApp.active) { + pDirectDraw->FlipToGDISurface(); + ddsPrimary->SetClipper(ddsClipper); + hret = ddsPrimary->Blt(&theApp.dest, ddsFlip, NULL, DDBLT_ASYNC, NULL); + // if using emulation only, then we have to redraw the menu + // everytime. It seems like a bug in DirectDraw to me as we not + // overwritting the menu area at all. + if(theApp.ddrawUsingEmulationOnly) + theApp.m_pMainWnd->DrawMenuBar(); + } else + hret = ddsPrimary->Flip(NULL, 0); + } + } else { + hret = ddsPrimary->Blt(&theApp.dest, ddsOffscreen, NULL,DDBLT_ASYNC,NULL); + + if(hret == DDERR_SURFACELOST) { + hret = ddsPrimary->Restore(); + + if(hret == DD_OK) { + hret = ddsPrimary->Blt(&theApp.dest, ddsOffscreen, NULL, DDBLT_ASYNC, NULL); + } + } + } + ddsOffscreen->PageUnlock(0); + } else if(theApp.ddrawDebug) + winlog("Error during unlock: %08x\n", hret); + + + bool textMessageStarted = false; + + if(textMethod == 2) + { + HDC hdc; + + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2)) + { + + if(!textMessageStarted) + { + textMessageStarted = true; + ddsPrimary->SetClipper(ddsClipper); + ddsPrimary->GetDC(&hdc); + SetBkMode(hdc,TRANSPARENT); + SetTextColor(hdc, textColor != 7 ? RGB(0,0,0) : RGB(255,255,255)); + } + + if(outlinedText) + { + // draw black outline + const static int xd [8] = {-1,0,1,1,1,0,-1,-1}; + const static int yd [8] = {-1,-1,-1,0,1,1,1,0}; + for(int i = 0 ; i < 8 ; i++) + { + TextOut(hdc, theApp.dest.left+10+xd[i], theApp.dest.bottom - 20*(slot+1)+yd[i], theApp.screenMessageBuffer[slot], + strlen(theApp.screenMessageBuffer[slot])); + } + } + } else { + theApp.screenMessage[slot] = false; + } + } + } + + if(textMessageStarted) + { + COLORREF color; + switch(textColor) + { + case 0: color = RGB(255, 255, 255); break; + case 1: color = RGB(255, 0, 0); break; + case 2: color = RGB(255, 255, 0); break; + case 3: color = RGB(0, 255, 0); break; + case 4: color = RGB(0, 255, 255); break; + case 5: color = RGB(0, 0, 255); break; + case 6: color = RGB(255, 0, 255); break; + case 7: color = RGB(0, 0, 0); break; + } + SetTextColor(hdc, color); + + // draw center text + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2)) + { + TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20*(slot+1), theApp.screenMessageBuffer[slot], + strlen(theApp.screenMessageBuffer[slot])); + } + } + } + } + + if(textMessageStarted) + { + ddsPrimary->ReleaseDC(hdc); + } + } + + if(hret != DD_OK) { + if(theApp.ddrawDebug) + winlog("Error on update screen: %08x\n", hret); + } +} + +int DirectDrawDisplay::selectFullScreenMode(GUID **pGUID) +{ + return winVideoModeSelect(theApp.m_pMainWnd, pGUID); +} + +IDisplay *newDirectDrawDisplay() +{ + return new DirectDrawDisplay(); +} + +void DrawTextMessages(u8 * dest, int pitch, int left, int bottom) +{ + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2)) { + + drawText(dest, + pitch, + left, + bottom - 10*(slot+1), + theApp.screenMessageBuffer[slot], + theApp.screenMessageColorBuffer[slot]); + + } else { + theApp.screenMessage[slot] = false; + } + } + } +} diff --git a/src/win32/DirectInput.cpp b/src/win32/DirectInput.cpp new file mode 100644 index 0000000..4eb5de2 --- /dev/null +++ b/src/win32/DirectInput.cpp @@ -0,0 +1,1093 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../movie.h" + +#define DIRECTINPUT_VERSION 0x0500 +#include "dinput.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern void directXMessage(const char *); +extern void winlog(const char *msg,...); + +#define POV_UP 1 +#define POV_DOWN 2 +#define POV_RIGHT 4 +#define POV_LEFT 8 + +class DirectInput : public Input { +private: + HINSTANCE dinputDLL; + +public: + virtual void checkDevices(); + DirectInput(); + virtual ~DirectInput(); + + virtual bool initialize(); + virtual bool readDevices(); + virtual u32 readDevice(int which, bool sensor); + virtual CString getKeyName(int key); + virtual void checkKeys(); + virtual void activate(); + virtual void loadSettings(); + virtual void saveSettings(); +}; + +struct deviceInfo { + LPDIRECTINPUTDEVICE device; + BOOL isPolled; + int nButtons; + int nAxes; + int nPovs; + BOOL first; + struct { + DWORD offset; + LONG center; + LONG negative; + LONG positive; + } axis[8]; + int needed; + union { + UCHAR data[256]; + DIJOYSTATE state; + }; +}; + +static deviceInfo *currentDevice = NULL; +static int numDevices = 1; +static deviceInfo *pDevices = NULL; +static LPDIRECTINPUT pDirectInput = NULL; +static int joyDebug = 0; +static int axisNumber = 0; + +USHORT joypad[4][13] = { + { + DIK_LEFT, DIK_RIGHT, + DIK_UP, DIK_DOWN, + DIK_Z, DIK_X, + DIK_RETURN,DIK_BACK, + DIK_A, DIK_S, + DIK_SPACE, DIK_F12, + DIK_C + }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +USHORT motion[4] = { + DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2 +}; + +static int winReadKey(char *name, int num) +{ + char buffer[80]; + + sprintf(buffer, "Joy%d_%s", num, name); + + return regQueryDwordValue(buffer, (DWORD)-1); +} + +void winReadKeys() +{ + int key = -1; + + for(int i = 0; i < 4; i++) { + key = winReadKey("Left", i); + if(key != -1) + joypad[i][KEY_LEFT] = key; + key = winReadKey("Right", i); + if(key != -1) + joypad[i][KEY_RIGHT] = key; + key = winReadKey("Up", i); + if(key != -1) + joypad[i][KEY_UP] = key; + key = winReadKey("Down", i); + if(key != -1) + joypad[i][KEY_DOWN] = key; + key = winReadKey("A", i); + if(key != -1) + joypad[i][KEY_BUTTON_A] = key; + key = winReadKey("B", i); + if(key != -1) + joypad[i][KEY_BUTTON_B] = key; + key = winReadKey("L", i); + if(key != -1) + joypad[i][KEY_BUTTON_L] = key; + key = winReadKey("R", i); + if(key != -1) + joypad[i][KEY_BUTTON_R] = key; + key = winReadKey("Start", i); + if(key != -1) + joypad[i][KEY_BUTTON_START] = key; + key = winReadKey("Select", i); + if(key != -1) + joypad[i][KEY_BUTTON_SELECT] = key; + key = winReadKey("Speed", i); + if(key != -1) + joypad[i][KEY_BUTTON_SPEED] = key; + key = winReadKey("Capture", i); + if(key != -1) + joypad[i][KEY_BUTTON_CAPTURE] = key; + key = winReadKey("GS", i); + if(key != -1) + joypad[i][KEY_BUTTON_GS] = key; + } + key = regQueryDwordValue("Motion_Left", (DWORD)-1); + if(key != -1) + motion[KEY_LEFT] = key; + key = regQueryDwordValue("Motion_Right", (DWORD)-1); + if(key != -1) + motion[KEY_RIGHT] = key; + key = regQueryDwordValue("Motion_Up", (DWORD)-1); + if(key != -1) + motion[KEY_UP] = key; + key = regQueryDwordValue("Motion_Down", (DWORD)-1); + if(key != -1) + motion[KEY_DOWN] = key; +} + +static void winSaveKey(char *name, int num, USHORT value) +{ + char buffer[80]; + + sprintf(buffer, "Joy%d_%s", num, name); + + regSetDwordValue(buffer, value); +} + +void winSaveKeys() +{ + for(int i = 0; i < 4; i++) { + winSaveKey("Left", i, joypad[i][KEY_LEFT]); + winSaveKey("Right", i, joypad[i][KEY_RIGHT]); + winSaveKey("Up", i, joypad[i][KEY_UP]); + winSaveKey("Speed", i, joypad[i][KEY_BUTTON_SPEED]); + winSaveKey("Capture", i, joypad[i][KEY_BUTTON_CAPTURE]); + winSaveKey("GS", i, joypad[i][KEY_BUTTON_GS]); + winSaveKey("Down", i, joypad[i][KEY_DOWN]); + winSaveKey("A", i, joypad[i][KEY_BUTTON_A]); + winSaveKey("B", i, joypad[i][KEY_BUTTON_B]); + winSaveKey("L", i, joypad[i][KEY_BUTTON_L]); + winSaveKey("R", i, joypad[i][KEY_BUTTON_R]); + winSaveKey("Start", i, joypad[i][KEY_BUTTON_START]); + winSaveKey("Select", i, joypad[i][KEY_BUTTON_SELECT]); + } + regSetDwordValue("joyVersion", 1); + + regSetDwordValue("Motion_Left", + motion[KEY_LEFT]); + regSetDwordValue("Motion_Right", + motion[KEY_RIGHT]); + regSetDwordValue("Motion_Up", + motion[KEY_UP]); + regSetDwordValue("Motion_Down", + motion[KEY_DOWN]); +} + +static BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, + VOID* pContext ) +{ + DIPROPRANGE diprg; + diprg.diph.dwSize = sizeof(DIPROPRANGE); + diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); + diprg.diph.dwHow = DIPH_BYOFFSET; + diprg.diph.dwObj = pdidoi->dwOfs; // Specify the enumerated axis + + diprg.lMin = -32768; + diprg.lMax = 32767; + // try to set the range + if(FAILED(currentDevice->device->SetProperty(DIPROP_RANGE, &diprg.diph))) { + // Get the range for the axis + if( FAILED(currentDevice->device-> + GetProperty( DIPROP_RANGE, &diprg.diph ) ) ) { + return DIENUM_STOP; + } + } + + DIPROPDWORD didz; + + didz.diph.dwSize = sizeof(didz); + didz.diph.dwHeaderSize = sizeof(DIPROPHEADER); + didz.diph.dwHow = DIPH_BYOFFSET; + didz.diph.dwObj = pdidoi->dwOfs; + + didz.dwData = 5000; + + currentDevice->device->SetProperty(DIPROP_DEADZONE, &didz.diph); + + LONG center = (diprg.lMin + diprg.lMax)/2; + LONG threshold = (diprg.lMax - center)/2; + + // only 8 axis supported + if(axisNumber < 8) { + currentDevice->axis[axisNumber].center = center; + currentDevice->axis[axisNumber].negative = center - threshold; + currentDevice->axis[axisNumber].positive = center + threshold; + currentDevice->axis[axisNumber].offset = pdidoi->dwOfs; + } + axisNumber++; + return DIENUM_CONTINUE; +} + +static BOOL CALLBACK EnumPovsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, + VOID* pContext ) +{ + return DIENUM_CONTINUE; +} + +static BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE pInst, + LPVOID lpvContext) +{ + ZeroMemory(&pDevices[numDevices],sizeof(deviceInfo)); + + HRESULT hRet = pDirectInput->CreateDevice(pInst->guidInstance, + &pDevices[numDevices].device, + NULL); + + if(hRet != DI_OK) + return DIENUM_STOP; + + DIDEVCAPS caps; + caps.dwSize=sizeof(DIDEVCAPS); + + hRet = pDevices[numDevices].device->GetCapabilities(&caps); + + if(hRet == DI_OK) { + if(caps.dwFlags & DIDC_POLLEDDATAFORMAT || + caps.dwFlags & DIDC_POLLEDDEVICE) + pDevices[numDevices].isPolled = TRUE; + + pDevices[numDevices].nButtons = caps.dwButtons; + pDevices[numDevices].nAxes = caps.dwAxes; + pDevices[numDevices].nPovs = caps.dwPOVs; + + for(int i = 0; i < 6; i++) { + pDevices[numDevices].axis[i].center = 0x8000; + pDevices[numDevices].axis[i].negative = 0x4000; + pDevices[numDevices].axis[i].positive = 0xc000; + } + } else if(joyDebug) + winlog("Failed to get device capabilities %08x\n", hRet); + + if(joyDebug) { + // don't translate. debug only + winlog("******************************\n"); + winlog("Joystick %2d name : %s\n", numDevices, pInst->tszProductName); + } + + numDevices++; + + + return DIENUM_CONTINUE; +} + +BOOL CALLBACK DIEnumDevicesCallback2(LPCDIDEVICEINSTANCE pInst, + LPVOID lpvContext) +{ + numDevices++; + + return DIENUM_CONTINUE; +} + +static int getPovState(DWORD value) +{ + int state = 0; + if(LOWORD(value) != 0xFFFF) { + if(value < 9000 || value > 27000) + state |= POV_UP; + if(value > 0 && value < 18000) + state |= POV_RIGHT; + if(value > 9000 && value < 27000) + state |= POV_DOWN; + if(value > 18000) + state |= POV_LEFT; + } + return state; +} + +static void checkKeys() +{ + int dev = 0; + int i; + + for(i = 0; i < numDevices; i++) + pDevices[i].needed = 0; + + for(i = 0; i < 4; i++) { + dev = joypad[i][KEY_LEFT] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_LEFT] = DIK_LEFT; + + dev = joypad[i][KEY_RIGHT] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_RIGHT] = DIK_RIGHT; + + dev = joypad[i][KEY_UP] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_UP] = DIK_UP; + + dev = joypad[i][KEY_DOWN] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_DOWN] = DIK_DOWN; + + dev = joypad[i][KEY_BUTTON_A] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_A] = DIK_Z; + + dev = joypad[i][KEY_BUTTON_B] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_B] = DIK_X; + + dev = joypad[i][KEY_BUTTON_L] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_L] = DIK_A; + + dev = joypad[i][KEY_BUTTON_R] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_R] = DIK_S; + + dev = joypad[i][KEY_BUTTON_START] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_START] = DIK_RETURN; + + dev = joypad[i][KEY_BUTTON_SELECT] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_SELECT] = DIK_BACK; + + dev = joypad[i][KEY_BUTTON_SPEED] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_SPEED] = DIK_SPACE; + + dev = joypad[i][KEY_BUTTON_CAPTURE] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_CAPTURE] = DIK_F12; + + dev = joypad[i][KEY_BUTTON_GS] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + joypad[i][KEY_BUTTON_GS] = DIK_C; + } + + dev = motion[KEY_UP] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + motion[KEY_UP] = DIK_NUMPAD8; + + dev = motion[KEY_DOWN] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + motion[KEY_DOWN] = DIK_NUMPAD2; + + dev = motion[KEY_LEFT] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + motion[KEY_LEFT] = DIK_NUMPAD4; + + dev = motion[KEY_RIGHT] >> 8; + if(dev < numDevices && dev >= 0) + pDevices[dev].needed = 1; + else + motion[KEY_RIGHT] = DIK_NUMPAD6; +} + +#define KEYDOWN(buffer,key) (buffer[key] & 0x80) + +static bool readKeyboard() +{ + if(pDevices[0].needed) { + HRESULT hret = pDevices[0].device-> + GetDeviceState(256, + (LPVOID)pDevices[0].data); + + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { + hret = pDevices[0].device->Acquire(); + if(hret != DI_OK) + return false; + hret = pDevices[0].device->GetDeviceState(256,(LPVOID)pDevices[0].data); + } + + return hret == DI_OK; + } + return true; +} + +static bool readJoystick(int joy) +{ + if(pDevices[joy].needed) { + if(pDevices[joy].isPolled) + ((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll(); + + HRESULT hret = pDevices[joy].device-> + GetDeviceState(sizeof(DIJOYSTATE), + (LPVOID)&pDevices[joy].state); + + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { + hret = pDevices[joy].device->Acquire(); + + if(hret == DI_OK) { + + if(pDevices[joy].isPolled) + ((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll(); + + hret = pDevices[joy].device-> + GetDeviceState(sizeof(DIJOYSTATE), + (LPVOID)&pDevices[joy].state); + } + } + + return hret == DI_OK; + } + + return true; +} + +static void checkKeyboard() +{ + HRESULT hret = pDevices[0].device->Acquire(); + hret = pDevices[0].device-> + GetDeviceState(256, + (LPVOID)pDevices[0].data); + + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { + return; + } + + if(hret == DI_OK) { + for(int i = 0; i < 256; i++) { + if(KEYDOWN(pDevices[0].data, i)) { + SendMessage(GetFocus(), JOYCONFIG_MESSAGE,0,i); + break; + } + } + } +} + +static void checkJoypads() +{ + DIDEVICEOBJECTINSTANCE di; + + ZeroMemory(&di,sizeof(DIDEVICEOBJECTINSTANCE)); + + di.dwSize = sizeof(DIDEVICEOBJECTINSTANCE); + + int i =0; + + DIJOYSTATE joystick; + + for(i = 1; i < numDevices; i++) { + HRESULT hret = pDevices[i].device->Acquire(); + + + if(pDevices[i].isPolled) + ((LPDIRECTINPUTDEVICE2)pDevices[i].device)->Poll(); + + hret = pDevices[i].device->GetDeviceState(sizeof(joystick), &joystick); + + int j; + + if(pDevices[i].first) { + memcpy(&pDevices[i].state, &joystick, sizeof(joystick)); + pDevices[i].first = FALSE; + continue; + } + + for(j = 0; j < pDevices[i].nButtons; j++) { + if(((pDevices[i].state.rgbButtons[j] ^ joystick.rgbButtons[j]) + & joystick.rgbButtons[j]) & 0x80) { + HWND focus = GetFocus(); + + SendMessage(focus, JOYCONFIG_MESSAGE, i,j+128); + } + } + + for(j = 0; j < pDevices[i].nAxes && j < 8; j++) { + LONG value = pDevices[i].axis[j].center; + LONG old = 0; + switch(pDevices[i].axis[j].offset) { + case DIJOFS_X: + value = joystick.lX; + old = pDevices[i].state.lX; + break; + case DIJOFS_Y: + value = joystick.lY; + old = pDevices[i].state.lY; + break; + case DIJOFS_Z: + value = joystick.lZ; + old = pDevices[i].state.lZ; + break; + case DIJOFS_RX: + value = joystick.lRx; + old = pDevices[i].state.lRx; + break; + case DIJOFS_RY: + value = joystick.lRy; + old = pDevices[i].state.lRy; + break; + case DIJOFS_RZ: + value = joystick.lRz; + old = pDevices[i].state.lRz; + break; + case DIJOFS_SLIDER(0): + value = joystick.rglSlider[0]; + old = pDevices[i].state.rglSlider[0]; + break; + case DIJOFS_SLIDER(1): + value = joystick.rglSlider[1]; + old = pDevices[i].state.rglSlider[1]; + break; + } + if(value != old) { + if(value < pDevices[i].axis[j].negative) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<1)); + else if (value > pDevices[i].axis[j].positive) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<1)+1); + } + } + + for(j = 0;j < 4 && j < pDevices[i].nPovs; j++) { + if(LOWORD(pDevices[i].state.rgdwPOV[j]) != LOWORD(joystick.rgdwPOV[j])) { + int state = getPovState(joystick.rgdwPOV[j]); + + if(state & POV_UP) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<2)+0x20); + else if(state & POV_DOWN) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<2)+0x21); + else if(state & POV_RIGHT) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<2)+0x22); + else if(state & POV_LEFT) + SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<2)+0x23); + } + } + + memcpy(&pDevices[i].state, &joystick, sizeof(joystick)); + } +} + +BOOL checkKey(int key) +{ + int dev = (key >> 8); + + int k = (key & 255); + + if(dev == 0) { + return KEYDOWN(pDevices[0].data,k); + } else { + if(k < 16) { + int axis = k >> 1; + LONG value = pDevices[dev].axis[axis].center; + switch(pDevices[dev].axis[axis].offset) { + case DIJOFS_X: + value = pDevices[dev].state.lX; + break; + case DIJOFS_Y: + value = pDevices[dev].state.lY; + break; + case DIJOFS_Z: + value = pDevices[dev].state.lZ; + break; + case DIJOFS_RX: + value = pDevices[dev].state.lRx; + break; + case DIJOFS_RY: + value = pDevices[dev].state.lRy; + break; + case DIJOFS_RZ: + value = pDevices[dev].state.lRz; + break; + case DIJOFS_SLIDER(0): + value = pDevices[dev].state.rglSlider[0]; + break; + case DIJOFS_SLIDER(1): + value = pDevices[dev].state.rglSlider[1]; + break; + } + + if(k & 1) + return value > pDevices[dev].axis[axis].positive; + return value < pDevices[dev].axis[axis].negative; + } else if(k < 48) { + int hat = (k >> 2) & 3; + int state = getPovState(pDevices[dev].state.rgdwPOV[hat]); + BOOL res = FALSE; + switch(k & 3) { + case 0: + res = state & POV_UP; + break; + case 1: + res = state & POV_DOWN; + break; + case 2: + res = state & POV_RIGHT; + break; + case 3: + res = state & POV_LEFT; + break; + } + return res; + } else if(k >= 128) { + return pDevices[dev].state.rgbButtons[k-128] & 0x80; + } + } + + return FALSE; +} + +DirectInput::DirectInput() +{ + dinputDLL = NULL; +} + +DirectInput::~DirectInput() +{ + saveSettings(); + if(pDirectInput != NULL) { + if(pDevices) { + for(int i = 0; i < numDevices ; i++) { + if(pDevices[i].device) { + pDevices[i].device->Unacquire(); + pDevices[i].device->Release(); + pDevices[i].device = NULL; + } + } + free(pDevices); + pDevices = NULL; + } + + pDirectInput->Release(); + pDirectInput = NULL; + } + + if(dinputDLL) { + /**/AfxFreeLibrary(dinputDLL); + dinputDLL = NULL; + } +} + +bool DirectInput::initialize() +{ + joyDebug = GetPrivateProfileInt("config", + "joyDebug", + 0, + "VBA.ini"); + dinputDLL = /**/AfxLoadLibrary("DINPUT.DLL"); + HRESULT (WINAPI *DInputCreate)(HINSTANCE,DWORD,LPDIRECTINPUT *,IUnknown *); + if(dinputDLL != NULL) { + DInputCreate = (HRESULT (WINAPI *)(HINSTANCE,DWORD,LPDIRECTINPUT *,IUnknown *)) + GetProcAddress(dinputDLL, "DirectInputCreateA"); + + if(DInputCreate == NULL) { + directXMessage("DirectInputCreateA"); + return false; + } + } else { + directXMessage("DINPUT.DLL"); + return false; + } + + HRESULT hret = DInputCreate(AfxGetInstanceHandle(), + DIRECTINPUT_VERSION, + &pDirectInput, + NULL); + if(hret != DI_OK) { + // errorMessage(myLoadString(IDS_ERROR_DISP_CREATE), hret); + return false; + } + + hret = pDirectInput->EnumDevices(DIDEVTYPE_JOYSTICK, + DIEnumDevicesCallback2, + NULL, + DIEDFL_ATTACHEDONLY); + + + + pDevices = (deviceInfo *)calloc(numDevices, sizeof(deviceInfo)); + + hret = pDirectInput->CreateDevice(GUID_SysKeyboard,&pDevices[0].device,NULL); + pDevices[0].isPolled = false; + pDevices[0].needed = true; + + if(hret != DI_OK) { + // errorMessage(myLoadString(IDS_ERROR_DISP_CREATEDEVICE), hret); + return false; + } + + + numDevices = 1; + + hret = pDirectInput->EnumDevices(DIDEVTYPE_JOYSTICK, + DIEnumDevicesCallback, + NULL, + DIEDFL_ATTACHEDONLY); + + // hret = pDevices[0].device->SetCooperativeLevel(hWindow, + // DISCL_FOREGROUND| + // DISCL_NONEXCLUSIVE); + + if(hret != DI_OK) { + // errorMessage(myLoadString(IDS_ERROR_DISP_LEVEL), hret); + return false; + } + + hret = pDevices[0].device->SetDataFormat(&c_dfDIKeyboard); + + if(hret != DI_OK) { + // errorMessage(myLoadString(IDS_ERROR_DISP_DATAFORMAT), hret); + return false; + } + + for(int i = 1; i < numDevices; i++) { + pDevices[i].device->SetDataFormat(&c_dfDIJoystick); + pDevices[i].needed = false; + currentDevice = &pDevices[i]; + axisNumber = 0; + currentDevice->device->EnumObjects(EnumAxesCallback, NULL, DIDFT_AXIS); + currentDevice->device->EnumObjects(EnumPovsCallback, NULL, DIDFT_POV); + if(joyDebug) { + // don't translate. debug only + winlog("Joystick %2d polled : %d\n", i, currentDevice->isPolled); + winlog("Joystick %2d buttons : %d\n", i, currentDevice->nButtons); + winlog("Joystick %2d povs : %d\n", i, currentDevice->nPovs); + winlog("Joystick %2d axes : %d\n", i, currentDevice->nAxes); + for(int j = 0; j < currentDevice->nAxes; j++) { + winlog("Axis %2d offset : %08lx\n", j, currentDevice->axis[j]. + offset); + winlog("Axis %2d center : %08lx\n", j, currentDevice->axis[j]. + center); + winlog("Axis %2d negative : %08lx\n", j, currentDevice->axis[j]. + negative); + winlog("Axis %2d positive : %08lx\n", j, currentDevice->axis[j]. + positive); + } + } + + currentDevice = NULL; + } + + for(int i = 0; i < numDevices; i++) + pDevices[i].device->Acquire(); + + return true; +} + +bool DirectInput::readDevices() +{ + bool ok = true; + for(int i = 0; i < numDevices; i++) { + if(pDevices[i].needed) { + if(i) { + ok = readJoystick(i); + } else + ok = readKeyboard(); + } + } + return ok; +} + +u32 currentButtons [4] = {0,0,0,0}; +bool inputActive = true; // used to disable all input when the window is inactive +bool sensorOn = false; + +u32 DirectInput::readDevice(int which, bool sensor) +{ + int i = theApp.joypadDefault; + if(which >= 0 && which <= 3) + i = which; + + sensorOn = sensor; + + currentButtons[i] = 0; + + if(inputActive) + { + if(checkKey(joypad[i][KEY_BUTTON_A])) + currentButtons[i] |= BUTTON_MASK_A; + if(checkKey(joypad[i][KEY_BUTTON_B])) + currentButtons[i] |= BUTTON_MASK_B; + if(checkKey(joypad[i][KEY_BUTTON_SELECT])) + currentButtons[i] |= BUTTON_MASK_SELECT; + if(checkKey(joypad[i][KEY_BUTTON_START])) + currentButtons[i] |= BUTTON_MASK_START; + if(checkKey(joypad[i][KEY_RIGHT])) + currentButtons[i] |= BUTTON_MASK_RIGHT; + if(checkKey(joypad[i][KEY_LEFT])) + currentButtons[i] |= BUTTON_MASK_LEFT; + if(checkKey(joypad[i][KEY_UP])) + currentButtons[i] |= BUTTON_MASK_UP; + if(checkKey(joypad[i][KEY_DOWN])) + currentButtons[i] |= BUTTON_MASK_DOWN; + if(checkKey(joypad[i][KEY_BUTTON_R])) + currentButtons[i] |= BUTTON_MASK_R; + if(checkKey(joypad[i][KEY_BUTTON_L])) + currentButtons[i] |= BUTTON_MASK_L; + + if(sensor) + { + if(checkKey(motion[KEY_LEFT])) + currentButtons[i] |= BUTTON_MASK_LEFT_MOTION; + else if(checkKey(motion[KEY_RIGHT])) + currentButtons[i] |= BUTTON_MASK_RIGHT_MOTION; + if(checkKey(motion[KEY_UP])) + currentButtons[i] |= BUTTON_MASK_UP_MOTION; + else if(checkKey(motion[KEY_DOWN])) + currentButtons[i] |= BUTTON_MASK_DOWN_MOTION; + } + } + + currentButtons[i] |= theApp.skinButtons; + + if(theApp.autoFire || theApp.autoFire2) + { + currentButtons[i] |= (theApp.autoFireToggle ? theApp.autoFire : theApp.autoFire2); + theApp.autoFireToggle = !theApp.autoFireToggle; + } + if(theApp.autoHold) + currentButtons[i] ^= theApp.autoHold; + + extern int gbSgbMode; // from gbSGB.cpp + if(theApp.cartridgeType != 0 && !gbSgbMode) // regular GB has no L/R buttons + { + if(currentButtons[i] & BUTTON_MASK_L) + currentButtons[i] ^= BUTTON_MASK_L; + if(currentButtons[i] & BUTTON_MASK_R) + currentButtons[i] ^= BUTTON_MASK_R; + } + + if(!theApp.allowLeftRight) + { + // disallow L+R or U+D to being pressed at the same time + if((currentButtons[i] & (BUTTON_MASK_RIGHT|BUTTON_MASK_LEFT)) == (BUTTON_MASK_RIGHT|BUTTON_MASK_LEFT)) + currentButtons[i] &= ~BUTTON_MASK_RIGHT; // leave only LEFT on + if((currentButtons[i] & (BUTTON_MASK_DOWN|BUTTON_MASK_UP)) == (BUTTON_MASK_DOWN|BUTTON_MASK_UP)) + currentButtons[i] &= ~BUTTON_MASK_DOWN; // leave only UP on + } + + if(theApp.frameSearchSkipping) + currentButtons[i] = theApp.frameSearchOldInput[i]; + + VBAMovieUpdate(i); + + + if(sensorOn) + { + // handle motion sensor input + if(currentButtons[i] & BUTTON_MASK_LEFT_MOTION) + { + theApp.sensorX += 3; + if(theApp.sensorX > 2197) theApp.sensorX = 2197; + if(theApp.sensorX < 2047) theApp.sensorX = 2057; + } + else if(currentButtons[i] & BUTTON_MASK_RIGHT_MOTION) + { + theApp.sensorX -= 3; + if(theApp.sensorX < 1897) theApp.sensorX = 1897; + if(theApp.sensorX > 2047) theApp.sensorX = 2037; + } + else if(theApp.sensorX > 2047) + { + theApp.sensorX -= 2; + if(theApp.sensorX < 2047) theApp.sensorX = 2047; + } + else + { + theApp.sensorX += 2; + if(theApp.sensorX > 2047) theApp.sensorX = 2047; + } + + if(currentButtons[i] & BUTTON_MASK_UP_MOTION) + { + theApp.sensorY += 3; + if(theApp.sensorY > 2197) theApp.sensorY = 2197; + if(theApp.sensorY < 2047) theApp.sensorY = 2057; + } + else if(currentButtons[i] & BUTTON_MASK_DOWN_MOTION) + { + theApp.sensorY -= 3; + if(theApp.sensorY < 1897) theApp.sensorY = 1897; + if(theApp.sensorY > 2047) theApp.sensorY = 2037; + } + else if(theApp.sensorY > 2047) + { + theApp.sensorY -= 2; + if(theApp.sensorY < 2047) theApp.sensorY = 2047; + } + else + { + theApp.sensorY += 2; + if(theApp.sensorY > 2047) theApp.sensorY = 2047; + } + } + + + uint32 res = currentButtons[i] & BUTTON_REGULAR_MASK; + + if(inputActive) + { + // the "non-button" buttons (what a hack!) + if(checkKey(joypad[i][KEY_BUTTON_SPEED]) || theApp.speedupToggle) + res |= BUTTON_MASK_SPEED; + if(checkKey(joypad[i][KEY_BUTTON_CAPTURE])) + res |= BUTTON_MASK_CAPTURE; + if(checkKey(joypad[i][KEY_BUTTON_GS])) + res |= BUTTON_MASK_GAMESHARK; + } + + return res; +} + +CString DirectInput::getKeyName(int key) +{ + int d = (key >> 8); + int k = key & 255; + + DIDEVICEOBJECTINSTANCE di; + + ZeroMemory(&di,sizeof(DIDEVICEOBJECTINSTANCE)); + + di.dwSize = sizeof(DIDEVICEOBJECTINSTANCE); + + CString winBuffer = winResLoadString(IDS_ERROR); + + if(d == 0) { + pDevices[0].device->GetObjectInfo(&di,key,DIPH_BYOFFSET); + winBuffer = di.tszName; + } else { + if(k < 16) { + if(k < 4) { + switch(k) { + case 0: + winBuffer.Format(winResLoadString(IDS_JOY_LEFT), d); + break; + case 1: + winBuffer.Format(winResLoadString(IDS_JOY_RIGHT), d); + break; + case 2: + winBuffer.Format(winResLoadString(IDS_JOY_UP), d); + break; + case 3: + winBuffer.Format(winResLoadString(IDS_JOY_DOWN), d); + break; + } + } else { + pDevices[d].device->GetObjectInfo(&di, + pDevices[d].axis[k>>1].offset, + DIPH_BYOFFSET); + if(k & 1) + winBuffer.Format("Joy %d %s +", d, di.tszName); + else + winBuffer.Format("Joy %d %s -", d, di.tszName); + } + } else if(k < 48) { + int hat = (k >> 2) & 3; + pDevices[d].device->GetObjectInfo(&di, + DIJOFS_POV(hat), + DIPH_BYOFFSET); + char *dir = "up"; + int dd = k & 3; + if(dd == 1) + dir = "down"; + else if(dd == 2) + dir = "right"; + else if(dd == 3) + dir = "left"; + winBuffer.Format("Joy %d %s %s", d, di.tszName, dir); + } else { + pDevices[d].device->GetObjectInfo(&di, + DIJOFS_BUTTON(k-128), + DIPH_BYOFFSET); + winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName); + } + } + + return winBuffer; +} + +void DirectInput::checkKeys() +{ + ::checkKeys(); +} + + +Input *newDirectInput() +{ + return new DirectInput; +} + + +void DirectInput::checkDevices() +{ + checkJoypads(); + checkKeyboard(); +} + +void DirectInput::activate() +{ + for(int i = 0; i < numDevices; i++) { + if(pDevices != NULL && pDevices[i].device != NULL) + pDevices[i].device->Acquire(); + } +} + +void DirectInput::loadSettings() +{ + winReadKeys(); +} + +void DirectInput::saveSettings() +{ + winSaveKeys(); +} diff --git a/src/win32/DirectSound.cpp b/src/win32/DirectSound.cpp new file mode 100644 index 0000000..fea5ba3 --- /dev/null +++ b/src/win32/DirectSound.cpp @@ -0,0 +1,474 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "VBA.h" +#include "AVIWrite.h" +#include "Sound.h" +#include "WavWriter.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Sound.h" +#include "../nesvideos-piece.h" + +#include +#include + +class DirectSound : public ISound +{ +private: + HINSTANCE dsoundDLL; + LPDIRECTSOUND pDirectSound; + LPDIRECTSOUNDBUFFER dsbPrimary; + LPDIRECTSOUNDBUFFER dsbSecondary; + LPDIRECTSOUNDNOTIFY dsbNotify; + HANDLE dsbEvent; + WAVEFORMATEX wfx; + float curRate; + +public: + DirectSound(); + virtual ~DirectSound(); + + bool init(); + void pause(); + void reset(); + void resume(); + void write(); + void setSpeed(float rate); + bool isPlaying(); +}; + +DirectSound::DirectSound() +{ + dsoundDLL = NULL; + pDirectSound = NULL; + dsbPrimary = NULL; + dsbSecondary = NULL; + dsbNotify = NULL; + dsbEvent = NULL; +} + +DirectSound::~DirectSound() +{ + if(theApp.aviRecorder != NULL) { + delete theApp.aviRecorder; + theApp.aviRecorder = NULL; + theApp.aviFrameNumber = 0; + theApp.aviRecording = false; + } + + if(theApp.soundRecording) { + if(theApp.soundRecorder != NULL) { + delete theApp.soundRecorder; + theApp.soundRecorder = NULL; + } + theApp.soundRecording = false; + } + + if(dsbNotify != NULL) { + dsbNotify->Release(); + dsbNotify = NULL; + } + + if(dsbEvent != NULL) { + CloseHandle(dsbEvent); + dsbEvent = NULL; + } + + if(pDirectSound != NULL) { + if(dsbPrimary != NULL) { + dsbPrimary->Release(); + dsbPrimary = NULL; + } + + if(dsbSecondary != NULL) { + dsbSecondary->Release(); + dsbSecondary = NULL; + } + + pDirectSound->Release(); + pDirectSound = NULL; + } + + if(dsoundDLL != NULL) { + FreeLibrary(dsoundDLL); + dsoundDLL = NULL; + } +} + +bool DirectSound::init() +{ + HRESULT hr; + + dsoundDLL = LoadLibrary("DSOUND.DLL"); + HRESULT (WINAPI *DSoundCreate)(LPCGUID,LPDIRECTSOUND *,IUnknown *); + if(dsoundDLL != NULL) { + DSoundCreate = (HRESULT (WINAPI *)(LPCGUID,LPDIRECTSOUND *,IUnknown *)) + GetProcAddress(dsoundDLL, "DirectSoundCreate"); + + if(DSoundCreate == NULL) { + theApp.directXMessage("DirectSoundCreate"); + return false; + } + } else { + theApp.directXMessage("DSOUND.DLL"); + return false; + } + + if(FAILED(hr = DSoundCreate(NULL,&pDirectSound,NULL))) + { + // errorMessage(myLoadString(IDS_ERROR_SOUND_CREATE), hr); + systemMessage(IDS_CANNOT_CREATE_DIRECTSOUND, + "Cannot create DirectSound %08x", hr); + pDirectSound = NULL; + dsbSecondary = NULL; + return false; + } + + if(FAILED(hr=pDirectSound->SetCooperativeLevel((HWND)*theApp.m_pMainWnd, DSSCL_EXCLUSIVE))) + { + // errorMessage(myLoadString(IDS_ERROR_SOUND_LEVEL), hr); + systemMessage(IDS_CANNOT_SETCOOPERATIVELEVEL, + "Cannot SetCooperativeLevel %08x", hr); + return false; + } + + DSBUFFERDESC dsbdesc; + ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); + dsbdesc.dwSize=sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; + + if(FAILED(hr=pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbPrimary, NULL))) + { + // errorMessage(myLoadString(IDS_ERROR_SOUND_BUFFER),hr); + systemMessage(IDS_CANNOT_CREATESOUNDBUFFER, + "Cannot CreateSoundBuffer %08x", hr); + return false; + } + + // Set primary buffer format + + memset(&wfx, 0, sizeof(WAVEFORMATEX)); + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 2; + switch(soundQuality) { + case 2: + wfx.nSamplesPerSec = 22050; + soundBufferLen = 736*2; + soundBufferTotalLen = 7360*2; + break; + case 4: + wfx.nSamplesPerSec = 11025; + soundBufferLen = 368*2; + soundBufferTotalLen = 3680*2; + break; + default: + soundQuality = 1; + wfx.nSamplesPerSec = 44100; + soundBufferLen = 1470*2; + soundBufferTotalLen = 14700*2; + } + wfx.wBitsPerSample = 16; + wfx.nBlockAlign = (wfx.wBitsPerSample / 8) * wfx.nChannels; + wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; + + if(FAILED(hr = dsbPrimary->SetFormat(&wfx))) { + // errorMessage(myLoadString(IDS_ERROR_SOUND_PRIMARY),hr); + systemMessage(IDS_CANNOT_SETFORMAT_PRIMARY, + "Cannot SetFormat for primary %08x", hr); + return false; + } + + ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); + dsbdesc.dwSize = sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_CTRLPOSITIONNOTIFY|DSBCAPS_CTRLFREQUENCY|DSBCAPS_GLOBALFOCUS; + dsbdesc.dwBufferBytes = soundBufferTotalLen; + dsbdesc.lpwfxFormat = &wfx; + + if(FAILED(hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL))) + { + bool ok = false; + while (dsbdesc.dwFlags != DSBCAPS_GETCURRENTPOSITION2) + { + if(dsbdesc.dwFlags & DSBCAPS_CTRLFREQUENCY) dsbdesc.dwFlags ^= DSBCAPS_CTRLFREQUENCY; + else if(dsbdesc.dwFlags & DSBCAPS_GLOBALFOCUS) dsbdesc.dwFlags ^= DSBCAPS_GLOBALFOCUS; + else if(dsbdesc.dwFlags & DSBCAPS_CTRLPOSITIONNOTIFY) dsbdesc.dwFlags ^= DSBCAPS_CTRLPOSITIONNOTIFY; + if(SUCCEEDED(hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL))) + { + ok = true; + break; + } + } + if(!ok) + { + systemMessage(IDS_CANNOT_CREATESOUNDBUFFER_SEC, "Cannot CreateSoundBuffer secondary %08x", hr); + return false; + } + + dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2; + } + + dsbSecondary->SetCurrentPosition(0); + + if(!theApp.useOldSync) { + hr = dsbSecondary->QueryInterface(IID_IDirectSoundNotify, + (void **)&dsbNotify); + if(!FAILED(hr)) { + dsbEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + + DSBPOSITIONNOTIFY notify[10]; + + for(int i = 0; i < 10; i++) { + notify[i].dwOffset = i*soundBufferLen; + notify[i].hEventNotify = dsbEvent; + } + if(FAILED(dsbNotify->SetNotificationPositions(10, notify))) { + dsbNotify->Release(); + dsbNotify = NULL; + CloseHandle(dsbEvent); + dsbEvent = NULL; + } + } + } + + hr = dsbPrimary->Play(0,0,DSBPLAY_LOOPING); + + if(FAILED(hr)) { + // errorMessage(myLoadString(IDS_ERROR_SOUND_PLAYPRIM), hr); + systemMessage(IDS_CANNOT_PLAY_PRIMARY, "Cannot Play primary %08x", hr); + return false; + } + + systemSoundOn = true; + + return true; +} + +void DirectSound::setSpeed(float rate) +{ + if(dsbSecondary == NULL || wfx.nSamplesPerSec <= 0) + return; + + if(rate != curRate) + { + curRate = rate; + + if(rate > 4.0f) rate = 4.0f; + if(rate < 0.06f) rate = 0.06f; + + dsbSecondary->SetFrequency((DWORD)((float)wfx.nSamplesPerSec * rate)); + } +} + +void DirectSound::pause() +{ + if(dsbSecondary != NULL) { + DWORD status = 0; + dsbSecondary->GetStatus(&status); + + if(status & DSBSTATUS_PLAYING) { + //systemScreenMessage("sound stopped (pause)!", 3); + dsbSecondary->Stop(); + } + } +} + +bool DirectSound::isPlaying() +{ + if(dsbSecondary != NULL) { + DWORD status = 0; + dsbSecondary->GetStatus(&status); + + if(status & DSBSTATUS_PLAYING) { + return true; + } + } + return false; +} + +void DirectSound::reset() +{ + if(dsbSecondary) { + //systemScreenMessage("sound stopped (reset)!", 3); + dsbSecondary->Stop(); + dsbSecondary->SetCurrentPosition(0); + } +} + +void DirectSound::resume() +{ + if(dsbSecondary != NULL) { + dsbSecondary->Play(0,0,DSBPLAY_LOOPING); + } +} + +extern long linearFrameCount; +long linearSoundByteCount = 0; +long linearSoundFrameCount = 0; + +void DirectSound::write() +{ + int len = soundBufferLen; + LPVOID lpvPtr1; + DWORD dwBytes1; + LPVOID lpvPtr2; + DWORD dwBytes2; + + do + { + linearSoundByteCount += len; + if(wfx.nAvgBytesPerSec) + linearSoundFrameCount = 60 * linearSoundByteCount / wfx.nAvgBytesPerSec; + + if(pDirectSound != NULL) + { + if(theApp.soundRecording) { + if(dsbSecondary) { + if(theApp.soundRecorder == NULL) { + theApp.soundRecorder = new WavWriter; + WAVEFORMATEX format; + dsbSecondary->GetFormat(&format, sizeof(format), NULL); + if(theApp.soundRecorder->Open(theApp.soundRecordName)) + theApp.soundRecorder->SetFormat(&format); + } + } + + if(theApp.soundRecorder) { + theApp.soundRecorder->AddSound((u8 *)soundFinalWave, len); + } + } + + if(theApp.nvAudioLog) + { + NESVideoLoggingAudio((u8 *)soundFinalWave, wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nChannels, len/(wfx.nChannels*(wfx.wBitsPerSample/8))); + } + + if(theApp.aviRecording) { + if(theApp.aviRecorder) { + if(dsbSecondary) { + if(!theApp.aviRecorder->IsSoundAdded()) { + WAVEFORMATEX format; + dsbSecondary->GetFormat(&format, sizeof(format), NULL); + theApp.aviRecorder->SetSoundFormat(&format); + } + } + + theApp.aviRecorder->AddSound((const char *)soundFinalWave, len); + } + } + } + } + while(linearSoundFrameCount <= linearFrameCount); + + // arbitrarily wrap counters at 10000 frames to avoid mismatching wrap-around freeze + if(linearSoundFrameCount > 10000 && linearFrameCount > 10000) + { + linearFrameCount -= 10000; + linearSoundByteCount -= wfx.nAvgBytesPerSec*10000/60; + linearSoundFrameCount = 60 * linearSoundByteCount / wfx.nAvgBytesPerSec; + } + + if(!pDirectSound) + return; + + HRESULT hr; + + bool fastForward = speedup; +#if (defined(WIN32) && !defined(SDL)) + fastForward |= theApp.frameSearchSkipping; +#endif + + // slows down emulator to match up with the sound speed + if(!fastForward && synchronize && !(theApp.throttle > 100 && theApp.accuratePitchThrottle) && theApp.throttle>=6) { + DWORD status=0; + hr = dsbSecondary->GetStatus(&status); + if(status & DSBSTATUS_PLAYING) { + if(!soundPaused) { + DWORD play; + while(true) { + dsbSecondary->GetCurrentPosition(&play, NULL); + + if((int)(soundNextPosition+soundBufferLen) < (int)soundBufferTotalLen) + { + if(play < soundNextPosition + || play > soundNextPosition+soundBufferLen) + break; + } + else + { + if(play < soundNextPosition + && play > (soundNextPosition+soundBufferLen)%soundBufferTotalLen) + break; + } + + if(dsbEvent) { + WaitForSingleObject(dsbEvent, 50); + } + } + } + } else { + soundPaused = 1; + } + } + // Obtain memory address of write block. This will be in two parts + // if the block wraps around. + hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen, &lpvPtr1, + &dwBytes1, &lpvPtr2, &dwBytes2, + 0); + + if(FAILED(hr)) + { + char str [256]; + sprintf(str, "Locking secondary failed with %d", hr); + systemScreenMessage(str); + } + + // If DSERR_BUFFERLOST is returned, restore and retry lock. + if (DSERR_BUFFERLOST == hr) { + dsbSecondary->Restore(); + hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen,&lpvPtr1, + &dwBytes1, &lpvPtr2, &dwBytes2, + 0); + } + + soundNextPosition += soundBufferLen; + soundNextPosition = soundNextPosition % soundBufferTotalLen; + + + + if SUCCEEDED(hr) + { + // Write to pointers. + if(NULL != lpvPtr1) + CopyMemory(lpvPtr1, soundFinalWave, dwBytes1); + if(NULL != lpvPtr2) + CopyMemory(lpvPtr2, soundFinalWave+dwBytes1, dwBytes2); + + // Release the data back to DirectSound. + hr = dsbSecondary->Unlock(lpvPtr1, dwBytes1, lpvPtr2, + dwBytes2); + } +} + +ISound *newDirectSound() +{ + return new DirectSound(); +} diff --git a/src/win32/Directories.cpp b/src/win32/Directories.cpp new file mode 100644 index 0000000..842f176 --- /dev/null +++ b/src/win32/Directories.cpp @@ -0,0 +1,257 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Directories.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Directories.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// Directories dialog + +static int CALLBACK browseCallbackProc(HWND hWnd, UINT msg, + LPARAM l, LPARAM data) +{ + char *buffer = (char *)data; + switch(msg) { + case BFFM_INITIALIZED: + if(buffer[0]) + SendMessage(hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)buffer); + break; + default: + break; + } + return 0; +} + +Directories::Directories(CWnd* pParent /*=NULL*/) + : CDialog(Directories::IDD, pParent) +{ + //{{AFX_DATA_INIT(Directories) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void Directories::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(Directories) + DDX_Control(pDX, IDC_SAVE_PATH, m_savePath); + DDX_Control(pDX, IDC_ROM_PATH, m_romPath); + DDX_Control(pDX, IDC_MOVIES_PATH, m_gbromPath); + DDX_Control(pDX, IDC_CAPTURE_PATH, m_capturePath); + DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(Directories, CDialog) + //{{AFX_MSG_MAP(Directories) + ON_BN_CLICKED(IDC_BATTERY_DIR, OnBatteryDir) + ON_BN_CLICKED(IDC_BATTERY_DIR_RESET, OnBatteryDirReset) + ON_BN_CLICKED(IDC_CAPTURE_DIR, OnCaptureDir) + ON_BN_CLICKED(IDC_CAPTURE_DIR_RESET, OnCaptureDirReset) + ON_BN_CLICKED(IDC_MOVIES_DIR, OnMoviesDir) + ON_BN_CLICKED(IDC_MOVIES_DIR_RESET, OnMoviesDirReset) + ON_BN_CLICKED(IDC_ROM_DIR, OnRomDir) + ON_BN_CLICKED(IDC_ROM_DIR_RESET, OnRomDirReset) + ON_BN_CLICKED(IDC_SAVE_DIR, OnSaveDir) + ON_BN_CLICKED(IDC_SAVE_DIR_RESET, OnSaveDirReset) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Directories message handlers + +BOOL Directories::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString p = regQueryStringValue("romdir", NULL); + if(!p.IsEmpty()) { + int len = p.GetLength(); + if(len > 0) + if(p[len-1] == '\\') + p = p.Left(len-1); + GetDlgItem(IDC_ROM_PATH)->SetWindowText(p); + } + + p = regQueryStringValue("moviesdir", NULL); + if(!p.IsEmpty()) { + int len = p.GetLength(); + if(len > 0) + if(p[len-1] == '\\') + p = p.Left(len-1); + GetDlgItem(IDC_MOVIES_PATH)->SetWindowText(p); + } + + p = regQueryStringValue("batteryDir", NULL); + if(!p.IsEmpty()) + GetDlgItem(IDC_BATTERY_PATH)->SetWindowText( p); + p = regQueryStringValue("saveDir", NULL); + if(!p.IsEmpty()) + GetDlgItem(IDC_SAVE_PATH)->SetWindowText(p); + p = regQueryStringValue("captureDir", NULL); + if(!p.IsEmpty()) + GetDlgItem(IDC_CAPTURE_PATH)->SetWindowText(p); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void Directories::OnBatteryDir() +{ + m_batteryPath.GetWindowText(initialFolderDir); + CString p = browseForDir(winResLoadString(IDS_SELECT_BATTERY_DIR)); + if(!p.IsEmpty()) + m_batteryPath.SetWindowText(p); +} + +void Directories::OnBatteryDirReset() +{ + regDeleteValue("batteryDir"); + m_batteryPath.SetWindowText(""); +} + +void Directories::OnCaptureDir() +{ + m_capturePath.GetWindowText(initialFolderDir); + CString p = browseForDir(winResLoadString(IDS_SELECT_CAPTURE_DIR)); + if(!p.IsEmpty()) + m_capturePath.SetWindowText(p); +} + +void Directories::OnCaptureDirReset() +{ + regDeleteValue("captureDir"); + m_capturePath.SetWindowText(""); +} + +void Directories::OnMoviesDir() +{ + m_gbromPath.GetWindowText(initialFolderDir); + CString p = browseForDir(winResLoadString(IDS_SELECT_ROM_DIR)); + if(!p.IsEmpty()) + m_gbromPath.SetWindowText(p); +} + +void Directories::OnMoviesDirReset() +{ + regDeleteValue("moviesdir"); + m_gbromPath.SetWindowText(""); +} + +void Directories::OnRomDir() +{ + m_romPath.GetWindowText(initialFolderDir); + CString p = browseForDir(winResLoadString(IDS_SELECT_ROM_DIR)); + if(!p.IsEmpty()) + m_romPath.SetWindowText(p); +} + +void Directories::OnRomDirReset() +{ + regDeleteValue("romdir"); + m_romPath.SetWindowText(""); +} + +void Directories::OnSaveDir() +{ + m_savePath.GetWindowText(initialFolderDir); + CString p = browseForDir(winResLoadString(IDS_SELECT_SAVE_DIR)); + if(!p.IsEmpty()) + m_savePath.SetWindowText(p); +} + +void Directories::OnSaveDirReset() +{ + regDeleteValue("saveDir"); + m_savePath.SetWindowText(""); +} + +void Directories::OnCancel() +{ + EndDialog(FALSE); +} + +void Directories::OnOK() +{ + CString buffer; + m_romPath.GetWindowText(buffer); + if(!buffer.IsEmpty()) + regSetStringValue("romdir", buffer); + m_gbromPath.GetWindowText(buffer); + if(!buffer.IsEmpty()) + regSetStringValue("moviesdir", buffer); + m_batteryPath.GetWindowText(buffer); + if(!buffer.IsEmpty()) + regSetStringValue("batteryDir", buffer); + m_savePath.GetWindowText(buffer); + if(!buffer.IsEmpty()) + regSetStringValue("saveDir", buffer); + m_capturePath.GetWindowText(buffer); + if(!buffer.IsEmpty()) + regSetStringValue("captureDir", buffer); + EndDialog(TRUE); +} + +CString Directories::browseForDir(CString title) +{ + static char buffer[1024]; + LPMALLOC pMalloc; + LPITEMIDLIST pidl; + + CString res; + + if(SUCCEEDED(SHGetMalloc(&pMalloc))) { + BROWSEINFO bi; + ZeroMemory(&bi, sizeof(bi)); + bi.hwndOwner = m_hWnd; + bi.lpszTitle = title; + bi.pidlRoot = 0; + bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.lpfn = browseCallbackProc; + bi.lParam = (LPARAM)(LPCTSTR)initialFolderDir; + + pidl = SHBrowseForFolder(&bi); + + if(pidl) { + if(SHGetPathFromIDList(pidl, buffer)) { + res = buffer; + } + pMalloc->Free(pidl); + pMalloc->Release(); + } + } + return res; +} diff --git a/src/win32/Directories.h b/src/win32/Directories.h new file mode 100644 index 0000000..602b53e --- /dev/null +++ b/src/win32/Directories.h @@ -0,0 +1,83 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_DIRECTORIES_H__7ADB14C1_3C1B_4294_8D66_A4E87D6FC731__INCLUDED_) +#define AFX_DIRECTORIES_H__7ADB14C1_3C1B_4294_8D66_A4E87D6FC731__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Directories.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// Directories dialog + +class Directories : public CDialog +{ + // Construction + public: + CString initialFolderDir; + CString browseForDir(CString title); + Directories(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(Directories) + enum { IDD = IDD_DIRECTORIES }; + CEdit m_savePath; + CEdit m_romPath; + CEdit m_gbromPath; + CEdit m_capturePath; + CEdit m_batteryPath; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Directories) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(Directories) + virtual BOOL OnInitDialog(); + afx_msg void OnBatteryDir(); + afx_msg void OnBatteryDirReset(); + afx_msg void OnCaptureDir(); + afx_msg void OnCaptureDirReset(); + afx_msg void OnMoviesDir(); + afx_msg void OnMoviesDirReset(); + afx_msg void OnRomDir(); + afx_msg void OnRomDirReset(); + afx_msg void OnSaveDir(); + afx_msg void OnSaveDirReset(); + virtual void OnCancel(); + virtual void OnOK(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DIRECTORIES_H__7ADB14C1_3C1B_4294_8D66_A4E87D6FC731__INCLUDED_) diff --git a/src/win32/Disassemble.cpp b/src/win32/Disassemble.cpp new file mode 100644 index 0000000..fab2d53 --- /dev/null +++ b/src/win32/Disassemble.cpp @@ -0,0 +1,349 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Disassemble.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Disassemble.h" + +#include "../System.h" +#include "../armdis.h" +#include "../GBA.h" +#include "../Globals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int emulating; + +extern void CPUUpdateCPSR(); + + +///////////////////////////////////////////////////////////////////////////// +// Disassemble dialog + + +Disassemble::Disassemble(CWnd* pParent /*=NULL*/) + : ResizeDlg(Disassemble::IDD, pParent) +{ + //{{AFX_DATA_INIT(Disassemble) + m_c = FALSE; + m_f = FALSE; + m_i = FALSE; + m_n = FALSE; + m_t = FALSE; + m_v = FALSE; + m_z = FALSE; + mode = -1; + //}}AFX_DATA_INIT + mode = 0; + address = 0; + autoUpdate = false; + count = 1; +} + + +void Disassemble::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(Disassemble) + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Control(pDX, IDC_DISASSEMBLE, m_list); + DDX_Check(pDX, IDC_C, m_c); + DDX_Check(pDX, IDC_F, m_f); + DDX_Check(pDX, IDC_I, m_i); + DDX_Check(pDX, IDC_N, m_n); + DDX_Check(pDX, IDC_T, m_t); + DDX_Check(pDX, IDC_V, m_v); + DDX_Check(pDX, IDC_Z, m_z); + DDX_Radio(pDX, IDC_AUTOMATIC, mode); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(Disassemble, CDialog) + //{{AFX_MSG_MAP(Disassemble) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_AUTOMATIC, OnAutomatic) + ON_BN_CLICKED(IDC_ARM, OnArm) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_GO, OnGo) + ON_BN_CLICKED(IDC_GOPC, OnGopc) + ON_BN_CLICKED(IDC_NEXT, OnNext) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_THUMB, OnThumb) + ON_WM_VSCROLL() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Disassemble message handlers + +void Disassemble::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void Disassemble::OnAutomatic() +{ + mode = 0; + refresh(); +} + +void Disassemble::OnArm() +{ + mode = 1; + refresh(); +} + +void Disassemble::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +void Disassemble::OnGo() +{ + CString buffer; + m_address.GetWindowText(buffer); + sscanf(buffer, "%x", &address); + refresh(); +} + +void Disassemble::OnGopc() +{ + if(armState) + address = armNextPC - 16; + else + address = armNextPC - 8; + + refresh(); +} + +void Disassemble::OnNext() +{ + CPULoop(1); + if(armState) { + u32 total = address+count*4; + if(armNextPC >= address && armNextPC < total) { + } else { + OnGopc(); + } + } else { + u32 total = address+count*2; + if(armNextPC >= address && armNextPC < total) { + } else { + OnGopc(); + } + } + refresh(); +} + +void Disassemble::OnRefresh() +{ + refresh(); +} + +void Disassemble::OnThumb() +{ + mode = 2; + refresh(); +} + +BOOL Disassemble::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_DISASSEMBLE, DS_SizeY) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_NEXT, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_AUTO_UPDATE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_GOPC, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_VSCROLL, DS_SizeY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\DisassembleView", + NULL); + + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = 100; + si.nPos = 50; + si.nPage = 0; + GetDlgItem(IDC_VSCROLL)->SetScrollInfo(SB_CTL, &si, TRUE); + + CFont *font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)); + + m_list.SetFont(font, FALSE); + for(int i = 0; i < 17; i++) + GetDlgItem(IDC_R0+i)->SetFont(font, FALSE); + + GetDlgItem(IDC_MODE)->SetFont(font, FALSE); + + + m_address.LimitText(8); + refresh(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void Disassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + switch(nSBCode) { + case SB_LINEDOWN: + if(mode == 0) { + if(armState) + address += 4; + else + address += 2; + } else if(mode == 1) + address += 4; + else + address += 2; + break; + case SB_LINEUP: + if(mode == 0) { + if(armState) + address -= 4; + else + address -= 2; + } else if(mode == 1) + address -= 4; + else + address -= 2; + break; + case SB_PAGEDOWN: + if(mode == 0) { + if(armState) + address += count*4; + else + address += count*2; + } else if(mode == 1) + address += count*4; + else + address += count*2; + break; + case SB_PAGEUP: + if(mode == 0) { + if(armState) + address -= count*4; + else + address -= count*2; + } else if(mode == 1) + address -= count*4; + else + address -= count*2; + break; + } + refresh(); + + CDialog::OnVScroll(nSBCode, nPos, pScrollBar); +} + +void Disassemble::refresh() +{ + if(rom == NULL) + return; + + bool arm = armState; + + if(mode != 0) { + if(mode == 1) + arm = true; + else + arm = false; + } + + int h = m_list.GetItemHeight(0); + RECT r; + m_list.GetClientRect(&r); + count = (r.bottom - r.top+1)/h; + + m_list.ResetContent(); + if(!emulating && theApp.cartridgeType == 0) + return; + + char buffer[80]; + u32 addr = address; + int i; + int sel = -1; + for(i = 0; i < count; i++) { + if(addr == armNextPC) + sel = i; + if(arm) { + addr += disArm(addr, buffer, 3); + } else { + addr += disThumb(addr, buffer, 3); + } + m_list.InsertString(-1, buffer); + } + + if(sel != -1) + m_list.SetCurSel(sel); + + CPUUpdateCPSR(); + + for(i = 0; i < 17; i++) { + sprintf(buffer, "%08x", reg[i].I); + GetDlgItem(IDC_R0+i)->SetWindowText(buffer); + } + + m_n = (reg[16].I & 0x80000000) != 0; + m_z = (reg[16].I & 0x40000000) != 0; + m_c = (reg[16].I & 0x20000000) != 0; + m_v = (reg[16].I & 0x10000000) != 0; + m_i = (reg[16].I & 0x80) != 0; + m_f = (reg[16].I & 0x40) != 0; + m_t = (reg[16].I & 0x20) != 0; + + UpdateData(FALSE); + + int v = reg[16].I & 0x1f; + sprintf(buffer, "%02x", v); + GetDlgItem(IDC_MODE)->SetWindowText(buffer); +} + +void Disassemble::update() +{ + OnGopc(); + refresh(); +} + +void Disassemble::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/Disassemble.h b/src/win32/Disassemble.h new file mode 100644 index 0000000..259538d --- /dev/null +++ b/src/win32/Disassemble.h @@ -0,0 +1,94 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_DISASSEMBLE_H__CA10E857_7D76_4B19_A62B_D0677040FD0F__INCLUDED_) +#define AFX_DISASSEMBLE_H__CA10E857_7D76_4B19_A62B_D0677040FD0F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Disassemble.h : header file +// + +#include "IUpdate.h" +#include "ResizeDlg.h" +#include "../System.h" // Added by ClassView + +///////////////////////////////////////////////////////////////////////////// +// Disassemble dialog + +class Disassemble : public ResizeDlg, IUpdateListener +{ + // Construction + public: + virtual void update(); + void refresh(); + int count; + bool autoUpdate; + u32 address; + Disassemble(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(Disassemble) + enum { IDD = IDD_DISASSEMBLE }; + CEdit m_address; + CListBox m_list; + BOOL m_c; + BOOL m_f; + BOOL m_i; + BOOL m_n; + BOOL m_t; + BOOL m_v; + BOOL m_z; + int mode; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Disassemble) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(Disassemble) + afx_msg void OnAutoUpdate(); + afx_msg void OnAutomatic(); + afx_msg void OnArm(); + afx_msg void OnClose(); + afx_msg void OnGo(); + afx_msg void OnGopc(); + afx_msg void OnNext(); + afx_msg void OnRefresh(); + afx_msg void OnThumb(); + virtual BOOL OnInitDialog(); + afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DISASSEMBLE_H__CA10E857_7D76_4B19_A62B_D0677040FD0F__INCLUDED_) diff --git a/src/win32/Display.h b/src/win32/Display.h new file mode 100644 index 0000000..c2cba0b --- /dev/null +++ b/src/win32/Display.h @@ -0,0 +1,44 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +enum DISPLAY_TYPE { + GDI = 0, + DIRECT_DRAW = 1, + DIRECT_3D = 2, + OPENGL = 3 +}; + +class IDisplay { + public: + IDisplay() {}; + virtual ~IDisplay() {}; + + virtual bool initialize() = 0; + virtual void cleanup() = 0; + virtual void render() = 0; + virtual void checkFullScreen() { }; + virtual void renderMenu() { }; + virtual void clear()=0; + virtual bool changeRenderSize(int w, int h) { return true; }; + virtual void resize(int w, int h) {}; + virtual void setOption(const char *option, int value) = 0; + virtual DISPLAY_TYPE getType() = 0; + virtual bool isSkinSupported() { return false; } + virtual int selectFullScreenMode(GUID **) = 0; +}; diff --git a/src/win32/ExportGSASnapshot.cpp b/src/win32/ExportGSASnapshot.cpp new file mode 100644 index 0000000..c6143d4 --- /dev/null +++ b/src/win32/ExportGSASnapshot.cpp @@ -0,0 +1,117 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// ExportGSASnapshot.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "ExportGSASnapshot.h" + +#include "../GBA.h" +#include "../NLS.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// ExportGSASnapshot dialog + + +ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pParent /*=NULL*/) + : CDialog(ExportGSASnapshot::IDD, pParent) +{ + //{{AFX_DATA_INIT(ExportGSASnapshot) + m_desc = _T(""); + m_notes = _T(""); + m_title = _T(""); + //}}AFX_DATA_INIT + m_title = title; + m_filename = filename; + char date[100]; + char time[100]; + + GetDateFormat(LOCALE_USER_DEFAULT, + DATE_SHORTDATE, + NULL, + NULL, + date, + 100); + GetTimeFormat(LOCALE_USER_DEFAULT, + 0, + NULL, + NULL, + time, + 100); + m_desc.Format("%s %s", date, time); +} + + +void ExportGSASnapshot::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(ExportGSASnapshot) + DDX_Text(pDX, IDC_DESC, m_desc); + DDV_MaxChars(pDX, m_desc, 100); + DDX_Text(pDX, IDC_NOTES, m_notes); + DDV_MaxChars(pDX, m_notes, 512); + DDX_Text(pDX, IDC_TITLE, m_title); + DDV_MaxChars(pDX, m_title, 100); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog) + //{{AFX_MSG_MAP(ExportGSASnapshot) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// ExportGSASnapshot message handlers + +BOOL ExportGSASnapshot::OnInitDialog() +{ + CDialog::OnInitDialog(); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void ExportGSASnapshot::OnCancel() +{ + EndDialog(FALSE); +} + +void ExportGSASnapshot::OnOk() +{ + UpdateData(TRUE); + + bool result = CPUWriteGSASnapshot(m_filename, m_title, m_desc, m_notes); + + if(!result) + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", + m_filename); + + EndDialog(TRUE); +} diff --git a/src/win32/ExportGSASnapshot.h b/src/win32/ExportGSASnapshot.h new file mode 100644 index 0000000..390908f --- /dev/null +++ b/src/win32/ExportGSASnapshot.h @@ -0,0 +1,70 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_EXPORTGSASNAPSHOT_H__ADF8566A_C64D_43CF_9CD2_A290370BA4F1__INCLUDED_) +#define AFX_EXPORTGSASNAPSHOT_H__ADF8566A_C64D_43CF_9CD2_A290370BA4F1__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ExportGSASnapshot.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// ExportGSASnapshot dialog + +class ExportGSASnapshot : public CDialog +{ + // Construction + public: + ExportGSASnapshot(CString filename, CString title,CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(ExportGSASnapshot) + enum { IDD = IDD_EXPORT_SPS }; + CString m_desc; + CString m_notes; + CString m_title; + //}}AFX_DATA + CString m_filename; + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ExportGSASnapshot) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(ExportGSASnapshot) + virtual BOOL OnInitDialog(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_EXPORTGSASNAPSHOT_H__ADF8566A_C64D_43CF_9CD2_A290370BA4F1__INCLUDED_) diff --git a/src/win32/FileDlg.cpp b/src/win32/FileDlg.cpp new file mode 100644 index 0000000..62fcab4 --- /dev/null +++ b/src/win32/FileDlg.cpp @@ -0,0 +1,200 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// FileDlg.cpp: implementation of the FileDlg class. +// +////////////////////////////////////////////////////////////////////// +#define WINVER 0x0410 // windows 98 - just for this 1 file - just in case +#include "stdafx.h" +#include +#include + +#include "VBA.h" +#include "FileDlg.h" +#include "../System.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +static FileDlg *instance = NULL; + +static UINT_PTR CALLBACK HookFunc(HWND hwnd, + UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + if(instance) { + if(msg == WM_NOTIFY) { + OFNOTIFY *notify = (OFNOTIFY *)lParam; + if(notify) { + if(notify->hdr.code == CDN_TYPECHANGE) { + instance->OnTypeChange(hwnd); + return 1; + } + } + } + } + return 0; +} + +static UINT_PTR CALLBACK HookFuncOldStyle(HWND hwnd, + UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + if(instance) { + if(msg == WM_COMMAND) { + if(HIWORD(wParam) == CBN_SELCHANGE) { + if(LOWORD(wParam) == cmb1) { + // call method with combobox handle to keep + // behaviour there + instance->OnTypeChange((HWND)lParam); + return 1; + } + } + } + } + return 0; +} + +///////////////////////////////////////////////////////////////////////////// +// FileDlg + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +FileDlg::FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, + int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, + LPCTSTR title, bool save, bool noReadOnly) +{ + OSVERSIONINFO info; + info.dwOSVersionInfoSize = sizeof(info); + GetVersionEx(&info); + m_file = file; + int size = sizeof(OPENFILENAME); + + // avoid problems if OPENFILENAME is already defined with the extended fields + // needed for the enhanced open/save dialog +#if _WIN32_WINNT < 0x0500 + if(info.dwPlatformId == VER_PLATFORM_WIN32_NT) { + if(info.dwMajorVersion >= 5) + size = sizeof(OPENFILENAMEEX); + } +#endif + + ZeroMemory(&m_ofn, sizeof(m_ofn)); + m_ofn.lpstrFile = m_file.GetBuffer(MAX_PATH); + m_ofn.nMaxFile = MAX_PATH; + m_ofn.lStructSize = size; + m_ofn.hwndOwner = parent ? parent->GetSafeHwnd() : NULL; + m_ofn.nFilterIndex = filterIndex; + m_ofn.lpstrInitialDir = initialDir; + m_ofn.lpstrTitle = title; + m_ofn.lpstrDefExt = ext; + m_ofn.lpfnHook = HookFunc; + m_ofn.Flags = OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_ENABLEHOOK; + m_ofn.Flags |= OFN_EXPLORER; + if(noReadOnly) + m_ofn.Flags |= OFN_HIDEREADONLY; + m_filter = filter; + + char *p = m_filter.GetBuffer(0); + + while ((p = strchr(p, '|')) != NULL) + *p++ = 0; + m_ofn.lpstrFilter = m_filter; + + if(theApp.videoOption == VIDEO_320x240) { + m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_OPENDLG); + m_ofn.lpfnHook = HookFuncOldStyle; + m_ofn.Flags |= OFN_ENABLETEMPLATE; + m_ofn.Flags &= ~OFN_EXPLORER; + } + + isSave = save; + extensions = exts; + + instance = this; +} + +FileDlg::~FileDlg() +{ + instance = NULL; +} + +void FileDlg::OnTypeChange(HWND hwnd) +{ + HWND parent = GetParent(hwnd); + + HWND fileNameControl = ::GetDlgItem(parent, cmb13); + + if(fileNameControl == NULL) + fileNameControl = ::GetDlgItem(parent, edt1); + + if(fileNameControl == NULL) + return; + + CString filename; + GetWindowText(fileNameControl, filename.GetBuffer(MAX_PATH), MAX_PATH); + filename.ReleaseBuffer(); + + HWND typeControl = ::GetDlgItem(parent, cmb1); + + ASSERT(typeControl != NULL); + + int sel = ::SendMessage(typeControl, CB_GETCURSEL, 0, 0); + + ASSERT(sel != -1); + + LPCTSTR typeName = extensions[sel]; + + if(filename.GetLength() == 0) { + filename.Format("*%s", typeName); + } else { + int index = filename.Find('.'); + if (index == -1) { + filename = filename + typeName; + } else { + filename = filename.Left(index) + typeName; + } + } + SetWindowText(fileNameControl, filename); +} + +int FileDlg::getFilterIndex() +{ + return m_ofn.nFilterIndex; +} + +int FileDlg::DoModal() +{ + BOOL res = isSave ? GetSaveFileName(&m_ofn) : + GetOpenFileName(&m_ofn); + + return res ? IDOK : IDCANCEL; +} + +LPCTSTR FileDlg::GetPathName() +{ + return (LPCTSTR)m_file; +} diff --git a/src/win32/FileDlg.h b/src/win32/FileDlg.h new file mode 100644 index 0000000..e1c45e0 --- /dev/null +++ b/src/win32/FileDlg.h @@ -0,0 +1,66 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// FileDlg.h: interface for the FileDlg class. +// +////////////////////////////////////////////////////////////////////// +#if !defined(AFX_FILEDLG_H__7E4F8B92_1B63_4126_8261_D9334C645940__INCLUDED_) +#define AFX_FILEDLG_H__7E4F8B92_1B63_4126_8261_D9334C645940__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// FileDlg.h : header file +// + +struct OPENFILENAMEEX : public OPENFILENAME { + void * pvReserved; + DWORD dwReserved; + DWORD FlagsEx; +}; + +///////////////////////////////////////////////////////////////////////////// +// FileDlg dialog + +class FileDlg +{ + private: + CString m_file; + CString m_filter; + public: + OPENFILENAMEEX m_ofn; + int DoModal(); + LPCTSTR GetPathName(); + virtual int getFilterIndex(); + virtual void OnTypeChange(HWND hwnd); + FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, + int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, + LPCTSTR title, bool save, bool noReadOnly=false); + virtual ~FileDlg(); + + protected: + bool isSave; + LPCTSTR *extensions; + + protected: + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. +}; + +#endif // !defined(AFX_FILEDLG_H__7E4F8B92_1B63_4126_8261_D9334C645940__INCLUDED_) diff --git a/src/win32/GBACheats.cpp b/src/win32/GBACheats.cpp new file mode 100644 index 0000000..2d6cab9 --- /dev/null +++ b/src/win32/GBACheats.cpp @@ -0,0 +1,1247 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBACheats.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GBACheats.h" + +#include "../System.h" +#include "../Cheats.h" +#include "../CheatSearch.h" +#include "../GBA.h" +#include "../Globals.h" + +#include "Reg.h" +#include "StringTokenizer.h" +#include "WinResUtil.h" +#include ".\gbacheats.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBACheatSearch dialog + +GBACheatSearch::GBACheatSearch(CWnd* pParent /*=NULL*/) + : CDialog(GBACheatSearch::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBACheatSearch) + valueType = -1; + sizeType = -1; + searchType = -1; + numberType = -1; + updateValues = FALSE; + //}}AFX_DATA_INIT + data = NULL; +} + +GBACheatSearch::~GBACheatSearch() +{ + if(data) + free(data); +} + +void GBACheatSearch::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBACheatSearch) + DDX_Control(pDX, IDC_VALUE, m_value); + DDX_Control(pDX, IDC_CHEAT_LIST, m_list); + DDX_Radio(pDX, IDC_OLD_VALUE, valueType); + DDX_Radio(pDX, IDC_SIZE_8, sizeType); + DDX_Radio(pDX, IDC_EQ, searchType); + DDX_Radio(pDX, IDC_SIGNED, numberType); + DDX_Check(pDX, IDC_UPDATE, updateValues); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBACheatSearch, CDialog) + //{{AFX_MSG_MAP(GBACheatSearch) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(IDC_START, OnStart) + ON_BN_CLICKED(IDC_SEARCH, OnSearch) + ON_BN_CLICKED(IDC_ADD_CHEAT, OnAddCheat) + ON_BN_CLICKED(IDC_UPDATE, OnUpdate) + ON_NOTIFY(LVN_GETDISPINFO, IDC_CHEAT_LIST, OnGetdispinfoCheatList) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_CHEAT_LIST, OnItemchangedCheatList) + ON_CONTROL_RANGE(BN_CLICKED, IDC_OLD_VALUE, IDC_SPECIFIC_VALUE, OnValueType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_EQ, IDC_GE, OnSearchType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIGNED, IDC_HEXADECIMAL, OnNumberType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIZE_8, IDC_SIZE_32, OnSizeType) + //}}AFX_MSG_MAP +ON_WM_CLOSE() +ON_BN_CLICKED(IDC_CHEATREFRESHBUTTON, OnBnClickedCheatrefreshbutton) +//ON_WM_DESTROY() +//ON_WM_NCDESTROY() +//ON_WM_SYSCOMMAND() +//ON_WM_ACTIVATE() +END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBACheatSearch message handlers + +void GBACheatSearch::OnOk() +{ + if(theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = false; + DestroyWindow(); + } + else + { + EndDialog(TRUE); + } +} + +void GBACheatSearch::OnClose() +{ + CDialog::OnClose(); + if(theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = false; + DestroyWindow(); + } + else + { + EndDialog(FALSE); + } +} + +void GBACheatSearch::OnStart() +{ + if(cheatSearchData.count == 0) { + CheatSearchBlock *block = &cheatSearchData.blocks[0]; + block->size = 0x40000; + block->offset = 0x2000000; + block->bits = (u8 *)malloc(0x40000>>3); + block->data = workRAM; + block->saved = (u8 *)malloc(0x40000); + + block = &cheatSearchData.blocks[1]; + block->size = 0x8000; + block->offset = 0x3000000; + block->bits = (u8 *)malloc(0x8000>>3); + block->data = internalRAM; + block->saved = (u8 *)malloc(0x8000); + + cheatSearchData.count = 2; + } + + cheatSearchStart(&cheatSearchData); + GetDlgItem(IDC_SEARCH)->EnableWindow(TRUE); + + if(theApp.modelessCheatDialogIsOpen) + { + GetDlgItem(IDC_CHEATREFRESHBUTTON)->ShowWindow(TRUE); + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(FALSE); + } +} + +static void dlgSystemMessage(CWnd * hWnd, int number, const char *defaultMsg, ...) +{ + CString buffer; + va_list valist; + CString msg = defaultMsg; + if(number) + msg = winResLoadString(number); + + va_start(valist, defaultMsg); + buffer.FormatV(msg, valist); + + theApp.winCheckFullscreen(); + + hWnd->MessageBox(buffer, winResLoadString(IDS_ERROR), MB_OK|MB_ICONERROR); + + va_end(valist); +} + +void GBACheatSearch::OnSearch() +{ + CString buffer; + + if(valueType == 0) + cheatSearch(&cheatSearchData, + searchType, + sizeType, + numberType == 0); + else { + m_value.GetWindowText(buffer); + if(buffer.IsEmpty()) { + dlgSystemMessage(this, IDS_NUMBER_CANNOT_BE_EMPTY, "Number cannot be empty"); + return; + } + int value = 0; + switch(numberType) { + case 0: + sscanf(buffer, "%d", &value); + break; + case 1: + sscanf(buffer, "%u", &value); + break; + default: + sscanf(buffer, "%x", &value); + } + cheatSearchValue(&cheatSearchData, + searchType, + sizeType, + numberType == 0, + value); + } + + addChanges(true); + + if(updateValues) + cheatSearchUpdateValues(&cheatSearchData); + + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(cheatSearchGetCount(&cheatSearchData, sizeType) == 0 ? FALSE : TRUE); + + if(0 == cheatSearchGetCount(&cheatSearchData, sizeType)) + OnStart(); +} + +void GBACheatSearch::OnAddCheat() +{ + int mark = m_list.GetSelectionMark(); + + if(mark != -1) { + LVITEM item; + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM; + item.iItem = mark; + if(m_list.GetItem(&item)) { + AddCheat dlg((u32)item.lParam); + dlg.DoModal(); + } + } +} + +void GBACheatSearch::OnUpdate() +{ + if(GetDlgItem(IDC_UPDATE)->SendMessage(BM_GETCHECK, + 0, + 0) & BST_CHECKED) + updateValues = true; + else + updateValues = false; + regSetDwordValue("cheatsUpdate", updateValues); +} + +void GBACheatSearch::OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + LV_DISPINFO* info = (LV_DISPINFO*)pNMHDR; + if(info->item.mask & LVIF_TEXT) { + int index = info->item.iItem; + int col = info->item.iSubItem; + + switch(col) { + case 0: + strcpy(info->item.pszText, data[index].address); + break; + case 1: + strcpy(info->item.pszText, data[index].oldValue); + break; + case 2: + strcpy(info->item.pszText, data[index].newValue); + break; + } + } + *pResult = TRUE; + +} + +void GBACheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(m_list.GetSelectionMark() != -1); + *pResult = TRUE; +} + +BOOL GBACheatSearch::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString temp = winResLoadString(IDS_ADDRESS); + + m_list.InsertColumn(0, temp, LVCFMT_CENTER, 125, 0); + + temp = winResLoadString(IDS_OLD_VALUE); + m_list.InsertColumn(1, temp, LVCFMT_CENTER, 125, 1); + + temp = winResLoadString(IDS_NEW_VALUE); + m_list.InsertColumn(2, temp, LVCFMT_CENTER, 125, 2); + + m_list.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)), + TRUE); + + m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT); + + if(!cheatSearchData.count) { + GetDlgItem(IDC_SEARCH)->EnableWindow(FALSE); + GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(FALSE); + } + + valueType = regQueryDwordValue("cheatsValueType", 0); + if(valueType < 0 || valueType > 1) + valueType = 0; + + searchType = regQueryDwordValue("cheatsSearchType", SEARCH_EQ); + if(searchType > 5 || searchType < 0) + searchType = 0; + + numberType = regQueryDwordValue("cheatsNumberType", 2); + if(numberType < 0 || numberType > 2) + numberType = 2; + + sizeType = regQueryDwordValue("cheatsSizeType", 0); + if(sizeType < 0 || sizeType > 2) + sizeType = 0; + + updateValues = regQueryDwordValue("cheatsUpdate", 0) ? + true : false; + + UpdateData(FALSE); + + if(valueType == 0) + m_value.EnableWindow(FALSE); + CenterWindow(); + + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->ShowWindow(TRUE); + + if(cheatSearchData.count) + { + addChanges(false); + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(cheatSearchGetCount(&cheatSearchData, sizeType) == 0 ? FALSE : TRUE); + } + else + { + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(FALSE); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBACheatSearch::addChanges(bool showMsgs) +{ + int count = cheatSearchGetCount(&cheatSearchData, sizeType); + + m_list.DeleteAllItems(); + + if(count > 4000) { + if(showMsgs) + dlgSystemMessage(this, IDS_SEARCH_PRODUCED_TOO_MANY, + "Search produced %d results.\nThey have been remembered, but are too many to display.\nPlease refine it better by performing additional searches.", + count); + return; + } + + if(count == 0) { + if(showMsgs) + dlgSystemMessage(this, IDS_SEARCH_PRODUCED_NO_RESULTS, + "Search produced no results."); + return; + } + + m_list.SetItemCount(count); + if(data) + free(data); + + data = (WinCheatsData *)calloc(count,sizeof(WinCheatsData)); + + int inc = 1; + switch(sizeType) { + case 1: + inc = 2; + break; + case 2: + inc = 4; + break; + } + + int index = 0; + if(numberType == 0) { + for(int i = 0; i < cheatSearchData.count; i++) { + CheatSearchBlock *block = &cheatSearchData.blocks[i]; + + for(int j = 0; j < block->size; j+= inc) { + if(IS_BIT_SET(block->bits, j)) { + addChange(index++, + block->offset | j, + cheatSearchSignedRead(block->saved, + j, + sizeType), + cheatSearchSignedRead(block->data, + j, + sizeType)); + } + } + } + } else { + for(int i = 0; i < cheatSearchData.count; i++) { + CheatSearchBlock *block = &cheatSearchData.blocks[i]; + + for(int j = 0; j < block->size; j+= inc) { + if(IS_BIT_SET(block->bits, j)) { + addChange(index++, + block->offset | j, + cheatSearchRead(block->saved, + j, + sizeType), + cheatSearchRead(block->data, + j, + sizeType)); + } + } + } + } + + for(int i = 0; i < count; i++) { + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + item.iItem = i; + item.iSubItem = 0; + item.lParam = data[i].addr; + item.state = 0; + item.stateMask = 0; + item.pszText = LPSTR_TEXTCALLBACK; + m_list.InsertItem(&item); + + m_list.SetItemText(i, 1, LPSTR_TEXTCALLBACK); + m_list.SetItemText(i, 2, LPSTR_TEXTCALLBACK); + } +} + +void GBACheatSearch::addChange(int index, u32 address, u32 oldValue, u32 newValue) +{ + data[index].addr = address; + sprintf(data[index].address, "%08x",address); + switch(numberType) { + case 0: + sprintf(data[index].oldValue, "%d", oldValue); + sprintf(data[index].newValue, "%d", newValue); + break; + case 1: + sprintf(data[index].oldValue, "%u", oldValue); + sprintf(data[index].newValue, "%u", newValue); + break; + case 2: + switch(sizeType) { + case 0: + sprintf(data[index].oldValue, "%02x", oldValue); + sprintf(data[index].newValue, "%02x", newValue); + break; + case 1: + sprintf(data[index].oldValue, "%04x", oldValue); + sprintf(data[index].newValue, "%04x", newValue); + break; + case 2: + sprintf(data[index].oldValue, "%08x", oldValue); + sprintf(data[index].newValue, "%08x", newValue); + break; + } + } +} + +void GBACheatSearch::OnValueType(UINT id) +{ + switch(id) { + case IDC_OLD_VALUE: + valueType = 0; + m_value.EnableWindow(FALSE); + regSetDwordValue("cheatsValueType", 0); + break; + case IDC_SPECIFIC_VALUE: + valueType = 1; + m_value.EnableWindow(TRUE); + regSetDwordValue("cheatsValueType", 1); + break; + } +} + +void GBACheatSearch::OnSearchType(UINT id) +{ + switch(id) { + case IDC_EQ: + searchType = SEARCH_EQ; + regSetDwordValue("cheatsSearchType", 0); + break; + case IDC_NE: + searchType = SEARCH_NE; + regSetDwordValue("cheatsSearchType", 1); + break; + case IDC_LT: + searchType = SEARCH_LT; + regSetDwordValue("cheatsSearchType", 2); + break; + case IDC_LE: + searchType = SEARCH_LE; + regSetDwordValue("cheatsSearchType", 3); + break; + case IDC_GT: + searchType = SEARCH_GT; + regSetDwordValue("cheatsSearchType", 4); + break; + case IDC_GE: + searchType = SEARCH_GE; + regSetDwordValue("cheatsSearchType", 5); + break; + } +} + +void GBACheatSearch::OnNumberType(UINT id) +{ + switch(id) { + case IDC_SIGNED: + numberType = 0; + regSetDwordValue("cheatsNumberType", 0); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_UNSIGNED: + numberType = 1; + regSetDwordValue("cheatsNumberType", 1); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_HEXADECIMAL: + numberType = 2; + regSetDwordValue("cheatsNumberType", 2); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + } +} + +void GBACheatSearch::OnSizeType(UINT id) +{ + switch(id) { + case IDC_SIZE_8: + sizeType = BITS_8; + regSetDwordValue("cheatsSizeType", 0); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_SIZE_16: + sizeType = BITS_16; + regSetDwordValue("cheatsSizeType", 1); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_SIZE_32: + sizeType = BITS_32; + regSetDwordValue("cheatsSizeType", 2); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + } +} +///////////////////////////////////////////////////////////////////////////// +// AddCheat dialog + + +AddCheat::AddCheat(u32 address, CWnd* pParent /*=NULL*/) + : CDialog(AddCheat::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddCheat) + sizeType = -1; + numberType = -1; + //}}AFX_DATA_INIT + this->address = address; +} + + +void AddCheat::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddCheat) + DDX_Control(pDX, IDC_VALUE, m_value); + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Radio(pDX, IDC_SIZE_8, sizeType); + DDX_Radio(pDX, IDC_SIGNED, numberType); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddCheat, CDialog) + //{{AFX_MSG_MAP(AddCheat) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIGNED, IDC_HEXADECIMAL, OnNumberType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIZE_8, IDC_SIZE_32, OnSizeType) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddCheat message handlers + +void AddCheat::OnOk() +{ + // add cheat + if(addCheat()) { + EndDialog(TRUE); + } +} + +void AddCheat::OnCancel() +{ + EndDialog(FALSE); +} + +BOOL AddCheat::OnInitDialog() +{ + CDialog::OnInitDialog(); + + if(address != 0) { + CString buffer; + buffer.Format("%08x", address); + m_address.SetWindowText(buffer); + m_address.EnableWindow(FALSE); + } + + numberType = regQueryDwordValue("cheatsNumberType", 2); + if(numberType < 0 || numberType > 2) + numberType = 2; + + sizeType = regQueryDwordValue("cheatsSizeType", 0); + if(sizeType < 0 || sizeType > 2) + sizeType = 0; + + UpdateData(FALSE); + + GetDlgItem(IDC_DESC)->SendMessage(EM_LIMITTEXT, + 32, + 0); + if(address != 0) { + GetDlgItem(IDC_SIZE_8)->EnableWindow(FALSE); + GetDlgItem(IDC_SIZE_16)->EnableWindow(FALSE); + GetDlgItem(IDC_SIZE_32)->EnableWindow(FALSE); + GetDlgItem(IDC_HEXADECIMAL)->EnableWindow(FALSE); + GetDlgItem(IDC_UNSIGNED)->EnableWindow(FALSE); + GetDlgItem(IDC_SIGNED)->EnableWindow(FALSE); + } + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void AddCheat::OnNumberType(UINT id) +{ + switch(id) { + case IDC_SIGNED: + numberType = 0; + regSetDwordValue("cheatsNumberType", 0); + break; + case IDC_UNSIGNED: + numberType = 1; + regSetDwordValue("cheatsNumberType", 1); + break; + case IDC_HEXADECIMAL: + numberType = 2; + regSetDwordValue("cheatsNumberType", 2); + break; + } +} + +void AddCheat::OnSizeType(UINT id) +{ + switch(id) { + case IDC_SIZE_8: + sizeType = BITS_8; + regSetDwordValue("cheatsSizeType", 0); + break; + case IDC_SIZE_16: + sizeType = BITS_16; + regSetDwordValue("cheatsSizeType", 1); + break; + case IDC_SIZE_32: + sizeType = BITS_32; + regSetDwordValue("cheatsSizeType", 2); + break; + } +} + +bool AddCheat::addCheat() +{ + CString buffer; + CString code; + + m_address.GetWindowText(buffer); + u32 address = 0; + sscanf(buffer, "%x", &address); + if((address >= 0x02000000 && address < 0x02040000) || + (address >= 0x03000000 && address < 0x03008000)) { + } else { + dlgSystemMessage(this, IDS_INVALID_ADDRESS, "Invalid address: %08x", address); + return false; + } + if(sizeType != 0) { + if(sizeType == 1 && address & 1) { + dlgSystemMessage(this, IDS_MISALIGNED_HALFWORD, + "Misaligned half-word address: %08x", address); + return false; + } + if(sizeType == 2 && address & 3) { + dlgSystemMessage(this, IDS_MISALIGNED_WORD, + "Misaligned word address: %08x", address); + return false; + } + } + u32 value; + m_value.GetWindowText(buffer); + + if(buffer.IsEmpty()) { + dlgSystemMessage(this, IDS_VALUE_CANNOT_BE_EMPTY, "Value cannot be empty"); + return false; + } + + switch(numberType) { + case 0: + sscanf(buffer, "%d", &value); + break; + case 1: + sscanf(buffer, "%u", &value); + break; + default: + sscanf(buffer, "%x", &value); + } + + m_desc.GetWindowText(buffer); + + switch(sizeType) { + case 0: + code.Format("%08x:%02x", address, value); + break; + case 1: + code.Format("%08x:%04x", address, value); + break; + case 2: + code.Format("%08x:%08x", address, value); + break; + } + + cheatsAdd(code, buffer,address, value,-1, sizeType); + return true; +} +///////////////////////////////////////////////////////////////////////////// +// GBACheatList dialog + + +GBACheatList::GBACheatList(CWnd* pParent /*=NULL*/) + : CDialog(GBACheatList::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBACheatList) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + duringRefresh = false; +} + + +void GBACheatList::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBACheatList) + DDX_Control(pDX, IDC_RESTORE, m_restore); + DDX_Control(pDX, IDC_CHEAT_LIST, m_list); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBACheatList, CDialog) + //{{AFX_MSG_MAP(GBACheatList) + ON_BN_CLICKED(IDC_ADD_CHEAT, OnAddCheat) + ON_BN_CLICKED(IDC_ADD_CODE, OnAddCode) + ON_BN_CLICKED(IDC_ADD_CODEBREAKER, OnAddCodebreaker) + ON_BN_CLICKED(IDC_ADD_GAMESHARK, OnAddGameshark) + ON_BN_CLICKED(IDC_ENABLE, OnEnable) + ON_BN_CLICKED(IDC_REMOVE, OnRemove) + ON_BN_CLICKED(IDC_REMOVE_ALL, OnRemoveAll) + ON_BN_CLICKED(IDC_RESTORE, OnRestore) + ON_BN_CLICKED(ID_OK, OnOk) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_CHEAT_LIST, OnItemchangedCheatList) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBACheatList message handlers + +void GBACheatList::OnAddCheat() +{ + AddCheat dlg(0); + dlg.DoModal(); + refresh(); +} + +void GBACheatList::OnAddCode() +{ + AddCheatCode dlg; + dlg.DoModal(); + refresh(); +} + +void GBACheatList::OnAddCodebreaker() +{ + AddCBACode dlg; + dlg.DoModal(); + refresh(); +} + +void GBACheatList::OnAddGameshark() +{ + AddGSACode dlg; + dlg.DoModal(); + refresh(); +} + +void GBACheatList::OnEnable() +{ + int mark = m_list.GetSelectionMark(); + int count = m_list.GetItemCount(); + + if(mark != -1) { + LVITEM item; + for(int i = 0; i < count; i++) { + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM|LVIF_STATE; + item.stateMask = LVIS_SELECTED; + item.iItem = i; + if(m_list.GetItem(&item)) { + if(item.state & LVIS_SELECTED) { + if(cheatsList[item.lParam].enabled) + cheatsDisable(item.lParam); + else + cheatsEnable(item.lParam); + } + } + } + refresh(); + } +} + +void GBACheatList::OnRemove() +{ + int mark = m_list.GetSelectionMark(); + int count = m_list.GetItemCount(); + + if(mark != -1) { + for(int i = count - 1; i >= 0; i--) { + LVITEM item; + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM|LVIF_STATE; + item.iItem = i; + item.stateMask = LVIS_SELECTED; + if(m_list.GetItem(&item)) { + if(item.state & LVIS_SELECTED) { + cheatsDelete(item.lParam, restoreValues); + } + } + } + refresh(); + } +} + +void GBACheatList::OnRemoveAll() +{ + cheatsDeleteAll(restoreValues); + refresh(); +} + + +void GBACheatList::OnRestore() +{ + restoreValues = !restoreValues; + regSetDwordValue("cheatsRestore", restoreValues); +} + +void GBACheatList::OnOk() +{ + EndDialog(TRUE); +} + +void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + if(m_list.GetSelectionMark() != -1) { + GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); + GetDlgItem(IDC_ENABLE)->EnableWindow(TRUE); + } else { + GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); + GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); + } + + if(!duringRefresh) { + LPNMLISTVIEW l = (LPNMLISTVIEW)pNMHDR; + if(l->uChanged & LVIF_STATE) { + if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) != + (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { + if(m_list.GetCheck(l->iItem)) + cheatsEnable(l->lParam); + else + cheatsDisable(l->lParam); + refresh(); + } + } + } + + *pResult = 0; +} + +BOOL GBACheatList::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString temp = winResLoadString(IDS_CODE); + m_list.InsertColumn(0, temp, LVCFMT_LEFT, 170, 0); + temp = winResLoadString(IDS_DESCRIPTION); + m_list.InsertColumn(1, temp, LVCFMT_LEFT, 150, 1); + temp = winResLoadString(IDS_STATUS); + m_list.InsertColumn(2, temp, LVCFMT_LEFT, 80, 1); + + m_list.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)), + TRUE); + + m_list.SetExtendedStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); + + restoreValues = regQueryDwordValue("cheatsRestore", 0) ? + true : false; + + m_restore.SetCheck(restoreValues); + + refresh(); + GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); + GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBACheatList::refresh() +{ + duringRefresh = true; + m_list.DeleteAllItems(); + + CString buffer; + + for(int i = 0; i < cheatsNumber; i++) { + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + item.iItem = i; + item.iSubItem = 0; + item.lParam = i; + item.state = 0; + item.stateMask = 0; + item.pszText = cheatsList[i].codestring; + m_list.InsertItem(&item); + + m_list.SetCheck(i, (cheatsList[i].enabled) ? TRUE : FALSE); + + m_list.SetItemText(i, 1, cheatsList[i].desc); + + buffer = (cheatsList[i].enabled) ? 'E' : 'D'; + m_list.SetItemText(i, 2, buffer); + } + duringRefresh = false; +} +///////////////////////////////////////////////////////////////////////////// +// AddGSACode dialog + + +AddGSACode::AddGSACode(CWnd* pParent /*=NULL*/) + : CDialog(AddGSACode::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddGSACode) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void AddGSACode::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddGSACode) + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Control(pDX, IDC_CODE, m_code); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddGSACode, CDialog) + //{{AFX_MSG_MAP(AddGSACode) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddGSACode message handlers + +void AddGSACode::OnOk() +{ + CString desc; + CString buffer; + CString part1; + CString code; + CString token; + + m_code.GetWindowText(buffer); + m_desc.GetWindowText(desc); + + StringTokenizer st(buffer, " \t\n\r"); + part1.Empty(); + const char *t = st.next(); + while(t) { + token = t; + token.MakeUpper(); + if(token.GetLength() == 16) + cheatsAddGSACode(token, desc, false); + else if(token.GetLength() == 12) { + code = token.Left(8); + code += " "; + code += token.Right(4); + cheatsAddCBACode(code, desc); + } else if(part1.IsEmpty()) + part1 = token; + else { + if(token.GetLength() == 4) { + code = part1; + code += " "; + code += token; + cheatsAddCBACode(code, desc); + } else { + code = part1 + token; + cheatsAddGSACode(code, desc, true); + } + part1.Empty(); + } + + t = st.next(); + } + EndDialog(TRUE); +} + +void AddGSACode::OnCancel() +{ + EndDialog(FALSE); +} + +BOOL AddGSACode::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_code.LimitText(1024); + m_desc.LimitText(32); + CString title = winResLoadString(IDS_ADD_GSA_CODE); + SetWindowText(title); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +///////////////////////////////////////////////////////////////////////////// +// AddCBACode dialog + + +AddCBACode::AddCBACode(CWnd* pParent /*=NULL*/) + : CDialog(AddCBACode::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddCBACode) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void AddCBACode::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddCBACode) + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Control(pDX, IDC_CODE, m_code); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddCBACode, CDialog) + //{{AFX_MSG_MAP(AddCBACode) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddCBACode message handlers + +void AddCBACode::OnOk() +{ + CString desc; + CString buffer; + CString part1; + CString code; + CString token; + + m_code.GetWindowText(buffer); + m_desc.GetWindowText(desc); + + StringTokenizer st(buffer, " \t\n\r"); + part1.Empty(); + const char *t = st.next(); + while(t) { + token = t; + token.MakeUpper(); + if(token.GetLength() == 16) + cheatsAddGSACode(token, desc, false); + else if(token.GetLength() == 12) { + code = token.Left(8); + code += " "; + code += token.Right(4); + cheatsAddCBACode(code, desc); + } else if(part1.IsEmpty()) + part1 = token; + else { + if(token.GetLength() == 4) { + code = part1; + code += " "; + code += token; + cheatsAddCBACode(code, desc); + } else { + code = part1 + token; + cheatsAddGSACode(code, desc, true); + } + part1.Empty(); + } + + t = st.next(); + } + EndDialog(TRUE); +} + +void AddCBACode::OnCancel() +{ + EndDialog(FALSE); +} + +BOOL AddCBACode::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_code.LimitText(1024); + m_desc.LimitText(32); + CString title = winResLoadString(IDS_ADD_CBA_CODE); + SetWindowText(title); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +///////////////////////////////////////////////////////////////////////////// +// AddCheatCode dialog + + +AddCheatCode::AddCheatCode(CWnd* pParent /*=NULL*/) + : CDialog(AddCheatCode::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddCheatCode) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void AddCheatCode::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddCheatCode) + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Control(pDX, IDC_CODE, m_code); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddCheatCode, CDialog) + //{{AFX_MSG_MAP(AddCheatCode) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddCheatCode message handlers + +void AddCheatCode::OnOk() +{ + CString desc; + CString buffer; + CString token; + + m_code.GetWindowText(buffer); + m_desc.GetWindowText(desc); + + StringTokenizer st(buffer, " \t\n\r"); + const char *t = st.next(); + while(t) { + token = t; + token.MakeUpper(); + cheatsAddCheatCode(token, desc); + t = st.next(); + } + EndDialog(TRUE); +} + +void AddCheatCode::OnCancel() +{ + EndDialog(FALSE); +} + +BOOL AddCheatCode::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_code.LimitText(1024); + m_desc.LimitText(32); + CString title = winResLoadString(IDS_ADD_CHEAT_CODE); + SetWindowText(title); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBACheatSearch::OnBnClickedCheatrefreshbutton() +{ + addChanges(false); +} diff --git a/src/win32/GBACheats.h b/src/win32/GBACheats.h new file mode 100644 index 0000000..1557309 --- /dev/null +++ b/src/win32/GBACheats.h @@ -0,0 +1,294 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_) +#define AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBACheats.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// GBACheatSearch dialog + +struct WinCheatsData { + u32 addr; + char address[9]; + char oldValue[12]; + char newValue[12]; +}; + +class GBACheatSearch : public CDialog +{ + // Construction + public: + afx_msg void OnSizeType(UINT id); + afx_msg void OnNumberType(UINT id); + afx_msg void OnSearchType(UINT id); + afx_msg void OnValueType(UINT id); + void addChange(int index, u32 address, u32 oldValue, u32 newValue); + GBACheatSearch(CWnd* pParent = NULL); // standard constructor + ~GBACheatSearch(); + + // Dialog Data + //{{AFX_DATA(GBACheatSearch) + enum { IDD = IDD_CHEATS }; + CEdit m_value; + CListCtrl m_list; + int valueType; + int sizeType; + int searchType; + int numberType; + BOOL updateValues; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBACheatSearch) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBACheatSearch) + afx_msg void OnOk(); + afx_msg void OnStart(); + afx_msg void OnSearch(); + afx_msg void OnAddCheat(); + afx_msg void OnUpdate(); + afx_msg void OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + void addChanges(bool showMsgs); + WinCheatsData *data; +public: + afx_msg void OnClose(); + afx_msg void OnBnClickedCheatrefreshbutton(); +}; + +///////////////////////////////////////////////////////////////////////////// +// AddCheat dialog + +class AddCheat : public CDialog +{ + // Construction + public: + bool addCheat(); + afx_msg void OnSizeType(UINT id); + afx_msg void OnNumberType(UINT id); + u32 address; + AddCheat(u32 address, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddCheat) + enum { IDD = IDD_ADD_CHEAT }; + CEdit m_value; + CEdit m_desc; + CEdit m_address; + int sizeType; + int numberType; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddCheat) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AddCheat) + afx_msg void OnOk(); + afx_msg void OnCancel(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + ///////////////////////////////////////////////////////////////////////////// +// GBACheatList dialog + +class GBACheatList : public CDialog +{ + // Construction + public: + void refresh(); + bool duringRefresh; + bool restoreValues; + + GBACheatList(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GBACheatList) + enum { IDD = IDD_CHEAT_LIST }; + CButton m_restore; + CListCtrl m_list; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBACheatList) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBACheatList) + afx_msg void OnAddCheat(); + afx_msg void OnAddCode(); + afx_msg void OnAddCodebreaker(); + afx_msg void OnAddGameshark(); + afx_msg void OnEnable(); + afx_msg void OnRemove(); + afx_msg void OnRemoveAll(); + afx_msg void OnRestore(); + afx_msg void OnOk(); + afx_msg void OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + ///////////////////////////////////////////////////////////////////////////// +// AddGSACode dialog + +class AddGSACode : public CDialog +{ + // Construction + public: + AddGSACode(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddGSACode) + enum { IDD = IDD_ADD_CHEAT_DLG }; + CEdit m_desc; + CEdit m_code; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddGSACode) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AddGSACode) + afx_msg void OnOk(); + afx_msg void OnCancel(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// +// AddCBACode dialog + +class AddCBACode : public CDialog +{ + // Construction + public: + AddCBACode(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddCBACode) + enum { IDD = IDD_ADD_CHEAT_DLG }; + CEdit m_desc; + CEdit m_code; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddCBACode) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AddCBACode) + afx_msg void OnOk(); + afx_msg void OnCancel(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// +// AddCheatCode dialog + +class AddCheatCode : public CDialog +{ + // Construction + public: + AddCheatCode(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddCheatCode) + enum { IDD = IDD_ADD_CHEAT_DLG }; + CEdit m_desc; + CEdit m_code; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddCheatCode) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AddCheatCode) + afx_msg void OnOk(); + afx_msg void OnCancel(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_) diff --git a/src/win32/GBCheatsDlg.cpp b/src/win32/GBCheatsDlg.cpp new file mode 100644 index 0000000..99d51e0 --- /dev/null +++ b/src/win32/GBCheatsDlg.cpp @@ -0,0 +1,1080 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBCheats.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GBCheatsDlg.h" +#include "Reg.h" +#include "StringTokenizer.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../CheatSearch.h" +#include "../gb/gbCheats.h" +#include "../gb/gbGlobals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +static bool winGbCheatAddVerifyGs(const char *code, const char *desc) +{ + gbAddGsCheat(code, desc); + return true; +} + +static bool winGbCheatAddVerifyGg(const char *code, const char *desc) +{ + gbAddGgCheat(code, desc); + return true; +} + +///////////////////////////////////////////////////////////////////////////// +// GBCheatSearch dialog + +GBCheatSearch::GBCheatSearch(CWnd* pParent /*=NULL*/) + : CDialog(GBCheatSearch::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBCheatSearch) + searchType = -1; + numberType = -1; + sizeType = -1; + updateValues = FALSE; + valueType = -1; + //}}AFX_DATA_INIT + data = NULL; +} + +GBCheatSearch::~GBCheatSearch() +{ + if(data) + free(data); +} + +void GBCheatSearch::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBCheatSearch) + DDX_Control(pDX, IDC_VALUE, m_value); + DDX_Control(pDX, IDC_CHEAT_LIST, m_list); + DDX_Radio(pDX, IDC_EQ, searchType); + DDX_Radio(pDX, IDC_SIGNED, numberType); + DDX_Radio(pDX, IDC_SIZE_8, sizeType); + DDX_Check(pDX, IDC_UPDATE, updateValues); + DDX_Radio(pDX, IDC_OLD_VALUE, valueType); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBCheatSearch, CDialog) + //{{AFX_MSG_MAP(GBCheatSearch) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(IDC_ADD_CHEAT, OnAddCheat) + ON_BN_CLICKED(IDC_SEARCH, OnSearch) + ON_BN_CLICKED(IDC_START, OnStart) + ON_BN_CLICKED(IDC_UPDATE, OnUpdate) + ON_NOTIFY(LVN_GETDISPINFO, IDC_CHEAT_LIST, OnGetdispinfoCheatList) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_CHEAT_LIST, OnItemchangedCheatList) + ON_CONTROL_RANGE(BN_CLICKED, IDC_OLD_VALUE, IDC_SPECIFIC_VALUE, OnValueType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_EQ, IDC_GE, OnSearchType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIGNED, IDC_HEXADECIMAL, OnNumberType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIZE_8, IDC_SIZE_32, OnSizeType) + //}}AFX_MSG_MAP +ON_WM_CLOSE() +ON_BN_CLICKED(IDC_CHEATREFRESHBUTTON, OnBnClickedCheatrefreshbutton) +END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBCheatSearch message handlers + +void GBCheatSearch::OnOk() +{ + if(data) + free(data); + data = NULL; + + if(theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = false; + DestroyWindow(); + } + else + { + EndDialog(TRUE); + } +} + +void GBCheatSearch::OnClose() +{ + CDialog::OnClose(); + if(theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = false; + DestroyWindow(); + } + else + { + EndDialog(FALSE); + } +} + +void GBCheatSearch::OnBnClickedCheatrefreshbutton() +{ + addChanges(false); +} + +void GBCheatSearch::OnAddCheat() +{ + int mark = m_list.GetSelectionMark(); + + if(mark != -1) { + LVITEM item; + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM; + item.iItem = mark; + if(m_list.GetItem(&item)) { + AddGBCheat dlg((u32)item.lParam); + dlg.DoModal(); + } + } +} + +static void dlgSystemMessage(CWnd * hWnd, int number, const char *defaultMsg, ...) +{ + CString buffer; + va_list valist; + CString msg = defaultMsg; + if(number) + msg = winResLoadString(number); + + va_start(valist, defaultMsg); + buffer.FormatV(msg, valist); + + theApp.winCheckFullscreen(); + + hWnd->MessageBox(buffer, winResLoadString(IDS_ERROR), MB_OK|MB_ICONERROR); + + va_end(valist); +} + + +void GBCheatSearch::OnSearch() +{ + CString buffer; + if(valueType == 0) + cheatSearch(&cheatSearchData, + searchType, + sizeType, + numberType == 0); + else { + m_value.GetWindowText(buffer); + if(buffer.IsEmpty()) { + dlgSystemMessage(this, IDS_NUMBER_CANNOT_BE_EMPTY, "Number cannot be empty"); + return; + } + int value = 0; + switch(numberType) { + case 0: + sscanf(buffer, "%d", &value); + break; + case 1: + sscanf(buffer, "%u", &value); + break; + default: + sscanf(buffer, "%x", &value); + } + cheatSearchValue(&cheatSearchData, + searchType, + sizeType, + numberType == 0, + value); + } + + addChanges(true); + + if(updateValues) + cheatSearchUpdateValues(&cheatSearchData); + + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(cheatSearchGetCount(&cheatSearchData, sizeType) == 0 ? FALSE : TRUE); + + if(0 == cheatSearchGetCount(&cheatSearchData, sizeType)) + OnStart(); +} + +void GBCheatSearch::OnStart() +{ + if(cheatSearchData.count == 0) { + int i = 0; + + CheatSearchBlock *block = &cheatSearchData.blocks[0]; + + if(gbRamSize) { + block->offset = 0xa000; + if(gbRam) + block->data = gbRam; + else + block->data = &gbMemory[0xa000]; + block->saved = (u8*)malloc(gbRamSize); + block->size = gbRamSize; + block->bits = (u8 *)malloc(gbRamSize >> 3); + i++; + } + block = &cheatSearchData.blocks[i]; + if(gbCgbMode) { + block->offset = 0xc000; + block->data = &gbMemory[0xc000]; + block->saved = (u8*)malloc(0x1000); + block->size = 0x1000; + block->bits = (u8 *)malloc(0x1000 >> 3); + i++; + block =&cheatSearchData.blocks[i]; + block->offset = 0xd000; + block->data = gbWram; + block->saved = (u8*)malloc(0x8000); + block->size = 0x8000; + block->bits = (u8 *)malloc(0x8000 >> 3); + i++; + } else { + block->offset = 0xc000; + block->data = &gbMemory[0xc000]; + block->saved = (u8*)malloc(0x2000); + block->size = 0x2000; + block->bits = (u8 *)malloc(0x2000 >> 3); + i++; + } + cheatSearchData.count = i; + } + + cheatSearchStart(&cheatSearchData); + GetDlgItem(IDC_SEARCH)->EnableWindow(TRUE); + + if(theApp.modelessCheatDialogIsOpen) + { + GetDlgItem(IDC_CHEATREFRESHBUTTON)->ShowWindow(TRUE); + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(FALSE); + } +} + +void GBCheatSearch::OnUpdate() +{ + if(GetDlgItem(IDC_UPDATE)->SendMessage(BM_GETCHECK, + 0, + 0) & BST_CHECKED) + updateValues = true; + else + updateValues = false; + regSetDwordValue("gbCheatsUpdate", updateValues); +} + +BOOL GBCheatSearch::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString temp = winResLoadString(IDS_ADDRESS); + + m_list.InsertColumn(0, temp, LVCFMT_CENTER, 125, 0); + + temp = winResLoadString(IDS_OLD_VALUE); + m_list.InsertColumn(1, temp, LVCFMT_CENTER, 125, 1); + + temp = winResLoadString(IDS_NEW_VALUE); + m_list.InsertColumn(2, temp, LVCFMT_CENTER, 125, 2); + + m_list.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)), + TRUE); + + m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT); + + if(!cheatSearchData.count) { + GetDlgItem(IDC_SEARCH)->EnableWindow(FALSE); + GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(FALSE); + } + + valueType = regQueryDwordValue("gbCheatsValueType", 0); + if(valueType < 0 || valueType > 1) + valueType = 2; + + searchType = regQueryDwordValue("gbCheatsSearchType", + SEARCH_EQ); + if(searchType < 0 || searchType > 5) + searchType = 0; + + numberType = regQueryDwordValue("gbCheatsNumberType", 2); + if(numberType < 0 || numberType > 2) + numberType = 2; + + sizeType = regQueryDwordValue("gbCheatsSizeType", 0); + if(sizeType < 0 || sizeType > 2) + sizeType = 0; + + updateValues = regQueryDwordValue("gbCheatsUpdate", 0) ? + true : false; + + UpdateData(FALSE); + + if(valueType == 0) + m_value.EnableWindow(FALSE); + + CenterWindow(); + + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->ShowWindow(TRUE); + + if(cheatSearchData.count) + { + addChanges(false); + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(cheatSearchGetCount(&cheatSearchData, sizeType) == 0 ? FALSE : TRUE); + } + else + { + if(theApp.modelessCheatDialogIsOpen) + GetDlgItem(IDC_CHEATREFRESHBUTTON)->EnableWindow(FALSE); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBCheatSearch::OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + LV_DISPINFO* info = (LV_DISPINFO*)pNMHDR; + if(info->item.mask & LVIF_TEXT) { + int index = info->item.iItem; + int col = info->item.iSubItem; + + switch(col) { + case 0: + strcpy(info->item.pszText, data[index].address); + break; + case 1: + strcpy(info->item.pszText, data[index].oldValue); + break; + case 2: + strcpy(info->item.pszText, data[index].newValue); + break; + } + } + *pResult = TRUE; +} + +void GBCheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(m_list.GetSelectionMark() != -1); +} + +int GBCheatSearch::getBank(u16 addr, int j) +{ + switch(addr >> 12) { + case 0x0a: + return j / 0x2000; + case 0x0d: + return j / 0x1000; + } + return 0; +} + +void GBCheatSearch::addChange(int index, int bank, u16 address, int offset, u32 oldValue, u32 newValue) +{ + data[index].bank = bank; + if(bank) { + if(address == 0xa000) + address |= offset & 0x1fff; + else + address |= offset & 0xfff; + } else + address |= offset; + data[index].addr = address; + sprintf(data[index].address, "%02x:%04x",bank,address); + switch(numberType) { + case 0: + sprintf(data[index].oldValue, "%d", oldValue); + sprintf(data[index].newValue, "%d", newValue); + break; + case 1: + sprintf(data[index].oldValue, "%u", oldValue); + sprintf(data[index].newValue, "%u", newValue); + break; + case 2: + switch(sizeType) { + case 0: + sprintf(data[index].oldValue, "%02x", oldValue); + sprintf(data[index].newValue, "%02x", newValue); + break; + case 1: + sprintf(data[index].oldValue, "%04x", oldValue); + sprintf(data[index].newValue, "%04x", newValue); + break; + case 2: + sprintf(data[index].oldValue, "%08x", oldValue); + sprintf(data[index].newValue, "%08x", newValue); + break; + } + } +} + +void GBCheatSearch::addChanges(bool showMsg) +{ + int count = cheatSearchGetCount(&cheatSearchData, sizeType); + + m_list.DeleteAllItems(); + + if(count > 4000) { + if(showMsg) + dlgSystemMessage(this, IDS_SEARCH_PRODUCED_TOO_MANY, + "Search produced %d results.\nThey have been remembered, but are too many to display.\nPlease refine it better by performing additional searches.", + count); + return; + } + + if(count == 0) { + if(showMsg) + dlgSystemMessage(this, IDS_SEARCH_PRODUCED_NO_RESULTS, + "Search produced no results"); + return; + } + + m_list.SetItemCount(count); + if(data) + free(data); + + data = (WinGbCheatsData *)calloc(count, sizeof(WinGbCheatsData)); + + int inc = 1; + switch(sizeType) { + case 1: + inc = 2; + break; + case 2: + inc = 4; + break; + } + + int index = 0; + if(numberType == 0) { + for(int i = 0; i < cheatSearchData.count; i++) { + CheatSearchBlock *block = &cheatSearchData.blocks[i]; + + for(int j = 0; j < block->size; j+= inc) { + if(IS_BIT_SET(block->bits, j)) { + addChange(index++, + getBank(block->offset|j, j), + block->offset, + j, + cheatSearchSignedRead(block->saved, + j, + sizeType), + cheatSearchSignedRead(block->data, + j, + sizeType)); + } + } + } + } else { + for(int i = 0; i < cheatSearchData.count; i++) { + CheatSearchBlock *block = &cheatSearchData.blocks[i]; + + for(int j = 0; j < block->size; j+= inc) { + if(IS_BIT_SET(block->bits, j)) { + addChange(index++, + getBank(block->offset|j, j), + block->offset, + j, + cheatSearchRead(block->saved, + j, + sizeType), + cheatSearchRead(block->data, + j, + sizeType)); + } + } + } + } + + for(int i = 0; i < count; i++) { + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + item.iItem = i; + item.iSubItem = 0; + item.lParam = data[i].addr| + (data[i].bank << 16); + item.state = 0; + item.stateMask = 0; + item.pszText = LPSTR_TEXTCALLBACK; + m_list.InsertItem(&item); + + m_list.SetItemText(i, 1, LPSTR_TEXTCALLBACK); + m_list.SetItemText(i, 2, LPSTR_TEXTCALLBACK); + } +} + +void GBCheatSearch::OnValueType(UINT id) +{ + switch(id) { + case IDC_OLD_VALUE: + valueType = 0; + m_value.EnableWindow(FALSE); + regSetDwordValue("gbCheatsValueType", 0); + break; + case IDC_SPECIFIC_VALUE: + valueType = 1; + m_value.EnableWindow(TRUE); + regSetDwordValue("gbCheatsValueType", 1); + break; + } +} + +void GBCheatSearch::OnSearchType(UINT id) +{ + switch(id) { + case IDC_EQ: + searchType = SEARCH_EQ; + regSetDwordValue("gbCheatsSearchType", 0); + break; + case IDC_NE: + searchType = SEARCH_NE; + regSetDwordValue("gbCheatsSearchType", 1); + break; + case IDC_LT: + searchType = SEARCH_LT; + regSetDwordValue("gbCheatsSearchType", 2); + break; + case IDC_LE: + searchType = SEARCH_LE; + regSetDwordValue("gbCheatsSearchType", 3); + break; + case IDC_GT: + searchType = SEARCH_GT; + regSetDwordValue("gbCheatsSearchType", 4); + break; + case IDC_GE: + searchType = SEARCH_GE; + regSetDwordValue("gbCheatsSearchType", 5); + break; + } +} + +void GBCheatSearch::OnNumberType(UINT id) +{ + switch(id) { + case IDC_SIGNED: + numberType = 0; + regSetDwordValue("gbCheatsNumberType", 0); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_UNSIGNED: + numberType = 1; + regSetDwordValue("gbCheatsNumberType", 1); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_HEXADECIMAL: + numberType = 2; + regSetDwordValue("gbCheatsNumberType", 2); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + } +} + +void GBCheatSearch::OnSizeType(UINT id) +{ + switch(id) { + case IDC_SIZE_8: + sizeType = BITS_8; + regSetDwordValue("gbCheatsSizeType", 0); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_SIZE_16: + sizeType = BITS_16; + regSetDwordValue("gbCheatsSizeType", 1); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + case IDC_SIZE_32: + sizeType = BITS_32; + regSetDwordValue("gbCheatsSizeType", 2); + if(m_list.GetItemCount()) { + addChanges(false); + } + break; + } +} +///////////////////////////////////////////////////////////////////////////// +// AddGBCheat dialog + + +AddGBCheat::AddGBCheat(u32 addr, CWnd* pParent /*=NULL*/) + : CDialog(AddGBCheat::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddGBCheat) + sizeType = -1; + numberType = -1; + //}}AFX_DATA_INIT + address = addr; +} + + +void AddGBCheat::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddGBCheat) + DDX_Control(pDX, IDC_VALUE, m_value); + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Radio(pDX, IDC_SIZE_8, sizeType); + DDX_Radio(pDX, IDC_SIGNED, numberType); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddGBCheat, CDialog) + //{{AFX_MSG_MAP(AddGBCheat) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIGNED, IDC_HEXADECIMAL, OnNumberType) + ON_CONTROL_RANGE(BN_CLICKED, IDC_SIZE_8, IDC_SIZE_32, OnSizeType) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddGBCheat message handlers + +void AddGBCheat::OnCancel() +{ + EndDialog(FALSE); +} + +void AddGBCheat::OnOk() +{ + // add cheat + if(addCheat()) { + EndDialog(TRUE); + } +} + +bool AddGBCheat::addCheat() +{ + CString buffer; + CString code; + + u32 value; + m_value.GetWindowText(buffer); + + if(buffer.IsEmpty()) { + dlgSystemMessage(this, IDS_VALUE_CANNOT_BE_EMPTY, "Value cannot be empty"); + return false; + } + + switch(numberType) { + case 0: + sscanf(buffer, "%d", &value); + break; + case 1: + sscanf(buffer, "%u", &value); + break; + default: + sscanf(buffer, "%x", &value); + } + + m_desc.GetWindowText(buffer); + + int bank = (address >> 16); + address &= 0xFFFF; + + if(address >= 0xd000) + bank += 0x90; + else + bank = 0x01; + + switch(sizeType) { + case 0: + code.Format("%02X%02X%02X%02X", bank, value, address&0xFF, address>>8); + gbAddGsCheat(code, buffer); + break; + case 1: + code.Format("%02X%02X%02X%02X", bank, value&0xFF, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + address++; + code.Format("%02X%02X%02X%02X", bank, value>>8, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + break; + case 2: + code.Format("%02X%02X%02X%02X", bank, value&0xFF, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + address++; + code.Format("%02X%02X%02X%02X", bank, (value>>8) & 0xFF, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + address++; + code.Format("%02X%02X%02X%02X", bank, (value>>16)&0xFF, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + address++; + code.Format("%02X%02X%02X%02X", bank, value>>24, address&0xFF, + address>>8); + gbAddGsCheat(code, buffer); + break; + } + + return true; +} + +BOOL AddGBCheat::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString buffer; + buffer.Format("%02x:%08x", (address>>16), address&0xFFFF); + m_address.SetWindowText(buffer); + m_address.EnableWindow(FALSE); + ::SetWindowLong(m_address, + GWL_USERDATA, + address); + + numberType = regQueryDwordValue("gbCheatsNumberType", 2); + if(numberType < 0 || numberType > 2) + numberType = 2; + + sizeType = regQueryDwordValue("gbCheatsSizeType", 0); + if(sizeType < 0 || sizeType > 2) + sizeType = 0; + + UpdateData(FALSE); + + m_desc.LimitText(32); + + if(address != 0) { + GetDlgItem(IDC_SIZE_8)->EnableWindow(FALSE); + GetDlgItem(IDC_SIZE_16)->EnableWindow(FALSE); + GetDlgItem(IDC_SIZE_32)->EnableWindow(FALSE); + GetDlgItem(IDC_HEXADECIMAL)->EnableWindow(FALSE); + GetDlgItem(IDC_UNSIGNED)->EnableWindow(FALSE); + GetDlgItem(IDC_SIGNED)->EnableWindow(FALSE); + } + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void AddGBCheat::OnNumberType(UINT id) +{ + switch(id) { + case IDC_SIGNED: + numberType = 0; + regSetDwordValue("gbCheatsNumberType", 0); + break; + case IDC_UNSIGNED: + numberType = 1; + regSetDwordValue("gbCheatsNumberType", 1); + break; + case IDC_HEXADECIMAL: + numberType = 2; + regSetDwordValue("gbCheatsNumberType", 2); + break; + } +} + +void AddGBCheat::OnSizeType(UINT id) +{ + switch(id) { + case IDC_SIZE_8: + sizeType = BITS_8; + regSetDwordValue("gbCheatsSizeType", 0); + break; + case IDC_SIZE_16: + sizeType = BITS_16; + regSetDwordValue("gbCheatsSizeType", 1); + break; + case IDC_SIZE_32: + sizeType = BITS_32; + regSetDwordValue("gbCheatsSizeType", 2); + break; + } +} + +///////////////////////////////////////////////////////////////////////////// +// GBCheatList dialog + + +GBCheatList::GBCheatList(CWnd* pParent /*=NULL*/) + : CDialog(GBCheatList::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBCheatList) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + duringRefresh = false; +} + + +void GBCheatList::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBCheatList) + DDX_Control(pDX, IDC_CHEAT_LIST, m_list); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBCheatList, CDialog) + //{{AFX_MSG_MAP(GBCheatList) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(IDC_ADD_GG_CHEAT, OnAddGgCheat) + ON_BN_CLICKED(IDC_ADD_GS_CHEAT, OnAddGsCheat) + ON_BN_CLICKED(IDC_ENABLE, OnEnable) + ON_BN_CLICKED(IDC_REMOVE, OnRemove) + ON_BN_CLICKED(IDC_REMOVE_ALL, OnRemoveAll) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_CHEAT_LIST, OnItemchangedCheatList) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBCheatList message handlers + +void GBCheatList::OnOk() +{ + EndDialog(TRUE); +} + +void GBCheatList::OnAddGgCheat() +{ + CString temp = winResLoadString(IDS_ADD_GG_CODE); + AddGBCode dlg(winGbCheatAddVerifyGg, 11, temp); + dlg.DoModal(); + refresh(); +} + +void GBCheatList::OnAddGsCheat() +{ + CString temp = winResLoadString(IDS_ADD_GS_CODE); + + AddGBCode dlg(winGbCheatAddVerifyGs, 8, temp); + dlg.DoModal(); + refresh(); +} + +void GBCheatList::OnEnable() +{ + int mark = m_list.GetSelectionMark(); + + if(mark != -1) { + LVITEM item; + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM; + item.iItem = mark; + if(m_list.GetItem(&item)) { + if(gbCheatList[item.lParam].enabled) + gbCheatDisable(item.lParam); + else + gbCheatEnable(item.lParam); + refresh(); + } + } +} + +void GBCheatList::OnRemove() +{ + int mark = m_list.GetSelectionMark(); + + if(mark != -1) { + LVITEM item; + memset(&item,0, sizeof(item)); + item.mask = LVIF_PARAM; + item.iItem = mark; + if(m_list.GetItem(&item)) { + gbCheatRemove(item.lParam); + refresh(); + } + } +} + +void GBCheatList::OnRemoveAll() +{ + gbCheatRemoveAll(); + refresh(); +} + +void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +{ + if(m_list.GetSelectionMark() != -1) { + GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); + GetDlgItem(IDC_ENABLE)->EnableWindow(TRUE); + } else { + GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); + GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); + } + + if(!duringRefresh) { + LPNMLISTVIEW l = (LPNMLISTVIEW)pNMHDR; + if(l->uChanged & LVIF_STATE) { + if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) != + (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { + if(m_list.GetCheck(l->iItem)) + gbCheatEnable(l->lParam); + else + gbCheatDisable(l->lParam); + refresh(); + } + } + } +} + +BOOL GBCheatList::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString temp = winResLoadString(IDS_CODE); + m_list.InsertColumn(0, temp, LVCFMT_LEFT, 120, 0); + temp = winResLoadString(IDS_DESCRIPTION); + m_list.InsertColumn(1, temp, LVCFMT_LEFT, 200, 1); + temp = winResLoadString(IDS_STATUS); + m_list.InsertColumn(2, temp, LVCFMT_LEFT, 80, 2); + + m_list.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)), + TRUE); + + m_list.SetExtendedStyle(LVS_EX_CHECKBOXES | + LVS_EX_FULLROWSELECT); + + refresh(); + GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); + GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBCheatList::refresh() +{ + duringRefresh = true; + + m_list.DeleteAllItems(); + + char buffer[2]; + + for(int i = 0; i < gbCheatNumber; i++) { + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; + item.iItem = i; + item.iSubItem = 0; + item.lParam = i; + item.state = 0; + item.stateMask = 0; + item.pszText = gbCheatList[i].cheatCode; + m_list.InsertItem(&item); + + m_list.SetCheck(i, (gbCheatList[i].enabled ? TRUE : FALSE)); + + m_list.SetItemText(i, 1, gbCheatList[i].cheatDesc); + + buffer[0] = (gbCheatList[i].enabled) ? 'E' : 'D'; + buffer[1] = 0; + m_list.SetItemText(i, 2, buffer); + } + duringRefresh = false; +} + +///////////////////////////////////////////////////////////////////////////// +// AddGBCode dialog + + +AddGBCode::AddGBCode(bool (*verify)(const char *,const char*), int len, const char *title, CWnd* pParent /*=NULL*/) + : CDialog(AddGBCode::IDD, pParent) +{ + //{{AFX_DATA_INIT(AddGBCode) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + addVerify = verify; + addLength = len; + addTitle = title; +} + + +void AddGBCode::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(AddGBCode) + DDX_Control(pDX, IDC_DESC, m_desc); + DDX_Control(pDX, IDC_CODE, m_code); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(AddGBCode, CDialog) + //{{AFX_MSG_MAP(AddGBCode) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// AddGBCode message handlers + +void AddGBCode::OnOk() +{ + CString desc; + CString buffer; + m_code.GetWindowText(buffer); + m_desc.GetWindowText(desc); + + StringTokenizer st(buffer, " \t\n\r"); + const char *t = st.next(); + while(t) { + addVerify(t, desc); + t = st.next(); + } + EndDialog(TRUE); +} + +void AddGBCode::OnCancel() +{ + EndDialog(FALSE); +} + +BOOL AddGBCode::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_code.LimitText(1024); + m_desc.LimitText(32); + SetWindowText(addTitle); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/GBCheatsDlg.h b/src/win32/GBCheatsDlg.h new file mode 100644 index 0000000..cf44331 --- /dev/null +++ b/src/win32/GBCheatsDlg.h @@ -0,0 +1,220 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBCHEATSDLG_H__8ECCB04A_AB75_4552_8625_C6FBF30A95D9__INCLUDED_) +#define AFX_GBCHEATSDLG_H__8ECCB04A_AB75_4552_8625_C6FBF30A95D9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBCheats.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// GBCheatSearch dialog + +struct WinGbCheatsData { + int bank; + u16 addr; + char address[9]; + char oldValue[12]; + char newValue[12]; +}; + +class GBCheatSearch : public CDialog +{ + // Construction + public: + afx_msg void OnSizeType(UINT id); + afx_msg void OnNumberType(UINT id); + afx_msg void OnSearchType(UINT id); + afx_msg void OnValueType(UINT id); + void addChanges(bool showMsg); + void addChange(int index, int bank, u16 address, int offset, u32 oldValue, u32 newValue); + int getBank(u16 addr, int j); + GBCheatSearch(CWnd* pParent = NULL); // standard constructor + ~GBCheatSearch(); + + // Dialog Data + //{{AFX_DATA(GBCheatSearch) + enum { IDD = IDD_CHEATS }; + CEdit m_value; + CListCtrl m_list; + int searchType; + int numberType; + int sizeType; + BOOL updateValues; + int valueType; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBCheatSearch) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + WinGbCheatsData *data; + + // Generated message map functions + //{{AFX_MSG(GBCheatSearch) + afx_msg void OnOk(); + afx_msg void OnAddCheat(); + afx_msg void OnSearch(); + afx_msg void OnStart(); + afx_msg void OnUpdate(); + virtual BOOL OnInitDialog(); + afx_msg void OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnClose(); + afx_msg void OnBnClickedCheatrefreshbutton(); +}; + +///////////////////////////////////////////////////////////////////////////// +// AddGBCheat dialog + +class AddGBCheat : public CDialog +{ + // Construction + public: + afx_msg void OnSizeType(UINT id); + afx_msg void OnNumberType(UINT id); + bool addCheat(); + AddGBCheat(u32 addr, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddGBCheat) + enum { IDD = IDD_ADD_CHEAT }; + CEdit m_value; + CEdit m_address; + CEdit m_desc; + int sizeType; + int numberType; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddGBCheat) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + u32 address; + + // Generated message map functions + //{{AFX_MSG(AddGBCheat) + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + ///////////////////////////////////////////////////////////////////////////// +// GBCheatList dialog + +class GBCheatList : public CDialog +{ + // Construction + public: + void refresh(); + bool duringRefresh; + GBCheatList(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GBCheatList) + enum { IDD = IDD_GB_CHEAT_LIST }; + CListCtrl m_list; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBCheatList) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBCheatList) + afx_msg void OnOk(); + afx_msg void OnAddGgCheat(); + afx_msg void OnAddGsCheat(); + afx_msg void OnEnable(); + afx_msg void OnRemove(); + afx_msg void OnRemoveAll(); + afx_msg void OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// +// AddGBCode dialog + +class AddGBCode : public CDialog +{ + // Construction + public: + AddGBCode(bool (*verify)(const char *, const char *),int, const char *, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(AddGBCode) + enum { IDD = IDD_ADD_CHEAT_DLG }; + CEdit m_desc; + CEdit m_code; + //}}AFX_DATA + + int addLength; + CString addTitle; + bool (*addVerify)(const char *, const char*); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(AddGBCode) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(AddGBCode) + afx_msg void OnOk(); + afx_msg void OnCancel(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBCHEATSDLG_H__8ECCB04A_AB75_4552_8625_C6FBF30A95D9__INCLUDED_) diff --git a/src/win32/GBColorDlg.cpp b/src/win32/GBColorDlg.cpp new file mode 100644 index 0000000..b4c2784 --- /dev/null +++ b/src/win32/GBColorDlg.cpp @@ -0,0 +1,261 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBColorDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GBColorDlg.h" +#include "../System.h" +#include "Reg.h" + +extern int gbPaletteOption; +extern int emulating; +extern int cartridgeType; +extern u16 gbPalette[128]; + +static u16 defaultPalettes[][24] = { + { + 0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000, + }, + { + 0x6200, 0x7E10, 0x7C10, 0x5000, 0x6200, 0x7E10, 0x7C10, 0x5000, + }, + { + 0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008, + }, + { + 0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200, + }, + { + 0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F, + }, + { + 0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010, + }, + { + 0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010, + }, + { + 0x1314, 0x0E91, 0x0E0D, 0x2108, 0x1314, 0x0E91, 0x0E0D, 0x2108, + } +}; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBColorDlg dialog + + +GBColorDlg::GBColorDlg(CWnd* pParent /*=NULL*/) + : CDialog(GBColorDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBColorDlg) + which = -1; + //}}AFX_DATA_INIT + which = gbPaletteOption; +} + + +void GBColorDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBColorDlg) + DDX_Control(pDX, IDC_PREDEFINED, m_predefined); + DDX_Radio(pDX, IDC_DEFAULT, which); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBColorDlg, CDialog) + //{{AFX_MSG_MAP(GBColorDlg) + ON_BN_CLICKED(IDC_DEFAULT, OnDefault) + ON_BN_CLICKED(IDC_RESET, OnReset) + ON_BN_CLICKED(IDC_USER1, OnUser1) + ON_BN_CLICKED(IDC_USER2, OnUser2) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_CBN_SELCHANGE(IDC_PREDEFINED, OnSelchangePredefined) + //}}AFX_MSG_MAP + ON_CONTROL_RANGE(BN_CLICKED, IDC_COLOR_BG0, IDC_COLOR_OB3, OnColorClicked) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBColorDlg message handlers + +void GBColorDlg::OnDefault() +{ + setWhich(0); +} + +void GBColorDlg::OnReset() +{ + int s = which * 8; + colors[s++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + colors[s++] = (0x15) | (0x15 << 5) | (0x15 << 10); + colors[s++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + colors[s++] = 0; + + colors[s++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + colors[s++] = (0x15) | (0x15 << 5) | (0x15 << 10); + colors[s++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + colors[s] = 0; + setWhich(which); +} + +void GBColorDlg::OnUser1() +{ + setWhich(1); +} + +void GBColorDlg::OnUser2() +{ + setWhich(2); +} + +void GBColorDlg::OnCancel() +{ + EndDialog(FALSE); +} + +void GBColorDlg::OnOk() +{ + EndDialog(TRUE); +} + +BOOL GBColorDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + colorControls[0].SubclassDlgItem(IDC_COLOR_BG0, this); + colorControls[1].SubclassDlgItem(IDC_COLOR_BG1, this); + colorControls[2].SubclassDlgItem(IDC_COLOR_BG2, this); + colorControls[3].SubclassDlgItem(IDC_COLOR_BG3, this); + colorControls[4].SubclassDlgItem(IDC_COLOR_OB0, this); + colorControls[5].SubclassDlgItem(IDC_COLOR_OB1, this); + colorControls[6].SubclassDlgItem(IDC_COLOR_OB2, this); + colorControls[7].SubclassDlgItem(IDC_COLOR_OB3, this); + + for(int i = 0; i < 24; i++) { + colors[i] = systemGbPalette[i]; + } + + const char *names[] = { + "Standard", + "Blue Sea", + "Dark Night", + "Green Forest", + "Hot Desert", + "Pink Dreams", + "Weird Colors", + "Real Colors" + }; + + for(int j = 0; j < 8; j++) { + int index = m_predefined.AddString(names[j]); + m_predefined.SetItemData(index, j); + } + + RECT cbSize; + int Height; + + m_predefined.GetClientRect(&cbSize); + Height = m_predefined.GetItemHeight(0); + Height += m_predefined.GetItemHeight(0) * (10); + + // Note: The use of SM_CYEDGE assumes that we're using Windows '95 + // Now add on the height of the border of the edit box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // The height of the border of the drop-down box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // now set the size of the window + m_predefined.SetWindowPos(NULL, + 0, 0, + cbSize.right, Height, + SWP_NOMOVE | SWP_NOZORDER); + + + setWhich(which); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBColorDlg::setWhich(int w) +{ + which = w; + + for(int i = 0; i < 8; i++) { + colorControls[i].setColor(colors[which*8+i]); + } +} + +u16 * GBColorDlg::getColors() +{ + return colors; +} + +void GBColorDlg::OnColorClicked(UINT id) +{ + id -= IDC_COLOR_BG0; + + u16 color = colors[which*8+id]; + + COLORREF colorInit = + RGB((color & 0x1f) << 3, ((color >> 5) & 0x1f) << 3, ((color >> 10) & 0x1f) << 3); + + CColorDialog dlg(colorInit, + CC_FULLOPEN | CC_ANYCOLOR, this); + + if(IDOK == dlg.DoModal()) + { + COLORREF c = dlg.GetColor(); + + colors[which*8+id] = (u16)((c >> 3) & 0x1f | ((c >> 11) & 0x1f) << 5 | + ((c >> 19) & 0x1f) << 10); + colorControls[id].setColor(colors[which*8+id]); + } +} + +int GBColorDlg::getWhich() +{ + return which; +} + + +void GBColorDlg::OnSelchangePredefined() +{ + int sel = m_predefined.GetCurSel(); + + if(sel != -1) { + int data = m_predefined.GetItemData(sel); + for(int i = 0; i < 8; i++) { + colorControls[i].setColor(defaultPalettes[data][i]); + colors[which*8+i] = defaultPalettes[data][i]; + } + } +} diff --git a/src/win32/GBColorDlg.h b/src/win32/GBColorDlg.h new file mode 100644 index 0000000..d19c308 --- /dev/null +++ b/src/win32/GBColorDlg.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBCOLORDLG_H__8D6126EF_06BB_48CF_ABB3_2CC4B1B60358__INCLUDED_) +#define AFX_GBCOLORDLG_H__8D6126EF_06BB_48CF_ABB3_2CC4B1B60358__INCLUDED_ + +#include "ColorButton.h" // Added by ClassView +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBColorDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// GBColorDlg dialog + +class GBColorDlg : public CDialog +{ + // Construction + public: + int getWhich(); + afx_msg void OnColorClicked(UINT id); + u16 * getColors(); + void setWhich(int w); + u16 colors[24]; + ColorButton colorControls[8]; + GBColorDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GBColorDlg) + enum { IDD = IDD_GB_COLORS }; + CComboBox m_predefined; + int which; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBColorDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBColorDlg) + afx_msg void OnDefault(); + afx_msg void OnReset(); + afx_msg void OnUser1(); + afx_msg void OnUser2(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + afx_msg void OnSelchangePredefined(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBCOLORDLG_H__8D6126EF_06BB_48CF_ABB3_2CC4B1B60358__INCLUDED_) diff --git a/src/win32/GBDisassemble.cpp b/src/win32/GBDisassemble.cpp new file mode 100644 index 0000000..6eee4ec --- /dev/null +++ b/src/win32/GBDisassemble.cpp @@ -0,0 +1,262 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBDisassemble.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GBDisassemble.h" + +#include "../System.h" +#include "../gb/GB.h" +#include "../gb/gbGlobals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern gbRegister AF; +extern gbRegister BC; +extern gbRegister DE; +extern gbRegister HL; +extern gbRegister SP; +extern gbRegister PC; +extern u16 IFF; +extern int gbDis(char *, u16); + +///////////////////////////////////////////////////////////////////////////// +// GBDisassemble dialog + + +GBDisassemble::GBDisassemble(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBDisassemble::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBDisassemble) + m_c = FALSE; + m_h = FALSE; + m_n = FALSE; + m_z = FALSE; + //}}AFX_DATA_INIT + address = 0; + autoUpdate = false; + count = 1; + lastAddress = 0; +} + + +void GBDisassemble::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBDisassemble) + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Control(pDX, IDC_DISASSEMBLE, m_list); + DDX_Check(pDX, IDC_C, m_c); + DDX_Check(pDX, IDC_H, m_h); + DDX_Check(pDX, IDC_N, m_n); + DDX_Check(pDX, IDC_Z, m_z); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBDisassemble, CDialog) + //{{AFX_MSG_MAP(GBDisassemble) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_NEXT, OnNext) + ON_BN_CLICKED(IDC_GO, OnGo) + ON_BN_CLICKED(IDC_GOPC, OnGopc) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_WM_VSCROLL() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBDisassemble message handlers + +void GBDisassemble::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +void GBDisassemble::OnRefresh() +{ + refresh(); +} + +void GBDisassemble::OnNext() +{ + gbEmulate(1); + if(PC.W < address || PC.W >= lastAddress) + OnGopc(); + refresh(); +} + +void GBDisassemble::OnGo() +{ + CString buffer; + m_address.GetWindowText(buffer); + sscanf(buffer, "%x", &address); + refresh(); +} + +void GBDisassemble::OnGopc() +{ + address = PC.W; + + refresh(); +} + +void GBDisassemble::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +BOOL GBDisassemble::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_DISASSEMBLE, DS_SizeY) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_NEXT, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_AUTO_UPDATE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_GOPC, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_VSCROLL, DS_SizeY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBDisassembleView", + NULL); + + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = 100; + si.nPos = 50; + si.nPage = 0; + GetDlgItem(IDC_VSCROLL)->SetScrollInfo(SB_CTL, &si, TRUE); + CFont *font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)); + m_list.SetFont(font); + + for(int i = 0; i < 6; i++) + GetDlgItem(IDC_R0+i)->SetFont(font); + + m_address.LimitText(4); + refresh(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBDisassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + char buffer[80]; + + switch(nSBCode) { + case SB_LINEDOWN: + address += gbDis(buffer, address); + break; + case SB_LINEUP: + address--; + break; + case SB_PAGEDOWN: + address = lastAddress; + break; + case SB_PAGEUP: + address -= count; + break; + } + refresh(); + + CDialog::OnVScroll(nSBCode, nPos, pScrollBar); +} + +void GBDisassemble::refresh() +{ + if(gbRom == NULL) + return; + + int h = m_list.GetItemHeight(0); + RECT r; + m_list.GetClientRect(&r); + count = (r.bottom - r.top+1)/h; + + m_list.ResetContent(); + if(!emulating || theApp.cartridgeType != 1) + return; + + char buffer[80]; + u16 addr = address; + int i; + int sel = -1; + for(i = 0; i < count; i++) { + if(addr == PC.W) + sel = i; + addr += gbDis(buffer, addr); + m_list.InsertString(-1, buffer); + } + lastAddress = addr-1; + if(sel != -1) + m_list.SetCurSel(sel); + + sprintf(buffer, "%04x", AF.W); + GetDlgItem(IDC_R0)->SetWindowText(buffer); + sprintf(buffer, "%04x", BC.W); + GetDlgItem(IDC_R1)->SetWindowText(buffer); + sprintf(buffer, "%04x", DE.W); + GetDlgItem(IDC_R2)->SetWindowText(buffer); + sprintf(buffer, "%04x", HL.W); + GetDlgItem(IDC_R3)->SetWindowText(buffer); + sprintf(buffer, "%04x", SP.W); + GetDlgItem(IDC_R4)->SetWindowText(buffer); + sprintf(buffer, "%04x", PC.W); + GetDlgItem(IDC_R5)->SetWindowText(buffer); + sprintf(buffer, "%04x", IFF); + GetDlgItem(IDC_R6)->SetWindowText(buffer); + + m_z = (AF.B.B0 & 0x80) != 0; + m_n = (AF.B.B0 & 0x40) != 0; + m_h = (AF.B.B0 & 0x20) != 0; + m_c = (AF.B.B0 & 0x10) != 0; + UpdateData(FALSE); +} + +void GBDisassemble::update() +{ + OnGopc(); + refresh(); +} + +void GBDisassemble::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/GBDisassemble.h b/src/win32/GBDisassemble.h new file mode 100644 index 0000000..0a37a6b --- /dev/null +++ b/src/win32/GBDisassemble.h @@ -0,0 +1,89 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_) +#define AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBDisassemble.h : header file +// + +#include "IUpdate.h" +#include "ResizeDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// GBDisassemble dialog + +class GBDisassemble : public ResizeDlg, IUpdateListener +{ + // Construction + public: + void refresh(); + u16 lastAddress; + int count; + bool autoUpdate; + u16 address; + GBDisassemble(CWnd* pParent = NULL); // standard constructor + + virtual void update(); + + // Dialog Data + //{{AFX_DATA(GBDisassemble) + enum { IDD = IDD_GB_DISASSEMBLE }; + CEdit m_address; + CListBox m_list; + BOOL m_c; + BOOL m_h; + BOOL m_n; + BOOL m_z; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBDisassemble) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBDisassemble) + afx_msg void OnClose(); + afx_msg void OnRefresh(); + afx_msg void OnNext(); + afx_msg void OnGo(); + afx_msg void OnGopc(); + afx_msg void OnAutoUpdate(); + virtual BOOL OnInitDialog(); + afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_) diff --git a/src/win32/GBMapView.cpp b/src/win32/GBMapView.cpp new file mode 100644 index 0000000..c3cd714 --- /dev/null +++ b/src/win32/GBMapView.cpp @@ -0,0 +1,577 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBMapView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBMapView.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../NLS.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" + +extern "C" { +#include +} + +extern u8 gbInvertTab[256]; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBMapView dialog + + +GBMapView::GBMapView(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBMapView::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBMapView) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 1024; + bmpInfo.bmiHeader.biHeight = -1024; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 1024 * 1024); + + mapView.setData(data); + mapView.setBmpInfo(&bmpInfo); + + bg = 0; + bank = 0; +} + + +void GBMapView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBMapView) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_MAP_VIEW, mapView); + DDX_Control(pDX, IDC_MAP_VIEW_ZOOM, mapViewZoom); + DDX_Control(pDX, IDC_COLOR, color); +} + + +BEGIN_MESSAGE_MAP(GBMapView, CDialog) + //{{AFX_MSG_MAP(GBMapView) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_BG0, OnBg0) + ON_BN_CLICKED(IDC_BG1, OnBg1) + ON_BN_CLICKED(IDC_BANK_0, OnBank0) + ON_BN_CLICKED(IDC_BANK_1, OnBank1) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBMapView message handlers + +GBMapView::~GBMapView() +{ + free(data); + data = NULL; +} + +void GBMapView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + +void GBMapView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + +void GBMapView::OnSave() +{ + CString filename; + + if(theApp.captureFormat == 0) + filename = "map.png"; + else + filename = "map.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + + FileDlg dlg(this, + filename, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + if(dlg.getFilterIndex() == 2) + saveBMP(dlg.GetPathName()); + else + savePNG(dlg.GetPathName()); +} + +void GBMapView::render() +{ + u8 * bank0; + u8 * bank1; + if(gbCgbMode) { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } else { + bank0 = &gbMemory[0x8000]; + bank1 = NULL; + } + + int tile_map_address = 0x1800; + if(bg == 1) + tile_map_address = 0x1c00; + + int tile_pattern = 0x0000; + if(bank == 1) + tile_pattern = 0x0800; + + w = 256; + h = 256; + + int tile = 0; + for(int y = 0; y < 32; y++) { + for(int x = 0; x < 32; x++) { + u8 *bmp = &data[y * 8 * 32 * 24 + x*24]; + u8 attrs = 0; + if(bank1 != NULL) + attrs = bank1[tile_map_address]; + u8 tile = bank0[tile_map_address]; + tile_map_address++; + + if(bank == 1) { + if(tile < 128) tile += 128; + else tile -= 128; + } + for(int j = 0; j < 8; j++) { + int tile_pattern_address = attrs & 0x40 ? + tile_pattern + tile*16 + (7-j)*2: + tile_pattern + tile*16+j*2; + + u8 tile_a = 0; + u8 tile_b = 0; + + if(attrs & 0x08) { + tile_a = bank1[tile_pattern_address++]; + tile_b = bank1[tile_pattern_address]; + } else { + tile_a = bank0[tile_pattern_address++]; + tile_b = bank0[tile_pattern_address]; + } + + if(attrs & 0x20) { + tile_a = gbInvertTab[tile_a]; + tile_b = gbInvertTab[tile_b]; + } + + u8 mask = 0x80; + + while(mask > 0) { + u8 c = (tile_a & mask) ? 1 : 0; + c += (tile_b & mask) ? 2 : 0; + + if(gbCgbMode) + c = c + (attrs & 7)*4; + + u16 color = gbPalette[c]; + + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + + mask >>= 1; + } + bmp += 31*24; + } + } + } +} + +void GBMapView::paint() +{ + if(gbRom == NULL) + return; + render(); + + SIZE s; + if(mapView.getStretch()) { + mapView.setSize(w, h); + s.cx = s.cy = 1; + mapView.SetScrollSizes(MM_TEXT, s); + } else { + mapView.setSize(w, h); + s.cx = w; + s.cy = h; + mapView.SetScrollSizes(MM_TEXT, s); + } + + mapView.refresh(); +} + +void GBMapView::OnRefresh() +{ + paint(); +} + +void GBMapView::update() +{ + paint(); +} + +BOOL GBMapView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_MAP_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBMapView", + NULL); + + int s = regQueryDwordValue("mapViewStretch", 0); + if(s) + mapView.setStretch(true); + ((CButton *)GetDlgItem(IDC_STRETCH))->SetCheck(s); + + UINT id = IDC_BANK_0; + if(bank == 1) + id = IDC_BANK_1; + CheckRadioButton(IDC_BANK_0, IDC_BANK_1, id); + id = IDC_BG0; + if(bg == 1) + id = IDC_BG1; + CheckRadioButton(IDC_BG0, IDC_BG1, id); + paint(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBMapView::OnBg0() +{ + bg = 0; + paint(); +} + +void GBMapView::OnBg1() +{ + bg = 1; + paint(); +} + +void GBMapView::OnBank0() +{ + bank = 0; + paint(); +} + +void GBMapView::OnBank1() +{ + bank = 1; + paint(); +} + +void GBMapView::OnStretch() +{ + mapView.setStretch(!mapView.getStretch()); + paint(); + regSetDwordValue("mapViewStretch", mapView.getStretch()); +} + +void GBMapView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void GBMapView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +u32 GBMapView::GetClickAddress(int x, int y) +{ + u32 base = 0x9800; + if(bg == 1) + base = 0x9c00; + + return base + (y >> 3)*32 + (x >> 3); +} + +LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + mapViewZoom.setColors(colors); + + int x = wParam & 0xffff; + int y = (wParam >> 16); + + CString buffer; + buffer.Format("(%d,%d)", x, y); + GetDlgItem(IDC_XY)->SetWindowText(buffer); + + u32 address = GetClickAddress(x,y); + buffer.Format("0x%08X", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + u8 attrs = 0; + + u8 tile = gbMemoryMap[9][address & 0xfff]; + if(gbCgbMode) { + attrs = gbVram[0x2000 + address - 0x8000]; + tile = gbVram[address & 0x1fff]; + } + + if(bank == 1) { + if(tile > 128) tile -= 128; + else tile += 128; + } + + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE_NUM)->SetWindowText(buffer); + + buffer.Empty(); + buffer += attrs & 0x20 ? 'H' : '-'; + buffer += attrs & 0x40 ? 'V' : '-'; + GetDlgItem(IDC_FLIP)->SetWindowText(buffer); + + if(gbCgbMode) { + buffer.Format("%d", (attrs & 7)); + } else + buffer = "---"; + GetDlgItem(IDC_PALETTE_NUM)->SetWindowText(buffer); + + buffer.Empty(); + if(gbCgbMode) + buffer += attrs & 0x80 ? 'P' : '-'; + else + buffer += '-'; + GetDlgItem(IDC_PRIORITY)->SetWindowText(buffer); + + return TRUE; +} + +LRESULT GBMapView::OnColInfo(WPARAM wParam, LPARAM) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + +void GBMapView::PostNcDestroy() +{ + delete this; + CDialog::PostNcDestroy(); +} diff --git a/src/win32/GBMapView.h b/src/win32/GBMapView.h new file mode 100644 index 0000000..2b2b006 --- /dev/null +++ b/src/win32/GBMapView.h @@ -0,0 +1,102 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBMAPVIEW_H__4CD23D38_F2CD_4B95_AE76_2781591DD077__INCLUDED_) +#define AFX_GBMAPVIEW_H__4CD23D38_F2CD_4B95_AE76_2781591DD077__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBMapView.h : header file +// + +#include "BitmapControl.h" +#include "ColorControl.h" +#include "ZoomControl.h" +#include "ResizeDlg.h" +#include "IUpdate.h" +#include "..\System.h" // Added by ClassView + +///////////////////////////////////////////////////////////////////////////// +// GBMapView dialog + +class GBMapView : public ResizeDlg, IUpdateListener +{ + private: + BITMAPINFO bmpInfo; + u8 *data; + int bank; + int bg; + int w; + int h; + BitmapControl mapView; + ZoomControl mapViewZoom; + ColorControl color; + bool autoUpdate; + // Construction + public: + afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + u32 GetClickAddress(int x, int y); + void update(); + void paint(); + void render(); + void savePNG(const char *name); + void saveBMP(const char *name); + ~GBMapView(); + GBMapView(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GBMapView) + enum { IDD = IDD_GB_MAP_VIEW }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBMapView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBMapView) + afx_msg void OnSave(); + afx_msg void OnRefresh(); + virtual BOOL OnInitDialog(); + afx_msg void OnBg0(); + afx_msg void OnBg1(); + afx_msg void OnBank0(); + afx_msg void OnBank1(); + afx_msg void OnStretch(); + afx_msg void OnAutoUpdate(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBMAPVIEW_H__4CD23D38_F2CD_4B95_AE76_2781591DD077__INCLUDED_) diff --git a/src/win32/GBMemoryViewerDlg.cpp b/src/win32/GBMemoryViewerDlg.cpp new file mode 100644 index 0000000..d7b2182 --- /dev/null +++ b/src/win32/GBMemoryViewerDlg.cpp @@ -0,0 +1,442 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBMemoryViewerDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBMemoryViewerDlg.h" +#include "MemoryViewerAddressSize.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../gb/gbGlobals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +GBMemoryViewer::GBMemoryViewer() + : MemoryViewer() +{ + setAddressSize(1); +} + +void GBMemoryViewer::readData(u32 address, int len, u8 *data) +{ + u16 addr = address & 0xffff; + if(emulating && gbRom != NULL) { + for(int i = 0; i < len; i++) { + *data++ = gbMemoryMap[addr >> 12][addr & 0xfff]; + addr++; + } + } else { + for(int i = 0; i < len; i++) { + *data++ = 0; + addr++; + } + } +} + +#define GB_READBYTE_QUICK(addr) \ + gbMemoryMap[(addr) >> 12][(addr) & 0xfff] + +#define GB_WRITEBYTE_QUICK(addr,v) \ + gbMemoryMap[(addr) >> 12][(addr) & 0xfff] = (v) + +void GBMemoryViewer::editData(u32 address, int size, int mask, u32 value) +{ + u32 oldValue; + u16 addr = (u16)address & 0xffff; + switch(size) { + case 8: + oldValue = GB_READBYTE_QUICK(addr); + oldValue &= mask; + oldValue |= (u8)value; + GB_WRITEBYTE_QUICK(addr, oldValue); + break; + case 16: + oldValue = GB_READBYTE_QUICK(addr) | + (GB_READBYTE_QUICK(addr + 1) << 8); + oldValue &= mask; + oldValue |= (u16)value; + GB_WRITEBYTE_QUICK(addr, (oldValue & 255)); + GB_WRITEBYTE_QUICK(addr+1, (oldValue >> 8)); + break; + case 32: + oldValue = GB_READBYTE_QUICK(addr) | + (GB_READBYTE_QUICK(addr + 1) << 8) | + (GB_READBYTE_QUICK(addr + 2) << 16) | + (GB_READBYTE_QUICK(addr + 3) << 24); + oldValue &= mask; + oldValue |= (u32)value; + GB_WRITEBYTE_QUICK(addr, (oldValue & 255)); + GB_WRITEBYTE_QUICK(addr+1, (oldValue >> 8)); + GB_WRITEBYTE_QUICK(addr+2, (oldValue >> 16)); + GB_WRITEBYTE_QUICK(addr+3, (oldValue >> 24)); + break; + } +} + +///////////////////////////////////////////////////////////////////////////// +// GBMemoryViewerDlg dialog + + +GBMemoryViewerDlg::GBMemoryViewerDlg(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBMemoryViewerDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBMemoryViewerDlg) + m_size = -1; + //}}AFX_DATA_INIT + autoUpdate = false; + + autoUpdate = !regQueryDwordValue("memViewerAutoUpdate", 1); + OnAutoUpdate(); // inverts and update dialog + + decimalDisplay = !regQueryDwordValue("memViewerDecimalDisplay", 0); + OnDecimalDisplay(); +} + + +void GBMemoryViewerDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBMemoryViewerDlg) + DDX_Control(pDX, IDC_CURRENT_ADDRESS, m_current); + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Control(pDX, IDC_ADDRESSES, m_addresses); + DDX_Radio(pDX, IDC_8_BIT, m_size); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_VIEWER, m_viewer); +} + + +BEGIN_MESSAGE_MAP(GBMemoryViewerDlg, CDialog) + //{{AFX_MSG_MAP(GBMemoryViewerDlg) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_8_BIT, On8Bit) + ON_BN_CLICKED(IDC_16_BIT, On16Bit) + ON_BN_CLICKED(IDC_32_BIT, On32Bit) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_DECIMALDISPLAY, OnDecimalDisplay) + ON_BN_CLICKED(IDC_GO, OnGo) + ON_CBN_SELCHANGE(IDC_ADDRESSES, OnSelchangeAddresses) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_LOAD, OnLoad) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBMemoryViewerDlg message handlers + +BOOL GBMemoryViewerDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_VIEWER, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_LOAD, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_AUTO_UPDATE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_DECIMALDISPLAY, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CURRENT_ADDRESS_LABEL, DS_MoveY | DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_CURRENT_ADDRESS, DS_MoveY | DS_MoveX) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBMemoryView", + NULL); + + m_viewer.setDialog(this); + m_viewer.ShowScrollBar(SB_VERT, TRUE); + m_viewer.EnableScrollBar(SB_VERT, ESB_ENABLE_BOTH); + + LPCTSTR s[] = { + "0x0000 - ROM", + "0x4000 - ROM", + "0x8000 - VRAM", + "0xA000 - SRAM", + "0xC000 - RAM", + "0xD000 - WRAM", + "0xFF00 - I/O", + "0xFF80 - RAM" + }; + + for(int i = 0; i < 8; i++) + m_addresses.AddString(s[i]); + + m_addresses.SetCurSel(0); + + RECT cbSize; + int Height; + + m_addresses.GetClientRect(&cbSize); + Height = m_addresses.GetItemHeight(-1); + Height += m_addresses.GetItemHeight(0) * (9); + + // Note: The use of SM_CYEDGE assumes that we're using Windows '95 + // Now add on the height of the border of the edit box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // The height of the border of the drop-down box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // now set the size of the window + m_addresses.SetWindowPos(NULL, + 0, 0, + cbSize.right, Height, + SWP_NOMOVE | SWP_NOZORDER); + + m_address.LimitText(8); + + m_size = regQueryDwordValue("memViewerDataSize", 0); + if(m_size < 0 || m_size > 2) + m_size = 0; + m_viewer.setSize(m_size); + UpdateData(FALSE); + + m_current.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT))); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBMemoryViewerDlg::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +void GBMemoryViewerDlg::OnRefresh() +{ + m_viewer.Invalidate(); +} + +void GBMemoryViewerDlg::update() +{ + OnRefresh(); +} + +void GBMemoryViewerDlg::On8Bit() +{ + m_viewer.setSize(0); + regSetDwordValue("memViewerDataSize", 0); +} + +void GBMemoryViewerDlg::On16Bit() +{ + m_viewer.setSize(1); + regSetDwordValue("memViewerDataSize", 1); +} + +void GBMemoryViewerDlg::On32Bit() +{ + m_viewer.setSize(2); + regSetDwordValue("memViewerDataSize", 2); +} + +void GBMemoryViewerDlg::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } + if(GetDlgItem(IDC_AUTO_UPDATE)) + ((CButton *)GetDlgItem(IDC_AUTO_UPDATE))->SetCheck(autoUpdate ? TRUE : FALSE); + regSetDwordValue("memViewerAutoUpdate", autoUpdate); +} + +void GBMemoryViewerDlg::OnDecimalDisplay() +{ + decimalDisplay = !decimalDisplay; + m_viewer.setDecimal(decimalDisplay ? true : false); + if(GetDlgItem(IDC_DECIMAL_DISPLAY)) + ((CButton *)GetDlgItem(IDC_DECIMAL_DISPLAY))->SetCheck(decimalDisplay ? TRUE : FALSE); + + regSetDwordValue("memViewerDecimalDisplay", decimalDisplay); +} + +void GBMemoryViewerDlg::OnGo() +{ + CString buffer; + + m_address.GetWindowText(buffer); + + u32 address; + sscanf(buffer, "%x", &address); + if(m_viewer.getSize() == 1) + address &= ~1; + else if(m_viewer.getSize() == 2) + address &= ~3; + m_viewer.setAddress(address); +} + +void GBMemoryViewerDlg::OnSelchangeAddresses() +{ + int cur = m_addresses.GetCurSel(); + + switch(cur) { + case 0: + m_viewer.setAddress(0x0000); + break; + case 1: + m_viewer.setAddress(0x4000); + break; + case 2: + m_viewer.setAddress(0x8000); + break; + case 3: + m_viewer.setAddress(0xa000); + break; + case 4: + m_viewer.setAddress(0xc000); + break; + case 5: + m_viewer.setAddress(0xd000); + break; + case 6: + m_viewer.setAddress(0xff00); + break; + case 7: + m_viewer.setAddress(0xff80); + break; + } +} + +void GBMemoryViewerDlg::setCurrentAddress(u32 address) +{ + CString buffer; + + buffer.Format("0x%08X", address); + m_current.SetWindowText(buffer); +} + +void GBMemoryViewerDlg::OnSave() +{ + MemoryViewerAddressSize dlg; + CString buffer; + + dlg.setAddress(m_viewer.getCurrentAddress()); + + LPCTSTR exts[] = { ".dmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_DUMP); + CString title = winResLoadString(IDS_SELECT_DUMP_FILE); + + if(dlg.DoModal() == IDOK) { + FileDlg file(this, + buffer, + filter, + 0, + "DMP", + exts, + "", + title, + true); + if(file.DoModal() == IDOK) { + buffer = file.GetPathName(); + FILE *f = fopen(buffer, "wb"); + + if(f == NULL) { + systemMessage(IDS_ERROR_CREATING_FILE, buffer); + return; + } + + int size = dlg.getSize(); + u16 addr = dlg.getAddress() & 0xffff; + + for(int i = 0; i < size; i++) { + fputc(gbMemoryMap[addr >> 12][addr & 0xfff], f); + addr++; + } + + fclose(f); + } + } +} + +void GBMemoryViewerDlg::OnLoad() +{ + CString buffer; + LPCTSTR exts[] = { ".dmp" }; + CString filter = theApp.winLoadFilter(IDS_FILTER_DUMP); + CString title = winResLoadString(IDS_SELECT_DUMP_FILE); + + FileDlg file(this, + buffer, + filter, + 0, + "DMP", + exts, + "", + title, + false); + + if(file.DoModal() == IDOK) { + buffer = file.GetPathName(); + FILE *f = fopen(buffer, "rb"); + if(f == NULL) { + systemMessage(IDS_CANNOT_OPEN_FILE, + "Cannot open file %s", + buffer); + return; + } + + MemoryViewerAddressSize dlg; + + fseek(f, 0, SEEK_END); + int size = ftell(f); + + fseek(f, 0, SEEK_SET); + + dlg.setAddress(m_viewer.getCurrentAddress()); + dlg.setSize(size); + + if(dlg.DoModal() == IDOK) { + int size = dlg.getSize(); + u16 addr = dlg.getAddress() & 0xffff; + + for(int i = 0; i < size; i++) { + int c = fgetc(f); + if(c == -1) + break; + gbMemoryMap[addr >> 12][addr & 0xfff] = c; + addr++; + } + OnRefresh(); + } + fclose(f); + } +} + +void GBMemoryViewerDlg::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/GBMemoryViewerDlg.h b/src/win32/GBMemoryViewerDlg.h new file mode 100644 index 0000000..ad2e2d7 --- /dev/null +++ b/src/win32/GBMemoryViewerDlg.h @@ -0,0 +1,96 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBMEMORYVIEWERDLG_H__23AD2804_EFA5_4900_AEC5_47196A41C50D__INCLUDED_) +#define AFX_GBMEMORYVIEWERDLG_H__23AD2804_EFA5_4900_AEC5_47196A41C50D__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBMemoryViewerDlg.h : header file +// +#include "MemoryViewer.h" +#include "ResizeDlg.h" +#include "IUpdate.h" + +class GBMemoryViewer : public MemoryViewer { + public: + GBMemoryViewer(); + virtual void readData(u32, int, u8 *); + virtual void editData(u32, int, int, u32); +}; + +///////////////////////////////////////////////////////////////////////////// +// GBMemoryViewerDlg dialog + +class GBMemoryViewerDlg : public ResizeDlg, IUpdateListener, IMemoryViewerDlg +{ + GBMemoryViewer m_viewer; + bool autoUpdate; + int decimalDisplay; + // Construction + public: + void setCurrentAddress(u32 address); + GBMemoryViewerDlg(CWnd* pParent = NULL); // standard constructor + + virtual void update(); + + // Dialog Data + //{{AFX_DATA(GBMemoryViewerDlg) + enum { IDD = IDD_MEM_VIEWER }; + CEdit m_current; + CEdit m_address; + CComboBox m_addresses; + int m_size; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBMemoryViewerDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBMemoryViewerDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + afx_msg void OnRefresh(); + afx_msg void On8Bit(); + afx_msg void On16Bit(); + afx_msg void On32Bit(); + afx_msg void OnAutoUpdate(); + afx_msg void OnDecimalDisplay(); + afx_msg void OnGo(); + afx_msg void OnSelchangeAddresses(); + afx_msg void OnSave(); + afx_msg void OnLoad(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBMEMORYVIEWERDLG_H__23AD2804_EFA5_4900_AEC5_47196A41C50D__INCLUDED_) diff --git a/src/win32/GBOamView.cpp b/src/win32/GBOamView.cpp new file mode 100644 index 0000000..7963f0b --- /dev/null +++ b/src/win32/GBOamView.cpp @@ -0,0 +1,599 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBOamView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBOamView.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../NLS.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBOamView dialog + + +GBOamView::GBOamView(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBOamView::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBOamView) + m_stretch = FALSE; + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 8; + bmpInfo.bmiHeader.biHeight = 16; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 8 * 16); + + oamView.setData(data); + oamView.setBmpInfo(&bmpInfo); + + number = 0; +} + + +void GBOamView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBOamView) + DDX_Control(pDX, IDC_SPRITE, m_sprite); + DDX_Check(pDX, IDC_STRETCH, m_stretch); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_COLOR, color); + DDX_Control(pDX, IDC_OAM_VIEW, oamView); + DDX_Control(pDX, IDC_OAM_VIEW_ZOOM, oamZoom); +} + + +BEGIN_MESSAGE_MAP(GBOamView, CDialog) + //{{AFX_MSG_MAP(GBOamView) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_EN_CHANGE(IDC_SPRITE, OnChangeSprite) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_WM_HSCROLL() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBOamView message handlers + +GBOamView::~GBOamView() +{ + free(data); + data = NULL; +} + + +void GBOamView::paint() +{ + if(gbRom == NULL) + return; + + render(); + oamView.setSize(w,h); + oamView.refresh(); +} + +void GBOamView::update() +{ + paint(); +} + + +void GBOamView::setAttributes(int y, int x, int tile, int flags) +{ + CString buffer; + + int flipH = flags & 0x20; + int flipV = flags & 0x40; + int prio = (flags & 0x80) >> 7; + int pal = flags & 0x7; + int oap = (flags & 0x08) >> 3; + int bank = (flags & 0x10) >> 4; + + buffer.Format("%d,%d", x,y); + GetDlgItem(IDC_POS)->SetWindowText(buffer); + + buffer.Format("%d", pal); + GetDlgItem(IDC_PALETTE)->SetWindowText(buffer); + + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE)->SetWindowText(buffer); + + buffer.Format("%d", prio); + GetDlgItem(IDC_PRIO)->SetWindowText(buffer); + + buffer.Format("%d", bank); + GetDlgItem(IDC_BANK)->SetWindowText(buffer); + + buffer.Empty(); + if(flipH) + buffer += 'H'; + else + buffer += ' '; + if(flipV) + buffer += 'V'; + else + buffer += ' '; + GetDlgItem(IDC_FLAGS)->SetWindowText(buffer); + + buffer.Format("%d", oap); + GetDlgItem(IDC_OAP)->SetWindowText(buffer); +} + +void GBOamView::render() +{ + int m=0; + if(gbRom == NULL) + return; + + u16 addr = number * 4 + 0xfe00; + + int size = register_LCDC & 4; + + u8 y = gbMemory[addr++]; + u8 x = gbMemory[addr++]; + u8 tile = gbMemory[addr++]; + if(size) + tile &= 254; + u8 flags = gbMemory[addr++]; + + u8 *bmp = data; + + w = 8; + h = size ? 16 : 8; + + setAttributes(y, x, tile, flags); + + u8 * bank0; + u8 * bank1; + if(gbCgbMode) { + if(register_VBK & 1) { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } else { + bank0 = &gbVram[0x0000]; + bank1 = &gbVram[0x2000]; + } + } else { + bank0 = &gbMemory[0x8000]; + bank1 = NULL; + } + + int init = 0x0000; + + u8 *pal = gbObp0; + + if((flags & 0x10)) + pal = gbObp1; + + for(int yy = 0; yy < h; yy++) { + int address = init + tile * 16 + 2*yy; + int a = 0; + int b = 0; + + if(gbCgbMode && flags & 0x08) { + a = bank1[address++]; + b = bank1[address++]; + } else { + a = bank0[address++]; + b = bank0[address++]; + } + + for(int xx = 0; xx < 8; xx++) { + u8 mask = 1 << (7-xx); + u8 c = 0; + if( (a & mask)) + c++; + if( (b & mask)) + c+=2; + + // make sure that sprites will work even in CGB mode + if(gbCgbMode) { + c = c + (flags & 0x07)*4 + 32; + } else { + c = pal[c]; + } + + u16 color = gbPalette[c]; + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + } + } +} + +void GBOamView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + +void GBOamView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + + +void GBOamView::save() +{ + CString captureBuffer; + + if(theApp.captureFormat == 0) + captureBuffer = "oam.png"; + else + captureBuffer = "oam.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + captureBuffer, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + captureBuffer = dlg.GetPathName(); + + if(dlg.getFilterIndex() == 2) + saveBMP(captureBuffer); + else + savePNG(captureBuffer); +} + +BOOL GBOamView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_OAM_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_OAM_VIEW_ZOOM, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBOamView", + NULL); + m_sprite.SetWindowText("0"); + + updateScrollInfo(); + + m_stretch = regQueryDwordValue("GBOamViewStretch", 0); + if(m_stretch) + oamView.setStretch(true); + UpdateData(FALSE); + + paint(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBOamView::OnStretch() +{ + oamView.setStretch(!oamView.getStretch()); + paint(); + regSetDwordValue("GBOamViewStretch", oamView.getStretch()); +} + +void GBOamView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + + +void GBOamView::OnChangeSprite() +{ + CString buffer; + m_sprite.GetWindowText(buffer); + int n = atoi(buffer); + if(n < 0 || n > 39) { + buffer.Format("%d", number); + m_sprite.SetWindowText(buffer); + return; + } + number = n; + paint(); + updateScrollInfo(); +} + +void GBOamView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +LRESULT GBOamView::OnMapInfo(WPARAM, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + oamZoom.setColors(colors); + + return TRUE; +} + +LRESULT GBOamView::OnColInfo(WPARAM wParam, LPARAM lParam) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + + +void GBOamView::updateScrollInfo() +{ + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL | SIF_POS; + si.nMin = 0; + si.nMax = 39; + si.nPage = 1; + si.nPos = number; + GetDlgItem(IDC_SCROLLBAR)->SetScrollInfo(SB_CTL, + &si, + TRUE); +} + + +void GBOamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + switch(nSBCode) { + case SB_BOTTOM: + number = 39; + break; + case SB_LINEDOWN: + number++; + if(number > 39) + number = 39; + break; + case SB_LINEUP: + number--; + if(number < 0) + number = 0; + break; + case SB_PAGEDOWN: + number += 16; + if(number > 39) + number = 39; + break; + case SB_PAGEUP: + number -= 16; + if(number < 0) + number = 0; + break; + case SB_TOP: + number = 0; + break; + case SB_THUMBTRACK: + number = nPos; + if(number < 0) + number = 0; + if(number > 39) + number = 39; + break; + } + + updateScrollInfo(); + + CString buffer; + buffer.Format("%d", number); + m_sprite.SetWindowText(buffer); + paint(); +} + +void GBOamView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/GBOamView.h b/src/win32/GBOamView.h new file mode 100644 index 0000000..663ade0 --- /dev/null +++ b/src/win32/GBOamView.h @@ -0,0 +1,103 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBOAMVIEW_H__FE8105E6_9693_479A_8C57_DEEA1B2EA3D6__INCLUDED_) +#define AFX_GBOAMVIEW_H__FE8105E6_9693_479A_8C57_DEEA1B2EA3D6__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBOamView.h : header file +// + +#include "BitmapControl.h" +#include "ZoomControl.h" +#include "ColorControl.h" + +#include "IUpdate.h" +#include "ResizeDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// GBOamView dialog + +class GBOamView : public ResizeDlg, IUpdateListener +{ + private: + BITMAPINFO bmpInfo; + u8 *data; + int w; + int h; + int number; + bool autoUpdate; + BitmapControl oamView; + ZoomControl oamZoom; + ColorControl color; + + + // Construction + public: + void updateScrollInfo(); + void save(); + void savePNG(const char *name); + void saveBMP(const char *name); + void render(); + void setAttributes(int y, int x, int tile, int flags); + void paint(); + ~GBOamView(); + GBOamView(CWnd* pParent = NULL); // standard constructor + + afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + virtual void update(); + + // Dialog Data + //{{AFX_DATA(GBOamView) + enum { IDD = IDD_GB_OAM_VIEW }; + CEdit m_sprite; + BOOL m_stretch; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBOamView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBOamView) + virtual BOOL OnInitDialog(); + afx_msg void OnStretch(); + afx_msg void OnAutoUpdate(); + afx_msg void OnChangeSprite(); + afx_msg void OnClose(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBOAMVIEW_H__FE8105E6_9693_479A_8C57_DEEA1B2EA3D6__INCLUDED_) diff --git a/src/win32/GBPaletteView.cpp b/src/win32/GBPaletteView.cpp new file mode 100644 index 0000000..522ba15 --- /dev/null +++ b/src/win32/GBPaletteView.cpp @@ -0,0 +1,243 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBPaletteView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBPaletteView.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../gb/gbGlobals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +void GBPaletteViewControl::updatePalette() +{ + if(gbRom) { + memcpy(palette, &gbPalette[paletteAddress], 64); + } +} + +///////////////////////////////////////////////////////////////////////////// +// GBPaletteView dialog + + +GBPaletteView::GBPaletteView(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBPaletteView::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBPaletteView) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + autoUpdate = false; +} + +GBPaletteView::~GBPaletteView() +{ +} + +void GBPaletteView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBPaletteView) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_PALETTE_VIEW, paletteView); + DDX_Control(pDX, IDC_PALETTE_VIEW_OBJ, paletteViewOBJ); + DDX_Control(pDX, IDC_COLOR, colorControl); +} + + +BEGIN_MESSAGE_MAP(GBPaletteView, CDialog) + //{{AFX_MSG_MAP(GBPaletteView) + ON_BN_CLICKED(IDC_SAVE_BG, OnSaveBg) + ON_BN_CLICKED(IDC_SAVE_OBJ, OnSaveObj) + ON_BN_CLICKED(IDC_REFRESH2, OnRefresh2) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + //}}AFX_MSG_MAP + ON_MESSAGE(WM_PALINFO, OnPalInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBPaletteView message handlers + +BOOL GBPaletteView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_END() + SetData(sz, + FALSE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBPaletteView", + NULL); + + paletteView.init(32, 64, 128); + paletteViewOBJ.init(32, 64, 128); + + paletteView.setPaletteAddress(0); + paletteView.refresh(); + + paletteViewOBJ.setPaletteAddress(32); + paletteViewOBJ.refresh(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBPaletteView::save(int which) +{ + CString captureBuffer; + + if(which == 0) + captureBuffer = "bg.pal"; + else + captureBuffer = "obj.pal"; + + LPCTSTR exts[] = {".pal", ".pal", ".act" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PAL); + CString title = winResLoadString(IDS_SELECT_PALETTE_NAME); + FileDlg dlg(this, + captureBuffer, + filter, + 1, + "PAL", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + PaletteViewControl *p = NULL; + + if(which == 0) + p = &paletteView; + else + p = &paletteViewOBJ; + + switch(dlg.getFilterIndex()) { + case 0: + case 1: + p->saveMSPAL(captureBuffer); + break; + case 2: + p->saveJASCPAL(captureBuffer); + break; + case 3: + p->saveAdobe(captureBuffer); + break; + } +} + + +void GBPaletteView::OnSaveBg() +{ + save(0); +} + +void GBPaletteView::OnSaveObj() +{ + save(1); +} + +void GBPaletteView::OnRefresh2() +{ + paletteView.refresh(); + paletteViewOBJ.refresh(); +} + +void GBPaletteView::update() +{ + OnRefresh2(); +} + + +void GBPaletteView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + + +void GBPaletteView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +LRESULT GBPaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) +{ + u16 color = (u16)wParam; + u32 address = (u32)lParam; + CString buffer; + + bool isOBJ = address >= 32; + address &= 31; + + buffer.Format("%d", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + int r = (color & 0x1f); + int g = (color & 0x3e0) >> 5; + int b = (color & 0x7c00) >> 10; + + buffer.Format("%d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("%d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("%d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + + buffer.Format("0x%04X", color); + GetDlgItem(IDC_VALUE)->SetWindowText(buffer); + + colorControl.setColor(color); + + if(isOBJ) + paletteView.setSelected(-1); + else + paletteViewOBJ.setSelected(-1); + + return TRUE; +} + +void GBPaletteView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/GBPaletteView.h b/src/win32/GBPaletteView.h new file mode 100644 index 0000000..0d2d71f --- /dev/null +++ b/src/win32/GBPaletteView.h @@ -0,0 +1,90 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBPALETTEVIEW_H__F909FF55_3021_4301_B017_0C2C9D8D8C08__INCLUDED_) +#define AFX_GBPALETTEVIEW_H__F909FF55_3021_4301_B017_0C2C9D8D8C08__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBPaletteView.h : header file +// + +#include "ColorControl.h" +#include "IUpdate.h" +#include "PaletteViewControl.h" +#include "ResizeDlg.h" + +class GBPaletteViewControl : public PaletteViewControl { + public: + virtual void updatePalette(); +}; + +///////////////////////////////////////////////////////////////////////////// +// GBPaletteView dialog + +class GBPaletteView : public ResizeDlg, IUpdateListener +{ + private: + GBPaletteViewControl paletteView; + GBPaletteViewControl paletteViewOBJ; + ColorControl colorControl; + bool autoUpdate; + // Construction + public: + void save(int which); + GBPaletteView(CWnd* pParent = NULL); // standard constructor + virtual ~GBPaletteView(); + + // Dialog Data + //{{AFX_DATA(GBPaletteView) + enum { IDD = IDD_GB_PALETTE_VIEW }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBPaletteView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + virtual void update(); + + // Implementation + protected: + afx_msg virtual LRESULT OnPalInfo(WPARAM wParam, LPARAM lParam); + // Generated message map functions + //{{AFX_MSG(GBPaletteView) + virtual BOOL OnInitDialog(); + afx_msg void OnSaveBg(); + afx_msg void OnSaveObj(); + afx_msg void OnRefresh2(); + afx_msg void OnAutoUpdate(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBPALETTEVIEW_H__F909FF55_3021_4301_B017_0C2C9D8D8C08__INCLUDED_) diff --git a/src/win32/GBPrinterDlg.cpp b/src/win32/GBPrinterDlg.cpp new file mode 100644 index 0000000..9f28fdc --- /dev/null +++ b/src/win32/GBPrinterDlg.cpp @@ -0,0 +1,494 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBPrinter.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBPrinterDlg.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../NLS.h" +#include "../Util.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBPrinter dialog + + +GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) + : CDialog(GBPrinterDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBPrinterDlg) + m_scale = -1; + //}}AFX_DATA_INIT + bitmap = (BITMAPINFO *)bitmapHeader; + + bitmap->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmap->bmiHeader.biWidth = 160; + bitmap->bmiHeader.biHeight = -144; + bitmap->bmiHeader.biPlanes = 1; + bitmap->bmiHeader.biBitCount = 8; + bitmap->bmiHeader.biCompression = BI_RGB; + bitmap->bmiHeader.biSizeImage = 160*144; + bitmap->bmiHeader.biXPelsPerMeter = 0; + bitmap->bmiHeader.biYPelsPerMeter = 0; + bitmap->bmiHeader.biClrUsed = 4; + bitmap->bmiHeader.biClrImportant = 4; + bitmap->bmiColors[0].rgbBlue = + bitmap->bmiColors[0].rgbGreen = + bitmap->bmiColors[0].rgbRed = + 255; + bitmap->bmiColors[0].rgbReserved = 0; + bitmap->bmiColors[1].rgbBlue = + bitmap->bmiColors[1].rgbGreen = + bitmap->bmiColors[1].rgbRed = + 168; + bitmap->bmiColors[1].rgbReserved = 0; + bitmap->bmiColors[2].rgbBlue = + bitmap->bmiColors[2].rgbGreen = + bitmap->bmiColors[2].rgbRed = + 96; + bitmap->bmiColors[2].rgbReserved = 0; + bitmap->bmiColors[3].rgbBlue = + bitmap->bmiColors[3].rgbGreen = + bitmap->bmiColors[3].rgbRed = + 0; + bitmap->bmiColors[3].rgbReserved = 0; +} + + +void GBPrinterDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBPrinterDlg) + DDX_Radio(pDX, IDC_1X, m_scale); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GBPrinterDlg, CDialog) + //{{AFX_MSG_MAP(GBPrinterDlg) + ON_BN_CLICKED(ID_SAVE, OnSave) + ON_BN_CLICKED(ID_PRINT, OnPrint) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(IDC_1X, On1x) + ON_BN_CLICKED(IDC_2X, On2x) + ON_BN_CLICKED(IDC_3X, On3x) + ON_BN_CLICKED(IDC_4X, On4x) + ON_WM_PAINT() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBPrinter message handlers + +void GBPrinterDlg::saveAsBMP(const char *name) +{ + u8 writeBuffer[512 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + 160*144*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, 160); + utilPutDword(bmpheader.height, 144); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 160*144); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + u8 *data = (u8 *)bitmapData; + u8 *p = data + (160*143); + for(int y = 0; y < 144; y++) { + for(int x = 0; x < 160; x++) { + u8 c = *p++; + + *b++ = bitmap->bmiColors[c].rgbBlue; + *b++ = bitmap->bmiColors[c].rgbGreen; + *b++ = bitmap->bmiColors[c].rgbRed; + } + p -= 2*(160); + fwrite(writeBuffer, 1, 3*160, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + +void GBPrinterDlg::saveAsPNG(const char *name) +{ + u8 writeBuffer[160 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", + name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + 160, + 144, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = 160; + int sizeY = 144; + + u8 *pixU8 = (u8 *)bitmapData; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u8 c = *pixU8++; + *b++ = bitmap->bmiColors[c].rgbRed; + *b++ = bitmap->bmiColors[c].rgbGreen; + *b++ = bitmap->bmiColors[c].rgbBlue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + + +void GBPrinterDlg::OnSave() +{ + CString captureBuffer; + + if(theApp.captureFormat == 0) + captureBuffer = "printer.png"; + else + captureBuffer = "printer.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + captureBuffer, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + captureBuffer = dlg.GetPathName(); + + if(dlg.getFilterIndex() == 2) + saveAsBMP(captureBuffer); + else + saveAsPNG(captureBuffer); +} + +void GBPrinterDlg::OnPrint() +{ + CPrintDialog dlg(FALSE); + + dlg.m_pd.nFromPage = 1; + dlg.m_pd.nToPage = 1; + dlg.m_pd.nMinPage = 1; + dlg.m_pd.nMaxPage = 1; + dlg.m_pd.nCopies = 1; + + if(dlg.DoModal() == IDOK) { + DOCINFO di; + float fLogPelsX1 = 0; + float fLogPelsX2 = 0; + float fLogPelsY1 = 0; + float fLogPelsY2 = 0; + float fScaleX = 0, fScaleY = 0; + CDC *winDC = NULL; + memset(&di, 0, sizeof(di)); + di.cbSize = sizeof(DOCINFO); + CString docName = winResLoadString(IDS_POCKET_PRINTER); + di.lpszDocName = docName; + CDC dc; + dc.Attach(dlg.GetPrinterDC()); + int nError = dc.StartDoc(&di); + + if(nError == SP_ERROR) { + systemMessage(IDS_ERROR_ON_STARTDOC,"Error on StartDoc"); + goto error; + } + nError = dc.StartPage(); + if(nError <= 0) { + systemMessage(IDS_ERROR_ON_STARTPAGE, "Error on StartPage"); + goto error; + } + + winDC = GetDC(); + fLogPelsX1 = (float)winDC->GetDeviceCaps(LOGPIXELSX); + fLogPelsY1 = (float)winDC->GetDeviceCaps(LOGPIXELSY); + ReleaseDC(winDC); + + fLogPelsX2 = (float)dc.GetDeviceCaps(LOGPIXELSX); + fLogPelsY2 = (float)dc.GetDeviceCaps(LOGPIXELSY); + + if(fLogPelsX1 > fLogPelsX2) + fScaleX = fLogPelsX1 / fLogPelsX2; + else + fScaleX = fLogPelsX2 / fLogPelsX1; + + if(fLogPelsY1 > fLogPelsY2) + fScaleY = fLogPelsY1 / fLogPelsY2; + else + fScaleY = fLogPelsY2 / fLogPelsY1; + + fScaleX *= (scale+1); + fScaleY *= (scale+1); + + if(StretchDIBits(dc, + 0, + 0, + (int)((float)160*fScaleX), + (int)((float)144*fScaleY), + 0, + 0, + 160, + 144, + bitmapData, + bitmap, + DIB_RGB_COLORS, + SRCCOPY) == GDI_ERROR) { + systemMessage(IDS_ERROR_PRINTING_ON_STRETCH, + "Error printing on StretchDIBits"); + } + + nError = dc.EndPage(); + + if(nError <= 0) { + systemMessage(IDS_ERROR_ON_ENDPAGE, "Error on EndPage"); + goto error; + } + + nError = dc.EndDoc(); + + if(nError <= 0) + systemMessage(IDS_ERROR_ON_ENDDOC, "Error on EndDoc"); + error: + dc.DeleteDC(); + } +} + +void GBPrinterDlg::processData(u8 *data) +{ + for(int y = 0; y < 0x12; y++) { + for(int x = 0; x < 0x14; x++) { + for(int k = 0; k < 8; k++) { + int a = *data++; + int b = *data++; + for(int j = 0; j < 8; j++) { + int mask = 1 << (7-j); + int c = 0; + if(a & mask) + c++; + if(b & mask) + c+=2; + bitmapData[x*8+j + 160*(y*8+k)] = c; + } + } + } + } +} + + +BOOL GBPrinterDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + scale = regQueryDwordValue("printerScale", 0); + if(scale < 0 || scale > 3) + scale = 0; + m_scale = scale; + UpdateData(FALSE); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBPrinterDlg::OnOk() +{ + EndDialog(TRUE); +} + +void GBPrinterDlg::On1x() +{ + regSetDwordValue("printerScale", 0); + scale = 0; +} + +void GBPrinterDlg::On2x() +{ + regSetDwordValue("printerScale", 1); + scale = 1; +} + +void GBPrinterDlg::On3x() +{ + regSetDwordValue("printerScale", 2); + scale = 2; +} + +void GBPrinterDlg::On4x() +{ + regSetDwordValue("printerScale", 3); + scale = 3; +} + +void GBPrinterDlg::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT rect; + CWnd *h = GetDlgItem(IDC_GB_PRINTER); + h->GetWindowRect(&rect); + POINT p; + p.x = rect.left; + p.y = rect.top; + ScreenToClient((POINT *)&p); + rect.left = p.x+1; + rect.top = p.y+1; + p.x = rect.right; + p.y = rect.bottom; + ScreenToClient((POINT *)&p); + rect.right = p.x-1; + rect.bottom = p.y-1; + + StretchDIBits(dc, + rect.left, + rect.top, + rect.right - rect.left, + rect.bottom - rect.top, + 0, + 0, + 160, + 144, + bitmapData, + bitmap, + DIB_RGB_COLORS, + SRCCOPY); +} + +void systemGbPrint(u8 *data, + int pages, + int feed, + int palette, + int contrast) +{ + theApp.winCheckFullscreen(); + GBPrinterDlg printer; + printer.processData(data); + printer.DoModal(); +} + diff --git a/src/win32/GBPrinterDlg.h b/src/win32/GBPrinterDlg.h new file mode 100644 index 0000000..506de51 --- /dev/null +++ b/src/win32/GBPrinterDlg.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBPRINTER_H__3180CC5A_1F9D_47E5_B044_407442CB40A4__INCLUDED_) +#define AFX_GBPRINTER_H__3180CC5A_1F9D_47E5_B044_407442CB40A4__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBPrinter.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// GBPrinter dialog + +class GBPrinterDlg : public CDialog +{ + private: + u8 bitmapHeader[sizeof(BITMAPINFO)+4*sizeof(RGBQUAD)]; + BITMAPINFO *bitmap; + u8 bitmapData[160*144]; + int scale; + // Construction + public: + void processData(u8 *data); + void saveAsPNG(const char *name); + void saveAsBMP(const char *name); + GBPrinterDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GBPrinterDlg) + enum { IDD = IDD_GB_PRINTER }; + int m_scale; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBPrinterDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GBPrinterDlg) + afx_msg void OnSave(); + afx_msg void OnPrint(); + virtual BOOL OnInitDialog(); + afx_msg void OnOk(); + afx_msg void On1x(); + afx_msg void On2x(); + afx_msg void On3x(); + afx_msg void On4x(); + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBPRINTER_H__3180CC5A_1F9D_47E5_B044_407442CB40A4__INCLUDED_) diff --git a/src/win32/GBTileView.cpp b/src/win32/GBTileView.cpp new file mode 100644 index 0000000..69bbe32 --- /dev/null +++ b/src/win32/GBTileView.cpp @@ -0,0 +1,524 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GBTileView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "GBTileView.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../NLS.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GBTileView dialog + + +GBTileView::GBTileView(CWnd* pParent /*=NULL*/) + : ResizeDlg(GBTileView::IDD, pParent) +{ + //{{AFX_DATA_INIT(GBTileView) + m_charBase = -1; + m_bank = -1; + m_stretch = FALSE; + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo, 0, sizeof(bmpInfo)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 32*8; + bmpInfo.bmiHeader.biHeight = 32*8; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 32*32 * 64); + + tileView.setData(data); + tileView.setBmpInfo(&bmpInfo); + + charBase = 0; + palette = 0; + bank = 0; + w = h = 0; +} + +GBTileView::~GBTileView() +{ + free(data); + data = NULL; +} + +void GBTileView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GBTileView) + DDX_Control(pDX, IDC_PALETTE_SLIDER, m_slider); + DDX_Radio(pDX, IDC_CHARBASE_0, m_charBase); + DDX_Radio(pDX, IDC_BANK_0, m_bank); + DDX_Check(pDX, IDC_STRETCH, m_stretch); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_TILE_VIEW, tileView); + DDX_Control(pDX, IDC_MAP_VIEW_ZOOM, zoom); + DDX_Control(pDX, IDC_COLOR, color); +} + + +BEGIN_MESSAGE_MAP(GBTileView, CDialog) + //{{AFX_MSG_MAP(GBTileView) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_CHARBASE_0, OnCharbase0) + ON_BN_CLICKED(IDC_CHARBASE_1, OnCharbase1) + ON_BN_CLICKED(IDC_BANK_0, OnBank0) + ON_BN_CLICKED(IDC_BANK_1, OnBank1) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_WM_HSCROLL() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GBTileView message handlers + +void GBTileView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + +void GBTileView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + + +void GBTileView::OnSave() +{ + CString captureBuffer; + + if(theApp.captureFormat == 0) + captureBuffer = "tiles.png"; + else + captureBuffer = "tiles.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + captureBuffer, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + captureBuffer = dlg.GetPathName(); + + if(theApp.captureFormat) + saveBMP(captureBuffer); + else + savePNG(captureBuffer); +} + +void GBTileView::renderTile(int tile, int x, int y, u8 *charBase) +{ + u8 *bmp = &data[24*x + 8*16*24*y]; + + for(int j = 0; j < 8; j++) { + u8 mask = 0x80; + u8 tile_a = charBase[tile*16+j*2]; + u8 tile_b = charBase[tile*16+j*2+1]; + + for(int i = 0; i < 8; i++) { + u8 c = (tile_a & mask) ? 1 : 0; + c += ((tile_b & mask) ? 2 : 0); + + if(gbCgbMode) { + c = c + palette*4; + } else { + c = gbBgp[c]; + } + + u16 color = gbPalette[c]; + + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + + mask >>= 1; + } + bmp += 15*24; // advance line + } +} + + +void GBTileView::render() +{ + int tiles = 0x0000; + if(charBase) + tiles = 0x0800; + u8 *charBase = (gbVram != NULL) ? + (bank ? &gbVram[0x2000+tiles] : &gbVram[tiles]) : + &gbMemory[0x8000+tiles]; + + int tile = 0; + for(int y = 0; y < 16; y++) { + for(int x = 0; x < 16; x++) { + renderTile(tile, x, y, charBase); + tile++; + } + } + tileView.setSize(16*8, 16*8); + w = 16*8; + h = 16*8; + SIZE s; + s.cx = s.cy = 16*8; + if(tileView.getStretch()) { + s.cx = s.cy = 1; + } + tileView.SetScrollSizes(MM_TEXT, s); +} + +void GBTileView::update() +{ + paint(); +} + + +BOOL GBTileView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_TILE_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\GBTileView", + NULL); + + m_charBase = charBase; + m_bank = bank; + + m_slider.SetRange(0, 7); + m_slider.SetPageSize(2); + m_slider.SetTicFreq(1); + paint(); + + m_stretch = regQueryDwordValue("tileViewStretch", 0); + if(m_stretch) + tileView.setStretch(true); + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GBTileView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + + +void GBTileView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void GBTileView::paint() +{ + if(gbRom != NULL) { + render(); + tileView.refresh(); + } +} + +void GBTileView::OnCharbase0() +{ + charBase = 0; + paint(); +} + +void GBTileView::OnCharbase1() +{ + charBase = 1; + paint(); +} + +void GBTileView::OnBank0() +{ + bank = 0; + paint(); +} + +void GBTileView::OnBank1() +{ + bank = 1; + paint(); +} + + +void GBTileView::OnStretch() +{ + tileView.setStretch(!tileView.getStretch()); + paint(); + regSetDwordValue("tileViewStretch", tileView.getStretch()); +} + +LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + zoom.setColors(colors); + + int x = (wParam & 0xFFFF)/8; + int y = ((wParam >> 16) & 0xFFFF)/8; + + int tiles = 0x0000; + if(charBase) + tiles = 0x0800; + u32 address = 0x8000 + tiles; + int tile = 16 * y + x; + + address += 16 * tile; + + CString buffer; + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE_NUMBER)->SetWindowText(buffer); + + buffer.Format("%04x", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + return TRUE; +} + +LRESULT GBTileView::OnColInfo(WPARAM wParam, LPARAM) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + +void GBTileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + switch(nSBCode) { + case TB_THUMBPOSITION: + palette = nPos; + break; + default: + palette = m_slider.GetPos(); + break; + } + paint(); +} + + +void GBTileView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/GBTileView.h b/src/win32/GBTileView.h new file mode 100644 index 0000000..7e72c5e --- /dev/null +++ b/src/win32/GBTileView.h @@ -0,0 +1,104 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GBTILEVIEW_H__C8C8DEBB_17ED_4C5C_9DBE_D730A49B312C__INCLUDED_) +#define AFX_GBTILEVIEW_H__C8C8DEBB_17ED_4C5C_9DBE_D730A49B312C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GBTileView.h : header file +// +#include "BitmapControl.h" +#include "ColorControl.h" +#include "IUpdate.h" +#include "ResizeDlg.h" +#include "ZoomControl.h" + +///////////////////////////////////////////////////////////////////////////// +// GBTileView dialog + +class GBTileView : public ResizeDlg, IUpdateListener +{ + int charBase; + int palette; + int bank; + BitmapControl tileView; + BITMAPINFO bmpInfo; + u8 *data; + ZoomControl zoom; + ColorControl color; + int w; + int h; + bool autoUpdate; + // Construction + public: + void paint(); + void render(); + void renderTile(int tile, int x, int y, u8 *charBase); + void savePNG(const char *name); + void saveBMP(const char *name); + GBTileView(CWnd* pParent = NULL); // standard constructor + virtual ~GBTileView(); + + virtual void update(); + + // Dialog Data + //{{AFX_DATA(GBTileView) + enum { IDD = IDD_GB_TILE_VIEWER }; + CSliderCtrl m_slider; + int m_charBase; + int m_bank; + BOOL m_stretch; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GBTileView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + virtual afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + virtual afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + + // Generated message map functions + //{{AFX_MSG(GBTileView) + afx_msg void OnSave(); + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + afx_msg void OnAutoUpdate(); + afx_msg void OnCharbase0(); + afx_msg void OnCharbase1(); + afx_msg void OnBank0(); + afx_msg void OnBank1(); + afx_msg void OnStretch(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GBTILEVIEW_H__C8C8DEBB_17ED_4C5C_9DBE_D730A49B312C__INCLUDED_) diff --git a/src/win32/GDBConnection.cpp b/src/win32/GDBConnection.cpp new file mode 100644 index 0000000..af03869 --- /dev/null +++ b/src/win32/GDBConnection.cpp @@ -0,0 +1,261 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GDBConnection.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GDBConnection.h" + +#include + +#define SOCKET_MESSAGE WM_APP+1 + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +static bool initialized = false; + +///////////////////////////////////////////////////////////////////////////// +// GDBPortDlg dialog + + +GDBPortDlg::GDBPortDlg(CWnd* pParent /*=NULL*/) + : CDialog(GDBPortDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(GDBPortDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + port = 55555; + sock = INVALID_SOCKET; + + if(!initialized) { + WSADATA wsaData; + + int error = WSAStartup(MAKEWORD(1,1), &wsaData); + + initialized = true; + } +} + + +void GDBPortDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GDBPortDlg) + DDX_Control(pDX, IDC_PORT, m_port); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GDBPortDlg, CDialog) + //{{AFX_MSG_MAP(GDBPortDlg) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_WM_CLOSE() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GDBPortDlg message handlers + +int GDBPortDlg::getPort() +{ + return port; +} + + +SOCKET GDBPortDlg::getSocket() +{ + return sock; +} + + +BOOL GDBPortDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString buffer; + + buffer.Format("%d", port); + + m_port.SetWindowText(buffer); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void GDBPortDlg::OnOk() +{ + CString buffer; + + m_port.GetWindowText(buffer); + + sockaddr_in address; + address.sin_family = AF_INET; + address.sin_addr.s_addr = inet_addr("0.0.0.0"); + address.sin_port = htons(atoi(buffer)); + port = ntohs(address.sin_port); + + SOCKET s = socket(AF_INET, SOCK_STREAM, 0); + + if(s != INVALID_SOCKET) { + int error = bind(s, (sockaddr *)&address, sizeof(address)); + + if(error) { + systemMessage(IDS_ERROR_BINDING, "Error binding socket. Port probably in use."); + error = closesocket(s); + EndDialog(FALSE); + } else { + error = listen(s, 1); + if(!error) { + sock = s; + EndDialog(TRUE); + } else { + systemMessage(IDS_ERROR_LISTENING, "Error listening on socket."); + closesocket(s); + EndDialog(FALSE); + } + } + } else { + systemMessage(IDS_ERROR_CREATING_SOCKET, "Error creating socket."); + EndDialog(FALSE); + } +} + +void GDBPortDlg::OnCancel() +{ + OnClose(); +} + +void GDBPortDlg::OnClose() +{ + EndDialog(FALSE); +} +///////////////////////////////////////////////////////////////////////////// +// GDBWaitingDlg dialog + + +GDBWaitingDlg::GDBWaitingDlg(SOCKET s, int p, CWnd* pParent /*=NULL*/) + : CDialog(GDBWaitingDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(GDBWaitingDlg) + //}}AFX_DATA_INIT + port = p & 65535; + listenSocket = s; +} + + +void GDBWaitingDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GDBWaitingDlg) + DDX_Control(pDX, IDC_PORT, m_port); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GDBWaitingDlg, CDialog) + //{{AFX_MSG_MAP(GDBWaitingDlg) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_WM_CLOSE() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GDBWaitingDlg message handlers + +BOOL GDBWaitingDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString buffer; + + buffer.Format("%d", port); + + m_port.SetWindowText(buffer); + + CenterWindow(); + + int error = WSAAsyncSelect(listenSocket, + (HWND )*this, + SOCKET_MESSAGE, + FD_ACCEPT); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +LRESULT GDBWaitingDlg::OnSocketAccept(WPARAM wParam, LPARAM lParam) +{ + if(LOWORD(lParam) == FD_ACCEPT) { + WSAAsyncSelect(listenSocket, (HWND)*this, 0, 0); + + int flag = 0; + ioctlsocket(listenSocket, FIONBIO, (unsigned long *)&flag); + + SOCKET s = accept(listenSocket, NULL, NULL); + if(s != INVALID_SOCKET) { + char dummy; + recv(s, &dummy, 1, 0); + if(dummy != '+') { + systemMessage(IDS_ACK_NOT_RECEIVED, "ACK not received from GDB."); + OnClose(); // calls EndDialog + } else { + sock = s; + EndDialog(TRUE); + } + } + } + + return TRUE; +} + +void GDBWaitingDlg::OnCancel() +{ + OnClose(); +} + +void GDBWaitingDlg::OnClose() +{ + if(sock != INVALID_SOCKET) { + closesocket(sock); + sock = INVALID_SOCKET; + } + if(listenSocket != INVALID_SOCKET) { + closesocket(listenSocket); + listenSocket = INVALID_SOCKET; + } + EndDialog(FALSE); +} + +SOCKET GDBWaitingDlg::getListenSocket() +{ + return listenSocket; +} + +SOCKET GDBWaitingDlg::getSocket() +{ + return sock; +} diff --git a/src/win32/GDBConnection.h b/src/win32/GDBConnection.h new file mode 100644 index 0000000..f82ac0e --- /dev/null +++ b/src/win32/GDBConnection.h @@ -0,0 +1,114 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GDBCONNECTION_H__DD73B298_E1A7_4A46_B282_E7A2B37FC9D9__INCLUDED_) +#define AFX_GDBCONNECTION_H__DD73B298_E1A7_4A46_B282_E7A2B37FC9D9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GDBConnection.h : header file +// + +#include + +///////////////////////////////////////////////////////////////////////////// +// GDBPortDlg dialog + +class GDBPortDlg : public CDialog +{ + int port; + SOCKET sock; + // Construction + public: + SOCKET getSocket(); + int getPort(); + GDBPortDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GDBPortDlg) + enum { IDD = IDD_GDB_PORT }; + CEdit m_port; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GDBPortDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GDBPortDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnOk(); + afx_msg void OnCancel(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// +// GDBWaitingDlg dialog + +class GDBWaitingDlg : public CDialog +{ + int port; + SOCKET listenSocket; + SOCKET sock; + // Construction + public: + SOCKET getSocket(); + SOCKET getListenSocket(); + afx_msg LRESULT OnSocketAccept(WPARAM wParam, LPARAM lParam); + GDBWaitingDlg(SOCKET s,int p, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GDBWaitingDlg) + enum { IDD = IDD_GDB_WAITING }; + CStatic m_port; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GDBWaitingDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GDBWaitingDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnCancel(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GDBCONNECTION_H__DD73B298_E1A7_4A46_B282_E7A2B37FC9D9__INCLUDED_) diff --git a/src/win32/GDIDisplay.cpp b/src/win32/GDIDisplay.cpp new file mode 100644 index 0000000..8a6f93a --- /dev/null +++ b/src/win32/GDIDisplay.cpp @@ -0,0 +1,490 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include + +#include "../System.h" +#include "../gb/gbGlobals.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" + +#include "VBA.h" +#include "MainWnd.h" +#include "Reg.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern void winlog(const char *,...); +extern int RGB_LOW_BITS_MASK; +extern int Init_2xSaI(u32); +extern int systemSpeed; + +class GDIDisplay : public IDisplay { +private: + u8 *filterData; + u8 info[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)]; + +public: + GDIDisplay(); + virtual ~GDIDisplay(); + + virtual bool initialize(); + virtual void cleanup(); + virtual void render(); + virtual void checkFullScreen(); + virtual void renderMenu(); + virtual void clear(); + virtual DISPLAY_TYPE getType() { return GDI; }; + virtual void setOption(const char *, int) {} + virtual bool isSkinSupported() { return true; } + virtual int selectFullScreenMode(GUID **); +}; + +static int calculateShift(u32 mask) +{ + int m = 0; + + while(mask) { + m++; + mask >>= 1; + } + + return m-5; +} + +GDIDisplay::GDIDisplay() +{ + filterData = (u8 *)malloc(4*4*256*240); +} + +GDIDisplay::~GDIDisplay() +{ + cleanup(); +} + +void GDIDisplay::cleanup() +{ + if(filterData) { + free(filterData); + filterData = NULL; + } +} + +bool GDIDisplay::initialize() +{ + theApp.sizeX = 240; + theApp.sizeY = 160; + switch(theApp.videoOption) { + case VIDEO_1X: + theApp.surfaceSizeX = theApp.sizeX; + theApp.surfaceSizeY = theApp.sizeY; + break; + case VIDEO_2X: + theApp.surfaceSizeX = theApp.sizeX * 2; + theApp.surfaceSizeY = theApp.sizeY * 2; + break; + case VIDEO_3X: + theApp.surfaceSizeX = theApp.sizeX * 3; + theApp.surfaceSizeY = theApp.sizeY * 3; + break; + case VIDEO_4X: + theApp.surfaceSizeX = theApp.sizeX * 4; + theApp.surfaceSizeY = theApp.sizeY * 4; + break; + case VIDEO_320x240: + case VIDEO_640x480: + case VIDEO_800x600: + case VIDEO_OTHER: + { + int scaleX = (theApp.fsWidth / theApp.sizeX); + int scaleY = (theApp.fsHeight / theApp.sizeY); + int min = scaleX < scaleY ? scaleX : scaleY; + if(theApp.fsMaxScale) + min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min; + theApp.surfaceSizeX = theApp.sizeX * min; + theApp.surfaceSizeY = theApp.sizeY * min; + if(theApp.fullScreenStretch) { + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; + } + } + break; + } + + theApp.rect.left = 0; + theApp.rect.top = 0; + theApp.rect.right = theApp.sizeX; + theApp.rect.bottom = theApp.sizeY; + + theApp.dest.left = 0; + theApp.dest.top = 0; + theApp.dest.right = theApp.surfaceSizeX; + theApp.dest.bottom = theApp.surfaceSizeY; + + DWORD style = WS_POPUP | WS_VISIBLE; + DWORD styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + style |= WS_OVERLAPPEDWINDOW; + else + styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); + else + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + + int winSizeX = theApp.dest.right-theApp.dest.left; + int winSizeY = theApp.dest.bottom-theApp.dest.top; + + if(theApp.videoOption > VIDEO_4X) { + winSizeX = theApp.fsWidth; + winSizeY = theApp.fsHeight; + } + + int x = 0; + int y = 0; + + if(theApp.videoOption <= VIDEO_4X) { + x = theApp.windowPositionX; + y = theApp.windowPositionY; + } + + // Create a window + MainWnd *pWnd = new MainWnd; + theApp.m_pMainWnd = pWnd; + + pWnd->CreateEx(styleEx, + theApp.wndClass, + "VisualBoyAdvance", + style, + x,y,winSizeX,winSizeY, + NULL, + 0); + + if (!(HWND)*pWnd) { + winlog("Error creating Window %08x\n", GetLastError()); + return FALSE; + } + + theApp.updateMenuBar(); + + theApp.adjustDestRect(); + + theApp.mode320Available = false; + theApp.mode640Available = false; + theApp.mode800Available = false; + + HDC dc = GetDC(NULL); + HBITMAP hbm = CreateCompatibleBitmap(dc, 1, 1); + BITMAPINFO *bi = (BITMAPINFO *)info; + ZeroMemory(bi, sizeof(info)); + bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS); + GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS); + DeleteObject(hbm); + ReleaseDC(NULL, dc); + + if(bi->bmiHeader.biCompression == BI_BITFIELDS) { + systemColorDepth = bi->bmiHeader.biBitCount; + if(systemColorDepth == 15) + systemColorDepth = 16; + systemRedShift = calculateShift(*((DWORD *)&bi->bmiColors[0])); + systemGreenShift = calculateShift(*((DWORD *)&bi->bmiColors[1])); + systemBlueShift = calculateShift(*((DWORD *)&bi->bmiColors[2])); + if(systemColorDepth == 16) { + if(systemGreenShift == 6) { + Init_2xSaI(565); + RGB_LOW_BITS_MASK=0x821; + } else { + Init_2xSaI(555); + RGB_LOW_BITS_MASK=0x421; + } + } else if(systemColorDepth == 32) + Init_2xSaI(32); + } else { + systemColorDepth = 32; + systemRedShift = 19; + systemGreenShift = 11; + systemBlueShift = 3; + + Init_2xSaI(32); + } + theApp.fsColorDepth = systemColorDepth; + if(systemColorDepth == 24) + theApp.filterFunction = NULL; +#ifdef MMX + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +#endif + + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + case 24: + case 32: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + } + theApp.updateFilter(); + theApp.updateIFB(); + + pWnd->DragAcceptFiles(TRUE); + + return TRUE; +} + +void GDIDisplay::clear() +{ +} + +void GDIDisplay::renderMenu() +{ + checkFullScreen(); + theApp.m_pMainWnd->DrawMenuBar(); +} + +void GDIDisplay::checkFullScreen() +{ +} + +void GDIDisplay::render() +{ + void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int) = theApp.filterFunction; + int filterWidth = theApp.filterWidth, filterHeight = theApp.filterHeight; +/* + if(textMethod == 1) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + extern void Simple1x(u8*,u32,u8*,u8*,u32,int,int); + filterFunction = Simple1x; + filterWidth = copyX*2; + filterHeight = copyY*2; + } +*/ + BITMAPINFO *bi = (BITMAPINFO *)info; + bi->bmiHeader.biWidth = filterWidth+1; + bi->bmiHeader.biHeight = -filterHeight; + + int pitch = filterWidth * 2 + 4; + if(systemColorDepth == 24) + pitch = filterWidth * 3; + else if(systemColorDepth == 32) + pitch = filterWidth * 4 + 4; + + if(textMethod == 1 && !filterFunction) + { + textMethod = 0; // must not be after systemMessage! + systemMessage(0,"The \"On Game\" text display mode does not work with this combination of renderers and filters.\nThe display mode is automatically being changed to \"In Game\" instead,\nbut this may cause message text to go into AVI recordings and screenshots.\nThis can be reconfigured by choosing \"Options->Video->Text Display Options...\""); + } + + if(textMethod == 0) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + DrawTextMessages((u8*)pix, copyX*(systemColorDepth/8)+(systemColorDepth==24?0:4), 0, copyY); + } + + if(filterFunction) { + bi->bmiHeader.biWidth = filterWidth * 2; + bi->bmiHeader.biHeight = -filterHeight * 2; + + if(systemColorDepth == 16) + (*filterFunction)(pix+pitch, + pitch, + (u8*)theApp.delta, + (u8*)filterData, + filterWidth*2*2, + filterWidth, + filterHeight); + else + (*filterFunction)(pix+pitch, + pitch, + (u8*)theApp.delta, + (u8*)filterData, + filterWidth*4*2, + filterWidth, + filterHeight); + } + + if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) { + char buffer[30]; + if(theApp.showSpeed == 1) + sprintf(buffer, "%3d%%", systemSpeed); + else + sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + theApp.showRenderedFrames); + + if(filterFunction) { + int p = filterWidth * 4; + if(systemColorDepth == 24) + p = filterWidth * 6; + else if(systemColorDepth == 32) + p = filterWidth * 8; + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)filterData, + p, + 10, + filterHeight*2-10, + buffer); + else + drawText((u8*)filterData, + p, + 10, + filterHeight*2-10, + buffer); + } else { + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)pix, + pitch, + 10, + filterHeight-10, + buffer); + else + drawText((u8*)pix, + pitch, + 10, + filterHeight-10, + buffer); + } + } + if(textMethod == 1 && filterFunction) + DrawTextMessages((u8*)filterData, filterWidth*systemColorDepth/4, 0, filterHeight*2); + + POINT p; + p.x = theApp.dest.left; + p.y = theApp.dest.top; + CWnd *pWnd = theApp.m_pMainWnd; + pWnd->ScreenToClient(&p); + POINT p2; + p2.x = theApp.dest.right; + p2.y = theApp.dest.bottom; + pWnd->ScreenToClient(&p2); + + CDC *dc = pWnd->GetDC(); + + StretchDIBits((HDC)*dc, + p.x, + p.y, + p2.x - p.x, + p2.y - p.y, + 0, + 0, + theApp.rect.right, + theApp.rect.bottom, + filterFunction ? filterData : pix+pitch, + bi, + DIB_RGB_COLORS, + SRCCOPY); + + if(textMethod == 2) + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2)) { + dc->SetBkMode(TRANSPARENT); + + if(outlinedText) + { + dc->SetTextColor(textColor != 7 ? RGB(0,0,0) : RGB(255,255,255)); + + // draw black outline + const static int xd [8] = {-1,0,1,1,1,0,-1,-1}; + const static int yd [8] = {-1,-1,-1,0,1,1,1,0}; + for(int i = 0 ; i < 8 ; i++) + { + dc->TextOut(p.x+10+xd[i], p2.y - 20*(slot+1)+yd[i], theApp.screenMessageBuffer[slot]); + } + } + + COLORREF color; + switch(textColor) + { + case 0: color = RGB(255, 255, 255); break; + case 1: color = RGB(255, 0, 0); break; + case 2: color = RGB(255, 255, 0); break; + case 3: color = RGB(0, 255, 0); break; + case 4: color = RGB(0, 255, 255); break; + case 5: color = RGB(0, 0, 255); break; + case 6: color = RGB(255, 0, 255); break; + case 7: color = RGB(0, 0, 0); break; + } + dc->SetTextColor(color); + + // draw center text + dc->TextOut(p.x+10, p2.y - 20*(slot+1), theApp.screenMessageBuffer[slot]); + } else { + theApp.screenMessage[slot] = false; + } + } + } + + + pWnd->ReleaseDC(dc); +} + +int GDIDisplay::selectFullScreenMode(GUID **) +{ + HWND wnd = GetDesktopWindow(); + RECT r; + GetWindowRect(wnd, &r); + int w = (r.right - r.left) & 4095; + int h = (r.bottom - r.top) & 4095; + HDC dc = GetDC(wnd); + int c = GetDeviceCaps(dc, BITSPIXEL); + ReleaseDC(wnd, dc); + + return (c << 24) | (w << 12) | h; +} + +IDisplay *newGDIDisplay() +{ + return new GDIDisplay(); +} + diff --git a/src/win32/GSACodeSelect.cpp b/src/win32/GSACodeSelect.cpp new file mode 100644 index 0000000..78e3b60 --- /dev/null +++ b/src/win32/GSACodeSelect.cpp @@ -0,0 +1,120 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// GSACodeSelect.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "GSACodeSelect.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// GSACodeSelect dialog + + +GSACodeSelect::GSACodeSelect(FILE *file, CWnd* pParent /*=NULL*/) + : CDialog(GSACodeSelect::IDD, pParent) +{ + //{{AFX_DATA_INIT(GSACodeSelect) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + m_file = file; +} + + +void GSACodeSelect::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(GSACodeSelect) + DDX_Control(pDX, IDC_GAME_LIST, m_games); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(GSACodeSelect, CDialog) + //{{AFX_MSG_MAP(GSACodeSelect) + ON_BN_CLICKED(ID_OK, OnOk) + ON_LBN_SELCHANGE(IDC_GAME_LIST, OnSelchangeGameList) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// GSACodeSelect message handlers + +void GSACodeSelect::OnCancel() +{ + EndDialog(-1); +} + +void GSACodeSelect::OnOk() +{ + EndDialog(m_games.GetCurSel()); +} + +void GSACodeSelect::OnSelchangeGameList() +{ + int item = m_games.GetCurSel(); + CWnd *ok = GetDlgItem(ID_OK); + + ok->EnableWindow(item != -1); +} + +BOOL GSACodeSelect::OnInitDialog() +{ + CDialog::OnInitDialog(); + + char buffer[1024]; + + FILE *f = m_file; + int games = 0; + int len = 0; + fseek(f, -4, SEEK_CUR); + fread(&games, 1, 4, f); + while(games > 0) { + fread(&len, 1, 4, f); + fread(buffer, 1, len, f); + buffer[len] = 0; + m_games.AddString(buffer); + int codes = 0; + fread(&codes, 1, 4, f); + + while(codes > 0) { + fread(&len, 1, 4, f); + fseek(f, len, SEEK_CUR); + fread(&len, 1, 4, f); + fseek(f, len, SEEK_CUR); + fseek(f, 4, SEEK_CUR); + fread(&len, 1, 4, f); + fseek(f, len*12, SEEK_CUR); + codes--; + } + games--; + } + GetDlgItem(ID_OK)->EnableWindow(FALSE); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/GSACodeSelect.h b/src/win32/GSACodeSelect.h new file mode 100644 index 0000000..8eeafa0 --- /dev/null +++ b/src/win32/GSACodeSelect.h @@ -0,0 +1,69 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_GSACODESELECT_H__189BD94D_288F_4E2A_9395_EAB16F104D87__INCLUDED_) +#define AFX_GSACODESELECT_H__189BD94D_288F_4E2A_9395_EAB16F104D87__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// GSACodeSelect.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// GSACodeSelect dialog + +class GSACodeSelect : public CDialog +{ + // Construction + public: + GSACodeSelect(FILE *file, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(GSACodeSelect) + enum { IDD = IDD_CODE_SELECT }; + CListBox m_games; + //}}AFX_DATA + FILE *m_file; + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(GSACodeSelect) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(GSACodeSelect) + afx_msg void OnCancel(); + afx_msg void OnOk(); + afx_msg void OnSelchangeGameList(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_GSACODESELECT_H__189BD94D_288F_4E2A_9395_EAB16F104D87__INCLUDED_) diff --git a/src/win32/Hyperlink.cpp b/src/win32/Hyperlink.cpp new file mode 100644 index 0000000..05770d6 --- /dev/null +++ b/src/win32/Hyperlink.cpp @@ -0,0 +1,118 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Hyperlink.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Hyperlink.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// Hyperlink + +Hyperlink::Hyperlink() +{ + m_over = false; +} + +Hyperlink::~Hyperlink() +{ + m_underlineFont.DeleteObject(); +} + + +BEGIN_MESSAGE_MAP(Hyperlink, CStatic) + //{{AFX_MSG_MAP(Hyperlink) + ON_WM_CTLCOLOR_REFLECT() + ON_WM_ERASEBKGND() + ON_WM_MOUSEMOVE() + //}}AFX_MSG_MAP + ON_CONTROL_REFLECT(STN_CLICKED, OnClicked) +END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Hyperlink message handlers + +void Hyperlink::PreSubclassWindow() +{ + DWORD dwStyle = GetStyle(); + ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY); + + // 32649 is the hand cursor + m_cursor = LoadCursor(NULL, MAKEINTRESOURCE(32649)); + + CFont *font = GetFont(); + + LOGFONT lg; + font->GetLogFont(&lg); + + lg.lfUnderline = TRUE; + + m_underlineFont.CreateFontIndirect(&lg); + SetFont(&m_underlineFont); + + CStatic::PreSubclassWindow(); +} + +void Hyperlink::OnClicked() +{ + CString url; + GetWindowText(url); + ::ShellExecute(0, _T("open"), url, + 0, 0, SW_SHOWNORMAL); +} + +HBRUSH Hyperlink::CtlColor(CDC* pDC, UINT nCtlColor) +{ + pDC->SetTextColor(RGB(0,0,240)); + + return (HBRUSH)GetStockObject(NULL_BRUSH); +} + +BOOL Hyperlink::OnEraseBkgnd(CDC* pDC) +{ + CRect rect; + GetClientRect(rect); + pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE)); + + return TRUE; +} + +void Hyperlink::OnMouseMove(UINT nFlags, CPoint point) +{ + if(!m_over) { + m_over = true; + SetCapture(); + ::SetCursor(m_cursor); + } else { + CRect r; + GetClientRect(&r); + + if(!r.PtInRect(point)) { + m_over = false; + ReleaseCapture(); + } + } +} diff --git a/src/win32/Hyperlink.h b/src/win32/Hyperlink.h new file mode 100644 index 0000000..4afe28e --- /dev/null +++ b/src/win32/Hyperlink.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_HYPERLINK_H__BECEAB7D_31FB_4727_A42B_8732162EEBCC__INCLUDED_) +#define AFX_HYPERLINK_H__BECEAB7D_31FB_4727_A42B_8732162EEBCC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Hyperlink.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// Hyperlink window + +class Hyperlink : public CStatic +{ +// Construction +public: + Hyperlink(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Hyperlink) + protected: + virtual void PreSubclassWindow(); + //}}AFX_VIRTUAL + +// Implementation +public: + bool m_over; + HCURSOR m_cursor; + afx_msg void OnClicked(); + CFont m_underlineFont; + virtual ~Hyperlink(); + + // Generated message map functions +protected: + //{{AFX_MSG(Hyperlink) + afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_HYPERLINK_H__BECEAB7D_31FB_4727_A42B_8732162EEBCC__INCLUDED_) diff --git a/src/win32/IOViewer.cpp b/src/win32/IOViewer.cpp new file mode 100644 index 0000000..4d2b2c7 --- /dev/null +++ b/src/win32/IOViewer.cpp @@ -0,0 +1,201 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// IOViewer.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "IOViewer.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" + +#include "IOViewerRegs.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// IOViewer dialog + + +IOViewer::IOViewer(CWnd* pParent /*=NULL*/) + : ResizeDlg(IOViewer::IDD, pParent) +{ + //{{AFX_DATA_INIT(IOViewer) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + selected = 0; + autoUpdate = false; +} + + +void IOViewer::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(IOViewer) + DDX_Control(pDX, IDC_VALUE, m_value); + DDX_Control(pDX, IDC_ADDRESSES, m_address); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(IOViewer, CDialog) + //{{AFX_MSG_MAP(IOViewer) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_CBN_SELCHANGE(IDC_ADDRESSES, OnSelchangeAddresses) + ON_BN_CLICKED(IDC_APPLY, OnApply) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// IOViewer message handlers + +void IOViewer::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +void IOViewer::OnRefresh() +{ + // TODO: Add your control notification handler code here + +} + +void IOViewer::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void IOViewer::OnSelchangeAddresses() +{ + selected = m_address.GetCurSel(); + + update(); +} + +void IOViewer::PostNcDestroy() +{ + delete this; +} + +BOOL IOViewer::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // winCenterWindow(getHandle()); + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\IOView", + NULL); + + CFont *font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)); + int i; + for(i = 0; i < sizeof(ioViewRegisters)/sizeof(IOData); i++) { + m_address.AddString(ioViewRegisters[i].name); + } + m_address.SetFont(font); + for(i = 0; i < 16; i++) { + GetDlgItem(IDC_BIT_0+i)->SetFont(font); + } + + RECT cbSize; + int Height; + + m_address.GetClientRect(&cbSize); + Height = m_address.GetItemHeight(0); + Height += m_address.GetItemHeight(0) * (10); + + // Note: The use of SM_CYEDGE assumes that we're using Windows '95 + // Now add on the height of the border of the edit box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // The height of the border of the drop-down box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // now set the size of the window + m_address.SetWindowPos(NULL, + 0, 0, + cbSize.right, Height, + SWP_NOMOVE | SWP_NOZORDER); + + m_address.SetCurSel(0); + update(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void IOViewer::update() +{ + CString buffer; + + const IOData *sel = &ioViewRegisters[selected]; + u16 data = sel->address ? *sel->address : + (ioMem ? *((u16 *)&ioMem[sel->offset]) : 0); + + for(int i = 0; i < 16; i++) { + CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i); + + if(pWnd) { + if(!(sel->write & (1 << i))) + pWnd->EnableWindow(FALSE); + else + pWnd->EnableWindow(TRUE); + pWnd->SetCheck(((data & (1 << i)) >> i)); + buffer.Format("%2d %s", i, sel->bits[i]); + pWnd->SetWindowText(buffer); + } + } + + buffer.Format("%04X", data); + m_value.SetWindowText(buffer); +} + +void IOViewer::OnApply() +{ + const IOData *sel = &ioViewRegisters[selected]; + u16 res = 0; + for(int i = 0; i < 16; i++) { + CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i); + + if(pWnd) { + if(pWnd->GetCheck()) + res |= (1 << i); + } + } + CPUWriteHalfWord(0x4000000+sel->offset, res); + update(); +} diff --git a/src/win32/IOViewer.h b/src/win32/IOViewer.h new file mode 100644 index 0000000..d768b01 --- /dev/null +++ b/src/win32/IOViewer.h @@ -0,0 +1,78 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_IOVIEWER_H__9C266B78_FC02_4572_9062_0241802B0E76__INCLUDED_) +#define AFX_IOVIEWER_H__9C266B78_FC02_4572_9062_0241802B0E76__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// IOViewer.h : header file +// + +#include "ResizeDlg.h" +#include "IUpdate.h" + +///////////////////////////////////////////////////////////////////////////// +// IOViewer dialog + +class IOViewer : public ResizeDlg, IUpdateListener +{ + // Construction + public: + void update(); + bool autoUpdate; + int selected; + IOViewer(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(IOViewer) + enum { IDD = IDD_IO_VIEWER }; + CStatic m_value; + CComboBox m_address; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(IOViewer) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(IOViewer) + afx_msg void OnClose(); + afx_msg void OnRefresh(); + afx_msg void OnAutoUpdate(); + afx_msg void OnSelchangeAddresses(); + virtual BOOL OnInitDialog(); + afx_msg void OnApply(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_IOVIEWER_H__9C266B78_FC02_4572_9062_0241802B0E76__INCLUDED_) diff --git a/src/win32/IOViewerRegs.h b/src/win32/IOViewerRegs.h new file mode 100644 index 0000000..9d28a6e --- /dev/null +++ b/src/win32/IOViewerRegs.h @@ -0,0 +1,2087 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +struct IOData { + u16 *address; + u16 offset; + char *name; + u16 write; + char *bits[16]; +}; + +const IOData ioViewRegisters[] = { + { + &DISPCNT, 0, "0x4000000-DISPCNT", 0xFFF7, + { + "", + "", + "BG Mode (3 bits)", + "CGB Mode", + "Display Frame", + "H-Blank Interval OBJ processing", + "OBJ Character mapping", + "Forced blank", + "BG0", + "BG1", + "BG2", + "BG3", + "OBJ", + "WIN0", + "WIN1", + "OBJWIN" + } + }, + { + &DISPSTAT, 4, "0x4000004-DISPSTAT", 0xFF38, + { + "V-Blank Status", + "H-Blank Status", + "VCOUNT Evaluation", + "V-Blank Interrupt Enable", + "H-Blank Interrupt Enable", + "VCOUNT Match Interrupt Enable", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "VCOUNT setting (8 bits)" + } + }, + { + &VCOUNT, 6, "0x4000006-VCOUNT", 0x0000, + { + "", + "", + "", + "", + "", + "", + "", + "VCOUNT (8 bits)", + "", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG0CNT, 8, "0x4000008-BG0CNT", 0xDFCF, + { + "", + "Priority (2 bits)", + "", + "Char base (2 bits)", + "", + "", + "Mosaic", + "16/256 colors", + "", + "", + "", + "", + "Screen Base Block (5 bits)", + "", + "", + "Size (2 bits)" + } + }, + { + &BG1CNT, 0xA, "0x400000A-BG1CNT", 0xDFCF, + { + "", + "Priority (2 bits)", + "", + "Char base (2 bits)", + "", + "", + "Mosaic", + "16/256 colors", + "", + "", + "", + "", + "Screen Base Block (5 bits)", + "", + "", + "Size (2 bits)" + } + }, + { + &BG2CNT, 0xC, "0x400000C-BG2CNT", 0xFFCF, + { + "", + "Priority (2 bits)", + "", + "Char base (2 bits)", + "", + "", + "Mosaic", + "16/256 colors", + "", + "", + "", + "", + "Screen Base Block (5 bits)", + "Area Overflow", + "", + "Size (2 bits)" + } + }, + { + &BG3CNT, 0xE, "0x400000E-BG3CNT", 0xFFCF, + { + "", + "Priority (2 bits)", + "", + "Char base (2 bits)", + "", + "", + "Mosaic", + "16/256 colors", + "", + "", + "", + "", + "Screen Base Block (5 bits)", + "Area Overflow", + "", + "Size (2 bits)" + } + }, + { + &BG0HOFS, 0x10, "0x4000010-BG0HOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Horizontal Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG0VOFS, 0x12, "0x4000012-BG0VOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Vertical Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG1HOFS, 0x14, "0x4000014-BG1HOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Horizontal Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG1VOFS, 0x16, "0x4000016-BG1VOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Vertical Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG2HOFS, 0x18, "0x4000018-BG8HOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Horizontal Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG2VOFS, 0x1A, "0x400001A-BG2VOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Vertical Offset (9 bits, W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG3HOFS, 0x1C, "0x400001C-BG3HOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Horizontal Offset (9 bits,W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG3VOFS, 0x1E, "0x400001E-BG3VOFS", 0x01FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "Vertical Offset (9 bits,W)", + "", + "", + "", + "", + "", + "", + "" + } + }, + { + &BG2PA, 0x20, "0x4000020-BG2PA", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dx (16 bits,W)" + } + }, + { + &BG2PB, 0x22, "0x4000022-BG2PB", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dmx (16 bits,W)" + } + }, + { + &BG2PC, 0x24, "0x4000024-BG2PC", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dy (16 bits,W)" + } + }, + { + &BG2PD, 0x26, "0x4000026-BG2PD", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dmy (16 bits,W)" + } + }, + { + &BG2X_L, 0x28, "0x4000028-BG2X_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "X low bits (16 bits,W)" + } + }, + { + &BG2X_H, 0x2A, "0x400002A-BG2X_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "X high bits (12 bits,W)", + "", + "", + "", + "", + } + }, + { + &BG2Y_L, 0x2C, "0x400002C-BG2Y_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Y low bits (16 bits,W)" + } + }, + { + &BG2Y_H, 0x2E, "0x400002E-BG2Y_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Y hight bits (12 bits,W)", + "", + "", + "", + "", + } + }, + { + &BG3PA, 0x30, "0x4000030-BG3PA", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dx (16 bits,W)" + } + }, + { + &BG3PB, 0x32, "0x4000032-BG3PB", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dmx (16 bits,W)" + } + }, + { + &BG3PC, 0x34, "0x4000034-BG3PC", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dy (16 bits,W)" + } + }, + { + &BG3PD, 0x36, "0x4000036-BG3PD", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "dmy (16 bits,W)" + } + }, + { + &BG3X_L, 0x38, "0x4000038-BG3X_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "X low bits (16 bits,W)" + } + }, + { + &BG3X_H, 0x3A, "0x400003A-BG3X_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "X hight bits (12 bits,W)", + "", + "", + "", + "", + } + }, + { + &BG3Y_L, 0x3C, "0x400003C-BG3Y_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Y low bits (16 bits,W)" + } + }, + { + &BG3Y_H, 0x3E, "0x400003E-BG3Y_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Y hight bits (12 bits,W)", + "", + "", + "", + "", + } + }, + { + &WIN0H, 0x40, "0x4000040-WIN0H", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Win 0 lower-right X (8 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "Win 0 upper-left X (8 bits,W)", + } + }, + { + &WIN1H, 0x42, "0x4000042-WIN1H", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Win 1 lower-right X (8 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "Win 1 upper-left (8 bits,W)", + } + }, + { + &WIN0V, 0x44, "0x4000044-WIN0V", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Win 0 lower-right Y (8 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "Win 0 upper-left Y (8 bits,W)", + } + }, + { + &WIN1V, 0x46, "0x4000046-WIN1V", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Win 1 lower-right Y (8 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "Win 1 upper-left Y (8 bits,W)", + } + }, + { + &WININ, 0x48, "0x4000048-WININ", 0x3F3F, + { + "WIN0 BG0", + "WIN0 BG1", + "WIN0 BG2", + "WIN0 BG3", + "WIN0 OBJ", + "WIN0 Special FX", + "", + "", + "WIN1 BG0", + "WIN1 BG1", + "WIN1 BG2", + "WIN1 BG3", + "WIN1 OBJ", + "WIN1 Special FX", + "", + "", + } + }, + { + &WINOUT, 0x4A, "0x400004A-WINOUT", 0x3F3F, + { + "WIN0/1 BG0", + "WIN0/1 BG1", + "WIN0/1 BG2", + "WIN0/1 BG3", + "WIN0/1 OBJ", + "WIN0/1 Special FX", + "", + "", + "OBJWIN BG0", + "OBJWIN BG1", + "OBJWIN BG2", + "OBJWIN BG3", + "OBJWIN OBJ", + "OBJWIN Special FX", + "", + "", + } + }, + { + &MOSAIC, 0x4C, "0x400004C-MOSAIC", 0xFFFF, + { + "", + "", + "", + "BG H Size (4 bits,W)", + "", + "", + "", + "BG V Size (4 bits,W)", + "", + "", + "", + "OBJ H Size (4 bits,W)", + "", + "", + "", + "OBJ V Size (4 bits,W)", + } + }, + { + &BLDMOD, 0x50, "0x4000050-BLDMOD", 0x3FFF, + { + "1st BG0", + "1st BG1", + "1st BG2", + "1st BG3", + "1st OBJ", + "1st BD", + "", + "FX Type (2 bits)", + "2nd BG0", + "2nd BG1", + "2nd BG2", + "2nd BG3", + "2nd OBJ", + "2nd BD", + "", + "", + } + }, + { + &COLEV, 0x52, "0x4000052-COLEV", 0x1F1F, + { + "", + "", + "", + "", + "Coefficient EVA (5 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "Coefficient EVB (5 bits,W)", + "", + "", + "", + } + }, + { + &COLY, 0x54, "0x4000054-COLEY", 0x001F, + { + "", + "", + "", + "", + "Coefficient EVY (5 bits,W)", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x60, "0x4000060-SG10_L", 0x007F, + { + "", + "", + "Sweep Shifts (3 bits)", + "Sweep addition/decrease", + "", + "", + "Sweep Time (3 bits)", + "", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x62, "0x4000062-SG10_H", 0xFFFF, + { + "", + "", + "", + "", + "", + "Sound Length (6 bits,W)", + "", + "Waveform Type (2 bits)", + "", + "", + "Envelope Steps (3 bits)", + "Envelope Attenuate/Amplify", + "", + "", + "", + "Envelope Initial Value", + } + }, + { + NULL, 0x64, "0x4000064-SG11", 0xC7FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Frequency (11 bits,W)", + "", + "", + "", + "Sound Continuous/Counter", + "Initialization (W)", + } + }, + { + NULL, 0x68, "0x4000068-SG20", 0xFFFF, + { + "", + "", + "", + "", + "", + "Sound Length (6 bits,W)", + "", + "Waveform Type (2 bits)", + "", + "", + "Envelope Steps (3 bits)", + "Envelope Attenuate/Amplify", + "", + "", + "", + "Envelope Initial Value", + } + }, + { + NULL, 0x6C, "0x400006C-SG21", 0xC7FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Frequency (11 bits,W)", + "", + "", + "", + "Sound Continuous/Counter", + "Initialization (W)", + } + }, + { + NULL, 0x70, "0x4000070-SG30_L", 0x00E0, + { + "", + "", + "", + "", + "", + "Waveform 32/64 Steps", + "Waveform Bank 0/1", + "Sound Output", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x72, "0x4000072-SG30_H", 0xE0FF, + { + "", + "", + "", + "", + "", + "", + "", + "Sound Length (8 bits,W)", + "", + "", + "", + "", + "", + "", + "Output Level (2 bits)", + "Forced 3/4 Output Level", + } + }, + { + NULL, 0x74, "0x4000074-SG31", 0xC7FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Frequency (11 bits,W)", + "", + "", + "", + "Sound Continuous/Counter", + "Initialization (W)", + } + }, + { + NULL, 0x78, "0x4000078-SG40", 0xFF3F, + { + "", + "", + "", + "", + "", + "Sound Length (6 bits,W)", + "", + "", + "", + "", + "Envelope Steps (3 bits)", + "Envelope Attenuate/Amplify", + "", + "", + "", + "Envelope Initial Value", + } + }, + { + NULL, 0x7C, "0x400007C-SG41", 0xC0FF, + { + "", + "", + "Dividing Ratio Freq. (3 bits)", + "Counter 15/7 Steps", + "", + "", + "", + "Counter Shift Clock (4 bits)", + "", + "", + "", + "", + "", + "", + "Sound Continuous/Counter", + "Initialization (W)", + } + }, + { + NULL, 0x80, "0x4000080-SGCNT0_L", 0xFF77, + { + "", + "", + "Right Volume (3 bits)", + "", + "", + "", + "Left Volume (3 bits)", + "", + "Channel 1->Right", + "Channel 2->Right", + "Channel 3->Right", + "Channel 4->Right", + "Channel 1->Left", + "Channel 2->Left", + "Channel 3->Left", + "Channel 4->Left", + } + }, + { + NULL, 0x82, "0x4000082-SGCNT0_H", 0xFF1F, + { + "", + "Sound 1-4 Volume (2 bits)", + "DMA Sound A Volume", + "DMA Sound B Volume", + "", + "", + "", + "", + "DMA Sound A->Right", + "DMA Sound A->Left", + "DMA Sound A Timer", + "DMA Sound A Reset FIFO", + "DMA Sound B->Right", + "DMA Sound B->Left", + "DMA Sound B Timer", + "DMA Sound B Reset FIFO", + } + }, + { + NULL, 0x84, "0x4000084-SGCNT1", 0x0080, + { + "Sound 1 On", + "Sound 2 On", + "Sound 3 On", + "Sound 4 On", + "", + "", + "", + "Master Sound Enable", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x88, "0x4000088-SGBIAS", 0xC3FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Bias Level (10 bits)", + "", + "", + "", + "", + "", + "Sampling Rate (2 bits)", + } + }, + { + NULL, 0xA0, "0x40000A0-SIGFIFOA_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Data 0 (8 bits)", + "", + "", + "", + "", + "", + "", + "", + "Data 1 (8 bits)", + } + }, + { + NULL, 0xA2, "0x40000A2-SIGFIFOA_H", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Data 2 (8 bits)", + "", + "", + "", + "", + "", + "", + "", + "Data 3 (8 bits)", + } + }, + { + NULL, 0xA4, "0x40000A4-SIGFIFOB_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Data 0 (8 bits)", + "", + "", + "", + "", + "", + "", + "", + "Data 1 (8 bits)", + } + }, + { + NULL, 0xA6, "0x40000A6-SIGFIFOB_H", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "Data 2 (8 bits)", + "", + "", + "", + "", + "", + "", + "", + "Data 3 (8 bits)", + } + }, + { + &DM0SAD_L, 0xB0, "0x40000B0-DM0SAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (lower 16 bits)", + } + }, + { + &DM0SAD_H, 0xB2, "0x40000B2-DM0SAD_H", 0x07FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (upper 11 bits)", + "", + "", + "", + "", + "", + } + }, + { + &DM0DAD_L, 0xB4, "0x40000B4-DM0DAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (lower 16 bits)", + } + }, + { + &DM0DAD_H, 0xB6, "0x40000B6-DM0DAD_H", 0x07FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (upper 11 bits)", + "", + "", + "", + "", + "", + } + }, + { + &DM0CNT_L, 0xB8, "0x40000B8-DM0CNT_L", 0x3FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Count (14 bits)", + "", + "", + } + }, + { + &DM0CNT_H, 0xBA, "0x40000BA-DM0CNT_H", 0xF7E0, + { + "", + "", + "", + "", + "", + "", + "Destination Address Control (2 bits)", + "", + "Source Address Control (2 bits)", + "Repeat", + "Transfer Type", + "", + "", + "Start Timing (2 bits)", + "Interrupt Request", + "Enable", + } + }, + { + &DM1SAD_L, 0xBC, "0x40000BC-DM1SAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (lower 16 bits)", + } + }, + { + &DM1SAD_H, 0xBE, "0x40000BE-DM1SAD_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (upper 12 bits)", + "", + "", + "", + "", + } + }, + { + &DM1DAD_L, 0xC0, "0x40000C0-DM1DAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (lower 16 bits)", + } + }, + { + &DM1DAD_H, 0xC2, "0x40000C2-DM1DAD_H", 0x07FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (upper 11 bits)", + "", + "", + "", + "", + "", + } + }, + { + &DM1CNT_L, 0xC4, "0x40000C4-DM1CNT_L", 0x3FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Count (14 bits)", + "", + "", + } + }, + { + &DM1CNT_H, 0xC6, "0x40000C6-DM1CNT_H", 0xF7E0, + { + "", + "", + "", + "", + "", + "", + "Destination Address Control (2 bits)", + "", + "Source Address Control (2 bits)", + "Repeat", + "Transfer Type", + "", + "", + "Start Timing (2 bits)", + "Interrupt Request", + "Enable", + } + }, + { + &DM2SAD_L, 0xC8, "0x40000C8-DM2SAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (lower 16 bits)", + } + }, + { + &DM2SAD_H, 0xCA, "0x40000CA-DM2SAD_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (upper 12 bits)", + "", + "", + "", + "", + } + }, + { + &DM2DAD_L, 0xCC, "0x40000CC-DM2DAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (lower 16 bits)", + } + }, + { + &DM2DAD_H, 0xCE, "0x40000CE-DM2DAD_H", 0x07FF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (upper 11 bits)", + "", + "", + "", + "", + "", + } + }, + { + &DM2CNT_L, 0xD0, "0x40000D0-DM2CNT_L", 0x3FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Count (14 bits)", + "", + "", + } + }, + { + &DM2CNT_H, 0xD2, "0x40000D2-DM2CNT_H", 0xF7E0, + { + "", + "", + "", + "", + "", + "", + "Destination Address Control (2 bits)", + "", + "Source Address Control (2 bits)", + "Repeat", + "Transfer Type", + "", + "", + "Start Timing (2 bits)", + "Interrupt Request", + "Enable", + } + }, + { + &DM3SAD_L, 0xD4, "0x40000D4-DM3SAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (lower 16 bits)", + } + }, + { + &DM3SAD_H, 0xD6, "0x40000D6-DM3SAD_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Source Address (upper 12 bits)", + "", + "", + "", + "", + } + }, + { + &DM3DAD_L, 0xD8, "0x40000D8-DM3DAD_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (lower 16 bits)", + } + }, + { + &DM3DAD_H, 0xDA, "0x40000DA-DM3DAD_H", 0x0FFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Destination Address (upper 12 bits)", + "", + "", + "", + "", + } + }, + { + &DM3CNT_L, 0xDC, "0x40000DC-DM3CNT_L", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Count (16 bits)", + } + }, + { + &DM3CNT_H, 0xDE, "0x40000DE-DM3CNT_H", 0xFFE0, + { + "", + "", + "", + "", + "", + "", + "Destination Address Control (2 bits)", + "", + "Source Address Control (2 bits)", + "Repeat", + "Transfer Type", + "Game Pak Data Request", + "", + "Start Timing (2 bits)", + "Interrupt Request", + "Enable", + } + }, + { + &TM0D, 0x100, "0x4000100-TM0D", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Timer Counter (16 bits)", + } + }, + { + &TM0CNT, 0x102, "0x4000102-TM0CNT", 0x00C7, + { + "", + "Scalar Selection (2 bits)", + "Count Up", + "", + "", + "", + "Interrupt Request", + "Enable", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + &TM1D, 0x104, "0x4000104-TM1D", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Timer Counter (16 bits)", + } + }, + { + &TM1CNT, 0x106, "0x4000106-TM1CNT", 0x00C7, + { + "", + "Scalar Selection (2 bits)", + "Count Up", + "", + "", + "", + "Interrupt Request", + "Enable", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + &TM2D, 0x108, "0x4000108-TM2D", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Timer Counter (16 bits)", + } + }, + { + &TM2CNT, 0x10A, "0x400010A-TM2CNT", 0x00C7, + { + "", + "Scalar Selection (2 bits)", + "Count Up", + "", + "", + "", + "Interrupt Request", + "Enable", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + &TM3D, 0x10C, "0x400010C-TM3D", 0xFFFF, + { + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Timer Counter (16 bits)", + } + }, + { + &TM3CNT, 0x10E, "0x400010E-TM3CNT", 0x00C7, + { + "", + "Scalar Selection (2 bits)", + "Count Up", + "", + "", + "", + "Interrupt Request", + "Enable", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + &P1, 0x130, "0x4000130-P1", 0x03FF, + { + "A", + "B", + "Select", + "Start", + "Right", + "Left", + "Up", + "Down", + "Shoulder Right", + "Shoulder Left", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x132, "0x4000132-P1CNT", 0xC3FF, + { + "A", + "B", + "Select", + "Start", + "Right", + "Left", + "Up", + "Down", + "Shoulder Right", + "Shoulder Left", + "", + "", + "", + "", + "Interrupt Request", + "Interrupt Condition", + } + }, + { + &IE, 0x200, "0x4000200-IE", 0x3FFF, + { + "VBlank", + "HBlank", + "VCount", + "Timer 0", + "Timer 1", + "Timer 2", + "Timer 3", + "Serial", + "DMA 0", + "DMA 1", + "DMA 2", + "DMA 3", + "Keypad", + "Game Pak", + "", + "", + } + }, + { + &IF, 0x202, "0x4000202-IF", 0x0000, + { + "VBlank", + "HBlank", + "VCount", + "Timer 0", + "Timer 1", + "Timer 2", + "Timer 3", + "Serial", + "DMA 0", + "DMA 1", + "DMA 2", + "DMA 3", + "Keypad", + "Game Pak", + "", + "", + } + }, + { + NULL, 0x204, "0x4000204-WAITCNT", 0x5FFF, + { + "", + "SRAM Wait Control (2 bits)", + "", + "Wait State 0 First Access (2 bits)", + "Wait State 0 Second Access", + "", + "Wait State 1 First Access (2 bits)", + "Wait State 1 Second Access", + "", + "Wait State 2 First Access (2 bits)", + "Wait State 2 Second Access", + "", + "PHI Terminal Output (2 bits)", + "", + "Game Pak Prefetch Buffer", + "Game Pak Type Flag", + } + }, + { + &IME, 0x208, "0x4000208-IME", 0x0001, + { + "Master Interrupt Enable", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + } + }, + { + NULL, 0x300, "0x4000300-HALTCNT", 0x8001, + { + "First Boot", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "Power Down", + } + }, +}; diff --git a/src/win32/IUpdate.h b/src/win32/IUpdate.h new file mode 100644 index 0000000..a409cb4 --- /dev/null +++ b/src/win32/IUpdate.h @@ -0,0 +1,27 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_WIN32_IUPDATE_H +#define VBA_WIN32_IUPDATE_H + +class IUpdateListener { + public: + virtual void update()=0; +}; +#endif diff --git a/src/win32/Input.h b/src/win32/Input.h new file mode 100644 index 0000000..ec271ce --- /dev/null +++ b/src/win32/Input.h @@ -0,0 +1,47 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_WIN32_INPUT_H +#define VBA_WIN32_INPUT_H +#include "../System.h" + +#define JOYCONFIG_MESSAGE (WM_USER + 1000) + + +#include "../inputGlobal.h" + +class Input { + + public: + Input() {}; + virtual ~Input() {}; + + virtual bool initialize() = 0; + + virtual bool readDevices() = 0; + virtual u32 readDevice(int which, bool sensor) = 0; + virtual CString getKeyName(int key) = 0; + virtual void checkKeys() = 0; + virtual void checkDevices() = 0; + virtual void activate() = 0; + virtual void loadSettings() = 0; + virtual void saveSettings() = 0; +}; + +#endif diff --git a/src/win32/Joypad.cpp b/src/win32/Joypad.cpp new file mode 100644 index 0000000..193313c --- /dev/null +++ b/src/win32/Joypad.cpp @@ -0,0 +1,435 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Joypad.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Joypad.h" +#include "Input.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern USHORT joypad[4][13]; +extern USHORT motion[4]; + +///////////////////////////////////////////////////////////////////////////// +// JoypadEditControl + +JoypadEditControl::JoypadEditControl() +{ +} + +JoypadEditControl::~JoypadEditControl() +{ +} + + +BEGIN_MESSAGE_MAP(JoypadEditControl, CEdit) + //{{AFX_MSG_MAP(JoypadEditControl) + ON_WM_CHAR() + //}}AFX_MSG_MAP + ON_MESSAGE(JOYCONFIG_MESSAGE, OnJoyConfig) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// JoypadEditControl message handlers + +void JoypadEditControl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +{ +} + +LRESULT JoypadEditControl::OnJoyConfig(WPARAM wParam, LPARAM lParam) +{ + SetWindowLong(GetSafeHwnd(), GWL_USERDATA,((wParam<<8)|lParam)); + SetWindowText(theApp.input->getKeyName((wParam<<8)|lParam)); + GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus(); + return TRUE; +} + +BOOL JoypadEditControl::PreTranslateMessage(MSG *pMsg) +{ + if(pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN)) + return TRUE; + + return CEdit::PreTranslateMessage(pMsg); +} + +///////////////////////////////////////////////////////////////////////////// +// JoypadConfig dialog + + +JoypadConfig::JoypadConfig(int w, CWnd* pParent /*=NULL*/) + : CDialog(JoypadConfig::IDD, pParent) +{ + //{{AFX_DATA_INIT(JoypadConfig) + //}}AFX_DATA_INIT + timerId = 0; + which = w; + if(which < 0 || which > 3) + which = 0; +} + +void JoypadConfig::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(JoypadConfig) + DDX_Control(pDX, IDC_EDIT_UP, up); + DDX_Control(pDX, IDC_EDIT_SPEED, speed); + DDX_Control(pDX, IDC_EDIT_RIGHT, right); + DDX_Control(pDX, IDC_EDIT_LEFT, left); + DDX_Control(pDX, IDC_EDIT_DOWN, down); + DDX_Control(pDX, IDC_EDIT_CAPTURE, capture); + DDX_Control(pDX, IDC_EDIT_BUTTON_START, buttonStart); + DDX_Control(pDX, IDC_EDIT_BUTTON_SELECT, buttonSelect); + DDX_Control(pDX, IDC_EDIT_BUTTON_R, buttonR); + DDX_Control(pDX, IDC_EDIT_BUTTON_L, buttonL); + DDX_Control(pDX, IDC_EDIT_BUTTON_GS, buttonGS); + DDX_Control(pDX, IDC_EDIT_BUTTON_B, buttonB); + DDX_Control(pDX, IDC_EDIT_BUTTON_A, buttonA); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(JoypadConfig, CDialog) + //{{AFX_MSG_MAP(JoypadConfig) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + ON_WM_CHAR() + ON_WM_DESTROY() + ON_WM_TIMER() + ON_WM_KEYDOWN() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// JoypadConfig message handlers + +void JoypadConfig::OnCancel() +{ + EndDialog(FALSE); +} + +void JoypadConfig::OnOk() +{ + assignKeys(); + theApp.input->checkKeys(); + EndDialog(TRUE); +} + +void JoypadConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +{ +} + +void JoypadConfig::OnDestroy() +{ + CDialog::OnDestroy(); + + KillTimer(timerId); +} + +void JoypadConfig::OnTimer(UINT nIDEvent) +{ + theApp.input->checkDevices(); + + CDialog::OnTimer(nIDEvent); +} + +void JoypadConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ +} + +BOOL JoypadConfig::OnInitDialog() +{ + CDialog::OnInitDialog(); + + timerId = SetTimer(0,200,NULL); + + SetWindowLong(up, GWL_USERDATA,joypad[which][KEY_UP]); + up.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_UP])); + + SetWindowLong(down, GWL_USERDATA,joypad[which][KEY_DOWN]); + down.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_DOWN])); + + SetWindowLong(left, GWL_USERDATA,joypad[which][KEY_LEFT]); + left.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_LEFT])); + + SetWindowLong(right, GWL_USERDATA,joypad[which][KEY_RIGHT]); + right.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_RIGHT])); + + SetWindowLong(buttonA, GWL_USERDATA,joypad[which][KEY_BUTTON_A]); + buttonA.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_A])); + + SetWindowLong(buttonB, GWL_USERDATA,joypad[which][KEY_BUTTON_B]); + buttonB.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_B])); + + SetWindowLong(buttonL, GWL_USERDATA,joypad[which][KEY_BUTTON_L]); + buttonL.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_L])); + + SetWindowLong(buttonR, GWL_USERDATA,joypad[which][KEY_BUTTON_R]); + buttonR.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_R])); + + SetWindowLong(buttonSelect, GWL_USERDATA,joypad[which][KEY_BUTTON_SELECT]); + buttonSelect.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SELECT])); + + SetWindowLong(buttonStart, GWL_USERDATA,joypad[which][KEY_BUTTON_START]); + buttonStart.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_START])); + + SetWindowLong(speed, GWL_USERDATA,joypad[which][KEY_BUTTON_SPEED]); + speed.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SPEED])); + + SetWindowLong(capture, GWL_USERDATA,joypad[which][KEY_BUTTON_CAPTURE]); + capture.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_CAPTURE])); + + SetWindowLong(buttonGS, GWL_USERDATA,joypad[which][KEY_BUTTON_GS]); + buttonGS.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_GS])); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void JoypadConfig::assignKey(int id, int key) +{ + switch(id) { + case IDC_EDIT_LEFT: + joypad[which][KEY_LEFT] = key; + break; + case IDC_EDIT_RIGHT: + joypad[which][KEY_RIGHT] = key; + break; + case IDC_EDIT_UP: + joypad[which][KEY_UP] = key; + break; + case IDC_EDIT_SPEED: + joypad[which][KEY_BUTTON_SPEED] = key; + break; + case IDC_EDIT_CAPTURE: + joypad[which][KEY_BUTTON_CAPTURE] = key; + break; + case IDC_EDIT_DOWN: + joypad[which][KEY_DOWN] = key; + break; + case IDC_EDIT_BUTTON_A: + joypad[which][KEY_BUTTON_A] = key; + break; + case IDC_EDIT_BUTTON_B: + joypad[which][KEY_BUTTON_B] = key; + break; + case IDC_EDIT_BUTTON_L: + joypad[which][KEY_BUTTON_L] = key; + break; + case IDC_EDIT_BUTTON_R: + joypad[which][KEY_BUTTON_R] = key; + break; + case IDC_EDIT_BUTTON_START: + joypad[which][KEY_BUTTON_START] = key; + break; + case IDC_EDIT_BUTTON_SELECT: + joypad[which][KEY_BUTTON_SELECT] = key; + break; + case IDC_EDIT_BUTTON_GS: + joypad[which][KEY_BUTTON_GS] = key; + break; + } +} + +void JoypadConfig::assignKeys() +{ + int id; + + id = IDC_EDIT_UP; + assignKey(id, GetWindowLong(up, GWL_USERDATA)); + + id = IDC_EDIT_DOWN; + assignKey(id, GetWindowLong(down, GWL_USERDATA)); + + id = IDC_EDIT_LEFT; + assignKey(id, GetWindowLong(left, GWL_USERDATA)); + + id = IDC_EDIT_RIGHT; + assignKey(id, GetWindowLong(right, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_A; + assignKey(id, GetWindowLong(buttonA, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_B; + assignKey(id, GetWindowLong(buttonB, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_L; + assignKey(id, GetWindowLong(buttonL, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_R; + assignKey(id, GetWindowLong(buttonR, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_SELECT; + assignKey(id, GetWindowLong(buttonSelect, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_START; + assignKey(id, GetWindowLong(buttonStart, GWL_USERDATA)); + + id = IDC_EDIT_SPEED; + assignKey(id, GetWindowLong(speed, GWL_USERDATA)); + + id = IDC_EDIT_CAPTURE; + assignKey(id, GetWindowLong(capture, GWL_USERDATA)); + + id = IDC_EDIT_BUTTON_GS; + assignKey(id, GetWindowLong(buttonGS, GWL_USERDATA)); + + // winSaveKeys(); +} + +///////////////////////////////////////////////////////////////////////////// +// MotionConfig dialog + + +MotionConfig::MotionConfig(CWnd* pParent /*=NULL*/) + : CDialog(MotionConfig::IDD, pParent) +{ + //{{AFX_DATA_INIT(MotionConfig) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + timerId = 0; +} + + +void MotionConfig::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MotionConfig) + DDX_Control(pDX, IDC_EDIT_UP, up); + DDX_Control(pDX, IDC_EDIT_RIGHT, right); + DDX_Control(pDX, IDC_EDIT_LEFT, left); + DDX_Control(pDX, IDC_EDIT_DOWN, down); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(MotionConfig, CDialog) + //{{AFX_MSG_MAP(MotionConfig) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + ON_WM_CHAR() + ON_WM_DESTROY() + ON_WM_KEYDOWN() + ON_WM_TIMER() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// MotionConfig message handlers + +void MotionConfig::OnCancel() +{ + EndDialog(FALSE); +} + +void MotionConfig::OnOk() +{ + assignKeys(); + theApp.input->checkKeys(); + EndDialog( TRUE); +} + +void MotionConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +{ +} + +void MotionConfig::OnDestroy() +{ + CDialog::OnDestroy(); + + KillTimer(timerId); +} + +BOOL MotionConfig::OnInitDialog() +{ + CDialog::OnInitDialog(); + + timerId = SetTimer(0,200,NULL); + + SetWindowLong(up, GWL_USERDATA,motion[KEY_UP]); + up.SetWindowText(theApp.input->getKeyName(motion[KEY_UP])); + + SetWindowLong(down, GWL_USERDATA,motion[KEY_DOWN]); + down.SetWindowText(theApp.input->getKeyName(motion[KEY_DOWN])); + + SetWindowLong(left, GWL_USERDATA,motion[KEY_LEFT]); + left.SetWindowText(theApp.input->getKeyName(motion[KEY_LEFT])); + + SetWindowLong(right, GWL_USERDATA,motion[KEY_RIGHT]); + right.SetWindowText(theApp.input->getKeyName(motion[KEY_RIGHT])); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MotionConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ +} + +void MotionConfig::OnTimer(UINT nIDEvent) +{ + theApp.input->checkDevices(); + + CDialog::OnTimer(nIDEvent); +} + +void MotionConfig::assignKey(int id, int key) +{ + switch(id) { + case IDC_EDIT_LEFT: + motion[KEY_LEFT] = key; + break; + case IDC_EDIT_RIGHT: + motion[KEY_RIGHT] = key; + break; + case IDC_EDIT_UP: + motion[KEY_UP] = key; + break; + case IDC_EDIT_DOWN: + motion[KEY_DOWN] = key; + break; + } +} + +void MotionConfig::assignKeys() +{ + int id; + + id = IDC_EDIT_UP; + assignKey(id, GetWindowLong(up, GWL_USERDATA)); + + id = IDC_EDIT_DOWN; + assignKey(id, GetWindowLong(down, GWL_USERDATA)); + + id = IDC_EDIT_LEFT; + assignKey(id, GetWindowLong(left, GWL_USERDATA)); + + id = IDC_EDIT_RIGHT; + assignKey(id, GetWindowLong(right, GWL_USERDATA)); +} diff --git a/src/win32/Joypad.h b/src/win32/Joypad.h new file mode 100644 index 0000000..4e39f09 --- /dev/null +++ b/src/win32/Joypad.h @@ -0,0 +1,168 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_) +#define AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Joypad.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// JoypadEditControl window + +class JoypadEditControl : public CEdit +{ + // Construction + public: + JoypadEditControl(); + + // Attributes + public: + + // Operations + public: + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(JoypadEditControl) + //}}AFX_VIRTUAL + + // Implementation + public: + virtual BOOL PreTranslateMessage(MSG *pMsg); + afx_msg LRESULT OnJoyConfig(WPARAM wParam, LPARAM lParam); + virtual ~JoypadEditControl(); + + // Generated message map functions + protected: + //{{AFX_MSG(JoypadEditControl) + afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// JoypadConfig dialog + +class JoypadConfig : public CDialog +{ + // Construction + public: + void assignKeys(); + void assignKey(int id, int key); + JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(JoypadConfig) + enum { IDD = IDD_CONFIG }; + JoypadEditControl up; + JoypadEditControl speed; + JoypadEditControl right; + JoypadEditControl left; + JoypadEditControl down; + JoypadEditControl capture; + JoypadEditControl buttonStart; + JoypadEditControl buttonSelect; + JoypadEditControl buttonR; + JoypadEditControl buttonL; + JoypadEditControl buttonGS; + JoypadEditControl buttonB; + JoypadEditControl buttonA; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(JoypadConfig) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + UINT timerId; + int which; + + // Generated message map functions + //{{AFX_MSG(JoypadConfig) + afx_msg void OnCancel(); + afx_msg void OnOk(); + afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnDestroy(); + afx_msg void OnTimer(UINT nIDEvent); + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + ///////////////////////////////////////////////////////////////////////////// +// MotionConfig dialog + +class MotionConfig : public CDialog +{ + // Construction + public: + void assignKeys(); + void assignKey(int id, int key); + MotionConfig(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(MotionConfig) + enum { IDD = IDD_MOTION_CONFIG }; + JoypadEditControl up; + JoypadEditControl right; + JoypadEditControl left; + JoypadEditControl down; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MotionConfig) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(MotionConfig) + afx_msg void OnCancel(); + afx_msg void OnOk(); + afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnDestroy(); + virtual BOOL OnInitDialog(); + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnTimer(UINT nIDEvent); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + UINT timerId; +}; +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_) diff --git a/src/win32/KeyboardEdit.cpp b/src/win32/KeyboardEdit.cpp new file mode 100644 index 0000000..be8d1a8 --- /dev/null +++ b/src/win32/KeyboardEdit.cpp @@ -0,0 +1,172 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : KeyboardEdit.cpp +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Authors : A.Lebatard + T.Maurel +// Date : 17.08.98 +// +// Remarks : implementation file +// +//////////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "KeyboardEdit.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern TCHAR* mapVirtKeysStringFromWORD(WORD wKey); + +///////////////////////////////////////////////////////////////////////////// +// CKeyboardEdit + +CKeyboardEdit::CKeyboardEdit() +{ + m_bKeyDefined = false; + ResetKey (); +} + +CKeyboardEdit::~CKeyboardEdit() +{ +} + + +BEGIN_MESSAGE_MAP(CKeyboardEdit, CEdit) + //{{AFX_MSG_MAP(CKeyboardEdit) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + +#pragma warning( disable : 4706 ) + ///////////////////////////////////////////////////////////////////////////// +// CKeyboardEdit message handlers +BOOL CKeyboardEdit::PreTranslateMessage (MSG* pMsg) +{ + bool bPressed; + if ((bPressed = (pMsg->message == WM_KEYDOWN)) || pMsg->message == WM_KEYUP || (bPressed = (pMsg->message == WM_SYSKEYDOWN)) || pMsg->message == WM_SYSKEYUP) { + bool bReset = false; + if (bPressed && m_bKeyDefined && !((1 << 30) & pMsg->lParam)) { + ResetKey (); + bReset = true; + } + bool syncShift = true, syncCtrl = true, syncAlt = true; + if (pMsg->wParam == VK_SHIFT && !m_bKeyDefined) { + if(bPressed) + m_bShiftPressed = bPressed; + syncShift = false; + } + else if (pMsg->wParam == VK_CONTROL &&!m_bKeyDefined) { + if(bPressed) + m_bCtrlPressed = bPressed; + syncCtrl = false; + } + else if (pMsg->wParam == VK_MENU && !m_bKeyDefined) { + if(bPressed) + m_bAltPressed = bPressed; + syncAlt = false; + } + else { + if (!m_bKeyDefined) { + m_wVirtKey = (WORD)pMsg->wParam; + if (bPressed) + m_bKeyDefined = true; + } + } + if (!m_bKeyDefined || bReset) { + if (syncShift) + m_bShiftPressed = ((GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0); + if (syncCtrl) + m_bCtrlPressed = ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0); + if (syncAlt) + m_bAltPressed = ((GetAsyncKeyState(VK_MENU) & 0x8000) != 0); + } + + DisplayKeyboardString (); + return TRUE; + } + + return CEdit::PreTranslateMessage(pMsg); +} +#pragma warning( default : 4706 ) + +//////////////////////////////////////////////////////////////////////// +// +void CKeyboardEdit::DisplayKeyboardString() +{ + CString strKbd; + + // modifiers + if (m_bCtrlPressed) + strKbd = "Ctrl"; + if (m_bAltPressed) { + if (strKbd.GetLength () > 0) + strKbd += '+'; + strKbd += "Alt"; + } + if (m_bShiftPressed) { + if (strKbd.GetLength () > 0) + strKbd += '+'; + strKbd += "Shift"; + } + // virtual key + LPCTSTR szVirtKey = mapVirtKeysStringFromWORD(m_wVirtKey); + if (szVirtKey != NULL) { + if (strKbd.GetLength () > 0) + strKbd += '+'; + strKbd += szVirtKey; + } + SetWindowText (strKbd); +} + + +//////////////////////////////////////////////////////////////////////// +// +void CKeyboardEdit::ResetKey () +{ + m_wVirtKey = 0; + m_bCtrlPressed = false; + m_bAltPressed = false; + m_bShiftPressed = false; + + m_bKeyDefined = false; + if(m_hWnd != NULL) + SetWindowText(_T("")); +} + + +//////////////////////////////////////////////////////////////////////// +// +bool CKeyboardEdit::GetAccelKey(WORD& wVirtKey, bool& bCtrl, bool& bAlt, bool& bShift) +{ + if (!m_bKeyDefined) + { + if(!m_bAltPressed && !m_bCtrlPressed && !m_bShiftPressed) + return false; + } + + wVirtKey = m_wVirtKey; + bAlt = m_bAltPressed; + bCtrl = m_bCtrlPressed; + bShift = m_bShiftPressed; + return true; +} + diff --git a/src/win32/KeyboardEdit.h b/src/win32/KeyboardEdit.h new file mode 100644 index 0000000..c72da1d --- /dev/null +++ b/src/win32/KeyboardEdit.h @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1998 by Thierry Maurel +// All rights reserved +// +// Distribute freely, except: don't remove my name from the source or +// documentation (don't take credit for my work), mark your changes (don't +// get me blamed for your possible bugs), don't alter or remove this +// notice. +// No warrantee of any kind, express or implied, is included with this +// software; use at your own risk, responsibility for damages (if any) to +// anyone resulting from the use of this software rests entirely with the +// user. +// +// Send bug reports, bug fixes, enhancements, requests, flames, etc., and +// I'll try to keep a version up to date. I can be reached as follows: +// tmaurel@caramail.com (or tmaurel@hol.fr) +// +//////////////////////////////////////////////////////////////////////////////// +// File : KeyboardEdit.h +// Project : AccelsEditor +//////////////////////////////////////////////////////////////////////////////// +// Version : 1.0 * Authors : A.Lebatard + T.Maurel +// Date : 17.08.98 +// +// Remarks : +// +//////////////////////////////////////////////////////////////////////////////// +#if !defined(AFX_KEYBOARDEDIT_H__88E35AB0_2E23_11D2_BA24_0060B0B5E151__INCLUDED_) +#define AFX_KEYBOARDEDIT_H__88E35AB0_2E23_11D2_BA24_0060B0B5E151__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// KeyboardEdit.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CKeyboardEdit window + +class CKeyboardEdit : public CEdit +{ + // Construction + public: + CKeyboardEdit(); + + // Attributes + public: + bool m_bKeyDefined; + + WORD m_wVirtKey; + bool m_bCtrlPressed; + bool m_bAltPressed; + bool m_bShiftPressed; + + // Operations + public: + bool GetAccelKey(WORD& wVirtKey, bool& bCtrl, bool& bAlt, bool& bShift); + void ResetKey (); + + protected: + void DisplayKeyboardString (); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CKeyboardEdit) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + //}}AFX_VIRTUAL + + // Implementation + public: + virtual ~CKeyboardEdit(); + + // Generated message map functions + protected: + //{{AFX_MSG(CKeyboardEdit) + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_KEYBOARDEDIT_H__88E35AB0_2E23_11D2_BA24_0060B0B5E151__INCLUDED_) diff --git a/src/win32/LangSelect.cpp b/src/win32/LangSelect.cpp new file mode 100644 index 0000000..4dcabe6 --- /dev/null +++ b/src/win32/LangSelect.cpp @@ -0,0 +1,97 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// LangSelect.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "LangSelect.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// LangSelect dialog + + +LangSelect::LangSelect(CWnd* pParent /*=NULL*/) + : CDialog(LangSelect::IDD, pParent) +{ + //{{AFX_DATA_INIT(LangSelect) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void LangSelect::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(LangSelect) + DDX_Control(pDX, IDC_LANG_STRING, m_langString); + DDX_Control(pDX, IDC_LANG_NAME, m_langName); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(LangSelect, CDialog) + //{{AFX_MSG_MAP(LangSelect) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// LangSelect message handlers + +void LangSelect::OnCancel() +{ + EndDialog(FALSE); +} + +void LangSelect::OnOk() +{ + m_langString.GetWindowText(theApp.languageName); + EndDialog(TRUE); +} + +BOOL LangSelect::OnInitDialog() +{ + CDialog::OnInitDialog(); + + char lbuffer[10]; + if(GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, + lbuffer, 10)) { + m_langName.SetWindowText(lbuffer); + } else { + m_langName.SetWindowText("???"); + } + + if(!theApp.languageName.IsEmpty()) + m_langString.SetWindowText(theApp.languageName); + + m_langString.LimitText(3); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/LangSelect.h b/src/win32/LangSelect.h new file mode 100644 index 0000000..d8b2239 --- /dev/null +++ b/src/win32/LangSelect.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_LANGSELECT_H__63619E13_A375_4ED4_952F_DCF8998C2914__INCLUDED_) +#define AFX_LANGSELECT_H__63619E13_A375_4ED4_952F_DCF8998C2914__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// LangSelect.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// LangSelect dialog + +class LangSelect : public CDialog +{ + // Construction + public: + LangSelect(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(LangSelect) + enum { IDD = IDD_LANG_SELECT }; + CEdit m_langString; + CStatic m_langName; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(LangSelect) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(LangSelect) + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_LANGSELECT_H__63619E13_A375_4ED4_952F_DCF8998C2914__INCLUDED_) diff --git a/src/win32/Logging.cpp b/src/win32/Logging.cpp new file mode 100644 index 0000000..697b6d4 --- /dev/null +++ b/src/win32/Logging.cpp @@ -0,0 +1,287 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Logging.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" + +#include "FileDlg.h" +#include "Logging.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// Logging dialog + +Logging *Logging::instance = NULL; +CString Logging::text; + +Logging::Logging(CWnd* pParent /*=NULL*/) + : ResizeDlg(Logging::IDD, pParent) +{ + //{{AFX_DATA_INIT(Logging) + m_swi = FALSE; + m_unaligned_access = FALSE; + m_illegal_write = FALSE; + m_illegal_read = FALSE; + m_dma0 = FALSE; + m_dma1 = FALSE; + m_dma2 = FALSE; + m_dma3 = FALSE; + m_agbprint = FALSE; + m_undefined = FALSE; + //}}AFX_DATA_INIT +} + + +void Logging::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(Logging) + DDX_Control(pDX, IDC_LOG, m_log); + DDX_Check(pDX, IDC_VERBOSE_SWI, m_swi); + DDX_Check(pDX, IDC_VERBOSE_UNALIGNED_ACCESS, m_unaligned_access); + DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_WRITE, m_illegal_write); + DDX_Check(pDX, IDC_VERBOSE_ILLEGAL_READ, m_illegal_read); + DDX_Check(pDX, IDC_VERBOSE_DMA0, m_dma0); + DDX_Check(pDX, IDC_VERBOSE_DMA1, m_dma1); + DDX_Check(pDX, IDC_VERBOSE_DMA2, m_dma2); + DDX_Check(pDX, IDC_VERBOSE_DMA3, m_dma3); + DDX_Check(pDX, IDC_VERBOSE_AGBPRINT, m_agbprint); + DDX_Check(pDX, IDC_VERBOSE_UNDEFINED, m_undefined); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(Logging, CDialog) + //{{AFX_MSG_MAP(Logging) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(IDC_CLEAR, OnClear) + ON_BN_CLICKED(IDC_VERBOSE_AGBPRINT, OnVerboseAgbprint) + ON_BN_CLICKED(IDC_VERBOSE_DMA0, OnVerboseDma0) + ON_BN_CLICKED(IDC_VERBOSE_DMA1, OnVerboseDma1) + ON_BN_CLICKED(IDC_VERBOSE_DMA2, OnVerboseDma2) + ON_BN_CLICKED(IDC_VERBOSE_DMA3, OnVerboseDma3) + ON_BN_CLICKED(IDC_VERBOSE_ILLEGAL_READ, OnVerboseIllegalRead) + ON_BN_CLICKED(IDC_VERBOSE_ILLEGAL_WRITE, OnVerboseIllegalWrite) + ON_BN_CLICKED(IDC_VERBOSE_SWI, OnVerboseSwi) + ON_BN_CLICKED(IDC_VERBOSE_UNALIGNED_ACCESS, OnVerboseUnalignedAccess) + ON_BN_CLICKED(IDC_VERBOSE_UNDEFINED, OnVerboseUndefined) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_EN_ERRSPACE(IDC_LOG, OnErrspaceLog) + ON_EN_MAXTEXT(IDC_LOG, OnMaxtextLog) + ON_WM_CLOSE() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Logging message handlers + +void Logging::OnOk() +{ + EndDialog(TRUE); + + instance = NULL; +} + +void Logging::OnClear() +{ + text = ""; + m_log.SetWindowText(""); +} + +void Logging::OnVerboseAgbprint() +{ + systemVerbose ^= 512; +} + +void Logging::OnVerboseDma0() +{ + systemVerbose ^= 16; +} + +void Logging::OnVerboseDma1() +{ + systemVerbose ^= 32; +} + +void Logging::OnVerboseDma2() +{ + systemVerbose ^= 64; +} + +void Logging::OnVerboseDma3() +{ + systemVerbose ^= 128; +} + +void Logging::OnVerboseIllegalRead() +{ + systemVerbose ^= 8; +} + +void Logging::OnVerboseIllegalWrite() +{ + systemVerbose ^= 4; +} + +void Logging::OnVerboseSwi() +{ + systemVerbose ^= 1; +} + +void Logging::OnVerboseUnalignedAccess() +{ + systemVerbose ^= 2; +} + +void Logging::OnVerboseUndefined() +{ + systemVerbose ^= 256; +} + +void Logging::OnSave() +{ + int len = m_log.GetWindowTextLength(); + + char *mem = (char *)malloc(len); + + if(mem) { + LPCTSTR exts[] = { ".txt" }; + m_log.GetWindowText(mem, len); + CString filter = "All Files|*.*||"; + FileDlg dlg(this, "", filter, 0, + NULL, exts, NULL, "Save output", true); + + if(dlg.DoModal() == IDOK) { + FILE *f = fopen(dlg.GetPathName(), "w"); + if(f) { + fwrite(mem, 1, len, f); + fclose(f); + } + } + } + + free(mem); +} + +void Logging::OnErrspaceLog() +{ + systemMessage(0, "Error allocating space"); +} + +void Logging::OnMaxtextLog() +{ + systemMessage(0, "Max text length reached %d", m_log.GetLimitText()); +} + +void Logging::PostNcDestroy() +{ + delete this; +} + +BOOL Logging::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_LOG, DS_SizeY|DS_SizeX) + DIALOG_SIZER_ENTRY( ID_OK, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLEAR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\LogView", + NULL); + m_swi = (systemVerbose & 1) != 0; + m_unaligned_access = (systemVerbose & 2) != 0; + m_illegal_write = (systemVerbose & 4) != 0; + m_illegal_read = (systemVerbose & 8) != 0; + m_dma0 = (systemVerbose & 16) != 0; + m_dma1 = (systemVerbose & 32) != 0; + m_dma2 = (systemVerbose & 64) != 0; + m_dma3 = (systemVerbose & 128) != 0; + m_undefined = (systemVerbose & 256) != 0; + m_agbprint = (systemVerbose & 256) != 0; + UpdateData(FALSE); + + m_log.LimitText(-1); + m_log.SetWindowText(text); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void Logging::log(const char *s) +{ + int size = ::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); + m_log.SetSel(size, size); + m_log.ReplaceSel(s); +} + +void Logging::OnClose() +{ + EndDialog(FALSE); + + instance = NULL; + + CDialog::OnClose(); +} + +void toolsLogging() +{ + if(Logging::instance == NULL) { + Logging::instance = new Logging(); + Logging::instance->Create(IDD_LOGGING, AfxGetApp()->m_pMainWnd); + Logging::instance->ShowWindow(SW_SHOW); + } else { + Logging::instance->SetForegroundWindow(); + } +} + +void toolsLog(const char *s) +{ + CString str; + int state = 0; + if(s) { + char c = *s++; + while(c) { + if(c == '\n' && state == 0) + str += '\r'; + else if(c == '\r') + state = 1; + else + state = 0; + str += c; + c = *s++; + } + } + + Logging::text += str; + if(Logging::instance != NULL) { + Logging::instance->log(str); + } +} diff --git a/src/win32/Logging.h b/src/win32/Logging.h new file mode 100644 index 0000000..01514f6 --- /dev/null +++ b/src/win32/Logging.h @@ -0,0 +1,98 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_) +#define AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Logging.h : header file +// + +#include "ResizeDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// Logging dialog + +class Logging : public ResizeDlg +{ + // Construction + public: + void log(const char *); + Logging(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(Logging) + enum { IDD = IDD_LOGGING }; + CEdit m_log; + BOOL m_swi; + BOOL m_unaligned_access; + BOOL m_illegal_write; + BOOL m_illegal_read; + BOOL m_dma0; + BOOL m_dma1; + BOOL m_dma2; + BOOL m_dma3; + BOOL m_agbprint; + BOOL m_undefined; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Logging) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(Logging) + afx_msg void OnOk(); + afx_msg void OnClear(); + afx_msg void OnVerboseAgbprint(); + afx_msg void OnVerboseDma0(); + afx_msg void OnVerboseDma1(); + afx_msg void OnVerboseDma2(); + afx_msg void OnVerboseDma3(); + afx_msg void OnVerboseIllegalRead(); + afx_msg void OnVerboseIllegalWrite(); + afx_msg void OnVerboseSwi(); + afx_msg void OnVerboseUnalignedAccess(); + afx_msg void OnVerboseUndefined(); + afx_msg void OnSave(); + afx_msg void OnErrspaceLog(); + afx_msg void OnMaxtextLog(); + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + public: + static Logging *instance; + static CString text; +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_LOGGING_H__222FC21A_D40D_450D_8A1C_D33305E47B85__INCLUDED_) diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp new file mode 100644 index 0000000..75b825b --- /dev/null +++ b/src/win32/MainWnd.cpp @@ -0,0 +1,1345 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MainWnd.cpp : implementation file +// + +#include "stdafx.h" +#include "VBA.h" +#include "MainWnd.h" + +#include + +#include "FileDlg.h" +#include "Reg.h" +#include "WinResUtil.h" +#include "GBACheats.h" +#include "GBCheatsDlg.h" + +#include "../System.h" +#include "../AutoBuild.h" +#include "../cheatSearch.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Flash.h" +#include "../Globals.h" +#include "../gb/GB.h" +#include "../gb/gbCheats.h" +#include "../gb/gbGlobals.h" +#include "../RTC.h" +#include "../Sound.h" +#include "../Util.h" +#include "../movie.h" +#include ".\mainwnd.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#define VBA_CONFIRM_MODE WM_APP + 100 + +extern void remoteCleanUp(); + +///////////////////////////////////////////////////////////////////////////// +// MainWnd + +MainWnd::MainWnd() +{ + m_hAccelTable = NULL; + arrow = LoadCursor(NULL, IDC_ARROW); +} + +MainWnd::~MainWnd() +{ +} + + +BEGIN_MESSAGE_MAP(MainWnd, CWnd) + //{{AFX_MSG_MAP(MainWnd) + ON_WM_CLOSE() + ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout) + ON_COMMAND(ID_HELP_FAQ, OnHelpFaq) + ON_COMMAND(ID_FILE_OPEN, OnFileOpen) + ON_WM_INITMENUPOPUP() + ON_COMMAND(ID_FILE_PAUSE, OnFilePause) + ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause) + ON_COMMAND(ID_FILE_RESET, OnFileReset) + ON_UPDATE_COMMAND_UI(ID_FILE_RESET, OnUpdateFileReset) + ON_UPDATE_COMMAND_UI(ID_FILE_RECENT_FREEZE, OnUpdateFileRecentFreeze) + ON_COMMAND(ID_FILE_RECENT_RESET, OnFileRecentReset) + ON_COMMAND(ID_FILE_RECENT_FREEZE, OnFileRecentFreeze) + ON_COMMAND(ID_FILE_EXIT, OnFileExit) + ON_COMMAND(ID_FILE_CLOSE, OnFileClose) + ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE, OnUpdateFileClose) + ON_COMMAND(ID_FILE_LOAD, OnFileLoad) + ON_UPDATE_COMMAND_UI(ID_FILE_LOAD, OnUpdateFileLoad) + ON_COMMAND(ID_FILE_SAVE, OnFileSave) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave) + ON_COMMAND(ID_FILE_IMPORT_BATTERYFILE, OnFileImportBatteryfile) + ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_BATTERYFILE, OnUpdateFileImportBatteryfile) + ON_COMMAND(ID_FILE_IMPORT_GAMESHARKCODEFILE, OnFileImportGamesharkcodefile) + ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_GAMESHARKCODEFILE, OnUpdateFileImportGamesharkcodefile) + ON_COMMAND(ID_FILE_IMPORT_GAMESHARKSNAPSHOT, OnFileImportGamesharksnapshot) + ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_GAMESHARKSNAPSHOT, OnUpdateFileImportGamesharksnapshot) + ON_COMMAND(ID_FILE_EXPORT_BATTERYFILE, OnFileExportBatteryfile) + ON_UPDATE_COMMAND_UI(ID_FILE_EXPORT_BATTERYFILE, OnUpdateFileExportBatteryfile) + ON_COMMAND(ID_FILE_EXPORT_GAMESHARKSNAPSHOT, OnFileExportGamesharksnapshot) + ON_UPDATE_COMMAND_UI(ID_FILE_EXPORT_GAMESHARKSNAPSHOT, OnUpdateFileExportGamesharksnapshot) + ON_COMMAND(ID_FILE_SCREENCAPTURE, OnFileScreencapture) + ON_UPDATE_COMMAND_UI(ID_FILE_SCREENCAPTURE, OnUpdateFileScreencapture) + ON_COMMAND(ID_FILE_ROMINFORMATION, OnFileRominformation) + ON_UPDATE_COMMAND_UI(ID_FILE_ROMINFORMATION, OnUpdateFileRominformation) + ON_COMMAND(ID_FILE_TOGGLEMENU, OnFileTogglemenu) + ON_UPDATE_COMMAND_UI(ID_FILE_TOGGLEMENU, OnUpdateFileTogglemenu) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_6, OnUpdateOptionsFrameskipThrottle6) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_15, OnUpdateOptionsFrameskipThrottle15) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_25, OnUpdateOptionsFrameskipThrottle25) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_37, OnUpdateOptionsFrameskipThrottle37) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_50, OnUpdateOptionsFrameskipThrottle50) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_75, OnUpdateOptionsFrameskipThrottle75) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_87, OnUpdateOptionsFrameskipThrottle87) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_100, OnUpdateOptionsFrameskipThrottle100) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_112, OnUpdateOptionsFrameskipThrottle112) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_125, OnUpdateOptionsFrameskipThrottle125) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_150, OnUpdateOptionsFrameskipThrottle150) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_200, OnUpdateOptionsFrameskipThrottle200) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_300, OnUpdateOptionsFrameskipThrottle300) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER, OnUpdateOptionsFrameskipThrottleOther) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE, OnUpdateOptionsFrameskipThrottleIncrease) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE, OnUpdateOptionsFrameskipThrottleDecrease) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_6, OnOptionsFrameskipThrottle6) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_15, OnOptionsFrameskipThrottle15) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_25, OnOptionsFrameskipThrottle25) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_37, OnOptionsFrameskipThrottle37) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_50, OnOptionsFrameskipThrottle50) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_75, OnOptionsFrameskipThrottle75) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_87, OnOptionsFrameskipThrottle87) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_100, OnOptionsFrameskipThrottle100) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_112, OnOptionsFrameskipThrottle112) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_125, OnOptionsFrameskipThrottle125) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_150, OnOptionsFrameskipThrottle150) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_200, OnOptionsFrameskipThrottle200) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_300, OnOptionsFrameskipThrottle300) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER, OnOptionsFrameskipThrottleOther) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE, OnOptionsFrameskipThrottleIncrease) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE, OnOptionsFrameskipThrottleDecrease) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_ACCURATEPITCH, OnOptionsFrameskipAccuratePitch) + ON_COMMAND(ID_OPTIONS_FRAMESKIP_ACCURATESPEED, OnOptionsFrameskipAccurateSpeed) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_ACCURATEPITCH, OnUpdateOptionsFrameskipAccuratePitch) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_ACCURATESPEED, OnUpdateOptionsFrameskipAccurateSpeed) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_0, OnUpdateOptionsVideoFrameskip0) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_1, OnUpdateOptionsVideoFrameskip1) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_2, OnUpdateOptionsVideoFrameskip2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_3, OnUpdateOptionsVideoFrameskip3) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_4, OnUpdateOptionsVideoFrameskip4) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_5, OnUpdateOptionsVideoFrameskip5) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_6, OnUpdateOptionsVideoFrameskip6) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_7, OnUpdateOptionsVideoFrameskip7) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_8, OnUpdateOptionsVideoFrameskip8) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_9, OnUpdateOptionsVideoFrameskip9) + ON_COMMAND(ID_OPTIONS_VIDEO_VSYNC, OnOptionsVideoVsync) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_VSYNC, OnUpdateOptionsVideoVsync) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X1, OnUpdateOptionsVideoX1) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X2, OnUpdateOptionsVideoX2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X3, OnUpdateOptionsVideoX3) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X4, OnUpdateOptionsVideoX4) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnUpdateOptionsVideoFullscreen320x240) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnUpdateOptionsVideoFullscreen640x480) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnUpdateOptionsVideoFullscreen800x600) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnOptionsVideoFullscreen320x240) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnOptionsVideoFullscreen640x480) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnOptionsVideoFullscreen800x600) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN, OnOptionsVideoFullscreen) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN, OnUpdateOptionsVideoFullscreen) + ON_WM_MOVE() + ON_WM_SIZE() + ON_COMMAND(ID_OPTIONS_VIDEO_DISABLESFX, OnOptionsVideoDisablesfx) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DISABLESFX, OnUpdateOptionsVideoDisablesfx) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT, OnOptionsVideoFullscreenstretchtofit) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT, OnUpdateOptionsVideoFullscreenstretchtofit) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_GDI, OnOptionsVideoRendermethodGdi) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_GDI, OnUpdateOptionsVideoRendermethodGdi) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW, OnOptionsVideoRendermethodDirectdraw) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW, OnUpdateOptionsVideoRendermethodDirectdraw) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D, OnOptionsVideoRendermethodDirect3d) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D, OnUpdateOptionsVideoRendermethodDirect3d) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL, OnOptionsVideoRendermethodOpengl) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL, OnUpdateOptionsVideoRendermethodOpengl) + ON_COMMAND(ID_OPTIONS_VIDEO_TRIPLEBUFFERING, OnOptionsVideoTriplebuffering) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_TRIPLEBUFFERING, OnUpdateOptionsVideoTriplebuffering) + ON_COMMAND(ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY, OnOptionsVideoDdrawemulationonly) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY, OnUpdateOptionsVideoDdrawemulationonly) + ON_COMMAND(ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY, OnOptionsVideoDdrawusevideomemory) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY, OnUpdateOptionsVideoDdrawusevideomemory) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER, OnOptionsVideoRenderoptionsD3dnofilter) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER, OnUpdateOptionsVideoRenderoptionsD3dnofilter) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR, OnOptionsVideoRenderoptionsD3dbilinear) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR, OnUpdateOptionsVideoRenderoptionsD3dbilinear) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST, OnOptionsVideoRenderoptionsGlnearest) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST, OnUpdateOptionsVideoRenderoptionsGlnearest) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR, OnOptionsVideoRenderoptionsGlbilinear) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR, OnUpdateOptionsVideoRenderoptionsGlbilinear) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE, OnOptionsVideoRenderoptionsGltriangle) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE, OnUpdateOptionsVideoRenderoptionsGltriangle) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnOptionsVideoRenderoptionsGlquads) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnUpdateOptionsVideoRenderoptionsGlquads) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnOptionsVideoRenderoptionsSelectskin) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnUpdateOptionsVideoRenderoptionsSelectskin) + ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnOptionsVideoRenderoptionsSkin) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnUpdateOptionsVideoRenderoptionsSkin) + ON_WM_CONTEXTMENU() + ON_COMMAND(ID_OPTIONS_EMULATOR_ASSOCIATE, OnOptionsEmulatorAssociate) + ON_COMMAND(ID_OPTIONS_EMULATOR_DIRECTORIES, OnOptionsEmulatorDirectories) + ON_COMMAND(ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES, OnOptionsVideoDisablestatusmessages) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES, OnUpdateOptionsVideoDisablestatusmessages) + ON_COMMAND(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnOptionsEmulatorSynchronize) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnUpdateOptionsEmulatorSynchronize) + ON_COMMAND(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnOptionsEmulatorPausewheninactive) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnUpdateOptionsEmulatorPausewheninactive) + ON_COMMAND(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnOptionsEmulatorSpeeduptoggle) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnUpdateOptionsEmulatorSpeeduptoggle) + ON_COMMAND(ID_OPTIONS_EMULATOR_REMOVEINTROSGBA, OnOptionsEmulatorRemoveintrosgba) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_REMOVEINTROSGBA, OnUpdateOptionsEmulatorRemoveintrosgba) + ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnOptionsEmulatorAutomaticallyipspatch) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnUpdateOptionsEmulatorAutomaticallyipspatch) + ON_COMMAND(ID_OPTIONS_EMULATOR_AGBPRINT, OnOptionsEmulatorAgbprint) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AGBPRINT, OnUpdateOptionsEmulatorAgbprint) + ON_COMMAND(ID_OPTIONS_EMULATOR_REALTIMECLOCK, OnOptionsEmulatorRealtimeclock) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_REALTIMECLOCK, OnUpdateOptionsEmulatorRealtimeclock) + ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOHIDEMENU, OnOptionsEmulatorAutohidemenu) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOHIDEMENU, OnUpdateOptionsEmulatorAutohidemenu) + ON_COMMAND(ID_OPTIONS_EMULATOR_REWINDINTERVAL, OnOptionsEmulatorRewindinterval) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC, OnOptionsEmulatorSavetypeAutomatic) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC, OnUpdateOptionsEmulatorSavetypeAutomatic) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM, OnOptionsEmulatorSavetypeEeprom) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM, OnUpdateOptionsEmulatorSavetypeEeprom) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_SRAM, OnOptionsEmulatorSavetypeSram) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_SRAM, OnUpdateOptionsEmulatorSavetypeSram) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH, OnOptionsEmulatorSavetypeFlash) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH, OnUpdateOptionsEmulatorSavetypeFlash) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR, OnOptionsEmulatorSavetypeEepromsensor) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR, OnUpdateOptionsEmulatorSavetypeEepromsensor) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_NONE, OnOptionsEmulatorSavetypeNone) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_NONE, OnUpdateOptionsEmulatorSavetypeNone) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K, OnOptionsEmulatorSavetypeFlash512k) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K, OnUpdateOptionsEmulatorSavetypeFlash512k) + ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnOptionsEmulatorSavetypeFlash1m) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnUpdateOptionsEmulatorSavetypeFlash1m) + ON_COMMAND(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnOptionsEmulatorUsebiosfile) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnUpdateOptionsEmulatorUsebiosfile) + ON_COMMAND(ID_OPTIONS_EMULATOR_SKIPBIOS, OnOptionsEmulatorSkipbios) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SKIPBIOS, OnUpdateOptionsEmulatorSkipbios) + ON_COMMAND(ID_OPTIONS_EMULATOR_SELECTBIOSFILE, OnOptionsEmulatorSelectbiosfile) + ON_COMMAND(ID_EMULATOR_USEOLDGBTIMING, OnOptionsEmulatorUseOldGBTiming) + ON_UPDATE_COMMAND_UI(ID_EMULATOR_USEOLDGBTIMING, OnUpdateOptionsEmulatorUseOldGBTiming) + ON_COMMAND(ID_EMULATOR_GBALAG, OnOptionsEmulatorGBALag) + ON_UPDATE_COMMAND_UI(ID_EMULATOR_GBALAG, OnUpdateOptionsEmulatorGBALag) + ON_COMMAND(ID_OPTIONS_EMULATOR_PNGFORMAT, OnOptionsEmulatorPngformat) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_PNGFORMAT, OnUpdateOptionsEmulatorPngformat) + ON_COMMAND(ID_OPTIONS_EMULATOR_BMPFORMAT, OnOptionsEmulatorBmpformat) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_BMPFORMAT, OnUpdateOptionsEmulatorBmpformat) + ON_COMMAND(ID_OPTIONS_SOUND_OFF, OnOptionsSoundOff) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_OFF, OnUpdateOptionsSoundOff) + ON_COMMAND(ID_OPTIONS_SOUND_MUTE, OnOptionsSoundMute) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_MUTE, OnUpdateOptionsSoundMute) + ON_COMMAND(ID_OPTIONS_SOUND_ON, OnOptionsSoundOn) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_ON, OnUpdateOptionsSoundOn) + ON_COMMAND(ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION, OnOptionsSoundUseoldsynchronization) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION, OnUpdateOptionsSoundUseoldsynchronization) + ON_COMMAND(ID_OPTIONS_SOUND_ECHO, OnOptionsSoundEcho) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_ECHO, OnUpdateOptionsSoundEcho) + ON_COMMAND(ID_OPTIONS_SOUND_LOWPASSFILTER, OnOptionsSoundLowpassfilter) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_LOWPASSFILTER, OnUpdateOptionsSoundLowpassfilter) + ON_COMMAND(ID_OPTIONS_SOUND_REVERSESTEREO, OnOptionsSoundReversestereo) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_REVERSESTEREO, OnUpdateOptionsSoundReversestereo) + ON_COMMAND(ID_OPTIONS_SOUND_MUTEFRAMEADVANCE, OnOptionsSoundMuteFrameAdvance) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_MUTEFRAMEADVANCE, OnUpdateOptionsSoundMuteFrameAdvance) + ON_COMMAND(ID_OPTIONS_SOUND_11KHZ, OnOptionsSound11khz) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_11KHZ, OnUpdateOptionsSound11khz) + ON_COMMAND(ID_OPTIONS_SOUND_22KHZ, OnOptionsSound22khz) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_22KHZ, OnUpdateOptionsSound22khz) + ON_COMMAND(ID_OPTIONS_SOUND_44KHZ, OnOptionsSound44khz) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_44KHZ, OnUpdateOptionsSound44khz) + ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL1, OnOptionsSoundChannel1) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL1, OnUpdateOptionsSoundChannel1) + ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL2, OnOptionsSoundChannel2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL2, OnUpdateOptionsSoundChannel2) + ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL3, OnOptionsSoundChannel3) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL3, OnUpdateOptionsSoundChannel3) + ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL4, OnOptionsSoundChannel4) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL4, OnUpdateOptionsSoundChannel4) + ON_COMMAND(ID_OPTIONS_SOUND_DIRECTSOUNDA, OnOptionsSoundDirectsounda) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_DIRECTSOUNDA, OnUpdateOptionsSoundDirectsounda) + ON_COMMAND(ID_OPTIONS_SOUND_DIRECTSOUNDB, OnOptionsSoundDirectsoundb) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_DIRECTSOUNDB, OnUpdateOptionsSoundDirectsoundb) + ON_COMMAND(ID_OPTIONS_GAMEBOY_BORDER, OnOptionsGameboyBorder) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_BORDER, OnUpdateOptionsGameboyBorder) + ON_COMMAND(ID_OPTIONS_GAMEBOY_PRINTER, OnOptionsGameboyPrinter) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_PRINTER, OnUpdateOptionsGameboyPrinter) + ON_COMMAND(ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC, OnOptionsGameboyBorderAutomatic) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC, OnUpdateOptionsGameboyBorderAutomatic) + ON_COMMAND(ID_OPTIONS_GAMEBOY_AUTOMATIC, OnOptionsGameboyAutomatic) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_AUTOMATIC, OnUpdateOptionsGameboyAutomatic) + ON_COMMAND(ID_OPTIONS_GAMEBOY_GBA, OnOptionsGameboyGba) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GBA, OnUpdateOptionsGameboyGba) + ON_COMMAND(ID_OPTIONS_GAMEBOY_CGB, OnOptionsGameboyCgb) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_CGB, OnUpdateOptionsGameboyCgb) + ON_COMMAND(ID_OPTIONS_GAMEBOY_SGB, OnOptionsGameboySgb) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_SGB, OnUpdateOptionsGameboySgb) + ON_COMMAND(ID_OPTIONS_GAMEBOY_SGB2, OnOptionsGameboySgb2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_SGB2, OnUpdateOptionsGameboySgb2) + ON_COMMAND(ID_OPTIONS_GAMEBOY_GB, OnOptionsGameboyGb) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GB, OnUpdateOptionsGameboyGb) + ON_COMMAND(ID_OPTIONS_GAMEBOY_REALCOLORS, OnOptionsGameboyRealcolors) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_REALCOLORS, OnUpdateOptionsGameboyRealcolors) + ON_COMMAND(ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS, OnOptionsGameboyGameboycolors) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS, OnUpdateOptionsGameboyGameboycolors) + ON_COMMAND(ID_OPTIONS_GAMEBOY_COLORS, OnOptionsGameboyColors) + ON_COMMAND(ID_OPTIONS_FILTER_DISABLEMMX, OnOptionsFilterDisablemmx) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_DISABLEMMX, OnUpdateOptionsFilterDisablemmx) + ON_COMMAND(ID_OPTIONS_LANGUAGE_SYSTEM, OnOptionsLanguageSystem) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_SYSTEM, OnUpdateOptionsLanguageSystem) + ON_COMMAND(ID_OPTIONS_LANGUAGE_ENGLISH, OnOptionsLanguageEnglish) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_ENGLISH, OnUpdateOptionsLanguageEnglish) + ON_COMMAND(ID_OPTIONS_LANGUAGE_OTHER, OnOptionsLanguageOther) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_OTHER, OnUpdateOptionsLanguageOther) + ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_1, OnOptionsJoypadConfigure1) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_1, OnUpdateOptionsJoypadConfigure1) + ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_2, OnOptionsJoypadConfigure2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_2, OnUpdateOptionsJoypadConfigure2) + ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_3, OnOptionsJoypadConfigure3) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_3, OnUpdateOptionsJoypadConfigure3) + ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_4, OnOptionsJoypadConfigure4) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_4, OnUpdateOptionsJoypadConfigure4) + ON_COMMAND(ID_OPTIONS_JOYPAD_MOTIONCONFIGURE, OnOptionsJoypadMotionconfigure) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_MOTIONCONFIGURE, OnUpdateOptionsJoypadMotionconfigure) + ON_COMMAND(ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT, OnOptionsJoypadAllowLeftRight) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT, OnUpdateOptionsJoypadAllowLeftRight) + ON_COMMAND(ID_CHEATS_SEARCHFORCHEATS, OnCheatsSearchforcheats) + ON_UPDATE_COMMAND_UI(ID_CHEATS_SEARCHFORCHEATS, OnUpdateCheatsSearchforcheats) + ON_COMMAND(ID_CHEATS_CHEATLIST, OnCheatsCheatlist) + ON_UPDATE_COMMAND_UI(ID_CHEATS_CHEATLIST, OnUpdateCheatsCheatlist) + ON_COMMAND(ID_CHEATS_AUTOMATICSAVELOADCHEATS, OnCheatsAutomaticsaveloadcheats) + ON_COMMAND(ID_CHEATS_PAUSEDURINGCHEATSEARCH, OnCheatsPauseDuringCheatSearch) + ON_COMMAND(ID_CHEATS_LOADCHEATLIST, OnCheatsLoadcheatlist) + ON_UPDATE_COMMAND_UI(ID_CHEATS_LOADCHEATLIST, OnUpdateCheatsLoadcheatlist) + ON_COMMAND(ID_CHEATS_SAVECHEATLIST, OnCheatsSavecheatlist) + ON_UPDATE_COMMAND_UI(ID_CHEATS_SAVECHEATLIST, OnUpdateCheatsSavecheatlist) + ON_COMMAND(ID_TOOLS_DISASSEMBLE, OnToolsDisassemble) + ON_UPDATE_COMMAND_UI(ID_TOOLS_DISASSEMBLE, OnUpdateToolsDisassemble) + ON_COMMAND(ID_TOOLS_LOGGING, OnToolsLogging) + ON_UPDATE_COMMAND_UI(ID_TOOLS_LOGGING, OnUpdateToolsLogging) + ON_COMMAND(ID_TOOLS_IOVIEWER, OnToolsIoviewer) + ON_UPDATE_COMMAND_UI(ID_TOOLS_IOVIEWER, OnUpdateToolsIoviewer) + ON_COMMAND(ID_TOOLS_MAPVIEW, OnToolsMapview) + ON_UPDATE_COMMAND_UI(ID_TOOLS_MAPVIEW, OnUpdateToolsMapview) + ON_COMMAND(ID_TOOLS_MEMORYVIEWER, OnToolsMemoryviewer) + ON_UPDATE_COMMAND_UI(ID_TOOLS_MEMORYVIEWER, OnUpdateToolsMemoryviewer) + ON_COMMAND(ID_TOOLS_OAMVIEWER, OnToolsOamviewer) + ON_UPDATE_COMMAND_UI(ID_TOOLS_OAMVIEWER, OnUpdateToolsOamviewer) + ON_COMMAND(ID_TOOLS_PALETTEVIEW, OnToolsPaletteview) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PALETTEVIEW, OnUpdateToolsPaletteview) + ON_COMMAND(ID_TOOLS_TILEVIEWER, OnToolsTileviewer) + ON_UPDATE_COMMAND_UI(ID_TOOLS_TILEVIEWER, OnUpdateToolsTileviewer) + ON_COMMAND(ID_DEBUG_NEXTFRAME, OnDebugNextframe) + ON_UPDATE_COMMAND_UI(ID_DEBUG_NEXTFRAME, OnUpdateDebugNextframe) + ON_COMMAND(ID_DEBUG_FRAMESEARCH, OnDebugFramesearch) + ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCH, OnUpdateDebugFramesearch) + ON_COMMAND(ID_DEBUG_FRAMESEARCHPREV, OnDebugFramesearchPrev) + ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCHPREV, OnUpdateDebugFramesearchPrev) + ON_COMMAND(ID_DEBUG_FRAMESEARCHLOAD, OnDebugFramesearchLoad) + ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCHLOAD, OnUpdateDebugFramesearchLoad) + ON_UPDATE_COMMAND_UI(ID_CHEATS_AUTOMATICSAVELOADCHEATS, OnUpdateCheatsAutomaticsaveloadcheats) + ON_UPDATE_COMMAND_UI(ID_CHEATS_PAUSEDURINGCHEATSEARCH, OnUpdateCheatsPauseDuringCheatSearch) + ON_COMMAND(ID_TOOLS_FRAMECOUNTER, OnToolsFrameCounter) + ON_UPDATE_COMMAND_UI(ID_TOOLS_FRAMECOUNTER, OnUpdateToolsFrameCounter) + ON_COMMAND(ID_TOOLS_INPUTDISPLAY, OnToolsInputDisplay) + ON_UPDATE_COMMAND_UI(ID_TOOLS_INPUTDISPLAY, OnUpdateToolsInputDisplay) + ON_COMMAND(ID_TOOLS_DEBUG_GDB, OnToolsDebugGdb) + ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_GDB, OnUpdateToolsDebugGdb) + ON_COMMAND(ID_TOOLS_DEBUG_LOADANDWAIT, OnToolsDebugLoadandwait) + ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_LOADANDWAIT, OnUpdateToolsDebugLoadandwait) + ON_COMMAND(ID_TOOLS_DEBUG_BREAK, OnToolsDebugBreak) + ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_BREAK, OnUpdateToolsDebugBreak) + ON_COMMAND(ID_TOOLS_DEBUG_DISCONNECT, OnToolsDebugDisconnect) + ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_DISCONNECT, OnUpdateToolsDebugDisconnect) + ON_COMMAND(ID_OPTIONS_SOUND_STARTRECORDING, OnOptionsSoundStartrecording) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_STARTRECORDING, OnUpdateOptionsSoundStartrecording) + ON_COMMAND(ID_OPTIONS_SOUND_STOPRECORDING, OnOptionsSoundStoprecording) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_STOPRECORDING, OnUpdateOptionsSoundStoprecording) + ON_COMMAND(ID_TOOLS_RECORD_STARTAVIRECORDING, OnToolsRecordStartavirecording) + ON_UPDATE_COMMAND_UI(ID_TOOLS_RECORD_STARTAVIRECORDING, OnUpdateToolsRecordStartavirecording) + ON_COMMAND(ID_TOOLS_RECORD_STOPAVIRECORDING, OnToolsRecordStopavirecording) + ON_UPDATE_COMMAND_UI(ID_TOOLS_RECORD_STOPAVIRECORDING, OnUpdateToolsRecordStopavirecording) + ON_WM_PAINT() + ON_COMMAND(ID_TOOLS_RECORD_STARTMOVIERECORDING, OnToolsRecordStartmovierecording) + ON_UPDATE_COMMAND_UI(ID_TOOLS_RECORD_STARTMOVIERECORDING, OnUpdateToolsRecordStartmovierecording) + ON_COMMAND(ID_TOOLS_RECORD_STOPMOVIERECORDING, OnToolsRecordStopmovierecording) + ON_UPDATE_COMMAND_UI(ID_TOOLS_RECORD_STOPMOVIERECORDING, OnUpdateToolsRecordStopmovierecording) + ON_COMMAND(ID_TOOLS_PLAY_STARTMOVIEPLAYING, OnToolsPlayStartmovieplaying) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PLAY_STARTMOVIEPLAYING, OnUpdateToolsPlayStartmovieplaying) + ON_COMMAND(ID_TOOLS_PLAY_STOPMOVIEPLAYING, OnToolsPlayStopmovieplaying) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PLAY_STOPMOVIEPLAYING, OnUpdateToolsPlayStopmovieplaying) + ON_COMMAND(ID_TOOLS_PLAY_READONLY, OnToolsPlayReadOnly) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PLAY_READONLY, OnUpdateToolsPlayReadOnly) + ON_COMMAND(ID_TOOLS_PLAY_CONTINUE, OnToolsPlayContinue) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PLAY_CONTINUE, OnUpdateToolsPlayContinue) + ON_COMMAND(ID_TOOLS_PLAY_RESTART, OnToolsPlayRestart) + ON_UPDATE_COMMAND_UI(ID_TOOLS_PLAY_RESTART, OnUpdateToolsPlayRestart) + ON_COMMAND(ID_TOOLS_REWIND, OnToolsRewind) + ON_UPDATE_COMMAND_UI(ID_TOOLS_REWIND, OnUpdateToolsRewind) + ON_COMMAND(ID_TOOLS_CUSTOMIZE, OnToolsCustomize) + ON_UPDATE_COMMAND_UI(ID_TOOLS_CUSTOMIZE, OnUpdateToolsCustomize) + ON_COMMAND(ID_TOOLS_CUSTOMIZE_COMMON, OnToolsCustomizeCommon) + ON_UPDATE_COMMAND_UI(ID_TOOLS_CUSTOMIZE_COMMON, OnUpdateToolsCustomizeCommon) + ON_COMMAND(ID_HELP_BUGREPORT, OnHelpBugreport) + ON_WM_MOUSEMOVE() + ON_WM_INITMENU() + ON_WM_ACTIVATE() + ON_WM_ACTIVATEAPP() + ON_WM_DROPFILES() + ON_COMMAND(ID_FILE_SAVEGAME_OLDESTSLOT, OnFileSavegameOldestslot) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_OLDESTSLOT, OnUpdateFileSavegameOldestslot) + ON_COMMAND(ID_FILE_LOADGAME_MOSTRECENT, OnFileLoadgameMostrecent) + ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MOSTRECENT, OnUpdateFileLoadgameMostrecent) + + ON_COMMAND(ID_FILE_SAVEGAME_CURRENT, OnFileSavegameCurrent) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_CURRENT, OnUpdateFileSavegameCurrent) + ON_COMMAND(ID_FILE_LOADGAME_CURRENT, OnFileLoadgameCurrent) + ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_CURRENT, OnUpdateFileLoadgameCurrent) + ON_COMMAND(ID_FILE_LOADGAME_MAKECURRENT, OnFileLoadgameMakeCurrent) + ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MAKECURRENT, OnUpdateFileLoadgameMakeCurrent) + ON_COMMAND(ID_FILE_SAVEGAME_MAKECURRENT, OnFileSavegameMakeCurrent) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_MAKECURRENT, OnUpdateFileSavegameMakeCurrent) + ON_COMMAND(ID_FILE_SAVEGAME_INCREMENTSLOT, OnFileSavegameIncrementSlot) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_INCREMENTSLOT, OnUpdateFileSavegameIncrementSlot) + ON_COMMAND(ID_FILE_SAVEGAME_DECREMENTSLOT, OnFileSavegameDecrementSlot) + ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_DECREMENTSLOT, OnUpdateFileSavegameDecrementSlot) + + ON_COMMAND(ID_FILE_LOADGAME_AUTOLOADMOSTRECENT, OnFileLoadgameAutoloadmostrecent) + ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_AUTOLOADMOSTRECENT, OnUpdateFileLoadgameAutoloadmostrecent) + ON_COMMAND(ID_FILE_LOADGAME_MAKERECENT, OnFileLoadgameMakeRecent) + ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MAKERECENT, OnUpdateFileLoadgameMakeRecent) + ON_COMMAND(ID_OPTIONS_SOUND_VOLUME_25X, OnOptionsSoundVolume25x) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_VOLUME_25X, OnUpdateOptionsSoundVolume25x) + ON_COMMAND(ID_OPTIONS_SOUND_VOLUME_5X, OnOptionsSoundVolume5x) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_VOLUME_5X, OnUpdateOptionsSoundVolume5x) + ON_COMMAND(ID_CHEATS_DISABLECHEATS, OnCheatsDisablecheats) + ON_UPDATE_COMMAND_UI(ID_CHEATS_DISABLECHEATS, OnUpdateCheatsDisablecheats) + ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE, OnOptionsVideoFullscreenmaxscale) + //}}AFX_MSG_MAP + ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE10, OnFileRecentFile) + ON_COMMAND_EX_RANGE(ID_FILE_LOADGAME_SLOT1, ID_FILE_LOADGAME_SLOT10, OnFileLoadSlot) + ON_COMMAND_EX_RANGE(ID_FILE_SAVEGAME_SLOT1, ID_FILE_SAVEGAME_SLOT10, OnFileSaveSlot) + ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_LOADGAME_SLOT1, ID_FILE_LOADGAME_SLOT10, OnUpdateFileLoadGameSlot) + ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_SAVEGAME_SLOT1, ID_FILE_SAVEGAME_SLOT10, OnUpdateFileSaveGameSlot) + + ON_COMMAND_EX_RANGE(ID_SELECT_SLOT1, ID_SELECT_SLOT10, OnSelectSlot) + ON_UPDATE_COMMAND_UI_RANGE(ID_SELECT_SLOT1, ID_SELECT_SLOT10, OnUpdateSelectSlot) + + ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_FRAMESKIP_0, ID_OPTIONS_VIDEO_FRAMESKIP_5, OnOptionsFrameskip) + ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_FRAMESKIP_6, ID_OPTIONS_VIDEO_FRAMESKIP_9, OnOptionsFrameskip) + ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_X1, ID_OPTIONS_VIDEO_X4, OnOptionVideoSize) + ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_LAYERS_BG0, ID_OPTIONS_VIDEO_LAYERS_OBJWIN, OnVideoLayer) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_VIDEO_LAYERS_BG0, ID_OPTIONS_VIDEO_LAYERS_OBJWIN, OnUpdateVideoLayer) + ON_COMMAND(ID_SYSTEM_MINIMIZE, OnSystemMinimize) + ON_COMMAND_EX_RANGE(ID_OPTIONS_EMULATOR_SHOWSPEED_NONE, ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT, OnOptionsEmulatorShowSpeed) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_EMULATOR_SHOWSPEED_NONE, ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT, OnUpdateOptionsEmulatorShowSpeed) + ON_COMMAND_EX_RANGE(ID_OPTIONS_SOUND_VOLUME_1X, ID_OPTIONS_SOUND_VOLUME_4X, OnOptionsSoundVolume) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_SOUND_VOLUME_1X, ID_OPTIONS_SOUND_VOLUME_4X, OnUpdateOptionsSoundVolume) + ON_COMMAND_EX_RANGE(ID_OPTIONS_PRIORITY_HIGHEST, ID_OPTIONS_PRIORITY_BELOWNORMAL, OnOptionsPriority) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_PRIORITY_HIGHEST, ID_OPTIONS_PRIORITY_BELOWNORMAL, OnUpdateOptionsPriority) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_NORMAL, ID_OPTIONS_FILTER_TVMODE, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL, ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X, ID_OPTIONS_FILTER16BIT_SIMPLE2X, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_LQ2X, ID_OPTIONS_FILTER_HQ3X2, OnOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_NORMAL, ID_OPTIONS_FILTER_TVMODE, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL, ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X, ID_OPTIONS_FILTER16BIT_SIMPLE2X, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_LQ2X, ID_OPTIONS_FILTER_HQ3X2, OnUpdateOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE, ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART, OnOptionsFilterIFB) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE, ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART, OnUpdateOptionsFilterIFB) + ON_COMMAND_EX_RANGE(ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1, ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4, OnOptionsJoypadDefault) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1, ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4, OnUpdateOptionsJoypadDefault) + ON_COMMAND_EX_RANGE(ID_OPTIONS_JOYPAD_AUTOFIRE_A, ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR, OnOptionsJoypadAutofire) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_JOYPAD_AUTOFIRE_A, ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR, OnUpdateOptionsJoypadAutofire) + ON_COMMAND_EX_RANGE(ID_STICKY_A, ID_STICKY_CLEAR, OnOptionsJoypadSticky) + ON_UPDATE_COMMAND_UI_RANGE(ID_STICKY_A, ID_STICKY_CLEAR, OnUpdateOptionsJoypadSticky) + ON_MESSAGE(VBA_CONFIRM_MODE, OnConfirmMode) + ON_MESSAGE(WM_SYSCOMMAND, OnMySysCommand) + ON_COMMAND(ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS, OnOptionsVideoTextdisplayoptions) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS, OnUpdateOptionsVideoTextdisplayoptions) + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// MainWnd message handlers + +bool vbaShuttingDown = false; + +void MainWnd::OnClose() +{ + vbaShuttingDown = true; // HACK to fix crash on exit while memory viewer is open + + CWnd::OnClose(); + + delete this; +} + +bool MainWnd::FileRun() +{ + int prevCartridgeType = theApp.cartridgeType; + + // save battery file before we change the filename... + if(rom != NULL || gbRom != NULL) { + if(theApp.autoSaveLoadCheatList) + winSaveCheatListDefault(); + writeBatteryFile(); + cheatSearchCleanup(&cheatSearchData); + theApp.emulator.emuCleanUp(); + remoteCleanUp(); + if(VBAMovieActive()) + VBAMovieStop(false); // will only get here on user selecting to open a ROM, canceling movie + emulating = false; + theApp.frameSearching = false; + theApp.frameSearchSkipping = false; + } + char tempName[2048]; + char file[2048]; + + utilGetBaseName(theApp.szFile, tempName); + + _fullpath(file, tempName, 1024); + theApp.filename = file; + + int index = theApp.filename.ReverseFind('.'); + if(index != -1) + theApp.filename = theApp.filename.Left(index); + + CString ipsname; + ipsname.Format("%s.ips", theApp.filename); + + if(!theApp.dir.GetLength()) { + int index = theApp.filename.ReverseFind('\\'); + if(index != -1) { + theApp.dir = theApp.filename.Left(index-1); + } + } + + IMAGE_TYPE type = utilFindType(theApp.szFile); + + if(type == IMAGE_UNKNOWN) { + systemMessage(IDS_UNSUPPORTED_FILE_TYPE, + "The file \"%s\" is an unsupported type.", theApp.szFile); + return false; + } + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + theApp.cartridgeType = (int)type; + if(type == IMAGE_GB) { + if(!gbLoadRom(theApp.szFile)) + return false; + theApp.emulator = GBSystem; + gbBorderOn = theApp.winGbBorderOn; + theApp.romSize = gbRomSize; + if(theApp.autoIPS) { + int size = gbRomSize; + utilApplyIPS(ipsname, &gbRom, &size); + if(size != gbRomSize) { + extern bool gbUpdateSizes(); + gbUpdateSizes(); + gbReset(); + theApp.romSize = size; + } + } + } else { + int size = CPULoadRom(theApp.szFile); + if(!size) + return false; + + theApp.romSize = size; + + flashSetSize(theApp.winFlashSize); + rtcEnable(theApp.winRtcEnable); + cpuSaveType = theApp.winSaveType; + + // if(cpuEnhancedDetection && winSaveType == 0) { + // utilGBAFindSave(rom, size); + // } + GetModuleFileName(NULL, tempName, 2048); + + char *p = strrchr(tempName, '\\'); + if(p) + *p = 0; + + char buffer[5]; + strncpy(buffer, (const char *)&rom[0xac], 4); + buffer[4] = 0; + + strcat(tempName, "\\vba-over.ini"); + + UINT i = GetPrivateProfileInt(buffer, + "rtcEnabled", + -1, + tempName); + if(i != (UINT)-1) + rtcEnable(i == 0 ? false : true); + + i = GetPrivateProfileInt(buffer, + "flashSize", + -1, + tempName); + if(i != (UINT)-1 && (i == 0x10000 || i == 0x20000)) + flashSetSize((int)i); + + i = GetPrivateProfileInt(buffer, + "saveType", + -1, + tempName); + if(i != (UINT)-1 && (i <= 5)) + cpuSaveType = (int)i; + + theApp.emulator = GBASystem; + /* disabled due to problems + if(theApp.removeIntros && rom != NULL) { + *((u32 *)rom)= 0xea00002e; + } + */ + + if(theApp.autoIPS) { + int size = 0x2000000; + utilApplyIPS(ipsname, &rom, &size); + if(size != 0x2000000) { + CPUReset(); + } + } + } + + if(theApp.soundInitialized) { + if(theApp.cartridgeType == 1) + gbSoundReset(); + else + soundReset(); + } else { + if(!soundOffFlag) + soundInit(); + theApp.soundInitialized = true; + } + + if(type == IMAGE_GBA) { + skipBios = theApp.skipBiosFile ? true : false; + CPUInit((char *)(LPCTSTR)theApp.biosFileName, theApp.useBiosFile ? true : false); + CPUReset(); + } + + readBatteryFile(); + + if(theApp.autoSaveLoadCheatList) + winLoadCheatListDefault(); + + theApp.addRecentFile(theApp.szFile); + + theApp.updateWindowSize(theApp.videoOption); + + theApp.updateFrameSkip(); + + if(theApp.autoHideMenu && theApp.videoOption > VIDEO_4X && theApp.menuToggle) + OnFileTogglemenu(); + + emulating = true; + + if(theApp.autoLoadMostRecent && !VBAMovieActive() && !VBAMovieLoading()) // would cause desync in movies... + OnFileLoadgameMostrecent(); + + theApp.frameskipadjust = 0; + theApp.renderedFrames = 0; + + theApp.rewindCount = 0; + theApp.rewindCounter = 0; + theApp.rewindSaveNeeded = false; + + { + extern bool playMovieFile, playMovieFileReadOnly, outputWavFile, outputAVIFile, flagHideMenu; // from VBA.cpp + extern char movieFileToPlay [1024], wavFileToOutput [1024]; // from VBA.cpp + extern int pauseAfterTime; // from VBA.cpp + if(playMovieFile) + { + playMovieFile = false; + VBAMovieOpen(movieFileToPlay, playMovieFileReadOnly); + } + if(outputWavFile) + { + outputWavFile = false; + theApp.soundRecordName = wavFileToOutput; + theApp.soundRecording = true; + } + if(outputAVIFile) + { + outputAVIFile = false; + OnToolsRecordStartavirecording(); + } + if(pauseAfterTime >= 0) + { + VBAMovieSetPauseAt(pauseAfterTime); + } + if(flagHideMenu) + { + OnFileTogglemenu(); + theApp.updateWindowSize(theApp.videoOption); + } + } + + if(theApp.cartridgeType != prevCartridgeType) + { + extern GBACheatSearch gbaDlg; + extern GBCheatSearch gbDlg; + if(!theApp.pauseDuringCheatSearch && theApp.modelessCheatDialogIsOpen) + { + gbaDlg.DestroyWindow(); + gbDlg.DestroyWindow(); + theApp.modelessCheatDialogIsOpen = false; + } + } + + return true; +} + +void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) +{ + ASSERT(pMenu != NULL); + + CCmdUI state; + state.m_pMenu = pMenu; + ASSERT(state.m_pOther == NULL); + ASSERT(state.m_pParentMenu == NULL); + + // determine if menu is popup in top-level menu and set m_pOther to + // it if so (m_pParentMenu == NULL indicates that it is secondary popup) + HMENU hParentMenu; + if (AfxGetThreadState()->m_hTrackingMenu == pMenu->m_hMenu) + state.m_pParentMenu = pMenu; // parent == child for tracking popup + else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL) { + CWnd* pParent = GetTopLevelParent(); + // child windows don't have menus -- need to go to the top! + if (pParent != NULL && + (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL) { + int nIndexMax = ::GetMenuItemCount(hParentMenu); + for (int nIndex = 0; nIndex < nIndexMax; nIndex++) { + if (::GetSubMenu(hParentMenu, nIndex) == pMenu->m_hMenu) { + // when popup is found, m_pParentMenu is containing menu + state.m_pParentMenu = CMenu::FromHandle(hParentMenu); + break; + } + } + } + } + + state.m_nIndexMax = pMenu->GetMenuItemCount(); + for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax; + state.m_nIndex++) { + state.m_nID = pMenu->GetMenuItemID(state.m_nIndex); + if (state.m_nID == 0) + continue; // menu separator or invalid cmd - ignore it + + ASSERT(state.m_pOther == NULL); + ASSERT(state.m_pMenu != NULL); + if (state.m_nID == (UINT)-1) { + // possibly a popup menu, route to first item of that popup + state.m_pSubMenu = pMenu->GetSubMenu(state.m_nIndex); + if (state.m_pSubMenu == NULL || + (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 || + state.m_nID == (UINT)-1) { + continue; // first item of popup can't be routed to + } + state.DoUpdate(this, FALSE); // popups are never auto disabled + } else { + // normal menu item + // Auto enable/disable if frame window has 'm_bAutoMenuEnable' + // set and command is _not_ a system command. + state.m_pSubMenu = NULL; + state.DoUpdate(this, state.m_nID < 0xF000); + } + + // adjust for menu deletions and additions + UINT nCount = pMenu->GetMenuItemCount(); + if (nCount < state.m_nIndexMax) { + state.m_nIndex -= (state.m_nIndexMax - nCount); + while (state.m_nIndex < nCount && + pMenu->GetMenuItemID(state.m_nIndex) == state.m_nID) { + state.m_nIndex++; + } + } + state.m_nIndexMax = nCount; + } +} + +void MainWnd::OnMove(int x, int y) +{ + CWnd::OnMove(x, y); + + if(!theApp.changingVideoSize) { + if(this) { + if(!IsIconic()) { + RECT r; + + GetWindowRect(&r); + theApp.windowPositionX = r.left; + theApp.windowPositionY = r.top; + theApp.adjustDestRect(); + regSetDwordValue("windowX", theApp.windowPositionX); + regSetDwordValue("windowY", theApp.windowPositionY); + } + } + } +} + +static bool wasPaused = false; +static int lastType = -1; + +void MainWnd::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + // hack to re-maximize window after it auto-unmaximizes while loading a ROM + if(nType == SIZE_MAXIMIZED && lastType == SIZE_MAXIMIZED) + { + lastType = -1; + ShowWindow(SW_SHOWMAXIMIZED); + MoveWindow(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)); + return; + } + else + lastType = nType; + + if(!theApp.changingVideoSize) { + if(this) { + if(!IsIconic()) { + if(theApp.iconic) { + if(emulating) { + if(!wasPaused) + { + soundResume(); + theApp.paused = false; + } + } + } + if(theApp.videoOption <= VIDEO_4X) { + theApp.surfaceSizeX = cx; + theApp.surfaceSizeY = cy; + theApp.adjustDestRect(); + if(theApp.display) + theApp.display->resize(theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top); + } + } else { + if(emulating) { + if(!theApp.paused) { + wasPaused = theApp.paused; + theApp.paused = true; + soundPause(); + } + } + theApp.iconic = true; + } + } + } +} + +void MainWnd::winSaveCheatListDefault() +{ + CString name; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + CString dir = regQueryStringValue("saveDir", NULL); + + if(!dir.GetLength()) + dir = getDirFromFile(filename); + + if(isDriveRoot(dir)) + filename.Format("%s%s.clt", dir, name); + else + filename.Format("%s\\%s.clt", dir, name); + + winSaveCheatList(filename); +} + +void MainWnd::winSaveCheatList(const char *name) +{ + if(theApp.cartridgeType == 0) + cheatsSaveCheatList(name); + else + gbCheatsSaveCheatList(name); +} + +void MainWnd::winLoadCheatListDefault() +{ + CString name; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + CString dir = regQueryStringValue("saveDir", NULL); + + if(!dir.GetLength()) + dir = getDirFromFile(filename); + + if(isDriveRoot(dir)) + filename.Format("%s%s.clt", dir, name); + else + filename.Format("%s\\%s.clt", dir, name); + + winLoadCheatList(filename); +} + +void MainWnd::winLoadCheatList(const char *name) +{ + bool res = false; + + if(theApp.cartridgeType == 0) + res = cheatsLoadCheatList(name); + else + res = gbCheatsLoadCheatList(name); + + if(res) + systemScreenMessage(winResLoadString(IDS_LOADED_CHEATS)); +} + +CString MainWnd::getDirFromFile(CString& file) +{ + CString temp = file; + int index = temp.ReverseFind('\\'); + + if(index != -1) { + temp = temp.Left(index); + if(temp.GetLength() == 2 && temp[1] == ':') + temp += "\\"; + } else { + temp = ""; + } + return temp; +} + +bool MainWnd::isDriveRoot(CString& file) +{ + if(file.GetLength() == 3) { + if(file[1] == ':' && file[2] == '\\') + return true; + } + return false; +} + +void MainWnd::writeBatteryFile() +{ + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("batteryDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.sav", saveDir, buffer); + else + filename.Format("%s\\%s.sav", saveDir, buffer); + + if(theApp.emulator.emuWriteBattery) + theApp.emulator.emuWriteBattery(filename); +} + + +void MainWnd::readBatteryFile() +{ + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("batteryDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.sav", saveDir, buffer); + else + filename.Format("%s\\%s.sav", saveDir, buffer); + + bool res = false; + + if(theApp.emulator.emuReadBattery) + res = theApp.emulator.emuReadBattery(filename); + + if(res) + systemScreenMessage(winResLoadString(IDS_LOADED_BATTERY)); +} + +CString MainWnd::winLoadFilter(UINT id) +{ + CString res = winResLoadString(id); + res.Replace('_','|'); + + return res; +} + +bool MainWnd::loadSaveGame(const char *name) +{ + if(theApp.emulator.emuReadState) + return theApp.emulator.emuReadState(name); + return false; +} + +bool MainWnd::writeSaveGame(const char *name) +{ + if(theApp.emulator.emuWriteState) + return theApp.emulator.emuWriteState(name); + return false; +} + +void MainWnd::OnContextMenu(CWnd* pWnd, CPoint point) +{ + winMouseOn(); + if(theApp.skin) { + if(theApp.popup == NULL) { + theApp.winAccelMgr.UpdateMenu(theApp.menu); + theApp.popup = CreatePopupMenu(); + if(theApp.menu != NULL) { + int count = GetMenuItemCount(theApp.menu); + OSVERSIONINFO info; + info.dwOSVersionInfoSize = sizeof(info); + GetVersionEx(&info); + + if(info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + for(int i = 0; i < count; i++) { + char buffer[256]; + MENUITEMINFO info; + ZeroMemory(&info, sizeof(info)); + info.cbSize = sizeof(info) - sizeof(HBITMAP); + info.fMask = MIIM_STRING | MIIM_SUBMENU; + info.dwTypeData = buffer; + info.cch = 256; + if(!GetMenuItemInfo(theApp.menu, i, MF_BYPOSITION, &info)) { + } + if(!AppendMenu(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) { + } + } + } else { + for(int i = 0; i < count; i++) { + wchar_t buffer[256]; + MENUITEMINFOW info; + ZeroMemory(&info, sizeof(info)); + info.cbSize = sizeof(info) - sizeof(HBITMAP); + info.fMask = MIIM_STRING | MIIM_SUBMENU; + info.dwTypeData = buffer; + info.cch = 256; + if(!GetMenuItemInfoW(theApp.menu, i, MF_BYPOSITION, &info)) { + } + if(!AppendMenuW(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) { + } + } + } + } + } + int x = point.x; + int y = point.y; + if(x == -1 && y == -1) { + x = (theApp.dest.left + theApp.dest.right) / 2; + y = (theApp.dest.top + theApp.dest.bottom) / 2; + } + if(!TrackPopupMenu(theApp.popup, 0, x, y, 0, m_hWnd, NULL)) { + } + } +} + +void MainWnd::OnSystemMinimize() +{ + ShowWindow(SW_SHOWMINIMIZED); +} + +bool MainWnd::fileOpenSelect() +{ + theApp.dir = ""; + CString initialDir = regQueryStringValue("romdir","."); + if(!initialDir.IsEmpty()) + theApp.dir = initialDir; + + int selectedFilter = regQueryDwordValue("selectedFilter", 0); + if(selectedFilter < 0 || selectedFilter > 2) + selectedFilter = 0; + + theApp.szFile = ""; + + LPCTSTR exts[] = { "" }; + CString filter = winLoadFilter(IDS_FILTER_ROM); + CString title = winResLoadString(IDS_SELECT_ROM); + + FileDlg dlg(this, "", filter, selectedFilter, "", exts, theApp.dir, title, false, true); + + if(dlg.DoModal() == IDOK) { + regSetDwordValue("selectedFilter", dlg.m_ofn.nFilterIndex); + theApp.szFile = dlg.GetPathName(); + theApp.dir = theApp.szFile.Left(dlg.m_ofn.nFileOffset); + if(theApp.dir.GetLength() > 3 && theApp.dir[theApp.dir.GetLength()-1] == '\\') + theApp.dir = theApp.dir.Left(theApp.dir.GetLength()-1); + regSetStringValue("romdir", theApp.dir); + return true; + } + return false; +} + +void MainWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + if(emulating) { + theApp.painting = true; + systemDrawScreen(); + theApp.painting = false; + theApp.renderedFrames--; + } +} + +static bool translatingAccelerator = false; + +BOOL MainWnd::PreTranslateMessage(MSG* pMsg) +{ + translatingAccelerator = true; + if (CWnd::PreTranslateMessage(pMsg)) + { + translatingAccelerator = false; + return TRUE; + } + + if(pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) { + bool bHit = theApp.hAccel != NULL && ::TranslateAccelerator(m_hWnd, theApp.hAccel, pMsg); + + // HACK to get around the fact that TranslateAccelerator can't handle modifier-only accelerators + // (it would be better to fix TranslateAccelerator, but its code is in a Microsoft library...) + if(!bHit) { + if(pMsg->wParam == VK_SHIFT || pMsg->wParam == VK_CONTROL || pMsg->wParam == VK_MENU) { + + // do a linear loop through all accelerators to find modifier-only ones... + CCmdAccelOb* pCmdAccel; + WORD wKey; + CAccelsOb* pAccelOb; + POSITION pos = theApp.winAccelMgr.m_mapAccelTable.GetStartPosition(); + const int modifiers = ((pMsg->wParam == VK_SHIFT) ? FSHIFT : ((pMsg->wParam == VK_CONTROL) ? FCONTROL : FALT)); + while (pos != NULL) { + theApp.winAccelMgr.m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); + POSITION pos = pCmdAccel->m_Accels.GetHeadPosition(); + while (pos != NULL) { + pAccelOb = pCmdAccel->m_Accels.GetNext(pos); + + if(pAccelOb->m_wKey == 0) // if accelerator-only + { + if((pAccelOb->m_cVirt & modifiers) == modifiers) // if modifier matches + { + SendMessage(WM_COMMAND, pCmdAccel->m_wIDCommand, 0); // tell Windows to call the right function + } + } + } + } + } + } + + translatingAccelerator = false; + return bHit; + } + + translatingAccelerator = false; + return FALSE; +} + +void MainWnd::screenCapture(int captureNumber) +{ + CString buffer; + + CString captureDir = regQueryStringValue("captureDir", ""); + int index = theApp.filename.ReverseFind('\\'); + + CString name; + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + + if(captureDir.IsEmpty()) + captureDir = getDirFromFile(theApp.filename); + + LPCTSTR ext = "png"; + if(theApp.captureFormat != 0) + ext = "bmp"; + + if(isDriveRoot(captureDir)) + buffer.Format("%s%s_%02d.%s", + captureDir, + name, + captureNumber, + ext); + else + buffer.Format("%s\\%s_%02d.%s", + captureDir, + name, + captureNumber, + ext); + + if(theApp.captureFormat == 0) + theApp.emulator.emuWritePNG(buffer); + else + theApp.emulator.emuWriteBMP(buffer); + + CString msg = winResLoadString(IDS_SCREEN_CAPTURE); + systemScreenMessage(msg); +} + +void MainWnd::winMouseOn() +{ + SetCursor(arrow); + if(theApp.videoOption > VIDEO_4X) { + theApp.mouseCounter = 120; + } else + theApp.mouseCounter = 0; +} + +void MainWnd::OnMouseMove(UINT nFlags, CPoint point) +{ + winMouseOn(); + + CWnd::OnMouseMove(nFlags, point); +} + +void MainWnd::OnInitMenu(CMenu* pMenu) +{ + CWnd::OnInitMenu(pMenu); + + // HACK: we only want to call this if the user is pulling down the menu, + // but TranslateAccelerator also causes OnInitMenu to be called, so ignore that + if(!translatingAccelerator) + { + soundPause(); + } +} + +void MainWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) +{ + CWnd::OnActivate(nState, pWndOther, bMinimized); + + bool a = (nState == WA_ACTIVE) || (nState == WA_CLICKACTIVE); + + extern bool inputActive; + inputActive = a; + + if(a && theApp.input) { + theApp.active = a; + theApp.input->activate(); + if(!theApp.paused) { + if(emulating) { + soundResume(); + } + } + } else { + wasPaused = theApp.paused; + theApp.wasPaused = true; + if(theApp.pauseWhenInactive) { + if(emulating) { + soundPause(); + } + theApp.active = a; + } + + memset(theApp.delta,255,sizeof(theApp.delta)); + } + + if(theApp.paused && emulating) + { + theApp.painting = true; + systemDrawScreen(); + theApp.painting = false; + } +} + +#if _MSC_VER <= 1200 +void MainWnd::OnActivateApp(BOOL bActive, HTASK hTask) +#else +void MainWnd::OnActivateApp(BOOL bActive, DWORD hTask) +#endif +{ + CWnd::OnActivateApp(bActive, hTask); + + if(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) { + if(bActive) { + if(theApp.display) + theApp.display->clear(); + } + } +} + +void MainWnd::OnDropFiles(HDROP hDropInfo) +{ + char szFile[1024]; + + if(DragQueryFile(hDropInfo, + 0, + szFile, + 1024)) { + theApp.szFile = szFile; + if(FileRun()) { + SetForegroundWindow(); + emulating = TRUE; + } else { + emulating = FALSE; + soundPause(); + } + } + DragFinish(hDropInfo); +} + +LRESULT MainWnd::OnMySysCommand(WPARAM wParam, LPARAM lParam) +{ + if(emulating && !theApp.paused) { + if((wParam&0xFFF0) == SC_SCREENSAVE || (wParam&0xFFF0) == SC_MONITORPOWER) + return 0; + } + return Default(); +} diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h new file mode 100644 index 0000000..f272f00 --- /dev/null +++ b/src/win32/MainWnd.h @@ -0,0 +1,497 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_) +#define AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MainWnd.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// MainWnd window + +class MainWnd : public CWnd +{ + // Construction + public: + MainWnd(); + + // Attributes + public: + + // Operations + public: + bool FileRun(); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MainWnd) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + //}}AFX_VIRTUAL + + // Implementation + public: + HCURSOR arrow; + void winMouseOn(); + void screenCapture(int captureNumber); + HACCEL m_hAccelTable; + bool fileOpenSelect(); + afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM); + afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM); + afx_msg void OnUpdateFileLoadGameSlot(CCmdUI *pCmdUI); + afx_msg void OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI); + afx_msg void OnUpdateSelectSlot(CCmdUI *pCmdUI); + afx_msg void OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsJoypadAutofire(UINT nID); + afx_msg void OnUpdateOptionsJoypadSticky(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsJoypadSticky(UINT nID); + afx_msg void OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsJoypadDefault(UINT nID); + afx_msg void OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsFilterIFB(UINT nID); + afx_msg void OnUpdateOptionsFilter(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsFilter(UINT nID); + afx_msg void OnUpdateOptionsPriority(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsPriority(UINT nID); + void updateSoundChannels(UINT nID); + afx_msg void OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsSoundVolume(UINT nID); + afx_msg void OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI); + afx_msg BOOL OnOptionsEmulatorShowSpeed(UINT nID); + afx_msg void OnSystemMinimize(); + afx_msg void OnUpdateVideoLayer(CCmdUI* pCmdUI); + afx_msg BOOL OnVideoLayer(UINT nID); + void winConfirmMode(); + afx_msg BOOL OnOptionVideoSize(UINT nID); + afx_msg BOOL OnOptionsFrameskip(UINT nID); + afx_msg void OnOptionsSound44khz(); + afx_msg void OnOptionsEmulatorSelectbiosfile(); + afx_msg void OnFileTogglemenu(); + bool fileImportGSACodeFile(CString& fileName); + bool writeSaveGame(const char *name); + bool loadSaveGame(const char *name); + CString winLoadFilter(UINT id); + void winLoadCheatList(const char *name); + void winLoadCheatListDefault(); + void readBatteryFile(); + void writeBatteryFile(); + bool isDriveRoot(CString& file); + CString getDirFromFile(CString& file); + void winSaveCheatList(const char *name); + void winSaveCheatListDefault(); + virtual ~MainWnd(); + + // Generated message map functions + protected: + //{{AFX_MSG(MainWnd) + afx_msg void OnClose(); + afx_msg void OnHelpAbout(); + afx_msg void OnHelpFaq(); + afx_msg void OnFileOpen(); + afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); + afx_msg void OnFilePause(); + afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI); + afx_msg void OnFileReset(); + afx_msg void OnUpdateFileReset(CCmdUI* pCmdUI); + afx_msg void OnUpdateFileRecentFreeze(CCmdUI* pCmdUI); + afx_msg void OnFileRecentReset(); + afx_msg void OnFileRecentFreeze(); + afx_msg void OnFileExit(); + afx_msg void OnFileClose(); + afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI); + afx_msg void OnFileLoad(); + afx_msg void OnUpdateFileLoad(CCmdUI* pCmdUI); + afx_msg void OnFileSave(); + afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI); + afx_msg void OnFileImportBatteryfile(); + afx_msg void OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI); + afx_msg void OnFileImportGamesharkcodefile(); + afx_msg void OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI); + afx_msg void OnFileImportGamesharksnapshot(); + afx_msg void OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI); + afx_msg void OnFileExportBatteryfile(); + afx_msg void OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI); + afx_msg void OnFileExportGamesharksnapshot(); + afx_msg void OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI); + afx_msg void OnFileScreencapture(); + afx_msg void OnUpdateFileScreencapture(CCmdUI* pCmdUI); + afx_msg void OnFileRominformation(); + afx_msg void OnUpdateFileRominformation(CCmdUI* pCmdUI); + afx_msg void OnUpdateFileTogglemenu(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle6(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle15(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle37(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle75(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle87(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle112(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle125(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottle300(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottleIncrease(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipThrottleDecrease(CCmdUI* pCmdUI); + afx_msg void OnOptionsFrameskipThrottleNothrottle(); + afx_msg void OnOptionsFrameskipThrottle6(); + afx_msg void OnOptionsFrameskipThrottle15(); + afx_msg void OnOptionsFrameskipThrottle25(); + afx_msg void OnOptionsFrameskipThrottle37(); + afx_msg void OnOptionsFrameskipThrottle50(); + afx_msg void OnOptionsFrameskipThrottle75(); + afx_msg void OnOptionsFrameskipThrottle87(); + afx_msg void OnOptionsFrameskipThrottle100(); + afx_msg void OnOptionsFrameskipThrottle112(); + afx_msg void OnOptionsFrameskipThrottle125(); + afx_msg void OnOptionsFrameskipThrottle150(); + afx_msg void OnOptionsFrameskipThrottle200(); + afx_msg void OnOptionsFrameskipThrottle300(); + afx_msg void OnOptionsFrameskipThrottleOther(); + afx_msg void OnOptionsFrameskipThrottleIncrease(); + afx_msg void OnOptionsFrameskipThrottleDecrease(); + afx_msg void OnOptionsFrameskipAccuratePitch(); + afx_msg void OnOptionsFrameskipAccurateSpeed(); + afx_msg void OnUpdateOptionsFrameskipAccuratePitch(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsFrameskipAccurateSpeed(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoVsync(); + afx_msg void OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoX1(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoX2(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoX3(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoX4(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoFullscreen320x240(); + afx_msg void OnOptionsVideoFullscreen640x480(); + afx_msg void OnOptionsVideoFullscreen800x600(); + afx_msg void OnOptionsVideoFullscreen(); + afx_msg void OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI); + afx_msg void OnMove(int x, int y); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnOptionsVideoDisablesfx(); + afx_msg void OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoFullscreenstretchtofit(); + afx_msg void OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRendermethodGdi(); + afx_msg void OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRendermethodDirectdraw(); + afx_msg void OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRendermethodDirect3d(); + afx_msg void OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRendermethodOpengl(); + afx_msg void OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoTriplebuffering(); + afx_msg void OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoDdrawemulationonly(); + afx_msg void OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoDdrawusevideomemory(); + afx_msg void OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsD3dnofilter(); + afx_msg void OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsD3dbilinear(); + afx_msg void OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsGlnearest(); + afx_msg void OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsGlbilinear(); + afx_msg void OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsGltriangle(); + afx_msg void OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsGlquads(); + afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsSelectskin(); + afx_msg void OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoRenderoptionsSkin(); + afx_msg void OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI* pCmdUI); + afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); + afx_msg void OnOptionsEmulatorAssociate(); + afx_msg void OnOptionsEmulatorDirectories(); + afx_msg void OnOptionsVideoDisablestatusmessages(); + afx_msg void OnUpdateOptionsVideoDisablestatusmessages(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSynchronize(); + afx_msg void OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorPausewheninactive(); + afx_msg void OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSpeeduptoggle(); + afx_msg void OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorRemoveintrosgba(); + afx_msg void OnUpdateOptionsEmulatorRemoveintrosgba(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorAutomaticallyipspatch(); + afx_msg void OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorAgbprint(); + afx_msg void OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorRealtimeclock(); + afx_msg void OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorAutohidemenu(); + afx_msg void OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorRewindinterval(); + afx_msg void OnOptionsEmulatorSavetypeAutomatic(); + afx_msg void OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeEeprom(); + afx_msg void OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeSram(); + afx_msg void OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeFlash(); + afx_msg void OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeEepromsensor(); + afx_msg void OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeNone(); + afx_msg void OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeFlash512k(); + afx_msg void OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSavetypeFlash1m(); + afx_msg void OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorUsebiosfile(); + afx_msg void OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorUseOldGBTiming(); + afx_msg void OnUpdateOptionsEmulatorUseOldGBTiming(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorGBALag(); + afx_msg void OnUpdateOptionsEmulatorGBALag(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorSkipbios(); + afx_msg void OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorPngformat(); + afx_msg void OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI); + afx_msg void OnOptionsEmulatorBmpformat(); + afx_msg void OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundOff(); + afx_msg void OnUpdateOptionsSoundOff(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundMute(); + afx_msg void OnUpdateOptionsSoundMute(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundOn(); + afx_msg void OnUpdateOptionsSoundOn(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundUseoldsynchronization(); + afx_msg void OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundEcho(); + afx_msg void OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundLowpassfilter(); + afx_msg void OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundReversestereo(); + afx_msg void OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundMuteFrameAdvance(); + afx_msg void OnUpdateOptionsSoundMuteFrameAdvance(CCmdUI* pCmdUI); + afx_msg void OnOptionsSound11khz(); + afx_msg void OnUpdateOptionsSound11khz(CCmdUI* pCmdUI); + afx_msg void OnOptionsSound22khz(); + afx_msg void OnUpdateOptionsSound22khz(CCmdUI* pCmdUI); + afx_msg void OnUpdateOptionsSound44khz(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundChannel1(); + afx_msg void OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundChannel2(); + afx_msg void OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundChannel3(); + afx_msg void OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundChannel4(); + afx_msg void OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundDirectsounda(); + afx_msg void OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundDirectsoundb(); + afx_msg void OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyBorder(); + afx_msg void OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyPrinter(); + afx_msg void OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyBorderAutomatic(); + afx_msg void OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyAutomatic(); + afx_msg void OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyGba(); + afx_msg void OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyCgb(); + afx_msg void OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboySgb(); + afx_msg void OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboySgb2(); + afx_msg void OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyGb(); + afx_msg void OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyRealcolors(); + afx_msg void OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyGameboycolors(); + afx_msg void OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI); + afx_msg void OnOptionsGameboyColors(); + afx_msg void OnOptionsFilterDisablemmx(); + afx_msg void OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI); + afx_msg void OnOptionsLanguageSystem(); + afx_msg void OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI); + afx_msg void OnOptionsLanguageEnglish(); + afx_msg void OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI); + afx_msg void OnOptionsLanguageOther(); + afx_msg void OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadConfigure1(); + afx_msg void OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadConfigure2(); + afx_msg void OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadConfigure3(); + afx_msg void OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadConfigure4(); + afx_msg void OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadMotionconfigure(); + afx_msg void OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI); + afx_msg void OnOptionsJoypadAllowLeftRight(); + afx_msg void OnUpdateOptionsJoypadAllowLeftRight(CCmdUI* pCmdUI); + afx_msg void OnCheatsSearchforcheats(); + afx_msg void OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI); + afx_msg void OnCheatsCheatlist(); + afx_msg void OnUpdateCheatsCheatlist(CCmdUI* pCmdUI); + afx_msg void OnCheatsAutomaticsaveloadcheats(); + afx_msg void OnCheatsPauseDuringCheatSearch(); + afx_msg void OnCheatsLoadcheatlist(); + afx_msg void OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI); + afx_msg void OnCheatsSavecheatlist(); + afx_msg void OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI); + afx_msg void OnToolsDisassemble(); + afx_msg void OnUpdateToolsDisassemble(CCmdUI* pCmdUI); + afx_msg void OnToolsLogging(); + afx_msg void OnUpdateToolsLogging(CCmdUI* pCmdUI); + afx_msg void OnToolsIoviewer(); + afx_msg void OnUpdateToolsIoviewer(CCmdUI* pCmdUI); + afx_msg void OnToolsMapview(); + afx_msg void OnUpdateToolsMapview(CCmdUI* pCmdUI); + afx_msg void OnToolsMemoryviewer(); + afx_msg void OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI); + afx_msg void OnToolsOamviewer(); + afx_msg void OnUpdateToolsOamviewer(CCmdUI* pCmdUI); + afx_msg void OnToolsPaletteview(); + afx_msg void OnUpdateToolsPaletteview(CCmdUI* pCmdUI); + afx_msg void OnToolsTileviewer(); + afx_msg void OnUpdateToolsTileviewer(CCmdUI* pCmdUI); + afx_msg void OnDebugNextframe(); + afx_msg void OnUpdateDebugNextframe(CCmdUI* pCmdUI); + afx_msg void OnDebugFramesearch(); + afx_msg void OnUpdateDebugFramesearch(CCmdUI* pCmdUI); + afx_msg void OnDebugFramesearchPrev(); + afx_msg void OnUpdateDebugFramesearchPrev(CCmdUI* pCmdUI); + afx_msg void OnDebugFramesearchLoad(); + afx_msg void OnUpdateDebugFramesearchLoad(CCmdUI* pCmdUI); + afx_msg void OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI); + afx_msg void OnUpdateCheatsPauseDuringCheatSearch(CCmdUI* pCmdUI); + afx_msg void OnToolsFrameCounter(); + afx_msg void OnUpdateToolsFrameCounter(CCmdUI* pCmdUI); + afx_msg void OnToolsInputDisplay(); + afx_msg void OnUpdateToolsInputDisplay(CCmdUI* pCmdUI); + afx_msg void OnToolsDebugGdb(); + afx_msg void OnUpdateToolsDebugGdb(CCmdUI* pCmdUI); + afx_msg void OnToolsDebugLoadandwait(); + afx_msg void OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI); + afx_msg void OnToolsDebugBreak(); + afx_msg void OnUpdateToolsDebugBreak(CCmdUI* pCmdUI); + afx_msg void OnToolsDebugDisconnect(); + afx_msg void OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundStartrecording(); + afx_msg void OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundStoprecording(); + afx_msg void OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI); + afx_msg void OnToolsRecordStartavirecording(); + afx_msg void OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI); + afx_msg void OnToolsRecordStopavirecording(); + afx_msg void OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI); + afx_msg void OnPaint(); + afx_msg void OnToolsRecordStartmovierecording(); + afx_msg void OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI); + afx_msg void OnToolsRecordStopmovierecording(); + afx_msg void OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI); + afx_msg void OnToolsPlayStartmovieplaying(); + afx_msg void OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI); + afx_msg void OnToolsPlayStopmovieplaying(); + afx_msg void OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI); + afx_msg void OnToolsPlayReadOnly(); + afx_msg void OnUpdateToolsPlayReadOnly(CCmdUI* pCmdUI); + afx_msg void OnToolsPlayContinue(); + afx_msg void OnUpdateToolsPlayContinue(CCmdUI* pCmdUI); + afx_msg void OnToolsPlayRestart(); + afx_msg void OnUpdateToolsPlayRestart(CCmdUI* pCmdUI); + afx_msg void OnToolsRewind(); + afx_msg void OnUpdateToolsRewind(CCmdUI* pCmdUI); + afx_msg void OnToolsCustomize(); + afx_msg void OnUpdateToolsCustomize(CCmdUI* pCmdUI); + afx_msg void OnToolsCustomizeCommon(); + afx_msg void OnUpdateToolsCustomizeCommon(CCmdUI* pCmdUI); + afx_msg void OnHelpBugreport(); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnInitMenu(CMenu* pMenu); + afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); +#if _MSC_VER <= 1200 + afx_msg void OnActivateApp(BOOL bActive, HTASK hTask); +#else + afx_msg void OnActivateApp(BOOL bActive, DWORD hTask); +#endif + afx_msg void OnDropFiles(HDROP hDropInfo); + afx_msg void OnFileSavegameOldestslot(); + afx_msg void OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI); + afx_msg void OnFileLoadgameMostrecent(); + afx_msg void OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI); + afx_msg void OnFileLoadgameAutoloadmostrecent(); + afx_msg void OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI); + afx_msg void OnFileLoadgameMakeRecent(); + afx_msg void OnUpdateFileLoadgameMakeRecent(CCmdUI* pCmdUI); + + afx_msg void OnFileSavegameCurrent(); + afx_msg void OnUpdateFileSavegameCurrent(CCmdUI* pCmdUI); + afx_msg void OnFileLoadgameCurrent(); + afx_msg void OnUpdateFileLoadgameCurrent(CCmdUI* pCmdUI); + afx_msg void OnFileLoadgameMakeCurrent(); + afx_msg void OnUpdateFileLoadgameMakeCurrent(CCmdUI* pCmdUI); + afx_msg void OnFileSavegameMakeCurrent(); + afx_msg void OnUpdateFileSavegameMakeCurrent(CCmdUI* pCmdUI); + afx_msg void OnFileSavegameIncrementSlot(); + afx_msg void OnUpdateFileSavegameIncrementSlot(CCmdUI* pCmdUI); + afx_msg void OnFileSavegameDecrementSlot(); + afx_msg void OnUpdateFileSavegameDecrementSlot(CCmdUI* pCmdUI); + + afx_msg void OnOptionsSoundVolume25x(); + afx_msg void OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI); + afx_msg void OnOptionsSoundVolume5x(); + afx_msg void OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI); + afx_msg void OnCheatsDisablecheats(); + afx_msg void OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI); + afx_msg void OnOptionsVideoFullscreenmaxscale(); + afx_msg void OnOptionsVideoTextdisplayoptions(); + afx_msg void OnUpdateOptionsVideoTextdisplayoptions(CCmdUI *pCmdUI); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + afx_msg BOOL OnFileRecentFile(UINT nID); + afx_msg BOOL OnFileLoadSlot(UINT nID); + afx_msg BOOL OnFileSaveSlot(UINT nID); + afx_msg BOOL OnSelectSlot(UINT nID); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_) diff --git a/src/win32/MainWndCheats.cpp b/src/win32/MainWndCheats.cpp new file mode 100644 index 0000000..f769330 --- /dev/null +++ b/src/win32/MainWndCheats.cpp @@ -0,0 +1,209 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" + +#include "FileDlg.h" +#include "GBACheats.h" +#include "GBCheatsDlg.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../GBA.h" +#include "../Globals.h" +#include "../gb/gbCheats.h" + +extern int emulating; + +GBACheatSearch gbaDlg; +GBCheatSearch gbDlg; + +void MainWnd::OnCheatsSearchforcheats() +{ + theApp.winCheckFullscreen(); + + if(!theApp.pauseDuringCheatSearch && theApp.modelessCheatDialogIsOpen) + { + gbaDlg.DestroyWindow(); + gbDlg.DestroyWindow(); + theApp.modelessCheatDialogIsOpen = false; + } + + if(theApp.cartridgeType == 0) + { + if(theApp.pauseDuringCheatSearch) + { + gbaDlg.DoModal(); + } + else + { + if(!theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = true; + gbaDlg.Create(GBACheatSearch::IDD, theApp.m_pMainWnd); + } + } + } + else + { + if(theApp.pauseDuringCheatSearch) + { + gbDlg.DoModal(); + } + else + { + if(!theApp.modelessCheatDialogIsOpen) + { + theApp.modelessCheatDialogIsOpen = true; + gbDlg.Create(GBACheatSearch::IDD, theApp.m_pMainWnd); + } + } + } +} + +void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnCheatsCheatlist() +{ + theApp.winCheckFullscreen(); + if(theApp.cartridgeType == 0) { + GBACheatList dlg; + dlg.DoModal(); + } else { + GBCheatList dlg; + dlg.DoModal(); + } +} + +void MainWnd::OnUpdateCheatsCheatlist(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnCheatsAutomaticsaveloadcheats() +{ + theApp.autoSaveLoadCheatList = !theApp.autoSaveLoadCheatList; +} + +void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoSaveLoadCheatList); +} + +void MainWnd::OnCheatsPauseDuringCheatSearch() +{ + theApp.pauseDuringCheatSearch = !theApp.pauseDuringCheatSearch; +} + +void MainWnd::OnUpdateCheatsPauseDuringCheatSearch(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.pauseDuringCheatSearch); +} + +void MainWnd::OnCheatsLoadcheatlist() +{ + theApp.winCheckFullscreen(); + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.clt", saveDir, buffer); + else + filename.Format("%s\\%s.clt", saveDir, buffer); + + LPCTSTR exts[] = { ".clt" }; + CString filter = winLoadFilter(IDS_FILTER_CHEAT_LIST); + CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME); + + FileDlg dlg(this, filename, filter, 0, "CLT", exts, saveDir, title, false); + + if(dlg.DoModal() == IDOK) { + winLoadCheatList(dlg.GetPathName()); + } +} + +void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnCheatsSavecheatlist() +{ + theApp.winCheckFullscreen(); + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.clt", saveDir, buffer); + else + filename.Format("%s\\%s.clt", saveDir, buffer); + + LPCTSTR exts[] = { ".clt" }; + CString filter = winLoadFilter(IDS_FILTER_CHEAT_LIST); + CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME); + + FileDlg dlg(this, filename, filter, 0, "CLT", exts, saveDir, title, true); + + if(dlg.DoModal() == IDOK) { + winSaveCheatList(dlg.GetPathName()); + } +} + +void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnCheatsDisablecheats() +{ + cheatsEnabled = !cheatsEnabled; +} + +void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(!cheatsEnabled); +} + diff --git a/src/win32/MainWndFile.cpp b/src/win32/MainWndFile.cpp new file mode 100644 index 0000000..4e579d8 --- /dev/null +++ b/src/win32/MainWndFile.cpp @@ -0,0 +1,1133 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" + +#include "ExportGSASnapshot.h" +#include "FileDlg.h" +#include "GSACodeSelect.h" +#include "RomInfo.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../GBA.h" +#include "../Globals.h" +#include "../NLS.h" +#include "../Sound.h" +#include "../gb/GB.h" +#include "../gb/gbCheats.h" +#include "../gb/gbGlobals.h" +#include "../movie.h" + +extern int emulating; + +extern void remoteCleanUp(); + +void MainWnd::OnFileOpen() +{ + theApp.winCheckFullscreen(); + if(fileOpenSelect()) { + if(VBAMovieActive()) + VBAMovieStop(false); // will only get here on user selecting to play a ROM, canceling movie + FileRun(); + } +} + +void MainWnd::OnFilePause() +{ + if(!theApp.paused) + { + if(theApp.throttle > 25) + { + // less immediate response, better update + OnDebugNextframe(); + } + else + { + // more immediate response, worse update + theApp.paused = !theApp.paused; + theApp.painting = true; + systemDrawScreen(); + theApp.painting = false; + } + theApp.wasPaused = true; + soundPause(); + } + else + { + theApp.paused = !theApp.paused; + soundResume(); + } +} + +void MainWnd::OnUpdateFilePause(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.paused); +} + +void MainWnd::OnFileReset() +{ + if(emulating) { + if(VBAMovieGetState() == MOVIE_STATE_PLAY) + { + VBAMovieRestart(); + systemScreenMessage("movie play restart"); + } + else + { + theApp.emulator.emuReset(); + systemScreenMessage(winResLoadString(IDS_RESET)); + } + } +} + +void MainWnd::OnUpdateFileReset(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnUpdateFileRecentFreeze(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.recentFreeze); + + if(pCmdUI->m_pMenu == NULL) + return; + + CMenu *pMenu = pCmdUI->m_pMenu; + + int i; + for(i = 0; i < 10; i++) { + if(!pMenu->RemoveMenu(ID_FILE_MRU_FILE1+i, MF_BYCOMMAND)) + break; + } + + for(i = 0; i < 10; i++) { + CString p = theApp.recentFiles[i]; + if(p.GetLength() == 0) + break; + int index = p.ReverseFind('\\'); + + if(index != -1) + p = p.Right(p.GetLength()-index-1); + + pMenu->AppendMenu(MF_STRING, ID_FILE_MRU_FILE1+i, p); + } + theApp.winAccelMgr.UpdateMenu((HMENU)*pMenu); +} + +BOOL MainWnd::OnFileRecentFile(UINT nID) +{ + if(theApp.recentFiles[(nID&0xFFFF)-ID_FILE_MRU_FILE1].GetLength()) { + + if(VBAMovieActive()) + VBAMovieStop(false); // will only get here on user selecting to play a ROM, canceling movie + + theApp.szFile = theApp.recentFiles[(nID&0xFFFF)-ID_FILE_MRU_FILE1]; + if(FileRun()) + emulating = true; + else { + emulating = false; + soundPause(); + } + } + return TRUE; +} + +void MainWnd::OnFileRecentReset() +{ + CString str1 = "Really clear your recent ROMs list?";//winResLoadString(IDS_REALLY_CLEAR); + CString str2 = winResLoadString(IDS_CONFIRM_ACTION); + + if(MessageBox(str1, + str2, + MB_YESNO) == IDNO) + return; + + int i = 0; + for(i = 0; i < 10; i++) + theApp.recentFiles[i] = ""; +} + +void MainWnd::OnFileRecentFreeze() +{ + theApp.recentFreeze = !theApp.recentFreeze; +} + +void MainWnd::OnFileExit() +{ + SendMessage(WM_CLOSE); +} + +void MainWnd::OnFileClose() +{ + // save battery file before we change the filename... + if(rom != NULL || gbRom != NULL) { + if(theApp.autoSaveLoadCheatList) + winSaveCheatListDefault(); + writeBatteryFile(); + soundPause(); + theApp.emulator.emuCleanUp(); + remoteCleanUp(); + if(VBAMovieActive()) + VBAMovieStop(false); // will only get here on user selecting to stop playing the ROM, canceling movie + } + emulating = 0; + RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); + systemSetTitle("VisualBoyAdvance"); +} + +void MainWnd::OnUpdateFileClose(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileLoad() +{ + theApp.winCheckFullscreen(); + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.sgm", saveDir, buffer); + else + filename.Format("%s\\%s.sgm", saveDir, buffer); + + LPCTSTR exts[] = { ".sgm" }; + CString filter = winLoadFilter(IDS_FILTER_SGM); + CString title = winResLoadString(IDS_SELECT_SAVE_GAME_NAME); + + FileDlg dlg(this, filename, filter, 0, "", exts, saveDir, title, false, true); + + if(dlg.DoModal() == IDOK) { + bool res = loadSaveGame(dlg.GetPathName()); + + theApp.rewindCount = 0; + theApp.rewindCounter = 0; + theApp.rewindSaveNeeded = false; + + if(res) + systemScreenMessage(winResLoadString(IDS_LOADED_STATE)); + } +} + +void MainWnd::OnUpdateFileLoad(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +bool8 loadedMovieSnapshot = 0; +BOOL MainWnd::OnFileLoadSlot(UINT nID) +{ + nID = nID + 1 - ID_FILE_LOADGAME_SLOT1; + + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s%d.sgm", saveDir, buffer, nID); + else + filename.Format("%s\\%s%d.sgm", saveDir, buffer, nID); + + bool res = loadSaveGame(filename); + + // deleting rewinds because you loaded a save state is stupid +/// theApp.rewindCount = 0; +/// theApp.rewindCounter = 0; +/// theApp.rewindSaveNeeded = false; + + if(res) + { + CString format; + if(VBAMovieActive()) + if(VBAMovieReadOnly()) + format = winResLoadString(IDS_REPLAYED_STATE_N); + else + format = winResLoadString(IDS_RERECORDED_STATE_N); + else + format = winResLoadString(IDS_LOADED_STATE_N); + buffer.Format(format, nID); + systemScreenMessage(buffer); + + int lastSlot = theApp.currentSlot; + + if(theApp.loadMakesRecent && VBAMovieActive() == loadedMovieSnapshot) + { + OnFileSaveSlot(nID - 1 + ID_FILE_SAVEGAME_SLOT1); // to update the file's modification date + } + + if(theApp.loadMakesCurrent) + theApp.currentSlot = nID - 1; + else + theApp.currentSlot = lastSlot; // restore value in case the call to OnFileSaveSlot changed it + + theApp.frameSearching = false; + theApp.frameSearchSkipping = false; + + } + + return res; +} + +void MainWnd::OnFileSave() +{ + theApp.winCheckFullscreen(); + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s.sgm", saveDir, buffer); + else + filename.Format("%s\\%s.sgm", saveDir, buffer); + + LPCTSTR exts[] = { ".sgm" }; + CString filter = winLoadFilter(IDS_FILTER_SGM); + CString title = winResLoadString(IDS_SELECT_SAVE_GAME_NAME); + + FileDlg dlg(this, filename, filter, 0, "", exts, saveDir, title, true); + + if(dlg.DoModal() == IDOK) { + bool res = writeSaveGame(dlg.GetPathName()); + if(res) + systemScreenMessage(winResLoadString(IDS_WROTE_STATE)); + } +} + +void MainWnd::OnUpdateFileSave(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +BOOL MainWnd::OnFileSaveSlot(UINT nID) +{ + nID = nID + 1 - ID_FILE_SAVEGAME_SLOT1; + + if(theApp.saveMakesCurrent) + theApp.currentSlot = nID - 1; + + CString buffer; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + buffer = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(isDriveRoot(saveDir)) + filename.Format("%s%s%d.sgm", saveDir, buffer, nID); + else + filename.Format("%s\\%s%d.sgm", saveDir, buffer, nID); + + bool res = writeSaveGame(filename); + + CString format = winResLoadString(IDS_WROTE_STATE_N); + buffer.Format(format, nID); + + systemScreenMessage(buffer); + + return res; +} + +BOOL MainWnd::OnSelectSlot(UINT nID) +{ + nID = nID + 1 - ID_SELECT_SLOT1; + theApp.currentSlot = nID - 1; + + CString buffer; + buffer.Format("Slot %d selected", nID); + systemScreenMessage(buffer, 0, 600); + + return true; +} + +void MainWnd::OnFileImportBatteryfile() +{ + theApp.winCheckFullscreen(); + LPCTSTR exts[] = { ".sav" }; + CString filter = winLoadFilter(IDS_FILTER_SAV); + CString title = winResLoadString(IDS_SELECT_BATTERY_FILE); + + CString saveDir = regQueryStringValue("batteryDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + FileDlg dlg(this, "", filter, 0, "", exts, saveDir, title, false, true); + + if(dlg.DoModal() == IDCANCEL) + return; + + CString str1 = winResLoadString(IDS_SAVE_WILL_BE_LOST); + CString str2 = winResLoadString(IDS_CONFIRM_ACTION); + + if(MessageBox(str1, + str2, + MB_OKCANCEL) == IDCANCEL) + return; + + bool res = false; + + res = theApp.emulator.emuReadBattery(dlg.GetPathName()); + + if(!res) + systemMessage(MSG_CANNOT_OPEN_FILE, "Cannot open file %s", dlg.GetPathName()); + else { + theApp.emulator.emuReset(); + } +} + +void MainWnd::OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileImportGamesharkcodefile() +{ + theApp.winCheckFullscreen(); + LPCTSTR exts[] = { "" }; + CString filter = theApp.cartridgeType == 0 ? winLoadFilter(IDS_FILTER_SPC) : winLoadFilter(IDS_FILTER_GCF); + CString title = winResLoadString(IDS_SELECT_CODE_FILE); + + FileDlg dlg(this, "", filter, 0, "", exts, "", title, false, true); + + if(dlg.DoModal() == IDCANCEL) + return; + + CString str1 = winResLoadString(IDS_CODES_WILL_BE_LOST); + CString str2 = winResLoadString(IDS_CONFIRM_ACTION); + + if(MessageBox(str1, + str2, + MB_OKCANCEL) == IDCANCEL) + return; + + bool res = false; + CString file = dlg.GetPathName(); + if(theApp.cartridgeType == 1) + res = gbCheatReadGSCodeFile(file); + else { + res = fileImportGSACodeFile(file); + } +} + +void MainWnd::OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileImportGamesharksnapshot() +{ + theApp.winCheckFullscreen(); + LPCTSTR exts[] = { "" }; + CString filter = theApp.cartridgeType == 1 ? winLoadFilter(IDS_FILTER_GBS) : winLoadFilter(IDS_FILTER_SPS); + CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE); + + FileDlg dlg(this, "", filter, 0, "", exts, "", title, false, true); + + if(dlg.DoModal() == IDCANCEL) + return; + + CString str1 = winResLoadString(IDS_SAVE_WILL_BE_LOST); + CString str2 = winResLoadString(IDS_CONFIRM_ACTION); + + if(MessageBox(str1, + str2, + MB_OKCANCEL) == IDCANCEL) + return; + + if(theApp.cartridgeType == 1) + gbReadGSASnapshot(dlg.GetPathName()); + else + CPUReadGSASnapshot(dlg.GetPathName()); +} + +void MainWnd::OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileExportBatteryfile() +{ + theApp.winCheckFullscreen(); + CString name; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + + LPCTSTR exts[] = {".sav", ".dat" }; + + CString filter = winLoadFilter(IDS_FILTER_SAV); + CString title = winResLoadString(IDS_SELECT_BATTERY_FILE); + + CString saveDir = regQueryStringValue("batteryDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + FileDlg dlg(this, + name, + filter, + 1, + "SAV", + exts, + saveDir, + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + bool result = false; + + if(theApp.cartridgeType == 1) { + result = gbWriteBatteryFile(dlg.GetPathName(), false); + } else + result = theApp.emulator.emuWriteBattery(dlg.GetPathName()); + + if(!result) + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", + dlg.GetPathName()); +} + +void MainWnd::OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileExportGamesharksnapshot() +{ + theApp.winCheckFullscreen(); + if(eepromInUse) { + systemMessage(IDS_EEPROM_NOT_SUPPORTED, "EEPROM saves cannot be exported"); + return; + } + + CString name; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + + LPCTSTR exts[] = {".sps" }; + + CString filter = winLoadFilter(IDS_FILTER_SPS); + CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE); + + FileDlg dlg(this, + name, + filter, + 1, + "SPS", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) + return; + + char buffer[16]; + strncpy(buffer, (const char *)&rom[0xa0], 12); + buffer[12] = 0; + + ExportGSASnapshot dlg2(dlg.GetPathName(), buffer, this); + dlg2.DoModal(); +} + +void MainWnd::OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && theApp.cartridgeType == 0); +} + +void MainWnd::OnFileScreencapture() +{ + theApp.winCheckFullscreen(); + CString name; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + name = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + name = theApp.filename; + + CString capdir = regQueryStringValue("captureDir", ""); + if(capdir.IsEmpty()) + capdir = getDirFromFile(name); + + CString ext = "png"; + + if(theApp.captureFormat != 0) + ext = "bmp"; + + if(isDriveRoot(capdir)) + filename.Format("%s%s.%s", capdir, name, ext); + else + filename.Format("%s\\%s.%s", capdir, name, ext); + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + filename, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + capdir, + title, + true); + + if(dlg.DoModal() == IDCANCEL) + return; + + if(dlg.getFilterIndex() == 2) + theApp.emulator.emuWriteBMP(dlg.GetPathName()); + else + theApp.emulator.emuWritePNG(dlg.GetPathName()); + + systemScreenMessage(winResLoadString(IDS_SCREEN_CAPTURE)); +} + +void MainWnd::OnUpdateFileScreencapture(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileRominformation() +{ + theApp.winCheckFullscreen(); + if(theApp.cartridgeType == 0) { + RomInfoGBA dlg(rom); + dlg.DoModal(); + } else { + RomInfoGB dlg(gbRom); + dlg.DoModal(); + } +} + +void MainWnd::OnUpdateFileRominformation(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnFileTogglemenu() +{ +/// if(theApp.videoOption <= VIDEO_4X) +/// return; + + theApp.menuToggle = !theApp.menuToggle; + + if(theApp.menuToggle) { + theApp.updateMenuBar(); + if(theApp.tripleBuffering) { + if(theApp.display) + theApp.display->checkFullScreen(); + DrawMenuBar(); + } + } else { + SetMenu(NULL); + DestroyMenu(theApp.menu); + } + + theApp.adjustDestRect(); +} + +void MainWnd::OnUpdateFileTogglemenu(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption > VIDEO_4X); +} + +bool MainWnd::fileImportGSACodeFile(CString& fileName) +{ + FILE *f = fopen(fileName, "rb"); + + if(f == NULL) { + systemMessage(MSG_CANNOT_OPEN_FILE, "Cannot open file %s", fileName); + return false; + } + + u32 len; + fread(&len, 1, 4, f); + if(len != 14) { + fclose(f); + systemMessage(MSG_UNSUPPORTED_CODE_FILE, "Unsupported code file %s", + fileName); + return false; + } + char buffer[16]; + fread(buffer, 1, 14, f); + buffer[14] = 0; + if(memcmp(buffer, "SharkPortCODES", 14)) { + fclose(f); + systemMessage(MSG_UNSUPPORTED_CODE_FILE, "Unsupported code file %s", + fileName); + return false; + } + fseek(f, 0x1e, SEEK_SET); + fread(&len, 1, 4, f); + int game = 0; + if(len > 1) { + GSACodeSelect dlg(f); + game = dlg.DoModal(); + } + fclose(f); + + bool v3 = false; + + int index = fileName.ReverseFind('.'); + + if(index != -1) { + if(fileName.Right(3).CompareNoCase("XPC") == 0) + v3 = true; + } + + if(game != -1) { + return cheatsImportGSACodeFile(fileName, game, v3); + } + + return true; +} + +void MainWnd::OnFileSavegameOldestslot() +{ + if(!emulating) + return; + + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + filename = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + filename = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(!isDriveRoot(saveDir)) + saveDir += "\\"; + + CString name; + CFileStatus status; + CString str; + time_t time = -1; + int found = 0; + + for(int i = 0; i < 10; i++) { + name.Format("%s%s%d.sgm", saveDir, filename, i+1); + + if(emulating && CFile::GetStatus(name, status)) { + if(time - status.m_mtime.GetTime() > 0 || time == -1) { + time = status.m_mtime.GetTime(); + found = i; + } + } else { + found = i; + break; + } + } + OnFileSaveSlot(ID_FILE_SAVEGAME_SLOT1+found); +} + +void MainWnd::OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); + if(pCmdUI->m_pSubMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pSubMenu; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + filename = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + filename = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(!isDriveRoot(saveDir)) + saveDir += "\\"; + + CString name; + CFileStatus status; + CString str; + time_t time = -1; + int found = 0; + bool foundEmpty = false; + + for(int i = 0; i < 10; i++) { + name.Format("%s%s%d.sgm", saveDir, filename, i+1); + + if(emulating && CFile::GetStatus(name, status)) { + CString timestamp = status.m_mtime.Format("%Y/%m/%d %H:%M:%S"); + str.Format("%d %s", i+1, timestamp); + if(!foundEmpty && (time - status.m_mtime.GetTime() > 0 || time == -1)) { + time = status.m_mtime.GetTime(); + found = i; + } + } else { + if(!foundEmpty) + { + found = i; + foundEmpty = true; + } + str.Format("%d ----/--/-- --:--:--", i+1); + } + pMenu->ModifyMenu(ID_FILE_SAVEGAME_SLOT1+i, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_SLOT1+i, str); + } + + if(found != -1 && emulating) + str.Format("Oldest slot (#%d)", found+1); + else + str.Format("Oldest slot", found+1); + pMenu->ModifyMenu(ID_FILE_SAVEGAME_OLDESTSLOT, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_OLDESTSLOT, str); + + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } +} + +void MainWnd::OnFileLoadgameMostrecent() +{ + if(!emulating) + return; + + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + filename = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + filename = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(!isDriveRoot(saveDir)) + saveDir += "\\"; + + CString name; + CFileStatus status; + CString str; + time_t time = 0; + int found = -1; + + for(int i = 0; i < 10; i++) { + name.Format("%s%s%d.sgm", saveDir, filename, i+1); + + if(emulating && CFile::GetStatus(name, status)) { + if(status.m_mtime.GetTime() > time) { + time = status.m_mtime.GetTime(); + found = i; + } + } + } + if(found != -1) { + OnFileLoadSlot(ID_FILE_LOADGAME_SLOT1+found); + } +} + +void MainWnd::OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); + + if(pCmdUI->m_pSubMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pSubMenu; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + filename = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + filename = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(!isDriveRoot(saveDir)) + saveDir += "\\"; + + CString name; + CFileStatus status; + CString str; + + time_t time = 0; + int found = -1; + for(int i = 0; i < 10; i++) { + name.Format("%s%s%d.sgm", saveDir, filename, i+1); + + if(emulating && CFile::GetStatus(name, status)) { + CString timestamp = status.m_mtime.Format("%Y/%m/%d %H:%M:%S"); + str.Format("%d %s", i+1, timestamp); + + if(status.m_mtime.GetTime() > time) { + time = status.m_mtime.GetTime(); + found = i; + } + } else { + str.Format("%d ----/--/-- --:--:--", i+1); + } + pMenu->ModifyMenu(ID_FILE_LOADGAME_SLOT1+i, MF_STRING|MF_BYCOMMAND, ID_FILE_LOADGAME_SLOT1+i, str); + } + + if(found != -1 && emulating) + str.Format("Most recent slot (#%d)", found+1); + else + str.Format("Most recent slot", found+1); + pMenu->ModifyMenu(ID_FILE_LOADGAME_MOSTRECENT, MF_STRING|MF_BYCOMMAND, ID_FILE_LOADGAME_MOSTRECENT, str); + + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } +} + +void MainWnd::OnUpdateFileLoadGameSlot(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnUpdateSelectSlot(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(true); +} + +void MainWnd::OnFileLoadgameAutoloadmostrecent() +{ + theApp.autoLoadMostRecent = !theApp.autoLoadMostRecent; +} +void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoLoadMostRecent); +} + +void MainWnd::OnFileLoadgameMakeRecent() +{ + theApp.loadMakesRecent = !theApp.loadMakesRecent; +} +void MainWnd::OnUpdateFileLoadgameMakeRecent(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.loadMakesRecent); +} + + +void MainWnd::OnFileSavegameCurrent() +{ + OnFileSaveSlot(ID_FILE_SAVEGAME_SLOT1 + theApp.currentSlot); +} +void MainWnd::OnUpdateFileSavegameCurrent(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); + + if(pCmdUI->m_pMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pMenu; + CString str; + + str.Format("Current slot (#%d)", theApp.currentSlot+1); + pMenu->ModifyMenu(ID_FILE_SAVEGAME_CURRENT, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_CURRENT, str); + + pCmdUI->Enable(emulating); + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } +} + +void MainWnd::OnFileLoadgameCurrent() +{ + OnFileLoadSlot(ID_FILE_LOADGAME_SLOT1 + theApp.currentSlot); +} +void MainWnd::OnUpdateFileLoadgameCurrent(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); + + if(pCmdUI->m_pMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pMenu; + CString filename; + + int index = theApp.filename.ReverseFind('\\'); + + if(index != -1) + filename = theApp.filename.Right(theApp.filename.GetLength()-index-1); + else + filename = theApp.filename; + + CString saveDir = regQueryStringValue("saveDir", NULL); + + if(saveDir.IsEmpty()) + saveDir = getDirFromFile(theApp.filename); + + if(!isDriveRoot(saveDir)) + saveDir += "\\"; + + CString name; + CFileStatus status; + CString str; + + bool found = false; + int i = theApp.currentSlot; + { + name.Format("%s%s%d.sgm", saveDir, filename, i+1); + + if(emulating && CFile::GetStatus(name, status)) { + found = true; + } + } + + str.Format("Current slot (#%d)", theApp.currentSlot+1); + pMenu->ModifyMenu(ID_FILE_LOADGAME_CURRENT, MF_STRING|MF_BYCOMMAND, ID_FILE_LOADGAME_CURRENT, str); + + pCmdUI->Enable(found && emulating); + + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } + +} + +void MainWnd::OnFileLoadgameMakeCurrent() +{ + theApp.loadMakesCurrent = !theApp.loadMakesCurrent; +} +void MainWnd::OnUpdateFileLoadgameMakeCurrent(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.loadMakesCurrent); +} + +void MainWnd::OnFileSavegameMakeCurrent() +{ + theApp.saveMakesCurrent = !theApp.saveMakesCurrent; +} +void MainWnd::OnUpdateFileSavegameMakeCurrent(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.saveMakesCurrent); +} + +void MainWnd::OnFileSavegameIncrementSlot() +{ + theApp.currentSlot = (theApp.currentSlot + 1) % 10; + + char str [32]; + sprintf(str, "Current Slot: %d", theApp.currentSlot+1); + systemScreenMessage(str, 0, 600); +} +void MainWnd::OnUpdateFileSavegameIncrementSlot(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(true); + + if(pCmdUI->m_pMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pMenu; + CString str; + + str.Format("Increase current slot (#%d -> #%d)", 1+(theApp.currentSlot), 1+((theApp.currentSlot + 1) % 10)); + pMenu->ModifyMenu(ID_FILE_SAVEGAME_INCREMENTSLOT, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_INCREMENTSLOT, str); + + pCmdUI->Enable(true); + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } +} + +void MainWnd::OnFileSavegameDecrementSlot() +{ + theApp.currentSlot = (10 + theApp.currentSlot - 1) % 10; + + char str [32]; + sprintf(str, "Current Slot: %d", theApp.currentSlot+1); + systemScreenMessage(str, 0, 600); +} +void MainWnd::OnUpdateFileSavegameDecrementSlot(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(true); + + if(pCmdUI->m_pMenu != NULL) { + CMenu *pMenu = pCmdUI->m_pMenu; + CString str; + + str.Format("Decrease current slot (#%d -> #%d)", 1+(theApp.currentSlot), 1+((10 + theApp.currentSlot - 1) % 10)); + pMenu->ModifyMenu(ID_FILE_SAVEGAME_DECREMENTSLOT, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_DECREMENTSLOT, str); + + pCmdUI->Enable(true); + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); + } +} diff --git a/src/win32/MainWndHelp.cpp b/src/win32/MainWndHelp.cpp new file mode 100644 index 0000000..bbecc0b --- /dev/null +++ b/src/win32/MainWndHelp.cpp @@ -0,0 +1,46 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" + +#include "AboutDialog.h" +#include "BugReport.h" + +extern int emulating; + +void MainWnd::OnHelpAbout() +{ + theApp.winCheckFullscreen(); + AboutDialog dlg; + + dlg.DoModal(); +} + +void MainWnd::OnHelpFaq() +{ + ::ShellExecute(0, _T("open"), "http://vba.ngemu.com/faq.shtml", + 0, 0, SW_SHOWNORMAL); +} + +void MainWnd::OnHelpBugreport() +{ + BugReport dlg(theApp.m_pMainWnd); + + dlg.DoModal(); +} diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp new file mode 100644 index 0000000..f1efd9c --- /dev/null +++ b/src/win32/MainWndOptions.cpp @@ -0,0 +1,2219 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" + +#include "Associate.h" +#include "Directories.h" +#include "FileDlg.h" +#include "GBColorDlg.h" +#include "Joypad.h" +#include "MaxScale.h" +#include "ModeConfirm.h" +#include "Reg.h" +#include "RewindInterval.h" +#include "skin.h" +#include "Throttle.h" +#include "TextOptions.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../agbprint.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Sound.h" +#include "../gb/GB.h" +#include "../gb/gbGlobals.h" +#include "../gb/gbPrinter.h" +#include "../movie.h" + +extern int emulating; + +#define VBA_CONFIRM_MODE WM_APP + 100 + +extern void CPUUpdateRenderBuffers(bool force); + +void MainWnd::OnOptionsFrameskipThrottleNothrottle() +{ + theApp.throttle = 0; +} + +void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 0); +} + +void MainWnd::OnOptionsFrameskipThrottle6() +{ + theApp.throttle = 6; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle6(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 6); +} + +void MainWnd::OnOptionsFrameskipThrottle15() +{ + theApp.throttle = 15; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle15(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 15); +} + +void MainWnd::OnOptionsFrameskipThrottle25() +{ + theApp.throttle = 25; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 25); +} + +void MainWnd::OnOptionsFrameskipThrottle37() +{ + theApp.throttle = 37; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle37(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 37); +} + +void MainWnd::OnOptionsFrameskipThrottle50() +{ + theApp.throttle = 50; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 50); +} + +void MainWnd::OnOptionsFrameskipThrottle75() +{ + theApp.throttle = 75; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle75(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 75); +} + +void MainWnd::OnOptionsFrameskipThrottle87() +{ + theApp.throttle = 87; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle87(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 87); +} + +void MainWnd::OnOptionsFrameskipThrottle100() +{ + theApp.throttle = 100; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 100); +} + +void MainWnd::OnOptionsFrameskipThrottle112() +{ + theApp.throttle = 112; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle112(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 112); +} + +void MainWnd::OnOptionsFrameskipThrottle125() +{ + theApp.throttle = 125; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle125(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 125); +} + +void MainWnd::OnOptionsFrameskipThrottle150() +{ + theApp.throttle = 150; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 150); +} + +void MainWnd::OnOptionsFrameskipThrottle200() +{ + theApp.throttle = 200; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 200); +} + +void MainWnd::OnOptionsFrameskipThrottle300() +{ + theApp.throttle = 300; +} +void MainWnd::OnUpdateOptionsFrameskipThrottle300(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.throttle == 300); +} + +static bool isMenuItemThrottleValue(int throttle) +{ + return throttle == 6 || throttle == 15 || throttle == 25 || throttle == 37 || + throttle == 50 || throttle == 75 || throttle == 87 || throttle == 100 || throttle == 112 || + throttle == 125 || throttle == 150 || throttle == 200 || throttle == 300; +} + +void MainWnd::OnOptionsFrameskipThrottleOther() +{ + Throttle dlg; + int v = dlg.DoModal(); + if(v) + theApp.throttle = v; +} +void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(!isMenuItemThrottleValue(theApp.throttle)); +} + +void MainWnd::OnOptionsFrameskipThrottleIncrease() +{ + if(theApp.throttle < 6) + theApp.throttle++; + else if(theApp.throttle < 300) + { + do { + theApp.throttle++; + } while (!isMenuItemThrottleValue(theApp.throttle)); + } + char str [256]; + sprintf(str, "%d%% throttle speed", theApp.throttle); + systemScreenMessage(str); +} +void MainWnd::OnUpdateOptionsFrameskipThrottleIncrease(CCmdUI* pCmdUI) +{ +} + +void MainWnd::OnOptionsFrameskipThrottleDecrease() +{ + if(theApp.throttle > 6) + { + do { + theApp.throttle--; + } while (!isMenuItemThrottleValue(theApp.throttle)); + } + else if(theApp.throttle > 1) + theApp.throttle--; + char str [256]; + sprintf(str, "%d%% throttle speed", theApp.throttle); + systemScreenMessage(str); +} +void MainWnd::OnUpdateOptionsFrameskipThrottleDecrease(CCmdUI* pCmdUI) +{ +} + + +/* +void MainWnd::OnOptionsFrameskipAutomatic() +{ + theApp.autoFrameSkip = !theApp.autoFrameSkip; + if(!theApp.autoFrameSkip && emulating) + theApp.updateFrameSkip(); +} + +void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoFrameSkip); +} +*/ + +void MainWnd::OnOptionsFrameskipAccuratePitch() +{ + theApp.accuratePitchThrottle = true; +} +void MainWnd::OnUpdateOptionsFrameskipAccuratePitch(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.accuratePitchThrottle || soundOffFlag || !synchronize); + pCmdUI->Enable(!soundOffFlag && synchronize); +} + +void MainWnd::OnOptionsFrameskipAccurateSpeed() +{ + theApp.accuratePitchThrottle = false; +} +void MainWnd::OnUpdateOptionsFrameskipAccurateSpeed(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(!theApp.accuratePitchThrottle && !soundOffFlag && synchronize); + pCmdUI->Enable(!soundOffFlag && synchronize); +} + +BOOL MainWnd::OnOptionsFrameskip(UINT nID) +{ + switch(nID) { + case ID_OPTIONS_VIDEO_FRAMESKIP_0: + case ID_OPTIONS_VIDEO_FRAMESKIP_1: + case ID_OPTIONS_VIDEO_FRAMESKIP_2: + case ID_OPTIONS_VIDEO_FRAMESKIP_3: + case ID_OPTIONS_VIDEO_FRAMESKIP_4: + case ID_OPTIONS_VIDEO_FRAMESKIP_5: + if(theApp.cartridgeType == 0) { + frameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0; + } else { + gbFrameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0; + } + if(emulating) + theApp.updateFrameSkip(); + return TRUE; + break; + case ID_OPTIONS_VIDEO_FRAMESKIP_6: + case ID_OPTIONS_VIDEO_FRAMESKIP_7: + case ID_OPTIONS_VIDEO_FRAMESKIP_8: + case ID_OPTIONS_VIDEO_FRAMESKIP_9: + if(theApp.cartridgeType == 0) { + frameSkip = 6 + nID - ID_OPTIONS_VIDEO_FRAMESKIP_6; + } else { + gbFrameSkip = 6 + nID - ID_OPTIONS_VIDEO_FRAMESKIP_6; + } + if(emulating) + theApp.updateFrameSkip(); + return TRUE; + break; + } + return FALSE; +} + +void MainWnd::OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 0 : gbFrameSkip == 0); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 1 : gbFrameSkip == 1); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 2 : gbFrameSkip == 2); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 3 : gbFrameSkip == 3); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 4 : gbFrameSkip == 4); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 5 : gbFrameSkip == 5); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 6 : gbFrameSkip == 6); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 7 : gbFrameSkip == 7); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 8 : gbFrameSkip == 8); +} + +void MainWnd::OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.cartridgeType == 0 ? frameSkip == 9 : gbFrameSkip == 9); +} + +void MainWnd::OnOptionsVideoVsync() +{ + theApp.vsync = !theApp.vsync; +} + +void MainWnd::OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.vsync); +} + +void MainWnd::OnUpdateOptionsVideoX1(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.videoOption == VIDEO_1X); +} + +void MainWnd::OnUpdateOptionsVideoX2(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.videoOption == VIDEO_2X); +} + +void MainWnd::OnUpdateOptionsVideoX3(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.videoOption == VIDEO_3X); +} + +void MainWnd::OnUpdateOptionsVideoX4(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.videoOption == VIDEO_4X); +} + +void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.mode320Available); + pCmdUI->SetCheck(theApp.videoOption == VIDEO_320x240); +} + +void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.mode640Available); + pCmdUI->SetCheck(theApp.videoOption == VIDEO_640x480); +} + +void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.mode800Available); + pCmdUI->SetCheck(theApp.videoOption == VIDEO_800x600); +} + +BOOL MainWnd::OnOptionVideoSize(UINT nID) +{ + theApp.updateVideoSize(nID); + theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE); + return TRUE; +} + +void MainWnd::OnOptionsVideoFullscreen320x240() +{ + OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN320X240); +} + +void MainWnd::OnOptionsVideoFullscreen640x480() +{ + OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN640X480); +} + +void MainWnd::OnOptionsVideoFullscreen800x600() +{ + OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN800X600); +} + +void MainWnd::OnOptionsVideoFullscreen() +{ + theApp.winCheckFullscreen(); + GUID *pGUID = NULL; + int size = theApp.display->selectFullScreenMode(&pGUID); + if(size != -1) { + int width = (size >> 12) & 4095; + int height = (size & 4095); + int colorDepth = (size >> 24); + if(width != theApp.fsWidth || + height != theApp.fsHeight || + colorDepth != theApp.fsColorDepth || + pGUID != theApp.pVideoDriverGUID || + theApp.videoOption != VIDEO_OTHER) { + theApp.fsForceChange = true; + theApp.fsWidth = width; + theApp.fsHeight = height; + theApp.fsColorDepth = colorDepth; + theApp.pVideoDriverGUID = pGUID; + if(pGUID) { + theApp.videoDriverGUID = *pGUID; + regSetDwordValue("defaultVideoDriver", FALSE); + regSetBinaryValue("videoDriverGUID", + (char *)pGUID, sizeof(GUID)); + } else { + regSetDwordValue("defaultVideoDriver", TRUE); + } + theApp.updateVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN); + theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE); + } + } + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.videoOption == VIDEO_OTHER); +} + +void MainWnd::OnOptionsVideoDisablesfx() +{ + cpuDisableSfx = !cpuDisableSfx; + if(emulating && theApp.cartridgeType == 0) + CPUUpdateRender(); +} + +void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(cpuDisableSfx); +} + +void MainWnd::OnOptionsVideoFullscreenstretchtofit() +{ + theApp.fullScreenStretch = !theApp.fullScreenStretch; + theApp.updateWindowSize(theApp.videoOption); + if(theApp.display) + theApp.display->clear(); +} + +void MainWnd::OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.fullScreenStretch); +} + +BOOL MainWnd::OnVideoLayer(UINT nID) +{ + layerSettings ^= 0x0100 << + ((nID & 0xFFFF) - ID_OPTIONS_VIDEO_LAYERS_BG0); + layerEnable = DISPCNT & layerSettings; + CPUUpdateRenderBuffers(false); + return TRUE; +} + +void MainWnd::OnUpdateVideoLayer(CCmdUI *pCmdUI) +{ + pCmdUI->SetCheck((layerSettings >> (8 + pCmdUI->m_nID - ID_OPTIONS_VIDEO_LAYERS_BG0)) & 1); + switch(pCmdUI->m_nID) { + case ID_OPTIONS_VIDEO_LAYERS_BG1: + case ID_OPTIONS_VIDEO_LAYERS_BG2: + case ID_OPTIONS_VIDEO_LAYERS_BG3: + case ID_OPTIONS_VIDEO_LAYERS_WIN1: + case ID_OPTIONS_VIDEO_LAYERS_OBJWIN: + pCmdUI->Enable(theApp.cartridgeType == 0); + break; + } +} + +void MainWnd::OnOptionsVideoRendermethodGdi() +{ + theApp.renderMethod = GDI; + theApp.updateRenderMethod(false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.renderMethod == GDI); +} + +void MainWnd::OnOptionsVideoRendermethodDirectdraw() +{ + theApp.renderMethod = DIRECT_DRAW; + theApp.updateRenderMethod(false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.renderMethod == DIRECT_DRAW); +} + +void MainWnd::OnOptionsVideoRendermethodDirect3d() +{ + theApp.renderMethod = DIRECT_3D; + theApp.updateRenderMethod(false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D); +} + +void MainWnd::OnOptionsVideoRendermethodOpengl() +{ + theApp.renderMethod = OPENGL; + theApp.updateRenderMethod(false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.renderMethod == OPENGL); +} + +void MainWnd::OnOptionsVideoTriplebuffering() +{ + theApp.tripleBuffering = !theApp.tripleBuffering; +} + +void MainWnd::OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.tripleBuffering); +} + +void MainWnd::OnOptionsVideoDdrawemulationonly() +{ + theApp.ddrawEmulationOnly = !theApp.ddrawEmulationOnly; +} + +void MainWnd::OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.ddrawEmulationOnly); +} + +void MainWnd::OnOptionsVideoDdrawusevideomemory() +{ + theApp.ddrawUseVideoMemory = !theApp.ddrawUseVideoMemory; +} + +void MainWnd::OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.ddrawUseVideoMemory); +} + +void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter() +{ + theApp.d3dFilter = 0; + if(theApp.display) + theApp.display->setOption("d3dFilter", 0); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.d3dFilter == 0); +} + +void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear() +{ + theApp.d3dFilter = 1; + if(theApp.display) + theApp.display->setOption("d3dFilter", 1); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.d3dFilter == 1); +} + +void MainWnd::OnOptionsVideoRenderoptionsGlnearest() +{ + theApp.glFilter = 0; + if(theApp.display) + theApp.display->setOption("glFilter", 0); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.glFilter == 0); +} + +void MainWnd::OnOptionsVideoRenderoptionsGlbilinear() +{ + theApp.glFilter = 1; + if(theApp.display) + theApp.display->setOption("glFilter", 1); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.glFilter == 1); +} + +void MainWnd::OnOptionsVideoRenderoptionsGltriangle() +{ + theApp.glType = 0; + if(theApp.display) + theApp.display->setOption("glType", 0); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.glType == 0); +} + +void MainWnd::OnOptionsVideoRenderoptionsGlquads() +{ + theApp.glType = 1; + if(theApp.display) + theApp.display->setOption("glType", 1); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.glType == 1); +} + +void MainWnd::OnOptionsVideoRenderoptionsSelectskin() +{ + LPCTSTR exts[] = {".ini" }; + CString filter = winLoadFilter(IDS_FILTER_INI); + CString title = winResLoadString(IDS_SELECT_SKIN_FILE); + + FileDlg dlg(this, + theApp.skinName, + filter, + 0, + "INI", + exts, + "", + title, + false); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + bool result = false; + if(!theApp.skinEnabled) { + theApp.skinEnabled = !theApp.skinEnabled; + regSetDwordValue("skinEnabled", theApp.skinEnabled); + } + + if(theApp.skin && theApp.skinEnabled) { + delete theApp.skin; + theApp.skin = NULL; + } + + theApp.skinName = dlg.GetPathName(); + + theApp.winUpdateSkin(); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.display && theApp.display->isSkinSupported() && + theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnOptionsVideoRenderoptionsSkin() +{ + theApp.skinEnabled = !theApp.skinEnabled; + theApp.updateRenderMethod(true); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.skinEnabled); + pCmdUI->Enable(theApp.display && theApp.display->isSkinSupported() && theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnOptionsEmulatorAssociate() +{ + theApp.winCheckFullscreen(); + Associate dlg; + dlg.DoModal(); +} + +void MainWnd::OnOptionsEmulatorDirectories() +{ + theApp.winCheckFullscreen(); + Directories dlg; + dlg.DoModal(); +} + +void MainWnd::OnOptionsVideoDisablestatusmessages() +{ + theApp.disableStatusMessage = !theApp.disableStatusMessage; +} + +void MainWnd::OnUpdateOptionsVideoDisablestatusmessages(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.disableStatusMessage); +} + +void MainWnd::OnOptionsEmulatorSynchronize() +{ + synchronize = !synchronize; +} + +void MainWnd::OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(synchronize); +} + +void MainWnd::OnOptionsEmulatorPausewheninactive() +{ + theApp.pauseWhenInactive = !theApp.pauseWhenInactive; +} + +void MainWnd::OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.pauseWhenInactive); +} + +void MainWnd::OnOptionsEmulatorSpeeduptoggle() +{ + theApp.speedupToggle = !theApp.speedupToggle; +} + +void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.speedupToggle); +} + +void MainWnd::OnOptionsEmulatorRemoveintrosgba() +{ + // theApp.removeIntros = !theApp.removeIntros; +} + +void MainWnd::OnUpdateOptionsEmulatorRemoveintrosgba(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(false); + // pCmdUI->SetCheck(theApp.removeIntros); +} + +void MainWnd::OnOptionsEmulatorAutomaticallyipspatch() +{ + theApp.autoIPS = !theApp.autoIPS; +} + +void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoIPS); +} + +void MainWnd::OnOptionsEmulatorAgbprint() +{ + agbPrintEnable(!agbPrintIsEnabled()); +} + +void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(agbPrintIsEnabled()); +} + +void MainWnd::OnOptionsEmulatorRealtimeclock() +{ + theApp.winRtcEnable = !theApp.winRtcEnable; +} + +void MainWnd::OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winRtcEnable); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorAutohidemenu() +{ + theApp.autoHideMenu = !theApp.autoHideMenu; +} + +void MainWnd::OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.autoHideMenu); +} + +void MainWnd::OnOptionsEmulatorRewindinterval() +{ + RewindInterval dlg((float)theApp.rewindTimer/6.0f, theApp.rewindSlots); + int v = dlg.DoModal(); + + if(v >= 0) { + + int interval = v & 0x0000ffff; + int slots = (v & 0xffff0000) >> 16; + + int prevSlots = theApp.rewindSlots; + + theApp.rewindTimer = interval; // already converted to a multiple of 10 frames + theApp.rewindSlots = slots; + if(interval == 0 || slots == 0) { + theApp.rewindTimer = theApp.rewindSlots = 0; + regSetDwordValue("rewindTimer", interval); + regSetDwordValue("rewindSlots", slots); + if(theApp.rewindMemory) + free(theApp.rewindMemory); + theApp.rewindMemory = NULL; + theApp.rewindCount = 0; + theApp.rewindCounter = 0; + theApp.rewindSaveNeeded = false; + } else { + regSetDwordValue("rewindTimer", interval); + regSetDwordValue("rewindSlots", slots); + if(slots != prevSlots) { + if(theApp.rewindMemory) + free(theApp.rewindMemory); + theApp.rewindMemory = NULL; + theApp.rewindPos = 0; + } + if(theApp.rewindMemory == NULL) + theApp.rewindMemory = (char *)malloc(theApp.rewindSlots*REWIND_SIZE); + theApp.rewindCount = 0; + theApp.rewindSaveNeeded = true; + } + } +} + +BOOL MainWnd::OnOptionsEmulatorShowSpeed(UINT nID) +{ + switch(nID) { + case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE: + theApp.showSpeed = 0; + systemSetTitle("VisualBoyAdvance"); + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE: + theApp.showSpeed = 1; + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED: + theApp.showSpeed = 2; + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT: + theApp.showSpeedTransparent = !theApp.showSpeedTransparent; + break; + default: + return FALSE; + } + return TRUE; +} + +void MainWnd::OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI) +{ + switch(pCmdUI->m_nID) { + case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE: + pCmdUI->SetCheck(theApp.showSpeed == 0); + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE: + pCmdUI->SetCheck(theApp.showSpeed == 1); + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED: + pCmdUI->SetCheck(theApp.showSpeed == 2); + break; + case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT: + pCmdUI->SetCheck(theApp.showSpeedTransparent); + break; + } +} + +void MainWnd::OnOptionsEmulatorSavetypeAutomatic() +{ + theApp.winSaveType = 0; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 0); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeEeprom() +{ + theApp.winSaveType = 1; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 1); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeSram() +{ + theApp.winSaveType = 2; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 2); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeFlash() +{ + theApp.winSaveType = 3; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 3); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeEepromsensor() +{ + theApp.winSaveType = 4; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 4); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeNone() +{ + theApp.winSaveType = 5; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winSaveType == 5); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeFlash512k() +{ + flashSetSize(0x10000); + theApp.winFlashSize = 0x10000; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winFlashSize == 0x10000); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSavetypeFlash1m() +{ + flashSetSize(0x20000); + theApp.winFlashSize = 0x20000; +} +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winFlashSize == 0x20000); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorUsebiosfile() +{ + if(!theApp.biosFileName.IsEmpty()) + theApp.useBiosFile = !theApp.useBiosFile; +} +void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.useBiosFile); + pCmdUI->Enable(!theApp.biosFileName.IsEmpty() && (!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL))); +} + +void MainWnd::OnOptionsEmulatorSkipbios() +{ + theApp.skipBiosFile = !theApp.skipBiosFile; +} +void MainWnd::OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.skipBiosFile); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorUseOldGBTiming() +{ + theApp.useOldGBTiming = !theApp.useOldGBTiming; +} +void MainWnd::OnUpdateOptionsEmulatorUseOldGBTiming(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.useOldGBTiming); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + + + +void MainWnd::OnOptionsEmulatorGBALag() +{ + extern void TogglePrefetchHack(); + TogglePrefetchHack(); + memLagEnabled = memLagTempEnabled; // memLagEnabled is only to hold the last value that the user chose, so temporary changes don't get into the registry +} +void MainWnd::OnUpdateOptionsEmulatorGBALag(CCmdUI* pCmdUI) +{ +/// extern bool prefetchActive, prefetchPrevActive, prefetchApplies; +/// pCmdUI->SetCheck((prefetchApplies||(VBAMovieGetState()==MOVIE_STATE_PLAY)) ? prefetchActive : !memLagTempEnabled); + pCmdUI->SetCheck(!memLagTempEnabled); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsEmulatorSelectbiosfile() +{ + theApp.winCheckFullscreen(); + LPCTSTR exts[] = { "" }; + CString filter = winLoadFilter(IDS_FILTER_BIOS); + CString title = winResLoadString(IDS_SELECT_BIOS_FILE); + + FileDlg dlg(this, + theApp.biosFileName, + filter, + 0, + "BIOS", + exts, + "", + title, + false); + + if(dlg.DoModal() == IDOK) { + theApp.biosFileName = dlg.GetPathName(); + } +} + +void MainWnd::OnOptionsEmulatorPngformat() +{ + theApp.captureFormat = 0; +} + +void MainWnd::OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.captureFormat == 0); +} + +void MainWnd::OnOptionsEmulatorBmpformat() +{ + theApp.captureFormat = 1; +} + +void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.captureFormat == 1); +} + +void MainWnd::OnOptionsSoundOff() +{ + soundOffFlag = true; + soundShutdown(); +} + +void MainWnd::OnUpdateOptionsSoundOff(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundOffFlag); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsSoundMute() +{ + soundDisable(0x30f); +} + +void MainWnd::OnUpdateOptionsSoundMute(CCmdUI* pCmdUI) +{ + int active = soundGetEnable() & 0x30f; + pCmdUI->SetCheck(active == 0); +} + +void MainWnd::OnOptionsSoundOn() +{ + if(soundOffFlag) { + soundOffFlag = false; + soundInit(); + } + soundEnable(0x30f); +} + +void MainWnd::OnUpdateOptionsSoundOn(CCmdUI* pCmdUI) +{ + int active = soundGetEnable() & 0x30f; + pCmdUI->SetCheck(active != 0 && !soundOffFlag); +} + +void MainWnd::OnOptionsSoundUseoldsynchronization() +{ + theApp.useOldSync = !theApp.useOldSync; + systemMessage(IDS_SETTING_WILL_BE_EFFECTIVE, + "Setting will be effective the next time you start the emulator"); +} + +void MainWnd::OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.useOldSync); +} + +void MainWnd::OnOptionsSoundEcho() +{ + soundEcho = !soundEcho; +} + +void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundEcho); +} + +void MainWnd::OnOptionsSoundLowpassfilter() +{ + soundLowPass = !soundLowPass; +} + +void MainWnd::OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundLowPass); +} + +void MainWnd::OnOptionsSoundReversestereo() +{ + soundReverse = !soundReverse; +} +void MainWnd::OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundReverse); +} + +void MainWnd::OnOptionsSoundMuteFrameAdvance() +{ + theApp.muteFrameAdvance = !theApp.muteFrameAdvance; + if(!theApp.muteFrameAdvance) + theApp.frameAdvanceMuteNow = false; +} +void MainWnd::OnUpdateOptionsSoundMuteFrameAdvance(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.muteFrameAdvance); +} + +void MainWnd::OnOptionsSound11khz() +{ + if(theApp.cartridgeType == 0) + soundSetQuality(4); + else + gbSoundSetQuality(4); +} + +void MainWnd::OnUpdateOptionsSound11khz(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundQuality == 4); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsSound22khz() +{ + if(theApp.cartridgeType == 0) + soundSetQuality(2); + else + gbSoundSetQuality(2); +} + +void MainWnd::OnUpdateOptionsSound22khz(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundQuality == 2); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsSound44khz() +{ + if(theApp.cartridgeType == 0) + soundSetQuality(1); + else + gbSoundSetQuality(1); +} + +void MainWnd::OnUpdateOptionsSound44khz(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundQuality == 1); +} + +BOOL MainWnd::OnOptionsSoundVolume(UINT nID) +{ + soundVolume = nID - ID_OPTIONS_SOUND_VOLUME_1X; + return TRUE; +} + +void MainWnd::OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI) +{ + pCmdUI->SetCheck(soundVolume == (int)(pCmdUI->m_nID - ID_OPTIONS_SOUND_VOLUME_1X)); +} + + +void MainWnd::OnOptionsSoundVolume25x() +{ + soundVolume = 4; +} + +void MainWnd::OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundVolume == 4); +} + +void MainWnd::OnOptionsSoundVolume5x() +{ + soundVolume = 5; +} + +void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundVolume == 5); +} + +void MainWnd::updateSoundChannels(UINT id) +{ + int flag = 0; + + if(id == ID_OPTIONS_SOUND_CHANNEL1) + flag = 1; + + if(id == ID_OPTIONS_SOUND_CHANNEL2) + flag = 2; + + if(id == ID_OPTIONS_SOUND_CHANNEL3) + flag = 4; + + if(id == ID_OPTIONS_SOUND_CHANNEL4) + flag = 8; + + if(id == ID_OPTIONS_SOUND_DIRECTSOUNDA) + flag = 256; + + if(id == ID_OPTIONS_SOUND_DIRECTSOUNDB) + flag = 512; + + int active = soundGetEnable() & 0x30f; + + if(active & flag) + active &= (~flag); + else + active |= flag; + + soundEnable(active); + soundDisable((~active)&0x30f); +} + +void MainWnd::OnOptionsSoundChannel1() +{ + updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL1); +} + +void MainWnd::OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 1); +} + +void MainWnd::OnOptionsSoundChannel2() +{ + updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL2); +} + +void MainWnd::OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 2); +} + +void MainWnd::OnOptionsSoundChannel3() +{ + updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL3); +} + +void MainWnd::OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 4); +} + +void MainWnd::OnOptionsSoundChannel4() +{ + updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL4); +} + +void MainWnd::OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 8); +} + +void MainWnd::OnOptionsSoundDirectsounda() +{ + updateSoundChannels(ID_OPTIONS_SOUND_DIRECTSOUNDA); +} + +void MainWnd::OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 256); + pCmdUI->Enable(theApp.cartridgeType == 0); +} + +void MainWnd::OnOptionsSoundDirectsoundb() +{ + updateSoundChannels(ID_OPTIONS_SOUND_DIRECTSOUNDB); +} + +void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(soundGetEnable() & 512); + pCmdUI->Enable(theApp.cartridgeType == 0); +} + +void MainWnd::OnOptionsGameboyBorder() +{ + theApp.winGbBorderOn = !theApp.winGbBorderOn; + gbBorderOn = theApp.winGbBorderOn; + if(emulating && theApp.cartridgeType == 1 && gbBorderOn) { + gbSgbRenderBorder(); + } + theApp.updateWindowSize(theApp.videoOption); +} + +void MainWnd::OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.winGbBorderOn); +} + +void MainWnd::OnOptionsGameboyPrinter() +{ + theApp.winGbPrinterEnabled = !theApp.winGbPrinterEnabled; + if(theApp.winGbPrinterEnabled) + gbSerialFunction = gbPrinterSend; + else + gbSerialFunction = NULL; +} + +void MainWnd::OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbSerialFunction == gbPrinterSend); +} + +void MainWnd::OnOptionsGameboyBorderAutomatic() +{ + gbBorderAutomatic = !gbBorderAutomatic; + if(emulating && theApp.cartridgeType == 1 && gbBorderOn) { + gbSgbRenderBorder(); + theApp.updateWindowSize(theApp.videoOption); + } +} + +void MainWnd::OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbBorderAutomatic); +} + +void MainWnd::OnOptionsGameboyAutomatic() +{ + gbEmulatorType = 0; +} + +void MainWnd::OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 0); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboyGba() +{ + gbEmulatorType = 4; +} + +void MainWnd::OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 4); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboyCgb() +{ + gbEmulatorType = 1; +} + +void MainWnd::OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 1); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboySgb() +{ + gbEmulatorType = 2; +} + +void MainWnd::OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 2); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboySgb2() +{ + gbEmulatorType = 5; +} + +void MainWnd::OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 5); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboyGb() +{ + gbEmulatorType = 3; +} + +void MainWnd::OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbEmulatorType == 3); + pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)); +} + +void MainWnd::OnOptionsGameboyRealcolors() +{ + gbColorOption = 0; +} + +void MainWnd::OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbColorOption == 0); +} + +void MainWnd::OnOptionsGameboyGameboycolors() +{ + gbColorOption = 1; +} + +void MainWnd::OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(gbColorOption == 1); +} + + +void MainWnd::OnOptionsGameboyColors() +{ + theApp.winCheckFullscreen(); + GBColorDlg dlg; + if(dlg.DoModal()) { + gbPaletteOption = dlg.getWhich(); + memcpy(systemGbPalette, dlg.getColors(), 24*sizeof(u16)); + if(emulating && theApp.cartridgeType == 1) { + memcpy(gbPalette, &systemGbPalette[dlg.getWhich()*8], 8*sizeof(u16)); + } + } +} + +BOOL MainWnd::OnOptionsPriority(UINT nID) +{ + switch(nID) { + case ID_OPTIONS_PRIORITY_HIGHEST: + theApp.threadPriority = 0; + break; + case ID_OPTIONS_PRIORITY_ABOVENORMAL: + theApp.threadPriority = 1; + break; + case ID_OPTIONS_PRIORITY_NORMAL: + theApp.threadPriority = 2; + break; + case ID_OPTIONS_PRIORITY_BELOWNORMAL: + theApp.threadPriority = 3; + break; + default: + return FALSE; + } + theApp.updatePriority(); + + return TRUE; +} + +void MainWnd::OnUpdateOptionsPriority(CCmdUI *pCmdUI) +{ + switch(pCmdUI->m_nID) { + case ID_OPTIONS_PRIORITY_HIGHEST: + pCmdUI->SetCheck(theApp.threadPriority == 0); + break; + case ID_OPTIONS_PRIORITY_ABOVENORMAL: + pCmdUI->SetCheck(theApp.threadPriority == 1); + break; + case ID_OPTIONS_PRIORITY_NORMAL: + pCmdUI->SetCheck(theApp.threadPriority == 2); + break; + case ID_OPTIONS_PRIORITY_BELOWNORMAL: + pCmdUI->SetCheck(theApp.threadPriority == 3); + break; + } +} + +BOOL MainWnd::OnOptionsFilter(UINT nID) +{ + switch(nID) { + case ID_OPTIONS_FILTER_NORMAL: + theApp.filterType = 0; + break; + case ID_OPTIONS_FILTER_TVMODE: + theApp.filterType = 1; + break; + case ID_OPTIONS_FILTER_2XSAI: + theApp.filterType = 2; + break; + case ID_OPTIONS_FILTER_SUPER2XSAI: + theApp.filterType = 3; + break; + case ID_OPTIONS_FILTER_SUPEREAGLE: + theApp.filterType = 4; + break; + case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL: + theApp.filterType = 5; + break; + case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL: + theApp.filterType = 6; + break; + case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X: + theApp.filterType = 7; + break; + case ID_OPTIONS_FILTER16BIT_SIMPLE2X: + theApp.filterType = 8; + break; + case ID_OPTIONS_FILTER_BILINEAR: + theApp.filterType = 9; + break; + case ID_OPTIONS_FILTER_BILINEARPLUS: + theApp.filterType = 10; + break; + case ID_OPTIONS_FILTER_SCANLINES: + theApp.filterType = 11; + break; + case ID_OPTIONS_FILTER_HQ2X2: + theApp.filterType = 12; + break; + case ID_OPTIONS_FILTER_HQ2X: + theApp.filterType = 13; + break; + case ID_OPTIONS_FILTER_LQ2X: + theApp.filterType = 14; + break; + case ID_OPTIONS_FILTER_HQ3X2: + theApp.filterType = 15; + break; + case ID_OPTIONS_FILTER_HQ3X: + theApp.filterType = 16; + break; + default: + return FALSE; + } + theApp.updateFilter(); + return TRUE; +} + +void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(systemColorDepth == 16 || systemColorDepth == 32); + switch(pCmdUI->m_nID) { + case ID_OPTIONS_FILTER_NORMAL: + pCmdUI->SetCheck(theApp.filterType == 0); + break; + case ID_OPTIONS_FILTER_TVMODE: + pCmdUI->SetCheck(theApp.filterType == 1); + break; + case ID_OPTIONS_FILTER_2XSAI: + pCmdUI->SetCheck(theApp.filterType == 2); + break; + case ID_OPTIONS_FILTER_SUPER2XSAI: + pCmdUI->SetCheck(theApp.filterType == 3); + break; + case ID_OPTIONS_FILTER_SUPEREAGLE: + pCmdUI->SetCheck(theApp.filterType == 4); + break; + case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL: + pCmdUI->SetCheck(theApp.filterType == 5); + break; + case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL: + pCmdUI->SetCheck(theApp.filterType == 6); + break; + case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X: + pCmdUI->SetCheck(theApp.filterType == 7); + break; + case ID_OPTIONS_FILTER16BIT_SIMPLE2X: + pCmdUI->SetCheck(theApp.filterType == 8); + break; + case ID_OPTIONS_FILTER_BILINEAR: + pCmdUI->SetCheck(theApp.filterType == 9); + break; + case ID_OPTIONS_FILTER_BILINEARPLUS: + pCmdUI->SetCheck(theApp.filterType == 10); + break; + case ID_OPTIONS_FILTER_SCANLINES: + pCmdUI->SetCheck(theApp.filterType == 11); + break; + case ID_OPTIONS_FILTER_HQ2X2: + pCmdUI->SetCheck(theApp.filterType == 12); + break; + case ID_OPTIONS_FILTER_HQ2X: + pCmdUI->SetCheck(theApp.filterType == 13); + break; + case ID_OPTIONS_FILTER_LQ2X: + pCmdUI->SetCheck(theApp.filterType == 14); + break; + case ID_OPTIONS_FILTER_HQ3X2: + pCmdUI->SetCheck(theApp.filterType == 15); + break; + case ID_OPTIONS_FILTER_HQ3X: + pCmdUI->SetCheck(theApp.filterType == 16); + break; + } +} + +BOOL MainWnd::OnOptionsFilterIFB(UINT nID) +{ + switch(nID) { + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE: + theApp.ifbType = 0; + break; + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR: + theApp.ifbType = 1; + break; + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART: + theApp.ifbType = 2; + break; + default: + return FALSE; + } + theApp.updateIFB(); + return TRUE; +} + +void MainWnd::OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI) +{ + switch(pCmdUI->m_nID) { + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE: + pCmdUI->SetCheck(theApp.ifbType == 0); + break; + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR: + pCmdUI->SetCheck(theApp.ifbType == 1); + break; + case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART: + pCmdUI->SetCheck(theApp.ifbType == 2); + break; + } +} + +void MainWnd::OnOptionsFilterDisablemmx() +{ + theApp.disableMMX = !theApp.disableMMX; + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +} + +void MainWnd::OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.disableMMX); +} + + +void MainWnd::OnOptionsLanguageSystem() +{ + theApp.winSetLanguageOption(0, false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.languageOption == 0); +} + +void MainWnd::OnOptionsLanguageEnglish() +{ + theApp.winSetLanguageOption(1, false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.languageOption == 1); +} + +void MainWnd::OnOptionsLanguageOther() +{ + theApp.winCheckFullscreen(); + theApp.winSetLanguageOption(2, false); + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.languageOption == 2); +} + + +void MainWnd::OnOptionsJoypadConfigure1() +{ + theApp.winCheckFullscreen(); + JoypadConfig dlg(0); + dlg.DoModal(); +} + +void MainWnd::OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + +void MainWnd::OnOptionsJoypadConfigure2() +{ + theApp.winCheckFullscreen(); + JoypadConfig dlg(1); + dlg.DoModal(); +} + +void MainWnd::OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + +void MainWnd::OnOptionsJoypadConfigure3() +{ + theApp.winCheckFullscreen(); + JoypadConfig dlg(2); + dlg.DoModal(); +} + +void MainWnd::OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + +void MainWnd::OnOptionsJoypadConfigure4() +{ + theApp.winCheckFullscreen(); + JoypadConfig dlg(3); + dlg.DoModal(); +} + +void MainWnd::OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + +BOOL MainWnd::OnOptionsJoypadDefault(UINT nID) +{ + theApp.joypadDefault = nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1; + return TRUE; +} + +void MainWnd::OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI) +{ + pCmdUI->SetCheck(theApp.joypadDefault == (int)(pCmdUI->m_nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1)); +} + +void MainWnd::OnOptionsJoypadMotionconfigure() +{ + theApp.winCheckFullscreen(); + MotionConfig dlg; + dlg.DoModal(); +} +void MainWnd::OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + +void MainWnd::OnOptionsJoypadAllowLeftRight() +{ + theApp.allowLeftRight = !theApp.allowLeftRight; +} +void MainWnd::OnUpdateOptionsJoypadAllowLeftRight(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.allowLeftRight); +} + +BOOL MainWnd::OnOptionsJoypadAutofire(UINT nID) +{ + int & autoFire = (theApp.autoFireToggle ? theApp.autoFire : theApp.autoFire2); + int & autoFire2 = (theApp.autoFireToggle ? theApp.autoFire2 : theApp.autoFire); + int autoFires = (theApp.autoFire | theApp.autoFire2); + + switch(nID) { + case ID_OPTIONS_JOYPAD_AUTOFIRE_A: + if(autoFires & BUTTON_MASK_A) { + autoFire &= ~BUTTON_MASK_A; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A_DISABLED)); + } else { + autoFire |= BUTTON_MASK_A; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A)); + } + autoFire2 &= ~BUTTON_MASK_A; + theApp.autoHold &= ~BUTTON_MASK_A; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_B: + if(autoFires & BUTTON_MASK_B) { + autoFire &= ~BUTTON_MASK_B; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B_DISABLED)); + } else { + autoFire |= BUTTON_MASK_B; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B)); + } + autoFire2 &= ~BUTTON_MASK_B; + theApp.autoHold &= ~BUTTON_MASK_B; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_L: + if(autoFires & BUTTON_MASK_L) { + autoFire &= ~BUTTON_MASK_L; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L_DISABLED)); + } else { + autoFire |= BUTTON_MASK_L; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L)); + } + autoFire2 &= ~BUTTON_MASK_L; + theApp.autoHold &= ~BUTTON_MASK_L; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_R: + if(autoFires & BUTTON_MASK_R) { + autoFire &= ~BUTTON_MASK_R; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R_DISABLED)); + } else { + autoFire |= BUTTON_MASK_R; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R)); + } + autoFire2 &= ~BUTTON_MASK_R; + theApp.autoHold &= ~BUTTON_MASK_R; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_START: + if(autoFires & BUTTON_MASK_START) { + autoFire &= ~BUTTON_MASK_START; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START_DISABLED)); + } else { + autoFire |= BUTTON_MASK_START; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START)); + } + autoFire2 &= ~BUTTON_MASK_START; + theApp.autoHold &= ~BUTTON_MASK_START; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT: + if(autoFires & BUTTON_MASK_SELECT) { + autoFire &= ~BUTTON_MASK_SELECT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT_DISABLED)); + } else { + autoFire |= BUTTON_MASK_SELECT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT)); + } + autoFire2 &= ~BUTTON_MASK_SELECT; + theApp.autoHold &= ~BUTTON_MASK_SELECT; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_UP: + if(autoFires & BUTTON_MASK_UP) { + autoFire &= ~BUTTON_MASK_UP; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP_DISABLED)); + } else { + autoFire |= BUTTON_MASK_UP; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP)); + } + autoFire2 &= ~BUTTON_MASK_UP; + theApp.autoHold &= ~BUTTON_MASK_UP; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN: + if(autoFires & BUTTON_MASK_DOWN) { + autoFire &= ~BUTTON_MASK_DOWN; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN_DISABLED)); + } else { + autoFire |= BUTTON_MASK_DOWN; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN)); + } + autoFire2 &= ~BUTTON_MASK_DOWN; + theApp.autoHold &= ~BUTTON_MASK_DOWN; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT: + if(autoFires & BUTTON_MASK_LEFT) { + autoFire &= ~BUTTON_MASK_LEFT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT_DISABLED)); + } else { + autoFire |= BUTTON_MASK_LEFT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT)); + } + autoFire2 &= ~BUTTON_MASK_LEFT; + theApp.autoHold &= ~BUTTON_MASK_LEFT; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT: + if(autoFires & BUTTON_MASK_RIGHT) { + autoFire &= ~BUTTON_MASK_RIGHT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT_DISABLED)); + } else { + autoFire |= BUTTON_MASK_RIGHT; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT)); + } + autoFire2 &= ~BUTTON_MASK_RIGHT; + theApp.autoHold &= ~BUTTON_MASK_RIGHT; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR: + if(autoFires != 0) { + theApp.autoFire = theApp.autoFire2 = 0; +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DISABLED)); + } else { +/// systemScreenMessage(winResLoadString(IDS_AUTOFIRE_ALREADY_DISABLED)); + systemScreenMessage("already cleared"); + } + break; + default: + return FALSE; + } + + extern void DisplayPressedKeys(); DisplayPressedKeys(); + + return TRUE; +} + +void MainWnd::OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI) +{ +/// pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + pCmdUI->Enable(TRUE); // TEMP + + int autoFires = (theApp.autoFire | theApp.autoFire2); + + bool check = true; + switch(pCmdUI->m_nID) { + case ID_OPTIONS_JOYPAD_AUTOFIRE_A: + check = (autoFires & BUTTON_MASK_A) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_B: + check = (autoFires & BUTTON_MASK_B) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_L: + check = (autoFires & BUTTON_MASK_L) != 0; +/// extern int gbSgbMode; // from gbSGB.cpp +/// if(emulating && theApp.cartridgeType != 0 && !gbSgbMode) // regular GB has no L button +/// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_R: + check = (autoFires & BUTTON_MASK_R) != 0; +/// extern int gbSgbMode; // from gbSGB.cpp +/// if(emulating && theApp.cartridgeType != 0 && !gbSgbMode) // regular GB has no R button +/// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_START: + check = (autoFires & BUTTON_MASK_START) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT: + check = (autoFires & BUTTON_MASK_SELECT) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_UP: + check = (autoFires & BUTTON_MASK_UP) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN: + check = (autoFires & BUTTON_MASK_DOWN) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT: + check = (autoFires & BUTTON_MASK_LEFT) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT: + check = (autoFires & BUTTON_MASK_RIGHT) != 0; + break; + case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR: + check = (autoFires == 0); +/// pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + } + pCmdUI->SetCheck(check); +} + +BOOL MainWnd::OnOptionsJoypadSticky(UINT nID) +{ + switch(nID) { + case ID_STICKY_A: + if(theApp.autoHold & BUTTON_MASK_A) { + theApp.autoHold &= ~BUTTON_MASK_A; +/// systemScreenMessage(winResLoadString(IDS_STICKY_A_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_A; +/// systemScreenMessage(winResLoadString(IDS_STICKY_A)); + } + theApp.autoFire &= ~BUTTON_MASK_A; + theApp.autoFire2 &= ~BUTTON_MASK_A; + break; + case ID_STICKY_B: + if(theApp.autoHold & BUTTON_MASK_B) { + theApp.autoHold &= ~BUTTON_MASK_B; +/// systemScreenMessage(winResLoadString(IDS_STICKY_B_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_B; +/// systemScreenMessage(winResLoadString(IDS_STICKY_B)); + } + theApp.autoFire &= ~BUTTON_MASK_B; + theApp.autoFire2 &= ~BUTTON_MASK_B; + break; + case ID_STICKY_L: + if(theApp.autoHold & BUTTON_MASK_L) { + theApp.autoHold &= ~BUTTON_MASK_L; +/// systemScreenMessage(winResLoadString(IDS_STICKY_L_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_L; +/// systemScreenMessage(winResLoadString(IDS_STICKY_L)); + } + theApp.autoFire &= ~BUTTON_MASK_L; + theApp.autoFire2 &= ~BUTTON_MASK_L; + break; + case ID_STICKY_R: + if(theApp.autoHold & BUTTON_MASK_R) { + theApp.autoHold &= ~BUTTON_MASK_R; +/// systemScreenMessage(winResLoadString(IDS_STICKY_R_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_R; +/// systemScreenMessage(winResLoadString(IDS_STICKY_R)); + } + theApp.autoFire &= ~BUTTON_MASK_R; + theApp.autoFire2 &= ~BUTTON_MASK_R; + break; + case ID_STICKY_START: + if(theApp.autoHold & BUTTON_MASK_START) { + theApp.autoHold &= ~BUTTON_MASK_START; +/// systemScreenMessage(winResLoadString(IDS_STICKY_START_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_START; +/// systemScreenMessage(winResLoadString(IDS_STICKY_START)); + } + theApp.autoFire &= ~BUTTON_MASK_START; + theApp.autoFire2 &= ~BUTTON_MASK_START; + break; + case ID_STICKY_SELECT: + if(theApp.autoHold & BUTTON_MASK_SELECT) { + theApp.autoHold &= ~BUTTON_MASK_SELECT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_SELECT_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_SELECT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_SELECT)); + } + theApp.autoFire &= ~BUTTON_MASK_SELECT; + theApp.autoFire2 &= ~BUTTON_MASK_SELECT; + break; + case ID_STICKY_UP: + if(theApp.autoHold & BUTTON_MASK_UP) { + theApp.autoHold &= ~BUTTON_MASK_UP; +/// systemScreenMessage(winResLoadString(IDS_STICKY_UP_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_UP; +/// systemScreenMessage(winResLoadString(IDS_STICKY_UP)); + } + theApp.autoFire &= ~BUTTON_MASK_UP; + theApp.autoFire2 &= ~BUTTON_MASK_UP; + if(!theApp.allowLeftRight) + theApp.autoHold &= ~BUTTON_MASK_DOWN; + break; + case ID_STICKY_DOWN: + if(theApp.autoHold & BUTTON_MASK_DOWN) { + theApp.autoHold &= ~BUTTON_MASK_DOWN; +/// systemScreenMessage(winResLoadString(IDS_STICKY_DOWN_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_DOWN; +/// systemScreenMessage(winResLoadString(IDS_STICKY_DOWN)); + } + theApp.autoFire &= ~BUTTON_MASK_DOWN; + theApp.autoFire2 &= ~BUTTON_MASK_DOWN; + if(!theApp.allowLeftRight) + theApp.autoHold &= ~BUTTON_MASK_UP; + break; + case ID_STICKY_LEFT: + if(theApp.autoHold & BUTTON_MASK_LEFT) { + theApp.autoHold &= ~BUTTON_MASK_LEFT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_LEFT_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_LEFT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_LEFT)); + } + theApp.autoFire &= ~BUTTON_MASK_LEFT; + theApp.autoFire2 &= ~BUTTON_MASK_LEFT; + if(!theApp.allowLeftRight) + theApp.autoHold &= ~BUTTON_MASK_RIGHT; + break; + case ID_STICKY_RIGHT: + if(theApp.autoHold & BUTTON_MASK_RIGHT) { + theApp.autoHold &= ~BUTTON_MASK_RIGHT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT_DISABLED)); + } else { + theApp.autoHold |= BUTTON_MASK_RIGHT; +/// systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT)); + } + theApp.autoFire &= ~BUTTON_MASK_RIGHT; + theApp.autoFire2 &= ~BUTTON_MASK_RIGHT; + if(!theApp.allowLeftRight) + theApp.autoHold &= ~BUTTON_MASK_LEFT; + break; + case ID_STICKY_CLEAR: + if(theApp.autoHold != 0) { + theApp.autoHold = 0; +/// systemScreenMessage(winResLoadString(IDS_STICKY_DISABLED)); + } else { +/// systemScreenMessage(winResLoadString(IDS_STICKY_ALREADY_DISABLED)); + systemScreenMessage("already cleared"); + } + break; + default: + return FALSE; + } + + extern void DisplayPressedKeys(); DisplayPressedKeys(); + + return TRUE; +} + +void MainWnd::OnUpdateOptionsJoypadSticky(CCmdUI *pCmdUI) +{ +/// pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + pCmdUI->Enable(TRUE); // TEMP + + bool check = true; + switch(pCmdUI->m_nID) { + case ID_STICKY_A: + check = (theApp.autoHold & BUTTON_MASK_A) != 0; + break; + case ID_STICKY_B: + check = (theApp.autoHold & BUTTON_MASK_B) != 0; + break; + case ID_STICKY_L: + check = (theApp.autoHold & BUTTON_MASK_L) != 0; +/// extern int gbSgbMode; // from gbSGB.cpp +/// if(emulating && theApp.cartridgeType != 0 && !gbSgbMode) // regular GB has no L button +/// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + case ID_STICKY_R: + check = (theApp.autoHold & BUTTON_MASK_R) != 0; +/// extern int gbSgbMode; // from gbSGB.cpp +/// if(emulating && theApp.cartridgeType != 0 && !gbSgbMode) // regular GB has no R button +/// pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + case ID_STICKY_START: + check = (theApp.autoHold & BUTTON_MASK_START) != 0; + break; + case ID_STICKY_SELECT: + check = (theApp.autoHold & BUTTON_MASK_SELECT) != 0; + break; + case ID_STICKY_UP: + check = (theApp.autoHold & BUTTON_MASK_UP) != 0; + break; + case ID_STICKY_DOWN: + check = (theApp.autoHold & BUTTON_MASK_DOWN) != 0; + break; + case ID_STICKY_LEFT: + check = (theApp.autoHold & BUTTON_MASK_LEFT) != 0; + break; + case ID_STICKY_RIGHT: + check = (theApp.autoHold & BUTTON_MASK_RIGHT) != 0; + break; + case ID_STICKY_CLEAR: + check = (theApp.autoHold == 0); +/// pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! + break; + } + pCmdUI->SetCheck(check); +} + +LRESULT MainWnd::OnConfirmMode(WPARAM, LPARAM) +{ + // we need to do this separately or the window will not have the right + // parent. must be related to the way MFC does modal dialogs + winConfirmMode(); + return 0; +} + +void MainWnd::winConfirmMode() +{ + if(theApp.renderMethod == DIRECT_DRAW && theApp.videoOption > VIDEO_4X) { + theApp.winCheckFullscreen(); + ModeConfirm dlg(theApp.m_pMainWnd); + + if(!dlg.DoModal()) { + theApp.updateVideoSize(ID_OPTIONS_VIDEO_X2); + } + } + theApp.winAccelMgr.UpdateMenu(theApp.menu); +} + +void MainWnd::OnOptionsVideoFullscreenmaxscale() +{ + MaxScale dlg; + + theApp.winCheckFullscreen(); + + dlg.DoModal(); +} + +void MainWnd::OnOptionsVideoTextdisplayoptions() +{ + TextOptions dlg; + + theApp.winCheckFullscreen(); + + dlg.DoModal(); +} + +void MainWnd::OnUpdateOptionsVideoTextdisplayoptions(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(TRUE); +} diff --git a/src/win32/MainWndTools.cpp b/src/win32/MainWndTools.cpp new file mode 100644 index 0000000..bf6224f --- /dev/null +++ b/src/win32/MainWndTools.cpp @@ -0,0 +1,673 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" + +#include "AccelEditor.h" +#include "AVIWrite.h" +#include "Disassemble.h" +#include "FileDlg.h" +#include "GBDisassemble.h" +#include "GBMapView.h" +#include "GBMemoryViewerDlg.h" +#include "GBOamView.h" +#include "GBPaletteView.h" +#include "GBTileView.h" +#include "GDBConnection.h" +#include "IOViewer.h" +#include "MapView.h" +#include "MemoryViewerDlg.h" +#include "MovieOpen.h" +#include "MovieCreate.h" +#include "OamView.h" +#include "PaletteView.h" +#include "Reg.h" +#include "TileView.h" +#include "WavWriter.h" +#include "WinResUtil.h" + +#include "../GBA.h" +#include "../Globals.h" +#include "../movie.h" +#include "../RTC.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern bool debugger; +extern int emulating; +extern int remoteSocket; + +extern void remoteCleanUp(); +extern void remoteSetSockets(SOCKET, SOCKET); +extern void toolsLogging(); + +void MainWnd::OnToolsDisassemble() +{ + if(theApp.cartridgeType == 0) { + Disassemble *dlg = new Disassemble(); + dlg->Create(IDD_DISASSEMBLE, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBDisassemble *dlg = new GBDisassemble(); + dlg->Create(IDD_GB_DISASSEMBLE, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsDisassemble(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsLogging() +{ + toolsLogging(); +} + +void MainWnd::OnUpdateToolsLogging(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsIoviewer() +{ + IOViewer *dlg = new IOViewer; + dlg->Create(IDD_IO_VIEWER,this); + dlg->ShowWindow(SW_SHOW); +} + +void MainWnd::OnUpdateToolsIoviewer(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && theApp.cartridgeType == 0); +} + +void MainWnd::OnToolsMapview() +{ + if(theApp.cartridgeType == 0) { + MapView *dlg = new MapView; + dlg->Create(IDD_MAP_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBMapView *dlg = new GBMapView; + dlg->Create(IDD_GB_MAP_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsMapview(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsMemoryviewer() +{ + if(theApp.cartridgeType == 0) { + MemoryViewerDlg *dlg = new MemoryViewerDlg; + dlg->Create(IDD_MEM_VIEWER, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBMemoryViewerDlg *dlg = new GBMemoryViewerDlg; + dlg->Create(IDD_MEM_VIEWER, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsOamviewer() +{ + if(theApp.cartridgeType == 0) { + OamView *dlg = new OamView; + dlg->Create(IDD_OAM_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBOamView *dlg = new GBOamView; + dlg->Create(IDD_GB_OAM_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsOamviewer(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsPaletteview() +{ + if(theApp.cartridgeType == 0) { + PaletteView *dlg = new PaletteView; + dlg->Create(IDD_PALETTE_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBPaletteView *dlg = new GBPaletteView; + dlg->Create(IDD_GB_PALETTE_VIEW, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsPaletteview(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnToolsTileviewer() +{ + if(theApp.cartridgeType == 0) { + TileView *dlg = new TileView; + dlg->Create(IDD_TILE_VIEWER, this); + dlg->ShowWindow(SW_SHOW); + } else { + GBTileView *dlg = new GBTileView; + dlg->Create(IDD_GB_TILE_VIEWER, this); + dlg->ShowWindow(SW_SHOW); + } +} + +void MainWnd::OnUpdateToolsTileviewer(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); +} + +void MainWnd::OnDebugNextframe() +{ + if(theApp.paused) + theApp.paused = false; + theApp.winPauseNextFrame = true; +} +void MainWnd::OnUpdateDebugNextframe(CCmdUI* pCmdUI) +{ +} + +#if (defined(WIN32) && !defined(SDL)) + extern u32 currentButtons [4]; // from DirectInput.cpp +#else + u32 currentButtons [4]; /// SDL FIXME movie support NYI (the input format is quite different) +#endif + +void MainWnd::OnDebugFramesearch() +{ + extern SMovie Movie; + if(!theApp.frameSearching) + { + // starting a new search + theApp.frameSearching = true; + theApp.frameSearchStart = (Movie.state == MOVIE_STATE_NONE) ? theApp.globalFrameCount : Movie.currentFrame; + theApp.frameSearchLength = 0; + theApp.frameSearchLoadValid = false; + theApp.emulator.emuWriteMemState(&theApp.frameSearchMemory[REWIND_SIZE*0], REWIND_SIZE); // 0 is start state, 1 is intermediate state (for speedup when going forward), 2 is end state + theApp.emulator.emuWriteMemState(&theApp.frameSearchMemory[REWIND_SIZE*1], REWIND_SIZE); + + // store old buttons from frame before the search + for(int i = 0 ; i < 4 ; i++) + theApp.frameSearchOldInput[i] = currentButtons[i]; + } + else + { + // advance forward 1 step in the search + theApp.frameSearchLength++; + + // try it + theApp.emulator.emuReadMemState(&theApp.frameSearchMemory[REWIND_SIZE*1], REWIND_SIZE); + } + + char str [32]; + sprintf(str, "%d frame search", theApp.frameSearchLength); + systemScreenMessage(str, 0, 600); + + theApp.frameSearchSkipping = true; + + // make sure the display updates at least 1 frame to show the new message + theApp.frameSearchFirstStep = true; + + if(theApp.paused) + theApp.paused = false; +} +void MainWnd::OnUpdateDebugFramesearch(CCmdUI* pCmdUI) +{ + extern SMovie Movie; + pCmdUI->Enable(emulating && Movie.state != MOVIE_STATE_PLAY); + pCmdUI->SetCheck(theApp.frameSearching); +} + +void MainWnd::OnDebugFramesearchPrev() +{ + if(theApp.frameSearching) + { + if(theApp.frameSearchLength > 0) + { + // rewind 1 step in the search + theApp.frameSearchLength--; + } + + // try it + theApp.emulator.emuReadMemState(&theApp.frameSearchMemory[REWIND_SIZE*0], REWIND_SIZE); + + char str [32]; + sprintf(str, "%d frame search", theApp.frameSearchLength); + systemScreenMessage(str, 0, 600); + + theApp.frameSearchSkipping = true; + + // make sure the display updates at least 1 frame to show the new message + theApp.frameSearchFirstStep = true; + + if(theApp.paused) + theApp.paused = false; + } +} +void MainWnd::OnUpdateDebugFramesearchPrev(CCmdUI* pCmdUI) +{ + extern SMovie Movie; + pCmdUI->Enable(emulating && theApp.frameSearching && Movie.state != MOVIE_STATE_PLAY); +} + +void MainWnd::OnDebugFramesearchLoad() +{ + if(theApp.frameSearchLoadValid) + { + theApp.emulator.emuReadMemState(&theApp.frameSearchMemory[REWIND_SIZE*2], REWIND_SIZE); + theApp.paused = true; + + if(theApp.frameSearching) + systemScreenMessage("end frame search", 0, 600); + else + systemScreenMessage("restore search end", 0, 600); + } + theApp.frameSearching = false; + theApp.frameSearchSkipping = false; +} +void MainWnd::OnUpdateDebugFramesearchLoad(CCmdUI* pCmdUI) +{ + extern SMovie Movie; + pCmdUI->Enable(emulating && Movie.state != MOVIE_STATE_PLAY); +} + +void MainWnd::OnToolsFrameCounter() +{ + theApp.frameCounter = !theApp.frameCounter; +} +void MainWnd::OnUpdateToolsFrameCounter(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.frameCounter); +} + +void MainWnd::OnToolsInputDisplay() +{ + theApp.inputDisplay = !theApp.inputDisplay; + systemScreenMessage(theApp.inputDisplay ? "Input Display On" : "Input Display Off"); + extern void DisplayPressedKeys(); DisplayPressedKeys(); +} +void MainWnd::OnUpdateToolsInputDisplay(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(theApp.inputDisplay); +} + + +void MainWnd::OnToolsDebugGdb() +{ + theApp.winCheckFullscreen(); + GDBPortDlg dlg; + + if(dlg.DoModal()) { + GDBWaitingDlg wait(dlg.getSocket(), dlg.getPort()); + if(wait.DoModal()) { + remoteSetSockets(wait.getListenSocket(), wait.getSocket()); + debugger = true; + emulating = 1; + theApp.cartridgeType = 0; + theApp.filename = "\\gnu_stub"; + rom = (u8 *)malloc(0x2000000); + workRAM = (u8 *)calloc(1, 0x40000); + bios = (u8 *)calloc(1,0x4000); + internalRAM = (u8 *)calloc(1,0x8000); + paletteRAM = (u8 *)calloc(1,0x400); + vram = (u8 *)calloc(1, 0x20000); + oam = (u8 *)calloc(1, 0x400); + pix = (u8 *)calloc(1, 4 * 240 * 160); + ioMem = (u8 *)calloc(1, 0x400); + + theApp.emulator = GBASystem; + + CPUInit(theApp.biosFileName, theApp.useBiosFile ? true : false); + CPUReset(); + } + } +} + +void MainWnd::OnUpdateToolsDebugGdb(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1); +} + +void MainWnd::OnToolsDebugLoadandwait() +{ + theApp.winCheckFullscreen(); + if(fileOpenSelect()) { + if(FileRun()) { + if(theApp.cartridgeType != 0) { + systemMessage(IDS_ERROR_NOT_GBA_IMAGE, "Error: not a GBA image"); + OnFileClose(); + return; + } + GDBPortDlg dlg; + + if(dlg.DoModal()) { + GDBWaitingDlg wait(dlg.getSocket(), dlg.getPort()); + if(wait.DoModal()) { + remoteSetSockets(wait.getListenSocket(), wait.getSocket()); + debugger = true; + emulating = 1; + } + } + } + } +} + +void MainWnd::OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1); +} + +void MainWnd::OnToolsDebugBreak() +{ + if(armState) { + armNextPC -= 4; + reg[15].I -= 4; + } else { + armNextPC -= 2; + reg[15].I -= 2; + } + debugger = true; +} + +void MainWnd::OnUpdateToolsDebugBreak(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1); +} + +void MainWnd::OnToolsDebugDisconnect() +{ + remoteCleanUp(); + debugger = false; +} + +void MainWnd::OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1); +} + +void MainWnd::OnOptionsSoundStartrecording() +{ + theApp.winCheckFullscreen(); + CString captureBuffer; + + CString capdir = regQueryStringValue("soundRecordDir", NULL); + + if(capdir.IsEmpty()) + capdir = getDirFromFile(theApp.filename); + + CString filter = theApp.winLoadFilter(IDS_FILTER_WAV); + CString title = winResLoadString(IDS_SELECT_WAV_NAME); + + LPCTSTR exts[] = { ".WAV" }; + + FileDlg dlg(this, "", filter, 1, "WAV", exts, capdir, title, true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + captureBuffer = theApp.soundRecordName = dlg.GetPathName(); + theApp.soundRecording = true; + + if(dlg.m_ofn.nFileOffset > 0) { + captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset); + } + + int len = captureBuffer.GetLength(); + + if(len > 3 && captureBuffer[len-1] == '\\') + captureBuffer = captureBuffer.Left(len-1); + regSetStringValue("soundRecordDir", captureBuffer); +} + +void MainWnd::OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && !theApp.soundRecording); +} + +void MainWnd::OnOptionsSoundStoprecording() +{ + if(theApp.soundRecorder) { + delete theApp.soundRecorder; + theApp.soundRecorder = NULL; + } + theApp.soundRecording = false; +} + +void MainWnd::OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && theApp.soundRecording); +} + +void MainWnd::OnToolsRecordStartavirecording() +{ + theApp.winCheckFullscreen(); + CString captureBuffer; + + CString capdir = regQueryStringValue("aviRecordDir", NULL); + + if(capdir.IsEmpty()) + capdir = getDirFromFile(theApp.filename); + + CString filter = theApp.winLoadFilter(IDS_FILTER_AVI); + CString title = winResLoadString(IDS_SELECT_AVI_NAME); + + LPCTSTR exts[] = { ".AVI" }; + + FileDlg dlg(this, "", filter, 1, "AVI", exts, capdir, title, true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + captureBuffer = theApp.soundRecordName = dlg.GetPathName(); + theApp.aviRecordName = captureBuffer; + theApp.aviRecording = true; + +/// extern long linearFrameCount; linearFrameCount = 0; +/// extern long linearSoundByteCount; linearSoundByteCount = 0; + + if(dlg.m_ofn.nFileOffset > 0) { + captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset); + } + + int len = captureBuffer.GetLength(); + + if(len > 3 && captureBuffer[len-1] == '\\') + captureBuffer = captureBuffer.Left(len-1); + + regSetStringValue("aviRecordDir", captureBuffer); +} + +void MainWnd::OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && !theApp.aviRecording); +} + +void MainWnd::OnToolsRecordStopavirecording() +{ + if(theApp.aviRecorder != NULL) { + delete theApp.aviRecorder; + theApp.aviRecorder = NULL; + theApp.aviFrameNumber = 0; + } + theApp.aviRecording = false; +} + +void MainWnd::OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && theApp.aviRecording); +} + +void MainWnd::OnToolsRecordStartmovierecording() +{ + MovieCreate dlg; + dlg.DoModal(); +} + +void MainWnd::OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnToolsRecordStopmovierecording() +{ + VBAMovieStop(false); +} +void MainWnd::OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && VBAMovieGetState() == MOVIE_STATE_RECORD); +} + +void MainWnd::OnToolsPlayStartmovieplaying() +{ + MovieOpen dlg; + dlg.DoModal(); +} +void MainWnd::OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating); +} + +void MainWnd::OnToolsPlayStopmovieplaying() +{ + VBAMovieStop(false); +} +void MainWnd::OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(emulating && VBAMovieGetState() == MOVIE_STATE_PLAY); +} + +void MainWnd::OnToolsPlayReadOnly() +{ +// if(!VBAMovieActive()) +// systemScreenMessage("no movie active"); +// else + VBAMovieToggleReadOnly(); + theApp.movieReadOnly = VBAMovieActive() ? (VBAMovieReadOnly()?true:false) : !theApp.movieReadOnly; +} +void MainWnd::OnUpdateToolsPlayReadOnly(CCmdUI* pCmdUI) +{ +/// pCmdUI->Enable(VBAMovieActive()); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu! +/// pCmdUI->SetCheck(VBAMovieReadOnly()); + pCmdUI->Enable(TRUE); // TEMP + pCmdUI->SetCheck(VBAMovieActive() ? VBAMovieReadOnly() : theApp.movieReadOnly); // TEMP +} + +void MainWnd::OnToolsPlayContinue() +{ + VBAMovieSwitchToRecording(); +} +void MainWnd::OnUpdateToolsPlayContinue(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(!VBAMovieReadOnly() && VBAMovieGetState() == MOVIE_STATE_PLAY); +} + +void MainWnd::OnToolsPlayRestart() +{ + VBAMovieRestart(); +} +void MainWnd::OnUpdateToolsPlayRestart(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(VBAMovieActive()); +} + +#include "assert.h" +void MainWnd::OnToolsRewind() +{ + assert(theApp.rewindTimer > 0 && theApp.rewindSlots > 0); + if(emulating && theApp.emulator.emuReadMemState && theApp.rewindMemory && theApp.rewindCount) { + assert(theApp.rewindPos >= 0 && theApp.rewindPos < theApp.rewindSlots); + theApp.rewindPos = (--theApp.rewindPos + theApp.rewindSlots) % theApp.rewindSlots; + assert(theApp.rewindPos >= 0 && theApp.rewindPos < theApp.rewindSlots); + theApp.emulator.emuReadMemState(&theApp.rewindMemory[REWIND_SIZE*theApp.rewindPos], REWIND_SIZE); + theApp.rewindCount--; + if(theApp.rewindCount > 0) + theApp.rewindCounter = 0; + else + { + theApp.rewindCounter = theApp.rewindTimer; + theApp.rewindSaveNeeded = true; + + // immediately save state to avoid eroding away the earliest you can rewind to + theApp.saveRewindStateIfNecessary(); + + theApp.rewindSaveNeeded = false; + } + } +} + +void MainWnd::OnUpdateToolsRewind(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.rewindMemory != NULL && emulating && theApp.rewindCount); +} + +void MainWnd::OnToolsCustomize() +{ + AccelEditor dlg; + + if(dlg.DoModal()) { + theApp.winAccelMgr = dlg.mgr; + theApp.winAccelMgr.UpdateWndTable(); + theApp.winAccelMgr.Write(); + theApp.winAccelMgr.UpdateMenu(theApp.menu); + } +} + +void MainWnd::OnUpdateToolsCustomize(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} + + +void MainWnd::OnToolsCustomizeCommon() +{ + AccelEditor dlg; + dlg.m_commonOnly = true; + + if(dlg.DoModal()) { + theApp.winAccelMgr = dlg.mgr; + theApp.winAccelMgr.UpdateWndTable(); + theApp.winAccelMgr.Write(); + theApp.winAccelMgr.UpdateMenu(theApp.menu); + } +} + +void MainWnd::OnUpdateToolsCustomizeCommon(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); +} diff --git a/src/win32/MapView.cpp b/src/win32/MapView.cpp new file mode 100644 index 0000000..92e7c72 --- /dev/null +++ b/src/win32/MapView.cpp @@ -0,0 +1,1026 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MapView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "MapView.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../NLS.h" +#include "../Util.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// MapView dialog + + +MapView::MapView(CWnd* pParent /*=NULL*/) + : ResizeDlg(MapView::IDD, pParent) +{ + //{{AFX_DATA_INIT(MapView) + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 1024; + bmpInfo.bmiHeader.biHeight = -1024; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 1024 * 1024); + + mapView.setData(data); + mapView.setBmpInfo(&bmpInfo); + + control = BG0CNT; + + bg = 0; + frame = 0; +} + +MapView::~MapView() +{ + free(data); + data = NULL; +} + +void MapView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MapView) + DDX_Control(pDX, IDC_NUMCOLORS, m_numcolors); + DDX_Control(pDX, IDC_MODE, m_mode); + DDX_Control(pDX, IDC_OVERFLOW, m_overflow); + DDX_Control(pDX, IDC_MOSAIC, m_mosaic); + DDX_Control(pDX, IDC_PRIORITY, m_priority); + DDX_Control(pDX, IDC_DIM, m_dim); + DDX_Control(pDX, IDC_CHARBASE, m_charbase); + DDX_Control(pDX, IDC_MAPBASE, m_mapbase); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_MAP_VIEW, mapView); + DDX_Control(pDX, IDC_MAP_VIEW_ZOOM, mapViewZoom); + DDX_Control(pDX, IDC_COLOR, color); +} + + +BEGIN_MESSAGE_MAP(MapView, CDialog) + //{{AFX_MSG_MAP(MapView) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_FRAME_0, OnFrame0) + ON_BN_CLICKED(IDC_FRAME_1, OnFrame1) + ON_BN_CLICKED(IDC_BG0, OnBg0) + ON_BN_CLICKED(IDC_BG1, OnBg1) + ON_BN_CLICKED(IDC_BG2, OnBg2) + ON_BN_CLICKED(IDC_BG3, OnBg3) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_SAVE, OnSave) + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// MapView message handlers + +void MapView::renderTextScreen(u16 control) +{ + u16 *palette = (u16 *)paletteRAM; + u8 *charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + u16 *screenBase = (u16 *)&vram[((control >> 8) & 0x1f) * 0x800]; + u8 *bmp = data; + + int sizeX = 256; + int sizeY = 256; + switch((control >> 14) & 3) { + case 0: + break; + case 1: + sizeX = 512; + break; + case 2: + sizeY = 512; + break; + case 3: + sizeX = 512; + sizeY = 512; + break; + } + + w = sizeX; + h = sizeY; + + if(control & 0x80) { + for(int y = 0; y < sizeY; y++) { + int yy = y & 255; + + if(y == 256 && sizeY > 256) { + screenBase += 0x400; + if(sizeX > 256) + screenBase += 0x400; + } + u16 *screenSource = screenBase + ((yy>>3)*32); + + for(int x = 0; x < sizeX; x++) { + u16 data = *screenSource; + + int tile = data & 0x3FF; + int tileX = (x & 7); + int tileY = y & 7; + + if(data & 0x0400) + tileX = 7 - tileX; + if(data & 0x0800) + tileY = 7 - tileY; + + u8 c = charBase[tile * 64 + tileY * 8 + tileX]; + + u16 color = palette[c]; + + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + + if(data & 0x0400) { + if(tileX == 0) + screenSource++; + } else if(tileX == 7) + screenSource++; + if(x == 255 && sizeX > 256) { + screenSource = screenBase + 0x400 + ((yy>>3)*32); + } + } + } + } else { + for(int y = 0; y < sizeY; y++) { + int yy = y & 255; + + if(y == 256 && sizeY > 256) { + screenBase += 0x400; + if(sizeX > 256) + screenBase += 0x400; + } + u16 *screenSource = screenBase + ((yy>>3)*32); + + for(int x = 0; x < sizeX; x++) { + u16 data = *screenSource; + + int tile = data & 0x3FF; + int tileX = (x & 7); + int tileY = y & 7; + + if(data & 0x0400) + tileX = 7 - tileX; + if(data & 0x0800) + tileY = 7 - tileY; + + u8 color = charBase[tile * 32 + tileY * 4 + (tileX>>1)]; + + if(tileX & 1) { + color = (color >> 4); + } else { + color &= 0x0F; + } + + int pal = (*screenSource>>8) & 0xF0; + u16 color2 = palette[pal + color]; + + *bmp++ = ((color2 >> 10) & 0x1f) << 3; + *bmp++ = ((color2 >> 5) & 0x1f) << 3; + *bmp++ = (color2 & 0x1f) << 3; + + if(data & 0x0400) { + if(tileX == 0) + screenSource++; + } else if(tileX == 7) + screenSource++; + + if(x == 255 && sizeX > 256) { + screenSource = screenBase + 0x400 + ((yy>>3)*32); + } + } + } + } + /* + switch(bg) { + case 0: + renderView(BG0HOFS<<8, BG0VOFS<<8, + 0x100, 0x000, + 0x000, 0x100, + (sizeX -1) <<8, + (sizeY -1) << 8, + true); + break; + case 1: + renderView(BG1HOFS<<8, BG1VOFS<<8, + 0x100, 0x000, + 0x000, 0x100, + (sizeX -1) <<8, + (sizeY -1) << 8, + true); + break; + case 2: + renderView(BG2HOFS<<8, BG2VOFS<<8, + 0x100, 0x000, + 0x000, 0x100, + (sizeX -1) <<8, + (sizeY -1) << 8, + true); + break; + case 3: + renderView(BG3HOFS<<8, BG3VOFS<<8, + 0x100, 0x000, + 0x000, 0x100, + (sizeX -1) <<8, + (sizeY -1) << 8, + true); + break; + } + */ +} + +void MapView::renderRotScreen(u16 control) +{ + u16 *palette = (u16 *)paletteRAM; + u8 *charBase = &vram[((control >> 2) & 0x03) * 0x4000]; + u8 *screenBase = (u8 *)&vram[((control >> 8) & 0x1f) * 0x800]; + u8 *bmp = data; + + int sizeX = 128; + int sizeY = 128; + switch((control >> 14) & 3) { + case 0: + break; + case 1: + sizeX = sizeY = 256; + break; + case 2: + sizeX = sizeY = 512; + break; + case 3: + sizeX = sizeY = 1024; + break; + } + + w = sizeX; + h = sizeY; + + if(control & 0x80) { + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int tile = screenBase[(x>>3) + (y>>3)*(w>>3)]; + + int tileX = (x & 7); + int tileY = y & 7; + + u8 color = charBase[tile * 64 + tileY * 8 + tileX]; + u16 color2 = palette[color]; + + *bmp++ = ((color2 >> 10) & 0x1f) << 3; + *bmp++ = ((color2 >> 5) & 0x1f) << 3; + *bmp++ = (color2 & 0x1f) << 3; + } + } + } else { + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int tile = screenBase[(x>>3) + (y>>3)*(w>>3)]; + + int tileX = (x & 7); + int tileY = y & 7; + + u8 color = charBase[tile * 64 + tileY * 8 + tileX]; + u16 color2 = palette[color]; + + *bmp++ = ((color2 >> 10) & 0x1f) << 3; + *bmp++ = ((color2 >> 5) & 0x1f) << 3; + *bmp++ = (color2 & 0x1f) << 3; + } + } + } + + u32 xx; + u32 yy; + + switch(bg) { + case 2: + xx = BG2X_L | BG2X_H << 16; + yy = BG2Y_L | BG2Y_H << 16; + + /* + renderView(xx, yy, + BG2PA, BG2PC, + BG2PB, BG2PD, + (sizeX -1) <<8, + (sizeY -1) << 8, + (control & 0x2000) != 0); + */ + break; + case 3: + xx = BG3X_L | BG3X_H << 16; + yy = BG3Y_L | BG3Y_H << 16; + /* + renderView(xx, yy, + BG3PA, BG3PC, + BG3PB, BG3PD, + (sizeX -1) <<8, + (sizeY -1) << 8, + (control & 0x2000) != 0); + */ + break; + } +} + +void MapView::renderMode0() +{ + renderTextScreen(control); +} + +void MapView::renderMode1() +{ + switch(bg) { + case 0: + case 1: + renderTextScreen(control); + break; + case 2: + renderRotScreen(control); + break; + default: + bg = 0; + control = BG0CNT; + renderTextScreen(control); + break; + } +} + +void MapView::renderMode2() +{ + switch(bg) { + case 2: + case 3: + renderRotScreen(control); + break; + default: + bg = 2; + control = BG2CNT; + renderRotScreen(control); + break; + } +} + +void MapView::renderMode3() +{ + u8 *bmp = data; + u16 *src = (u16 *)&vram[0]; + + w = 240; + h = 160; + + for(int y = 0; y < 160; y++) { + for(int x = 0; x < 240; x++) { + u16 data = *src++; + *bmp++ = ((data >> 10) & 0x1f) << 3; + *bmp++ = ((data >> 5) & 0x1f) << 3; + *bmp++ = (data & 0x1f) << 3; + } + } + bg = 2; +} + + +void MapView::renderMode4() +{ + u8 *bmp = data; + u8 *src = frame ? &vram[0xa000] : &vram[0]; + u16 *pal = (u16 *)&paletteRAM[0]; + + w = 240; + h = 160; + + for(int y = 0; y < 160; y++) { + for(int x = 0; x < 240; x++) { + u8 c = *src++; + u16 data = pal[c]; + *bmp++ = ((data >> 10) & 0x1f) << 3; + *bmp++ = ((data >> 5) & 0x1f) << 3; + *bmp++ = (data & 0x1f) << 3; + } + } + bg = 2; +} + + +void MapView::renderMode5() +{ + u8 *bmp = data; + u16 *src = (u16 *)(frame ? &vram[0xa000] : &vram[0]); + + w = 160; + h = 128; + + for(int y = 0; y < 128; y++) { + for(int x = 0; x < 160; x++) { + u16 data = *src++; + *bmp++ = ((data >> 10) & 0x1f) << 3; + *bmp++ = ((data >> 5) & 0x1f) << 3; + *bmp++ = (data & 0x1f) << 3; + } + } + bg = 2; +} + +void MapView::OnRefresh() +{ + paint(); +} + +void MapView::paint() +{ + if(vram == NULL) + return; + int mode = DISPCNT & 7; + + switch(bg) { + default: + case 0: + control = BG0CNT; + break; + case 1: + control = BG1CNT; + break; + case 2: + control = BG2CNT; + break; + case 3: + control = BG3CNT; + break; + } + + switch(mode) { + case 0: + renderMode0(); + break; + case 1: + renderMode1(); + break; + case 2: + renderMode2(); + break; + case 3: + renderMode3(); + break; + case 4: + renderMode4(); + break; + case 5: + renderMode5(); + break; + } + enableButtons(mode); + SIZE s; + + if(mapView.getStretch()) { + mapView.setSize(w, h); + s.cx = s.cy = 1; + mapView.SetScrollSizes(MM_TEXT, s); + } else { + mapView.setSize(w, h); + s.cx = w; + s.cy = h; + mapView.SetScrollSizes(MM_TEXT, s); + } + + mapView.refresh(); + + CString buffer; + + u32 charBase = ((control >> 2) & 0x03) * 0x4000 + 0x6000000; + u32 screenBase = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + + buffer.Format("%d", mode); + m_mode.SetWindowText(buffer); + + if(mode >= 3) { + m_mapbase.SetWindowText(""); + m_charbase.SetWindowText(""); + } else { + buffer.Format("0x%08X", screenBase); + m_mapbase.SetWindowText(buffer); + + buffer.Format("0x%08X", charBase); + m_charbase.SetWindowText(buffer); + } + + buffer.Format("%dx%d", w, h); + m_dim.SetWindowText(buffer); + + m_numcolors.SetWindowText(control & 0x80 ? "256" : "16"); + + buffer.Format("%d", control & 3); + m_priority.SetWindowText(buffer); + + m_mosaic.SetWindowText(control & 0x40 ? "1" : "0"); + + m_overflow.SetWindowText(bg <= 1 ? "" : + control & 0x2000 ? "1" : "0"); +} + +BOOL MapView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_MAP_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\MapView", + NULL); + SIZE size; + size.cx = 1; + size.cy = 1; + mapView.SetScrollSizes(MM_TEXT,size); + int s = regQueryDwordValue("mapViewStretch", 0); + if(s) + mapView.setStretch(true); + ((CButton *)GetDlgItem(IDC_STRETCH))->SetCheck(s); + paint(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MapView::PostNcDestroy() +{ + delete this; +} + +void MapView::enableButtons(int mode) +{ + bool enable[6] = { true, true, true, true, true, true }; + + switch(mode) { + case 0: + enable[4] = false; + enable[5] = false; + break; + case 1: + enable[3] = false; + enable[4] = false; + enable[5] = false; + break; + case 2: + enable[0] = false; + enable[1] = false; + enable[4] = false; + enable[5] = false; + break; + case 3: + enable[0] = false; + enable[1] = false; + enable[2] = false; + enable[3] = false; + enable[4] = false; + enable[5] = false; + break; + case 4: + enable[0] = false; + enable[1] = false; + enable[2] = false; + enable[3] = false; + break; + case 5: + enable[0] = false; + enable[1] = false; + enable[2] = false; + enable[3] = false; + break; + } + GetDlgItem(IDC_BG0)->EnableWindow(enable[0]); + GetDlgItem(IDC_BG1)->EnableWindow(enable[1]); + GetDlgItem(IDC_BG2)->EnableWindow(enable[2]); + GetDlgItem(IDC_BG3)->EnableWindow(enable[3]); + GetDlgItem(IDC_FRAME_0)->EnableWindow(enable[4]); + GetDlgItem(IDC_FRAME_1)->EnableWindow(enable[5]); + int id = IDC_BG0; + switch(bg) { + case 1: + id = IDC_BG1; + break; + case 2: + id = IDC_BG2; + break; + case 3: + id = IDC_BG3; + break; + } + CheckRadioButton(IDC_BG0, IDC_BG3, id); + id = IDC_FRAME_0; + if(frame != 0) + id = IDC_FRAME_1; + CheckRadioButton(IDC_FRAME_0, IDC_FRAME_1, id); +} + +void MapView::OnFrame0() +{ + frame = 0; + paint(); +} + +void MapView::OnFrame1() +{ + frame = 1; + paint(); +} + +void MapView::OnBg0() +{ + bg = 0; + control = BG0CNT; + paint(); +} + +void MapView::OnBg1() +{ + bg = 1; + control = BG1CNT; + paint(); +} + +void MapView::OnBg2() +{ + bg = 2; + control = BG2CNT; + paint(); +} + +void MapView::OnBg3() +{ + bg = 3; + control = BG3CNT; + paint(); +} + +void MapView::OnStretch() +{ + mapView.setStretch(!mapView.getStretch()); + paint(); + regSetDwordValue("mapViewStretch", mapView.getStretch()); +} + +void MapView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void MapView::update() +{ + paint(); +} + +void MapView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +u32 MapView::GetTextClickAddress(u32 base, int x, int y) +{ + if(y > 255 && h > 256) { + base += 0x800; + if(w > 256) + base += 0x800; + } + if(x >= 256) + base += 0x800; + x &= 255; + y &= 255; + base += (x>>3)*2 + 64*(y>>3); + + return base; +} + + + +u32 MapView::GetClickAddress(int x, int y) +{ + int mode = DISPCNT & 7; + + u32 base = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + + // all text bgs (16 bits) + if(mode == 0 ||(mode < 3 && bg < 2)) { + return GetTextClickAddress(base, x, y); + } + // rot bgs (8 bits) + if(mode < 3) { + return base + (x>>3) + (w>>3)*(y>>3); + } + // mode 3/5 (16 bits) + if(mode != 4) { + return 0x6000000 + 0xa000*frame + 2*x + w*y*2; + } + // mode 4 (8 bits) + return 0x6000000 + 0xa000*frame + x + w*y; +} + +LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + mapViewZoom.setColors(colors); + + int x = wParam & 0xffff; + int y = (wParam >> 16); + + CString buffer; + buffer.Format("(%d,%d)", x, y); + GetDlgItem(IDC_XY)->SetWindowText(buffer); + + u32 address = GetClickAddress(x,y); + buffer.Format("0x%08X", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + int mode = DISPCNT & 7; + if(mode >= 3) { + // bitmap modes + GetDlgItem(IDC_TILE_NUM)->SetWindowText("---"); + GetDlgItem(IDC_FLIP)->SetWindowText("--"); + GetDlgItem(IDC_PALETTE_NUM)->SetWindowText("---"); + } else if(mode == 0 || bg < 2) { + // text bgs + u16 value = *((u16 *)&vram[address - 0x6000000]); + + int tile = value & 1023; + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE_NUM)->SetWindowText(buffer); + buffer.Empty(); + buffer += value & 1024 ? 'H' : '-'; + buffer += value & 2048 ? 'V' : '-'; + GetDlgItem(IDC_FLIP)->SetWindowText(buffer); + + if(!(control & 0x80)) { + buffer.Format("%d", (value >> 12) & 15); + } else + buffer = "---"; + GetDlgItem(IDC_PALETTE_NUM)->SetWindowText(buffer); + } else { + // rot bgs + GetDlgItem(IDC_TILE_NUM)->SetWindowText("---"); + GetDlgItem(IDC_FLIP)->SetWindowText("--"); + GetDlgItem(IDC_PALETTE_NUM)->SetWindowText("---"); + } + + return TRUE; +} + +LRESULT MapView::OnColInfo(WPARAM wParam, LPARAM lParam) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + +void MapView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + + +void MapView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + +void MapView::OnSave() +{ + CString filename; + + if(theApp.captureFormat == 0) + filename = "map.png"; + else + filename = "map.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + filename, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + if(dlg.getFilterIndex() == 2) + saveBMP(dlg.GetPathName()); + else + savePNG(dlg.GetPathName()); +} diff --git a/src/win32/MapView.h b/src/win32/MapView.h new file mode 100644 index 0000000..db0a575 --- /dev/null +++ b/src/win32/MapView.h @@ -0,0 +1,122 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MAPVIEW_H__20F40C77_8E10_44B7_BB49_7865F73C3E75__INCLUDED_) +#define AFX_MAPVIEW_H__20F40C77_8E10_44B7_BB49_7865F73C3E75__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MapView.h : header file +// + +#include "BitmapControl.h" +#include "ColorControl.h" +#include "ZoomControl.h" +#include "ResizeDlg.h" +#include "IUpdate.h" +#include "..\System.h" // Added by ClassView + +///////////////////////////////////////////////////////////////////////////// +// MapView dialog + +class MapView : public ResizeDlg, IUpdateListener +{ + private: + BITMAPINFO bmpInfo; + u8 *data; + int frame; + u16 control; + int bg; + int w; + int h; + BitmapControl mapView; + ZoomControl mapViewZoom; + ColorControl color; + bool autoUpdate; + + // Construction + public: + void savePNG(const char *name); + void saveBMP(const char *name); + afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + u32 GetClickAddress(int x, int y); + u32 GetTextClickAddress(u32 base, int x, int y); + void update(); + void enableButtons(int mode); + void paint(); + void renderMode5(); + void renderMode4(); + void renderMode3(); + void renderMode2(); + void renderMode1(); + void renderMode0(); + void renderRotScreen(u16 control); + void renderTextScreen(u16 control); + MapView(CWnd* pParent = NULL); // standard constructor + ~MapView(); + + // Dialog Data + //{{AFX_DATA(MapView) + enum { IDD = IDD_MAP_VIEW }; + CStatic m_numcolors; + CStatic m_mode; + CStatic m_overflow; + CStatic m_mosaic; + CStatic m_priority; + CStatic m_dim; + CStatic m_charbase; + CStatic m_mapbase; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MapView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(MapView) + afx_msg void OnRefresh(); + virtual BOOL OnInitDialog(); + afx_msg void OnFrame0(); + afx_msg void OnFrame1(); + afx_msg void OnBg0(); + afx_msg void OnBg1(); + afx_msg void OnBg2(); + afx_msg void OnBg3(); + afx_msg void OnStretch(); + afx_msg void OnAutoUpdate(); + afx_msg void OnClose(); + afx_msg void OnSave(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAPVIEW_H__20F40C77_8E10_44B7_BB49_7865F73C3E75__INCLUDED_) diff --git a/src/win32/MaxScale.cpp b/src/win32/MaxScale.cpp new file mode 100644 index 0000000..2daf5d7 --- /dev/null +++ b/src/win32/MaxScale.cpp @@ -0,0 +1,89 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MaxScale.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "MaxScale.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// MaxScale dialog + + +MaxScale::MaxScale(CWnd* pParent /*=NULL*/) + : CDialog(MaxScale::IDD, pParent) +{ + //{{AFX_DATA_INIT(MaxScale) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void MaxScale::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MaxScale) + DDX_Control(pDX, IDC_VALUE, m_value); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(MaxScale, CDialog) + //{{AFX_MSG_MAP(MaxScale) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// MaxScale message handlers + +void MaxScale::OnCancel() +{ + EndDialog(FALSE); +} + +void MaxScale::OnOk() +{ + CString tmp; + m_value.GetWindowText(tmp); + theApp.fsMaxScale = atoi(tmp); + EndDialog(TRUE); +} + +BOOL MaxScale::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString temp; + + temp.Format("%d", theApp.fsMaxScale); + + m_value.SetWindowText(temp); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/MaxScale.h b/src/win32/MaxScale.h new file mode 100644 index 0000000..2ad3d45 --- /dev/null +++ b/src/win32/MaxScale.h @@ -0,0 +1,67 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MAXSCALE_H__3F42C0CC_DD5E_4A96_A60D_33AB7CBDE406__INCLUDED_) +#define AFX_MAXSCALE_H__3F42C0CC_DD5E_4A96_A60D_33AB7CBDE406__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MaxScale.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// MaxScale dialog + +class MaxScale : public CDialog +{ +// Construction +public: + MaxScale(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(MaxScale) + enum { IDD = IDD_MAX_SCALE }; + CEdit m_value; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MaxScale) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(MaxScale) + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAXSCALE_H__3F42C0CC_DD5E_4A96_A60D_33AB7CBDE406__INCLUDED_) diff --git a/src/win32/MemoryViewer.cpp b/src/win32/MemoryViewer.cpp new file mode 100644 index 0000000..f747c3f --- /dev/null +++ b/src/win32/MemoryViewer.cpp @@ -0,0 +1,653 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MemoryViewer.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "MemoryViewer.h" + +#include "../System.h" +extern int emulating; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewer + +bool MemoryViewer::isRegistered = false; + +MemoryViewer::MemoryViewer() +{ + address = 0; + addressSize = 0; + dataSize = 0; + editAddress = 0; + editNibble = 0; + displayedLines = 0; + hasCaret = false; + maxNibble = 0; + font = (HFONT)GetStockObject(SYSTEM_FIXED_FONT); + fontSize.cx = fontSize.cy = 0; + beginAscii = 0; + beginHex = 0; + dlg = NULL; + registerClass(); +} + +MemoryViewer::~MemoryViewer() +{ +} + + +BEGIN_MESSAGE_MAP(MemoryViewer, CWnd) + //{{AFX_MSG_MAP(MemoryViewer) + ON_WM_ERASEBKGND() + ON_WM_PAINT() + ON_WM_VSCROLL() + ON_WM_GETDLGCODE() + ON_WM_LBUTTONDOWN() + ON_WM_SETFOCUS() + ON_WM_KILLFOCUS() + ON_WM_KEYDOWN() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_CHAR, OnWMChar) + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// MemoryViewer message handlers + +void MemoryViewer::setDialog(IMemoryViewerDlg *d) +{ + dlg = d; +} + + +void MemoryViewer::setAddress(u32 a) +{ + address = a; + if(displayedLines) { + if(addressSize) { + u16 addr = address; + if((u16)(addr+(displayedLines<<4)) < addr) { + address = 0xffff - (displayedLines<<4) + 1; + } + } else { + if((address+(displayedLines<<4)) < address) { + address = 0xffffffff - (displayedLines<<4) + 1; + } + } + } + if(addressSize) + address &= 0xffff; + setCaretPos(); + InvalidateRect(NULL, TRUE); +} + + +void MemoryViewer::setSize(int s) +{ + dataSize = s; + if(s == 0) + maxNibble = 1; + else if(s == 1) + maxNibble = 3; + else + maxNibble = 7; + + InvalidateRect(NULL, TRUE); +} + +void MemoryViewer::setDecimal(bool decimalDisplayMode) +{ + decimalDisplay = decimalDisplayMode; + InvalidateRect(NULL, TRUE); +} + + +BOOL MemoryViewer::OnEraseBkgnd(CDC* pDC) +{ + return TRUE; +} + +void MemoryViewer::updateScrollInfo(int lines) +{ + int page = lines * 16; + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL | SIF_POS; + si.nMin = 0; + if(addressSize) { + si.nMax = 0x10000/page; + si.nPage = 1; + } else { + si.nMax = 0xa000000 / page; + si.nPage = page; + } + + si.nPos = address / page; + SetScrollInfo(SB_VERT, + &si, + TRUE); +} + +void MemoryViewer::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT rect; + GetClientRect(&rect); + int w = rect.right - rect.left; + int h = rect.bottom - rect.top - 6; + + CDC memDC; + memDC.CreateCompatibleDC(&dc); + CBitmap bitmap, *pOldBitmap; + bitmap.CreateCompatibleBitmap(&dc, w, rect.bottom - rect.top); + pOldBitmap = memDC.SelectObject(&bitmap); + + memDC.FillRect(&rect, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH))); + memDC.DrawEdge(&rect, EDGE_ETCHED, BF_RECT); + + CFont *oldFont = memDC.SelectObject(CFont::FromHandle(font)); + + fontSize = memDC.GetTextExtent("0", 1); + + int lines = h / fontSize.cy; + + displayedLines = lines; + + updateScrollInfo(lines); + + u32 addr = address; + + memDC.SetTextColor(RGB(0,0,0)); + + u8 data[32]; + + RECT r; + r.top = 3; + r.left = 3; + r.bottom = r.top+fontSize.cy; + r.right = rect.right-3; + + int line = 0; + + for(int i = 0; i < lines; i++) { + CString buffer; + if(addressSize) + buffer.Format("%04X", addr); + else + buffer.Format("%08X", addr); + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); + r.left += 10*fontSize.cx; + beginHex = r.left; + readData(addr, 16, data); + + int j; + + if(dataSize == 0) { + for(j = 0; j < 16; j++) { + const int nextRLeft = r.left + 3*fontSize.cx; + if(!decimalDisplay) + buffer.Format("%02X", data[j]); + else + { + const signed char num = data[j]; + if(num < -9 || num > 99) r.left -= fontSize.cx; + if(num >= -99 && num <= 99) buffer.Format("%2d", num); + else buffer.Format(""); + } + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); + r.left = nextRLeft; + } + } + if(dataSize == 1) { + for(j = 0; j < 16; j += 2) { + const int nextRLeft = r.left + 5*fontSize.cx; + if(!decimalDisplay) + buffer.Format("%04X", data[j] | data[j+1]<<8); + else + { + const signed short num = data[j] | data[j+1]<<8; + if(num < -999 || num > 9999) r.left -= fontSize.cx; + if(num >= -9999 && num <= 9999) buffer.Format("%4d", num); + else buffer.Format(""); + } + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); + r.left = nextRLeft; + } + } + if(dataSize == 2) { + for(j = 0; j < 16; j += 4) { + if(!decimalDisplay) + buffer.Format("%08X", data[j] | data[j+1]<<8 | data[j+2] << 16 | data[j+3] << 24); + else + { + const signed long num = data[j] | data[j+1]<<8 | data[j+2] << 16 | data[j+3] << 24; + if(num >= -9999999 && num <= 99999999) buffer.Format("%8d", num); + else buffer.Format(""); + } + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); + r.left += 9*fontSize.cx; + } + } + + line = r.left; + + r.left += fontSize.cx; + beginAscii = r.left; + buffer.Empty(); + for(j = 0; j < 16; j++) { + char c = data[j]; + if(c >= 32 && c <= 127) { + buffer += c; + } else + buffer += '.'; + } + + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); + addr += 16; + if(addressSize) + addr &= 0xffff; + r.top += fontSize.cy; + r.bottom += fontSize.cy; + r.left = 3; + } + CPen pen; + pen.CreatePen(PS_SOLID, 1, RGB(0,0,0)); + CPen *old = memDC.SelectObject(&pen); + + memDC.MoveTo(3+fontSize.cx*9, 3); + memDC.LineTo(3+fontSize.cx*9, 3+displayedLines*fontSize.cy); + + memDC.MoveTo(line, 3); + memDC.LineTo(line, 3+displayedLines*fontSize.cy); + + memDC.SelectObject(old); + pen.DeleteObject(); + + memDC.SelectObject(oldFont); + + dc.BitBlt(0, 0, w, rect.bottom - rect.top, &memDC, 0, 0, SRCCOPY); + + memDC.SelectObject(pOldBitmap); + memDC.DeleteDC(); + bitmap.DeleteObject(); +} + +void MemoryViewer::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + int address = this->address; + switch(nSBCode) { + case SB_BOTTOM: + address = 0xffffff00; + break; + case SB_LINEDOWN: + address += 0x10; + break; + case SB_LINEUP: + address -= 0x10; + break; + case SB_PAGEDOWN: + address += (displayedLines<<4); + break; + case SB_PAGEUP: + address -= (displayedLines<<4); + break; + case SB_TOP: + address = 0; + break; + case SB_THUMBTRACK: + { + int page = displayedLines * 16; + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_TRACKPOS; + GetScrollInfo(SB_VERT, &si); + address = page * si.nTrackPos; + } + break; + } + setAddress(address); +} + +UINT MemoryViewer::OnGetDlgCode() +{ + return DLGC_WANTALLKEYS; +} + +void MemoryViewer::createEditCaret(int w, int h) +{ + if(!hasCaret || caretWidth != w || caretHeight != h) { + hasCaret = true; + caretWidth = w; + caretHeight = h; + ::CreateCaret(m_hWnd, (HBITMAP)0, w, h); + } +} + + +void MemoryViewer::destroyEditCaret() +{ + hasCaret = false; + DestroyCaret(); +} + +void MemoryViewer::setCaretPos() +{ + if(GetFocus() != this) { + destroyEditCaret(); + return; + } + + if(dlg) + dlg->setCurrentAddress(editAddress); + + if(editAddress < address || editAddress > (address -1 + (displayedLines<<4))) { + destroyEditCaret(); + return; + } + + int subAddress = (editAddress - address); + + int x = 3+10*fontSize.cx+editNibble*fontSize.cx; + int y = 3+fontSize.cy*((editAddress-address)>>4); + + if(editAscii) { + x = beginAscii + fontSize.cx*(subAddress&15); + } else { + switch(dataSize) { + case 0: + x += 3*fontSize.cx*(subAddress & 15); + break; + case 1: + x += 5*fontSize.cx*((subAddress>>1) & 7); + break; + case 2: + x += 9*fontSize.cx*((subAddress>>2) & 3); + break; + } + } + + RECT r; + GetClientRect(&r); + r.right -= 3; + if(x >= r.right) { + destroyEditCaret(); + return; + } + int w = fontSize.cx; + if((x+fontSize.cx)>=r.right) + w = r.right - x; + createEditCaret(w, fontSize.cy); + ::SetCaretPos(x, y); + ShowCaret(); +} + +void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) +{ + int x = point.x; + int y = point.y; + int line = (y-3)/fontSize.cy; + int beforeAscii = beginHex; + int inc = 1; + int sub = 3*fontSize.cx; + switch(dataSize) { + case 0: + beforeAscii += 47*fontSize.cx; + break; + case 1: + beforeAscii += 39*fontSize.cx; + inc = 2; + sub = 5*fontSize.cx; + break; + case 2: + beforeAscii += 35*fontSize.cx; + inc = 4; + sub = 9*fontSize.cx; + break; + } + + editAddress = address + (line<<4); + if(x >= beginHex && x < beforeAscii) { + x -= beginHex; + editNibble = 0; + while(x > 0) { + x -= sub; + if(x >= 0) + editAddress += inc; + else { + editNibble = (x + sub)/fontSize.cx; + } + } + editAscii = false; + } else if(x >= beginAscii) { + int afterAscii = beginAscii+16*fontSize.cx; + if(x >= afterAscii) + x = afterAscii-1; + editAddress += (x-beginAscii)/fontSize.cx; + editNibble = 0; + editAscii = true; + } else { + return; + } + + if(editNibble > maxNibble) + editNibble = maxNibble; + SetFocus(); + setCaretPos(); +} + +void MemoryViewer::OnSetFocus(CWnd* pOldWnd) +{ + setCaretPos(); + InvalidateRect(NULL, TRUE); +} + +void MemoryViewer::OnKillFocus(CWnd* pNewWnd) +{ + destroyEditCaret(); + InvalidateRect(NULL, TRUE); +} + +void MemoryViewer::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + bool isShift = (GetKeyState(VK_SHIFT) & 0x80000000) == 0x80000000; + + switch(nChar) { + case VK_RIGHT: + if(editAscii) + moveAddress(1,0); + else if(isShift) + moveAddress((maxNibble+1)>>1,0); + else + moveAddress(0, 1); + break; + case VK_LEFT: + if(editAscii) + moveAddress(-1, 0); + else if(isShift) + moveAddress(-((maxNibble+1)>>1),0); + else + moveAddress(0, -1); + break; + case VK_DOWN: + moveAddress(16, 0); + break; + case VK_UP: + moveAddress(-16, 0); + break; + case VK_TAB: + GetNextDlgTabItem(GetParent(), isShift)->SetFocus(); + break; + } +} + +void MemoryViewer::moveAddress(s32 offset, int nibbleOff) +{ + if(offset == 0) { + if(nibbleOff == -1) { + editNibble--; + if(editNibble == -1) { + editAddress -= (maxNibble + 1) >> 1; + editNibble = maxNibble; + } + if(address == 0 && (editAddress >= (u32)(displayedLines<<4))) { + editAddress = 0; + editNibble = 0; + beep(); + } + if(editAddress < address) + setAddress(address - 16); + } else { + editNibble++; + if(editNibble > maxNibble) { + editNibble = 0; + editAddress += (maxNibble + 1) >> 1; + } + if(editAddress < address) { + editAddress -= (maxNibble + 1) >> 1; + editNibble = maxNibble; + beep(); + } + if(editAddress >= (address+(displayedLines<<4))) + setAddress(address+16); + } + } else { + editAddress += offset; + if(offset < 0 && editAddress > (address-1+(displayedLines<<4))) { + editAddress -= offset; + beep(); + return; + } + if(offset > 0 && (editAddress < address)) { + editAddress -= offset; + beep(); + return; + } + if(editAddress < address) { + if(offset & 15) + setAddress((address+offset-16) & ~15); + else + setAddress(address+offset); + } else if(editAddress > (address - 1 + (displayedLines<<4))) { + if(offset & 15) + setAddress((address+offset+16) & ~15); + else + setAddress(address+offset); + } + } + + setCaretPos(); +} + +LRESULT MemoryViewer::OnWMChar(WPARAM wParam, LPARAM LPARAM) +{ + if(OnEditInput(wParam)) + return 0; + return 1; +} + +bool MemoryViewer::OnEditInput(UINT c) +{ + if(c > 255 || !emulating) { + beep(); + return false; + } + + if(!editAscii) + c = tolower(c); + + u32 value = 256; + + if(c >= 'a' && c <= 'f') + value = 10 + (c - 'a'); + else if(c >= '0' && c <= '9') + value = (c - '0'); + if(editAscii) { + editData(editAddress, 8, 0, c); + moveAddress(1, 0); + InvalidateRect(NULL, TRUE); + } else { + if(value != 256) { + value <<= 4*(maxNibble-editNibble); + u32 mask = ~(15 << 4*(maxNibble - editNibble)); + switch(dataSize) { + case 0: + editData(editAddress, 8, mask, value); + break; + case 1: + editData(editAddress, 16, mask, value); + break; + case 2: + editData(editAddress, 32, mask, value); + break; + } + moveAddress(0, 1); + InvalidateRect(NULL, TRUE); + } + } + return true; +} + +void MemoryViewer::beep() +{ + MessageBeep((UINT)-1); +} + +void MemoryViewer::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_PARENTDC | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH )GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaMemoryViewer"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} + +void MemoryViewer::setAddressSize(int s) +{ + addressSize = s; +} + + +u32 MemoryViewer::getCurrentAddress() +{ + return editAddress; +} + +int MemoryViewer::getSize() +{ + return dataSize; +} diff --git a/src/win32/MemoryViewer.h b/src/win32/MemoryViewer.h new file mode 100644 index 0000000..0a6933a --- /dev/null +++ b/src/win32/MemoryViewer.h @@ -0,0 +1,116 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MEMORYVIEWER_H__52C50474_5399_4D0B_A3E4_4C52C4E0EAA0__INCLUDED_) +#define AFX_MEMORYVIEWER_H__52C50474_5399_4D0B_A3E4_4C52C4E0EAA0__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MemoryViewer.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewer window + +class IMemoryViewerDlg { + public: + virtual void setCurrentAddress(u32 address)=0; +}; + +class MemoryViewer : public CWnd +{ + u32 address; + int addressSize; + int dataSize; + bool hasCaret; + int caretWidth; + int caretHeight; + HFONT font; + CSize fontSize; + u32 editAddress; + int editNibble; + int maxNibble; + int displayedLines; + int beginAscii; + int beginHex; + bool editAscii; + bool decimalDisplay; + IMemoryViewerDlg *dlg; + + static bool isRegistered; + // Construction + public: + MemoryViewer(); + + // Attributes + public: + + // Operations + public: + virtual void readData(u32,int,u8 *) = 0; + virtual void editData(u32,int,int,u32)=0; + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MemoryViewer) + //}}AFX_VIRTUAL + + // Implementation + public: + int getSize(); + u32 getCurrentAddress(); + void setAddressSize(int s); + void registerClass(); + void beep(); + bool OnEditInput(UINT c); + void moveAddress(s32 offset, int nibbleOff); + void setCaretPos(); + void destroyEditCaret(); + void createEditCaret(int w, int h); + void updateScrollInfo(int lines); + void setSize(int s); + void setDecimal(bool decimalDisplayMode); + void setAddress(u32 a); + void setDialog(IMemoryViewerDlg *d); + virtual ~MemoryViewer(); + + // Generated message map functions + protected: + //{{AFX_MSG(MemoryViewer) + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnPaint(); + afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg UINT OnGetDlgCode(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnSetFocus(CWnd* pOldWnd); + afx_msg void OnKillFocus(CWnd* pNewWnd); + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + afx_msg LRESULT OnWMChar(WPARAM wParam, LPARAM lParam); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MEMORYVIEWER_H__52C50474_5399_4D0B_A3E4_4C52C4E0EAA0__INCLUDED_) diff --git a/src/win32/MemoryViewerAddressSize.cpp b/src/win32/MemoryViewerAddressSize.cpp new file mode 100644 index 0000000..78b0056 --- /dev/null +++ b/src/win32/MemoryViewerAddressSize.cpp @@ -0,0 +1,137 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MemoryViewerAddressSize.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "MemoryViewerAddressSize.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewerAddressSize dialog + + +MemoryViewerAddressSize::MemoryViewerAddressSize(u32 a, int s, CWnd* pParent /*=NULL*/) + : CDialog(MemoryViewerAddressSize::IDD, pParent) +{ + //{{AFX_DATA_INIT(MemoryViewerAddressSize) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + address = a; + size = s; +} + + +void MemoryViewerAddressSize::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MemoryViewerAddressSize) + DDX_Control(pDX, IDC_SIZE_CONTROL, m_size); + DDX_Control(pDX, IDC_ADDRESS, m_address); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(MemoryViewerAddressSize, CDialog) + //{{AFX_MSG_MAP(MemoryViewerAddressSize) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// MemoryViewerAddressSize message handlers + +BOOL MemoryViewerAddressSize::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CString buffer; + if(address != 0xFFFFFFFF) { + buffer.Format("%08X", address); + m_address.SetWindowText(buffer); + } + if(size != -1) { + buffer.Format("%08X", size); + m_size.SetWindowText(buffer); + m_size.EnableWindow(FALSE); + } + + if(size == -1 && address != 0xFFFFFFFF) + m_size.SetFocus(); + + m_address.LimitText(9); + m_size.LimitText(9); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MemoryViewerAddressSize::OnOk() +{ + CString buffer; + + m_address.GetWindowText(buffer); + if(buffer.IsEmpty()) { + m_address.SetFocus(); + return; + } + sscanf(buffer, "%x", &address); + + m_size.GetWindowText(buffer); + if(buffer.IsEmpty()) { + m_size.SetFocus(); + return; + } + sscanf(buffer, "%x", &size); + EndDialog(TRUE); +} + +void MemoryViewerAddressSize::OnCancel() +{ + EndDialog(FALSE); +} + +void MemoryViewerAddressSize::setAddress(u32 a) +{ + address = a; +} + +void MemoryViewerAddressSize::setSize(int s) +{ + size = s; +} + + +u32 MemoryViewerAddressSize::getAddress() +{ + return address; +} +\ + +int MemoryViewerAddressSize::getSize() +{ + return size; +} diff --git a/src/win32/MemoryViewerAddressSize.h b/src/win32/MemoryViewerAddressSize.h new file mode 100644 index 0000000..71d3b5e --- /dev/null +++ b/src/win32/MemoryViewerAddressSize.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MEMORYVIEWERADDRESSSIZE_H__04605262_2B1D_4EED_A467_B6C56AC2CACD__INCLUDED_) +#define AFX_MEMORYVIEWERADDRESSSIZE_H__04605262_2B1D_4EED_A467_B6C56AC2CACD__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MemoryViewerAddressSize.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewerAddressSize dialog + +class MemoryViewerAddressSize : public CDialog +{ + u32 address; + int size; + // Construction + public: + int getSize(); + u32 getAddress(); + void setSize(int s); + void setAddress(u32 a); + MemoryViewerAddressSize(u32 a=0xffffff, int s=-1, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(MemoryViewerAddressSize) + enum { IDD = IDD_ADDR_SIZE }; + CEdit m_size; + CEdit m_address; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MemoryViewerAddressSize) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(MemoryViewerAddressSize) + virtual BOOL OnInitDialog(); + afx_msg void OnOk(); + afx_msg void OnCancel(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MEMORYVIEWERADDRESSSIZE_H__04605262_2B1D_4EED_A467_B6C56AC2CACD__INCLUDED_) diff --git a/src/win32/MemoryViewerDlg.cpp b/src/win32/MemoryViewerDlg.cpp new file mode 100644 index 0000000..57ccf24 --- /dev/null +++ b/src/win32/MemoryViewerDlg.cpp @@ -0,0 +1,447 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// MemoryViewerDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "MemoryViewerAddressSize.h" +#include "MemoryViewerDlg.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int emulating; + +#define CPUReadByteQuick(addr) \ + ::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask] +#define CPUWriteByteQuick(addr, b) \ + ::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask] = (b) +#define CPUReadHalfWordQuick(addr) \ + *((u16 *)&::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask]) +#define CPUWriteHalfWordQuick(addr, b) \ + *((u16 *)&::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask]) = (b) +#define CPUReadMemoryQuick(addr) \ + *((u32 *)&::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask]) +#define CPUWriteMemoryQuick(addr, b) \ + *((u32 *)&::map[(addr)>>24].address[(addr) & ::map[(addr)>>24].mask]) = (b) + +///////////////////////////////////////////////////////////////////////////// +// GBAMemoryViewer control + + +GBAMemoryViewer::GBAMemoryViewer() + : MemoryViewer() +{ + setAddressSize(0); +} + +void GBAMemoryViewer::readData(u32 address, int len, u8 *data) +{ + if(emulating && rom != NULL) { + for(int i = 0; i < len; i++) { + *data++ = CPUReadByteQuick(address); + address++; + } + } else { + for(int i = 0; i < len; i++) { + *data++ = 0; + address++; + } + } +} + +void GBAMemoryViewer::editData(u32 address, int size, int mask, u32 value) +{ + u32 oldValue; + + switch(size) { + case 8: + oldValue = (CPUReadByteQuick(address) & mask) | value; + CPUWriteByteQuick(address, oldValue); + break; + case 16: + oldValue = (CPUReadHalfWordQuick(address) & mask) | value; + CPUWriteHalfWordQuick(address, oldValue); + break; + case 32: + oldValue = (CPUReadMemoryQuick(address) & mask) | value; + CPUWriteMemoryQuick(address, oldValue); + break; + } +} + + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewerDlg dialog + + +MemoryViewerDlg::MemoryViewerDlg(CWnd* pParent /*=NULL*/) + : ResizeDlg(MemoryViewerDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(MemoryViewerDlg) + m_size = -1; + //}}AFX_DATA_INIT + autoUpdate = false; + + autoUpdate = !regQueryDwordValue("memViewerAutoUpdate", 1); + OnAutoUpdate(); // FIXME: how to make this actually change the check mark? GetDlgItem(IDC_AUTO_UPDATE) returns NULL. + + decimalDisplay = !regQueryDwordValue("memViewerDecimalDisplay", 0); + OnDecimalDisplay(); // FIXME: how to make this actually change the check mark? GetDlgItem(IDC_DECIMAL_DISPLAY) returns NULL. +} + + +void MemoryViewerDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MemoryViewerDlg) + DDX_Control(pDX, IDC_CURRENT_ADDRESS, m_current); + DDX_Control(pDX, IDC_ADDRESS, m_address); + DDX_Control(pDX, IDC_ADDRESSES, m_addresses); + DDX_Check(pDX, IDC_AUTO_UPDATE, autoUpdate); + DDX_Check(pDX, IDC_DECIMALDISPLAY, decimalDisplay); + DDX_Radio(pDX, IDC_8_BIT, m_size); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_VIEWER, m_viewer); +} + + +BEGIN_MESSAGE_MAP(MemoryViewerDlg, CDialog) + //{{AFX_MSG_MAP(MemoryViewerDlg) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_REFRESH, OnRefresh) + ON_BN_CLICKED(IDC_8_BIT, On8Bit) + ON_BN_CLICKED(IDC_16_BIT, On16Bit) + ON_BN_CLICKED(IDC_32_BIT, On32Bit) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_DECIMALDISPLAY, OnDecimalDisplay) + ON_BN_CLICKED(IDC_GO, OnGo) + ON_CBN_SELCHANGE(IDC_ADDRESSES, OnSelchangeAddresses) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_LOAD, OnLoad) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// MemoryViewerDlg message handlers + +BOOL MemoryViewerDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_VIEWER, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_LOAD, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_AUTO_UPDATE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_DECIMALDISPLAY, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CURRENT_ADDRESS_LABEL, DS_MoveY | DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_CURRENT_ADDRESS, DS_MoveY | DS_MoveX) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\MemoryView", + NULL); + + m_viewer.setDialog(this); + m_viewer.ShowScrollBar(SB_VERT, TRUE); + m_viewer.EnableScrollBar(SB_VERT, ESB_ENABLE_BOTH); + + LPCTSTR s[] = { + "0x00000000 - BIOS", + "0x02000000 - WRAM", + "0x03000000 - IRAM", + "0x04000000 - I/O", + "0x05000000 - PALETTE", + "0x06000000 - VRAM", + "0x07000000 - OAM", + "0x08000000 - ROM" + }; + + for(int i = 0; i < 8; i++) + m_addresses.AddString(s[i]); + + m_addresses.SetCurSel(0); + + RECT cbSize; + int Height; + + m_addresses.GetClientRect(&cbSize); + Height = m_addresses.GetItemHeight(-1); + Height += m_addresses.GetItemHeight(0) * (9); + + // Note: The use of SM_CYEDGE assumes that we're using Windows '95 + // Now add on the height of the border of the edit box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // The height of the border of the drop-down box + Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges + + // now set the size of the window + m_addresses.SetWindowPos(NULL, + 0, 0, + cbSize.right, Height, + SWP_NOMOVE | SWP_NOZORDER); + + m_address.LimitText(8); + + m_size = regQueryDwordValue("memViewerDataSize", 1); + if(m_size < 0 || m_size > 2) + m_size = 0; + m_viewer.setSize(m_size); + UpdateData(FALSE); + + m_current.SetFont(CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT))); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MemoryViewerDlg::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +void MemoryViewerDlg::OnRefresh() +{ + m_viewer.Invalidate(); +} + +void MemoryViewerDlg::update() +{ + OnRefresh(); +} + + +void MemoryViewerDlg::On8Bit() +{ + m_viewer.setSize(0); + regSetDwordValue("memViewerDataSize", 0); +} + +void MemoryViewerDlg::On16Bit() +{ + m_viewer.setSize(1); + regSetDwordValue("memViewerDataSize", 1); +} + +void MemoryViewerDlg::On32Bit() +{ + m_viewer.setSize(2); + regSetDwordValue("memViewerDataSize", 2); +} + +void MemoryViewerDlg::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } + if(GetDlgItem(IDC_AUTO_UPDATE)) + ((CButton *)GetDlgItem(IDC_AUTO_UPDATE))->SetCheck(autoUpdate ? TRUE : FALSE); + regSetDwordValue("memViewerAutoUpdate", autoUpdate); +} + +void MemoryViewerDlg::OnDecimalDisplay() +{ + decimalDisplay = !decimalDisplay; + m_viewer.setDecimal(decimalDisplay ? true : false); + if(GetDlgItem(IDC_DECIMAL_DISPLAY)) + ((CButton *)GetDlgItem(IDC_DECIMAL_DISPLAY))->SetCheck(decimalDisplay ? TRUE : FALSE); + + regSetDwordValue("memViewerDecimalDisplay", decimalDisplay); +} + +void MemoryViewerDlg::OnGo() +{ + CString buffer; + + m_address.GetWindowText(buffer); + + u32 address; + sscanf(buffer, "%x", &address); + if(m_viewer.getSize() == 1) + address &= ~1; + else if(m_viewer.getSize() == 2) + address &= ~3; + m_viewer.setAddress(address); +} + +void MemoryViewerDlg::OnSelchangeAddresses() +{ + int cur = m_addresses.GetCurSel(); + + switch(cur) { + case 0: + m_viewer.setAddress(0); + break; + case 1: + m_viewer.setAddress(0x2000000); + break; + case 2: + m_viewer.setAddress(0x3000000); + break; + case 3: + m_viewer.setAddress(0x4000000); + break; + case 4: + m_viewer.setAddress(0x5000000); + break; + case 5: + m_viewer.setAddress(0x6000000); + break; + case 6: + m_viewer.setAddress(0x7000000); + break; + case 7: + m_viewer.setAddress(0x8000000); + break; + } +} + +void MemoryViewerDlg::setCurrentAddress(u32 address) +{ + CString buffer; + + buffer.Format("0x%08X", address); + m_current.SetWindowText(buffer); +} + +void MemoryViewerDlg::OnSave() +{ + MemoryViewerAddressSize dlg; + CString buffer; + + dlg.setAddress(m_viewer.getCurrentAddress()); + + LPCTSTR exts[] = { ".dmp" }; + + if(dlg.DoModal() == IDOK) { + CString filter = theApp.winLoadFilter(IDS_FILTER_DUMP); + CString title = winResLoadString(IDS_SELECT_DUMP_FILE); + + FileDlg file(this, + buffer, + filter, + 0, + "DMP", + exts, + "", + title, + true); + if(file.DoModal() == IDOK) { + buffer = file.GetPathName(); + + FILE *f = fopen(buffer, "wb"); + + if(f == NULL) { + systemMessage(IDS_ERROR_CREATING_FILE, buffer); + return; + } + + int size = dlg.getSize(); + u32 addr = dlg.getAddress(); + + for(int i = 0; i < size; i++) { + fputc(CPUReadByteQuick(addr), f); + addr++; + } + + fclose(f); + } + } +} + +void MemoryViewerDlg::OnLoad() +{ + CString buffer; + LPCTSTR exts[] = { ".dmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_DUMP); + CString title = winResLoadString(IDS_SELECT_DUMP_FILE); + + FileDlg file(this, + buffer, + filter, + 0, + "DMP", + exts, + "", + title, + false); + + if(file.DoModal() == IDOK) { + buffer = file.GetPathName(); + FILE *f = fopen(buffer, "rb"); + if(f == NULL) { + systemMessage(IDS_CANNOT_OPEN_FILE, + "Cannot open file %s", + buffer); + return; + } + + MemoryViewerAddressSize dlg; + + fseek(f, 0, SEEK_END); + int size = ftell(f); + + fseek(f, 0, SEEK_SET); + + dlg.setAddress(m_viewer.getCurrentAddress()); + dlg.setSize(size); + + if(dlg.DoModal() == IDOK) { + int size = dlg.getSize(); + u32 addr = dlg.getAddress(); + + for(int i = 0; i < size; i++) { + int c = fgetc(f); + if(c == -1) + break; + CPUWriteByteQuick(addr, c); + addr++; + } + OnRefresh(); + } + fclose(f); + } +} + +void MemoryViewerDlg::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/MemoryViewerDlg.h b/src/win32/MemoryViewerDlg.h new file mode 100644 index 0000000..6ee3bfc --- /dev/null +++ b/src/win32/MemoryViewerDlg.h @@ -0,0 +1,96 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MEMORYVIEWERDLG_H__15046D5B_D5A2_4C49_A969_2A77F803F2F1__INCLUDED_) +#define AFX_MEMORYVIEWERDLG_H__15046D5B_D5A2_4C49_A969_2A77F803F2F1__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MemoryViewerDlg.h : header file +// + +#include "MemoryViewer.h" +#include "ResizeDlg.h" +#include "IUpdate.h" + +class GBAMemoryViewer : public MemoryViewer { + public: + GBAMemoryViewer(); + virtual void readData(u32, int, u8 *); + virtual void editData(u32,int,int,u32); +}; + +///////////////////////////////////////////////////////////////////////////// +// MemoryViewerDlg dialog + +class MemoryViewerDlg : public ResizeDlg, IUpdateListener, IMemoryViewerDlg +{ + GBAMemoryViewer m_viewer; + // Construction + public: + void setCurrentAddress(u32 address); + int autoUpdate; + int decimalDisplay; + void update(); + MemoryViewerDlg(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(MemoryViewerDlg) + enum { IDD = IDD_MEM_VIEWER }; + CEdit m_current; + CEdit m_address; + CComboBox m_addresses; + int m_size; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(MemoryViewerDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(MemoryViewerDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + afx_msg void OnRefresh(); + afx_msg void On8Bit(); + afx_msg void On16Bit(); + afx_msg void On32Bit(); + afx_msg void OnAutoUpdate(); + afx_msg void OnDecimalDisplay(); + afx_msg void OnGo(); + afx_msg void OnSelchangeAddresses(); + afx_msg void OnSave(); + afx_msg void OnLoad(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MEMORYVIEWERDLG_H__15046D5B_D5A2_4C49_A969_2A77F803F2F1__INCLUDED_) diff --git a/src/win32/ModeConfirm.cpp b/src/win32/ModeConfirm.cpp new file mode 100644 index 0000000..6ac8803 --- /dev/null +++ b/src/win32/ModeConfirm.cpp @@ -0,0 +1,113 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// ModeConfirm.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "ModeConfirm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// ModeConfirm dialog + + +ModeConfirm::ModeConfirm(CWnd* pParent /*=NULL*/) + : CDialog(ModeConfirm::IDD, pParent) +{ + //{{AFX_DATA_INIT(ModeConfirm) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void ModeConfirm::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(ModeConfirm) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(ModeConfirm, CDialog) + //{{AFX_MSG_MAP(ModeConfirm) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + ON_WM_DESTROY() + ON_WM_TIMER() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// ModeConfirm message handlers + +void ModeConfirm::OnCancel() +{ + EndDialog(FALSE); +} + +void ModeConfirm::OnOk() +{ + EndDialog(TRUE); +} + +void ModeConfirm::OnDestroy() +{ + CDialog::OnDestroy(); + + KillTimer(timer); + timer = 0; +} + +BOOL ModeConfirm::OnInitDialog() +{ + CDialog::OnInitDialog(); + + timer = SetTimer(0, 1000, NULL); + + count = 10; + + CString buffer; + buffer.Format("%d", count); + + GetDlgItem(IDC_TIMER)->SetWindowText(buffer); + + CenterWindow(theApp.m_pMainWnd); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void ModeConfirm::OnTimer(UINT nIDEvent) +{ + CString buffer; + count--; + if(count == 0) + EndDialog(FALSE); + buffer.Format("%d", count); + GetDlgItem(IDC_TIMER)->SetWindowText(buffer); + + CDialog::OnTimer(nIDEvent); +} diff --git a/src/win32/ModeConfirm.h b/src/win32/ModeConfirm.h new file mode 100644 index 0000000..0e5a183 --- /dev/null +++ b/src/win32/ModeConfirm.h @@ -0,0 +1,71 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_MODECONFIRM_H__AF9F877E_6EDF_4523_95C9_1C745ABBA796__INCLUDED_) +#define AFX_MODECONFIRM_H__AF9F877E_6EDF_4523_95C9_1C745ABBA796__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ModeConfirm.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// ModeConfirm dialog + +class ModeConfirm : public CDialog +{ + // Construction + public: + int count; + UINT timer; + ModeConfirm(CWnd* pParent); // standard constructor + + // Dialog Data + //{{AFX_DATA(ModeConfirm) + enum { IDD = IDD_MODE_CONFIRM }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ModeConfirm) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(ModeConfirm) + afx_msg void OnCancel(); + afx_msg void OnOk(); + afx_msg void OnDestroy(); + virtual BOOL OnInitDialog(); + afx_msg void OnTimer(UINT nIDEvent); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MODECONFIRM_H__AF9F877E_6EDF_4523_95C9_1C745ABBA796__INCLUDED_) diff --git a/src/win32/MovieCreate.cpp b/src/win32/MovieCreate.cpp new file mode 100644 index 0000000..963b7e5 --- /dev/null +++ b/src/win32/MovieCreate.cpp @@ -0,0 +1,418 @@ +// MovieCreate.cpp : implementation file +// + +#include "stdafx.h" +#include "../GBA.h" +#include "MovieCreate.h" +#include "./moviecreate.h" +#include "../movie.h" +#include "mainwnd.h" +#include "filedlg.h" +#include "WinResUtil.h" +#include "VBA.h" +#include "../gb/gbGlobals.h" +#include "../Globals.h" +#include "../NLS.h" +#include "../Util.h" +#include "../GBAInline.h" + + +#define GBC_CAPABLE ((gbRom[0x143] & 0x80) != 0) +#define SGB_CAPABLE (gbRom[0x146] == 0x03) + + +// MovieCreate dialog + +IMPLEMENT_DYNAMIC(MovieCreate, CDialog) +MovieCreate::MovieCreate(CWnd* pParent /*=NULL*/) + : CDialog(MovieCreate::IDD, pParent) +{ + //{{AFX_DATA_INIT(MovieCreate) + m_startOption = 2; // "from start" as default + m_systemOption = theApp.cartridgeType == 0 ? 0 : (GBC_CAPABLE ? 1 : (SGB_CAPABLE ? 2 : 3)); // GBA, GBC, SGB, or GB + m_biosOption = theApp.cartridgeType == 0 ? (useBios ? 2 : 1) : 0; // none for non-GBA, or introless and based on settings + //}}AFX_DATA_INIT +} + +MovieCreate::~MovieCreate() +{ +} + +BOOL MovieCreate::OnInitDialog() +{ + CDialog::OnInitDialog(); + + GetDlgItem(IDC_RECRESET)->EnableWindow(theApp.cartridgeType == 0); /// FIXME / TEMP: from-SRAM of non-GBA games is broken + + GetDlgItem(IDC_REC_GBA)->EnableWindow(theApp.cartridgeType == 0); + GetDlgItem(IDC_REC_GBC)->EnableWindow(theApp.cartridgeType != 0 && GBC_CAPABLE); + GetDlgItem(IDC_REC_SGB)->EnableWindow(theApp.cartridgeType != 0 && SGB_CAPABLE); + GetDlgItem(IDC_REC_GB )->EnableWindow(theApp.cartridgeType != 0); + + GetDlgItem(IDC_REC_NOBIOS)->EnableWindow(theApp.cartridgeType != 0); + GetDlgItem(IDC_REC_EMUBIOS)->EnableWindow(theApp.cartridgeType == 0); + GetDlgItem(IDC_REC_GBABIOS)->EnableWindow(theApp.cartridgeType == 0); + GetDlgItem(IDC_REC_GBABIOSINTRO)->EnableWindow(theApp.cartridgeType == 0); + + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_NOBIOS + m_biosOption); + + m_editFilename.LimitText(_MAX_PATH); + m_editAuthor.LimitText(MOVIE_METADATA_AUTHOR_SIZE); + m_editDescription.LimitText(MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + + // convert the ROM filename into a default movie name + { + extern char *regQueryStringValue(const char * key, char *def); // from Reg.cpp + CString capdir = regQueryStringValue("moviesDir", ""); + + if(capdir.IsEmpty()) + capdir = ((MainWnd *)theApp.m_pMainWnd)->getDirFromFile(theApp.filename); + + char str [_MAX_PATH]; + strcpy(str, theApp.filename); + strcat(str, ".vbm"); + char * strPtr = strrchr(str, (int)'\\'); + if(strPtr == NULL) + strPtr = str; + + capdir += strPtr; + movieName = capdir; + + GetDlgItem(IDC_MOVIE_FILENAME)->SetWindowText(movieName); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MovieCreate::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MovieCreate) + DDX_Radio(pDX, IDC_RECNOW, m_startOption); + DDX_Radio(pDX, IDC_REC_GBA, m_systemOption); +/// done manually DDX_Radio(pDX, IDC_REC_NOBIOS, m_biosOption); + DDX_Control(pDX, IDC_EDIT_AUTHOR, m_editAuthor); + DDX_Control(pDX, IDC_EDIT_DESCRIPTION, m_editDescription); + DDX_Control(pDX, IDC_MOVIE_FILENAME, m_editFilename); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(MovieCreate, CDialog) + ON_BN_CLICKED(IDOK, OnBnClickedOk) + ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel) + ON_BN_CLICKED(IDC_BROWSE, OnBnClickedBrowse) + ON_BN_CLICKED(IDC_RECSTART, OnBnClickedRecstart) + ON_BN_CLICKED(IDC_RECRESET, OnBnClickedRecreset) + ON_BN_CLICKED(IDC_RECNOW, OnBnClickedRecnow) + ON_BN_CLICKED(IDC_REC_GBA, OnBnClickedRecGba) + ON_BN_CLICKED(IDC_REC_GBC, OnBnClickedRecGbc) + ON_BN_CLICKED(IDC_REC_SGB, OnBnClickedRecSgb) + ON_BN_CLICKED(IDC_REC_GB, OnBnClickedRecGb) + ON_BN_CLICKED(IDC_REC_NOBIOS, OnBnClickedRecNobios) + ON_BN_CLICKED(IDC_REC_EMUBIOS, OnBnClickedRecEmubios) + ON_BN_CLICKED(IDC_REC_GBABIOS, OnBnClickedRecGbabios) + ON_BN_CLICKED(IDC_REC_GBABIOSINTRO, OnBnClickedRecGbabiosintro) +END_MESSAGE_MAP() + + +// MovieCreate message handlers + +void MovieCreate::OnBnClickedBrowse() +{ + theApp.winCheckFullscreen(); + CString captureBuffer; + extern char *regQueryStringValue(const char * key, char *def); // from Reg.cpp + CString capdir = regQueryStringValue("moviesDir", ""); + + if(capdir.IsEmpty()) + capdir = ((MainWnd *)theApp.m_pMainWnd)->getDirFromFile(theApp.filename); + + CString filter = theApp.winLoadFilter(IDS_FILTER_MOVIE); + CString title = winResLoadString(IDS_SELECT_MOVIE_NAME); + + LPCTSTR exts[] = { ".vbm" }; + + FileDlg dlg(this, "", filter, 1, "vbm", exts, capdir, title, true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + movieName = dlg.GetPathName(); + captureBuffer = movieName; + + if(dlg.m_ofn.nFileOffset > 0) { + captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset); + } + + int len = captureBuffer.GetLength(); + + if(len > 3 && captureBuffer[len-1] == '\\') + captureBuffer = captureBuffer.Left(len-1); + + extern void regSetStringValue(const char * key, const char * value); // from Reg.cpp + regSetStringValue("moviesDir", captureBuffer); + + GetDlgItem(IDC_MOVIE_FILENAME)->SetWindowText(movieName); +} + +void loadBIOS() +{ + if(bios == NULL) + return; + + useBios = false; + if(theApp.useBiosFile) + { + int size = 0x4000; + extern bool CPUIsGBABios(const char * file); + if(utilLoad(theApp.biosFileName, + CPUIsGBABios, + bios, + size)) { + if(size == 0x4000) + useBios = true; + } + } + if(!useBios) { + memcpy(bios, myROM, /*sizeof(myROM)*/0x4000); // copy internal emulator BIOS + theApp.useBiosFile = false; + } +} + +bool checkBIOS(CString & biosFileName) +{ + if(biosFileName.IsEmpty()) + return false; + + bool ok = false; + u8 * tempBIOS = (u8 *)malloc(0x4000); + int size = 0x4000; + extern bool CPUIsGBABios(const char * file); + if(utilLoad(biosFileName, + CPUIsGBABios, + tempBIOS, + size)) { + if(size == 0x4000) + ok = true; + else + systemMessage(MSG_INVALID_BIOS_FILE_SIZE, N_("Invalid BIOS file size")); + } + free(tempBIOS); + return ok; +} + +void MovieCreate::OnBnClickedOk() +{ + int startFlags=0, controllerFlags=0, typeFlags=0; + + if(m_startOption == 0) + startFlags |= MOVIE_START_FROM_SNAPSHOT; + else if(m_startOption == 1) + startFlags |= MOVIE_START_FROM_SRAM; + //else + // startFlags = 0; // no SRAM or snapshot + + if(m_systemOption == 0) + typeFlags |= MOVIE_TYPE_GBA, gbEmulatorType = 4; + else if(m_systemOption == 1) + typeFlags |= MOVIE_TYPE_GBC, gbEmulatorType = 1; + else if(m_systemOption == 2) + typeFlags |= MOVIE_TYPE_SGB, gbEmulatorType = 2; + else + gbEmulatorType = 3; // plain old GB + + controllerFlags |= MOVIE_CONTROLLER(0); + if(typeFlags & MOVIE_TYPE_SGB) + { + // XXX FIXME - the code for multiple controllers must be broken somehow + // (it crashes strangely during FreezeToStream in SGB games) + + // SGB games are free to request controllers while running, so we have to assume it needs all 4 +/// controllerFlags |= MOVIE_CONTROLLER(1) | MOVIE_CONTROLLER(2) | MOVIE_CONTROLLER(3); + } + + if(m_biosOption == 1) + theApp.useBiosFile = false; + if(m_biosOption == 2) + theApp.useBiosFile = true, theApp.skipBiosFile = true, loadBIOS(); + if(m_biosOption == 3) + theApp.useBiosFile = true, theApp.skipBiosFile = false, loadBIOS(); + + // get author and movie info from the edit fields: + char info [MOVIE_METADATA_SIZE], buffer [MOVIE_METADATA_SIZE]; + + GetDlgItem(IDC_EDIT_AUTHOR)->GetWindowText(buffer, MOVIE_METADATA_AUTHOR_SIZE); + strncpy(info, buffer, MOVIE_METADATA_AUTHOR_SIZE); + info[MOVIE_METADATA_AUTHOR_SIZE-1] = '\0'; + + GetDlgItem(IDC_EDIT_DESCRIPTION)->GetWindowText(buffer, MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + strncpy(info + MOVIE_METADATA_AUTHOR_SIZE, buffer, MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + info[MOVIE_METADATA_SIZE-1] = '\0'; + + + if(memLagTempEnabled && theApp.cartridgeType == 0) + { + // lag reduction is off -- if the user didn't turn it off, silently turn it back on, otherwise ask + int ans = !memLagEnabled ? IDYES : AfxGetApp()->m_pMainWnd->MessageBox("Lag reduction is currently OFF.\nIt is recommended that you turn this ON for recording.\nWould you like to turn it on now?", "Warning", MB_YESNOCANCEL|MB_ICONWARNING); + switch(ans) + { + case IDYES: + extern void SetPrefetchHack(bool); + SetPrefetchHack(true); + break; + case IDNO: break; + case IDCANCEL: return; + } + } + + + GetDlgItem(IDC_MOVIE_FILENAME)->GetWindowText(movieName); + + // actually make the movie file: + int code = VBAMovieCreate(movieName, info, startFlags, controllerFlags, typeFlags); + + if(code != SUCCESS) + { + systemMessage(0, "Failed to create movie %s", (const char *)movieName); + return; + } + + + OnOK(); +} + +void MovieCreate::OnBnClickedCancel() +{ + OnCancel(); +} + +void MovieCreate::OnBnClickedRecstart() +{ + m_startOption = 2; + if(theApp.cartridgeType == 0) + { + GetDlgItem(IDC_REC_EMUBIOS)->EnableWindow(TRUE); + GetDlgItem(IDC_REC_GBABIOSINTRO)->EnableWindow(TRUE); + } + else + { + GetDlgItem(IDC_REC_GBC)->EnableWindow(GBC_CAPABLE); + GetDlgItem(IDC_REC_SGB)->EnableWindow(SGB_CAPABLE); + GetDlgItem(IDC_REC_GB )->EnableWindow(TRUE); + } +} + +void MovieCreate::OnBnClickedRecreset() +{ + m_startOption = 1; + if(theApp.cartridgeType == 0) + { + GetDlgItem(IDC_REC_EMUBIOS)->EnableWindow(TRUE); + GetDlgItem(IDC_REC_GBABIOSINTRO)->EnableWindow(TRUE); + } + else + { + GetDlgItem(IDC_REC_GBC)->EnableWindow(GBC_CAPABLE); + GetDlgItem(IDC_REC_SGB)->EnableWindow(SGB_CAPABLE); + GetDlgItem(IDC_REC_GB )->EnableWindow(TRUE); + } +} + +void MovieCreate::OnBnClickedRecnow() +{ + m_startOption = 0; + + // starting from emulator bios file from a snapshot made while playing with GBA bios file won't work + if(theApp.cartridgeType == 0 && useBios) + { + if(m_biosOption == 1) + { + OnBnClickedRecGbabios(); + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_NOBIOS + m_biosOption); + } + GetDlgItem(IDC_REC_EMUBIOS)->EnableWindow(FALSE); + } + + // "with intro" distinction makes no sense when continuing from snapshot + if(theApp.cartridgeType == 0) + { + if(m_biosOption == 3) + { + OnBnClickedRecGbabios(); + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_NOBIOS + m_biosOption); + } + GetDlgItem(IDC_REC_GBABIOSINTRO)->EnableWindow(FALSE); + } + + // can't switch systems while recording from snapshot! + if(theApp.cartridgeType != 0) + { + int curSystemOption = (gbCgbMode==1 ? 1 : (gbSgbMode==1 ? 2 : 3)); // GBC, SGB, or GB + GetDlgItem(IDC_REC_GBC)->EnableWindow(curSystemOption == 1); + GetDlgItem(IDC_REC_SGB)->EnableWindow(curSystemOption == 2); + GetDlgItem(IDC_REC_GB)->EnableWindow(curSystemOption == 3); + m_systemOption = curSystemOption; + CheckRadioButton(IDC_REC_GBA, IDC_REC_GB, IDC_REC_GBA + m_systemOption); + } +} + +void MovieCreate::OnBnClickedRecGba() +{ + m_systemOption = 0; +} + +void MovieCreate::OnBnClickedRecGbc() +{ + m_systemOption = 1; +} + +void MovieCreate::OnBnClickedRecSgb() +{ + m_systemOption = 2; +} + +void MovieCreate::OnBnClickedRecGb() +{ + m_systemOption = 3; +} + +void MovieCreate::OnBnClickedRecNobios() +{ + m_biosOption = 0; +} + +void MovieCreate::OnBnClickedRecEmubios() +{ + m_biosOption = 1; +} + +void MovieCreate::OnBnClickedRecGbabios() +{ + if(checkBIOS(theApp.biosFileName)) + m_biosOption = 2; + else + { + ((MainWnd *)theApp.m_pMainWnd)->OnOptionsEmulatorSelectbiosfile(); + if(checkBIOS(theApp.biosFileName)) + m_biosOption = 2; + else + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_EMUBIOS); + } +} + +void MovieCreate::OnBnClickedRecGbabiosintro() +{ + if(checkBIOS(theApp.biosFileName)) + m_biosOption = 3; + else + { + ((MainWnd *)theApp.m_pMainWnd)->OnOptionsEmulatorSelectbiosfile(); + if(checkBIOS(theApp.biosFileName)) + m_biosOption = 3; + else + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_EMUBIOS); + } +} diff --git a/src/win32/MovieCreate.h b/src/win32/MovieCreate.h new file mode 100644 index 0000000..35b2297 --- /dev/null +++ b/src/win32/MovieCreate.h @@ -0,0 +1,48 @@ +#pragma once + + +// MovieCreate dialog + +class MovieCreate : public CDialog +{ + DECLARE_DYNAMIC(MovieCreate) + +public: + MovieCreate(CWnd* pParent = NULL); // standard constructor + virtual ~MovieCreate(); + + virtual BOOL OnInitDialog() ; + +// Dialog Data + //{{AFX_DATA(MovieCreate) + enum { IDD = IDD_MOVIECREATE }; + int m_startOption; + int m_systemOption; + int m_biosOption; + CEdit m_editAuthor; + CEdit m_editDescription; + CEdit m_editFilename; + //}}AFX_DATA + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnBnClickedOk(); + afx_msg void OnBnClickedCancel(); + afx_msg void OnBnClickedBrowse(); + + CString movieName; + afx_msg void OnBnClickedRecstart(); + afx_msg void OnBnClickedRecreset(); + afx_msg void OnBnClickedRecnow(); + afx_msg void OnBnClickedRecGba(); + afx_msg void OnBnClickedRecGbc(); + afx_msg void OnBnClickedRecSgb(); + afx_msg void OnBnClickedRecGb(); + afx_msg void OnBnClickedRecNobios(); + afx_msg void OnBnClickedRecEmubios(); + afx_msg void OnBnClickedRecGbabios(); + afx_msg void OnBnClickedRecGbabiosintro(); +}; diff --git a/src/win32/MovieOpen.cpp b/src/win32/MovieOpen.cpp new file mode 100644 index 0000000..486c17d --- /dev/null +++ b/src/win32/MovieOpen.cpp @@ -0,0 +1,522 @@ +// MovieOpen.cpp : implementation file +// + +#include "stdafx.h" +#include "../GBA.h" +#include "MovieOpen.h" +#include "../movie.h" +#include "mainwnd.h" +#include "filedlg.h" +#include "WinResUtil.h" +#include "VBA.h" +#include "time.h" +#include "../gb/gbGlobals.h" +#include "../Util.h" +#include "../GBAinline.h" +#include ".\movieopen.h" + + + +// MovieOpen dialog + +IMPLEMENT_DYNAMIC(MovieOpen, CDialog) +MovieOpen::MovieOpen(CWnd* pParent /*=NULL*/) + : CDialog(MovieOpen::IDD, pParent) +{ +} + +MovieOpen::~MovieOpen() +{ +} + +BOOL MovieOpen::OnInitDialog() +{ + CDialog::OnInitDialog(); + + GetDlgItem(IDC_CHECK_HIDEBORDER)->ShowWindow(FALSE); + GetDlgItem(IDC_LABEL_WARNING1)->SetWindowText(""); + GetDlgItem(IDC_LABEL_WARNING2)->SetWindowText(""); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->SetWindowText(""); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->EnableWindow(FALSE); + GetDlgItem(IDC_CHECK_PAUSEFRAME)->EnableWindow(FALSE); + + CheckDlgButton(IDC_READONLY, theApp.movieReadOnly); + m_editDescription.SetReadOnly(theApp.movieReadOnly); + + // convert the ROM filename into a default movie name + { + extern char *regQueryStringValue(const char * key, char *def); // from Reg.cpp + CString capdir = regQueryStringValue("moviesDir", ""); + + if(capdir.IsEmpty()) + capdir = ((MainWnd *)theApp.m_pMainWnd)->getDirFromFile(theApp.filename); + + char str [_MAX_PATH]; + strcpy(str, theApp.filename); + strcat(str, ".vbm"); + char * strPtr = strrchr(str, (int)'\\'); + if(strPtr == NULL) + strPtr = str; + + movieName = capdir + strPtr; + + GetDlgItem(IDC_MOVIE_FILENAME)->SetWindowText(movieName); + } + + m_editFilename.LimitText(_MAX_PATH); + m_editAuthor.LimitText(MOVIE_METADATA_AUTHOR_SIZE); + m_editDescription.LimitText(MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + m_editPauseFrame.LimitText(8); + + OnBnClickedMovieRefresh(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void MovieOpen::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(MovieCreate) + DDX_Control(pDX, IDC_EDIT_AUTHOR, m_editAuthor); + DDX_Control(pDX, IDC_EDIT_DESCRIPTION, m_editDescription); + DDX_Control(pDX, IDC_MOVIE_FILENAME, m_editFilename); + DDX_Control(pDX, IDC_EDIT_PAUSEFRAME, m_editPauseFrame); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(MovieOpen, CDialog) + ON_BN_CLICKED(IDC_BROWSE, OnBnClickedBrowse) + ON_BN_CLICKED(IDOK, OnBnClickedOk) + ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel) + ON_BN_CLICKED(IDC_MOVIE_REFRESH, OnBnClickedMovieRefresh) + ON_BN_CLICKED(IDC_READONLY, OnBnClickedReadonly) + ON_BN_CLICKED(IDC_CHECK_PAUSEFRAME, OnBnClickedCheckPauseframe) + ON_BN_CLICKED(IDC_CHECK_HIDEBORDER, OnBnClickedHideborder) + ON_EN_CHANGE(IDC_MOVIE_FILENAME, OnEnChangeMovieFilename) +END_MESSAGE_MAP() + + +// MovieOpen message handlers + +void MovieOpen::OnBnClickedBrowse() +{ + extern char *regQueryStringValue(const char * key, char *def); // from Reg.cpp + CString capdir = regQueryStringValue("moviesDir", ""); + + if(capdir.IsEmpty()) + capdir = ((MainWnd *)theApp.m_pMainWnd)->getDirFromFile(theApp.filename); + + CString filter = theApp.winLoadFilter(IDS_FILTER_MOVIE); + CString title = winResLoadString(IDS_SELECT_MOVIE_NAME); + + LPCTSTR exts[] = { ".vbm" }; + + FileDlg dlg(this, "", filter, 1, "vbm", exts, capdir, title, false, true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + movieName = dlg.GetPathName(); + + GetDlgItem(IDC_MOVIE_FILENAME)->SetWindowText(movieName); + + OnBnClickedMovieRefresh(); +} + +// returns the checksum of the BIOS that will be loaded after the next restart +u16 checksumBIOS() +{ + bool hasBIOS = false; + u8 * tempBIOS; + if(theApp.useBiosFile) + { + tempBIOS = (u8 *)malloc(0x4000); + int size = 0x4000; + extern bool CPUIsGBABios(const char * file); + if(utilLoad(theApp.biosFileName, + CPUIsGBABios, + tempBIOS, + size)) { + if(size == 0x4000) + hasBIOS = true; + } + } + + u16 biosCheck = 0; + if(hasBIOS) { + for(int i = 0; i < 0x4000; i += 4) + biosCheck += *((u32 *)&tempBIOS[i]); + free(tempBIOS); + } + + return biosCheck; +} + +void fillRomInfo(const SMovie & movieInfo, char romTitle [12], uint32 & romGameCode, uint16 & checksum, uint8 & crc) +{ + if(theApp.cartridgeType == 0) // GBA + { + extern u8 *bios, *rom; + memcpy(romTitle, (const char *)&rom[0xa0], 12); // GBA TITLE + memcpy(&romGameCode, &rom[0xac], 4); // GBA ROM GAME CODE + + bool prevUseBiosFile = theApp.useBiosFile; + theApp.useBiosFile = (movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) != 0; + checksum = checksumBIOS(); // GBA BIOS CHECKSUM + theApp.useBiosFile = prevUseBiosFile; + crc = rom[0xbd]; // GBA ROM CRC + } + else // non-GBA + { + extern u8 *gbRom; + memcpy(romTitle, (const char *)&gbRom[0x134], 12); // GB TITLE (note this can be 15 but is truncated to 12) + romGameCode = (uint32)gbRom[0x146]; // GB ROM UNIT CODE + + checksum = (gbRom[0x14e]<<8)|gbRom[0x14f]; // GB ROM CHECKSUM + crc = gbRom[0x14d]; // GB ROM CRC + } +} + +void MovieOpen::OnBnClickedMovieRefresh() +{ + GetDlgItem(IDC_MOVIE_FILENAME)->GetWindowText(movieName); + if(VBAMovieGetInfo(movieName, &movieInfo) == SUCCESS) + { + if(movieInfo.readOnly) + { + CheckDlgButton(IDC_READONLY, TRUE); + m_editDescription.SetReadOnly(TRUE); + } + + char buffer [MOVIE_METADATA_SIZE]; + + strncpy(buffer, movieInfo.authorInfo, MOVIE_METADATA_AUTHOR_SIZE); + buffer[MOVIE_METADATA_AUTHOR_SIZE - 1] = '\0'; + GetDlgItem(IDC_EDIT_AUTHOR)->SetWindowText(buffer); + + strncpy(buffer, movieInfo.authorInfo + MOVIE_METADATA_AUTHOR_SIZE, MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + buffer[MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE - 1] = '\0'; + GetDlgItem(IDC_EDIT_DESCRIPTION)->SetWindowText(buffer); + + int option = 2; + if(movieInfo.header.startFlags & MOVIE_START_FROM_SRAM) + option = 1; + if(movieInfo.header.startFlags & MOVIE_START_FROM_SNAPSHOT) + option = 0; + CheckRadioButton(IDC_RECNOW, IDC_RECSTART, IDC_RECNOW + option); + + option = 3; + if(movieInfo.header.typeFlags & MOVIE_TYPE_SGB) + option = 2; + if(movieInfo.header.typeFlags & MOVIE_TYPE_GBC) + option = 1; + if(movieInfo.header.typeFlags & MOVIE_TYPE_GBA) + option = 0; + CheckRadioButton(IDC_REC_GBA, IDC_REC_GB, IDC_REC_GBA + option); + + GetDlgItem(IDC_CHECK_HIDEBORDER)->ShowWindow(option == 2 ? TRUE : FALSE); + + + if(movieInfo.header.typeFlags & MOVIE_TYPE_GBA) + { + if(movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) + { + if(movieInfo.header.optionFlags & MOVIE_SETTING_SKIPBIOSFILE) + option = 2; + else + option = 3; + } + else + option = 1; + } + else + option = 0; + + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, IDC_REC_NOBIOS + option); + + + { + char* p; + time_t ttime = (time_t)movieInfo.header.uid; + strncpy(buffer, ctime(&ttime), 127); + buffer[127]='\0'; + if((p=strrchr(buffer, '\n'))) + *p='\0'; + GetDlgItem(IDC_LABEL_DATE)->SetWindowText(buffer); + + uint32 div = 60; + uint32 l=(movieInfo.header.length_frames+(div>>1))/div; + uint32 seconds=l%60; + l/=60; + uint32 minutes=l%60; + l/=60; + uint32 hours=l%60; + sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds); + GetDlgItem(IDC_LABEL_LENGTH)->SetWindowText(buffer); + sprintf(buffer, "%ld", movieInfo.header.length_frames); + GetDlgItem(IDC_LABEL_FRAMES)->SetWindowText(buffer); + sprintf(buffer, "%ld", movieInfo.header.rerecord_count); + GetDlgItem(IDC_LABEL_RERECORD)->SetWindowText(buffer); + } + + { + char warning1 [1024], warning2 [1024], buffer [1024]; + + strcpy(warning1, ""); + strcpy(warning2, ""); + + char romTitle [12]; + uint32 romGameCode; + uint16 checksum; + uint8 crc; + + fillRomInfo(movieInfo, romTitle, romGameCode, checksum, crc); + + // rather than treat these as warnings, might as well always show the info in the dialog (it's probably more informative and reassuring) +/// if(strncmp(movieInfo.header.romTitle,romTitle,12) != 0) + { + char str [13]; + strncpy(str, movieInfo.header.romTitle, 12); + str[12] = '\0'; + sprintf(buffer, "title=%s ", str); + strcat(warning1, buffer); + + strncpy(str, romTitle, 12); + str[12] = '\0'; + sprintf(buffer, "title=%s ", str); + strcat(warning2, buffer); + } +/// if(((movieInfo.header.typeFlags & MOVIE_TYPE_GBA)!=0) != (theApp.cartridgeType == 0)) + { + sprintf(buffer, "type=%s ", (movieInfo.header.typeFlags&MOVIE_TYPE_GBA) ? "GBA" : (movieInfo.header.typeFlags&MOVIE_TYPE_GBC) ? "GBC" : (movieInfo.header.typeFlags&MOVIE_TYPE_SGB) ? "SGB" : "GB"); + strcat(warning1, buffer); + + sprintf(buffer, "type=%s ", theApp.cartridgeType == 0 ? "GBA" : (gbRom[0x143] & 0x80 ? "GBC" : (gbRom[0x146] == 0x03 ? "SGB" : "GB")) ); + strcat(warning2, buffer); + } +/// if(movieInfo.header.romCRC != crc) + { + sprintf(buffer, "crc=%02d ", movieInfo.header.romCRC); + strcat(warning1, buffer); + + sprintf(buffer, "crc=%02d ", crc); + strcat(warning2, buffer); + } +/// if(movieInfo.header.romGameCode != romGameCode) + { + char code [5]; + if(movieInfo.header.typeFlags&MOVIE_TYPE_GBA) + { + memcpy(code, &movieInfo.header.romGameCode, 4); + code[4] = '\0'; + sprintf(buffer, "code=%s ", code); + strcat(warning1, buffer); + } + + if(theApp.cartridgeType == 0) + { + memcpy(code, &romGameCode, 4); + code[4] = '\0'; + sprintf(buffer, "code=%s ", code); + strcat(warning2, buffer); + } + } +/// if(movieInfo.header.romOrBiosChecksum != checksum && !((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE)==0 && checksum==0)) + { + sprintf(buffer, movieInfo.header.typeFlags&MOVIE_TYPE_GBA ? ((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE)==0 ? "(bios=none) " : "(bios=%d) ") : "check=%d ", movieInfo.header.romOrBiosChecksum); + strcat(warning1, buffer); + + sprintf(buffer, checksum==0 ? "(bios=none) " : theApp.cartridgeType == 0 ? "(bios=%d) " : "check=%d ", checksum); + strcat(warning2, buffer); + } + + if(strlen(warning1) > 0) + { + sprintf(buffer, "Movie ROM: %s", warning1); + GetDlgItem(IDC_LABEL_WARNING1)->SetWindowText(buffer); + + sprintf(buffer, "Your ROM: %s", warning2); + + //if(movieInfo.header.romCRC != crc + //|| strncmp(movieInfo.header.romTitle,romTitle,12) != 0 + //|| movieInfo.header.romOrBiosChecksum != checksum && !((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE)==0 && checksum==0)) + // strcat(buffer, "<-- MISMATCH"); + + GetDlgItem(IDC_LABEL_WARNING2)->SetWindowText(buffer); + } + else + { + GetDlgItem(IDC_LABEL_WARNING1)->SetWindowText("(No problems detected)"); + GetDlgItem(IDC_LABEL_WARNING2)->SetWindowText(" "); + } + } + GetDlgItem(IDC_CHECK_PAUSEFRAME)->EnableWindow(TRUE); + } + else + { + GetDlgItem(IDC_LABEL_DATE)->SetWindowText(" "); + GetDlgItem(IDC_LABEL_LENGTH)->SetWindowText(" "); + GetDlgItem(IDC_LABEL_FRAMES)->SetWindowText(" "); + GetDlgItem(IDC_LABEL_RERECORD)->SetWindowText(" "); + GetDlgItem(IDC_EDIT_AUTHOR)->SetWindowText(" "); + GetDlgItem(IDC_EDIT_DESCRIPTION)->SetWindowText(" "); + GetDlgItem(IDC_LABEL_WARNING1)->SetWindowText(" "); + GetDlgItem(IDC_LABEL_WARNING2)->SetWindowText(" "); + + GetDlgItem(IDC_EDIT_PAUSEFRAME)->SetWindowText(""); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->EnableWindow(FALSE); + GetDlgItem(IDC_CHECK_PAUSEFRAME)->EnableWindow(FALSE); + CheckDlgButton(IDC_CHECK_PAUSEFRAME, FALSE); +/* + /// FIXME: how to un-check all the radio buttons? + CheckRadioButton(IDC_RECNOW, IDC_RECSTART, -1); + CheckRadioButton(IDC_REC_GBA, IDC_REC_GB, -1); + CheckRadioButton(IDC_REC_NOBIOS, IDC_REC_GBABIOSINTRO, -1);*/ + } +} + +BOOL MovieOpen::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *res) +{ + switch( msg ) { + case WM_CTLCOLORSTATIC: + { + //HWND hwndDlg = GetSafeHwnd(); + HWND warnDlg = NULL; + GetDlgItem(IDC_LABEL_WARNING2, &warnDlg); + + if((HWND)lParam == warnDlg) + { + char romTitle [12]; + uint32 romGameCode; + uint16 checksum; + uint8 crc; + + fillRomInfo(movieInfo, romTitle, romGameCode, checksum, crc); + + if(movieInfo.header.romCRC != crc + || strncmp(movieInfo.header.romTitle,romTitle,12) != 0 + || movieInfo.header.romOrBiosChecksum != checksum + && !((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) == 0 && checksum==0)) + { + // draw the md5 sum in red if it's different from the md5 of the rom used in the replay + HDC hdcStatic = (HDC)wParam; + SetTextColor(hdcStatic, RGB(255,0,0)); // use red for a mismatch + + // I'm not sure why this doesn't work to make the background transparent... it turns white anyway + SetBkMode(hdcStatic, TRANSPARENT); + return (LONG)GetStockObject(NULL_BRUSH); + } + } + return FALSE; + } + } + return CDialog::OnWndMsg(msg, wParam, lParam, res); +} + +void MovieOpen::OnBnClickedOk() +{ + theApp.useBiosFile = (movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) != 0; + if(theApp.useBiosFile) + { + extern bool checkBIOS(CString & biosFileName); // from MovieCreate.cpp + if(!checkBIOS(theApp.biosFileName)) + { + systemMessage(0, "This movie requires a valid GBA BIOS file to play.\nPlease locate a BIOS file."); + ((MainWnd *)theApp.m_pMainWnd)->OnOptionsEmulatorSelectbiosfile(); + if(!checkBIOS(theApp.biosFileName)) + { + systemMessage(0, "\"%s\" is not a valid BIOS file; cannot play movie without one.", theApp.biosFileName); + return; + } + } + } + extern void loadBIOS(); + loadBIOS(); + + + int code = VBAMovieOpen(movieName, IsDlgButtonChecked(IDC_READONLY)); + + + if(code != SUCCESS) + { + if(code == FILE_NOT_FOUND) + systemMessage(0, "Could not find movie file \"%s\".", (const char *)movieName); + else if(code == WRONG_FORMAT) + systemMessage(0, "Movie file \"%s\" is not in proper VBM format.", (const char *)movieName); + else if(code == WRONG_VERSION) + systemMessage(0, "Movie file \"%s\" is not a supported version.", (const char *)movieName); + else + systemMessage(0, "Failed to open movie \"%s\".", (const char *)movieName); + return; + } + else + { + // get author and movie info from the edit fields (the description might change): + char info [MOVIE_METADATA_SIZE], buffer [MOVIE_METADATA_SIZE]; + + GetDlgItem(IDC_EDIT_AUTHOR)->GetWindowText(buffer, MOVIE_METADATA_AUTHOR_SIZE); + strncpy(info, buffer, MOVIE_METADATA_AUTHOR_SIZE); + info[MOVIE_METADATA_AUTHOR_SIZE-1] = '\0'; + + GetDlgItem(IDC_EDIT_DESCRIPTION)->GetWindowText(buffer, MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + strncpy(info + MOVIE_METADATA_AUTHOR_SIZE, buffer, MOVIE_METADATA_SIZE - MOVIE_METADATA_AUTHOR_SIZE); + info[MOVIE_METADATA_SIZE-1] = '\0'; + + VBAMovieSetMetadata(info); + } + + if(IsDlgButtonChecked(IDC_CHECK_PAUSEFRAME)) + { + char buffer [9]; + GetDlgItem(IDC_EDIT_PAUSEFRAME)->GetWindowText(buffer, 8); + buffer[8] = '\0'; + + int pauseFrame = atoi(buffer); + if(pauseFrame >= 0) + VBAMovieSetPauseAt(pauseFrame); + } + + OnOK(); +} + +void MovieOpen::OnBnClickedCancel() +{ + OnCancel(); +} + +void MovieOpen::OnBnClickedReadonly() +{ + theApp.movieReadOnly = IsDlgButtonChecked(IDC_READONLY) != 0; + m_editDescription.SetReadOnly(theApp.movieReadOnly); + OnBnClickedMovieRefresh(); +} + +void MovieOpen::OnBnClickedCheckPauseframe() +{ + if(IsDlgButtonChecked(IDC_CHECK_PAUSEFRAME)) + { + char buffer [8]; + _itoa(movieInfo.header.length_frames, buffer, 10); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->SetWindowText(buffer); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->EnableWindow(TRUE); + } + else + { + GetDlgItem(IDC_EDIT_PAUSEFRAME)->SetWindowText(""); + GetDlgItem(IDC_EDIT_PAUSEFRAME)->EnableWindow(FALSE); + } +} + + +void MovieOpen::OnBnClickedHideborder() +{ + theApp.hideMovieBorder = IsDlgButtonChecked(IDC_CHECK_HIDEBORDER) != 0; +} + +void MovieOpen::OnEnChangeMovieFilename() +{ + OnBnClickedMovieRefresh(); +} diff --git a/src/win32/MovieOpen.h b/src/win32/MovieOpen.h new file mode 100644 index 0000000..ec927ab --- /dev/null +++ b/src/win32/MovieOpen.h @@ -0,0 +1,46 @@ +#pragma once + + +#include "..\movie.h" + +// MovieOpen dialog + +class MovieOpen : public CDialog +{ + DECLARE_DYNAMIC(MovieOpen) + +public: + MovieOpen(CWnd* pParent = NULL); // standard constructor + virtual ~MovieOpen(); + + virtual BOOL OnInitDialog() ; + +// Dialog Data + //{{AFX_DATA(MovieOpen) + enum { IDD = IDD_MOVIEOPEN }; + CEdit m_editAuthor; + CEdit m_editDescription; + CEdit m_editFilename; + CEdit m_editPauseFrame; + CString movieName; + SMovie movieInfo; + int pauseFrame; + //}}AFX_DATA + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnBnClickedBrowse(); + afx_msg void OnBnClickedOk(); + afx_msg void OnBnClickedCancel(); + afx_msg void OnBnClickedMovieRefresh(); + afx_msg void OnBnClickedReadonly(); + afx_msg void OnBnClickedCheckPauseframe(); + + afx_msg void OnBnClickedHideborder(); + + virtual BOOL OnWndMsg(UINT, WPARAM, LPARAM, LRESULT *); + afx_msg void OnEnChangeMovieFilename(); +}; diff --git a/src/win32/OamView.cpp b/src/win32/OamView.cpp new file mode 100644 index 0000000..13c233a --- /dev/null +++ b/src/win32/OamView.cpp @@ -0,0 +1,669 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// OamView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "OamView.h" +#include "Reg.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../NLS.h" +#include "../Util.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// OamView dialog + + +OamView::OamView(CWnd* pParent /*=NULL*/) + : ResizeDlg(OamView::IDD, pParent) +{ + //{{AFX_DATA_INIT(OamView) + m_stretch = FALSE; + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 32; + bmpInfo.bmiHeader.biHeight = 32; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 64 * 64); + + oamView.setData(data); + oamView.setBmpInfo(&bmpInfo); + + number = 0; +} + + +void OamView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(OamView) + DDX_Control(pDX, IDC_SPRITE, m_sprite); + DDX_Check(pDX, IDC_STRETCH, m_stretch); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_COLOR, color); + DDX_Control(pDX, IDC_OAM_VIEW, oamView); + DDX_Control(pDX, IDC_OAM_VIEW_ZOOM, oamZoom); +} + + +BEGIN_MESSAGE_MAP(OamView, CDialog) + //{{AFX_MSG_MAP(OamView) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_EN_CHANGE(IDC_SPRITE, OnChangeSprite) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_WM_HSCROLL() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// OamView message handlers + +OamView::~OamView() +{ + free(data); + data = NULL; +} + +void OamView::paint() +{ + if(oam == NULL || paletteRAM == NULL || vram == NULL) + return; + + render(); + oamView.setSize(w,h); + oamView.refresh(); +} + +void OamView::update() +{ + paint(); +} + + + +void OamView::setAttributes(u16 a0, u16 a1, u16 a2) +{ + CString buffer; + + int y = a0 & 255; + int rot = a0 & 512; + int mode = (a0 >> 10) & 3; + int mosaic = a0 & 4096; + int color = a0 & 8192; + int duple = a0 & 1024; + int shape = (a0 >> 14) & 3; + int x = a1 & 511; + int rotParam = (a1 >> 9) & 31; + int flipH = a1 & 4096; + int flipV = a1 & 8192; + int size = (a1 >> 14) & 3; + int tile = a2 & 1023; + int prio = (a2 >> 10) & 3; + int pal = (a2 >> 12) & 15; + + buffer.Format("%d,%d", x,y); + GetDlgItem(IDC_POS)->SetWindowText(buffer); + + buffer.Format("%d", mode); + GetDlgItem(IDC_MODE)->SetWindowText(buffer); + + GetDlgItem(IDC_COLORS)->SetWindowText(color ? "256" : "16"); + + buffer.Format("%d", pal); + GetDlgItem(IDC_PALETTE)->SetWindowText(buffer); + + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE)->SetWindowText(buffer); + + buffer.Format("%d", prio); + GetDlgItem(IDC_PRIO)->SetWindowText(buffer); + + buffer.Format("%d,%d", w,h); + GetDlgItem(IDC_SIZE2)->SetWindowText(buffer); + + if(rot) { + buffer.Format("%d", rotParam); + } else + buffer.Empty(); + GetDlgItem(IDC_ROT)->SetWindowText(buffer); + + buffer.Empty(); + + if(rot) + buffer += 'R'; + else buffer += ' '; + if(!rot) { + if(flipH) + buffer += 'H'; + else + buffer += ' '; + if(flipV) + buffer += 'V'; + else + buffer += ' '; + } else { + buffer += ' '; + buffer += ' '; + } + if(mosaic) + buffer += 'M'; + else + buffer += ' '; + if(duple) + buffer += 'D'; + else + buffer += ' '; + + GetDlgItem(IDC_FLAGS)->SetWindowText(buffer); +} + +void OamView::render() +{ + int m=0; + if(oam == NULL || paletteRAM == NULL || vram == NULL) + return; + + u16 *sprites = &((u16 *)oam)[4*number]; + u16 *spritePalette = &((u16 *)paletteRAM)[0x100]; + u8 *bmp = data; + + u16 a0 = *sprites++; + u16 a1 = *sprites++; + u16 a2 = *sprites++; + + int sizeY = 8; + int sizeX = 8; + + switch(((a0 >>12) & 0x0c)|(a1>>14)) { + case 0: + break; + case 1: + sizeX = sizeY = 16; + break; + case 2: + sizeX = sizeY = 32; + break; + case 3: + sizeX = sizeY = 64; + break; + case 4: + sizeX = 16; + break; + case 5: + sizeX = 32; + break; + case 6: + sizeX = 32; + sizeY = 16; + break; + case 7: + sizeX = 64; + sizeY = 32; + break; + case 8: + sizeY = 16; + break; + case 9: + sizeY = 32; + break; + case 10: + sizeX = 16; + sizeY = 32; + break; + case 11: + sizeX = 32; + sizeY = 64; + break; + default: + return; + } + + w = sizeX; + h = sizeY; + + setAttributes(a0,a1,a2); + + int sy = (a0 & 255); + + if(a0 & 0x2000) { + int c = (a2 & 0x3FF); + // if((DISPCNT & 7) > 2 && (c < 512)) + // return; + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 2; + else + c &= 0x3FE; + + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u32 color = vram[0x10000 + (((c + (y>>3) * inc)* + 32 + (y & 7) * 8 + (x >> 3) * 64 + + (x & 7))&0x7FFF)]; + color = spritePalette[color]; + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + } + } + } else { + int c = (a2 & 0x3FF); + // if((DISPCNT & 7) > 2 && (c < 512)) + // continue; + + int inc = 32; + if(DISPCNT & 0x40) + inc = sizeX >> 3; + int palette = (a2 >> 8) & 0xF0; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + u32 color = vram[0x10000 + (((c + (y>>3) * inc)* + 32 + (y & 7) * 4 + (x >> 3) * 32 + + ((x & 7)>>1))&0x7FFF)]; + if(x & 1) + color >>= 4; + else + color &= 0x0F; + + color = spritePalette[palette+color]; + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + } + } + } +} + +void OamView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + + +void OamView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + +void OamView::OnSave() +{ + CString captureBuffer; + + if(theApp.captureFormat == 0) + captureBuffer = "oam.png"; + else + captureBuffer = "oam.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + captureBuffer, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + captureBuffer = dlg.GetPathName(); + + if(dlg.getFilterIndex() == 2) + saveBMP(captureBuffer); + else + savePNG(captureBuffer); +} + +BOOL OamView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_OAM_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_OAM_VIEW_ZOOM, DS_MoveX) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\OamView", + NULL); + m_sprite.SetWindowText("0"); + + updateScrollInfo(); + + m_stretch = regQueryDwordValue("oamViewStretch", 0); + if(m_stretch) + oamView.setStretch(true); + UpdateData(FALSE); + + paint(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void OamView::OnStretch() +{ + oamView.setStretch(!oamView.getStretch()); + paint(); + regSetDwordValue("oamViewStretch", oamView.getStretch()); +} + + +void OamView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void OamView::OnChangeSprite() +{ + CString buffer; + m_sprite.GetWindowText(buffer); + int n = atoi(buffer); + if(n < 0 || n > 127) { + buffer.Format("%d", number); + m_sprite.SetWindowText(buffer); + return; + } + number = n; + paint(); + updateScrollInfo(); +} + +void OamView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +LRESULT OamView::OnMapInfo(WPARAM wParam, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + oamZoom.setColors(colors); + + return TRUE; +} + +LRESULT OamView::OnColInfo(WPARAM wParam, LPARAM lParam) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + +void OamView::updateScrollInfo() +{ + SCROLLINFO si; + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL | SIF_POS; + si.nMin = 0; + si.nMax = 127; + si.nPage = 1; + si.nPos = number; + GetDlgItem(IDC_SCROLLBAR)->SetScrollInfo(SB_CTL, + &si, + TRUE); +} + +void OamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + switch(nSBCode) { + case SB_BOTTOM: + number = 127; + break; + case SB_LINEDOWN: + number++; + if(number > 127) + number = 127; + break; + case SB_LINEUP: + number--; + if(number < 0) + number = 0; + break; + case SB_PAGEDOWN: + number += 16; + if(number > 127) + number = 127; + break; + case SB_PAGEUP: + number -= 16; + if(number < 0) + number = 0; + break; + case SB_TOP: + number = 0; + break; + case SB_THUMBTRACK: + number = nPos; + if(number < 0) + number = 0; + if(number > 127) + number = 127; + break; + } + + updateScrollInfo(); + + CString buffer; + buffer.Format("%d", number); + m_sprite.SetWindowText(buffer); + paint(); +} + +void OamView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/OamView.h b/src/win32/OamView.h new file mode 100644 index 0000000..dbe770b --- /dev/null +++ b/src/win32/OamView.h @@ -0,0 +1,100 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_OAMVIEW_H__E5369352_80F8_49C4_9F23_05EB6FC1345B__INCLUDED_) +#define AFX_OAMVIEW_H__E5369352_80F8_49C4_9F23_05EB6FC1345B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// OamView.h : header file +// +#include "BitmapControl.h" +#include "ZoomControl.h" +#include "ColorControl.h" + +#include "IUpdate.h" +#include "ResizeDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// OamView dialog + +class OamView : public ResizeDlg, IUpdateListener +{ + private: + BITMAPINFO bmpInfo; + u8 *data; + int w; + int h; + int number; + bool autoUpdate; + BitmapControl oamView; + ZoomControl oamZoom; + ColorControl color; + + // Construction + public: + void updateScrollInfo(); + afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + void savePNG(const char *name); + void saveBMP(const char *name); + void render(); + void setAttributes(u16 a0, u16 a1, u16 a2); + void paint(); + ~OamView(); + OamView(CWnd* pParent = NULL); // standard constructor + + virtual void update(); + // Dialog Data + //{{AFX_DATA(OamView) + enum { IDD = IDD_OAM_VIEW }; + CEdit m_sprite; + BOOL m_stretch; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(OamView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(OamView) + afx_msg void OnSave(); + virtual BOOL OnInitDialog(); + afx_msg void OnStretch(); + afx_msg void OnAutoUpdate(); + afx_msg void OnChangeSprite(); + afx_msg void OnClose(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_OAMVIEW_H__E5369352_80F8_49C4_9F23_05EB6FC1345B__INCLUDED_) diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp new file mode 100644 index 0000000..58666e3 --- /dev/null +++ b/src/win32/OpenGL.cpp @@ -0,0 +1,638 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" +#include "MainWnd.h" +#include + +#include "../System.h" +#include "../GBA.h" +#include "../gb/gbGlobals.h" +#include "../Globals.h" +#include "../Text.h" + +#include "Reg.h" +#include "resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#ifdef MMX +extern "C" bool cpu_mmx; + +extern bool detectMMX(); +#endif + +extern int Init_2xSaI(u32); +extern void winlog(const char *,...); +extern int systemSpeed; + +class OpenGLDisplay : public IDisplay { +private: + HDC hDC; + HGLRC hglrc; + GLuint texture; + int width; + int height; + float size; + u8 *filterData; + bool failed; + + bool initializeTexture(int w, int h); + void updateFiltering(int); +public: + OpenGLDisplay(); + virtual ~OpenGLDisplay(); + + virtual bool initialize(); + virtual void cleanup(); + virtual void render(); + virtual void checkFullScreen(); + virtual void renderMenu(); + virtual void clear(); + virtual bool changeRenderSize(int w, int h); + virtual void resize(int w, int h); + virtual DISPLAY_TYPE getType() { return OPENGL; }; + virtual void setOption(const char *, int); + virtual int selectFullScreenMode(GUID **); +}; + +OpenGLDisplay::OpenGLDisplay() +{ + hDC = NULL; + hglrc = NULL; + texture = 0; + width = 0; + height = 0; + size = 0.0f; + filterData = (u8 *)malloc(4*4*256*240); + failed = false; +} + +OpenGLDisplay::~OpenGLDisplay() +{ + cleanup(); +} + +void OpenGLDisplay::cleanup() +{ + if(texture != 0) { + glDeleteTextures(1, &texture); + texture = 0; + } + if(hglrc != NULL) { + wglDeleteContext(hglrc); + wglMakeCurrent(NULL, NULL); + hglrc = NULL; + } + if(hDC != NULL) { + ReleaseDC(*theApp.m_pMainWnd, hDC); + hDC = NULL; + } + if(filterData) { + free(filterData); + filterData = NULL; + } + width = 0; + height = 0; + size = 0.0f; +} + +bool OpenGLDisplay::initialize() +{ + theApp.sizeX = 240; + theApp.sizeY = 160; + + switch(theApp.videoOption) { + case VIDEO_1X: + theApp.surfaceSizeX = theApp.sizeX; + theApp.surfaceSizeY = theApp.sizeY; + break; + case VIDEO_2X: + theApp.surfaceSizeX = theApp.sizeX * 2; + theApp.surfaceSizeY = theApp.sizeY * 2; + break; + case VIDEO_3X: + theApp.surfaceSizeX = theApp.sizeX * 3; + theApp.surfaceSizeY = theApp.sizeY * 3; + break; + case VIDEO_4X: + theApp.surfaceSizeX = theApp.sizeX * 4; + theApp.surfaceSizeY = theApp.sizeY * 4; + break; + case VIDEO_320x240: + case VIDEO_640x480: + case VIDEO_800x600: + case VIDEO_OTHER: + { + RECT r; + ::GetWindowRect(GetDesktopWindow(), &r); + theApp.fsWidth = r.right - r.left; + theApp.fsHeight = r.bottom - r.top; + + /* Need to fix this code later. For now, Fullscreen takes the whole + screen. + int scaleX = (fsWidth / sizeX); + int scaleY = (fsHeight / sizeY); + int min = scaleX < scaleY ? scaleX : scaleY; + surfaceSizeX = sizeX * min; + surfaceSizeY = sizeY * min; + if(fullScreenStretch) { + */ + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; + // } + } + break; + } + + theApp.rect.left = 0; + theApp.rect.top = 0; + theApp.rect.right = theApp.sizeX; + theApp.rect.bottom = theApp.sizeY; + + theApp.dest.left = 0; + theApp.dest.top = 0; + theApp.dest.right = theApp.surfaceSizeX; + theApp.dest.bottom = theApp.surfaceSizeY; + + DWORD style = WS_POPUP | WS_VISIBLE; + DWORD styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + style |= WS_OVERLAPPEDWINDOW; + else + styleEx = 0; + + if(theApp.videoOption <= VIDEO_4X) + AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); + else + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + + int winSizeX = theApp.dest.right-theApp.dest.left; + int winSizeY = theApp.dest.bottom-theApp.dest.top; + + if(theApp.videoOption > VIDEO_4X) { + winSizeX = theApp.fsWidth; + winSizeY = theApp.fsHeight; + } + + int x = 0; + int y = 0; + + if(theApp.videoOption <= VIDEO_4X) { + x = theApp.windowPositionX; + y = theApp.windowPositionY; + } + + // Create a window + MainWnd *pWnd = new MainWnd; + theApp.m_pMainWnd = pWnd; + + pWnd->CreateEx(styleEx, + theApp.wndClass, + "VisualBoyAdvance", + style, + x,y,winSizeX,winSizeY, + NULL, + 0); + + if (!(HWND)*pWnd) { + winlog("Error creating Window %08x\n", GetLastError()); + return FALSE; + } + + theApp.updateMenuBar(); + + theApp.adjustDestRect(); + + theApp.mode320Available = FALSE; + theApp.mode640Available = FALSE; + theApp.mode800Available = FALSE; + + CDC *dc = pWnd->GetDC(); + HDC hDC = dc->GetSafeHdc(); + + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd + 1, // version number + PFD_DRAW_TO_WINDOW | // support window + PFD_SUPPORT_OPENGL | // support OpenGL + PFD_DOUBLEBUFFER, // double buffered + PFD_TYPE_RGBA, // RGBA type + 16, // 16-bit color depth + 0, 0, 0, 0, 0, 0, // color bits ignored + 0, // no alpha buffer + 0, // shift bit ignored + 0, // no accumulation buffer + 0, 0, 0, 0, // accum bits ignored + 32, // 32-bit z-buffer + 0, // no stencil buffer + 0, // no auxiliary buffer + PFD_MAIN_PLANE, // main layer + 0, // reserved + 0, 0, 0 // layer masks ignored + }; + int iPixelFormat; + + if(!(iPixelFormat = ChoosePixelFormat(hDC, &pfd))) { + winlog("Failed ChoosePixelFormat\n"); + return false; + } + + // obtain detailed information about + // the device context's first pixel format + if(!(DescribePixelFormat(hDC, iPixelFormat, + sizeof(PIXELFORMATDESCRIPTOR), &pfd))) { + winlog("Failed DescribePixelFormat\n"); + return false; + } + + if(!SetPixelFormat(hDC, iPixelFormat, &pfd)) { + winlog("Failed SetPixelFormat\n"); + return false; + } + + if(!(hglrc = wglCreateContext(hDC))) { + winlog("Failed wglCreateContext\n"); + return false; + } + + if(!wglMakeCurrent(hDC, hglrc)) { + winlog("Failed wglMakeCurrent\n"); + return false; + } + pWnd->ReleaseDC(dc); + + // setup 2D gl environment + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + + glViewport(0, 0, theApp.surfaceSizeX, theApp.surfaceSizeY); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble)(theApp.surfaceSizeX), (GLdouble)(theApp.surfaceSizeY), + 0.0, 0.0,1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + systemRedShift = 3; + systemGreenShift = 11; + systemBlueShift = 19; + systemColorDepth = 32; + theApp.fsColorDepth = 32; + + Init_2xSaI(32); +#ifdef MMX + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +#endif + + if(theApp.ddrawDebug) { + winlog("R shift: %d\n", systemRedShift); + winlog("G shift: %d\n", systemGreenShift); + winlog("B shift: %d\n", systemBlueShift); + } + + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + case 24: + case 32: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + } + break; + } + theApp.updateFilter(); + theApp.updateIFB(); + + if(failed) + return false; + + pWnd->DragAcceptFiles(TRUE); + + return TRUE; +} + +void OpenGLDisplay::clear() +{ +} + +void OpenGLDisplay::renderMenu() +{ + checkFullScreen(); + if(theApp.m_pMainWnd) + theApp.m_pMainWnd->DrawMenuBar(); +} + +void OpenGLDisplay::checkFullScreen() +{ + // if(tripleBuffering) + // pOpenGL->FlipToGDISurface(); +} + +void OpenGLDisplay::render() +{ + void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int) = theApp.filterFunction; + int filterWidth = theApp.filterWidth, filterHeight = theApp.filterHeight; +/* + if(textMethod == 1) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + extern void Simple1x(u8*,u32,u8*,u8*,u32,int,int); + filterFunction = Simple1x; + filterWidth = copyX; + filterHeight = copyY; + } +*/ + int pitch = filterWidth * 4 + 4; + u8 *data = pix + (theApp.sizeX+1)*4; + + if(textMethod == 1 && !filterFunction) + { + textMethod = 0; // must not be after systemMessage! + systemMessage(0,"The \"On Game\" text display mode does not work with this combination of renderers and filters.\nThe display mode is automatically being changed to \"In Game\" instead,\nbut this may cause message text to go into AVI recordings and screenshots.\nThis can be reconfigured by choosing \"Options->Video->Text Display Options...\""); + } + + if(textMethod == 0) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + DrawTextMessages((u8*)pix, (copyX+1)*(systemColorDepth/8), 0, copyY); + } + + if(filterFunction) { + data = filterData; + filterFunction(pix+pitch, + pitch, + (u8*)theApp.delta, + (u8*)filterData, + filterWidth*4*2, + filterWidth, + filterHeight); + } + + if(theApp.videoOption > VIDEO_4X && theApp.showSpeed) { + char buffer[30]; + if(theApp.showSpeed == 1) + sprintf(buffer, "%3d%%", systemSpeed); + else + sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + theApp.showRenderedFrames); + + if(filterFunction) { + int p = filterWidth * 4; + if(systemColorDepth == 24) + p = filterWidth * 6; + else if(systemColorDepth == 32) + p = filterWidth * 8; + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)filterData, + p, + 10, + filterHeight*2-10, + buffer); + else + drawText((u8*)filterData, + p, + 10, + filterHeight*2-10, + buffer); + + } else { + if(theApp.showSpeedTransparent) + drawTextTransp((u8*)pix, + pitch, + 10, + filterHeight-10, + buffer); + else + drawText((u8*)pix, + pitch, + 10, + filterHeight-10, + buffer); + } + } + + if(textMethod == 1 && filterFunction) + DrawTextMessages((u8*)filterData, filterWidth*systemColorDepth/4, 0, filterHeight*2); + + + // Texturemap complete texture to surface so we have free scaling + // and antialiasing + int mult = 1; + if(filterFunction) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, 2*theApp.sizeX); + mult = 2; + } else { + glPixelStorei(GL_UNPACK_ROW_LENGTH, theApp.sizeX+1); + } + + glTexSubImage2D( GL_TEXTURE_2D,0, + 0,0, mult*theApp.sizeX,mult*theApp.sizeY, + GL_RGBA,GL_UNSIGNED_BYTE,data); + + if(theApp.glType == 0) { + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0); + glTexCoord2f(mult*theApp.sizeX/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0); + glTexCoord2f(0.0, mult*theApp.sizeY/size); glVertex3i(0, theApp.surfaceSizeY, 0); + glTexCoord2f(mult*theApp.sizeX/size, mult*theApp.sizeY/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0); + glEnd(); + } else { + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0); + glTexCoord2f(mult*theApp.sizeX/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0); + glTexCoord2f(mult*theApp.sizeX/size, mult*theApp.sizeY/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0); + glTexCoord2f(0.0, mult*theApp.sizeY/size); glVertex3i(0, theApp.surfaceSizeY, 0); + glEnd(); + } + + CDC *dc = theApp.m_pMainWnd->GetDC(); + + if(textMethod == 2) + { + for(int slot = 0 ; slot < SCREEN_MESSAGE_SLOTS ; slot++) + { + if(theApp.screenMessage[slot]) + { + if(((int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) && + (!theApp.disableStatusMessage || slot == 1 || slot == 2)) + { + dc->SetBkMode(TRANSPARENT); + + if(outlinedText) + { + dc->SetTextColor(textColor != 7 ? RGB(0,0,0) : RGB(255,255,255)); + // draw black outline + const static int xd [8] = {-1,0,1,1,1,0,-1,-1}; + const static int yd [8] = {-1,-1,-1,0,1,1,1,0}; + for(int i = 0 ; i < 8 ; i++) + { + dc->TextOut(10+xd[i], theApp.surfaceSizeY - 20*(slot+1)+yd[i], theApp.screenMessageBuffer[slot]); + } + } + + COLORREF color; + switch(textColor) + { + case 0: color = RGB(255, 255, 255); break; + case 1: color = RGB(255, 0, 0); break; + case 2: color = RGB(255, 255, 0); break; + case 3: color = RGB(0, 255, 0); break; + case 4: color = RGB(0, 255, 255); break; + case 5: color = RGB(0, 0, 255); break; + case 6: color = RGB(255, 0, 255); break; + case 7: color = RGB(0, 0, 0); break; + } + dc->SetTextColor(color); + + // draw center text + dc->TextOut(10, theApp.surfaceSizeY - 20*(slot+1), theApp.screenMessageBuffer[slot]); + } else { + theApp.screenMessage[slot] = false; + } + } + } + } + + SwapBuffers(dc->GetSafeHdc()); + + theApp.m_pMainWnd->ReleaseDC(dc); +} + +void OpenGLDisplay::resize(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble)(w), (GLdouble)(h), + 0.0, 0.0,1.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void OpenGLDisplay::updateFiltering(int value) +{ + switch(value) { + case 0: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + break; + case 1: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + break; + } +} + +bool OpenGLDisplay::initializeTexture(int w, int h) +{ + int mySize = 256; + size = 256.0f; + if(w > 255 || h > 255) { + size = 512.0f; + mySize = 512; + } + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + + int filter = regQueryDwordValue("glFilter", 0); + if(filter < 0 || filter > 1) + filter = 0; + updateFiltering(filter); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mySize, mySize, 0, GL_RGBA, + GL_UNSIGNED_BYTE, NULL ); + width = w; + height = h; + + return true; +} + +bool OpenGLDisplay::changeRenderSize(int w, int h) +{ + if(width != w || height != h) { + if(texture != 0) { + glDeleteTextures(1, &texture); + texture = 0; + } + if(!initializeTexture(w, h)) { + failed = true; + return false; + } + } + return true; +} + +void OpenGLDisplay::setOption(const char *option, int value) +{ + if(!strcmp(option, "glFilter")) + updateFiltering(value); +} + +int OpenGLDisplay::selectFullScreenMode(GUID **) +{ + HWND wnd = GetDesktopWindow(); + RECT r; + GetWindowRect(wnd, &r); + int w = (r.right - r.left) & 4095; + int h = (r.bottom - r.top) & 4095; + HDC dc = GetDC(wnd); + int c = GetDeviceCaps(dc, BITSPIXEL); + ReleaseDC(wnd, dc); + + return (c << 24) | (w << 12) | h; +} + +IDisplay *newOpenGLDisplay() +{ + return new OpenGLDisplay(); +} + diff --git a/src/win32/PaletteView.cpp b/src/win32/PaletteView.cpp new file mode 100644 index 0000000..29e8a9b --- /dev/null +++ b/src/win32/PaletteView.cpp @@ -0,0 +1,240 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// PaletteView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "PaletteView.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +void GBAPaletteViewControl::updatePalette() +{ + if(paletteRAM != NULL) + memcpy(palette, &paletteRAM[paletteAddress], 512); +} + +///////////////////////////////////////////////////////////////////////////// +// PaletteView dialog + + +PaletteView::PaletteView(CWnd* pParent /*=NULL*/) + : ResizeDlg(PaletteView::IDD, pParent) +{ + //{{AFX_DATA_INIT(PaletteView) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + autoUpdate = false; +} + +PaletteView::~PaletteView() +{ +} + + +void PaletteView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(PaletteView) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_PALETTE_VIEW, paletteView); + DDX_Control(pDX, IDC_PALETTE_VIEW_OBJ, paletteViewOBJ); + DDX_Control(pDX, IDC_COLOR, colorControl); +} + + +BEGIN_MESSAGE_MAP(PaletteView, CDialog) + //{{AFX_MSG_MAP(PaletteView) + ON_BN_CLICKED(IDC_SAVE_BG, OnSaveBg) + ON_BN_CLICKED(IDC_SAVE_OBJ, OnSaveObj) + ON_BN_CLICKED(IDC_REFRESH2, OnRefresh2) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + //}}AFX_MSG_MAP + ON_MESSAGE(WM_PALINFO, OnPalInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// PaletteView message handlers + +BOOL PaletteView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_END() + SetData(sz, + FALSE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\PaletteView", + NULL); + + paletteView.setPaletteAddress(0); + paletteView.refresh(); + + paletteViewOBJ.setPaletteAddress(0x200); + paletteViewOBJ.refresh(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void PaletteView::save(int which) +{ + CString captureBuffer; + + if(which == 0) + captureBuffer = "bg.pal"; + else + captureBuffer = "obj.pal"; + + LPCTSTR exts[] = {".pal", ".pal", ".act" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PAL); + CString title = winResLoadString(IDS_SELECT_PALETTE_NAME); + FileDlg dlg(this, + captureBuffer, + filter, + 1, + "PAL", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + PaletteViewControl *p = NULL; + + if(which == 0) + p = &paletteView; + else + p = &paletteViewOBJ; + + switch(dlg.getFilterIndex()) { + case 0: + case 1: + p->saveMSPAL(captureBuffer); + break; + case 2: + p->saveJASCPAL(captureBuffer); + break; + case 3: + p->saveAdobe(captureBuffer); + break; + } +} + +void PaletteView::OnSaveBg() +{ + save(0); +} + +void PaletteView::OnSaveObj() +{ + save(1); +} + +void PaletteView::OnRefresh2() +{ + paletteView.refresh(); + paletteViewOBJ.refresh(); +} + +void PaletteView::update() +{ + OnRefresh2(); +} + + +void PaletteView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + +void PaletteView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + +LRESULT PaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) +{ + u16 color = (u16)wParam; + u32 address = (u32)lParam; + CString buffer; + + if(address >= 0x200) + address = 0x5000200 + 2*(address & 255); + else + address = 0x5000000 + 2*(address & 255); + + buffer.Format("0x%08X", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + int r = (color & 0x1f); + int g = (color & 0x3e0) >> 5; + int b = (color & 0x7c00) >> 10; + + buffer.Format("%d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("%d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("%d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + buffer.Format("0x%04X", color); + GetDlgItem(IDC_VALUE)->SetWindowText(buffer); + + colorControl.setColor(color); + + if(address >= 0x5000200) { + paletteView.setSelected(-1); + } else + paletteViewOBJ.setSelected(-1); + + return TRUE; +} + +void PaletteView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/PaletteView.h b/src/win32/PaletteView.h new file mode 100644 index 0000000..aee3a4c --- /dev/null +++ b/src/win32/PaletteView.h @@ -0,0 +1,90 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_PALETTEVIEW1_H__0873E3FF_9486_4B2C_8EF0_59C3B4F47162__INCLUDED_) +#define AFX_PALETTEVIEW1_H__0873E3FF_9486_4B2C_8EF0_59C3B4F47162__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// PaletteView.h : header file +// + +#include "ColorControl.h" +#include "PaletteViewControl.h" +#include "ResizeDlg.h" + +class GBAPaletteViewControl : public PaletteViewControl { + public: + virtual void updatePalette(); +}; + +///////////////////////////////////////////////////////////////////////////// +// PaletteView dialog + +class PaletteView : public ResizeDlg, IUpdateListener +{ + private: + GBAPaletteViewControl paletteView; + GBAPaletteViewControl paletteViewOBJ; + ColorControl colorControl; + bool autoUpdate; + // Construction + public: + void save(int which); + PaletteView(CWnd* pParent = NULL); // standard constructor + ~PaletteView(); + afx_msg LRESULT OnPalInfo(WPARAM wParam, LPARAM lParam); + + // Dialog Data + //{{AFX_DATA(PaletteView) + enum { IDD = IDD_PALETTE_VIEW }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(PaletteView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + virtual void update(); + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(PaletteView) + virtual BOOL OnInitDialog(); + afx_msg void OnSaveBg(); + afx_msg void OnSaveObj(); + afx_msg void OnRefresh2(); + afx_msg void OnAutoUpdate(); + afx_msg void OnClose(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PALETTEVIEW1_H__0873E3FF_9486_4B2C_8EF0_59C3B4F47162__INCLUDED_) diff --git a/src/win32/PaletteViewControl.cpp b/src/win32/PaletteViewControl.cpp new file mode 100644 index 0000000..a769d56 --- /dev/null +++ b/src/win32/PaletteViewControl.cpp @@ -0,0 +1,409 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// PaletteViewControl.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "PaletteViewControl.h" + +#include "../Util.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +bool PaletteViewControl::isRegistered = false; + +///////////////////////////////////////////////////////////////////////////// +// PaletteViewControl + +PaletteViewControl::PaletteViewControl() +{ + memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 256; + bmpInfo.bmiHeader.biHeight = -256; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)malloc(3 * 256 * 256); + + w = 256; + h = 256; + + colors = 256; + + paletteAddress = 0; + + ZeroMemory(palette, 512); + + selected = -1; + registerClass(); +} + +PaletteViewControl::~PaletteViewControl() +{ + if(data) + free(data); +} + + +BEGIN_MESSAGE_MAP(PaletteViewControl, CWnd) + //{{AFX_MSG_MAP(PaletteViewControl) + ON_WM_LBUTTONDOWN() + ON_WM_ERASEBKGND() + ON_WM_PAINT() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// PaletteViewControl message handlers + +void PaletteViewControl::init(int c, int w, int h) +{ + this->w = w; + this->h = h; + this->colors = c; + + bmpInfo.bmiHeader.biWidth = w; + bmpInfo.bmiHeader.biHeight = -h; +} + + +bool PaletteViewControl::saveAdobe(const char *name) +{ + FILE *f = fopen(name, "wb"); + + if(!f) + return false; + + for(int i = 0; i < colors; i++) { + u16 c = palette[i]; + int r = (c & 0x1f) << 3; + int g = (c & 0x3e0) >> 2; + int b = (c & 0x7c00) >> 7; + + u8 data[3] = { r, g, b }; + fwrite(data, 1, 3, f); + } + if(colors < 256) { + for(int i = colors; i < 256; i++) { + u8 data[3] = { 0, 0, 0 }; + fwrite(data, 1, 3, f); + } + } + fclose(f); + + return true; +} + + +bool PaletteViewControl::saveMSPAL(const char *name) +{ + FILE *f = fopen(name, "wb"); + + if(!f) + return false; + + u8 data[4] = { 'R', 'I', 'F', 'F' }; + + fwrite(data, 1, 4, f); + utilPutDword(data, 256 * 4 + 16); + fwrite(data, 1, 4, f); + u8 data3[4] = { 'P', 'A', 'L', ' ' }; + fwrite(data3, 1, 4, f); + u8 data4[4] = { 'd', 'a', 't', 'a' }; + fwrite(data4, 1, 4, f); + utilPutDword(data, 256*4+4); + fwrite(data, 1, 4, f); + utilPutWord(&data[0], 0x0300); + utilPutWord(&data[2], 256); // causes problems if not 16 or 256 + fwrite(data, 1, 4, f); + + for(int i = 0; i < colors; i++) { + u16 c = palette[i]; + int r = (c & 0x1f) << 3; + int g = (c & 0x3e0) >> 2; + int b = (c & 0x7c00) >> 7; + + u8 data7[4] = { r, g, b, 0 }; + fwrite(data7, 1, 4, f); + } + if(colors < 256) { + for(int i = colors; i < 256; i++) { + u8 data7[4] = { 0, 0, 0, 0 }; + fwrite(data7, 1, 4, f); + } + } + fclose(f); + + return true; +} + + +bool PaletteViewControl::saveJASCPAL(const char *name) +{ + FILE *f = fopen(name, "wb"); + + if(!f) + return false; + + fprintf(f, "JASC-PAL\r\n0100\r\n256\r\n"); + + for(int i = 0; i < colors; i++) { + u16 c = palette[i]; + int r = (c & 0x1f) << 3; + int g = (c & 0x3e0) >> 2; + int b = (c & 0x7c00) >> 7; + + fprintf(f, "%d %d %d\r\n", r, g, b); + } + if(colors < 256) { + for(int i = colors; i < 256; i++) + fprintf(f, "0 0 0\r\n"); + } + fclose(f); + + return true; +} + +void PaletteViewControl::setPaletteAddress(int address) +{ + paletteAddress = address; +} + + +void PaletteViewControl::setSelected(int s) +{ + selected = s; + InvalidateRect(NULL, FALSE); +} + + +void PaletteViewControl::render(u16 color, int x, int y) +{ + u8 *start = data + y*16*w*3 + x*16*3; + int skip = w*3-16*3; + + int r = (color & 0x1f) << 3; + int g = (color & 0x3e0) >> 2; + int b = (color & 0x7c00) >> 7; + + for(int i = 0; i < 16; i++) { + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + *start++ = b; + *start++ = g; + *start++ = r; + + start += skip; + } +} + +void PaletteViewControl::refresh() +{ + updatePalette(); + int sw = w/16; + int sh = h/16; + for(int i = 0; i < colors; i++) { + render(palette[i], i & (sw-1), i/sw); + } + InvalidateRect(NULL, FALSE); +} + +void PaletteViewControl::OnLButtonDown(UINT nFlags, CPoint point) +{ + int x = point.x; + int y = point.y; + RECT rect; + GetClientRect(&rect); + int h = rect.bottom - rect.top; + int w = rect.right - rect.left; + int sw = (this->w/16); + int sh = (this->h/16); + int mult = w / sw; + int multY = h / sh; + + setSelected(x/mult + (y/multY)*sw); + + GetParent()->SendMessage(WM_PALINFO, + palette[x/mult+(y/multY)*sw], + paletteAddress+(x/mult+(y/multY)*sw)); +} + +BOOL PaletteViewControl::OnEraseBkgnd(CDC* pDC) +{ + return TRUE; +} + + +void PaletteViewControl::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT rect; + GetClientRect(&rect); + int w = rect.right - rect.left; + int h = rect.bottom - rect.top; + + CDC memDC; + memDC.CreateCompatibleDC(&dc); + CBitmap bitmap, *pOldBitmap; + bitmap.CreateCompatibleBitmap(&dc, w, h); + pOldBitmap = memDC.SelectObject(&bitmap); + + StretchDIBits(memDC.GetSafeHdc(), + 0, + 0, + w, + h, + 0, + 0, + this->w, + this->h, + data, + &bmpInfo, + DIB_RGB_COLORS, + SRCCOPY); + int sw = this->w / 16; + int sh = this->h / 16; + int mult = w / sw; + int multY = h / sh; + CPen pen; + pen.CreatePen(PS_SOLID, 1, RGB(192,192,192)); + CPen *old = memDC.SelectObject(&pen); + int i; + for(i = 1; i < sh; i++) { + memDC.MoveTo(0, i * multY); + memDC.LineTo(w, i * multY); + } + for(i = 1; i < sw; i++) { + memDC.MoveTo(i * mult, 0); + memDC.LineTo(i * mult, h); + } + memDC.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT); + memDC.SelectObject(old); + pen.DeleteObject(); + + if(selected != -1) { + pen.CreatePen(PS_SOLID, 2, RGB(255, 0, 0)); + old = memDC.SelectObject(&pen); + + int startX = (selected & (sw-1))*mult+1; + int startY = (selected / sw)*multY+1; + int endX = startX + mult-2; + int endY = startY + multY-2; + + memDC.MoveTo(startX, startY); + memDC.LineTo(endX, startY); + memDC.LineTo(endX, endY); + memDC.LineTo(startX, endY); + memDC.LineTo(startX, startY-1); + + memDC.SelectObject(old); + pen.DeleteObject(); + } + + dc.BitBlt(0,0,w,h, + &memDC,0,0,SRCCOPY); + + memDC.SelectObject(pOldBitmap); + bitmap.DeleteObject(); + memDC.DeleteDC(); +} + +void PaletteViewControl::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaPaletteViewControl"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} diff --git a/src/win32/PaletteViewControl.h b/src/win32/PaletteViewControl.h new file mode 100644 index 0000000..a7c8922 --- /dev/null +++ b/src/win32/PaletteViewControl.h @@ -0,0 +1,90 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_PALETTEVIEWCONTROL_H__31F600AE_B7E5_4F6C_80B6_55E4B61FBD57__INCLUDED_) +#define AFX_PALETTEVIEWCONTROL_H__31F600AE_B7E5_4F6C_80B6_55E4B61FBD57__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// PaletteViewControl.h : header file +// +#define WM_PALINFO WM_APP+1 + +///////////////////////////////////////////////////////////////////////////// +// PaletteViewControl window + +class PaletteViewControl : public CWnd +{ + int w; + int h; + int colors; + u8 *data; + BITMAPINFO bmpInfo; + static bool isRegistered; + int selected; + protected: + u16 palette[256]; + int paletteAddress; + // Construction + public: + PaletteViewControl(); + + virtual void updatePalette()=0; + + // Attributes + public: + + // Operations + public: + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(PaletteViewControl) + //}}AFX_VIRTUAL + + // Implementation + public: + void registerClass(); + void refresh(); + void render(u16 color, int x, int y); + void setSelected(int s); + void setPaletteAddress(int address); + bool saveJASCPAL(const char *name); + bool saveMSPAL(const char *name); + bool saveAdobe(const char *name); + void init(int c, int w, int h); + virtual ~PaletteViewControl(); + + // Generated message map functions + protected: + //{{AFX_MSG(PaletteViewControl) + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PALETTEVIEWCONTROL_H__31F600AE_B7E5_4F6C_80B6_55E4B61FBD57__INCLUDED_) diff --git a/src/win32/PerfTimer.cpp b/src/win32/PerfTimer.cpp new file mode 100644 index 0000000..e886681 --- /dev/null +++ b/src/win32/PerfTimer.cpp @@ -0,0 +1,35 @@ +// CPerfTimer - a simple Win32 performance counter wrapper +// by Dean Wyant dwyant@mindspring.com + +#include "stdafx.h" +#include "PerfTimer.h" + +// Declare and initialize static member vars that get set only once and never change +__int64 CPerfTimer::m_Freq = 0; +__int64 CPerfTimer::m_Adjust = 0; + +// All functions defined inline for speed. After all, the performance counter is +// supposed to be able to time very short events fairly accurately. + + + +BOOL CPerfTimer::IsSupported() +{ // Returns FALSE if performance counter not supported. + // Call after constructing at least one CPerfTimer + return (m_Freq > 1); +} + +const double CPerfTimer::Resolution() +{ // Returns timer resolution in seconds + return 1.0/(double)m_Freq; +} + +const double CPerfTimer::Resolutionms() +{ // Returns timer resolution in milliseconds + return 1000.0/(double)m_Freq; +} + +const double CPerfTimer::Resolutionus() +{ // Returns timer resolution in microseconds + return 1000000.0/(double)m_Freq; +} diff --git a/src/win32/PerfTimer.h b/src/win32/PerfTimer.h new file mode 100644 index 0000000..e97887e --- /dev/null +++ b/src/win32/PerfTimer.h @@ -0,0 +1,403 @@ +// CPerfTimer - a simple Win32 performance counter wrapper +// by Dean Wyant dwyant@mindspring.com + +/* + +This class is simple to use. Just declare a variable(s) as type CPerfTimer, +call Start() to start timimg and call Stop() to stop timimg. You can pause a +timer by calling Stop() and then you can call Start() to resume. Retrieve the +elapsed time by calling an Elapsed..() function. Assignment, addition, +subtraction and comparison are supported. There are a few information calls +available also. All calls except Start and Stop can be performed on a timer +without stopping it. + +*/ + +#ifndef __PERFTIMER_H__ +#define __PERFTIMER_H__ + +class CPerfTimer +{ +public: + CPerfTimer(BOOL bStart = FALSE) {Init(bStart);} + + CPerfTimer(const CPerfTimer& Src); + + virtual ~CPerfTimer() {;} + + void Start(BOOL bReset = FALSE); // Start from current value or optionally from 0 + void Stop(); // Stop timing. Use Start afterwards to continue. + + BOOL IsRunning(); // Returns FALSE if stopped. + + BOOL IsSupported(); // Returns FALSE if performance counter not supported. + // Call after constructing at least one CPerfTimer + + const double Resolution(); // Returns timer resolution in seconds + const double Resolutionms(); // Returns timer resolution in milliseconds + const double Resolutionus(); // Returns timer resolution in microseconds + + const double Elapsed(); // Returns elapsed time in seconds + const double Elapsedms(); // Returns elapsed time in milliseconds + const double Elapsedus(); // Returns elapsed time in microseconds + + const CPerfTimer& operator=(const CPerfTimer& Src); // Assignment operator + + // Math operators + CPerfTimer operator+(const CPerfTimer& Src) const; + CPerfTimer operator-(const CPerfTimer& Src) const; + const CPerfTimer& operator+=(const CPerfTimer& Src); + const CPerfTimer& operator-=(const CPerfTimer& Src); + // For time in seconds + CPerfTimer operator+(const double Secs) const; + CPerfTimer operator-(const double Secs) const; + const CPerfTimer& operator+=(const double Secs); + const CPerfTimer& operator-=(const double Secs); + + // Boolean comparison operators + BOOL operator<(const CPerfTimer& Src); + BOOL operator>(const CPerfTimer& Src); + BOOL operator<=(const CPerfTimer& Src); + BOOL operator>=(const CPerfTimer& Src); + // For time in seconds + BOOL operator<(const double Secs); + BOOL operator>(const double Secs); + BOOL operator<=(const double Secs); + BOOL operator>=(const double Secs); + + virtual void Lock() const {;} // Override for thread safe operation + virtual void Unlock() const {;} // Override for thread safe operation +protected: + void Init(BOOL bStart); + void Copy(const CPerfTimer& Src); + +private: + __int64 m_Start; + static __int64 m_Freq; // does not change while system is running + static __int64 m_Adjust; // Adjustment time it takes to Start and Stop +}; + +class CPerfTimerT : public CPerfTimer +{ // You only need to use types of this class if a timer is going to be shared between threads +public: + CPerfTimerT(BOOL bStart = FALSE) + { + m_hMutex = CreateMutex(NULL,FALSE,""); + Init(bStart); + } + + CPerfTimerT(const CPerfTimerT& Src) + { + m_hMutex = CreateMutex(NULL,FALSE,""); + Copy(Src); + } + + CPerfTimerT(const CPerfTimer& Src) + { + m_hMutex = CreateMutex(NULL,FALSE,""); + Copy(Src); + } + + virtual ~CPerfTimerT() + { CloseHandle(m_hMutex); } + + const CPerfTimerT& operator=(const CPerfTimerT& Src) // Assignment operator + { + Copy(Src); + return *this; + } + + virtual void Lock() const { WaitForSingleObject(m_hMutex,10000); } + virtual void Unlock() const { ReleaseMutex(m_hMutex); } +private: + HANDLE m_hMutex; +}; + +inline void CPerfTimer::Init(BOOL bStart) +{ + if (!m_Freq) + { // Initialization should only run once + QueryPerformanceFrequency((LARGE_INTEGER *)&m_Freq); + if (!m_Freq) + m_Freq = 1; // Timer will be useless but will not cause divide by zero + m_Start = 0; + m_Adjust = 0; + Start(); // Time a Stop + Stop(); + m_Adjust = m_Start; + } + // This is the only part that normally runs + m_Start = 0; + if (bStart) + Start(); +} + +inline CPerfTimer::CPerfTimer(const CPerfTimer& Src) +{ + Copy(Src); +} + +inline void CPerfTimer::Copy(const CPerfTimer& Src) +{ + if (&Src == this) + return; // avoid deadlock if someone tries to copy it to itself + Src.Lock(); + Lock(); + m_Start = Src.m_Start; + Unlock(); + Src.Unlock(); +} + +inline void CPerfTimer::Start(BOOL bReset) +{ // Start from current value or optionally from 0 + __int64 i; + QueryPerformanceCounter((LARGE_INTEGER *)&i); + Lock(); + if ((!bReset) && (m_Start < 0)) + m_Start += i; // We are starting with an accumulated time + else + m_Start = i; // Starting from 0 + Unlock(); +} + +inline void CPerfTimer::Stop() +{ // Stop timing. Use Start afterwards to continue + Lock(); + if (m_Start <= 0) + { + Unlock(); + return; // Was not running + } + __int64 i; + QueryPerformanceCounter((LARGE_INTEGER *)&i); + m_Start += -i; // Stopped timer keeps elapsed timer ticks as a negative + if (m_Start < m_Adjust) // Do not overflow + m_Start -= m_Adjust; // Adjust for time timer code takes to run + else + m_Start = 0; // Stop must have been called directly after Start + Unlock(); +} + +inline BOOL CPerfTimer::IsRunning() +{ // Returns FALSE if stopped. + Lock(); + BOOL bRet = (m_Start > 0); // When < 0, holds elpased clicks + Unlock(); + return bRet; +} +inline const double CPerfTimer::Elapsed() +{ // Returns elapsed time in seconds + CPerfTimer Result(*this); + Result.Stop(); + return (double)(-Result.m_Start)/(double)m_Freq; +} + +inline const double CPerfTimer::Elapsedms() +{ // Returns elapsed time in milliseconds + CPerfTimer Result(*this); + Result.Stop(); + return (-Result.m_Start*1000.0)/(double)m_Freq; +} + +inline const double CPerfTimer::Elapsedus() +{ // Returns elapsed time in microseconds + CPerfTimer Result(*this); + + return (-Result.m_Start * 1000000.0)/(double)m_Freq; +} + + +// Assignment operator +inline const CPerfTimer& CPerfTimer::operator=(const CPerfTimer& Src) +{ + Copy(Src); + return *this; +} + + +// Math operators +inline CPerfTimer CPerfTimer::operator+(const CPerfTimer& Src) const +{ + CPerfTimer Result(*this); + Result += Src; + return Result; +} + +inline CPerfTimer CPerfTimer::operator-(const CPerfTimer& Src) const +{ + CPerfTimer Result(*this); + Result -= Src; + return Result; +} + +inline const CPerfTimer& CPerfTimer::operator+=(const CPerfTimer& Src) +{ + CPerfTimer SrcStop(Src); // Temp is necessary in case Src is not stopped + SrcStop.Stop(); + Lock(); + m_Start += SrcStop.m_Start; + Unlock(); + return *this; +} + +inline const CPerfTimer& CPerfTimer::operator-=(const CPerfTimer& Src) +{ + CPerfTimer SrcStop(Src); // Temp is necessary in case Src is not stopped + SrcStop.Stop(); + Lock(); + m_Start -= SrcStop.m_Start; + Unlock(); + return *this; +} + +// For time in seconds +inline CPerfTimer CPerfTimer::operator+(const double Secs) const +{ + CPerfTimer Result(*this); + Result += Secs; + return Result; +} + +inline CPerfTimer CPerfTimer::operator-(const double Secs) const +{ + CPerfTimer Result(*this); + Result += Secs; + return Result; +} + +inline const CPerfTimer& CPerfTimer::operator+=(const double Secs) +{ + Lock(); + m_Start -= (__int64)(Secs*(double)m_Freq); + Unlock(); + return *this; +} + +inline const CPerfTimer& CPerfTimer::operator-=(const double Secs) +{ + Lock(); + m_Start += (__int64)(Secs*(double)m_Freq); + Unlock(); + return *this; +} + + + +// Boolean comparison operators +inline BOOL CPerfTimer::operator<(const CPerfTimer& Src) +{ + BOOL bRet; + CPerfTimer Temp(Src); + Lock(); + if (m_Start <= 0) + { + Temp.Stop(); + bRet = (m_Start > Temp.m_Start); + Unlock(); + return bRet; + } + else + if (Temp.m_Start > 0) + { + bRet = (m_Start < Temp.m_Start); + Unlock(); + return bRet; + } + else + { + Unlock(); + CPerfTimer ThisStop(*this); + ThisStop.Stop(); + return (ThisStop.m_Start > Temp.m_Start); + } +} + +inline BOOL CPerfTimer::operator>(const CPerfTimer& Src) +{ + BOOL bRet; + CPerfTimer Temp(Src); + Lock(); + if (m_Start <= 0) + { + Temp.Stop(); + bRet = (m_Start < Temp.m_Start); + Unlock(); + return bRet; + } + else + if (Temp.m_Start > 0) + { + bRet = (m_Start > Temp.m_Start); + Unlock(); + return bRet; + } + else + { + Unlock(); + CPerfTimer ThisStop(*this); + ThisStop.Stop(); + return (ThisStop.m_Start < Temp.m_Start); + } +} + +inline BOOL CPerfTimer::operator<=(const CPerfTimer& Src) +{ + return !(*this > Src); +} + +inline BOOL CPerfTimer::operator>=(const CPerfTimer& Src) +{ + return !(*this < Src); +} + +// For time in seconds +inline BOOL CPerfTimer::operator<(const double Secs) +{ + BOOL bRet; + Lock(); + if (m_Start <= 0) + { + bRet = (m_Start > (__int64)(-Secs*(double)m_Freq)); + Unlock(); + return bRet; + } + else + { + Unlock(); + CPerfTimer ThisStop(*this); + ThisStop.Stop(); + return (ThisStop.m_Start > (__int64)(-Secs*(double)m_Freq)); + } +} + +inline BOOL CPerfTimer::operator>(const double Secs) +{ + BOOL bRet; + Lock(); + if (m_Start <= 0) + { + bRet = (m_Start < (__int64)(-Secs*(double)m_Freq)); + Unlock(); + return bRet; + } + else + { + Unlock(); + CPerfTimer ThisStop(*this); + ThisStop.Stop(); + return (ThisStop.m_Start < (__int64)(-Secs*(double)m_Freq)); + } +} + +inline BOOL CPerfTimer::operator<=(const double Secs) +{ + return !(*this > Secs); +} + +inline BOOL CPerfTimer::operator>=(const double Secs) +{ + return !(*this < Secs); +} + + +#endif //__PERFTIMER_H__ \ No newline at end of file diff --git a/src/win32/Reg.cpp b/src/win32/Reg.cpp new file mode 100644 index 0000000..c0014b3 --- /dev/null +++ b/src/win32/Reg.cpp @@ -0,0 +1,369 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" + +static char buffer[2048]; +static HKEY vbKey = NULL; +static CString regVbaPath; + +#define VBA_PREF "preferences" + +bool regEnabled = true; + +void regInit(const char *path) +{ + DWORD disp = 0; + LONG res = RegCreateKeyEx(HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance", + 0, + "", + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &vbKey, + &disp); + regVbaPath.Format("%s\\vba.ini", path); +} + +void regShutdown() +{ + LONG res = RegCloseKey(vbKey); +} + +const char *regGetINIPath() +{ + return regVbaPath; +} + +char *regQueryStringValue(const char * key, char *def) +{ + if(regEnabled) { + DWORD type = 0; + DWORD size = 2048; + + LONG res = RegQueryValueEx(vbKey, + key, + NULL, + &type, + (UCHAR *)buffer, + &size); + + if(res == ERROR_SUCCESS && type == REG_SZ) + return buffer; + + return def; + } + + DWORD res = GetPrivateProfileString(VBA_PREF, + key, + def, + (LPTSTR)buffer, + 2048, + regVbaPath); + + if(res) + return buffer; + + return def; +} + +DWORD regQueryDwordValue(const char * key, DWORD def, bool force) +{ + if(regEnabled || force) { + DWORD type = 0; + DWORD size = sizeof(DWORD); + DWORD result = 0; + + LONG res = RegQueryValueEx(vbKey, + key, + NULL, + &type, + (UCHAR *)&result, + &size); + + if(res == ERROR_SUCCESS && type == REG_DWORD) + return result; + + return def; + } + + return GetPrivateProfileInt(VBA_PREF, + key, + def, + regVbaPath); +} + +BOOL regQueryBinaryValue(const char * key, char *value, int count) +{ + if(regEnabled) { + DWORD type = 0; + DWORD size = count; + DWORD result = 0; + + + LONG res = RegQueryValueEx(vbKey, + key, + NULL, + &type, + (UCHAR *)value, + &size); + + if(res == ERROR_SUCCESS && type == REG_BINARY) + return TRUE; + + return FALSE; + } + CString k = key; + k += "Count"; + int size = GetPrivateProfileInt(VBA_PREF, + k, + -1, + regVbaPath); + if(size >= 0 && size < count) + count = size; + return GetPrivateProfileStruct(VBA_PREF, + key, + value, + count, + regVbaPath); +} + +void regSetStringValue(const char * key, const char * value) +{ + if(regEnabled) { + LONG res = RegSetValueEx(vbKey, + key, + NULL, + REG_SZ, + (const UCHAR *)value, + strlen(value)+1); + } else { + WritePrivateProfileString(VBA_PREF, + key, + value, + regVbaPath); + } +} + +void regSetDwordValue(const char * key, DWORD value, bool force) +{ + if(regEnabled || force) { + LONG res = RegSetValueEx(vbKey, + key, + NULL, + REG_DWORD, + (const UCHAR *)&value, + sizeof(DWORD)); + } else { + wsprintf(buffer, "%u", value); + WritePrivateProfileString(VBA_PREF, + key, + buffer, + regVbaPath); + } +} + +void regSetBinaryValue(const char *key, char *value, int count) +{ + if(regEnabled) { + LONG res = RegSetValueEx(vbKey, + key, + NULL, + REG_BINARY, + (const UCHAR *)value, + count); + } else { + CString k = key; + k += "Count"; + wsprintf(buffer, "%u", count); + + WritePrivateProfileString(VBA_PREF, + k, + buffer, + regVbaPath); + + WritePrivateProfileStruct(VBA_PREF, + key, + value, + count, + regVbaPath); + } +} + +void regDeleteValue(char *key) +{ + if(regEnabled) { + LONG res = RegDeleteValue(vbKey, + key); + } else { + WritePrivateProfileString(VBA_PREF, + key, + NULL, + regVbaPath); + } +} + +bool regCreateFileType(const char *ext, const char *type) +{ + DWORD disp = 0; + HKEY key; + LONG res = RegCreateKeyEx(HKEY_CLASSES_ROOT, + ext, + 0, + "", + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &key, + &disp); + if(res == ERROR_SUCCESS) { + res = RegSetValueEx(key, + "", + 0, + REG_SZ, + (const UCHAR *)type, + strlen(type)+1); + RegCloseKey(key); + return true; + } + return false; +} + +bool regAssociateType(const char *type, const char *desc, const char *application) +{ + DWORD disp = 0; + HKEY key; + LONG res = RegCreateKeyEx(HKEY_CLASSES_ROOT, + type, + 0, + "", + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &key, + &disp); + if(res == ERROR_SUCCESS) { + res = RegSetValueEx(key, + "", + 0, + REG_SZ, + (const UCHAR *)desc, + strlen(desc)+1); + HKEY key2; + res = RegCreateKeyEx(key, + "Shell\\Open\\Command", + 0, + "", + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &key2, + &disp); + if(res == ERROR_SUCCESS) { + res = RegSetValueEx(key2, + "", + 0, + REG_SZ, + (const UCHAR *)application, + strlen(application)+1); + RegCloseKey(key2); + RegCloseKey(key); + return true; + } + + RegCloseKey(key); + } + return false; +} + +static void regExportSettingsToINI(HKEY key, const char *section) +{ + char valueName[256]; + int index = 0; + while(1) { + DWORD nameSize = 256; + DWORD size = 2048; + DWORD type; + LONG res = RegEnumValue(key, + index, + valueName, + &nameSize, + NULL, + &type, + (LPBYTE)buffer, + &size); + + if(res == ERROR_SUCCESS) { + switch(type) { + case REG_DWORD: + { + char temp[256]; + wsprintf(temp, "%u", *((DWORD *)buffer)); + WritePrivateProfileString(section, + valueName, + temp, + regVbaPath); + } + break; + case REG_SZ: + WritePrivateProfileString(section, + valueName, + buffer, + regVbaPath); + break; + case REG_BINARY: + { + char temp[256]; + + wsprintf(temp, "%u", size); + CString k = valueName; + k += "Count"; + WritePrivateProfileString(section, + k, + temp, + regVbaPath); + WritePrivateProfileStruct(section, + valueName, + buffer, + size, + regVbaPath); + } + break; + } + index++; + } else + break; + } +} + +void regExportSettingsToINI() +{ + if(vbKey != NULL) { + regExportSettingsToINI(vbKey, VBA_PREF); + } + + HKEY key; + + if(RegOpenKey(HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer", &key) == + ERROR_SUCCESS) { + regExportSettingsToINI(key, "Viewer"); + RegCloseKey(key); + } +} diff --git a/src/win32/Reg.h b/src/win32/Reg.h new file mode 100644 index 0000000..7d3350e --- /dev/null +++ b/src/win32/Reg.h @@ -0,0 +1,37 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_REG_H +#define VBA_REG_H + +extern bool regEnabled; + +char *regQueryStringValue(const char *key, char *def); +DWORD regQueryDwordValue(const char *key, DWORD def, bool force=false); +BOOL regQueryBinaryValue(const char *key, char *value, int count); +void regSetStringValue(const char *key,const char *value); +void regSetDwordValue(const char *key,DWORD value,bool force=false); +void regSetBinaryValue(const char *key, char *value, int count); +void regDeleteValue(char *key); +void regInit(const char *); +void regShutdown(); +bool regCreateFileType(const char *ext, const char *type); +bool regAssociateType(const char *type, const char *desc, const char *application); +void regExportSettingsToINI(); +#endif // VBA_REG_H diff --git a/src/win32/ResizeDlg.cpp b/src/win32/ResizeDlg.cpp new file mode 100644 index 0000000..bee5823 --- /dev/null +++ b/src/win32/ResizeDlg.cpp @@ -0,0 +1,561 @@ +/*---------------------------------------------------------------------- + Copyright (c) Gipsysoft. All Rights Reserved. + File: DialogSizer_Set.cpp + Web site: http://gipsysoft.com + + This software is provided 'as-is', without any express or implied warranty. + + In no event will the author be held liable for any damages arising from the + use of this software. + + Permission is granted to anyone to use this software for any purpose, including + commercial applications, and to alter it and redistribute it freely, subject + to the following restrictions: + + 1) The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, + an acknowledgment in the product documentation is requested but not required. + 2) Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. Altered source is encouraged + to be submitted back to the original author so it can be shared with the + community. Please share your changes. + 3) This notice may not be removed or altered from any source distribution. + + Owner: russf@gipsysoft.com + Purpose: Main functionality for sizeable dialogs + + Store a local copy of the user settings + Subclass the window + Respond to various messages withinn the subclassed window. + + ----------------------------------------------------------------------*/ +#include "stdafx.h" +#include "VBA.h" +#include "ResizeDlg.h" +#undef ASSERT +#include "WinHelper.h" + +// moved functions to this file to reduce number of files + +struct RegistryData +{ + WINDOWPLACEMENT m_wpl; +}; + + +struct DialogData // dd +{ + HKEY hkRootSave; + LPCTSTR pcszName; + + // + // The number of items contained in the psd member. + // Used in the DeferWindowPos structure and in allocating memory + int nItemCount; + DialogSizerSizingItem *psd; + + // + // We need the smallest to respond to the WM_GETMINMAXINFO message + POINT m_ptSmallest; + + // + // We don't strictly speaking need to say how big the biggest can be but + POINT m_ptLargest; + bool m_bLargestSet; + + // + // we need this to decide how much the window has changed size when we get a WM_SIZE message + SIZE m_sizeClient; + + // + // Draw the sizing grip...or not + bool m_bMaximised; + BOOL m_bShowSizingGrip; + + WinHelper::CRect m_rcGrip; +}; + +extern bool regEnabled; +extern const char *regGetINIPath(); + +void AssertFailed(char *file, int line, char *exp) +{ + char buffer[1024]; + + sprintf(buffer, "File %s\nLine %d\nExpression %s\nPress Retry to debug", + file, line, exp); + int res = MessageBox(*theApp.m_pMainWnd, buffer, "Assertion failed!", + MB_ICONHAND | MB_SETFOREGROUND | MB_TASKMODAL | + MB_ABORTRETRYIGNORE); + + if(res == IDRETRY) { + __asm int 3; + } else if(res == IDABORT) + SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); +} + +void ApiFailure(char *pcszFilename, int nLine, char *pcszExpression ) +{ + const DWORD dwLastError = ::GetLastError(); + LPCTSTR lpMsgBuf; + (void)::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, dwLastError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, 0, NULL ); + + char szExeName[ MAX_PATH ]; + + if( !GetModuleFileName( NULL, szExeName, countof( szExeName ) ) ) + strcpy( szExeName, "" ); + + + char szMessage[ 1024 ]; + _snprintf( szMessage, countof( szMessage ) + , "API VERIFY Failure!" + "\nProgram: %s" + "\n" + "\nFile %s" + "\nLine %d" + "\n" + "\nExpression %s" + "\n" + "\nLast Error %d" + "\n %s" + "\n\nPress Retry to debug the application" + , szExeName + , pcszFilename + , nLine + , pcszExpression + , dwLastError + , lpMsgBuf + ); + + (void)LocalFree( (LPVOID)lpMsgBuf ); + HWND hwndParent = ::GetActiveWindow(); + hwndParent = ::GetLastActivePopup( hwndParent ); + int nCode = ::MessageBoxA( hwndParent, + szMessage, + "Debug Helper", + MB_TASKMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE | + MB_SETFOREGROUND ); + if(nCode == IDABORT) { + ::SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); + } else if(nCode == IDRETRY) + __asm int 3; +} + +long FASTCALL RegQueryValueExRecursive( HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ) +{ + TCHAR szBuffer[ 256 ]; + R_ASSERT( lstrlen( lpValueName ) < countof( szBuffer ) ); + (void)lstrcpy( szBuffer, lpValueName ); + + LPTSTR pszBuffer = szBuffer; + LPTSTR pszLast = szBuffer; + while( *pszBuffer ) + { + if( *pszBuffer == _T('\\') || *pszBuffer == _T('/') ) + { + pszLast = pszBuffer; + lpValueName = pszLast + 1; + } + pszBuffer++; + } + + if(!regEnabled) { + if(GetPrivateProfileStruct("Viewer", + lpValueName, + lpData, + *lpcbData, + regGetINIPath())) { + *lpType = REG_BINARY; + return ERROR_SUCCESS; + } + return -1; + } + + bool m_bNeedToCloseKey = false; + if( pszLast != szBuffer ) + { + *pszLast = _T('\000'); + HKEY hkeyTemp; + long lRet = RegOpenKey( hKey, szBuffer, &hkeyTemp ); + if( lRet != ERROR_SUCCESS ) + { + return lRet; + } + hKey = hkeyTemp; + m_bNeedToCloseKey = true; + } + + long lRet = RegQueryValueEx( hKey, lpValueName, lpReserved, lpType, lpData, lpcbData ); + if( m_bNeedToCloseKey ) + { + R_VERIFY( RegCloseKey( hKey ) == ERROR_SUCCESS ); + } + return lRet; +} + +long FASTCALL RegSetValueExRecursive( HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData ) +{ + TCHAR szBuffer[ 256 ]; + R_ASSERT( lstrlen( lpValueName ) < countof( szBuffer ) ); + (void)lstrcpy( szBuffer, lpValueName ); + + LPTSTR pszBuffer = szBuffer; + LPTSTR pszLast = szBuffer; + while( *pszBuffer ) + { + if( *pszBuffer == _T('\\') || *pszBuffer == _T('/') ) + { + pszLast = pszBuffer; + lpValueName = pszLast + 1; + } + pszBuffer++; + } + + if(!regEnabled) { + if(WritePrivateProfileStruct("Viewer", + lpValueName, + (LPVOID)lpData, + cbData, + regGetINIPath())) { + return ERROR_SUCCESS; + } + return -1; + } + + bool m_bNeedToCloseKey = false; + if( pszLast != szBuffer ) + { + *pszLast = _T('\000'); + HKEY hkeyTemp; + long lRet = RegOpenKey( hKey, szBuffer, &hkeyTemp ); + if( lRet != ERROR_SUCCESS ) + { + lRet = RegCreateKey( hKey, szBuffer, &hkeyTemp ); + if( lRet != ERROR_SUCCESS ) + return lRet; + } + hKey = hkeyTemp; + m_bNeedToCloseKey = true; + } + + long lRet = RegSetValueEx( hKey, lpValueName, Reserved, dwType, lpData, cbData ); + if( m_bNeedToCloseKey ) + { + R_VERIFY( RegCloseKey( hKey ) == ERROR_SUCCESS ); + } + return lRet; +} + + +int ResizeDlgGetItemCount(const DialogSizerSizingItem *psd) +{ + R_ASSERT( psd ); + int nCount = 0; + while( psd->uSizeInfo != 0xFFFFFFFF ) + { + nCount++; + psd++; + } + return nCount; +} + +void ResizeDlgUpdateGripperRect( const int cx, const int cy, WinHelper::CRect &rcGrip ) +{ + const int nGripWidth = GetSystemMetrics( SM_CYVSCROLL ); + const int nGripHeight = GetSystemMetrics( SM_CXVSCROLL ); + rcGrip.left = cx - nGripWidth; + rcGrip.top = cy - nGripHeight; + rcGrip.right = cx; + rcGrip.bottom = cy; +} + +void ResizeDlgUpdateGripper( HWND hwnd, DialogData *pdd ) +{ + if( pdd->m_bShowSizingGrip ) + { + WinHelper::CRect rcOld( pdd->m_rcGrip ); + + ResizeDlgUpdateGripperRect( pdd->m_sizeClient.cx, pdd->m_sizeClient.cy, pdd->m_rcGrip ); + + // + // We also need to invalidate the combined area of the old and new rectangles + // otherwise we would have trail of grippers when we sized the dialog larger + // in any axis + (void)UnionRect( &rcOld, &rcOld, &pdd->m_rcGrip ); + (void)InvalidateRect( hwnd, &rcOld, TRUE ); + } +} + +void ResizeDlgCopyItems( DialogSizerSizingItem *psdDest, const DialogSizerSizingItem *psdSource ) + // + // Will copy all of the items in psdSource into psdDest. +{ + // + // Loop til we reach the end + while( psdSource->uSizeInfo != 0xFFFFFFFF ) + { + *psdDest = *psdSource; + psdDest++; + psdSource++; + } + // And when we do copy the last item + *psdDest = *psdSource; +} + + +ResizeDlg::ResizeDlg(UINT id, CWnd *parent) + : CDialog(id, parent) +{ + dd = NULL; +} + +void *ResizeDlg::AddDialogData() + // + // Firstly determine if the data already exists, if it does then return that, if not then we will + // create and initialise a brand new structure. +{ + DialogData *pdd = (DialogData*)dd; + if( !pdd ) { + pdd = (DialogData *)calloc(1, sizeof(DialogData)); + } + + if( pdd ) { + // + // Store some sizes etc. for later. + CRect rc; + GetWindowRect( rc ); + pdd->m_ptSmallest.x = rc.Width(); + pdd->m_ptSmallest.y = rc.Height(); + + + GetClientRect( rc ); + pdd->m_sizeClient = rc.Size(); + dd = pdd; + ResizeDlgUpdateGripperRect( pdd->m_sizeClient.cx, pdd->m_sizeClient.cy, pdd->m_rcGrip ); + } + return pdd; +} + +BOOL ResizeDlg::SetData(const DialogSizerSizingItem *psd, + BOOL bShowSizingGrip, + HKEY hkRootSave, + LPCTSTR pcszName, + SIZE *psizeMax) + // + // Setting a dialog sizeable involves subclassing the window and handling it's + // WM_SIZE messages, if we have a hkRootSave and pcszName then we will also be loading/saving + // the size and position of the window from the registry. We load from the registry when we + // subclass the window and we save to the registry when we get a WM_DESTROY. + // + // It will return non-zero for success and zero if it fails +{ + R_ASSERT( psd ); + R_ASSERT( ( hkRootSave != NULL && pcszName != NULL ) + || ( hkRootSave == NULL && pcszName == NULL ) ); + // + // Make sure all of the parameters are valid. + if( ::IsWindow( *this ) + && psd + && ( ( hkRootSave != NULL && pcszName != NULL && + !IsBadStringPtr( pcszName, 0xFFFF ) ) || + ( hkRootSave == NULL && pcszName == NULL ) ) + && ( psizeMax == NULL || !IsBadReadPtr( psizeMax, sizeof( SIZE ) ) ) + ) { + DialogData *pdd = (DialogData *)AddDialogData(); + if( pdd ) { + pdd->hkRootSave = hkRootSave; + pdd->pcszName = pcszName; + pdd->m_bShowSizingGrip = bShowSizingGrip; + pdd->nItemCount = ResizeDlgGetItemCount( psd ) + 1; + pdd->psd = (DialogSizerSizingItem *) + calloc(pdd->nItemCount, + sizeof(DialogSizerSizingItem )); + if( pdd->psd ) { + // + // Copy all of the user controls etc. for later, this way the user can quite happily + // let the structure go out of scope. + ResizeDlgCopyItems( pdd->psd, psd ); + if( psizeMax ) { + pdd->m_ptLargest.x = psizeMax->cx; + pdd->m_ptLargest.y = psizeMax->cy; + pdd->m_bLargestSet = true; + } + + // + // If the there was save info passed in then we need to make damn good use of it + // by attempting to load the RegistryData structure + if( hkRootSave && pcszName ) { + RegistryData rd; + DWORD dwSize = sizeof( RegistryData ); + DWORD dwType = REG_BINARY; + if( RegQueryValueExRecursive( hkRootSave, pcszName, NULL, &dwType, reinterpret_cast( &rd ), &dwSize ) == ERROR_SUCCESS && dwSize == sizeof( rd ) ) { + if( !(GetWindowLong( *this, GWL_STYLE ) & WS_VISIBLE) ) + rd.m_wpl.showCmd = SW_HIDE; + + VAPI( SetWindowPlacement( &rd.m_wpl ) ); + } + } + return TRUE; + } else { + free(pdd); + } + } + } + return FALSE; +} + +void ResizeDlg::UpdateWindowSize(const int cx, const int cy, HWND hwnd) +{ + DialogData *pdd = (DialogData*)dd; + if( pdd ) { + const int nDeltaX = cx - pdd->m_sizeClient.cx; + const int nDeltaY = cy - pdd->m_sizeClient.cy; + WinHelper::CDeferWindowPos def( pdd->nItemCount ); + WinHelper::CRect rc; + const DialogSizerSizingItem *psd = pdd->psd; + while( psd->uSizeInfo != 0xFFFFFFFF ) { + HWND hwndChild = ::GetDlgItem( *this, psd->uControlID ); + if( ::IsWindow( hwndChild ) ) { + VAPI( ::GetWindowRect( hwndChild, rc ) ); + (void)::MapWindowPoints( ::GetDesktopWindow(), hwnd, + (LPPOINT)&rc, 2 ); + + // + // Adjust the window horizontally + if( psd->uSizeInfo & DS_MoveX ) { + rc.left += nDeltaX; + rc.right += nDeltaX; + } + + // + // Adjust the window vertically + if( psd->uSizeInfo & DS_MoveY ) { + rc.top += nDeltaY; + rc.bottom += nDeltaY; + } + + // + // Size the window horizontally + if( psd->uSizeInfo & DS_SizeX ) { + rc.right += nDeltaX; + } + + // + // Size the window vertically + if( psd->uSizeInfo & DS_SizeY ) { + rc.bottom += nDeltaY; + } + + (void)def.DeferWindowPos( hwndChild, NULL, rc, + SWP_NOACTIVATE | SWP_NOZORDER ); + } + psd++; + } + + pdd->m_sizeClient.cx = cx; + pdd->m_sizeClient.cy = cy; + + // + // If we have a sizing grip enabled then adjust it's position + ResizeDlgUpdateGripper( hwnd, pdd ); + } +} + +BOOL ResizeDlg::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *res ) + // Actual window procedure that will handle saving window size/position and moving + // the controls whilst the window sizes. +{ + if(dd == NULL) { + return CDialog::OnWndMsg(msg, wParam, lParam, res); + } + switch( msg ) { + case WM_ERASEBKGND: + { + BOOL r = CDialog::OnWndMsg(msg, wParam, lParam, res); + DialogData *pdd = (DialogData*)dd; + if( pdd && pdd->m_bShowSizingGrip && !pdd->m_bMaximised ) { + VAPI( ::DrawFrameControl( reinterpret_cast( wParam ), + pdd->m_rcGrip, + DFC_SCROLL, DFCS_SCROLLSIZEGRIP ) ); + } + return r; + } + case WM_SIZE: + { + DialogData *pdd = (DialogData*)dd; + if( pdd && wParam != SIZE_MINIMIZED ) { + pdd->m_bMaximised = ( wParam == SIZE_MAXIMIZED ? true : false ); + UpdateWindowSize( LOWORD( lParam ), HIWORD( lParam ), *this); + } + } + break; + case WM_NCHITTEST: + { + // + // If the gripper is enabled then perform a simple hit test on our gripper area. + DialogData *pdd = (DialogData*)dd; + if( pdd && pdd->m_bShowSizingGrip ) { + POINT pt = { LOWORD(lParam), HIWORD(lParam) }; + (void)ScreenToClient( &pt ); + if( PtInRect( pdd->m_rcGrip, pt ) ) + return (BOOL)HTBOTTOMRIGHT; + } + } + break; + case WM_GETMINMAXINFO: + { + // + // Our opportunity to say that we do not want the dialog to grow or shrink any more. + DialogData *pdd = (DialogData*)dd; + LPMINMAXINFO lpmmi = reinterpret_cast( lParam ); + lpmmi->ptMinTrackSize = pdd->m_ptSmallest; + if( pdd->m_bLargestSet ) { + lpmmi->ptMaxTrackSize = pdd->m_ptLargest; + } + } + return (BOOL)0; + case WM_NOTIFY: + { + if( reinterpret_cast(lParam)->code == PSN_SETACTIVE ) { + CRect rc; + VAPI( ::GetClientRect( *GetParent( ), &rc ) ); + UpdateWindowSize( rc.Width(), rc.Height(), *GetParent( ) ); + } + } + break; + case WM_DESTROY: + { + // + // Our opportunty for cleanup. + // Simply acquire all of our objects, free the appropriate memory and remove the + // properties from the window. If we do not remove the properties then they will constitute + // a resource leak. + DialogData *pdd = (DialogData*)dd; + if( pdd ) { + RegistryData rd; + rd.m_wpl.length = sizeof( rd.m_wpl ); + VAPI( GetWindowPlacement( &rd.m_wpl ) ); + + if( pdd->hkRootSave && pdd->pcszName ) { + (void)RegSetValueExRecursive( pdd->hkRootSave, pdd->pcszName, + NULL, REG_BINARY, + reinterpret_cast( &rd ), + sizeof( rd ) ); + } + + if( pdd->psd ) { + free(pdd->psd); + } + free(pdd); + } + + } + break; + } + return CDialog::OnWndMsg(msg, wParam, lParam, res); +} diff --git a/src/win32/ResizeDlg.h b/src/win32/ResizeDlg.h new file mode 100644 index 0000000..e09d589 --- /dev/null +++ b/src/win32/ResizeDlg.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_WIN32_RESIZEDLG_H +#define VBA_WIN32_RESIZEDLG_H + +#ifndef _INC_TCHAR +#include +#endif // _INC_TCHAR + +// +// Predefined sizing information +#define DS_MoveX 1 +#define DS_MoveY 2 +#define DS_SizeX 4 +#define DS_SizeY 8 + +typedef struct DialogSizerSizingItem // sdi +{ + UINT uControlID; + UINT uSizeInfo; +} DialogSizerSizingItem; + +#define DIALOG_SIZER_START( name ) DialogSizerSizingItem name[] = { +#define DIALOG_SIZER_ENTRY( controlID, flags ) { controlID, flags }, +#define DIALOG_SIZER_END() { 0xFFFFFFFF, 0xFFFFFFFF } }; + +class ResizeDlg : public CDialog { + void *dd; + public: + ResizeDlg(UINT id, CWnd *parent = NULL); + + void *AddDialogData(); + BOOL SetData(const DialogSizerSizingItem *psd, + BOOL bShowSizingGrip, + HKEY hkRootSave, + LPCTSTR pcszName, + SIZE *psizeMax); + void UpdateWindowSize(const int cx, const int cy, HWND); + + virtual BOOL OnWndMsg(UINT, WPARAM, LPARAM, LRESULT *); +}; +#endif diff --git a/src/win32/RewindInterval.cpp b/src/win32/RewindInterval.cpp new file mode 100644 index 0000000..de5d40c --- /dev/null +++ b/src/win32/RewindInterval.cpp @@ -0,0 +1,119 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// RewindInterval.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "RewindInterval.h" +#include "math.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// RewindInterval dialog + + +RewindInterval::RewindInterval(float interval, int slots, CWnd* pParent /*=NULL*/) + : CDialog(RewindInterval::IDD, pParent) +{ + //{{AFX_DATA_INIT(RewindInterval) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + this->interval = interval; + this->slots = slots; +} + + +void RewindInterval::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(RewindInterval) + DDX_Control(pDX, IDC_INTERVAL, m_interval); + DDX_Control(pDX, IDC_REWINDSLOTS, m_slots); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(RewindInterval, CDialog) + //{{AFX_MSG_MAP(RewindInterval) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// RewindInterval message handlers + +void RewindInterval::OnCancel() +{ + EndDialog(-1); +} + +void RewindInterval::OnOk() +{ + CString buffer, buffer2; + + m_interval.GetWindowText(buffer); + m_slots.GetWindowText(buffer2); + + float interval = (float)atof(buffer); + int slots = atoi(buffer2); + + + if(interval >= 0 && (int)interval <= 600) { + if(slots >= 0 && slots <= MAX_REWIND_SLOTS) + { + int iInterval = (int)(interval*6.0f + 0.5f); + if(interval > 0 && iInterval == 0) + iInterval = 1; + EndDialog(iInterval | (slots << 16)); + theApp.winAccelMgr.UpdateMenu(theApp.menu); + } else + systemMessage(IDS_INVALID_INTERVAL_VALUE, + "Invalid rewind slot amount. Please enter a number " + "between 0 and 128 slots"); + } else + systemMessage(IDS_INVALID_INTERVAL_VALUE, + "Invalid rewind interval value. Please enter a number " + "between 0 and 600 seconds"); +} + +BOOL RewindInterval::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_interval.LimitText(5); + m_slots.LimitText(3); + + CString buffer, buffer2; + buffer.Format("%.1f", interval); + m_interval.SetWindowText(buffer); + buffer2.Format("%d", slots); + m_slots.SetWindowText(buffer2); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/RewindInterval.h b/src/win32/RewindInterval.h new file mode 100644 index 0000000..1cdb42c --- /dev/null +++ b/src/win32/RewindInterval.h @@ -0,0 +1,70 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_REWINDINTERVAL_H__C95AFF44_1F64_44C8_BAAB_A54B982D28EA__INCLUDED_) +#define AFX_REWINDINTERVAL_H__C95AFF44_1F64_44C8_BAAB_A54B982D28EA__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// RewindInterval.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// RewindInterval dialog + +class RewindInterval : public CDialog +{ + // Construction + public: + float interval; + int slots; + RewindInterval(float interval, int slots, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(RewindInterval) + enum { IDD = IDD_REWIND_INTERVAL }; + CEdit m_interval; + CEdit m_slots; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(RewindInterval) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(RewindInterval) + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_REWINDINTERVAL_H__C95AFF44_1F64_44C8_BAAB_A54B982D28EA__INCLUDED_) diff --git a/src/win32/RomInfo.cpp b/src/win32/RomInfo.cpp new file mode 100644 index 0000000..1d923ca --- /dev/null +++ b/src/win32/RomInfo.cpp @@ -0,0 +1,575 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// RomInfo.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "RomInfo.h" +#include "WinResUtil.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int gbRomSize; + +struct WinGBACompanyName { + LPCTSTR code; + LPCTSTR name; +}; + +static WinGBACompanyName winGBARomInfoCompanies[] = { + { "01", "Nintendo" }, + { "02", "Rocket Games" }, + { "08", "Capcom" }, + { "09", "Hot B Co." }, + { "0A", "Jaleco" }, + { "0B", "Coconuts Japan" }, + { "0C", "Coconuts Japan/G.X.Media" }, + { "0H", "Starfish" }, + { "0L", "Warashi Inc." }, + { "0N", "Nowpro" }, + { "0P", "Game Village" }, + { "13", "Electronic Arts Japan" }, + { "18", "Hudson Soft Japan" }, + { "19", "S.C.P." }, + { "1A", "Yonoman" }, + { "1G", "SMDE" }, + { "1P", "Creatures Inc." }, + { "1Q", "TDK Deep Impresion" }, + { "20", "Destination Software" }, + { "22", "VR 1 Japan" }, + { "25", "San-X" }, + { "28", "Kemco Japan" }, + { "29", "Seta" }, + { "2H", "Ubisoft Japan" }, + { "2K", "NEC InterChannel" }, + { "2L", "Tam" }, + { "2M", "Jordan" }, + { "2N", "Smilesoft" }, + { "2Q", "Mediakite" }, + { "36", "Codemasters" }, + { "37", "GAGA Communications" }, + { "38", "Laguna" }, + { "39", "Telstar Fun and Games" }, + { "41", "Ubi Soft Entertainment" }, + { "42", "Sunsoft" }, + { "47", "Spectrum Holobyte" }, + { "49", "IREM" }, + { "4D", "Malibu Games" }, + { "4F", "Eidos/U.S. Gold" }, + { "4J", "Fox Interactive" }, + { "4K", "Time Warner Interactive" }, + { "4Q", "Disney" }, + { "4S", "Black Pearl" }, + { "4X", "GT Interactive" }, + { "4Y", "RARE" }, + { "4Z", "Crave Entertainment" }, + { "50", "Absolute Entertainment" }, + { "51", "Acclaim" }, + { "52", "Activision" }, + { "53", "American Sammy Corp." }, + { "54", "Take 2 Interactive" }, + { "55", "Hi Tech" }, + { "56", "LJN LTD." }, + { "58", "Mattel" }, + { "5A", "Mindscape/Red Orb Ent." }, + { "5C", "Taxan" }, + { "5D", "Midway" }, + { "5F", "American Softworks" }, + { "5G", "Majesco Sales Inc" }, + { "5H", "3DO" }, + { "5K", "Hasbro" }, + { "5L", "NewKidCo" }, + { "5M", "Telegames" }, + { "5N", "Metro3D" }, + { "5P", "Vatical Entertainment" }, + { "5Q", "LEGO Media" }, + { "5S", "Xicat Interactive" }, + { "5T", "Cryo Interactive" }, + { "5W", "Red Storm Ent./BKN Ent." }, + { "5X", "Microids" }, + { "5Z", "Conspiracy Entertainment Corp." }, + { "60", "Titus Interactive Studios" }, + { "61", "Virgin Interactive" }, + { "62", "Maxis" }, + { "64", "LucasArts Entertainment" }, + { "67", "Ocean" }, + { "69", "Electronic Arts" }, + { "6E", "Elite Systems Ltd." }, + { "6F", "Electro Brain" }, + { "6G", "The Learning Company" }, + { "6H", "BBC" }, + { "6J", "Software 2000" }, + { "6L", "BAM! Entertainment" }, + { "6M", "Studio 3" }, + { "6Q", "Classified Games" }, + { "6S", "TDK Mediactive" }, + { "6U", "DreamCatcher" }, + { "6V", "JoWood Productions" }, + { "6W", "SEGA" }, + { "6X", "Wannado Edition" }, + { "6Y", "LSP" }, + { "6Z", "ITE Media" }, + { "70", "Infogrames" }, + { "71", "Interplay" }, + { "72", "JVC Musical Industries Inc" }, + { "73", "Parker Brothers" }, + { "75", "SCI" }, + { "78", "THQ" }, + { "79", "Accolade" }, + { "7A", "Triffix Ent. Inc." }, + { "7C", "Microprose Software" }, + { "7D", "Universal Interactive Studios" }, + { "7F", "Kemco" }, + { "7G", "Rage Software" }, + { "7H", "Encore" }, + { "7J", "Zoo" }, + { "7K", "BVM" }, + { "7L", "Simon & Schuster Interactive" }, + { "7M", "Asmik Ace Entertainment Inc./AIA" }, + { "7N", "Empire Interactive" }, + { "7Q", "Jester Interactive" }, + { "7T", "Scholastic" }, + { "7U", "Ignition Entertainment" }, + { "7W", "Stadlbauer" }, + { "80", "Misawa" }, + { "83", "LOZC" }, + { "8B", "Bulletproof Software" }, + { "8C", "Vic Tokai Inc." }, + { "8J", "General Entertainment" }, + { "8N", "Success" }, + { "8P", "SEGA Japan" }, + { "91", "Chun Soft" }, + { "92", "Video System" }, + { "93", "BEC" }, + { "96", "Yonezawa/S'pal" }, + { "97", "Kaneko" }, + { "99", "Victor Interactive Software" }, + { "9A", "Nichibutsu/Nihon Bussan" }, + { "9B", "Tecmo" }, + { "9C", "Imagineer" }, + { "9F", "Nova" }, + { "9H", "Bottom Up" }, + { "9L", "Hasbro Japan" }, + { "9N", "Marvelous Entertainment" }, + { "9P", "Keynet Inc." }, + { "9Q", "Hands-On Entertainment" }, + { "A0", "Telenet" }, + { "A1", "Hori" }, + { "A4", "Konami" }, + { "A6", "Kawada" }, + { "A7", "Takara" }, + { "A9", "Technos Japan Corp." }, + { "AA", "JVC" }, + { "AC", "Toei Animation" }, + { "AD", "Toho" }, + { "AF", "Namco" }, + { "AG", "Media Rings Corporation" }, + { "AH", "J-Wing" }, + { "AK", "KID" }, + { "AL", "MediaFactory" }, + { "AP", "Infogrames Hudson" }, + { "AQ", "Kiratto. Ludic Inc" }, + { "B0", "Acclaim Japan" }, + { "B1", "ASCII" }, + { "B2", "Bandai" }, + { "B4", "Enix" }, + { "B6", "HAL Laboratory" }, + { "B7", "SNK" }, + { "B9", "Pony Canyon Hanbai" }, + { "BA", "Culture Brain" }, + { "BB", "Sunsoft" }, + { "BD", "Sony Imagesoft" }, + { "BF", "Sammy" }, + { "BG", "Magical" }, + { "BJ", "Compile" }, + { "BL", "MTO Inc." }, + { "BN", "Sunrise Interactive" }, + { "BP", "Global A Entertainment" }, + { "BQ", "Fuuki" }, + { "C0", "Taito" }, + { "C2", "Kemco" }, + { "C3", "Square Soft" }, + { "C5", "Data East" }, + { "C6", "Tonkin House" }, + { "C8", "Koei" }, + { "CA", "Konami/Palcom/Ultra" }, + { "CB", "Vapinc/NTVIC" }, + { "CC", "Use Co.,Ltd." }, + { "CD", "Meldac" }, + { "CE", "FCI/Pony Canyon" }, + { "CF", "Angel" }, + { "CM", "Konami Computer Entertainment Osaka" }, + { "CP", "Enterbrain" }, + { "D1", "Sofel" }, + { "D2", "Quest" }, + { "D3", "Sigma Enterprises" }, + { "D4", "Ask Kodansa" }, + { "D6", "Naxat" }, + { "D7", "Copya System" }, + { "D9", "Banpresto" }, + { "DA", "TOMY" }, + { "DB", "LJN Japan" }, + { "DD", "NCS" }, + { "DF", "Altron Corporation" }, + { "DH", "Gaps Inc." }, + { "DN", "ELF" }, + { "E2", "Yutaka" }, + { "E3", "Varie" }, + { "E5", "Epoch" }, + { "E7", "Athena" }, + { "E8", "Asmik Ace Entertainment Inc." }, + { "E9", "Natsume" }, + { "EA", "King Records" }, + { "EB", "Atlus" }, + { "EC", "Epic/Sony Records" }, + { "EE", "IGS" }, + { "EL", "Spike" }, + { "EM", "Konami Computer Entertainment Tokyo" }, + { "EN", "Alphadream Corporation" }, + { "F0", "A Wave" }, + { "G1", "PCCW" }, + { "G4", "KiKi Co Ltd" }, + { "G5", "Open Sesame Inc." }, + { "G6", "Sims" }, + { "G7", "Broccoli" }, + { "G8", "Avex" }, + { "G9", "D3 Publisher" }, + { "GB", "Konami Computer Entertainment Japan" }, + { "GD", "Square-Enix" }, + { "HY", "Sachen" }, + { NULL, NULL } +}; + +static LPCTSTR winGBARomInfoFindMakerCode(LPCTSTR code) +{ + int i = 0; + while(winGBARomInfoCompanies[i].code) { + if(!strcmp(winGBARomInfoCompanies[i].code, code)) + return winGBARomInfoCompanies[i].name; + i++; + } + return (LPCTSTR)winResLoadString(IDS_UNKNOWN); +} + + +///////////////////////////////////////////////////////////////////////////// +// RomInfoGB dialog + + +RomInfoGB::RomInfoGB(u8 *rom, CWnd* pParent /*=NULL*/) + : CDialog(RomInfoGB::IDD, pParent) +{ + //{{AFX_DATA_INIT(RomInfoGB) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + this->rom = rom; +} + + +void RomInfoGB::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(RomInfoGB) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(RomInfoGB, CDialog) + //{{AFX_MSG_MAP(RomInfoGB) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// RomInfoGB message handlers + +void RomInfoGB::OnOk() +{ + EndDialog(TRUE); +} + +BOOL RomInfoGB::OnInitDialog() +{ + CDialog::OnInitDialog(); + + char buffer[128]; + + strncpy(buffer, (const char *)&rom[0x134], 15); + buffer[15] = 0; + GetDlgItem(IDC_ROM_TITLE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0x143]); + GetDlgItem(IDC_ROM_COLOR)->SetWindowText(buffer); + + strncpy(buffer, (const char *)&rom[0x144],2); + buffer[2] = 0; + GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer); + + if(rom[0x14b] != 0x33) { + sprintf(buffer, "%02X", rom[0x14b]); + GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer); + } + GetDlgItem(IDC_ROM_MAKER_NAME2)->SetWindowText(winGBARomInfoFindMakerCode(buffer)); + + sprintf(buffer, "%02x", rom[0x146]); + GetDlgItem(IDC_ROM_UNIT_CODE)->SetWindowText(buffer); + + CString type = winResLoadString(IDS_UNKNOWN); + switch(rom[0x147]) { + case 0x00: + type = "ROM"; + break; + case 0x01: + type = "ROM+MBC1"; + break; + case 0x02: + type = "ROM+MBC1+RAM"; + break; + case 0x03: + type = "ROM+MBC1+RAM+BATT"; + break; + case 0x05: + type = "ROM+MBC2"; + break; + case 0x06: + type = "ROM+MBC2+BATT"; + break; + case 0x0f: + type = "ROM+MBC3+TIMER+BATT"; + break; + case 0x10: + type = "ROM+MBC3+TIMER+RAM+BATT"; + break; + case 0x11: + type = "ROM+MBC3"; + break; + case 0x12: + type = "ROM+MBC3+RAM"; + break; + case 0x13: + type = "ROM+MBC3+RAM+BATT"; + break; + case 0x19: + type = "ROM+MBC5"; + break; + case 0x1a: + type = "ROM+MBC5+RAM"; + break; + case 0x1b: + type = "ROM+MBC5+RAM+BATT"; + break; + case 0x1c: + type = "ROM+MBC5+RUMBLE"; + break; + case 0x1d: + type = "ROM+MBC5+RUMBLE+RAM"; + break; + case 0x1e: + type = "ROM+MBC5+RUMBLE+RAM+BATT"; + break; + case 0x22: + type = "ROM+MBC7+BATT"; + break; + case 0xfe: + type = "ROM+HuC-3"; + break; + case 0xff: + type = "ROM+HuC-1"; + break; + } + sprintf(buffer, "%02x (%s)", rom[0x147], (const char *)type); + GetDlgItem(IDC_ROM_DEVICE_TYPE)->SetWindowText(buffer); + + type = winResLoadString(IDS_UNKNOWN); + switch(rom[0x148]) { + case 0: + type = "32K"; + break; + case 1: + type = "64K"; + break; + case 2: + type = "128K"; + break; + case 3: + type = "256K"; + break; + case 4: + type = "512K"; + break; + case 5: + type = "1M"; + break; + case 6: + type = "2M"; + break; + case 7: + type = "4M"; + break; + } + + sprintf(buffer, "%02x (%s)", rom[0x148], (const char *)type); + GetDlgItem(IDC_ROM_SIZE)->SetWindowText(buffer); + + type = winResLoadString(IDS_UNKNOWN); + switch(rom[0x149]) { + case 0: + type = winResLoadString(IDS_NONE); + break; + case 1: + type = "2K"; + break; + case 2: + type = "8K"; + break; + case 3: + type = "32K"; + break; + case 4: + type = "128K"; + break; + case 5: + type = "64K"; + break; + } + + sprintf(buffer, "%02x (%s)", rom[0x149], (const char *)type); + GetDlgItem(IDC_ROM_RAM_SIZE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0x14a]); + GetDlgItem(IDC_ROM_DEST_CODE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0x14b]); + GetDlgItem(IDC_ROM_LIC_CODE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0x14c]); + GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer); + + u8 crc = 25; + int i; + for(i = 0x134; i < 0x14d; i++) { + crc += rom[i]; + } + + crc = 256 - crc; + + sprintf(buffer, "%02x (%02x)", crc, rom[0x14d]); + GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer); + + u16 crc16 = 0; + for(i = 0; i < gbRomSize; i++) { + crc16 += rom[i]; + } + + crc16 -= rom[0x14e]; + crc16 -= rom[0x14f]; + sprintf(buffer, "%04x (%04x)", crc16, (rom[0x14e]<<8)|rom[0x14f]); + GetDlgItem(IDC_ROM_CHECKSUM)->SetWindowText(buffer); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} +///////////////////////////////////////////////////////////////////////////// +// RomInfoGBA dialog + + +RomInfoGBA::RomInfoGBA(u8 *rom, CWnd* pParent /*=NULL*/) + : CDialog(RomInfoGBA::IDD, pParent) +{ + //{{AFX_DATA_INIT(RomInfoGBA) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + this->rom = rom; +} + + +void RomInfoGBA::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(RomInfoGBA) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(RomInfoGBA, CDialog) + //{{AFX_MSG_MAP(RomInfoGBA) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// RomInfoGBA message handlers + +void RomInfoGBA::OnOk() +{ + EndDialog(TRUE); +} + +BOOL RomInfoGBA::OnInitDialog() +{ + CDialog::OnInitDialog(); + + char buffer[13]; + + strncpy(buffer, (const char *)&rom[0xa0], 12); + buffer[12] = 0; + GetDlgItem(IDC_ROM_TITLE)->SetWindowText(buffer); + + strncpy(buffer, (const char *)&rom[0xac], 4); + buffer[4] = 0; + GetDlgItem(IDC_ROM_GAME_CODE)->SetWindowText(buffer); + + strncpy(buffer, (const char *)&rom[0xb0],2); + buffer[2] = 0; + GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer); + + GetDlgItem(IDC_ROM_MAKER_NAME)->SetWindowText(winGBARomInfoFindMakerCode(buffer)); + + sprintf(buffer, "%02x", rom[0xb3]); + GetDlgItem(IDC_ROM_UNIT_CODE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0xb4]); + GetDlgItem(IDC_ROM_DEVICE_TYPE)->SetWindowText(buffer); + + sprintf(buffer, "%02x", rom[0xbc]); + GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer); + + u8 crc = 0x19; + for(int i = 0xa0; i < 0xbd; i++) { + crc += rom[i]; + } + + crc = (-crc) & 255; + + sprintf(buffer, "%02x (%02x)", crc, rom[0xbd]); + GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/src/win32/RomInfo.h b/src/win32/RomInfo.h new file mode 100644 index 0000000..e7005f4 --- /dev/null +++ b/src/win32/RomInfo.h @@ -0,0 +1,101 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_ROMINFO_H__9888A45C_3E71_4C0F_B119_EFC74DFF8CD3__INCLUDED_) +#define AFX_ROMINFO_H__9888A45C_3E71_4C0F_B119_EFC74DFF8CD3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// RomInfo.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// RomInfoGB dialog + +class RomInfoGB : public CDialog +{ + // Construction + public: + RomInfoGB(u8 *rom, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(RomInfoGB) + enum { IDD = IDD_GB_ROM_INFO }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(RomInfoGB) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + u8 *rom; + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(RomInfoGB) + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// +// RomInfoGBA dialog + +class RomInfoGBA : public CDialog +{ + // Construction + public: + RomInfoGBA(u8 *rom, CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(RomInfoGBA) + enum { IDD = IDD_GBA_ROM_INFO }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + u8 *rom; + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(RomInfoGBA) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(RomInfoGBA) + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ROMINFO_H__9888A45C_3E71_4C0F_B119_EFC74DFF8CD3__INCLUDED_) diff --git a/src/win32/Sound.h b/src/win32/Sound.h new file mode 100644 index 0000000..b46d210 --- /dev/null +++ b/src/win32/Sound.h @@ -0,0 +1,37 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_WIN32_SOUND_H +#define VBA_WIN32_SOUND_H + +class ISound +{ + public: + virtual ~ISound() {}; + + virtual bool init() = 0; + virtual void pause() = 0; + virtual void reset() = 0; + virtual void resume() = 0; + virtual void write() = 0; + virtual void setSpeed(float rate) = 0; + virtual bool isPlaying() = 0; +}; + +#endif diff --git a/src/win32/StringTokenizer.cpp b/src/win32/StringTokenizer.cpp new file mode 100644 index 0000000..b7ea313 --- /dev/null +++ b/src/win32/StringTokenizer.cpp @@ -0,0 +1,69 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// StringTokenizer.cpp: implementation of the StringTokenizer class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "vba.h" +#include "StringTokenizer.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +StringTokenizer::StringTokenizer(CString str, CString del) +{ + m_right = str; + m_delim = del; +} + +StringTokenizer::~StringTokenizer() +{ + +} + + +const char *StringTokenizer::next() +{ + int index = m_right.FindOneOf(m_delim); + + while(index == 0) { + m_right = m_right.Right(m_right.GetLength()-1); + index = m_right.FindOneOf(m_delim); + } + if(index == -1) { + if(m_right.IsEmpty()) + return NULL; + m_token = m_right; + m_right.Empty(); + return m_token; + } + + m_token = m_right.Left(index); + m_right = m_right.Right(m_right.GetLength()-(1+index)); + + return m_token; +} diff --git a/src/win32/StringTokenizer.h b/src/win32/StringTokenizer.h new file mode 100644 index 0000000..7deae2d --- /dev/null +++ b/src/win32/StringTokenizer.h @@ -0,0 +1,44 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// StringTokenizer.h: interface for the StringTokenizer class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_STRINGTOKENIZER_H__1AB4CD12_6B7A_49E4_A87F_75D3DC3FF20F__INCLUDED_) +#define AFX_STRINGTOKENIZER_H__1AB4CD12_6B7A_49E4_A87F_75D3DC3FF20F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class StringTokenizer +{ + public: + const char * next(); + StringTokenizer(CString str, CString token); + virtual ~StringTokenizer(); + + private: + CString m_token; + CString m_delim; + CString m_right; +}; + +#endif // !defined(AFX_STRINGTOKENIZER_H__1AB4CD12_6B7A_49E4_A87F_75D3DC3FF20F__INCLUDED_) diff --git a/src/win32/TextOptions.cpp b/src/win32/TextOptions.cpp new file mode 100644 index 0000000..7f57ae7 --- /dev/null +++ b/src/win32/TextOptions.cpp @@ -0,0 +1,80 @@ +// TextOptions.cpp : implementation file +// + +#include "stdafx.h" +#include "../Text.h" +#include "TextOptions.h" +#include ".\textoptions.h" + + +// TextOptions dialog + +IMPLEMENT_DYNAMIC(TextOptions, CDialog) +TextOptions::TextOptions(CWnd* pParent /*=NULL*/) +: CDialog(TextOptions::IDD, pParent) +{ +} + +TextOptions::~TextOptions() +{ +} + +BOOL TextOptions::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CheckRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK, IDC_RADIO_WHITE + textColor); + CheckRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER, IDC_RADIO_PREFILTER + textMethod); + CheckDlgButton(IDC_CHECK_OUTLINED, outlinedText); + CheckDlgButton(IDC_CHECK_TRANSPARENT, transparentText); + GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(GetCheckedRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER) != IDC_RADIO_POSTRENDER); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void TextOptions::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(TextOptions, CDialog) + ON_BN_CLICKED(IDOK, OnBnClickedOk) + ON_BN_CLICKED(IDC_RADIO_PREFILTER, OnBnClickedRadioPrefilter) + ON_BN_CLICKED(IDC_RADIO_POSTFILTER, OnBnClickedRadioPostfilter) + ON_BN_CLICKED(IDC_RADIO_POSTRENDER, OnBnClickedRadioPostrender) +END_MESSAGE_MAP() + + +// TextOptions message handlers + +void TextOptions::OnBnClickedOk() +{ + transparentText = IsDlgButtonChecked(IDC_CHECK_TRANSPARENT) != 0; + outlinedText = IsDlgButtonChecked(IDC_CHECK_OUTLINED) != 0; + textMethod = GetCheckedRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER) - IDC_RADIO_PREFILTER; + textColor = GetCheckedRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK) - IDC_RADIO_WHITE; + if(textMethod < 0) textMethod = 0; + if(textMethod > 2) textMethod = 2; + if(textColor < 0) textColor = 0; + if(textColor > 7) textColor = 7; + + OnOK(); +} + +void TextOptions::OnBnClickedRadioPrefilter() +{ + GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE); +} + +void TextOptions::OnBnClickedRadioPostfilter() +{ + GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE); +} + +void TextOptions::OnBnClickedRadioPostrender() +{ + GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(FALSE); + CheckDlgButton(IDC_CHECK_TRANSPARENT, FALSE); +} diff --git a/src/win32/TextOptions.h b/src/win32/TextOptions.h new file mode 100644 index 0000000..443d415 --- /dev/null +++ b/src/win32/TextOptions.h @@ -0,0 +1,28 @@ +#pragma once + + +// TextOptions dialog + +class TextOptions : public CDialog +{ + DECLARE_DYNAMIC(TextOptions) + +public: + TextOptions(CWnd* pParent = NULL); // standard constructor + virtual ~TextOptions(); + + virtual BOOL OnInitDialog() ; + +// Dialog Data + enum { IDD = IDD_TEXTCONFIG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnBnClickedOk(); + afx_msg void OnBnClickedRadioPrefilter(); + afx_msg void OnBnClickedRadioPostfilter(); + afx_msg void OnBnClickedRadioPostrender(); +}; diff --git a/src/win32/Throttle.cpp b/src/win32/Throttle.cpp new file mode 100644 index 0000000..d73a347 --- /dev/null +++ b/src/win32/Throttle.cpp @@ -0,0 +1,87 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Throttle.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "Throttle.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// Throttle dialog + + +Throttle::Throttle(CWnd* pParent /*=NULL*/) + : CDialog(Throttle::IDD, pParent) +{ + //{{AFX_DATA_INIT(Throttle) + m_throttle = 100; + //}}AFX_DATA_INIT +} + + +void Throttle::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(Throttle) + DDX_Text(pDX, IDC_THROTTLE, m_throttle); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(Throttle, CDialog) + //{{AFX_MSG_MAP(Throttle) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// Throttle message handlers + +BOOL Throttle::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void Throttle::OnCancel() +{ + EndDialog(false); +} + +void Throttle::OnOk() +{ + UpdateData(); + + if(m_throttle < 5 || m_throttle > 1000) + systemMessage(IDS_INVALID_THROTTLE_VALUE, "Invalid throttle value. Please enter a number between 5 and 1000"); + else + EndDialog(m_throttle); +} diff --git a/src/win32/Throttle.h b/src/win32/Throttle.h new file mode 100644 index 0000000..e406417 --- /dev/null +++ b/src/win32/Throttle.h @@ -0,0 +1,67 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_THROTTLE_H__5F03B6E9_0C43_4933_A7BC_1618428C2B7F__INCLUDED_) +#define AFX_THROTTLE_H__5F03B6E9_0C43_4933_A7BC_1618428C2B7F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// Throttle.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// Throttle dialog + +class Throttle : public CDialog +{ + // Construction + public: + Throttle(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(Throttle) + enum { IDD = IDD_THROTTLE }; + int m_throttle; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(Throttle) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(Throttle) + virtual BOOL OnInitDialog(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_THROTTLE_H__5F03B6E9_0C43_4933_A7BC_1618428C2B7F__INCLUDED_) diff --git a/src/win32/TileView.cpp b/src/win32/TileView.cpp new file mode 100644 index 0000000..24b3a4c --- /dev/null +++ b/src/win32/TileView.cpp @@ -0,0 +1,587 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// TileView.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "FileDlg.h" +#include "Reg.h" +#include "TileView.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../NLS.h" +#include "../Util.h" + +extern "C" { +#include +} + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// TileView dialog + + +TileView::TileView(CWnd* pParent /*=NULL*/) + : ResizeDlg(TileView::IDD, pParent) +{ + //{{AFX_DATA_INIT(TileView) + m_colors = -1; + m_charBase = -1; + m_stretch = FALSE; + //}}AFX_DATA_INIT + autoUpdate = false; + + memset(&bmpInfo, 0, sizeof(bmpInfo)); + + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); + bmpInfo.bmiHeader.biWidth = 32*8; + bmpInfo.bmiHeader.biHeight = 32*8; + bmpInfo.bmiHeader.biPlanes = 1; + bmpInfo.bmiHeader.biBitCount = 24; + bmpInfo.bmiHeader.biCompression = BI_RGB; + data = (u8 *)calloc(1, 3 * 32*32 * 64); + + tileView.setData(data); + tileView.setBmpInfo(&bmpInfo); + + charBase = 0; + is256Colors = 0; + palette = 0; + w = h = 0; +} + +TileView::~TileView() +{ + free(data); + data = NULL; +} + +void TileView::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(TileView) + DDX_Control(pDX, IDC_PALETTE_SLIDER, m_slider); + DDX_Radio(pDX, IDC_16_COLORS, m_colors); + DDX_Radio(pDX, IDC_CHARBASE_0, m_charBase); + DDX_Check(pDX, IDC_STRETCH, m_stretch); + //}}AFX_DATA_MAP + DDX_Control(pDX, IDC_TILE_VIEW, tileView); + DDX_Control(pDX, IDC_MAP_VIEW_ZOOM, zoom); + DDX_Control(pDX, IDC_COLOR, color); +} + + +BEGIN_MESSAGE_MAP(TileView, CDialog) + //{{AFX_MSG_MAP(TileView) + ON_BN_CLICKED(IDC_SAVE, OnSave) + ON_BN_CLICKED(IDC_CLOSE, OnClose) + ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) + ON_BN_CLICKED(IDC_16_COLORS, On16Colors) + ON_BN_CLICKED(IDC_256_COLORS, On256Colors) + ON_BN_CLICKED(IDC_CHARBASE_0, OnCharbase0) + ON_BN_CLICKED(IDC_CHARBASE_1, OnCharbase1) + ON_BN_CLICKED(IDC_CHARBASE_2, OnCharbase2) + ON_BN_CLICKED(IDC_CHARBASE_3, OnCharbase3) + ON_BN_CLICKED(IDC_CHARBASE_4, OnCharbase4) + ON_BN_CLICKED(IDC_STRETCH, OnStretch) + ON_WM_HSCROLL() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_MAPINFO, OnMapInfo) + ON_MESSAGE(WM_COLINFO, OnColInfo) + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// TileView message handlers + +void TileView::saveBMP(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + struct { + u8 ident[2]; + u8 filesize[4]; + u8 reserved[4]; + u8 dataoffset[4]; + u8 headersize[4]; + u8 width[4]; + u8 height[4]; + u8 planes[2]; + u8 bitsperpixel[2]; + u8 compression[4]; + u8 datasize[4]; + u8 hres[4]; + u8 vres[4]; + u8 colors[4]; + u8 importantcolors[4]; + u8 pad[2]; + } bmpheader; + memset(&bmpheader, 0, sizeof(bmpheader)); + + bmpheader.ident[0] = 'B'; + bmpheader.ident[1] = 'M'; + + u32 fsz = sizeof(bmpheader) + w*h*3; + utilPutDword(bmpheader.filesize, fsz); + utilPutDword(bmpheader.dataoffset, 0x38); + utilPutDword(bmpheader.headersize, 0x28); + utilPutDword(bmpheader.width, w); + utilPutDword(bmpheader.height, h); + utilPutDword(bmpheader.planes, 1); + utilPutDword(bmpheader.bitsperpixel, 24); + utilPutDword(bmpheader.datasize, 3*w*h); + + fwrite(&bmpheader, 1, sizeof(bmpheader), fp); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data+3*w*(h-1); + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + *b++ = *pixU8++; // B + *b++ = *pixU8++; // G + *b++ = *pixU8++; // R + } + pixU8 -= 2*3*w; + fwrite(writeBuffer, 1, 3*w, fp); + + b = writeBuffer; + } + + fclose(fp); +} + + +void TileView::savePNG(const char *name) +{ + u8 writeBuffer[1024 * 3]; + + FILE *fp = fopen(name,"wb"); + + if(!fp) { + systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", name); + return; + } + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, + NULL, + NULL); + if(!png_ptr) { + fclose(fp); + return; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + + if(!info_ptr) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + if(setjmp(png_ptr->jmpbuf)) { + png_destroy_write_struct(&png_ptr,NULL); + fclose(fp); + return; + } + + png_init_io(png_ptr,fp); + + png_set_IHDR(png_ptr, + info_ptr, + w, + h, + 8, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(png_ptr,info_ptr); + + u8 *b = writeBuffer; + + int sizeX = w; + int sizeY = h; + + u8 *pixU8 = (u8 *)data; + for(int y = 0; y < sizeY; y++) { + for(int x = 0; x < sizeX; x++) { + int blue = *pixU8++; + int green = *pixU8++; + int red = *pixU8++; + + *b++ = red; + *b++ = green; + *b++ = blue; + } + png_write_row(png_ptr,writeBuffer); + + b = writeBuffer; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); +} + + +void TileView::OnSave() +{ + CString captureBuffer; + + if(theApp.captureFormat == 0) + captureBuffer = "tiles.png"; + else + captureBuffer = "tiles.bmp"; + + LPCTSTR exts[] = {".png", ".bmp" }; + + CString filter = theApp.winLoadFilter(IDS_FILTER_PNG); + CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME); + + FileDlg dlg(this, + captureBuffer, + filter, + theApp.captureFormat ? 2 : 1, + theApp.captureFormat ? "BMP" : "PNG", + exts, + "", + title, + true); + + if(dlg.DoModal() == IDCANCEL) { + return; + } + + captureBuffer = dlg.GetPathName(); + + if(dlg.getFilterIndex() == 2) + saveBMP(captureBuffer); + else + savePNG(captureBuffer); +} + +void TileView::renderTile256(int tile, int x, int y, u8 *charBase, u16 *palette) +{ + u8 *bmp = &data[24*x + 8*32*24*y]; + + for(int j = 0; j < 8; j++) { + for(int i = 0; i < 8; i++) { + u8 c = charBase[tile*64 + j * 8 + i]; + + u16 color = palette[c]; + + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + + } + bmp += 31*24; // advance line + } +} + +void TileView::renderTile16(int tile, int x, int y, u8 *charBase, u16 *palette) +{ + u8 *bmp = &data[24*x + 8*32*24*y]; + + int pal = this->palette; + + if(this->charBase == 4) + pal += 16; + + for(int j = 0; j < 8; j++) { + for(int i = 0; i < 8; i++) { + u8 c = charBase[tile*32 + j * 4 + (i>>1)]; + + if(i & 1) + c = c>>4; + else + c = c & 15; + + u16 color = palette[pal*16+c]; + + *bmp++ = ((color >> 10) & 0x1f) << 3; + *bmp++ = ((color >> 5) & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; + } + bmp += 31*24; // advance line + } +} + + +void TileView::render() +{ + u16 *palette = (u16 *)paletteRAM; + u8 *charBase = &vram[this->charBase * 0x4000]; + + int maxY; + + if(is256Colors) { + int tile = 0; + maxY = 16; + for(int y = 0; y < maxY; y++) { + for(int x = 0; x < 32; x++) { + if(this->charBase == 4) + renderTile256(tile, x, y, charBase, &palette[256]); + else + renderTile256(tile, x, y, charBase, palette); + tile++; + } + } + tileView.setSize(32*8, maxY*8); + w = 32*8; + h = maxY*8; + SIZE s; + s.cx = 32*8; + s.cy = maxY*8; + if(tileView.getStretch()) { + s.cx = s.cy = 1; + } + tileView.SetScrollSizes(MM_TEXT,s); + } else { + int tile = 0; + maxY = 32; + if(this->charBase == 3) + maxY = 16; + for(int y = 0; y < maxY; y++) { + for(int x = 0; x < 32; x++) { + renderTile16(tile, x, y, charBase, palette); + tile++; + } + } + tileView.setSize(32*8, maxY*8); + w = 32*8; + h = maxY*8; + SIZE s; + s.cx = 32*8; + s.cy = maxY*8; + if(tileView.getStretch()) { + s.cx = s.cy = 1; + } + tileView.SetScrollSizes(MM_TEXT, s); + } +} + +void TileView::update() +{ + paint(); +} + + +BOOL TileView::OnInitDialog() +{ + CDialog::OnInitDialog(); + + DIALOG_SIZER_START( sz ) + DIALOG_SIZER_ENTRY( IDC_TILE_VIEW, DS_SizeX | DS_SizeY ) + DIALOG_SIZER_ENTRY( IDC_COLOR, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_R, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_G, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_B, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_CLOSE, DS_MoveY) + DIALOG_SIZER_ENTRY( IDC_SAVE, DS_MoveY) + DIALOG_SIZER_END() + SetData(sz, + TRUE, + HKEY_CURRENT_USER, + "Software\\Emulators\\VisualBoyAdvance\\Viewer\\TileView", + NULL); + + m_colors = is256Colors; + m_charBase = charBase; + + m_slider.SetRange(0, 15); + m_slider.SetPageSize(4); + m_slider.SetTicFreq(1); + + paint(); + + m_stretch = regQueryDwordValue("tileViewStretch", 0); + if(m_stretch) + tileView.setStretch(true); + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void TileView::OnClose() +{ + theApp.winRemoveUpdateListener(this); + + DestroyWindow(); +} + + +void TileView::OnAutoUpdate() +{ + autoUpdate = !autoUpdate; + if(autoUpdate) { + theApp.winAddUpdateListener(this); + } else { + theApp.winRemoveUpdateListener(this); + } +} + + +void TileView::paint() +{ + if(vram != NULL && paletteRAM != NULL) { + render(); + tileView.refresh(); + } +} + + +void TileView::On16Colors() +{ + is256Colors = 0; + paint(); +} + +void TileView::On256Colors() +{ + is256Colors = 1; + paint(); +} + +void TileView::OnCharbase0() +{ + charBase = 0; + paint(); +} + +void TileView::OnCharbase1() +{ + charBase = 1; + paint(); +} + +void TileView::OnCharbase2() +{ + charBase = 2; + paint(); +} + +void TileView::OnCharbase3() +{ + charBase = 3; + paint(); +} + +void TileView::OnCharbase4() +{ + charBase = 4; + paint(); +} + +void TileView::OnStretch() +{ + tileView.setStretch(!tileView.getStretch()); + paint(); + regSetDwordValue("tileViewStretch", tileView.getStretch()); +} + +LRESULT TileView::OnMapInfo(WPARAM wParam, LPARAM lParam) +{ + u8 *colors = (u8 *)lParam; + zoom.setColors(colors); + + int x = (wParam & 0xFFFF)/8; + int y = ((wParam >> 16) & 0xFFFF)/8; + + u32 address = 0x6000000 + 0x4000 * charBase; + int tile = 32 * y + x; + if(is256Colors) + tile *= 2; + address += 32 * tile; + + CString buffer; + buffer.Format("%d", tile); + GetDlgItem(IDC_TILE_NUMBER)->SetWindowText(buffer); + + buffer.Format("%08x", address); + GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); + + return TRUE; +} + +LRESULT TileView::OnColInfo(WPARAM wParam, LPARAM) +{ + u16 c = (u16)wParam; + + color.setColor(c); + + int r = (c & 0x1f); + int g = (c & 0x3e0) >> 5; + int b = (c & 0x7c00) >> 10; + + CString buffer; + buffer.Format("R: %d", r); + GetDlgItem(IDC_R)->SetWindowText(buffer); + + buffer.Format("G: %d", g); + GetDlgItem(IDC_G)->SetWindowText(buffer); + + buffer.Format("B: %d", b); + GetDlgItem(IDC_B)->SetWindowText(buffer); + + return TRUE; +} + +void TileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + switch(nSBCode) { + case TB_THUMBPOSITION: + palette = nPos; + break; + default: + palette = m_slider.GetPos(); + break; + } + paint(); +} + +void TileView::PostNcDestroy() +{ + delete this; +} diff --git a/src/win32/TileView.h b/src/win32/TileView.h new file mode 100644 index 0000000..888d67b --- /dev/null +++ b/src/win32/TileView.h @@ -0,0 +1,109 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_TILEVIEW_H__055751EC_2DF3_495B_B643_29025465CD2E__INCLUDED_) +#define AFX_TILEVIEW_H__055751EC_2DF3_495B_B643_29025465CD2E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// TileView.h : header file +// + +#include "BitmapControl.h" +#include "ColorControl.h" +#include "IUpdate.h" +#include "ResizeDlg.h" +#include "ZoomControl.h" + +///////////////////////////////////////////////////////////////////////////// +// TileView dialog + +class TileView : public ResizeDlg, IUpdateListener +{ + int charBase; + int is256Colors; + int palette; + BitmapControl tileView; + BITMAPINFO bmpInfo; + u8 *data; + ZoomControl zoom; + ColorControl color; + int w; + int h; + bool autoUpdate; + // Construction + public: + void paint(); + void render(); + void renderTile16(int tile, int x, int y, u8 *charBase, u16 *palette); + void renderTile256(int tile, int x, int y, u8 *charBase, u16 *palette); + void savePNG(const char *name); + void saveBMP(const char *name); + TileView(CWnd* pParent = NULL); // standard constructor + virtual ~TileView(); + + virtual void update(); + + // Dialog Data + //{{AFX_DATA(TileView) + enum { IDD = IDD_TILE_VIEWER }; + CSliderCtrl m_slider; + int m_colors; + int m_charBase; + BOOL m_stretch; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(TileView) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy(); + //}}AFX_VIRTUAL + + // Implementation + protected: + virtual afx_msg LRESULT OnMapInfo(WPARAM wParam, LPARAM lParam); + virtual afx_msg LRESULT OnColInfo(WPARAM wParam, LPARAM lParam); + + // Generated message map functions + //{{AFX_MSG(TileView) + afx_msg void OnSave(); + virtual BOOL OnInitDialog(); + afx_msg void OnClose(); + afx_msg void OnAutoUpdate(); + afx_msg void On16Colors(); + afx_msg void On256Colors(); + afx_msg void OnCharbase0(); + afx_msg void OnCharbase1(); + afx_msg void OnCharbase2(); + afx_msg void OnCharbase3(); + afx_msg void OnCharbase4(); + afx_msg void OnStretch(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TILEVIEW_H__055751EC_2DF3_495B_B643_29025465CD2E__INCLUDED_) diff --git a/src/win32/VBA.clw b/src/win32/VBA.clw new file mode 100644 index 0000000..5bae081 --- /dev/null +++ b/src/win32/VBA.clw @@ -0,0 +1,1715 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=Hyperlink +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "vba.h" +LastPage=0 + +ClassCount=57 +Class1=AboutDialog +Class2=Associate +Class3=ColorButton +Class4=ColorControl +Class5=Directories +Class6=ExportGSASnapshot +Class7=FileDlg +Class8=GBACheatSearch +Class9=AddCheat +Class10=GBACheatList +Class11=GBCheatSearch +Class12=AddGBCheat +Class13=GBColorDlg +Class14=GSACodeSelect +Class15=JoypadEditControl +Class16=JoypadConfig +Class17=MotionConfig +Class18=Hyperlink +Class19=LangSelect +Class20=MainWnd +Class21=ModeConfirm +Class22=RewindInterval +Class23=RomInfoGB +Class24=RomInfoGBA +Class25=SkinButton +Class26=Throttle +Class27=VBA +Class28=VideoMode +Class29=VideoDriverSelect + +ResourceCount=44 +Resource1=IDD_MAX_SCALE +Resource2=IDD_GDB_WAITING +Resource3=IDD_GB_CHEAT_LIST +Resource4=IDD_CONFIG +Resource5=IDD_ADD_CHEAT_DLG +Resource6=IDD_GB_OAM_VIEW +Resource7=IDD_GB_ROM_INFO +Resource8=IDD_OPENDLG +Resource9=IDD_MAP_VIEW +Resource10=IDD_ABOUT +Resource11=IDD_CHEAT_LIST +Resource12=IDD_OAM_VIEW +Resource13=IDD_CODE_SELECT +Resource14=IDD_CHEATS +Resource15=IDD_GBA_ROM_INFO +Resource16=IDD_IO_VIEWER +Resource17=IDD_MEM_VIEWER +Resource18=IDD_ADDR_SIZE +Resource19=IDR_MENU +Resource20=IDD_PALETTE_VIEW +Resource21=IDD_ASSOCIATIONS +Resource22=IDD_GB_COLORS +Resource23=IDD_ADD_CHEAT +Resource24=IDD_DISASSEMBLE +Resource25=IDD_MODES +Resource26=IDD_GDB_PORT +Resource27=IDD_LANG_SELECT +Resource28=IDD_LOGGING +Resource29=IDD_DRIVERS +Resource30=IDD_EXPORT_SPS +Resource31=IDD_THROTTLE +Resource32=IDD_MODE_CONFIRM +Resource33=IDD_GB_DISASSEMBLE +Resource34=IDD_GB_PALETTE_VIEW +Resource35=IDD_REWIND_INTERVAL +Resource36=IDD_GB_TILE_VIEWER +Resource37=IDD_ACCEL_EDITOR +Resource38=IDD_GB_MAP_VIEW +Resource39=IDD_BUG_REPORT +Resource40=IDD_MOTION_CONFIG +Resource41=IDD_TILE_VIEWER +Class30=AddGSACode +Class31=GBCheatList +Class32=Disassemble +Class33=GBDisassemble +Class34=Logging +Class35=IOViewer +Class36=ZoomControl +Class37=BitmapControl +Class38=MapView +Class39=GBMapView +Class40=MemoryViewer +Class41=MemoryViewerDlg +Class42=MemoryViewerAddressSize +Class43=GBMemoryViewerDlg +Class44=OamView +Class45=GBOamView +Class46=PaletteViewControl +Class47=PaletteView +Class48=GBPaletteView +Class49=TileView +Class50=GBTileView +Class51=GBPrinterDlg +Class52=GDBPortDlg +Class53=GDBWaitingDlg +Class54=AccelEditor +Class55=CKeyboardEdit +Resource42=IDD_DIRECTORIES +Class56=MaxScale +Resource43=IDD_GB_PRINTER +Class57=BugReport +Resource44=IDR_ACCELERATOR + +[CLS:AboutDialog] +Type=0 +BaseClass=CDialog +HeaderFile=AboutDialog.h +ImplementationFile=AboutDialog.cpp +LastObject=AboutDialog + +[CLS:Associate] +Type=0 +BaseClass=CDialog +HeaderFile=Associate.h +ImplementationFile=Associate.cpp +LastObject=ID_OK + +[CLS:ColorButton] +Type=0 +BaseClass=CButton +HeaderFile=ColorButton.h +ImplementationFile=ColorButton.cpp + +[CLS:ColorControl] +Type=0 +BaseClass=CWnd +HeaderFile=ColorControl.h +ImplementationFile=ColorControl.cpp + +[CLS:Directories] +Type=0 +BaseClass=CDialog +HeaderFile=Directories.h +ImplementationFile=Directories.cpp + +[CLS:ExportGSASnapshot] +Type=0 +BaseClass=CDialog +HeaderFile=ExportGSASnapshot.h +ImplementationFile=ExportGSASnapshot.cpp + +[CLS:FileDlg] +Type=0 +BaseClass=CFileDialog +HeaderFile=FileDlg.h +ImplementationFile=FileDlg.cpp + +[CLS:GBACheatSearch] +Type=0 +BaseClass=CDialog +HeaderFile=GBACheats.h +ImplementationFile=GBACheats.cpp + +[CLS:AddCheat] +Type=0 +BaseClass=CDialog +HeaderFile=GBACheats.h +ImplementationFile=GBACheats.cpp + +[CLS:GBACheatList] +Type=0 +BaseClass=CDialog +HeaderFile=GBACheats.h +ImplementationFile=GBACheats.cpp +LastObject=GBACheatList + +[CLS:GBCheatSearch] +Type=0 +BaseClass=CDialog +HeaderFile=GBCheatsDlg.h +ImplementationFile=GBCheatsDlg.cpp + +[CLS:AddGBCheat] +Type=0 +BaseClass=CDialog +HeaderFile=GBCheatsDlg.h +ImplementationFile=GBCheatsDlg.cpp +LastObject=AddGBCheat + +[CLS:GBColorDlg] +Type=0 +BaseClass=CDialog +HeaderFile=GBColorDlg.h +ImplementationFile=GBColorDlg.cpp +LastObject=IDC_PREDEFINED +Filter=D +VirtualFilter=dWC + +[CLS:GSACodeSelect] +Type=0 +BaseClass=CDialog +HeaderFile=GSACodeSelect.h +ImplementationFile=GSACodeSelect.cpp + +[CLS:JoypadEditControl] +Type=0 +BaseClass=CEdit +HeaderFile=Joypad.h +ImplementationFile=Joypad.cpp + +[CLS:JoypadConfig] +Type=0 +BaseClass=CDialog +HeaderFile=Joypad.h +ImplementationFile=Joypad.cpp + +[CLS:CKeyboardEdit] +Type=0 +BaseClass=CEdit +HeaderFile=KeyboardEdit.h +ImplementationFile=KeyboardEdit.cpp + +[CLS:MotionConfig] +Type=0 +BaseClass=CDialog +HeaderFile=Joypad.h +ImplementationFile=Joypad.cpp + +[CLS:LangSelect] +Type=0 +BaseClass=CDialog +HeaderFile=LangSelect.h +ImplementationFile=LangSelect.cpp + +[CLS:MainWnd] +Type=0 +BaseClass=CWnd +HeaderFile=MainWnd.h +ImplementationFile=MainWnd.cpp +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS +Filter=W +VirtualFilter=WC + +[CLS:ModeConfirm] +Type=0 +BaseClass=CDialog +HeaderFile=ModeConfirm.h +ImplementationFile=ModeConfirm.cpp + +[CLS:RewindInterval] +Type=0 +BaseClass=CDialog +HeaderFile=RewindInterval.h +ImplementationFile=RewindInterval.cpp + +[CLS:RomInfoGB] +Type=0 +BaseClass=CDialog +HeaderFile=RomInfo.h +ImplementationFile=RomInfo.cpp + +[CLS:RomInfoGBA] +Type=0 +BaseClass=CDialog +HeaderFile=RomInfo.h +ImplementationFile=RomInfo.cpp + +[CLS:SkinButton] +Type=0 +BaseClass=CWnd +HeaderFile=skinButton.h +ImplementationFile=skinButton.cpp + +[CLS:Throttle] +Type=0 +BaseClass=CDialog +HeaderFile=Throttle.h +ImplementationFile=Throttle.cpp + +[CLS:VBA] +Type=0 +BaseClass=CWinApp +HeaderFile=VBA.h +ImplementationFile=VBA.cpp + +[CLS:VideoMode] +Type=0 +BaseClass=CDialog +HeaderFile=VideoMode.h +ImplementationFile=VideoMode.cpp + +[CLS:VideoDriverSelect] +Type=0 +BaseClass=CDialog +HeaderFile=VideoMode.h +ImplementationFile=VideoMode.cpp +Filter=D +VirtualFilter=dWC +LastObject=ID_CANCEL + +[DLG:IDD_ABOUT] +Type=1 +Class=AboutDialog +ControlCount=8 +Control1=IDOK,button,1342242817 +Control2=IDC_STATIC,static,1342177283 +Control3=IDC_STATIC,static,1342308353 +Control4=IDC_STATIC,static,1342308353 +Control5=IDC_URL,static,1342308353 +Control6=IDC_STATIC,static,1342308353 +Control7=IDC_STATIC,static,1342308353 +Control8=IDC_VERSION,static,1342308353 + +[DLG:IDD_ASSOCIATIONS] +Type=1 +Class=Associate +ControlCount=11 +Control1=IDC_GB,button,1342242819 +Control2=IDC_SGB,button,1342242819 +Control3=IDC_CGB,button,1342242819 +Control4=IDC_GBC,button,1342242819 +Control5=IDC_GBA,button,1342242819 +Control6=IDC_AGB,button,1342242819 +Control7=IDC_BIN,button,1342242819 +Control8=ID_OK,button,1342242817 +Control9=ID_CANCEL,button,1342242816 +Control10=IDC_STATIC,button,1342177287 +Control11=IDC_STATIC,button,1342177287 + +[DLG:IDD_DIRECTORIES] +Type=1 +Class=Directories +ControlCount=22 +Control1=IDC_ROM_DIR,button,1342242816 +Control2=IDC_GBROM_DIR,button,1342242816 +Control3=IDC_BATTERY_DIR,button,1342242816 +Control4=IDC_SAVE_DIR,button,1342242816 +Control5=IDC_CAPTURE_DIR,button,1342242816 +Control6=IDOK,button,1342242817 +Control7=IDCANCEL,button,1342242816 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_STATIC,static,1342308352 +Control10=IDC_STATIC,static,1342308352 +Control11=IDC_STATIC,static,1342308352 +Control12=IDC_ROM_PATH,edit,1484849280 +Control13=IDC_BATTERY_PATH,edit,1484849280 +Control14=IDC_SAVE_PATH,edit,1484849280 +Control15=IDC_CAPTURE_PATH,edit,1484849280 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_GBROM_PATH,edit,1484849280 +Control18=IDC_ROM_DIR_RESET,button,1342242816 +Control19=IDC_GBROM_DIR_RESET,button,1342242816 +Control20=IDC_BATTERY_DIR_RESET,button,1342242816 +Control21=IDC_SAVE_DIR_RESET,button,1342242816 +Control22=IDC_CAPTURE_DIR_RESET,button,1342242816 + +[DLG:IDD_EXPORT_SPS] +Type=1 +Class=ExportGSASnapshot +ControlCount=8 +Control1=IDC_TITLE,edit,1350631552 +Control2=IDC_DESC,edit,1350631552 +Control3=IDC_NOTES,edit,1350635652 +Control4=ID_OK,button,1342242817 +Control5=ID_CANCEL,button,1342242816 +Control6=IDC_STATIC,static,1342308352 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,static,1342308352 + +[DLG:IDD_CHEATS] +Type=1 +Class=GBACheatSearch +ControlCount=26 +Control1=IDC_CHEAT_LIST,SysListView32,1350631429 +Control2=IDC_OLD_VALUE,button,1342308361 +Control3=IDC_SPECIFIC_VALUE,button,1342177289 +Control4=IDC_SIZE_8,button,1342308361 +Control5=IDC_SIZE_16,button,1342177289 +Control6=IDC_SIZE_32,button,1342177289 +Control7=IDC_EQ,button,1342308361 +Control8=IDC_NE,button,1342177289 +Control9=IDC_LT,button,1342177289 +Control10=IDC_LE,button,1342177289 +Control11=IDC_GT,button,1342177289 +Control12=IDC_GE,button,1342177289 +Control13=IDC_SIGNED,button,1342308361 +Control14=IDC_UNSIGNED,button,1342177289 +Control15=IDC_HEXADECIMAL,button,1342177289 +Control16=IDC_UPDATE,button,1342373891 +Control17=IDC_VALUE,edit,1350631552 +Control18=IDC_START,button,1342373888 +Control19=IDC_SEARCH,button,1342242816 +Control20=IDC_ADD_CHEAT,button,1342242816 +Control21=ID_OK,button,1342242817 +Control22=IDC_STATIC,button,1342177287 +Control23=IDC_STATIC,button,1342177287 +Control24=IDC_STATIC,button,1342177287 +Control25=IDC_STATIC,button,1342177287 +Control26=IDC_STATIC,static,1342308352 + +[DLG:IDD_ADD_CHEAT] +Type=1 +Class=AddCheat +ControlCount=16 +Control1=IDC_ADDRESS,edit,1350631552 +Control2=IDC_VALUE,edit,1350631552 +Control3=IDC_DESC,edit,1350631552 +Control4=IDC_SIZE_8,button,1342373897 +Control5=IDC_SIZE_16,button,1342177289 +Control6=IDC_SIZE_32,button,1342177289 +Control7=IDC_SIGNED,button,1342373897 +Control8=IDC_UNSIGNED,button,1342177289 +Control9=IDC_HEXADECIMAL,button,1342177289 +Control10=ID_OK,button,1342373889 +Control11=ID_CANCEL,button,1342242816 +Control12=IDC_STATIC,static,1342308352 +Control13=IDC_STATIC,button,1342177287 +Control14=IDC_STATIC,static,1342308352 +Control15=IDC_STATIC,button,1342177287 +Control16=IDC_STATIC,static,1342308352 + +[DLG:IDD_CHEAT_LIST] +Type=1 +Class=GBACheatList +ControlCount=14 +Control1=IDC_RESTORE,button,1342373891 +Control2=IDC_ADD_CODE,button,1342373888 +Control3=IDC_ADD_CHEAT,button,1342242816 +Control4=IDC_ADD_GAMESHARK,button,1342242816 +Control5=IDC_ADD_CODEBREAKER,button,1342242816 +Control6=IDC_REMOVE,button,1342242816 +Control7=IDC_REMOVE_ALL,button,1342242816 +Control8=IDC_ENABLE,button,1342242816 +Control9=ID_OK,button,1342373889 +Control10=IDC_CHEAT_LIST,SysListView32,1350762497 +Control11=IDC_STATIC,static,1342308352 +Control12=IDC_STATIC,static,1342308352 +Control13=IDC_STATIC,static,1342308352 +Control14=IDC_STATIC,button,1342177287 + +[DLG:IDD_GB_COLORS] +Type=1 +Class=GBColorDlg +ControlCount=17 +Control1=IDC_DEFAULT,button,1342308361 +Control2=IDC_USER1,button,1342177289 +Control3=IDC_USER2,button,1342177289 +Control4=IDC_PREDEFINED,combobox,1344340227 +Control5=IDC_COLOR_BG0,button,1342373888 +Control6=IDC_COLOR_BG1,button,1342242816 +Control7=IDC_COLOR_BG2,button,1342242816 +Control8=IDC_COLOR_BG3,button,1342242816 +Control9=IDC_COLOR_OB0,button,1342242816 +Control10=IDC_COLOR_OB1,button,1342242816 +Control11=IDC_COLOR_OB2,button,1342242816 +Control12=IDC_COLOR_OB3,button,1342242816 +Control13=IDC_RESET,button,1342242816 +Control14=ID_OK,button,1342242817 +Control15=ID_CANCEL,button,1342242816 +Control16=IDC_STATIC,button,1342177287 +Control17=IDC_STATIC,button,1342177287 + +[DLG:IDD_CODE_SELECT] +Type=1 +Class=GSACodeSelect +ControlCount=3 +Control1=ID_OK,button,1342242817 +Control2=ID_CANCEL,button,1342242816 +Control3=IDC_GAME_LIST,listbox,1353777411 + +[DLG:IDD_CONFIG] +Type=1 +Class=JoypadConfig +ControlCount=28 +Control1=IDC_EDIT_UP,edit,1350631552 +Control2=IDC_EDIT_DOWN,edit,1350631552 +Control3=IDC_EDIT_LEFT,edit,1350631552 +Control4=IDC_EDIT_RIGHT,edit,1350631552 +Control5=IDC_EDIT_BUTTON_A,edit,1350631552 +Control6=IDC_EDIT_BUTTON_B,edit,1350631552 +Control7=IDC_EDIT_BUTTON_L,edit,1350631552 +Control8=IDC_EDIT_BUTTON_R,edit,1350631552 +Control9=IDC_EDIT_BUTTON_SELECT,edit,1350631552 +Control10=IDC_EDIT_BUTTON_START,edit,1350631552 +Control11=IDC_EDIT_SPEED,edit,1350631552 +Control12=IDC_EDIT_CAPTURE,edit,1350631552 +Control13=IDC_EDIT_BUTTON_GS,edit,1350631552 +Control14=ID_OK,button,1342242816 +Control15=ID_CANCEL,button,1342242816 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_STATIC,static,1342308352 +Control18=IDC_STATIC,static,1342308352 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_STATIC,static,1342308352 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_STATIC,static,1342308352 +Control26=IDC_STATIC,static,1342308352 +Control27=IDC_STATIC,static,1342308352 +Control28=IDC_STATIC,static,1342308352 + +[DLG:IDD_MOTION_CONFIG] +Type=1 +Class=MotionConfig +ControlCount=10 +Control1=IDC_EDIT_UP,edit,1350631552 +Control2=IDC_EDIT_DOWN,edit,1350631552 +Control3=IDC_EDIT_LEFT,edit,1350631552 +Control4=IDC_EDIT_RIGHT,edit,1350631552 +Control5=ID_OK,button,1342242816 +Control6=ID_CANCEL,button,1342242816 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_STATIC,static,1342308352 +Control10=IDC_STATIC,static,1342308352 + +[DLG:IDD_LANG_SELECT] +Type=1 +Class=LangSelect +ControlCount=6 +Control1=IDC_LANG_STRING,edit,1350631552 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_LANG_NAME,static,1342308352 + +[DLG:IDD_MODE_CONFIRM] +Type=1 +Class=ModeConfirm +ControlCount=4 +Control1=ID_OK,button,1342242817 +Control2=ID_CANCEL,button,1342242816 +Control3=IDC_STATIC,static,1342308353 +Control4=IDC_TIMER,static,1342308353 + +[DLG:IDD_REWIND_INTERVAL] +Type=1 +Class=RewindInterval +ControlCount=5 +Control1=IDC_INTERVAL,edit,1350631552 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_STATIC,static,1342308352 + +[DLG:IDD_GB_ROM_INFO] +Type=1 +Class=RomInfoGB +ControlCount=27 +Control1=ID_OK,button,1342242817 +Control2=IDC_STATIC,static,1342308352 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_ROM_TITLE,static,1342308352 +Control9=IDC_ROM_MAKER_CODE,static,1342308352 +Control10=IDC_ROM_UNIT_CODE,static,1342308352 +Control11=IDC_ROM_DEVICE_TYPE,static,1342308352 +Control12=IDC_ROM_VERSION,static,1342308352 +Control13=IDC_ROM_CRC,static,1342308352 +Control14=IDC_STATIC,static,1342308352 +Control15=IDC_ROM_COLOR,static,1342308352 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_ROM_SIZE,static,1342308352 +Control18=IDC_STATIC,static,1342308352 +Control19=IDC_ROM_RAM_SIZE,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_ROM_DEST_CODE,static,1342308352 +Control22=IDC_STATIC,static,1342308352 +Control23=IDC_ROM_LIC_CODE,static,1342308352 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_ROM_CHECKSUM,static,1342308352 +Control26=IDC_ROM_MAKER_NAME2,static,1342308352 +Control27=IDC_STATIC,static,1342308352 + +[DLG:IDD_GBA_ROM_INFO] +Type=1 +Class=RomInfoGBA +ControlCount=17 +Control1=ID_OK,button,1342242817 +Control2=IDC_STATIC,static,1342308352 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_ROM_TITLE,static,1342308352 +Control10=IDC_ROM_GAME_CODE,static,1342308352 +Control11=IDC_ROM_MAKER_CODE,static,1342308352 +Control12=IDC_ROM_UNIT_CODE,static,1342308352 +Control13=IDC_ROM_DEVICE_TYPE,static,1342308352 +Control14=IDC_ROM_VERSION,static,1342308352 +Control15=IDC_ROM_CRC,static,1342308352 +Control16=IDC_ROM_MAKER_NAME,static,1342308352 +Control17=IDC_STATIC,static,1342308352 + +[DLG:IDD_THROTTLE] +Type=1 +Class=Throttle +ControlCount=4 +Control1=IDC_THROTTLE,edit,1350631552 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 + +[DLG:IDD_MODES] +Type=1 +Class=VideoMode +ControlCount=4 +Control1=IDC_MODES,listbox,1352728835 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 + +[DLG:IDD_DRIVERS] +Type=1 +Class=VideoDriverSelect +ControlCount=4 +Control1=IDC_DRIVERS,listbox,1352728833 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 + +[DLG:IDD_OPENDLG] +Type=1 +Class=GBMemoryViewerDlg +ControlCount=12 +Control1=1090,static,1342308352 +Control2=1152,edit,1350632576 +Control3=1120,listbox,1352732755 +Control4=65535,static,1342308352 +Control5=1088,static,1342308480 +Control6=1121,listbox,1352732755 +Control7=1089,static,1342308352 +Control8=1136,combobox,1344340035 +Control9=1091,static,1342308352 +Control10=1137,combobox,1344340819 +Control11=IDOK,button,1342373889 +Control12=IDCANCEL,button,1342373888 + +[DLG:IDD_GB_CHEAT_LIST] +Type=1 +Class=GBCheatList +ControlCount=10 +Control1=IDC_CHEAT_LIST,SysListView32,1350762497 +Control2=IDC_ADD_GG_CHEAT,button,1342373888 +Control3=IDC_ADD_GS_CHEAT,button,1342373888 +Control4=IDC_REMOVE,button,1342242816 +Control5=IDC_REMOVE_ALL,button,1342242816 +Control6=IDC_ENABLE,button,1342242816 +Control7=ID_OK,button,1342242817 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_STATIC,static,1342308352 +Control10=IDC_STATIC,static,1342308352 + +[DLG:IDD_ADD_CHEAT_DLG] +Type=1 +Class=AddGSACode +ControlCount=6 +Control1=IDC_DESC,edit,1350631552 +Control2=IDC_CODE,edit,1350635724 +Control3=ID_OK,button,1342242817 +Control4=ID_CANCEL,button,1342242816 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 + +[DLG:IDD_GB_PRINTER] +Type=1 +Class=GBPrinterDlg +ControlCount=9 +Control1=IDC_1X,button,1342308361 +Control2=IDC_2X,button,1342177289 +Control3=IDC_3X,button,1342177289 +Control4=IDC_4X,button,1342177289 +Control5=ID_PRINT,button,1342373889 +Control6=ID_SAVE,button,1342242816 +Control7=ID_OK,button,1342242816 +Control8=IDC_GB_PRINTER,static,1342308359 +Control9=IDC_STATIC,button,1342177287 + +[DLG:IDD_MAP_VIEW] +Type=1 +Class=MapView +ControlCount=44 +Control1=IDC_FRAME_0,button,1342308361 +Control2=IDC_FRAME_1,button,1342177289 +Control3=IDC_BG0,button,1342308361 +Control4=IDC_BG1,button,1342177289 +Control5=IDC_BG2,button,1342177289 +Control6=IDC_BG3,button,1342177289 +Control7=IDC_STRETCH,button,1342242819 +Control8=IDC_REFRESH,button,1342373888 +Control9=IDC_SAVE,button,1342373888 +Control10=IDC_CLOSE,button,1342242816 +Control11=IDC_MAP_VIEW,VbaBitmapControl,1342373888 +Control12=IDC_MAP_VIEW_ZOOM,VbaZoomControl,1342373888 +Control13=IDC_COLOR,VbaColorControl,1342242816 +Control14=IDC_R,static,1342308352 +Control15=IDC_G,static,1342308352 +Control16=IDC_B,static,1342308352 +Control17=IDC_STATIC,button,1342177287 +Control18=IDC_STATIC,button,1342177287 +Control19=IDC_AUTO_UPDATE,button,1342242819 +Control20=IDC_XY,static,1342308352 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_MODE,static,1342308352 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_MAPBASE,static,1342308352 +Control25=IDC_STATIC,static,1342308352 +Control26=IDC_CHARBASE,static,1342308352 +Control27=IDC_STATIC,static,1342308352 +Control28=IDC_DIM,static,1342308352 +Control29=IDC_STATIC,static,1342308352 +Control30=IDC_NUMCOLORS,static,1342308352 +Control31=IDC_STATIC,static,1342308352 +Control32=IDC_PRIORITY,static,1342308352 +Control33=IDC_STATIC,static,1342308352 +Control34=IDC_MOSAIC,static,1342308352 +Control35=IDC_STATIC,static,1342308352 +Control36=IDC_OVERFLOW,static,1342308352 +Control37=IDC_STATIC,static,1342308352 +Control38=IDC_ADDRESS,static,1342308352 +Control39=IDC_STATIC,static,1342308352 +Control40=IDC_TILE_NUM,static,1342308352 +Control41=IDC_STATIC,static,1342308352 +Control42=IDC_FLIP,static,1342308352 +Control43=IDC_STATIC,static,1342308352 +Control44=IDC_PALETTE_NUM,static,1342308352 + +[DLG:IDD_PALETTE_VIEW] +Type=1 +Class=PaletteView +ControlCount=21 +Control1=IDC_SAVE_BG,button,1342242816 +Control2=IDC_SAVE_OBJ,button,1342242816 +Control3=IDC_REFRESH2,button,1342242816 +Control4=IDC_CLOSE,button,1342242816 +Control5=IDC_ADDRESS,static,1342308352 +Control6=IDC_R,static,1342308352 +Control7=IDC_G,static,1342308352 +Control8=IDC_B,static,1342308352 +Control9=IDC_VALUE,static,1342308352 +Control10=IDC_COLOR,VbaColorControl,1342242816 +Control11=IDC_PALETTE_VIEW,VbaPaletteViewControl,1342242816 +Control12=IDC_PALETTE_VIEW_OBJ,VbaPaletteViewControl,1342242816 +Control13=IDC_STATIC,button,1342177287 +Control14=IDC_STATIC,button,1342177287 +Control15=IDC_STATIC,static,1342308352 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_STATIC,static,1342308352 +Control18=IDC_STATIC,static,1342308352 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_AUTO_UPDATE,button,1342242819 + +[DLG:IDD_MEM_VIEWER] +Type=1 +Class=MemoryViewerDlg +ControlCount=14 +Control1=IDC_ADDRESSES,combobox,1344339971 +Control2=IDC_8_BIT,button,1342308361 +Control3=IDC_16_BIT,button,1342177289 +Control4=IDC_32_BIT,button,1342177289 +Control5=IDC_ADDRESS,edit,1350766728 +Control6=IDC_GO,button,1342373889 +Control7=IDC_VIEWER,VbaMemoryViewer,1342242816 +Control8=IDC_AUTO_UPDATE,button,1342242819 +Control9=IDC_REFRESH,button,1342242816 +Control10=IDC_LOAD,button,1342242816 +Control11=IDC_SAVE,button,1342242816 +Control12=IDC_CLOSE,button,1342242816 +Control13=IDC_CURRENT_ADDRESS_LABEL,static,1342308352 +Control14=IDC_CURRENT_ADDRESS,edit,1484849282 + +[DLG:IDD_OAM_VIEW] +Type=1 +Class=OamView +ControlCount=32 +Control1=IDC_SPRITE,edit,1350639746 +Control2=IDC_SCROLLBAR,scrollbar,1342177280 +Control3=IDC_STRETCH,button,1342242819 +Control4=IDC_REFRESH,button,1342373888 +Control5=IDC_SAVE,button,1342373888 +Control6=IDC_CLOSE,button,1342242816 +Control7=IDC_OAM_VIEW,VbaBitmapControl,1342373888 +Control8=IDC_OAM_VIEW_ZOOM,VbaZoomControl,1342373888 +Control9=IDC_COLOR,VbaColorControl,1342242816 +Control10=IDC_POS,static,1342308352 +Control11=IDC_MODE,static,1342308352 +Control12=IDC_COLORS,static,1342308352 +Control13=IDC_PALETTE,static,1342308352 +Control14=IDC_TILE,static,1342308352 +Control15=IDC_PRIO,static,1342308352 +Control16=IDC_SIZE2,static,1342308352 +Control17=IDC_ROT,static,1342308352 +Control18=IDC_FLAGS,static,1342308352 +Control19=IDC_R,static,1342308352 +Control20=IDC_G,static,1342308352 +Control21=IDC_B,static,1342308352 +Control22=IDC_STATIC,static,1342308352 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_STATIC,static,1342308352 +Control26=IDC_STATIC,static,1342308352 +Control27=IDC_STATIC,static,1342308352 +Control28=IDC_STATIC,static,1342308352 +Control29=IDC_STATIC,static,1342308352 +Control30=IDC_STATIC,static,1342308352 +Control31=IDC_STATIC,static,1342308352 +Control32=IDC_AUTO_UPDATE,button,1342242819 + +[DLG:IDD_ACCEL_EDITOR] +Type=1 +Class=AccelEditor +ControlCount=13 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_COMMANDS,listbox,1352732931 +Control3=IDC_STATIC1,static,1342308352 +Control4=IDC_CURRENTS,listbox,1352728835 +Control5=ID_OK,button,1342242817 +Control6=ID_CANCEL,button,1342242816 +Control7=IDC_STATIC3,static,1342308352 +Control8=IDC_EDIT_KEY,edit,1350631552 +Control9=IDC_ASSIGN,button,1342242816 +Control10=IDC_REMOVE,button,1342242816 +Control11=IDC_RESET,button,1342242816 +Control12=IDC_ALREADY_AFFECTED,static,1342308864 +Control13=IDC_STATIC2,static,1342308352 + +[DLG:IDD_TILE_VIEWER] +Type=1 +Class=TileView +ControlCount=26 +Control1=IDC_16_COLORS,button,1342308361 +Control2=IDC_256_COLORS,button,1342177289 +Control3=IDC_CHARBASE_0,button,1342308361 +Control4=IDC_CHARBASE_1,button,1342177289 +Control5=IDC_CHARBASE_2,button,1342177289 +Control6=IDC_CHARBASE_3,button,1342177289 +Control7=IDC_CHARBASE_4,button,1342177289 +Control8=IDC_PALETTE_SLIDER,msctls_trackbar32,1342373889 +Control9=IDC_STRETCH,button,1342242819 +Control10=IDC_REFRESH,button,1342373888 +Control11=IDC_SAVE,button,1342242816 +Control12=IDC_CLOSE,button,1342242816 +Control13=IDC_TILE_VIEW,VbaBitmapControl,1342373888 +Control14=IDC_STATIC,button,1342177287 +Control15=IDC_STATIC,button,1342177287 +Control16=IDC_MAP_VIEW_ZOOM,VbaZoomControl,1342373888 +Control17=IDC_COLOR,VbaColorControl,1342242816 +Control18=IDC_R,static,1342308352 +Control19=IDC_G,static,1342308352 +Control20=IDC_B,static,1342308352 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_AUTO_UPDATE,button,1342242819 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_TILE_NUMBER,static,1342308352 +Control26=IDC_ADDRESS,static,1342308352 + +[DLG:IDD_DISASSEMBLE] +Type=1 +Class=Disassemble +ControlCount=55 +Control1=IDC_AUTOMATIC,button,1342308361 +Control2=IDC_ARM,button,1342177289 +Control3=IDC_THUMB,button,1342177289 +Control4=IDC_ADDRESS,edit,1350762632 +Control5=IDC_GO,button,1342242816 +Control6=IDC_DISASSEMBLE,listbox,1350631683 +Control7=IDC_AUTO_UPDATE,button,1342242819 +Control8=IDC_REFRESH,button,1342242816 +Control9=IDC_NEXT,button,1342242816 +Control10=IDC_CLOSE,button,1342242817 +Control11=IDC_STATIC,static,1342308352 +Control12=IDC_STATIC,static,1342308352 +Control13=IDC_STATIC,static,1342308352 +Control14=IDC_STATIC,static,1342308352 +Control15=IDC_STATIC,static,1342308352 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_STATIC,static,1342308352 +Control18=IDC_STATIC,static,1342308352 +Control19=IDC_R0,static,1342308352 +Control20=IDC_R1,static,1342308352 +Control21=IDC_R2,static,1342308352 +Control22=IDC_R3,static,1342308352 +Control23=IDC_R4,static,1342308352 +Control24=IDC_R5,static,1342308352 +Control25=IDC_R6,static,1342308352 +Control26=IDC_R7,static,1342308352 +Control27=IDC_R8,static,1342308352 +Control28=IDC_R9,static,1342308352 +Control29=IDC_R10,static,1342308352 +Control30=IDC_R11,static,1342308352 +Control31=IDC_R12,static,1342308352 +Control32=IDC_R13,static,1342308352 +Control33=IDC_R14,static,1342308352 +Control34=IDC_R15,static,1342308352 +Control35=IDC_STATIC,static,1342308352 +Control36=IDC_STATIC,static,1342308352 +Control37=IDC_STATIC,static,1342308352 +Control38=IDC_STATIC,static,1342308352 +Control39=IDC_STATIC,static,1342308352 +Control40=IDC_STATIC,static,1342308352 +Control41=IDC_STATIC,static,1342308352 +Control42=IDC_STATIC,static,1342308352 +Control43=IDC_R16,static,1342308352 +Control44=IDC_STATIC,static,1342308352 +Control45=IDC_N,button,1476460547 +Control46=IDC_Z,button,1476460547 +Control47=IDC_C,button,1476460547 +Control48=IDC_V,button,1476460547 +Control49=IDC_F,button,1476460547 +Control50=IDC_I,button,1476460547 +Control51=IDC_T,button,1476460547 +Control52=IDC_STATIC,static,1342308352 +Control53=IDC_MODE,static,1342308352 +Control54=IDC_VSCROLL,scrollbar,1342177281 +Control55=IDC_GOPC,button,1342242816 + +[DLG:IDD_GDB_PORT] +Type=1 +Class=GDBPortDlg +ControlCount=4 +Control1=ID_OK,button,1342242817 +Control2=ID_CANCEL,button,1342242816 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_PORT,edit,1350631554 + +[DLG:IDD_GDB_WAITING] +Type=1 +Class=GDBWaitingDlg +ControlCount=3 +Control1=ID_CANCEL,button,1342242816 +Control2=IDC_STATIC,static,1342308352 +Control3=IDC_PORT,static,1342308352 + +[DLG:IDD_LOGGING] +Type=1 +Class=Logging +ControlCount=15 +Control1=IDC_VERBOSE_SWI,button,1342242819 +Control2=IDC_VERBOSE_UNALIGNED_ACCESS,button,1342242819 +Control3=IDC_VERBOSE_ILLEGAL_WRITE,button,1342242819 +Control4=IDC_VERBOSE_ILLEGAL_READ,button,1342242819 +Control5=IDC_VERBOSE_DMA0,button,1342242819 +Control6=IDC_VERBOSE_DMA1,button,1342242819 +Control7=IDC_VERBOSE_DMA2,button,1342242819 +Control8=IDC_VERBOSE_DMA3,button,1342242819 +Control9=IDC_VERBOSE_UNDEFINED,button,1342242819 +Control10=IDC_VERBOSE_AGBPRINT,button,1342242819 +Control11=IDC_LOG,edit,1353779396 +Control12=IDC_SAVE,button,1342242816 +Control13=IDC_CLEAR,button,1342242816 +Control14=ID_OK,button,1342242817 +Control15=IDC_STATIC,button,1342177287 + +[DLG:IDD_ADDR_SIZE] +Type=1 +Class=MemoryViewerAddressSize +ControlCount=6 +Control1=IDC_ADDRESS,edit,1350631552 +Control2=IDC_SIZE_CONTROL,edit,1350631552 +Control3=ID_OK,button,1342242817 +Control4=ID_CANCEL,button,1342242816 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_STATIC,static,1342308352 + +[DLG:IDD_GB_DISASSEMBLE] +Type=1 +Class=GBDisassemble +ControlCount=27 +Control1=IDC_ADDRESS,edit,1350762632 +Control2=IDC_GO,button,1342242816 +Control3=IDC_DISASSEMBLE,listbox,1350631683 +Control4=IDC_AUTO_UPDATE,button,1342242819 +Control5=IDC_REFRESH,button,1342242816 +Control6=IDC_NEXT,button,1342242816 +Control7=IDC_CLOSE,button,1342242817 +Control8=IDC_STATIC,static,1342308352 +Control9=IDC_STATIC,static,1342308352 +Control10=IDC_STATIC,static,1342308352 +Control11=IDC_STATIC,static,1342308352 +Control12=IDC_STATIC,static,1342308352 +Control13=IDC_R0,static,1342308352 +Control14=IDC_R1,static,1342308352 +Control15=IDC_R2,static,1342308352 +Control16=IDC_R3,static,1342308352 +Control17=IDC_R6,static,1342308352 +Control18=IDC_N,button,1476460547 +Control19=IDC_Z,button,1476460547 +Control20=IDC_C,button,1476460547 +Control21=IDC_H,button,1476460547 +Control22=IDC_VSCROLL,scrollbar,1342177281 +Control23=IDC_GOPC,button,1342242816 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_R4,static,1342308352 +Control26=IDC_STATIC,static,1342308352 +Control27=IDC_R5,static,1342308352 + +[DLG:IDD_GB_OAM_VIEW] +Type=1 +Class=GBOamView +ControlCount=28 +Control1=IDC_SPRITE,edit,1350639746 +Control2=IDC_SCROLLBAR,scrollbar,1342177280 +Control3=IDC_STRETCH,button,1342242819 +Control4=IDC_REFRESH,button,1342373888 +Control5=IDC_SAVE,button,1342373888 +Control6=IDC_CLOSE,button,1342242816 +Control7=IDC_OAM_VIEW,VbaBitmapControl,1342373888 +Control8=IDC_OAM_VIEW_ZOOM,VbaZoomControl,1342373888 +Control9=IDC_COLOR,VbaColorControl,1342242816 +Control10=IDC_POS,static,1342308352 +Control11=IDC_PALETTE,static,1342308352 +Control12=IDC_TILE,static,1342308352 +Control13=IDC_PRIO,static,1342308352 +Control14=IDC_OAP,static,1342308352 +Control15=IDC_FLAGS,static,1342308352 +Control16=IDC_R,static,1342308352 +Control17=IDC_G,static,1342308352 +Control18=IDC_B,static,1342308352 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_STATIC,static,1342308352 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_STATIC,static,1342308352 +Control25=IDC_STATIC,static,1342308352 +Control26=IDC_AUTO_UPDATE,button,1342242819 +Control27=IDC_BANK,static,1342308352 +Control28=IDC_STATIC,static,1342308352 + +[DLG:IDD_GB_TILE_VIEWER] +Type=1 +Class=GBTileView +ControlCount=23 +Control1=IDC_BANK_0,button,1342308361 +Control2=IDC_BANK_1,button,1342177289 +Control3=IDC_CHARBASE_0,button,1342308361 +Control4=IDC_CHARBASE_1,button,1342177289 +Control5=IDC_STRETCH,button,1342242819 +Control6=IDC_REFRESH,button,1342373888 +Control7=IDC_SAVE,button,1342242816 +Control8=IDC_CLOSE,button,1342242816 +Control9=IDC_TILE_VIEW,VbaBitmapControl,1342373888 +Control10=IDC_STATIC,button,1342177287 +Control11=IDC_STATIC,button,1342177287 +Control12=IDC_MAP_VIEW_ZOOM,VbaZoomControl,1342373888 +Control13=IDC_COLOR,VbaColorControl,1342242816 +Control14=IDC_R,static,1342308352 +Control15=IDC_G,static,1342308352 +Control16=IDC_B,static,1342308352 +Control17=IDC_STATIC,static,1342308352 +Control18=IDC_AUTO_UPDATE,button,1342242819 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_TILE_NUMBER,static,1342308352 +Control22=IDC_ADDRESS,static,1342308352 +Control23=IDC_PALETTE_SLIDER,msctls_trackbar32,1342373889 + +[DLG:IDD_GB_MAP_VIEW] +Type=1 +Class=GBMapView +ControlCount=28 +Control1=IDC_BANK_0,button,1342308361 +Control2=IDC_BANK_1,button,1342177289 +Control3=IDC_BG0,button,1342308361 +Control4=IDC_BG1,button,1342177289 +Control5=IDC_STRETCH,button,1342242819 +Control6=IDC_REFRESH,button,1342373888 +Control7=IDC_SAVE,button,1342373888 +Control8=IDC_CLOSE,button,1342242816 +Control9=IDC_MAP_VIEW,VbaBitmapControl,1342373888 +Control10=IDC_MAP_VIEW_ZOOM,VbaZoomControl,1342373888 +Control11=IDC_COLOR,VbaColorControl,1342242816 +Control12=IDC_R,static,1342308352 +Control13=IDC_G,static,1342308352 +Control14=IDC_B,static,1342308352 +Control15=IDC_STATIC,button,1342177287 +Control16=IDC_STATIC,button,1342177287 +Control17=IDC_AUTO_UPDATE,button,1342242819 +Control18=IDC_XY,static,1342308352 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_PRIORITY,static,1342308352 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_ADDRESS,static,1342308352 +Control23=IDC_STATIC,static,1342308352 +Control24=IDC_TILE_NUM,static,1342308352 +Control25=IDC_STATIC,static,1342308352 +Control26=IDC_FLIP,static,1342308352 +Control27=IDC_STATIC,static,1342308352 +Control28=IDC_PALETTE_NUM,static,1342308352 + +[DLG:IDD_GB_PALETTE_VIEW] +Type=1 +Class=GBPaletteView +ControlCount=21 +Control1=IDC_SAVE_BG,button,1342242816 +Control2=IDC_SAVE_OBJ,button,1342242816 +Control3=IDC_REFRESH2,button,1342242816 +Control4=IDC_CLOSE,button,1342242816 +Control5=IDC_ADDRESS,static,1342308352 +Control6=IDC_R,static,1342308352 +Control7=IDC_G,static,1342308352 +Control8=IDC_B,static,1342308352 +Control9=IDC_VALUE,static,1342308352 +Control10=IDC_COLOR,VbaColorControl,1342242816 +Control11=IDC_PALETTE_VIEW,VbaPaletteViewControl,1342242816 +Control12=IDC_PALETTE_VIEW_OBJ,VbaPaletteViewControl,1342242816 +Control13=IDC_STATIC,button,1342177287 +Control14=IDC_STATIC,button,1342177287 +Control15=IDC_STATIC,static,1342308352 +Control16=IDC_STATIC,static,1342308352 +Control17=IDC_STATIC,static,1342308352 +Control18=IDC_STATIC,static,1342308352 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_STATIC,static,1342308352 +Control21=IDC_AUTO_UPDATE,button,1342242819 + +[DLG:IDD_IO_VIEWER] +Type=1 +Class=IOViewer +ControlCount=23 +Control1=IDC_ADDRESSES,combobox,1344339971 +Control2=IDC_VALUE,static,1342308354 +Control3=IDC_BIT_15,button,1342242819 +Control4=IDC_BIT_14,button,1342242819 +Control5=IDC_BIT_13,button,1342242819 +Control6=IDC_BIT_12,button,1342242819 +Control7=IDC_BIT_11,button,1342242819 +Control8=IDC_BIT_10,button,1342242819 +Control9=IDC_BIT_9,button,1342242819 +Control10=IDC_BIT_8,button,1342242819 +Control11=IDC_BIT_7,button,1342242819 +Control12=IDC_BIT_6,button,1342242819 +Control13=IDC_BIT_5,button,1342242819 +Control14=IDC_BIT_4,button,1342242819 +Control15=IDC_BIT_3,button,1342242819 +Control16=IDC_BIT_2,button,1342242819 +Control17=IDC_BIT_1,button,1342242819 +Control18=IDC_BIT_0,button,1342242819 +Control19=IDC_AUTO_UPDATE,button,1342242819 +Control20=IDC_REFRESH,button,1342242817 +Control21=IDC_APPLY,button,1342242817 +Control22=IDC_CLOSE,button,1342242816 +Control23=IDC_STATIC,static,1342308352 + +[MNU:IDR_MENU] +Type=1 +Class=MainWnd +Command1=ID_FILE_OPEN +Command2=ID_FILE_OPENGAMEBOY +Command3=ID_FILE_LOAD +Command4=ID_FILE_SAVE +Command5=ID_FILE_LOADGAME_MOSTRECENT +Command6=ID_FILE_LOADGAME_AUTOLOADMOSTRECENT +Command7=ID_FILE_LOADGAME_SLOT1 +Command8=ID_FILE_LOADGAME_SLOT2 +Command9=ID_FILE_LOADGAME_SLOT3 +Command10=ID_FILE_LOADGAME_SLOT4 +Command11=ID_FILE_LOADGAME_SLOT5 +Command12=ID_FILE_LOADGAME_SLOT6 +Command13=ID_FILE_LOADGAME_SLOT7 +Command14=ID_FILE_LOADGAME_SLOT8 +Command15=ID_FILE_LOADGAME_SLOT9 +Command16=ID_FILE_LOADGAME_SLOT10 +Command17=ID_FILE_SAVEGAME_OLDESTSLOT +Command18=ID_FILE_SAVEGAME_SLOT1 +Command19=ID_FILE_SAVEGAME_SLOT2 +Command20=ID_FILE_SAVEGAME_SLOT3 +Command21=ID_FILE_SAVEGAME_SLOT4 +Command22=ID_FILE_SAVEGAME_SLOT5 +Command23=ID_FILE_SAVEGAME_SLOT6 +Command24=ID_FILE_SAVEGAME_SLOT7 +Command25=ID_FILE_SAVEGAME_SLOT8 +Command26=ID_FILE_SAVEGAME_SLOT9 +Command27=ID_FILE_SAVEGAME_SLOT10 +Command28=ID_FILE_PAUSE +Command29=ID_FILE_RESET +Command30=ID_FILE_RECENT_RESET +Command31=ID_FILE_RECENT_FREEZE +Command32=ID_FILE_IMPORT_BATTERYFILE +Command33=ID_FILE_IMPORT_GAMESHARKCODEFILE +Command34=ID_FILE_IMPORT_GAMESHARKSNAPSHOT +Command35=ID_FILE_EXPORT_BATTERYFILE +Command36=ID_FILE_EXPORT_GAMESHARKSNAPSHOT +Command37=ID_FILE_SCREENCAPTURE +Command38=ID_FILE_ROMINFORMATION +Command39=ID_FILE_TOGGLEMENU +Command40=ID_FILE_CLOSE +Command41=ID_FILE_EXIT +Command42=ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE +Command43=ID_OPTIONS_FRAMESKIP_THROTTLE_25 +Command44=ID_OPTIONS_FRAMESKIP_THROTTLE_50 +Command45=ID_OPTIONS_FRAMESKIP_THROTTLE_100 +Command46=ID_OPTIONS_FRAMESKIP_THROTTLE_150 +Command47=ID_OPTIONS_FRAMESKIP_THROTTLE_200 +Command48=ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER +Command49=ID_OPTIONS_FRAMESKIP_AUTOMATIC +Command50=ID_OPTIONS_VIDEO_FRAMESKIP_0 +Command51=ID_OPTIONS_VIDEO_FRAMESKIP_1 +Command52=ID_OPTIONS_VIDEO_FRAMESKIP_2 +Command53=ID_OPTIONS_VIDEO_FRAMESKIP_3 +Command54=ID_OPTIONS_VIDEO_FRAMESKIP_4 +Command55=ID_OPTIONS_VIDEO_FRAMESKIP_5 +Command56=ID_OPTIONS_VIDEO_FRAMESKIP_6 +Command57=ID_OPTIONS_VIDEO_FRAMESKIP_7 +Command58=ID_OPTIONS_VIDEO_FRAMESKIP_8 +Command59=ID_OPTIONS_VIDEO_FRAMESKIP_9 +Command60=ID_OPTIONS_VIDEO_VSYNC +Command61=ID_OPTIONS_VIDEO_RENDERMETHOD_GDI +Command62=ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW +Command63=ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D +Command64=ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL +Command65=ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY +Command66=ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY +Command67=ID_OPTIONS_VIDEO_TRIPLEBUFFERING +Command68=ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER +Command69=ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR +Command70=ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST +Command71=ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR +Command72=ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE +Command73=ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS +Command74=ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN +Command75=ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN +Command76=ID_OPTIONS_VIDEO_X1 +Command77=ID_OPTIONS_VIDEO_X2 +Command78=ID_OPTIONS_VIDEO_X3 +Command79=ID_OPTIONS_VIDEO_X4 +Command80=ID_OPTIONS_VIDEO_FULLSCREEN320X240 +Command81=ID_OPTIONS_VIDEO_FULLSCREEN640X480 +Command82=ID_OPTIONS_VIDEO_FULLSCREEN800X600 +Command83=ID_OPTIONS_VIDEO_FULLSCREEN +Command84=ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE +Command85=ID_OPTIONS_VIDEO_DISABLESFX +Command86=ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT +Command87=ID_OPTIONS_VIDEO_LAYERS_BG0 +Command88=ID_OPTIONS_VIDEO_LAYERS_BG1 +Command89=ID_OPTIONS_VIDEO_LAYERS_BG2 +Command90=ID_OPTIONS_VIDEO_LAYERS_BG3 +Command91=ID_OPTIONS_VIDEO_LAYERS_OBJ +Command92=ID_OPTIONS_VIDEO_LAYERS_WIN0 +Command93=ID_OPTIONS_VIDEO_LAYERS_WIN1 +Command94=ID_OPTIONS_VIDEO_LAYERS_OBJWIN +Command95=ID_OPTIONS_EMULATOR_ASSOCIATE +Command96=ID_OPTIONS_EMULATOR_DIRECTORIES +Command97=ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES +Command98=ID_OPTIONS_EMULATOR_SYNCHRONIZE +Command99=ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE +Command100=ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE +Command101=ID_OPTIONS_EMULATOR_REMOVEINTROSGBA +Command102=ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH +Command103=ID_OPTIONS_EMULATOR_AGBPRINT +Command104=ID_OPTIONS_EMULATOR_REALTIMECLOCK +Command105=ID_OPTIONS_EMULATOR_AUTOHIDEMENU +Command106=ID_OPTIONS_EMULATOR_REWINDINTERVAL +Command107=ID_OPTIONS_EMULATOR_SHOWSPEED_NONE +Command108=ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE +Command109=ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED +Command110=ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT +Command111=ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC +Command112=ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM +Command113=ID_OPTIONS_EMULATOR_SAVETYPE_SRAM +Command114=ID_OPTIONS_EMULATOR_SAVETYPE_FLASH +Command115=ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR +Command116=ID_OPTIONS_EMULATOR_SAVETYPE_NONE +Command117=ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K +Command118=ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M +Command119=ID_OPTIONS_EMULATOR_SAVETYPE_ENHANCEDDETECTION +Command120=ID_OPTIONS_EMULATOR_USEBIOSFILE +Command121=ID_OPTIONS_EMULATOR_SKIPBIOS +Command122=ID_OPTIONS_EMULATOR_SELECTBIOSFILE +Command123=ID_OPTIONS_EMULATOR_PNGFORMAT +Command124=ID_OPTIONS_EMULATOR_BMPFORMAT +Command125=ID_OPTIONS_SOUND_OFF +Command126=ID_OPTIONS_SOUND_MUTE +Command127=ID_OPTIONS_SOUND_ON +Command128=ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION +Command129=ID_OPTIONS_SOUND_ECHO +Command130=ID_OPTIONS_SOUND_LOWPASSFILTER +Command131=ID_OPTIONS_SOUND_REVERSESTEREO +Command132=ID_OPTIONS_SOUND_CHANNEL1 +Command133=ID_OPTIONS_SOUND_CHANNEL2 +Command134=ID_OPTIONS_SOUND_CHANNEL3 +Command135=ID_OPTIONS_SOUND_CHANNEL4 +Command136=ID_OPTIONS_SOUND_DIRECTSOUNDA +Command137=ID_OPTIONS_SOUND_DIRECTSOUNDB +Command138=ID_OPTIONS_SOUND_11KHZ +Command139=ID_OPTIONS_SOUND_22KHZ +Command140=ID_OPTIONS_SOUND_44KHZ +Command141=ID_OPTIONS_SOUND_VOLUME_25X +Command142=ID_OPTIONS_SOUND_VOLUME_5X +Command143=ID_OPTIONS_SOUND_VOLUME_1X +Command144=ID_OPTIONS_SOUND_VOLUME_2X +Command145=ID_OPTIONS_SOUND_VOLUME_3X +Command146=ID_OPTIONS_SOUND_VOLUME_4X +Command147=ID_OPTIONS_GAMEBOY_BORDER +Command148=ID_OPTIONS_GAMEBOY_PRINTER +Command149=ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC +Command150=ID_OPTIONS_GAMEBOY_AUTOMATIC +Command151=ID_OPTIONS_GAMEBOY_GBA +Command152=ID_OPTIONS_GAMEBOY_CGB +Command153=ID_OPTIONS_GAMEBOY_SGB +Command154=ID_OPTIONS_GAMEBOY_SGB2 +Command155=ID_OPTIONS_GAMEBOY_GB +Command156=ID_OPTIONS_GAMEBOY_REALCOLORS +Command157=ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS +Command158=ID_OPTIONS_GAMEBOY_COLORS +Command159=ID_OPTIONS_PRIORITY_HIGHEST +Command160=ID_OPTIONS_PRIORITY_ABOVENORMAL +Command161=ID_OPTIONS_PRIORITY_NORMAL +Command162=ID_OPTIONS_PRIORITY_BELOWNORMAL +Command163=ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE +Command164=ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR +Command165=ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART +Command166=ID_OPTIONS_FILTER_NORMAL +Command167=ID_OPTIONS_FILTER_TVMODE +Command168=ID_OPTIONS_FILTER_2XSAI +Command169=ID_OPTIONS_FILTER_SUPER2XSAI +Command170=ID_OPTIONS_FILTER_SUPEREAGLE +Command171=ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL +Command172=ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL +Command173=ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X +Command174=ID_OPTIONS_FILTER16BIT_SIMPLE2X +Command175=ID_OPTIONS_FILTER_BILINEAR +Command176=ID_OPTIONS_FILTER_BILINEARPLUS +Command177=ID_OPTIONS_FILTER_SCANLINES +Command178=ID_OPTIONS_FILTER_HQ2X +Command179=ID_OPTIONS_FILTER_LQ2X +Command180=ID_OPTIONS_FILTER_DISABLEMMX +Command181=ID_OPTIONS_JOYPAD_CONFIGURE_1 +Command182=ID_OPTIONS_JOYPAD_CONFIGURE_2 +Command183=ID_OPTIONS_JOYPAD_CONFIGURE_3 +Command184=ID_OPTIONS_JOYPAD_CONFIGURE_4 +Command185=ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1 +Command186=ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_2 +Command187=ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_3 +Command188=ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4 +Command189=ID_OPTIONS_JOYPAD_MOTIONCONFIGURE +Command190=ID_OPTIONS_JOYPAD_AUTOFIRE_A +Command191=ID_OPTIONS_JOYPAD_AUTOFIRE_B +Command192=ID_OPTIONS_JOYPAD_AUTOFIRE_L +Command193=ID_OPTIONS_JOYPAD_AUTOFIRE_R +Command194=ID_OPTIONS_LANGUAGE_SYSTEM +Command195=ID_OPTIONS_LANGUAGE_ENGLISH +Command196=ID_OPTIONS_LANGUAGE_OTHER +Command197=ID_CHEATS_SEARCHFORCHEATS +Command198=ID_CHEATS_CHEATLIST +Command199=ID_CHEATS_AUTOMATICSAVELOADCHEATS +Command200=ID_CHEATS_DISABLECHEATS +Command201=ID_CHEATS_LOADCHEATLIST +Command202=ID_CHEATS_SAVECHEATLIST +Command203=ID_TOOLS_DISASSEMBLE +Command204=ID_TOOLS_LOGGING +Command205=ID_TOOLS_IOVIEWER +Command206=ID_TOOLS_MAPVIEW +Command207=ID_TOOLS_MEMORYVIEWER +Command208=ID_TOOLS_OAMVIEWER +Command209=ID_TOOLS_PALETTEVIEW +Command210=ID_TOOLS_TILEVIEWER +Command211=ID_DEBUG_NEXTFRAME +Command212=ID_TOOLS_DEBUG_GDB +Command213=ID_TOOLS_DEBUG_LOADANDWAIT +Command214=ID_TOOLS_DEBUG_BREAK +Command215=ID_TOOLS_DEBUG_DISCONNECT +Command216=ID_OPTIONS_SOUND_STARTRECORDING +Command217=ID_OPTIONS_SOUND_STOPRECORDING +Command218=ID_TOOLS_RECORD_STARTAVIRECORDING +Command219=ID_TOOLS_RECORD_STOPAVIRECORDING +Command220=ID_TOOLS_RECORD_STARTMOVIERECORDING +Command221=ID_TOOLS_RECORD_STOPMOVIERECORDING +Command222=ID_TOOLS_PLAY_STARTMOVIEPLAYING +Command223=ID_TOOLS_PLAY_STOPMOVIEPLAYING +Command224=ID_TOOLS_REWIND +Command225=ID_TOOLS_CUSTOMIZE +Command226=ID_HELP_BUGREPORT +Command227=ID_HELP_FAQ +Command228=ID_HELP_ABOUT +CommandCount=228 + +[ACL:IDR_ACCELERATOR] +Type=1 +Class=? +Command1=ID_OPTIONS_VIDEO_LAYERS_BG0 +Command2=ID_OPTIONS_JOYPAD_AUTOFIRE_A +Command3=ID_OPTIONS_VIDEO_LAYERS_BG1 +Command4=ID_OPTIONS_JOYPAD_AUTOFIRE_B +Command5=ID_OPTIONS_VIDEO_LAYERS_BG2 +Command6=ID_OPTIONS_JOYPAD_AUTOFIRE_L +Command7=ID_OPTIONS_VIDEO_LAYERS_BG3 +Command8=ID_OPTIONS_JOYPAD_AUTOFIRE_R +Command9=ID_OPTIONS_VIDEO_LAYERS_OBJ +Command10=ID_OPTIONS_VIDEO_LAYERS_WIN0 +Command11=ID_OPTIONS_VIDEO_LAYERS_WIN1 +Command12=ID_OPTIONS_VIDEO_LAYERS_OBJWIN +Command13=ID_TOOLS_REWIND +Command14=ID_CHEATS_SEARCHFORCHEATS +Command15=ID_FILE_LOAD +Command16=ID_DEBUG_NEXTFRAME +Command17=ID_FILE_OPEN +Command18=ID_FILE_PAUSE +Command19=ID_FILE_RESET +Command20=ID_FILE_SAVE +Command21=ID_FILE_TOGGLEMENU +Command22=ID_FILE_LOADGAME_SLOT1 +Command23=ID_FILE_MRU_FILE1 +Command24=ID_FILE_SAVEGAME_SLOT1 +Command25=ID_FILE_LOADGAME_SLOT10 +Command26=ID_FILE_MRU_FILE10 +Command27=ID_FILE_SAVEGAME_SLOT10 +Command28=ID_FILE_LOADGAME_SLOT2 +Command29=ID_FILE_MRU_FILE2 +Command30=ID_FILE_SAVEGAME_SLOT2 +Command31=ID_FILE_LOADGAME_SLOT3 +Command32=ID_FILE_MRU_FILE3 +Command33=ID_FILE_SAVEGAME_SLOT3 +Command34=ID_FILE_LOADGAME_SLOT4 +Command35=ID_FILE_MRU_FILE4 +Command36=ID_FILE_SAVEGAME_SLOT4 +Command37=ID_FILE_LOADGAME_SLOT5 +Command38=ID_FILE_MRU_FILE5 +Command39=ID_FILE_SAVEGAME_SLOT5 +Command40=ID_FILE_LOADGAME_SLOT6 +Command41=ID_FILE_MRU_FILE6 +Command42=ID_FILE_SAVEGAME_SLOT6 +Command43=ID_FILE_LOADGAME_SLOT7 +Command44=ID_FILE_MRU_FILE7 +Command45=ID_FILE_SAVEGAME_SLOT7 +Command46=ID_FILE_LOADGAME_SLOT8 +Command47=ID_FILE_MRU_FILE8 +Command48=ID_FILE_SAVEGAME_SLOT8 +Command49=ID_FILE_LOADGAME_SLOT9 +Command50=ID_FILE_MRU_FILE9 +Command51=ID_FILE_SAVEGAME_SLOT9 +Command52=ID_FILE_EXIT +CommandCount=52 + +[CLS:AddGSACode] +Type=0 +HeaderFile=GBACheats.h +ImplementationFile=GBACheats.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=AddGSACode + +[CLS:GBCheatList] +Type=0 +HeaderFile=GBCheatsDlg.h +ImplementationFile=GBCheatsDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=GBCheatList + +[CLS:Disassemble] +Type=0 +HeaderFile=Disassemble.h +ImplementationFile=Disassemble.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=Disassemble + +[CLS:GBDisassemble] +Type=0 +HeaderFile=GBDisassemble.h +ImplementationFile=GBDisassemble.cpp +BaseClass=CDialog +Filter=D +LastObject=IDC_GO +VirtualFilter=dWC + +[CLS:Logging] +Type=0 +HeaderFile=Logging.h +ImplementationFile=Logging.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=IDC_LOG + +[CLS:IOViewer] +Type=0 +HeaderFile=IOViewer.h +ImplementationFile=IOViewer.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=ID_FILE_LOADGAME_SLOT1 + +[CLS:ZoomControl] +Type=0 +HeaderFile=ZoomControl.h +ImplementationFile=ZoomControl.cpp +BaseClass=CWnd +Filter=W +VirtualFilter=WC +LastObject=ZoomControl + +[CLS:BitmapControl] +Type=0 +HeaderFile=BitmapControl.h +ImplementationFile=BitmapControl.cpp +BaseClass=CScrollView +Filter=C +VirtualFilter=VWC +LastObject=BitmapControl + +[CLS:MapView] +Type=0 +HeaderFile=MapView.h +ImplementationFile=MapView.cpp +BaseClass=CDialog +Filter=D +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS +VirtualFilter=dWC + +[CLS:GBMapView] +Type=0 +HeaderFile=GBMapView.h +ImplementationFile=GBMapView.cpp +BaseClass=CDialog +Filter=D +LastObject=GBMapView +VirtualFilter=dWC + +[CLS:MemoryViewer] +Type=0 +HeaderFile=MemoryViewer.h +ImplementationFile=MemoryViewer.cpp +BaseClass=CWnd +Filter=W +VirtualFilter=WC +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS + +[CLS:MemoryViewerDlg] +Type=0 +HeaderFile=MemoryViewerDlg.h +ImplementationFile=MemoryViewerDlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=MemoryViewerDlg + +[CLS:MemoryViewerAddressSize] +Type=0 +HeaderFile=MemoryViewerAddressSize.h +ImplementationFile=MemoryViewerAddressSize.cpp +BaseClass=CDialog +Filter=D +LastObject=ID_CANCEL +VirtualFilter=dWC + +[CLS:GBMemoryViewerDlg] +Type=0 +HeaderFile=GBMemoryViewerDlg.h +ImplementationFile=GBMemoryViewerDlg.cpp +BaseClass=CDialog +Filter=D +LastObject=GBMemoryViewerDlg +VirtualFilter=dWC + +[CLS:OamView] +Type=0 +HeaderFile=OamView.h +ImplementationFile=OamView.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS + +[CLS:GBOamView] +Type=0 +HeaderFile=GBOamView.h +ImplementationFile=GBOamView.cpp +BaseClass=CDialog +Filter=D +LastObject=GBOamView +VirtualFilter=dWC + +[CLS:PaletteViewControl] +Type=0 +HeaderFile=PaletteViewControl.h +ImplementationFile=PaletteViewControl.cpp +BaseClass=CWnd +Filter=W +VirtualFilter=WC +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS + +[CLS:PaletteView] +Type=0 +HeaderFile=paletteview.h +ImplementationFile=paletteview.cpp +BaseClass=CDialog +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS + +[CLS:GBPaletteView] +Type=0 +HeaderFile=GBPaletteView.h +ImplementationFile=GBPaletteView.cpp +BaseClass=CDialog +Filter=D +LastObject=GBPaletteView +VirtualFilter=dWC + +[CLS:TileView] +Type=0 +HeaderFile=TileView.h +ImplementationFile=TileView.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=ID_CHEATS_AUTOMATICSAVELOADCHEATS + +[CLS:GBTileView] +Type=0 +HeaderFile=GBTileView.h +ImplementationFile=GBTileView.cpp +BaseClass=CDialog +Filter=D +LastObject=GBTileView +VirtualFilter=dWC + +[CLS:GBPrinterDlg] +Type=0 +HeaderFile=gbprinterdlg.h +ImplementationFile=gbprinterdlg.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=GBPrinterDlg + +[CLS:GDBPortDlg] +Type=0 +HeaderFile=GDBConnection.h +ImplementationFile=GDBConnection.cpp +BaseClass=CDialog +Filter=D +LastObject=GDBPortDlg +VirtualFilter=dWC + +[CLS:GDBWaitingDlg] +Type=0 +HeaderFile=GDBConnection.h +ImplementationFile=GDBConnection.cpp +BaseClass=CDialog +Filter=D +LastObject=GDBWaitingDlg +VirtualFilter=dWC + +[CLS:AccelEditor] +Type=0 +HeaderFile=AccelEditor.h +ImplementationFile=AccelEditor.cpp +BaseClass=CDialog +Filter=D +LastObject=IDC_REMOVE +VirtualFilter=dWC + +[CLS:Hyperlink] +Type=0 +HeaderFile=Hyperlink.h +ImplementationFile=Hyperlink.cpp +BaseClass=CStatic +Filter=W +VirtualFilter=WC +LastObject=Hyperlink + +[DLG:IDD_MAX_SCALE] +Type=1 +Class=MaxScale +ControlCount=5 +Control1=IDC_VALUE,edit,1350631552 +Control2=ID_OK,button,1342242817 +Control3=ID_CANCEL,button,1342242816 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_STATIC,static,1342308352 + +[CLS:MaxScale] +Type=0 +HeaderFile=MaxScale.h +ImplementationFile=MaxScale.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=MaxScale + +[DLG:IDD_BUG_REPORT] +Type=1 +Class=BugReport +ControlCount=4 +Control1=ID_OK,button,1342242816 +Control2=IDC_BUG_REPORT,edit,1352730820 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_COPY,button,1342242817 + +[CLS:BugReport] +Type=0 +HeaderFile=BugReport.h +ImplementationFile=BugReport.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=BugReport + diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp new file mode 100644 index 0000000..76c9822 --- /dev/null +++ b/src/win32/VBA.cpp @@ -0,0 +1,2707 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// VBA.cpp : Defines the class behaviors for the application. +// +#include "stdafx.h" +#include +#include + +#include "AVIWrite.h" +#include "LangSelect.h" +#include "MainWnd.h" +#include "Reg.h" +#include "resource.h" +#include "skin.h" +#include "WavWriter.h" +#include "WinResUtil.h" + +#include "../System.h" +#include "../agbprint.h" +#include "../cheatSearch.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../RTC.h" +#include "../Sound.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" +#include "../gb/gbPrinter.h" +#include "../Text.h" +#include "../movie.h" +#include "../nesvideos-piece.h" + +extern void Pixelate(u8*,u32,u8*,u8*,u32,int,int); +extern void Pixelate32(u8*,u32,u8*,u8*,u32,int,int); +extern void MotionBlur(u8*,u32,u8*,u8*,u32,int,int); +extern void MotionBlur32(u8*,u32,u8*,u8*,u32,int,int); +extern void _2xSaI(u8*,u32,u8*,u8*,u32,int,int); +extern void _2xSaI32(u8*,u32,u8*,u8*,u32,int,int); +extern void Super2xSaI(u8*,u32,u8*,u8*,u32,int,int); +extern void Super2xSaI32(u8*,u32,u8*,u8*,u32,int,int); +extern void SuperEagle(u8*,u32,u8*,u8*,u32,int,int); +extern void SuperEagle32(u8*,u32,u8*,u8*,u32,int,int); +extern void AdMame2x(u8*,u32,u8*,u8*,u32,int,int); +extern void AdMame2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void Simple2x(u8*,u32,u8*,u8*,u32,int,int); +extern void Simple2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void Bilinear(u8*,u32,u8*,u8*,u32,int,int); +extern void Bilinear32(u8*,u32,u8*,u8*,u32,int,int); +extern void BilinearPlus(u8*,u32,u8*,u8*,u32,int,int); +extern void BilinearPlus32(u8*,u32,u8*,u8*,u32,int,int); +extern void Scanlines(u8*,u32,u8*,u8*,u32,int,int); +extern void Scanlines32(u8*,u32,u8*,u8*,u32,int,int); +extern void ScanlinesTV(u8*,u32,u8*,u8*,u32,int,int); +extern void ScanlinesTV32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2x(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2xS(u8*,u32,u8*,u8*,u32,int,int); +extern void hq2xS32(u8*,u32,u8*,u8*,u32,int,int); +extern void lq2x(u8*,u32,u8*,u8*,u32,int,int); +extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3x(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3xS(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3xS32(u8*,u32,u8*,u8*,u32,int,int); + +extern void SmartIB(u8*,u32,int,int); +extern void SmartIB32(u8*,u32,int,int); +extern void MotionBlurIB(u8*,u32,int,int); +extern void InterlaceIB(u8*,u32,int,int); +extern void MotionBlurIB32(u8*,u32,int,int); + +extern void toolsLog(const char *); + +extern IDisplay *newGDIDisplay(); +extern IDisplay *newDirectDrawDisplay(); +extern IDisplay *newDirect3DDisplay(); +extern IDisplay *newOpenGLDisplay(); + +extern Input *newDirectInput(); + +extern ISound *newDirectSound(); + +extern void remoteStubSignal(int, int); +extern void remoteOutput(char *, u32); +extern void remoteStubMain(); +extern void remoteSetProtocol(int); +extern void remoteCleanUp(); +extern int remoteSocket; + +extern void InterframeCleanup(); + +void winlog(const char *msg, ...); + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +int emulating = 0; +bool debugger = false; +int RGB_LOW_BITS_MASK = 0; + +int systemFrameSkip = 0; +int systemSpeed = 0; +bool systemSoundOn = false; +u32 systemColorMap32[0x10000]; +u16 systemColorMap16[0x10000]; +u16 systemGbPalette[24]; +int systemRedShift = 0; +int systemBlueShift = 0; +int systemGreenShift = 0; +int systemColorDepth = 16; +int systemVerbose = 0; +int systemDebug = 0; +int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + +#define BMP_BUFFER_MAX_WIDTH (256) +#define BMP_BUFFER_MAX_HEIGHT (224) +#define BMP_BUFFER_MAX_DEPTH (3) +static char bmpBuffer [BMP_BUFFER_MAX_WIDTH*BMP_BUFFER_MAX_HEIGHT*BMP_BUFFER_MAX_DEPTH]; + +char movieFileToPlay [1024]; +bool playMovieFile = false; +bool playMovieFileReadOnly = false; +char wavFileToOutput [1024]; +bool outputWavFile = false; +bool outputAVIFile = false; +bool flagHideMenu = false; +int quitAfterTime = -1; +int pauseAfterTime = -1; + +void winSignal(int,int); +void winOutput(char *, u32); + +void (*dbgSignal)(int,int) = winSignal; +void (*dbgOutput)(char *, u32) = winOutput; + +#ifdef MMX +extern "C" bool cpu_mmx; +#endif + +void directXMessage(const char *msg) +{ + systemMessage(IDS_DIRECTX_7_REQUIRED, + "DirectX 7.0 or greater is required to run.\nDownload at http://www.microsoft.com/directx.\n\nError found at: %s", + msg); +} + +///////////////////////////////////////////////////////////////////////////// +// VBA + +BEGIN_MESSAGE_MAP(VBA, CWinApp) + //{{AFX_MSG_MAP(VBA) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// VBA construction + +VBA::VBA() +{ + mode320Available = false; + mode640Available = false; + mode800Available = false; + windowPositionX = 0; + windowPositionY = 0; + filterFunction = NULL; + ifbFunction = NULL; + ifbType = 0; + filterType = 0; + filterWidth = 0; + filterHeight = 0; + fsWidth = 0; + fsHeight = 0; + fsColorDepth = 0; + fsForceChange = false; + surfaceSizeX = 0; + surfaceSizeY = 0; + sizeX = 0; + sizeY = 0; + videoOption = 0; + fullScreenStretch = false; + disableStatusMessage = false; + showSpeed = 1; + showSpeedTransparent = true; + showRenderedFrames = 0; + for(int j = 0 ; j < SCREEN_MESSAGE_SLOTS ; j++) + { + screenMessage[j] = false; + screenMessageTime[j] = 0; + screenMessageDuration[j] = 0; + } + menuToggle = true; + display = NULL; + menu = NULL; + popup = NULL; + cartridgeType = 0; + soundInitialized = false; + useBiosFile = false; + skipBiosFile = false; + active = true; + paused = false; + recentFreeze = false; + autoSaveLoadCheatList = false; + pauseDuringCheatSearch = true; + modelessCheatDialogIsOpen = false; + winout = NULL; + removeIntros = false; + autoIPS = true; + winGbBorderOn = 0; + hideMovieBorder = false; + winFlashSize = 0x10000; + winRtcEnable = false; + winSaveType = 0; + rewindMemory = NULL; + frameSearchMemory = NULL; + rewindPos = 0; + rewindTopPos = 0; + rewindCounter = 0; + rewindCount = 0; + rewindSaveNeeded = false; + rewindTimer = 0; + captureFormat = 0; + tripleBuffering = true; + autoHideMenu = false; + throttle = 100; + throttleLastTime = 0; +/// autoFrameSkipLastTime = 0; +/// autoFrameSkip = false; + vsync = false; + changingVideoSize = false; + pVideoDriverGUID = NULL; + renderMethod = DIRECT_DRAW; + iconic = false; + ddrawEmulationOnly = false; + ddrawUsingEmulationOnly = false; + ddrawDebug = false; + ddrawUseVideoMemory = false; + d3dFilter = 0; + glFilter = 0; + glType = 0; + skin = NULL; + skinName = ""; + skinEnabled = false; + skinButtons = 0; + regEnabled = false; + pauseWhenInactive = true; + frameCounter = false; + inputDisplay = false; + movieReadOnly = true; + speedupToggle = false; + useOldSync = false; + useOldGBTiming = false; + allowLeftRight = false; + muteFrameAdvance = false; + frameAdvanceMuteNow = false; + winGbPrinterEnabled = false; + threadPriority = 2; + disableMMX = false; + languageOption = 0; + languageModule = NULL; + languageName = ""; + renderedFrames = 0; + input = NULL; + joypadDefault = 0; + autoFire = 0; + autoFire2 = 0; + autoHold = 0; + autoFireToggle = false; + winPauseNextFrame = false; + soundRecording = false; + soundRecorder = NULL; + sound = NULL; + aviRecording = false; + aviRecorder = NULL; + aviFrameNumber = 0; + painting = false; + sensorX = 2047; + sensorY = 2047; + mouseCounter = 0; + wasPaused = false; + frameskipadjust = 0; + autoLoadMostRecent = false; + loadMakesRecent = false; + fsMaxScale = 0; + romSize = 0; + loadMakesCurrent = false; + saveMakesCurrent = false; + currentSlot = 0; + frameSearchLoadValid = false; + frameSearching = false; + frameSearchSkipping = false; + nvVideoLog = false; + nvAudioLog = false; + LoggingEnabled = 0; +/// FPS = 60; + + updateCount = 0; + + globalFrameCount = 0; + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + ZeroMemory(&emulator, sizeof(emulator)); + + hAccel = NULL; + + for(int i = 0; i < 24;) { + systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10); + systemGbPalette[i++] = (0x15) | (0x15 << 5) | (0x15 << 10); + systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10); + systemGbPalette[i++] = 0; + } + + VBAMovieInit(); +} + +VBA::~VBA() +{ + InterframeCleanup(); + + saveSettings(); +/* + if(moviePlaying) { + if(movieFile != NULL) { + fclose(movieFile); + movieFile = NULL; + } + moviePlaying = false; + movieLastJoypad = 0; + } +*/ + if(VBAMovieActive()) + VBAMovieStop(true); +/* + if(movieRecording) { + if(movieFile != NULL) { + // record the last joypad change so that the correct time can be + // recorded + fwrite(&movieFrame, 1, sizeof(int), movieFile); + fwrite(&movieLastJoypad, 1, sizeof(u32), movieFile); + fclose(movieFile); + movieFile = NULL; + } + movieRecording = false; + moviePlaying = false; + movieLastJoypad = 0; + } +*/ + if(aviRecorder) { + delete aviRecorder; + aviRecorder = NULL; + aviRecording = false; + } + + if(soundRecorder) { + delete soundRecorder; + soundRecorder = NULL; + } + soundRecording = false; + soundPause(); + soundShutdown(); + + if(gbRom != NULL || rom != NULL) { + if(autoSaveLoadCheatList) + ((MainWnd *)m_pMainWnd)->winSaveCheatListDefault(); + ((MainWnd *)m_pMainWnd)->writeBatteryFile(); + cheatSearchCleanup(&cheatSearchData); + emulator.emuCleanUp(); + + if(VBAMovieActive()) + VBAMovieStop(false); + } + + if(input) + delete input; + + shutdownDisplay(); + + if(skin) { + delete skin; + } + + if(rewindMemory) + free(rewindMemory); + + if(frameSearchMemory) + free(frameSearchMemory); +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only VBA object + +VBA theApp; +#include +///////////////////////////////////////////////////////////////////////////// +// VBA initialization + +// code from SDL_main.c for Windows +/* Parse a command line buffer into arguments */ +static int parseCommandLine(char *cmdline, char **argv) +{ + char *bufp; + int argc; + + argc = 0; + for ( bufp = cmdline; *bufp; ) { + /* Skip leading whitespace */ + while ( isspace(*bufp) ) { + ++bufp; + } + /* Skip over argument */ + if ( *bufp == '"' ) { + ++bufp; + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && (*bufp != '"') ) { + ++bufp; + } + } else { + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && ! isspace(*bufp) ) { + ++bufp; + } + } + if ( *bufp ) { + if ( argv ) { + *bufp = '\0'; + } + ++bufp; + } + } + if ( argv ) { + argv[argc] = NULL; + } + return(argc); +} + +static void CorrectPath (CString & path) +{ + CString tempStr; + FILE * tempFile; + + if(tempFile = fopen(path, "rb")) + { + fclose(tempFile); + } + else + { + for(int i = 0 ; i < 10 ; i++) + { + switch(i) + { + case 0: { + char curDir [_MAX_PATH]; + GetCurrentDirectory(_MAX_PATH, curDir); + curDir[_MAX_PATH-1] = '\0'; + tempStr = curDir; + } break; + case 1: tempStr = regQueryStringValue("romdir","."); break; + case 2: tempStr = regQueryStringValue("moviesdir","."); break; + case 3: tempStr = regQueryStringValue("batteryDir","."); break; + case 4: tempStr = regQueryStringValue("saveDir","."); break; + case 5: tempStr = regQueryStringValue("captureDir","."); break; + case 6: tempStr = regQueryStringValue("soundRecordDir","."); break; + case 7: tempStr = regQueryStringValue("aviRecordDir","."); break; + case 8: tempStr = "C:"; + case 9: { + tempStr = regQueryStringValue("romdir","."); + char * slash = (char*)strrchr(tempStr, '\\'); + if(slash) + slash[0] = '\0'; + } break; + } + tempStr += "\\"; + tempStr += path; + + if(tempFile = fopen(tempStr, "rb")) + { + fclose(tempFile); + path = tempStr; + break; + } + } + } +} + +static void CorrectPath (char * path) +{ + CString pathCStr = path; + CorrectPath(pathCStr); + strcpy(path, pathCStr); +} + + +void debugSystemScreenMessage1(const char *msg) +{ + systemScreenMessage(msg, 3, 60); +} +void debugSystemScreenMessage2(const char *msg) +{ + systemScreenMessage(msg, 4, 60); +} + + +BOOL VBA::InitInstance() +{ + AfxEnableControlContainer(); + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +//#ifdef _AFXDLL +// Enable3dControls(); // Call this when using MFC in a shared DLL +//#else +// Enable3dControlsStatic(); // Call this when linking to MFC statically +//#endif + + SetRegistryKey(_T("VBA")); + + remoteSetProtocol(0); + + systemVerbose = GetPrivateProfileInt("config", + "verbose", + 0, + "VBA.ini"); + + systemDebug = GetPrivateProfileInt("config", + "debug", + 0, + "VBA.ini"); + ddrawDebug = GetPrivateProfileInt("config", + "ddrawDebug", + 0, + "VBA.ini") ? true : false; + + wndClass = AfxRegisterWndClass(0, LoadCursor(IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), LoadIcon(IDI_ICON)); + + char winBuffer[2048]; + + GetModuleFileName(NULL, winBuffer, 2048); + char *p = strrchr(winBuffer, '\\'); + if(p) + *p = 0; + + regInit(winBuffer); + + loadSettings(); + + if(!initInput()) + return FALSE; + + if(!initDisplay()) { + if(videoOption >= VIDEO_320x240) { + regSetDwordValue("video", VIDEO_1X); + if(pVideoDriverGUID) + regSetDwordValue("defaultVideoDriver", TRUE); + } + return FALSE; + } + + hAccel = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR)); + + winAccelMgr.Connect((MainWnd *)m_pMainWnd); + + winAccelMgr.SetRegKey(HKEY_CURRENT_USER, "Software\\Emulators\\VisualBoyAdvance"); + + extern void winAccelAddCommands(CAcceleratorManager&); + + winAccelAddCommands(winAccelMgr); + + winAccelMgr.CreateDefaultTable(); + + winAccelMgr.Load(); + + winAccelMgr.UpdateWndTable(); + + winAccelMgr.UpdateMenu(menu); + + if (m_lpCmdLine[0]) + { + int argc = parseCommandLine(m_lpCmdLine, NULL); + char **argv = (char **)malloc((argc+1)*sizeof(char *)); + parseCommandLine(m_lpCmdLine, argv); + + + + bool gotFlag = false, enoughArgs = false; + for(int i = 0 ; i < argc ; i++) + { + if(argv[i][0] == '-' || gotFlag) + { + if(!gotFlag) + loadSettings(); + gotFlag = true; + if(_stricmp(argv[i], "-rom") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + szFile = argv[++i]; + CorrectPath(szFile); + filename = szFile; + } + else + if(_stricmp(argv[i], "-bios") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + biosFileName = argv[++i]; + CorrectPath(biosFileName); + extern void loadBIOS(); + loadBIOS(); + } + else + if(_stricmp(argv[i], "-frameskip") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + frameSkip = atoi(argv[++i]); + if(frameSkip < 0) frameSkip = 0; + if(frameSkip > 9) frameSkip = 9; + gbFrameSkip = frameSkip; + } + else + if(_stricmp(argv[i], "-throttle") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + throttle = atoi(argv[++i]); + if(throttle < 5) throttle = 5; + if(throttle > 1000) throttle = 1000; + } + else + if(_stricmp(argv[i], "-throttleKeepPitch") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + accuratePitchThrottle = atoi(argv[++i]) != 0; + } + else + if(_stricmp(argv[i], "-synchronize") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + synchronize = atoi(argv[++i]) != 0; + } + else + if(_stricmp(argv[i], "-hideborder") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + hideMovieBorder = atoi(argv[++i]) != 0; + } + else + if(_stricmp(argv[i], "-play") == 0) + { + playMovieFile = true; + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + strcpy(movieFileToPlay, argv[++i]); + CorrectPath(movieFileToPlay); + if(i+1 >= argc || argv[i+1][0] == '-') {--i; goto invalidArgument;} + playMovieFileReadOnly = atoi(argv[++i]) != 0; + } + else + if(_stricmp(argv[i], "-videoLog") == 0) + { + nvVideoLog = true; + nvAudioLog = true; + LoggingEnabled = 2; + if(i+1 >= argc || argv[i+1][0] == '-') {} + else NESVideoSetVideoCmd(argv[++i]); + } + else + if(_stricmp(argv[i], "-logDebug") == 0) + { + NESVideoEnableDebugging(debugSystemScreenMessage1,debugSystemScreenMessage2); + } + else + if(_stricmp(argv[i], "-logToFile") == 0) + { + NESVideoSetFileFuncs(fopen,fclose); + } + else + if(_stricmp(argv[i], "-outputWAV") == 0) + { + outputWavFile = true; + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + strcpy(wavFileToOutput, argv[++i]); + } + else + if(_stricmp(argv[i], "-outputAVI") == 0) + { + outputAVIFile = true; + } + else + if(_stricmp(argv[i], "-quitAfter") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + quitAfterTime = atoi(argv[++i]); + } + else + if(_stricmp(argv[i], "-pauseAt") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + pauseAfterTime = atoi(argv[++i]); + } + else + if(_stricmp(argv[i], "-videoScale") == 0) + { + if(i+1 >= argc || argv[i+1][0] == '-') goto invalidArgument; + int size = atoi(argv[++i]); + if(size < 1) size = 1; + if(size > 4) size = 4; + switch(size) + { + case 1: videoOption = VIDEO_1X; break; + case 2: videoOption = VIDEO_2X; break; + case 3: videoOption = VIDEO_3X; break; + case 4: videoOption = VIDEO_4X; break; + } + } + else + if(_stricmp(argv[i], "-hideMenu") == 0) + { + flagHideMenu = true; + } + else + { + enoughArgs = true; +invalidArgument: + char str [1024]; + strcpy(str, ""); + if(_stricmp(argv[i], "-h") != 0) + if(enoughArgs) + sprintf(str, "Invalid commandline argument %d: %s\n", i, argv[i]); + else + sprintf(str, "Not enough arguments for arg %d: %s\n", i, argv[i]); + strcat(str, "Valid commands:\n" + "-h \t\t\t displays this help\n" + "-rom filename \t\t opens the given ROM\n" + "-bios filename \t\t use the given GBA BIOS\n" + "-play filename val \t\t plays the given VBM movie (val: 1 = read-only, 0 = editable)\n" + "-outputWAV filename \t outputs WAV audio to the given file\n" + "-outputAVI \t\t outputs an AVI (you are prompted for location and codec)\n" + "-frameskip val \t\t sets the frameskip amount to the given value\n" + "-synchronize val \t\t limits running speed to sound playing speed, (0 = off, 1 = on)\n" + "-throttle val \t\t sets the throttle speed to the given percentage\n" + "-hideborder val \t\t hides SGB border, if any (0 = show, 1 = hide)\n" + "-throttleKeepPitch val \t if throttle and synch, don't change sound freq (0 = off, 1 = on)\n" + "-quitAfter val \t\t close program when frame counter == val\n" + "-pauseAt val \t\t pause (movie) once when frame counter == val\n" + "-videoScale val \t\t sets the video size (val = 1 for 1X, 2 for 2X, 3 for 3X, or 4 for 4X)\n" + "-hideMenu \t\t hides the menu until program exit\n" + "\n" + "-videoLog args \t does (nesvideos) video+audio logging with the given arguments\n" + "-logToFile \t tells logging to use fopen/fclose of args, if logging is enabled\n" + "-logDebug \t tells logging to output debug info to screen, if logging is enabled\n" + ); + theApp.winCheckFullscreen(); + AfxGetApp()->m_pMainWnd->MessageBox(str, "Commandline Help", MB_OK|MB_ICONINFORMATION); + exit(0); + } + } + else + { + // assume anything else is a ROM, for backward compatibility + szFile = argv[i++]; + filename = szFile; + loadSettings(); + } + } + int index = filename.ReverseFind('.'); + + if(index != -1) + filename = filename.Left(index); + + if(szFile.GetLength() > 0) + { + if(((MainWnd*)m_pMainWnd)->FileRun()) + emulating = true; + else + emulating = false; + } + free(argv); + } + + return TRUE; +} + +void VBA::adjustDestRect() +{ + POINT point; + RECT skinRect; + if(skin) + skinRect = skin->GetBlitRect(); + + point.x = 0; + point.y = 0; + + if(skin) { + point.x = skinRect.left; + point.y = skinRect.top; + } + + m_pMainWnd->ClientToScreen(&point); + dest.top = point.y; + dest.left = point.x; + + point.x = surfaceSizeX; + point.y = surfaceSizeY; + + if(skin) { + point.x = skinRect.right; + point.y = skinRect.bottom; + } + + m_pMainWnd->ClientToScreen(&point); + dest.bottom = point.y; + dest.right = point.x; + + // make sure that dest rect lies in the monitor + if(videoOption >= VIDEO_320x240) { + dest.top -= windowPositionY; + dest.left -= windowPositionX; + dest.bottom-= windowPositionY; + dest.right -= windowPositionX; + } + + if(skin) + return; + + int menuSkip = 0; + + if(videoOption >= VIDEO_320x240 && menuToggle) { + int m = GetSystemMetrics(SM_CYMENU); + menuSkip = m; + dest.bottom -=m; + } + + if(videoOption > VIDEO_4X) { + int top = (fsHeight - surfaceSizeY) / 2; + int left = (fsWidth - surfaceSizeX) / 2; + dest.top += top; + dest.bottom += top; + dest.left += left; + dest.right += left; + if(fullScreenStretch) { + dest.top = 0+menuSkip; + dest.left = 0; + dest.right = fsWidth; + dest.bottom = fsHeight; + } + } +} + +void VBA::updateIFB() +{ + if(systemColorDepth == 16) { + switch(ifbType) { + case 0: + default: + ifbFunction = NULL; + break; + case 1: + ifbFunction = MotionBlurIB; + break; + case 2: + ifbFunction = SmartIB; + break; + } + } else if(systemColorDepth == 32) { + switch(ifbType) { + case 0: + default: + ifbFunction = NULL; + break; + case 1: + ifbFunction = MotionBlurIB32; + break; + case 2: + ifbFunction = SmartIB32; + break; + } + } else + ifbFunction = NULL; +} + +void VBA::updateFilter() +{ + filterWidth = sizeX; + filterHeight = sizeY; + + if(systemColorDepth == 16 && (videoOption > VIDEO_1X && + videoOption != VIDEO_320x240)) { + switch(filterType) { + default: + case 0: + filterFunction = NULL; + break; + case 1: + filterFunction = ScanlinesTV; + break; + case 2: + filterFunction = _2xSaI; + break; + case 3: + filterFunction = Super2xSaI; + break; + case 4: + filterFunction = SuperEagle; + break; + case 5: + filterFunction = Pixelate; + break; + case 6: + filterFunction = MotionBlur; + break; + case 7: + filterFunction = AdMame2x; + break; + case 8: + filterFunction = Simple2x; + break; + case 9: + filterFunction = Bilinear; + break; + case 10: + filterFunction = BilinearPlus; + break; + case 11: + filterFunction = Scanlines; + break; + case 12: + filterFunction = hq2xS; + break; + case 13: + filterFunction = hq2x; + break; + case 14: + filterFunction = lq2x; + break; + case 15: + filterFunction = hq3xS; + break; + case 16: + filterFunction = hq3x; + break; + } + switch(filterType) + { + case 0: // normal -> 1x texture + rect.right = sizeX; + rect.bottom = sizeY; + break; + default: // other -> 2x texture + rect.right = sizeX*2; + rect.bottom = sizeY*2; + memset(delta,255,sizeof(delta)); + break; + case 15: // hq3x -> 3x texture + case 16: + rect.right = sizeX*3; + rect.bottom = sizeY*3; + memset(delta,255,sizeof(delta)); + break; + } + } else { + if(systemColorDepth == 32 && videoOption > VIDEO_1X && + videoOption != VIDEO_320x240) { + switch(filterType) { + default: + case 0: + filterFunction = NULL; + break; + case 1: + filterFunction = ScanlinesTV32; + break; + case 2: + filterFunction = _2xSaI32; + break; + case 3: + filterFunction = Super2xSaI32; + break; + case 4: + filterFunction = SuperEagle32; + break; + case 5: + filterFunction = Pixelate32; + break; + case 6: + filterFunction = MotionBlur32; + break; + case 7: + filterFunction = AdMame2x32; + break; + case 8: + filterFunction = Simple2x32; + break; + case 9: + filterFunction = Bilinear32; + break; + case 10: + filterFunction = BilinearPlus32; + break; + case 11: + filterFunction = Scanlines32; + break; + case 12: + filterFunction = hq2xS32; + break; + case 13: + filterFunction = hq2x32; + break; + case 14: + filterFunction = lq2x32; + break; + case 15: + filterFunction = hq3xS32; + break; + case 16: + filterFunction = hq3x32; + break; + } + switch(filterType) + { + case 0: // normal -> 1x texture + rect.right = sizeX; + rect.bottom = sizeY; + break; + default: // other -> 2x texture + rect.right = sizeX*2; + rect.bottom = sizeY*2; + memset(delta,255,sizeof(delta)); + break; + case 15: // hq3x -> 3x texture + case 16: + rect.right = sizeX*3; + rect.bottom = sizeY*3; + memset(delta,255,sizeof(delta)); + break; + } + } else + filterFunction = NULL; + } + + if(display) + display->changeRenderSize(rect.right, rect.bottom); +} + +void VBA::updateMenuBar() +{ + if(flagHideMenu) + return; + + if(menu != NULL) { + if(m_pMainWnd) + m_pMainWnd->SetMenu(NULL); + m_menu.Detach(); + DestroyMenu(menu); + } + + if(popup != NULL) { + // force popup recreation if language changed + DestroyMenu(popup); + popup = NULL; + } + + m_menu.Attach(winResLoadMenu(MAKEINTRESOURCE(IDR_MENU))); + menu = (HMENU)m_menu; + + // don't set a menu if skin is active + if(skin == NULL) + if(m_pMainWnd) + m_pMainWnd->SetMenu(&m_menu); +} + +void winlog(const char *msg, ...) +{ + CString buffer; + va_list valist; + + va_start(valist, msg); + buffer.FormatV(msg, valist); + + if(theApp.winout == NULL) { + theApp.winout = fopen("vba-trace.log","w"); + } + + fputs(buffer, theApp.winout); + + va_end(valist); +} + +void log(const char *msg, ...) +{ + CString buffer; + va_list valist; + + va_start(valist, msg); + buffer.FormatV(msg, valist); + + toolsLog(buffer); + + va_end(valist); +} + +bool systemReadJoypads() +{ + if(theApp.input) + return theApp.input->readDevices(); + return false; +} + +u32 systemReadJoypad(int which, bool sensor) +{ + if(theApp.input) + return theApp.input->readDevice(which,sensor); + return 0; +} + +extern bool vbaShuttingDown; +extern long linearSoundFrameCount; +long linearFrameCount = 0; + +void systemDrawScreen() +{ + if(vbaShuttingDown) + return; + + if(!theApp.painting) + { + linearFrameCount++; + if(!theApp.sound) + { + if(linearFrameCount > 10000) + linearFrameCount -= 10000; + linearSoundFrameCount = linearFrameCount; + } + } + else + { + static bool updatingFrameCount = false; + if(!updatingFrameCount) // recursion-preventing paranoia + { + updatingFrameCount = true; + VBAUpdateFrameCountDisplay(); + updatingFrameCount = false; + } + } + + + if(theApp.display == NULL) + return; + + theApp.renderedFrames++; + + if(theApp.updateCount) { + POSITION pos = theApp.updateList.GetHeadPosition(); + while(pos) { + IUpdateListener *up = theApp.updateList.GetNext(pos); + if(up) + up->update(); + } + } + + // "in-game" text rendering + if(textMethod == 0) + { + int copyX = 240, copyY = 160; + if(theApp.cartridgeType == 1) + if(gbBorderOn) copyX = 256, copyY = 224; + else copyX = 160, copyY = 144; + + DrawTextMessages((u8*)pix, copyX*(systemColorDepth/8)+(systemColorDepth==24?0:4), 0, copyY); + } + + + if(!theApp.painting) + { + int width = 240; + int height = 160; + switch(theApp.cartridgeType) + { + case 0: + width = 240; + height = 160; + break; + case 1: + if(gbBorderOn) { + width = 256; + height = 224; + } else { + width = 160; + height = 144; + } + break; + } + + linearFrameCount--; + do + { + linearFrameCount++; + + if(theApp.aviRecording) + { + if(theApp.aviRecorder == NULL) { + FILE * temp = fopen(theApp.aviRecordName, "wb"); + if(temp == NULL) + { + theApp.aviRecording = false; + systemMessage(0,"AVI recording failed: file is read-only or already in use."); + } + else + { + fclose(temp); + + theApp.aviRecorder = new AVIWrite(); + theApp.aviFrameNumber = 0; + + theApp.aviRecorder->SetFPS(60); + + BITMAPINFOHEADER bi; + memset(&bi, 0, sizeof(bi)); + bi.biSize = 0x28; + bi.biPlanes = 1; + bi.biBitCount = 24; + bi.biWidth = width; + bi.biHeight = height; + bi.biSizeImage = 3*width*height; + theApp.aviRecorder->SetVideoFormat(&bi); + theApp.aviRecorder->Open(theApp.aviRecordName); + } + } + + if(theApp.aviRecorder != NULL) { + assert(width <= BMP_BUFFER_MAX_WIDTH && height <= BMP_BUFFER_MAX_HEIGHT && systemColorDepth <= BMP_BUFFER_MAX_DEPTH*8); + utilWriteBMP(bmpBuffer, width, height, systemColorDepth, pix); + theApp.aviRecorder->AddFrame(theApp.aviFrameNumber++, bmpBuffer); + } + } + + if(theApp.nvVideoLog) + { + // convert from whatever bit depth to 16-bit, while stripping away extra pixels + assert(width <= BMP_BUFFER_MAX_WIDTH && height <= BMP_BUFFER_MAX_HEIGHT && 16 <= BMP_BUFFER_MAX_DEPTH*8); + utilWriteBMP(bmpBuffer, width, -height, 16, pix); + NESVideoLoggingVideo((u8 *)bmpBuffer, width, height, 0x1000000 * 60); + } + } + while(linearFrameCount < linearSoundFrameCount); // compensate for frames lost due to frame skip being nonzero, etc. + } + + + if(theApp.ifbFunction) { + if(systemColorDepth == 16) + theApp.ifbFunction(pix+theApp.filterWidth*2+4, theApp.filterWidth*2+4, + theApp.filterWidth, theApp.filterHeight); + else + theApp.ifbFunction(pix+theApp.filterWidth*4+4, theApp.filterWidth*4+4, + theApp.filterWidth, theApp.filterHeight); + } + + theApp.display->render(); +} + +void systemScreenCapture(int captureNumber) +{ + if(theApp.m_pMainWnd) + ((MainWnd *)theApp.m_pMainWnd)->screenCapture(captureNumber); +} + +u32 systemGetClock() +{ + return timeGetTime(); +} + +void systemMessage(int number, const char *defaultMsg, ...) +{ + CString buffer; + va_list valist; + CString msg = defaultMsg; + if(number) + msg = winResLoadString(number); + + va_start(valist, defaultMsg); + buffer.FormatV(msg, valist); + + theApp.winCheckFullscreen(); + + AfxGetApp()->m_pMainWnd->MessageBox(buffer, winResLoadString(IDS_ERROR), MB_OK|MB_ICONERROR); + + va_end(valist); +} + +void systemSetTitle(const char *title) +{ + if(theApp.m_pMainWnd != NULL) { + AfxGetApp()->m_pMainWnd->SetWindowText(title); + } +} + +void systemShowSpeed(int speed) +{ + systemSpeed = speed; + theApp.showRenderedFrames = theApp.renderedFrames; + theApp.renderedFrames = 0; + if(theApp.videoOption <= VIDEO_4X && theApp.showSpeed) { + CString buffer; + if(theApp.showSpeed == 1) + buffer.Format("VisualBoyAdvance-%3d%%", systemSpeed); + else + buffer.Format("VisualBoyAdvance-%3d%%(%d, %d fps)", systemSpeed, + systemFrameSkip, + theApp.showRenderedFrames); + + systemSetTitle(buffer); + } +} + +void systemFrame(int rate) +{ + if(quitAfterTime >= 0 && theApp.globalFrameCount == quitAfterTime) + { + VBAMovieStop(true); + AfxPostQuitMessage(0); + } + + theApp.globalFrameCount++; + + + u32 time = systemGetClock(); + + // change the sound speed, or set it to normal - must always do this or it won't get reset after a change, but that's OK because it's inexpensive + if(theApp.sound) + theApp.sound->setSpeed(theApp.throttle != 100 && !speedup && !theApp.winPauseNextFrame && synchronize && !theApp.accuratePitchThrottle && !theApp.useOldSync ? (float)theApp.throttle / 100.0f : 1.0f); + +// bool deadSound = !theApp.sound->isPlaying(); + + // if a throttle speed is set and we're not allowed to change the sound frequency to achieve it, + // sleep for a certain amount each time we get here to approximate the necessary slowdown + if(((theApp.accuratePitchThrottle || !theApp.sound || !synchronize) + && (theApp.throttle != 100 || !synchronize)) + || theApp.throttle < 6 && !theApp.winPauseNextFrame) + { + /// FIXME: this is still a horrible way of achieving a certain frame time + /// (look at what Snes9x does - it's complicated but much much better) + + static float sleepAmt = 0.0f; // variable to smooth out the sleeping amount so it doesn't oscillate so fast +// if(!theApp.wasPaused) { + if(!speedup) { + u32 diff = time - theApp.throttleLastTime; + if(theApp.wasPaused) + diff = 0; + + int target = (100000/(rate*theApp.throttle)); + int d = (target - diff); + + sleepAmt = 0.8f * sleepAmt + 0.2f * (float)d; + if(d - sleepAmt <= 1.5f && d - sleepAmt >= -1.5f) + d = (int)(sleepAmt); + + if(d > 0) { + Sleep(d); + } + } + theApp.throttleLastTime = systemGetClock(); + //} + //else + //{ + // Sleep(100); + //} + } + + if(theApp.globalFrameCount % 10 == 0) + { + if(theApp.rewindMemory) { + if(++theApp.rewindCounter >= (theApp.rewindTimer)) { + theApp.rewindSaveNeeded = true; + theApp.rewindCounter = 0; + } + } + if(systemSaveUpdateCounter) { + if(--systemSaveUpdateCounter <= SYSTEM_SAVE_NOT_UPDATED) { + ((MainWnd *)theApp.m_pMainWnd)->writeBatteryFile(); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + } + } + } + + theApp.wasPaused = false; +/// theApp.autoFrameSkipLastTime = time; +} + + +void systemScreenMessage(const char *msg, int slot, int duration, const char *colorList) +{ + if(slot < 0 || slot > SCREEN_MESSAGE_SLOTS) + return; + + if(slot == 0 && (theApp.paused || (theApp.frameSearching))) + theApp.m_pMainWnd->PostMessage(WM_PAINT, NULL, NULL); // update the display when a main-slot message appears while the game is paused + + + theApp.screenMessage[slot] = true; + theApp.screenMessageTime[slot] = GetTickCount(); + theApp.screenMessageDuration[slot] = duration; + theApp.screenMessageBuffer[slot] = msg; + theApp.screenMessageColorBuffer[slot] = colorList ? colorList : ""; + + if(theApp.screenMessageBuffer[slot].GetLength() > 40) + theApp.screenMessageBuffer[slot] = theApp.screenMessageBuffer[slot].Left(40); +} + +int systemGetSensorX() +{ + return theApp.sensorX; +} + +int systemGetSensorY() +{ + return theApp.sensorY; +} + +bool systemSoundInit() +{ + if(theApp.sound) + delete theApp.sound; + + theApp.sound = newDirectSound(); + return theApp.sound->init(); +} + + +void systemSoundShutdown() +{ + if(theApp.sound) + delete theApp.sound; + theApp.sound = NULL; +} + +void systemSoundPause() +{ + if(theApp.sound) + theApp.sound->pause(); +} + +void systemSoundReset() +{ + if(theApp.sound) + theApp.sound->reset(); +} + +void systemSoundResume() +{ + if(theApp.sound) + theApp.sound->resume(); +} + +void systemWriteDataToSoundBuffer() +{ + if(theApp.sound) + theApp.sound->write(); +} + +bool systemCanChangeSoundQuality() +{ + return true; +} + +bool systemPauseOnFrame() +{ + if(theApp.winPauseNextFrame) { + theApp.paused = true; + theApp.winPauseNextFrame = false; + return true; + } + return false; +} + +void systemGbBorderOn() +{ + if(emulating && theApp.cartridgeType == 1 && gbBorderOn) { + theApp.updateWindowSize(theApp.videoOption); + } +} + +#include "assert.h" + +void VBA::saveRewindStateIfNecessary () +{ + if(rewindSaveNeeded && rewindMemory && emulator.emuWriteMemState) { + rewindCount++; + if(rewindCount > rewindSlots) + rewindCount = rewindSlots; + assert(rewindPos >= 0 && rewindPos < rewindSlots); + if(emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], REWIND_SIZE)) { + rewindPos = ++rewindPos % rewindSlots; + assert(rewindPos >= 0 && rewindPos < rewindSlots); + if(rewindCount == rewindSlots) + rewindTopPos = ++rewindTopPos % rewindSlots; + } + } + + // also update/cache some frame search stuff + if(theApp.frameSearching) + { + extern SMovie Movie; + int curFrame = (Movie.state == MOVIE_STATE_NONE) ? theApp.globalFrameCount : Movie.currentFrame; + int endFrame = theApp.frameSearchStart + theApp.frameSearchLength; + theApp.frameSearchSkipping = (curFrame < endFrame); + theApp.frameSearchFirstStep = false; + + if(curFrame == endFrame) + { + // cache intermediate state to speed up searching forward + theApp.emulator.emuWriteMemState(&theApp.frameSearchMemory[REWIND_SIZE*1], REWIND_SIZE); + } + + if(curFrame == endFrame + 1) + { + theApp.emulator.emuWriteMemState(&theApp.frameSearchMemory[REWIND_SIZE*2], REWIND_SIZE); + theApp.frameSearchLoadValid = true; + } + } + else + { + theApp.frameSearchFirstStep = false; + + assert(!theApp.frameSearchSkipping); + // just in case + theApp.frameSearchSkipping = false; + } + +} + + + +BOOL VBA::OnIdle(LONG lCount) +{ + if(emulating && debugger) { + MSG msg; + remoteStubMain(); + if(debugger) + return TRUE; // continue loop + return !::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE); + } else if(emulating && active && !paused) { +/// for(int i = 0; i < 2; i++) + { + emulator.emuMain(emulator.emuCount); + + // save the state for rewinding, if necessary + saveRewindStateIfNecessary(); + + rewindSaveNeeded = false; + } + + if(mouseCounter) { + if(--mouseCounter == 0) { + SetCursor(NULL); + } + } + return TRUE; + } + + return FALSE; + + // return CWinApp::OnIdle(lCount); +} + +void VBA::addRecentFile(CString file) +{ + // Do not change recent list if frozen + if(recentFreeze) + return; + int i = 0; + for(i = 0; i < 10; i++) { + if(recentFiles[i].GetLength() == 0) + break; + + if(recentFiles[i].Compare(file) == 0) { + if(i == 0) + return; + CString p = recentFiles[i]; + for(int j = i; j > 0; j--) { + recentFiles[j] = recentFiles[j-1]; + } + recentFiles[0] = p; + return; + } + } + int num = 0; + for(i = 0; i < 10; i++) { + if(recentFiles[i].GetLength() != 0) + num++; + } + if(num == 10) { + num--; + } + + for(i = num; i >= 1; i--) { + recentFiles[i] = recentFiles[i-1]; + } + recentFiles[0] = file; +} + +void VBA::loadSettings() +{ + CString buffer; + + languageOption = regQueryDwordValue("language", 1); + if(languageOption < 0 || languageOption > 2) + languageOption = 1; + + buffer = regQueryStringValue("languageName", ""); + if(!buffer.IsEmpty()) { + languageName = buffer.Left(3); + } else + languageName = ""; + + winSetLanguageOption(languageOption, true); + + frameSkip = regQueryDwordValue("frameSkip", /*2*/ 0); + if(frameSkip < 0 || frameSkip > 9) + frameSkip = 1; + + gbFrameSkip = regQueryDwordValue("gbFrameSkip", 0); + if(gbFrameSkip < 0 || gbFrameSkip > 9) + gbFrameSkip = 0; + +/// autoFrameSkip = regQueryDwordValue("autoFrameSkip", FALSE) ? TRUE : FALSE; + accuratePitchThrottle = regQueryDwordValue("accuratePitchThrottle", FALSE) ? TRUE : FALSE; + + vsync = regQueryDwordValue("vsync", false) ? true : false ; + synchronize = regQueryDwordValue("synchronize", 1) ? true : false; + fullScreenStretch = regQueryDwordValue("stretch", 0) ? true : false; + + videoOption = regQueryDwordValue("video", 0); + + if(videoOption < 0 || videoOption > VIDEO_OTHER) + videoOption = 0; + + bool defaultVideoDriver = regQueryDwordValue("defaultVideoDriver", true) ? + true : false; + + if(!regQueryBinaryValue("videoDriverGUID", (char *)&videoDriverGUID, + sizeof(GUID))) { + defaultVideoDriver = TRUE; + } + + if(defaultVideoDriver) + pVideoDriverGUID = NULL; + else + pVideoDriverGUID = &videoDriverGUID; + + fsWidth = regQueryDwordValue("fsWidth", 0); + fsHeight = regQueryDwordValue("fsHeight", 0); + fsColorDepth = regQueryDwordValue("fsColorDepth", 0); + + if(videoOption == VIDEO_OTHER) { + if(fsWidth < 0 || fsWidth > 4095 || fsHeight < 0 || fsHeight > 4095) + videoOption = 0; + if(fsColorDepth != 16 && fsColorDepth != 24 && fsColorDepth != 32) + videoOption = 0; + } + + renderMethod = (DISPLAY_TYPE)regQueryDwordValue("renderMethod", DIRECT_DRAW); + + if(renderMethod < GDI || renderMethod > OPENGL) + renderMethod = DIRECT_DRAW; + + windowPositionX = regQueryDwordValue("windowX", 0); + if(windowPositionX < 0) + windowPositionX = 0; + windowPositionY = regQueryDwordValue("windowY", 0); + if(windowPositionY < 0) + windowPositionY = 0; + + useBiosFile = regQueryDwordValue("useBios", 0) ? true: false; + + skipBiosFile = regQueryDwordValue("skipBios", 0) ? true : false; + + memLagEnabled = regQueryDwordValue("memLagEnabled", false) ? true: false; + memLagTempEnabled = memLagEnabled; + + useOldGBTiming = regQueryDwordValue("useOldGBTiming", false) ? true: false; + + allowLeftRight = regQueryDwordValue("allowLeftRight", false) ? true: false; + + buffer = regQueryStringValue("biosFile", ""); + + if(!buffer.IsEmpty()) { + biosFileName = buffer; + } + + int res = regQueryDwordValue("soundEnable", 0x30f); + + soundEnable(res); + soundDisable(~res); + + soundOffFlag = (regQueryDwordValue("soundOff", 0)) ? true : false; + + soundQuality = regQueryDwordValue("soundQuality", 2); + + soundEcho = regQueryDwordValue("soundEcho", 0) ? true : false; + + soundLowPass = regQueryDwordValue("soundLowPass", 0) ? true : false; + + soundReverse = regQueryDwordValue("soundReverse", 0) ? true : false; + + soundVolume = regQueryDwordValue("soundVolume", 0); + if(soundVolume < 0 || soundVolume > 5) + soundVolume = 0; + + ddrawEmulationOnly = regQueryDwordValue("ddrawEmulationOnly", false) ? true : false; + ddrawUseVideoMemory = regQueryDwordValue("ddrawUseVideoMemory", false) ? true : false; + tripleBuffering = regQueryDwordValue("tripleBuffering", true) ? true : false; + + d3dFilter = regQueryDwordValue("d3dFilter", 0); + if(d3dFilter < 0 || d3dFilter > 1) + d3dFilter = 0; + glFilter = regQueryDwordValue("glFilter", 0); + if(glFilter < 0 || glFilter > 1) + glFilter = 0; + glType = regQueryDwordValue("glType", 0); + if(glType < 0 || glType > 1) + glType = 0; + + filterType = regQueryDwordValue("filter", 0); + if(filterType < 0 || filterType > 16) + filterType = 0; + + disableMMX = regQueryDwordValue("disableMMX", 0) ? true: false; + + disableStatusMessage = regQueryDwordValue("disableStatus", 0) ? true : false; + + showSpeed = regQueryDwordValue("showSpeed", 1); + if(showSpeed < 0 || showSpeed > 2) + showSpeed = 1; + + showSpeedTransparent = regQueryDwordValue("showSpeedTransparent", TRUE) ? + TRUE : FALSE; + + winGbPrinterEnabled = regQueryDwordValue("gbPrinter", false) ? true : false; + + if(winGbPrinterEnabled) + gbSerialFunction = gbPrinterSend; + else + gbSerialFunction = NULL; + + pauseWhenInactive = regQueryDwordValue("pauseWhenInactive", 1) ? + true : false; + + frameCounter = regQueryDwordValue("frameCounter", false) ? true : false; + inputDisplay = regQueryDwordValue("inputDisplay", false) ? true : false; + movieReadOnly = regQueryDwordValue("movieReadOnly", false) ? true : false; + + useOldSync = regQueryDwordValue("useOldSync", 0) ? TRUE : FALSE; + + muteFrameAdvance = regQueryDwordValue("muteFrameAdvance", 0) ? TRUE : FALSE; + + captureFormat = regQueryDwordValue("captureFormat", 0); + + removeIntros = regQueryDwordValue("removeIntros", false) ? true : false; + + recentFreeze = regQueryDwordValue("recentFreeze", false) ? true : false; + + autoIPS = regQueryDwordValue("autoIPS", true) ? true : false; + + cpuDisableSfx = regQueryDwordValue("disableSfx", 0) ? true : false; + + winSaveType = regQueryDwordValue("saveType", 0); + if(winSaveType < 0 || winSaveType > 5) + winSaveType = 0; + + cpuEnhancedDetection = regQueryDwordValue("enhancedDetection", 1) ? true : + false; + + ifbType = regQueryDwordValue("ifbType", 0); + if(ifbType < 0 || ifbType > 2) + ifbType = 0; + + winFlashSize = regQueryDwordValue("flashSize", 0x10000); + if(winFlashSize != 0x10000 && winFlashSize != 0x20000) + winFlashSize = 0x10000; + + agbPrintEnable(regQueryDwordValue("agbPrint", 0) ? true : false); + + winRtcEnable = regQueryDwordValue("rtcEnabled", 0) ? true : false; + rtcEnable(winRtcEnable); + + autoHideMenu = regQueryDwordValue("autoHideMenu", 0) ? true : false; + + skinEnabled = regQueryDwordValue("skinEnabled", 0) ? true : false; + + skinName = regQueryStringValue("skinName", ""); + + switch(videoOption) { + case VIDEO_320x240: + fsWidth = 320; + fsHeight = 240; + fsColorDepth = 16; + break; + case VIDEO_640x480: + fsWidth = 640; + fsHeight = 480; + fsColorDepth = 16; + break; + case VIDEO_800x600: + fsWidth = 800; + fsHeight = 600; + fsColorDepth = 16; + break; + } + + winGbBorderOn = regQueryDwordValue("borderOn", 0); + gbBorderAutomatic = regQueryDwordValue("borderAutomatic", 0); + gbEmulatorType = regQueryDwordValue("emulatorType", 0); + if(gbEmulatorType < 0 || gbEmulatorType > 5) + gbEmulatorType = 1; + gbColorOption = regQueryDwordValue("colorOption", 0); + + outlinedText = regQueryDwordValue("outlinedText", TRUE) != 0; + transparentText = regQueryDwordValue("transparentText", FALSE) != 0; + textColor = regQueryDwordValue("textColor", 0); + textMethod = regQueryDwordValue("textMethod", 1); + + threadPriority = regQueryDwordValue("priority", 2); + + if(threadPriority < 0 || threadPriority >3) + threadPriority = 2; + updatePriority(); + + autoSaveLoadCheatList = regQueryDwordValue("autoSaveCheatList", 0) ? true : false; + + pauseDuringCheatSearch = regQueryDwordValue("pauseDuringCheatSearch", 1) ? true : false; + + gbPaletteOption = regQueryDwordValue("gbPaletteOption", 0); + if(gbPaletteOption < 0) + gbPaletteOption = 0; + if(gbPaletteOption > 2) + gbPaletteOption = 2; + + regQueryBinaryValue("gbPalette", (char *)systemGbPalette, 24*sizeof(u16)); + + rewindTimer = regQueryDwordValue("rewindTimer", 0); + rewindSlots = regQueryDwordValue("rewindSlots", 64); + + if(rewindTimer < 0 || rewindTimer > 600) + rewindTimer = 0; + + if(rewindSlots <= 0) + rewindTimer = rewindSlots = 0; + if(rewindSlots > MAX_REWIND_SLOTS) + rewindSlots = MAX_REWIND_SLOTS; + + if(rewindTimer != 0) + { + if(rewindMemory == NULL) + rewindMemory = (char *)malloc(rewindSlots*REWIND_SIZE); + } + + if(frameSearchMemory == NULL) + frameSearchMemory = (char *)malloc(3*REWIND_SIZE); + + for(int i = 0; i < 10; i++) { + buffer.Format("recent%d", i); + char *s = regQueryStringValue(buffer, NULL); + if(s == NULL) + break; + recentFiles[i] = s; + } + + joypadDefault = regQueryDwordValue("joypadDefault", 0); + if(joypadDefault < 0 || joypadDefault > 3) + joypadDefault = 0; + + autoLoadMostRecent = regQueryDwordValue("autoLoadMostRecent", false) ? true : + false; + + loadMakesRecent = regQueryDwordValue("loadMakesRecent", false) ? true : false; + + loadMakesCurrent = regQueryDwordValue("loadMakesCurrent", false) ? true : false; + saveMakesCurrent = regQueryDwordValue("saveMakesCurrent", false) ? true : false; + currentSlot = regQueryDwordValue("currentSlot", 0); + + cheatsEnabled = regQueryDwordValue("cheatsEnabled", true) ? true : false; + + fsMaxScale = regQueryDwordValue("fsMaxScale", 0); + + throttle = regQueryDwordValue("throttle", 0); + if(throttle < 5 || throttle > 1000) + throttle = 100; +} + +void VBA::updateFrameSkip() +{ + switch(cartridgeType) { + case 0: + systemFrameSkip = frameSkip; + break; + case 1: + systemFrameSkip = gbFrameSkip; + break; + } +} + +void VBA::updateVideoSize(UINT id) +{ + int value = 0; + + switch(id) { + case ID_OPTIONS_VIDEO_X1: + value = VIDEO_1X; + break; + case ID_OPTIONS_VIDEO_X2: + value = VIDEO_2X; + break; + case ID_OPTIONS_VIDEO_X3: + value = VIDEO_3X; + break; + case ID_OPTIONS_VIDEO_X4: + value = VIDEO_4X; + break; + case ID_OPTIONS_VIDEO_FULLSCREEN320X240: + value = VIDEO_320x240; + fsWidth = 320; + fsHeight = 240; + fsColorDepth = 16; + break; + case ID_OPTIONS_VIDEO_FULLSCREEN640X480: + value = VIDEO_640x480; + fsWidth = 640; + fsHeight = 480; + fsColorDepth = 16; + break; + case ID_OPTIONS_VIDEO_FULLSCREEN800X600: + value = VIDEO_800x600; + fsWidth = 800; + fsHeight = 600; + fsColorDepth = 16; + break; + case ID_OPTIONS_VIDEO_FULLSCREEN: + value = VIDEO_OTHER; + break; + } + + if(videoOption == value && value != VIDEO_OTHER) + return; + + updateWindowSize(value); +} + +typedef BOOL (WINAPI *GETMENUBARINFO)(HWND, LONG, LONG, PMENUBARINFO); + +static void winCheckMenuBarInfo(int& winSizeX, int& winSizeY) +{ + HINSTANCE hinstDll; + DWORD dwVersion = 0; + + hinstDll = /**/AfxLoadLibrary("USER32.DLL"); + + if(hinstDll) { + GETMENUBARINFO func = (GETMENUBARINFO)GetProcAddress(hinstDll, + "GetMenuBarInfo"); + + if(func) { + MENUBARINFO info; + info.cbSize = sizeof(info); + + func(AfxGetMainWnd()->GetSafeHwnd(), OBJID_MENU, 0, &info); + + int menuHeight = GetSystemMetrics(SM_CYMENU); + + if((info.rcBar.bottom - info.rcBar.top) > menuHeight) { + winSizeY += (info.rcBar.bottom - info.rcBar.top) - menuHeight + 1; + theApp.m_pMainWnd->SetWindowPos( + 0, //HWND_TOPMOST, + theApp.windowPositionX, + theApp.windowPositionY, + winSizeX, + winSizeY, + SWP_NOMOVE | SWP_SHOWWINDOW); + } + } + /**/AfxFreeLibrary(hinstDll); + } +} + +void VBA::updateWindowSize(int value) +{ + regSetDwordValue("video", value); + + if(value == VIDEO_OTHER) { + regSetDwordValue("fsWidth", fsWidth); + regSetDwordValue("fsHeight", fsHeight); + regSetDwordValue("fsColorDepth", fsColorDepth); + } + + if(((value >= VIDEO_320x240) && + (videoOption != value)) || + (videoOption >= VIDEO_320x240 && + value <= VIDEO_4X) || + fsForceChange) { + fsForceChange = false; + changingVideoSize = true; + shutdownDisplay(); + if(input) { + delete input; + input = NULL; + } + m_pMainWnd->DragAcceptFiles(FALSE); + CWnd *pWnd = m_pMainWnd; + m_pMainWnd = NULL; + pWnd->DestroyWindow(); + delete pWnd; + videoOption = value; + if(!initDisplay()) { + if(videoOption == VIDEO_320x240 || + videoOption == VIDEO_640x480 || + videoOption == VIDEO_800x600 || + videoOption == VIDEO_OTHER) { + regSetDwordValue("video", VIDEO_1X); + if(pVideoDriverGUID) + regSetDwordValue("defaultVideoDriver", TRUE); + } + changingVideoSize = false; + AfxPostQuitMessage(0); + return; + } + if(!initInput()) { + changingVideoSize = false; + AfxPostQuitMessage(0); + return; + } + input->checkKeys(); + updateMenuBar(); + changingVideoSize = FALSE; + updateWindowSize(videoOption); + return; + } + + sizeX = 240; + sizeY = 160; + + videoOption = value; + + if(cartridgeType == 1) { + if(gbBorderOn) { + sizeX = 256; + sizeY = 224; + gbBorderLineSkip = 256; + gbBorderColumnSkip = 48; + gbBorderRowSkip = 40; + } else { + sizeX = 160; + sizeY = 144; + gbBorderLineSkip = 160; + gbBorderColumnSkip = 0; + gbBorderRowSkip = 0; + } + } + + surfaceSizeX = sizeX; + surfaceSizeY = sizeY; + + switch(videoOption) { + case VIDEO_1X: + surfaceSizeX = sizeX; + surfaceSizeY = sizeY; + break; + case VIDEO_2X: + surfaceSizeX = sizeX * 2; + surfaceSizeY = sizeY * 2; + break; + case VIDEO_3X: + surfaceSizeX = sizeX * 3; + surfaceSizeY = sizeY * 3; + break; + case VIDEO_4X: + surfaceSizeX = sizeX * 4; + surfaceSizeY = sizeY * 4; + break; + case VIDEO_320x240: + case VIDEO_640x480: + case VIDEO_800x600: + case VIDEO_OTHER: + { + int scaleX = 1; + int scaleY = 1; + scaleX = (fsWidth / sizeX); + scaleY = (fsHeight / sizeY); + int min = scaleX < scaleY ? scaleX : scaleY; + if(fsMaxScale) + min = min > fsMaxScale ? fsMaxScale : min; + surfaceSizeX = min * sizeX; + surfaceSizeY = min * sizeY; + if((fullScreenStretch && (display != NULL && + (display->getType() != DIRECT_3D))) + || (display != NULL && display->getType() >= DIRECT_3D)) { + surfaceSizeX = fsWidth; + surfaceSizeY = fsHeight; + } + } + break; + } + + rect.right = sizeX; + rect.bottom = sizeY; + + int winSizeX = sizeX; + int winSizeY = sizeY; + + if(videoOption <= VIDEO_4X) { + dest.left = 0; + dest.top = 0; + dest.right = surfaceSizeX; + dest.bottom = surfaceSizeY; + + DWORD style = WS_POPUP | WS_VISIBLE; + + style |= WS_OVERLAPPEDWINDOW; + + menuToggle = TRUE; + AdjustWindowRectEx(&dest, style, flagHideMenu ? FALSE : TRUE, 0); //WS_EX_TOPMOST); + + winSizeX = dest.right-dest.left; + winSizeY = dest.bottom-dest.top; + + if(skin == NULL) { + m_pMainWnd->SetWindowPos(0, //HWND_TOPMOST, + windowPositionX, + windowPositionY, + winSizeX, + winSizeY, + SWP_NOMOVE | SWP_SHOWWINDOW); + + winCheckMenuBarInfo(winSizeX, winSizeY); + } + } + + adjustDestRect(); + + updateIFB(); + updateFilter(); + + m_pMainWnd->RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); +} + +bool VBA::initDisplay() +{ + return updateRenderMethod(false); +} + +bool VBA::updateRenderMethod(bool force) +{ + bool res = updateRenderMethod0(force); + + while(!res && renderMethod > 0) { + if(renderMethod == OPENGL) + renderMethod = DIRECT_3D; + else if(renderMethod == DIRECT_3D) + renderMethod = DIRECT_DRAW; + else if(renderMethod == DIRECT_DRAW) { + if(videoOption > VIDEO_4X) { + videoOption = VIDEO_2X; + force = true; + } else + renderMethod = GDI; + } + + res = updateRenderMethod(force); + } + return res; +} + +bool VBA::updateRenderMethod0(bool force) +{ + bool initInput = false; + + if(display) { + if(display->getType() != renderMethod || force) { + if(skin) { + delete skin; + skin = NULL; + } + initInput = true; + changingVideoSize = true; + shutdownDisplay(); + if(input) { + delete input; + input = NULL; + } + CWnd *pWnd = m_pMainWnd; + + m_pMainWnd = NULL; + pWnd->DragAcceptFiles(FALSE); + pWnd->DestroyWindow(); + delete pWnd; + + display = NULL; + regSetDwordValue("renderMethod", renderMethod); + } + } + if(display == NULL) { + switch(renderMethod) { + case GDI: + display = newGDIDisplay(); + break; + case DIRECT_DRAW: + display = newDirectDrawDisplay(); + break; + case DIRECT_3D: + display = newDirect3DDisplay(); + break; + case OPENGL: + display = newOpenGLDisplay(); + break; + } + + if(display->initialize()) { + winUpdateSkin(); + if(initInput) { + if(!this->initInput()) { + changingVideoSize = false; + AfxPostQuitMessage(0); + return false; + } + input->checkKeys(); + updateMenuBar(); + changingVideoSize = false; + updateWindowSize(videoOption); + + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->UpdateWindow(); + m_pMainWnd->SetFocus(); + + return true; + } else { + changingVideoSize = false; + return true; + } + } + changingVideoSize = false; + } + return true; +} + +void VBA::winCheckFullscreen() +{ + if(videoOption > VIDEO_4X && tripleBuffering) { + if(display) + display->checkFullScreen(); + } +} + +void VBA::shutdownDisplay() +{ + if(display != NULL) { + display->cleanup(); + delete display; + display = NULL; + } +} + +void VBA::directXMessage(const char *msg) +{ + systemMessage(IDS_DIRECTX_7_REQUIRED, + "DirectX 7.0 or greater is required to run.\nDownload at http://www.microsoft.com/directx.\n\nError found at: %s", + msg); +} + +void VBA::winUpdateSkin() +{ + skinButtons = 0; + if(skin) { + delete skin; + skin = NULL; + } + + if(!skinName.IsEmpty() && skinEnabled && display->isSkinSupported()) { + skin = new CSkin(); + if(skin->Initialize(skinName)) { + skin->Hook(m_pMainWnd); + skin->Enable(true); + } else { + delete skin; + skin = NULL; + } + } + + if(!skin) { + adjustDestRect(); + updateMenuBar(); + } +} + +void VBA::updatePriority() +{ + switch(threadPriority) { + case 0: + SetThreadPriority(THREAD_PRIORITY_HIGHEST); + break; + case 1: + SetThreadPriority(THREAD_PRIORITY_ABOVE_NORMAL); + break; + case 3: + SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); + break; + default: + SetThreadPriority(THREAD_PRIORITY_NORMAL); + } +} + +#ifdef MMX +bool VBA::detectMMX() +{ + bool support = false; + char brand[13]; + + // check for Intel chip + __try { + __asm { + mov eax, 0; + cpuid; + mov [dword ptr brand+0], ebx; + mov [dword ptr brand+4], edx; + mov [dword ptr brand+8], ecx; + } + } + __except(EXCEPTION_EXECUTE_HANDLER) { + if(_exception_code() == STATUS_ILLEGAL_INSTRUCTION) { + return false; + } + return false; + } + // Check for Intel or AMD CPUs + if(strncmp(brand, "GenuineIntel", 12)) { + if(strncmp(brand, "AuthenticAMD", 12)) { + return false; + } + } + + __asm { + mov eax, 1; + cpuid; + test edx, 00800000h; + jz NotFound; + mov [support], 1; + NotFound: + } + return support; +} +#endif + +void VBA::winSetLanguageOption(int option, bool force) +{ + if(((option == languageOption) && option != 2) && !force) + return; + switch(option) { + case 0: + { + char lbuffer[10]; + + if(GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, + lbuffer, 10)) { + HINSTANCE l = winLoadLanguage(lbuffer); + if(l == NULL) { + LCID locIdBase = MAKELCID( MAKELANGID( PRIMARYLANGID( GetSystemDefaultLangID() ), SUBLANG_NEUTRAL ), SORT_DEFAULT ); + if(GetLocaleInfo(locIdBase, LOCALE_SABBREVLANGNAME, + lbuffer, 10)) { + l = winLoadLanguage(lbuffer); + if(l == NULL) { + systemMessage(IDS_FAILED_TO_LOAD_LIBRARY, + "Failed to load library %s", + lbuffer); + return; + } + } + } + AfxSetResourceHandle(l); + if(languageModule != NULL) + /**/AfxFreeLibrary(languageModule); + languageModule = l; + } else { + systemMessage(IDS_FAILED_TO_GET_LOCINFO, + "Failed to get locale information"); + return; + } + } + break; + case 1: + if(languageModule != NULL) + /**/AfxFreeLibrary(languageModule); + languageModule = NULL; + AfxSetResourceHandle(AfxGetInstanceHandle()); + break; + case 2: + { + if(!force) { + LangSelect dlg; + if(dlg.DoModal()) { + HINSTANCE l = winLoadLanguage(languageName); + if(l == NULL) { + systemMessage(IDS_FAILED_TO_LOAD_LIBRARY, + "Failed to load library %s", + languageName); + return; + } + AfxSetResourceHandle(l); + if(languageModule != NULL) + /**/AfxFreeLibrary(languageModule); + languageModule = l; + } + } else { + if(languageName.IsEmpty()) + return; + HINSTANCE l = winLoadLanguage(languageName); + if(l == NULL) { + systemMessage(IDS_FAILED_TO_LOAD_LIBRARY, + "Failed to load library %s", + languageName); + return; + } + AfxSetResourceHandle(l); + if(languageModule != NULL) + FreeLibrary(languageModule); + languageModule = l; + } + } + break; + } + languageOption = option; + updateMenuBar(); +} + +HINSTANCE VBA::winLoadLanguage(const char *name) +{ + CString buffer; + + buffer.Format("vba_%s.dll", name); + + HINSTANCE l = /**/AfxLoadLibrary(buffer); + + if(l == NULL) { + if(strlen(name) == 3) { + char buffer2[3]; + buffer2[0] = name[0]; + buffer2[1] = name[1]; + buffer2[2] = 0; + buffer.Format("vba_%s.dll", buffer2); + + return /**/AfxLoadLibrary(buffer); + } + } + return l; +} + + +bool VBA::initInput() +{ + if(input) + delete input; + input = newDirectInput(); + if(input->initialize()) { + input->loadSettings(); + input->checkKeys(); + return true; + } + delete input; + return false; +} + +void VBA::winAddUpdateListener(IUpdateListener *l) +{ + updateList.AddTail(l); + updateCount++; +} + +void VBA::winRemoveUpdateListener(IUpdateListener *l) +{ + POSITION pos = updateList.Find(l); + if(pos) { + updateList.RemoveAt(pos); + updateCount--; + if(updateCount < 0) + updateCount = 0; + } +} + +CString VBA::winLoadFilter(UINT id) +{ + CString res = winResLoadString(id); + res.Replace('_','|'); + + return res; +} + + +void VBA::saveSettings() +{ + regSetDwordValue("language", languageOption); + + regSetStringValue("languageName", languageName); + + regSetDwordValue("frameSkip", frameSkip); + + regSetDwordValue("gbFrameSkip", gbFrameSkip); + +/// regSetDwordValue("autoFrameSkip", autoFrameSkip); + regSetDwordValue("accuratePitchThrottle", accuratePitchThrottle); + + regSetDwordValue("vsync", vsync); + regSetDwordValue("synchronize", synchronize); + regSetDwordValue("stretch", fullScreenStretch); + + regSetDwordValue("video", videoOption); + + regSetDwordValue("defaultVideoDriver", pVideoDriverGUID == NULL); + + if(pVideoDriverGUID) { + regSetBinaryValue("videoDriverGUID", (char *)&videoDriverGUID, + sizeof(GUID)); + } + + + regSetDwordValue("fsWidth", fsWidth); + regSetDwordValue("fsHeight", fsHeight); + regSetDwordValue("fsColorDepth", fsColorDepth); + + regSetDwordValue("renderMethod", renderMethod); + + regSetDwordValue("windowX", windowPositionX); + regSetDwordValue("windowY", windowPositionY); + + regSetDwordValue("useBios", useBiosFile); + + regSetDwordValue("skipBios", skipBiosFile); + + regSetDwordValue("memLagEnabled", memLagEnabled); + + regSetDwordValue("useOldGBTiming", useOldGBTiming); + + regSetDwordValue("allowLeftRight", allowLeftRight); + + if(!biosFileName.IsEmpty()) + regSetStringValue("biosFile", biosFileName); + + regSetDwordValue("soundEnable", soundGetEnable() & 0x30f); + + regSetDwordValue("soundOff", soundOffFlag); + + regSetDwordValue("soundQuality", soundQuality); + + regSetDwordValue("soundEcho", soundEcho); + + regSetDwordValue("soundLowPass", soundLowPass); + + regSetDwordValue("soundReverse", soundReverse); + + regSetDwordValue("soundVolume", soundVolume); + + regSetDwordValue("ddrawEmulationOnly", ddrawEmulationOnly); + regSetDwordValue("ddrawUseVideoMemory", ddrawUseVideoMemory); + regSetDwordValue("tripleBuffering", tripleBuffering); + + regSetDwordValue("d3dFilter", d3dFilter); + regSetDwordValue("glFilter", glFilter); + regSetDwordValue("glType", glType); + + regSetDwordValue("filter", filterType); + + regSetDwordValue("disableMMX", disableMMX); + + regSetDwordValue("disableStatus", disableStatusMessage); + + regSetDwordValue("showSpeed", showSpeed); + + regSetDwordValue("showSpeedTransparent", showSpeedTransparent); + + regSetDwordValue("gbPrinter", winGbPrinterEnabled); + + regSetDwordValue("pauseWhenInactive", pauseWhenInactive); + + regSetDwordValue("frameCounter", frameCounter); + regSetDwordValue("inputDisplay", inputDisplay); + regSetDwordValue("movieReadOnly", movieReadOnly); + + regSetDwordValue("useOldSync", useOldSync); + + regSetDwordValue("muteFrameAdvance", muteFrameAdvance); + + regSetDwordValue("captureFormat", captureFormat); + + regSetDwordValue("removeIntros", removeIntros); + + regSetDwordValue("recentFreeze", recentFreeze); + + regSetDwordValue("autoIPS", autoIPS); + + regSetDwordValue("disableSfx", cpuDisableSfx); + + regSetDwordValue("saveType", winSaveType); + + regSetDwordValue("enhancedDetection", cpuEnhancedDetection); + + regSetDwordValue("ifbType", ifbType); + + regSetDwordValue("flashSize", winFlashSize); + + regSetDwordValue("agbPrint", agbPrintIsEnabled()); + + regSetDwordValue("rtcEnabled", winRtcEnable); + + regSetDwordValue("autoHideMenu", autoHideMenu); + + regSetDwordValue("skinEnabled", skinEnabled); + + regSetStringValue("skinName", skinName); + + regSetDwordValue("borderOn", winGbBorderOn); + regSetDwordValue("borderAutomatic", gbBorderAutomatic); + regSetDwordValue("emulatorType", gbEmulatorType); + regSetDwordValue("colorOption", gbColorOption); + + regSetDwordValue("outlinedText", outlinedText); + regSetDwordValue("transparentText", transparentText); + regSetDwordValue("textColor", textColor); + regSetDwordValue("textMethod", textMethod); + + regSetDwordValue("priority", threadPriority); + + regSetDwordValue("autoSaveCheatList", autoSaveLoadCheatList); + + regSetDwordValue("pauseDuringCheatSearch", pauseDuringCheatSearch); + + regSetDwordValue("gbPaletteOption", gbPaletteOption); + + regSetBinaryValue("gbPalette", (char *)systemGbPalette, 24*sizeof(u16)); + + regSetDwordValue("rewindTimer", rewindTimer); + regSetDwordValue("rewindSlots", rewindSlots); + + CString buffer; + for(int i = 0; i < 10; i++) { + buffer.Format("recent%d", i); + regSetStringValue(buffer, recentFiles[i]); + } + + regSetDwordValue("joypadDefault", joypadDefault); + regSetDwordValue("autoLoadMostRecent", autoLoadMostRecent); + regSetDwordValue("loadMakesRecent", loadMakesRecent); + regSetDwordValue("loadMakesCurrent", loadMakesCurrent); + regSetDwordValue("saveMakesCurrent", saveMakesCurrent); + regSetDwordValue("currentSlot", currentSlot); + regSetDwordValue("cheatsEnabled", cheatsEnabled); + regSetDwordValue("fsMaxScale", fsMaxScale); + regSetDwordValue("throttle", throttle); +} + +void winSignal(int, int) +{ +} + +#define CPUReadByteQuick(addr) \ + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] + +void winOutput(char *s, u32 addr) +{ + if(s) { + toolsLog(s); + } else { + CString str; + char c; + + c = CPUReadByteQuick(addr); + addr++; + while(c) { + str += c; + c = CPUReadByteQuick(addr); + addr++; + } + toolsLog(str); + } +} diff --git a/src/win32/VBA.h b/src/win32/VBA.h new file mode 100644 index 0000000..f3ce89e --- /dev/null +++ b/src/win32/VBA.h @@ -0,0 +1,292 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// VBA.h : main header file for the VBA application +// + +#if !defined(AFX_VBA_H__57514A10_49F9_4B83_A928_0D8A4A7306A3__INCLUDED_) +#define AFX_VBA_H__57514A10_49F9_4B83_A928_0D8A4A7306A3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ +#error include 'stdafx.h' before including this file for PCH +#endif + +#include + +#include "AcceleratorManager.h" +#include "resource.h" // main symbols +#include "Display.h" +#include "Input.h" +#include "IUpdate.h" +#include "Sound.h" +#include "../System.h" + +///////////////////////////////////////////////////////////////////////////// +// VBA: +// See VBA.cpp for the implementation of this class +// + +enum { + VIDEO_1X, VIDEO_2X, VIDEO_3X, VIDEO_4X, + VIDEO_320x240, VIDEO_640x480, VIDEO_800x600, VIDEO_OTHER +}; + +#define REWIND_SIZE 400000 +#define MAX_REWIND_SLOTS 256 +#define SCREEN_MESSAGE_SLOTS 8 + +class CSkin; +class AVIWrite; +class WavWriter; + +class VBA : public CWinApp +{ + public: + CMenu m_menu; + HMENU menu; + HMENU popup; + bool mode320Available; + bool mode640Available; + bool mode800Available; + int windowPositionX; + int windowPositionY; + void (*filterFunction)(u8*,u32,u8*,u8*,u32,int,int); + void (*ifbFunction)(u8*,u32,int,int); + int ifbType; + int filterType; + int filterWidth; + int filterHeight; + int fsWidth; + int fsHeight; + int fsColorDepth; + bool fsForceChange; + int sizeX; + int sizeY; + int surfaceSizeX; + int surfaceSizeY; + int videoOption; + bool fullScreenStretch; + bool disableStatusMessage; + int showSpeed; + BOOL showSpeedTransparent; + int showRenderedFrames; + bool screenMessage [SCREEN_MESSAGE_SLOTS]; + CString screenMessageBuffer [SCREEN_MESSAGE_SLOTS]; + DWORD screenMessageTime [SCREEN_MESSAGE_SLOTS]; + int screenMessageDuration [SCREEN_MESSAGE_SLOTS]; + CString screenMessageColorBuffer [SCREEN_MESSAGE_SLOTS]; + u8 *delta[257*244*4]; + bool menuToggle; + IDisplay *display; + int cartridgeType; + bool soundInitialized; + bool useBiosFile; + bool skipBiosFile; + CString biosFileName; + bool useOldGBTiming; + bool allowLeftRight; + bool active; + bool paused; + CString recentFiles[10]; + bool recentFreeze; + bool autoSaveLoadCheatList; + bool pauseDuringCheatSearch; + bool modelessCheatDialogIsOpen; + FILE *winout; + bool removeIntros; + bool autoIPS; + int winGbBorderOn; + bool hideMovieBorder; + int winFlashSize; + bool winRtcEnable; + int winSaveType; + char *rewindMemory; + int rewindPos; + int rewindTopPos; + int rewindCounter; + int rewindCount; + bool rewindSaveNeeded; + int rewindTimer; + int rewindSlots; + int captureFormat; + bool tripleBuffering; + bool autoHideMenu; + int throttle; + u32 throttleLastTime; +/// u32 autoFrameSkipLastTime; +/// bool autoFrameSkip; + bool accuratePitchThrottle; + bool vsync; + bool changingVideoSize; + GUID videoDriverGUID; + GUID *pVideoDriverGUID; + DISPLAY_TYPE renderMethod; + bool iconic; + bool ddrawEmulationOnly; + bool ddrawUsingEmulationOnly; + bool ddrawDebug; + bool ddrawUseVideoMemory; + int d3dFilter; + int glFilter; + int glType; + CSkin *skin; + CString skinName; + bool skinEnabled; + int skinButtons; + bool pauseWhenInactive; + bool speedupToggle; + bool useOldSync; + bool muteFrameAdvance; + bool frameAdvanceMuteNow; + bool winGbPrinterEnabled; + int threadPriority; + bool disableMMX; + int languageOption; + CString languageName; + HINSTANCE languageModule; + int renderedFrames; + Input *input; + int joypadDefault; + int autoFire, autoFire2; + int autoHold; + bool autoFireToggle; + bool winPauseNextFrame; + bool frameCounter; + int globalFrameCount; + bool inputDisplay; + bool movieReadOnly; + bool soundRecording; + WavWriter *soundRecorder; + CString soundRecordName; + ISound *sound; + bool aviRecording; + AVIWrite *aviRecorder; + CString aviRecordName; + int aviFrameNumber; + bool nvVideoLog; + bool nvAudioLog; + bool painting; + int sensorX; + int sensorY; + int mouseCounter; + bool wasPaused; + int frameskipadjust; + bool autoLoadMostRecent; + bool loadMakesRecent; + int fsMaxScale; + int romSize; + bool loadMakesCurrent; + bool saveMakesCurrent; + int currentSlot; + bool frameSearching; + bool frameSearchSkipping; + bool frameSearchFirstStep; + bool frameSearchLoadValid; + int frameSearchLength; + int frameSearchStart; + u32 frameSearchOldInput [4]; + char *frameSearchMemory; + + CList updateList; + int updateCount; + + CAcceleratorManager winAccelMgr; + HACCEL hAccel; + + RECT rect; + RECT dest; + + struct EmulatedSystem emulator; + + CString szFile; + CString filename; + CString dir; + + CString wndClass; + + public: + VBA(); + ~VBA(); + + void adjustDestRect(); + void updateIFB(); + void updateFilter(); + void updateMenuBar(); + void winAddUpdateListener(IUpdateListener *l); + void winRemoveUpdateListener(IUpdateListener *l); + CString winLoadFilter(UINT id); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(VBA) + public: + virtual BOOL InitInstance(); + virtual BOOL OnIdle(LONG lCount); + //}}AFX_VIRTUAL + + // Implementation + + public: + void saveSettings(); + bool initInput(); + HINSTANCE winLoadLanguage(const char *name); + void winSetLanguageOption(int option, bool force); + bool detectMMX(); +#ifdef MMX +#endif + void updatePriority(); + void winUpdateSkin(); + void directXMessage(const char *msg); + void shutdownDisplay(); + void winCheckFullscreen(); + bool updateRenderMethod0(bool force); + bool updateRenderMethod(bool force); + bool initDisplay(); + void updateWindowSize(int value); + void updateVideoSize(UINT id); + void updateFrameSkip(); + void loadSettings(); + void addRecentFile(CString file); + void saveRewindStateIfNecessary(); + //{{AFX_MSG(VBA) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + extern VBA theApp; + +#ifdef MMX + extern "C" bool cpu_mmx; +#endif + + extern void DrawTextMessages(u8 * dest, int pitch, int left, int bottom); + + ///////////////////////////////////////////////////////////////////////////// + + //{{AFX_INSERT_LOCATION}} + // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_VBA_H__57514A10_49F9_4B83_A928_0D8A4A7306A3__INCLUDED_) diff --git a/src/win32/VideoMode.cpp b/src/win32/VideoMode.cpp new file mode 100644 index 0000000..3eb7a6c --- /dev/null +++ b/src/win32/VideoMode.cpp @@ -0,0 +1,368 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// VideoMode.cpp : implementation file +// + +#include "stdafx.h" +/// #define _AFXDLL /// EVIL +/// #include "afxwin.h" /// EVIL +/// #include "afxdll_.h" /// EVIL +#include "VBA.h" + +#define DIRECTDRAW_VERSION 0x0700 +#include "ddraw.h" + +#include "VideoMode.h" + +#include "../System.h" +#include "resource.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#define MAX_DRIVERS 32 // 32 drivers maximum + +//----------------------------------------------------------------------------- +// Local structures +//----------------------------------------------------------------------------- +// Keeps data on the available DDraw drivers +struct +{ + char szDescription[128]; + char szName[128]; + GUID *pGUID; + GUID GUIDcopy; + HMONITOR hm; +} Drivers[MAX_DRIVERS]; + +//----------------------------------------------------------------------------- +// Local data +//----------------------------------------------------------------------------- +static int gDriverCnt = 0; // Total number of drivers +static GUID *gpSelectedDriverGUID; + +//----------------------------------------------------------------------------- +// Name: DDEnumCallbackEx() +// Desc: This call back is used to determine the existing available DDraw +// devices, so the user can pick which one to run on. +//----------------------------------------------------------------------------- +BOOL WINAPI +DDEnumCallbackEx(GUID *pGUID, LPSTR pDescription, LPSTR pName, LPVOID pContext, HMONITOR hm) +{ + if (pGUID) + { + Drivers[gDriverCnt].GUIDcopy = *pGUID; + Drivers[gDriverCnt].pGUID = &Drivers[gDriverCnt].GUIDcopy; + } + else + Drivers[gDriverCnt].pGUID = NULL; + Drivers[gDriverCnt].szDescription[127] = '\0'; + Drivers[gDriverCnt].szName[127] = '\0'; + strncpy(Drivers[gDriverCnt].szDescription,pDescription,127); + strncpy(Drivers[gDriverCnt].szName,pName,127); + Drivers[gDriverCnt].hm = hm; + if (gDriverCnt < MAX_DRIVERS) + gDriverCnt++; + else + return DDENUMRET_CANCEL; + return DDENUMRET_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDEnumCallback() +// Desc: This callback is used only with old versions of DDraw. +//----------------------------------------------------------------------------- +BOOL WINAPI +DDEnumCallback(GUID *pGUID, LPSTR pDescription, LPSTR pName, LPVOID context) +{ + return (DDEnumCallbackEx(pGUID, pDescription, pName, context, NULL)); +} + +static HRESULT WINAPI addVideoMode(LPDDSURFACEDESC2 surf, LPVOID lpContext) +{ + HWND h = (HWND)lpContext; + char buffer[50]; + + switch(surf->ddpfPixelFormat.dwRGBBitCount) { + case 16: + case 24: + case 32: + if(surf->dwWidth >= 640 && surf->dwHeight >= 480) { + sprintf(buffer, "%4dx%4dx%2d", surf->dwWidth, surf->dwHeight, + surf->ddpfPixelFormat.dwRGBBitCount); + int pos = ::SendMessage(h, LB_ADDSTRING, 0, (LPARAM)buffer); + ::SendMessage(h, LB_SETITEMDATA, pos, + (surf->ddpfPixelFormat.dwRGBBitCount << 24) | + ((surf->dwWidth & 4095) << 12) | + (surf->dwHeight & 4095)); + } + } + + return DDENUMRET_OK; +} + +int winVideoModeSelect(CWnd *pWnd, GUID **guid) +{ + HINSTANCE h = /**/AfxLoadLibrary("ddraw.dll"); + + // If ddraw.dll doesn't exist in the search path, + // then DirectX probably isn't installed, so fail. + if (!h) + return -1; + + gDriverCnt = 0; + + // Note that you must know which version of the + // function to retrieve (see the following text). + // For this example, we use the ANSI version. + LPDIRECTDRAWENUMERATEEX lpDDEnumEx; + lpDDEnumEx = (LPDIRECTDRAWENUMERATEEX) + GetProcAddress(h,"DirectDrawEnumerateExA"); + + // If the function is there, call it to enumerate all display + // devices attached to the desktop, and any non-display DirectDraw + // devices. + if (lpDDEnumEx) + lpDDEnumEx(DDEnumCallbackEx, NULL, + DDENUM_ATTACHEDSECONDARYDEVICES | + DDENUM_NONDISPLAYDEVICES + ); + else { + /* + * We must be running on an old version of DirectDraw. + * Therefore MultiMon isn't supported. Fall back on + * DirectDrawEnumerate to enumerate standard devices on a + * single-monitor system. + */ + BOOL (WINAPI *lpDDEnum)(LPDDENUMCALLBACK, LPVOID); + + lpDDEnum = (BOOL (WINAPI *)(LPDDENUMCALLBACK, LPVOID)) + GetProcAddress(h, "DirectDrawEnumerateA"); + if(lpDDEnum) + lpDDEnum(DDEnumCallback,NULL); + + /* Note that it could be handy to let the OldCallback function + * be a wrapper for a DDEnumCallbackEx. + * + * Such a function would look like: + * BOOL FAR PASCAL OldCallback(GUID FAR *lpGUID, + * LPSTR pDesc, + * LPSTR pName, + * LPVOID pContext) + * { + * return Callback(lpGUID,pDesc,pName,pContext,NULL); + * } + */ + } + + int selected = 0; + + if(gDriverCnt > 1) { + VideoDriverSelect d(pWnd); + + selected = d.DoModal(); + + if(selected == -1) { + // If the library was loaded by calling LoadLibrary(), + // then you must use FreeLibrary() to let go of it. + /**/AfxFreeLibrary(h); + + return -1; + } + } + + HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); + DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *)) + GetProcAddress(h, "DirectDrawCreateEx"); + + LPDIRECTDRAW7 ddraw = NULL; + if(DDrawCreateEx) { + HRESULT hret = DDrawCreateEx(Drivers[selected].pGUID, + (void **)&ddraw, + IID_IDirectDraw7, + NULL); + if(hret != DD_OK) { + systemMessage(0, "Error during DirectDrawCreateEx: %08x", hret); + /**/AfxFreeLibrary(h); + return -1; + } + } else { + // should not happen.... + systemMessage(0, "Error getting DirectDrawCreateEx"); + /**/AfxFreeLibrary(h); + return -1; + } + + VideoMode dlg(ddraw, pWnd); + + int res = dlg.DoModal(); + + if(res != -1) { + *guid = Drivers[selected].pGUID; + } + ddraw->Release(); + ddraw = NULL; + + // If the library was loaded by calling LoadLibrary(), + // then you must use FreeLibrary() to let go of it. + /**/AfxFreeLibrary(h); + + return res; +} + +///////////////////////////////////////////////////////////////////////////// +// VideoMode dialog + + +VideoMode::VideoMode(LPDIRECTDRAW7 pDraw, CWnd* pParent /*=NULL*/) + : CDialog(VideoMode::IDD, pParent) +{ + //{{AFX_DATA_INIT(VideoMode) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + pDirectDraw = pDraw; +} + + +void VideoMode::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(VideoMode) + DDX_Control(pDX, IDC_MODES, m_modes); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(VideoMode, CDialog) + //{{AFX_MSG_MAP(VideoMode) + ON_LBN_SELCHANGE(IDC_MODES, OnSelchangeModes) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_BN_CLICKED(ID_OK, OnOk) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// VideoMode message handlers + +void VideoMode::OnSelchangeModes() +{ + int item = m_modes.GetCurSel(); + + GetDlgItem(ID_OK)->EnableWindow(item != -1); +} + +void VideoMode::OnCancel() +{ + EndDialog(-1); +} + +void VideoMode::OnOk() +{ + int cur = m_modes.GetCurSel(); + + if(cur != -1) { + cur = m_modes.GetItemData(cur); + } + EndDialog(cur); +} + +BOOL VideoMode::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // check for available fullscreen modes + pDirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, m_modes.m_hWnd, + addVideoMode); + + GetDlgItem(ID_OK)->EnableWindow(FALSE); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +///////////////////////////////////////////////////////////////////////////// +// VideoDriverSelect dialog + + +VideoDriverSelect::VideoDriverSelect(CWnd* pParent /*=NULL*/) + : CDialog(VideoDriverSelect::IDD, pParent) +{ + //{{AFX_DATA_INIT(VideoDriverSelect) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void VideoDriverSelect::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(VideoDriverSelect) + DDX_Control(pDX, IDC_DRIVERS, m_drivers); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(VideoDriverSelect, CDialog) + //{{AFX_MSG_MAP(VideoDriverSelect) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + ON_LBN_SELCHANGE(IDC_DRIVERS, OnSelchangeDrivers) + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + ///////////////////////////////////////////////////////////////////////////// +// VideoDriverSelect message handlers + +void VideoDriverSelect::OnCancel() +{ + EndDialog(-1); +} + +void VideoDriverSelect::OnOk() +{ + EndDialog(m_drivers.GetCurSel()); +} + +BOOL VideoDriverSelect::OnInitDialog() +{ + CDialog::OnInitDialog(); + + for(int i = 0; i < gDriverCnt; i++) { + m_drivers.AddString(Drivers[i].szDescription); + } + + GetDlgItem(ID_OK)->EnableWindow(FALSE); + CenterWindow(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void VideoDriverSelect::OnSelchangeDrivers() +{ + GetDlgItem(ID_OK)->EnableWindow(m_drivers.GetCurSel() != -1); +} diff --git a/src/win32/VideoMode.h b/src/win32/VideoMode.h new file mode 100644 index 0000000..6b359f5 --- /dev/null +++ b/src/win32/VideoMode.h @@ -0,0 +1,102 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_VIDEOMODE_H__074B2426_32EA_4D69_9215_AB5E90F885D0__INCLUDED_) +#define AFX_VIDEOMODE_H__074B2426_32EA_4D69_9215_AB5E90F885D0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// VideoMode.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// VideoMode dialog + +class VideoMode : public CDialog +{ + // Construction + public: + VideoMode(LPDIRECTDRAW7 pDraw,CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(VideoMode) + enum { IDD = IDD_MODES }; + CListBox m_modes; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(VideoMode) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(VideoMode) + afx_msg void OnSelchangeModes(); + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + LPDIRECTDRAW7 pDirectDraw; +}; + +///////////////////////////////////////////////////////////////////////////// +// VideoDriverSelect dialog + +class VideoDriverSelect : public CDialog +{ + // Construction + public: + VideoDriverSelect(CWnd* pParent = NULL); // standard constructor + + // Dialog Data + //{{AFX_DATA(VideoDriverSelect) + enum { IDD = IDD_DRIVERS }; + CListBox m_drivers; + //}}AFX_DATA + + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(VideoDriverSelect) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation + protected: + + // Generated message map functions + //{{AFX_MSG(VideoDriverSelect) + afx_msg void OnCancel(); + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + afx_msg void OnSelchangeDrivers(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; +#endif // !defined(AFX_VIDEOMODE_H__074B2426_32EA_4D69_9215_AB5E90F885D0__INCLUDED_) diff --git a/src/win32/VisualBoyAdvance.exe.manifest b/src/win32/VisualBoyAdvance.exe.manifest new file mode 100644 index 0000000..e09116c --- /dev/null +++ b/src/win32/VisualBoyAdvance.exe.manifest @@ -0,0 +1,23 @@ + + + +VisualBoyAdvance Emulator. + + + + + + + diff --git a/src/win32/WavWriter.cpp b/src/win32/WavWriter.cpp new file mode 100644 index 0000000..3759bfd --- /dev/null +++ b/src/win32/WavWriter.cpp @@ -0,0 +1,117 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// WavWriter.cpp: implementation of the WavWriter class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "vba.h" +#include "WavWriter.h" + +#include "../System.h" +#include "../Util.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +WavWriter::WavWriter() +{ + m_file = NULL; + m_len = 0; + m_posSize = 0; +} + +WavWriter::~WavWriter() +{ + if(m_file) + Close(); +} + +void WavWriter::Close() +{ + // calculate the total file length + u32 len = ftell(m_file)-8; + fseek(m_file, 4, SEEK_SET); + u8 data[4]; + utilPutDword(data, len); + fwrite(data, 1, 4, m_file); + // write out the size of the data section + fseek(m_file, m_posSize, SEEK_SET); + utilPutDword(data, m_len); + fwrite(data, 1, 4, m_file); + fclose(m_file); + m_file = NULL; +} + +bool WavWriter::Open(const char *name) +{ + if(m_file) + Close(); + m_file = fopen(name, "wb"); + + if(!m_file) + return false; + // RIFF header + u8 data[4] = { 'R', 'I', 'F', 'F' }; + fwrite(data, 1, 4, m_file); + utilPutDword(data, 0); + // write 0 for now. Will get filled during close + fwrite(data, 1, 4, m_file); + // write WAVE header + u8 data2[4] = { 'W', 'A', 'V', 'E' }; + fwrite(data2, 1, 4, m_file); + return true; +} + +void WavWriter::SetFormat(const WAVEFORMATEX *format) +{ + if(m_file == NULL) + return; + // write fmt header + u8 data[4] = { 'f', 'm', 't', ' ' }; + fwrite(data, 1, 4, m_file); + u32 value = sizeof(WAVEFORMATEX); + utilPutDword(data, value); + fwrite(data, 1, 4, m_file); + fwrite(format, 1, sizeof(WAVEFORMATEX), m_file); + // start data header + u8 data2[4] = { 'd', 'a', 't', 'a' }; + fwrite(data2, 1, 4, m_file); + + m_posSize = ftell(m_file); + // write 0 for data chunk size. Filled out during Close() + utilPutDword(data, 0); + fwrite(data, 1, 4, m_file); +} + +void WavWriter::AddSound(const u8 *data, int len) +{ + if(m_file == NULL) + return; + // write a block of sound data + fwrite(data, 1, len, m_file); + m_len += len; +} diff --git a/src/win32/WavWriter.h b/src/win32/WavWriter.h new file mode 100644 index 0000000..8e3c31b --- /dev/null +++ b/src/win32/WavWriter.h @@ -0,0 +1,52 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// WavWriter.h: interface for the WavWriter class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_WAVWRITER_H__BE6C9DE9_60E7_4192_9797_8C7F55B3CE46__INCLUDED_) +#define AFX_WAVWRITER_H__BE6C9DE9_60E7_4192_9797_8C7F55B3CE46__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +class WavWriter +{ + private: + FILE *m_file; + int m_len; + long m_posSize; + + public: + WavWriter(); + ~WavWriter(); + + bool Open(const char *name); + void SetFormat(const WAVEFORMATEX *format); + void AddSound(const u8 *data, int len); + + private: + void Close(); +}; + +#endif // !defined(AFX_WAVWRITER_H__BE6C9DE9_60E7_4192_9797_8C7F55B3CE46__INCLUDED_) diff --git a/src/win32/WinHelper.h b/src/win32/WinHelper.h new file mode 100644 index 0000000..66fb6b7 --- /dev/null +++ b/src/win32/WinHelper.h @@ -0,0 +1,232 @@ +/*---------------------------------------------------------------------- + Copyright (c) 1998 Gipsysoft. All Rights Reserved. + Please see the file "licence.txt" for licencing details. + File: WinHelper.h + Owner: russf@gipsysoft.com + Purpose: Windows helper functions, classes, structures and macros + that make life a little easier + These should all be zero impact classes etc. that is they + should *not* have a cpp file associated with them. + ----------------------------------------------------------------------*/ +#ifndef WINHELPER_H +#define WINHELPER_H + +//#ifndef DEBUGHLP_H +// #include +//#endif // DEBUGHLP_H + +#ifndef FASTCALL +#define FASTCALL +#endif // FASTCALL + +extern void AssertFailed(char *, int, char *); +extern void ApiFailure(char *, int, char *); + +#define R_VERIFY(a) R_ASSERT(a) +#define R_ASSERT(a) \ + do {\ + if(!(a)) {\ + AssertFailed(__FILE__, __LINE__, #a);\ + }\ + } while(0); + +#define VAPI(a) \ + do { \ + if(!(a)) {\ + ApiFailure(__FILE__, __LINE__, #a); \ + }\ + } while (0); + +#define ASSERT_VALID_HWND(a) ASSERT( ::IsWindow(a) ) + +namespace WinHelper +{ + + class CSize : public tagSIZE + // + // Wrapper for the SIZE structure + { + public: + inline CSize() {}; + inline explicit CSize( const SIZE &size ) { cx = size.cx; cy = size.cy; } + inline explicit CSize( long nSizeX, long nSizeY ) { cx = nSizeX; cy = nSizeY; } + inline void Set( long nSizeX, long nSizeY ) { cx = nSizeX; cy = nSizeY; } + inline operator LPSIZE() { return this; }; + + inline bool operator !=( const SIZE &size ) const { return cx != size.cx || cy != size.cy;} + inline CSize & operator =( const SIZE &size ) { cx = size.cx; cy = size.cy; return *this; } + inline void Empty() { cx = cy = 0; } + }; + + + class CRect : public tagRECT + // + // Wrapper for a RECT structure + { + public: + inline CRect() {} + // Initialisation constructor + inline explicit CRect( const RECT& rhs ) { Set( rhs.left, rhs.top, rhs.right, rhs.bottom );} + inline CRect(int xLeft, int yTop, int xRight, int yBottom) { Set( xLeft, yTop, xRight, yBottom ); } + // Get the width of the rectangle + inline int Width() const { return right - left; } + // Get the height of the rectangle + inline int Height() const { return bottom - top; } + // overloaded operator so you don't have to do &rc anymore + inline operator LPCRECT() const { return this; }; + inline operator LPRECT() { return this; }; + // Return the SIZE of the rectangle; + inline CSize Size() const { CSize s( Width(), Height() ); return s; } + // Return the top left of the rectangle + inline POINT TopLeft() const { POINT pt = { left, top }; return pt; } + // Return the bottom right of the rectangle + inline POINT BottomRight() const { POINT pt = { right, bottom }; return pt; } + // Set the rectangles left, top, right and bottom + inline void Set( int xLeft, int yTop, int xRight, int yBottom) { top = yTop; bottom = yBottom; right = xRight; left = xLeft; } + // Return true if the rectangle contains all zeros + inline bool IsEmpty() const { return left == 0 && right == 0 && top == 0 && bottom == 0 ? true : false; } + // Zero out our rectangle + inline void Empty() { left = right = top = bottom = 0; } + // Set the size of the rect but leave the top left position untouched. + inline void SetSize( const CSize &size ) { bottom = top + size.cy; right = left + size.cx; } + inline void SetSize( const SIZE &size ) { bottom = top + size.cy; right = left + size.cx; } + inline void SetSize( int cx, int cy ) { bottom = top + cy; right = left + cx; } + // Move the rectangle by an offset + inline void Offset( int cx, int cy ) + { + top+=cy; + bottom+=cy; + right+=cx; + left+=cx; + } + // Inflate the rectangle by the cx and cy, use negative to shrink the rectangle + inline void Inflate( int cx, int cy ) + { + top-=cy; + bottom+=cy; + right+=cx; + left-=cx; + } + // Assignment from a RECT + inline CRect &operator = ( const RECT&rhs ) + { + left = rhs.left; top = rhs.top; + right = rhs.right; bottom = rhs.bottom; + return *this; + } + + // Return true if the point passed is within the rectangle + inline bool PtInRect( const POINT &pt ) const { return ( pt.x >= left && pt.x < right && pt.y >=top && pt.y < bottom ); } + // Return true if the rectangle passed overlaps this rectangle + inline bool Intersect( const RECT &rc ) const { return ( rc.left < right && rc.right > left && rc.top < bottom && rc.bottom > top ); } + }; + + + class CPoint : public tagPOINT + // + // Wrapper for the POINT structure + { + public: + inline CPoint() {}; + inline CPoint( LPARAM lParam ) { x = LOWORD( lParam ); y = HIWORD(lParam); } + inline CPoint( int nX, int nY ) { x = nX; y = nY; } + inline CPoint( const POINT &pt ) { x = pt.x; y = pt.y; } + inline bool operator == ( const CPoint &rhs ) const { return x == rhs.x && y == rhs.y; } + inline bool operator != ( const CPoint &rhs ) const { return x != rhs.x || y != rhs.y; } + inline operator LPPOINT () { return this; } + }; + + + class CScrollInfo : public tagSCROLLINFO + { + public: + CScrollInfo( UINT fPassedMask ) { cbSize = sizeof( tagSCROLLINFO ); fMask = fPassedMask; } + }; + + + class CCriticalSection + // + // Simple crtical section handler/wrapper + { + public: + inline CCriticalSection() { ::InitializeCriticalSection(&m_sect); } + inline ~CCriticalSection() { ::DeleteCriticalSection(&m_sect); } + + // Blocking lock. + inline void Lock() { ::EnterCriticalSection(&m_sect); } + // Unlock + inline void Unlock() { ::LeaveCriticalSection(&m_sect); } + + class CLock + // + // Simple lock class for the critcal section + { + public: + inline CLock( CCriticalSection § ) : m_sect( sect ) { m_sect.Lock(); } + inline ~CLock() { m_sect.Unlock(); } + private: + CCriticalSection &m_sect; + + CLock(); + CLock( const CLock &); + CLock& operator =( const CLock &); + }; + + private: + CRITICAL_SECTION m_sect; + + CCriticalSection( const CCriticalSection & ); + CCriticalSection& operator =( const CCriticalSection & ); + }; + + +#define ZeroStructure( t ) ZeroMemory( &t, sizeof( t ) ) +#define countof( t ) (sizeof( (t) ) / sizeof( (t)[0] ) ) +#define UNREF(P) UNREFERENCED_PARAMETER(P) + + inline bool IsShiftPressed() + { + return GetKeyState(VK_SHIFT) & 0x8000 ? true : false; + } + + inline bool IsAltPressed() + { + return GetKeyState(VK_MENU) & 0x8000 ? true : false; + } + + inline bool IsControlPressed() + { + return GetKeyState(VK_CONTROL) & 0x8000 ? true : false; + } + + inline HICON LoadIcon16x16( HINSTANCE hInst, UINT uID ) + // + // Load a 16x16 icon from the same resource as the other size icons. + { + return reinterpret_cast( ::LoadImage( hInst, MAKEINTRESOURCE( uID ), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ) ); + } + + + class CDeferWindowPos + // + // Wrapper for the Begin, Defer and End WindowPos functions. Nothing glamorous. + { + public: + inline CDeferWindowPos( const int nWindows = 1 ) : m_hdlDef( ::BeginDeferWindowPos( nWindows ) ) {} + inline ~CDeferWindowPos() { R_VERIFY( ::EndDeferWindowPos( m_hdlDef ) ); } + inline HDWP DeferWindowPos( HWND hWnd, HWND hWndInsertAfter , int x, int y, int cx, int cy, UINT uFlags ) + { + return ::DeferWindowPos( m_hdlDef, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags ); + } + inline HDWP DeferWindowPos( HWND hWnd, HWND hWndInsertAfter, const CRect &rc, UINT uFlags ) + { + return ::DeferWindowPos( m_hdlDef, hWnd, hWndInsertAfter, rc.left, rc.top, rc.Width(), rc.Height(), uFlags ); + } + + private: + HDWP m_hdlDef; + }; + +} // WinHelper + +#endif //WINHELPER_H diff --git a/src/win32/WinResUtil.cpp b/src/win32/WinResUtil.cpp new file mode 100644 index 0000000..968df8a --- /dev/null +++ b/src/win32/WinResUtil.cpp @@ -0,0 +1,109 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "stdafx.h" + +static HINSTANCE winResGetInstance(LPCTSTR resType, LPCTSTR resName) +{ + // TODO: make language DLL first + return AfxFindResourceHandle(resName, resType); +} + + +UCHAR *winResGetResource(LPCTSTR resType, LPCTSTR resName) +{ + HINSTANCE winResInstance = winResGetInstance(resType, resName); + + HRSRC hRsrc = FindResourceEx(winResInstance, resType, resName, 0); + + if(hRsrc != NULL) { + HGLOBAL hGlobal = LoadResource(winResInstance, hRsrc); + + if(hGlobal != NULL) { + UCHAR * b = (UCHAR *)LockResource(hGlobal); + + return b; + } + } + return NULL; +} + +HMENU winResLoadMenu(LPCTSTR menuName) +{ + UCHAR * b = winResGetResource(RT_MENU, menuName); + + if(b != NULL) { + HMENU menu = LoadMenuIndirect((CONST MENUTEMPLATE *)b); + + if(menu != NULL) + return menu; + } + + return LoadMenu(NULL, menuName); +} + +int winResDialogBox(LPCTSTR boxName, + HWND parent, + DLGPROC dlgProc, + LPARAM lParam) +{ + /* + UCHAR * b = winResGetResource(RT_DIALOG, boxName); + + if(b != NULL) { + + return DialogBoxIndirectParam(hInstance, + (LPCDLGTEMPLATE)b, + parent, + dlgProc, + lParam); + } + + return DialogBoxParam(hInstance, + boxName, + parent, + dlgProc, + lParam); + */ + return 0; +} + +int winResDialogBox(LPCTSTR boxName, + HWND parent, + DLGPROC dlgProc) +{ + return winResDialogBox(boxName, + parent, + dlgProc, + 0); +} + +CString winResLoadString(UINT id) +{ + int stId = id / 16 + 1; + HINSTANCE inst = winResGetInstance(RT_STRING, MAKEINTRESOURCE(stId)); + + CString res; + if(res.LoadString(id)) + return res; + + // TODO: handle case where string is only in the default English + res = ""; + + return res; +} diff --git a/src/win32/WinResUtil.h b/src/win32/WinResUtil.h new file mode 100644 index 0000000..8184c95 --- /dev/null +++ b/src/win32/WinResUtil.h @@ -0,0 +1,31 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +extern HMENU winResLoadMenu(LPCTSTR menuName); + +extern int winResDialogBox(LPCTSTR boxName, + HWND parent, + DLGPROC dlgProc); + +extern int winResDialogBox(LPCTSTR boxName, + HWND parent, + DLGPROC dlgProc, + LPARAM lParam); + +extern CString winResLoadString(UINT id); diff --git a/src/win32/ZoomControl.cpp b/src/win32/ZoomControl.cpp new file mode 100644 index 0000000..67509fc --- /dev/null +++ b/src/win32/ZoomControl.cpp @@ -0,0 +1,190 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// ZoomControl.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "ZoomControl.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +bool ZoomControl::isRegistered = false; + +///////////////////////////////////////////////////////////////////////////// +// ZoomControl + +ZoomControl::ZoomControl() +{ + ZeroMemory(colors, 3*64); + selected = -1; + registerClass(); +} + +ZoomControl::~ZoomControl() +{ +} + + +BEGIN_MESSAGE_MAP(ZoomControl, CWnd) + //{{AFX_MSG_MAP(ZoomControl) + ON_WM_PAINT() + ON_WM_LBUTTONDOWN() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// ZoomControl message handlers + +void ZoomControl::registerClass() +{ + if(!isRegistered) { + WNDCLASS wc; + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wc.lpfnWndProc = (WNDPROC)::DefWindowProc; + wc.hInstance = AfxGetInstanceHandle(); + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "VbaZoomControl"; + AfxRegisterClass(&wc); + isRegistered = true; + } +} + +void ZoomControl::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + RECT rect; + GetClientRect(&rect); + + int w = rect.right - rect.left; + int h = rect.bottom - rect.top; + + CDC memDC ; + memDC.CreateCompatibleDC(&dc); + CBitmap bitmap, *pOldBitmap; + bitmap.CreateCompatibleBitmap(&dc, w, h); + + pOldBitmap = memDC.SelectObject(&bitmap); + + int multX = w / 8; + int multY = h / 8; + + int i; + for(i = 0; i < 64; i++) { + CBrush b; + b.CreateSolidBrush(RGB(colors[i*3+2], colors[i*3+1], colors[i*3])); + + RECT r; + int x = i & 7; + int y = i / 8; + r.top = y*multY; + r.left = x*multX; + r.bottom = r.top + multY; + r.right = r.left + multX; + memDC.FillRect(&r, &b); + b.DeleteObject(); + } + + CPen pen; + pen.CreatePen(PS_SOLID, 1, RGB(192,192,192)); + CPen *old = (CPen *)memDC.SelectObject(&pen); + + for(i = 0; i < 8; i++) { + memDC.MoveTo(0, i * multY); + memDC.LineTo(w, i * multY); + memDC.MoveTo(i * multX, 0); + memDC.LineTo(i * multX, h); + } + + if(selected != -1) { + CPen pen2; + pen2.CreatePen(PS_SOLID, 2, RGB(255, 0, 0)); + CPen *old2 = (CPen*)memDC.SelectObject(&pen2); + + int startX = (selected & 7)*multX+1; + int startY = (selected / 8)*multY+1; + int endX = startX + multX-2; + int endY = startY + multY-2; + + memDC.MoveTo(startX, startY); + memDC.LineTo(endX, startY); + memDC.LineTo(endX, endY); + memDC.LineTo(startX, endY); + memDC.LineTo(startX, startY-1); + memDC.SelectObject(old2); + pen2.DeleteObject(); + } + memDC.SelectObject(old); + pen.DeleteObject(); + + dc.BitBlt(0,0,w,h, + &memDC,0,0, SRCCOPY); + + memDC.SelectObject(pOldBitmap); + bitmap.DeleteObject(); + memDC.DeleteDC(); +} + +void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) +{ + RECT rect; + GetClientRect(&rect); + + int height = rect.bottom - rect.top; + int width = rect.right - rect.left; + + int multX = width / 8; + int multY = height / 8; + + selected = point.x / multX + 8 * (point.y / multY); + + int c = point.x / multX + 8 * (point.y/multY); + u16 color = colors[c*3] << 7 | + colors[c*3+1] << 2 | + (colors[c*3+2] >> 3); + + GetParent()->PostMessage(WM_COLINFO, + color, + 0); + + Invalidate(); +} + +BOOL ZoomControl::OnEraseBkgnd(CDC* pDC) +{ + return TRUE; +} + +void ZoomControl::setColors(const u8 *c) +{ + memcpy(colors, c, 3*64); + selected = -1; + Invalidate(); +} diff --git a/src/win32/ZoomControl.h b/src/win32/ZoomControl.h new file mode 100644 index 0000000..d70b4c9 --- /dev/null +++ b/src/win32/ZoomControl.h @@ -0,0 +1,78 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_ZOOMCONTROL_H__BC193230_D2D6_4240_93AE_28C2EF2C641A__INCLUDED_) +#define AFX_ZOOMCONTROL_H__BC193230_D2D6_4240_93AE_28C2EF2C641A__INCLUDED_ + +#include "..\System.h" // Added by ClassView +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ZoomControl.h : header file +// +#ifndef WM_COLINFO +#define WM_COLINFO WM_APP+100 +#endif + +///////////////////////////////////////////////////////////////////////////// +// ZoomControl window + +class ZoomControl : public CWnd +{ + // Construction + public: + ZoomControl(); + + // Attributes + public: + + // Operations + public: + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ZoomControl) + //}}AFX_VIRTUAL + + // Implementation + public: + void setColors(const u8 *c); + static bool isRegistered; + virtual ~ZoomControl(); + + // Generated message map functions + protected: + //{{AFX_MSG(ZoomControl) + afx_msg void OnPaint(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + private: + int selected; + u8 colors[3*64]; + void registerClass(); +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_ZOOMCONTROL_H__BC193230_D2D6_4240_93AE_28C2EF2C641A__INCLUDED_) diff --git a/src/win32/gbadvance.ico b/src/win32/gbadvance.ico new file mode 100644 index 0000000000000000000000000000000000000000..aa35b5c89e55600ac8a4439ab1953209014d8aba GIT binary patch literal 4710 zcmeH}O=ufO6vv-it9DIm2YRVX= zoq6+q^LF%hrF|j|(kMrc91+#~4I&@WS4=q*5E*5zqr>+I$7kCNF z27C^F8GZpi4nGL*!1v3Vbi;ST2jSb{i}364dH7ZM415|s4ZjFK4L=M&0N({~;0?Ti zH}D4D!0WNbah>B5N1P*U`6B!}d>(!kJ_E1O)6k31)3Wrz8R!A%F5+*%=iry&7vSUY zgYXV~KYTaQJK=-y?eN51S%II2AAt|S2jK<&+3b+D4fq`VGW-I39DWeqf$xX!CYzmP zGe|buMSlMNs+e{7Jp3wr20jg+hF^rAh98C>fbY_0h4=>Ez#Di2Z{XR`8XLOK?YhM6 zigUZdVUZ&I<A9fbX10ihvnqSlQJ+cASX_o zkgl#SIez@O96fqeT3cIrBL0S2tSVs3t{by*cUweuPcuGkr33Z3@^oi+cl)W}a^2WN zS7xk4eeT0DcIlnemowr%jJe84(h7e{L%Z_1mAI*xyPFz`xp6BuHZt*K>-W-xy*j6f z((l`{z4a(s(W5Okg#7Kc_(o;d2X)nd%$;NZ{C~EC;61eJ`zXP?tEzwReN?@|OZ2?T zc$rlLG^(ZQ(HX2$`id$PZtILX6FM)_JUH(31e_s$ty5!TlOlnS$HM`~!S>bkX&*NJ z->iK9(D=R`!9R5|tPik0!vW6;2Rtt1}C+<|^zRJG(obL4$1y4oJ-xFy{=%e=%()IUJ(vdZL5YLu(Mf zo=7xeR8_Ns!+PSdo;a*0_+h-D;5w`)s(%>&bziAsw3u+8+e?j8fjY$ZQCQVzpQ)_e zsSmjmi$?t@O8yzM-qKd-F-OT7F;@u@8%h07YJ?e$QcG3*cD-LzRZ1(??XBM`Dpx7G z_WfFm>H1>1TvUH@X8*v9mCMv`+HXB7+x5v0-)&2_eVfV5B-Q^%IaXGGjO8y{AA`WJ zU(@&dRh?hj={i*FzfdEMuM2Da%+)H^3ZVYI3)FgT_-GV=DwXn6?beFe(I_sF&AGV> zp&Qzhdgtcm@B=8Z=dpuNtao!$uh|5$U9CB*{r23Z@2%|W8DP6^v;SkGzG}dF#dXSG DsvOIK literal 0 HcmV?d00001 diff --git a/src/win32/resource.h b/src/win32/resource.h new file mode 100644 index 0000000..ac5ef39 --- /dev/null +++ b/src/win32/resource.h @@ -0,0 +1,908 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vba.rc +// +#define IDS_UNSUPPORTED_VBA_SGM 1 +#define IDS_CANNOT_LOAD_SGM 2 +#define IDS_SAVE_GAME_NOT_USING_BIOS 3 +#define IDS_SAVE_GAME_USING_BIOS 4 +#define IDS_UNSUPPORTED_SAVE_TYPE 5 +#define IDS_CANNOT_OPEN_FILE 6 +#define IDS_BAD_ZIP_FILE 7 +#define IDS_NO_IMAGE_ON_ZIP 8 +#define IDS_ERROR_OPENING_IMAGE 9 +#define IDS_ERROR_READING_IMAGE 10 +#define IDS_UNSUPPORTED_BIOS_FUNCTION 11 +#define IDS_INVALID_BIOS_FILE_SIZE 12 +#define IDS_INVALID_CHEAT_CODE 13 +#define IDS_UNKNOWN_ARM_OPCDOE 14 +#define IDS_UNKNOWN_THUMB_OPCODE 15 +#define IDS_ERROR_CREATING_FILE 16 +#define IDS_FAILED_TO_READ_SGM 17 +#define IDS_FAILED_TO_READ_RTC 18 +#define IDS_UNSUPPORTED_VB_SGM 19 +#define IDS_CANNOT_LOAD_SGM_FOR 20 +#define IDS_ERROR_OPENING_IMAGE_FROM 21 +#define IDS_ERROR_READING_IMAGE_FROM 22 +#define IDS_UNSUPPORTED_ROM_SIZE 23 +#define IDS_UNSUPPORTED_RAM_SIZE 24 +#define IDS_UNKNOWN_CARTRIDGE_TYPE 25 +#define IDS_MAXIMUM_NUMBER_OF_CHEATS 26 +#define IDS_INVALID_GAMESHARK_CODE 27 +#define IDS_INVALID_GAMEGENIE_CODE 28 +#define IDS_INVALID_CHEAT_TO_REMOVE 29 +#define IDS_INVALID_CHEAT_CODE_ADDRESS 30 +#define IDS_UNSUPPORTED_CHEAT_LIST_VERSION 31 +#define IDS_UNSUPPORTED_CHEAT_LIST_TYPE 32 +#define IDS_INVALID_GSA_CODE 33 +#define IDS_CANNOT_IMPORT_SNAPSHOT_FOR 34 +#define IDS_UNSUPPORTED_SNAPSHOT_FILE 35 +#define IDS_UNSUPPORTED_ARM_MODE 36 +#define IDS_UNSUPPORTED_CODE_FILE 37 +#define IDS_GSA_CODE_WARNING 38 +#define IDS_INVALID_CBA_CODE 39 +#define IDS_CBA_CODE_WARNING 40 +#define IDS_OUT_OF_MEMORY 41 +#define IDI_ICON 101 +#define IDD_REGISTERS 102 +#define IDD_DEBUG 103 +#define IDR_MENU 104 +#define IDD_ABOUT 105 +#define IDR_ACCELERATOR 106 +#define IDD_CHEATS 107 +#define IDD_ADD_CHEAT 108 +#define IDD_DIRECTORIES 109 +#define IDD_CONFIG 110 +#define IDD_GS 111 +#define IDD_GG 112 +#define IDD_CHEAT_LIST 113 +#define IDD_ASSOCIATIONS 114 +#define IDR_GB_PRINTER 115 +#define IDD_GBA_ROM_INFO 116 +#define IDD_GB_ROM_INFO 117 +#define IDD_GB_CHEAT_LIST 118 +#define IDD_ADD_CHEAT_DLG 119 +#define IDD_GB_PRINTER 120 +#define IDD_MOTION_CONFIG 121 +#define IDD_LANG_SELECT 122 +#define IDD_CODE_SELECT 123 +#define IDD_OPENDLG 124 +#define IDD_MAP_VIEW 126 +#define IDD_PALETTE_VIEW 127 +#define IDD_MEM_VIEWER 128 +#define IDD_OAM_VIEW 130 +#define IDD_ACCEL_EDITOR 131 +#define IDD_TILE_VIEWER 132 +#define IDD_GB_COLORS 133 +#define IDD_DISASSEMBLE 134 +#define IDD_GDB_PORT 135 +#define IDD_GDB_WAITING 136 +#define IDD_LOGGING 137 +#define IDD_EXPORT_SPS 138 +#define IDD_ADDR_SIZE 139 +#define IDD_MODES 140 +#define IDD_DRIVERS 142 +#define IDD_THROTTLE 143 +#define IDD_GB_DISASSEMBLE 144 +#define IDD_GB_OAM_VIEW 145 +#define IDD_GB_TILE_VIEWER 146 +#define IDD_GB_MAP_VIEW 147 +#define IDD_GB_PALETTE_VIEW 148 +#define IDD_MODE_CONFIRM 149 +#define IDD_REWIND_INTERVAL 150 +#define IDD_IO_VIEWER 151 +#define IDD_MAX_SCALE 154 +#define IDD_BUG_REPORT 155 +#define IDD_MOVIECREATE 156 +#define IDD_MOVIEOPEN 157 +#define IDD_TEXTCONFIG 158 +#define IDC_R0 1000 +#define IDC_EDIT_UP 1000 +#define IDC_R1 1001 +#define IDC_EDIT_DOWN 1001 +#define IDC_R2 1002 +#define IDC_EDIT_LEFT 1002 +#define IDC_R3 1003 +#define IDC_EDIT_RIGHT 1003 +#define IDC_R4 1004 +#define IDC_EDIT_BUTTON_A 1004 +#define IDC_R5 1005 +#define IDC_EDIT_BUTTON_B 1005 +#define IDC_R6 1006 +#define IDC_EDIT_BUTTON_SELECT 1006 +#define IDC_R7 1007 +#define IDC_EDIT_BUTTON_START 1007 +#define IDC_R8 1008 +#define ID_OK 1008 +#define IDC_R9 1009 +#define ID_CANCEL 1009 +#define ID_SAVE 1009 +#define IDC_R10 1010 +#define IDC_EDIT_SPEED 1010 +#define IDC_R11 1011 +#define IDC_EDIT_CAPTURE 1011 +#define IDC_R12 1012 +#define IDC_EDIT_BUTTON_L 1012 +#define IDC_R13 1013 +#define IDC_EDIT_BUTTON_GS 1013 +#define IDC_R14 1014 +#define IDC_EDIT_BUTTON_R 1014 +#define IDC_R15 1015 +#define IDC_R16 1016 +#define IDC_R17 1017 +#define IDC_N_FLAG 1018 +#define IDC_ROM_DIR 1018 +#define IDC_Z_FLAG 1019 +#define IDC_NEXT 1019 +#define IDC_BATTERY_DIR 1019 +#define IDC_C_FLAG 1020 +#define IDC_CONTINUE 1020 +#define IDC_SAVE_DIR 1020 +#define IDC_V_FLAG 1021 +#define IDC_CAPTURE_DIR 1021 +#define IDC_CHEAT_LIST 1021 +#define IDC_IRQ 1022 +#define IDC_ROM_PATH 1022 +#define IDC_START 1022 +#define IDC_T_FLAG 1023 +#define IDC_BATTERY_PATH 1023 +#define IDC_SEARCH 1023 +#define IDS_DIRECTX_7_REQUIRED 1024 +#define IDC_SAVE_PATH 1024 +#define IDC_ADD_CHEAT 1024 +#define IDC_M4 1025 +#define IDC_CAPTURE_PATH 1025 +#define IDC_OLD_VALUE 1025 +#define IDC_ADD_GS_CHEAT 1025 +#define IDS_DISABLING_VIDEO_MEMORY 1025 +#define IDC_ADD_GAMESHARK 1025 +#define IDC_M3 1026 +#define IDC_SPECIFIC_VALUE 1026 +#define IDS_SETTING_WILL_BE_EFFECTIVE 1026 +#define IDC_GBROM_DIR 1026 +#define IDC_MOVIES_DIR 1026 +#define IDC_M2 1027 +#define IDS_DISABLING_EMULATION_ONLY 1027 +#define IDC_GBROM_PATH 1027 +#define IDC_MOVIES_PATH 1027 +#define IDC_M1 1028 +#define IDC_SIZE_8 1028 +#define IDS_FAILED_TO_OPEN_FILE 1028 +#define IDC_ROM_DIR_RESET 1028 +#define IDC_M0 1029 +#define IDC_SIZE_16 1029 +#define IDS_FAILED_TO_READ_ZIP_DIR 1029 +#define IDC_GBROM_DIR_RESET 1029 +#define IDC_MOVIES_DIR_RESET 1029 +#define IDC_SIZE_32 1030 +#define IDS_UNSUPPORTED_FILE_TYPE 1030 +#define IDC_BATTERY_DIR_RESET 1030 +#define IDC_EQ 1031 +#define IDS_CANNOT_CREATE_DIRECTSOUND 1031 +#define IDC_SAVE_DIR_RESET 1031 +#define IDC_NE 1032 +#define IDS_CANNOT_SETCOOPERATIVELEVEL 1032 +#define IDC_CAPTURE_DIR_RESET 1032 +#define IDC_LT 1033 +#define IDS_CANNOT_CREATESOUNDBUFFER 1033 +#define IDC_LE 1034 +#define IDS_CANNOT_SETFORMAT_PRIMARY 1034 +#define IDC_GT 1035 +#define IDS_CANNOT_CREATESOUNDBUFFER_SEC 1035 +#define IDC_GE 1036 +#define IDS_CANNOT_PLAY_PRIMARY 1036 +#define IDC_SIGNED 1037 +#define IDS_SEARCH_PRODUCED_TOO_MANY 1037 +#define IDC_UNSIGNED 1038 +#define IDS_NUMBER_CANNOT_BE_EMPTY 1038 +#define IDS_INVALID_ADDRESS 1039 +#define IDC_HEXADECIMAL 1040 +#define IDS_MISALIGNED_HALFWORD 1040 +#define IDC_VALUE 1041 +#define IDS_MISALIGNED_WORD 1041 +#define IDC_ADDRESS 1042 +#define IDS_VALUE_CANNOT_BE_EMPTY 1042 +#define IDS_ERROR_ON_STARTDOC 1043 +#define IDC_R 1043 +#define IDS_ERROR_ON_STARTPAGE 1044 +#define IDC_G 1044 +#define IDS_ERROR_PRINTING_ON_STRETCH 1045 +#define IDC_B 1045 +#define IDC_UPDATE 1046 +#define IDS_ERROR_ON_ENDPAGE 1046 +#define IDC_TILE_NUM 1046 +#define IDC_GGDESC 1047 +#define IDS_ERROR_ON_ENDDOC 1047 +#define IDC_FLIP 1047 +#define IDC_GGCODE 1048 +#define IDS_ERROR 1048 +#define IDC_PALETTE_NUM 1048 +#define IDC_GGADD 1049 +#define IDS_JOY_LEFT 1049 +#define IDC_GGDEL 1050 +#define IDS_JOY_RIGHT 1050 +#define IDC_GGLIST 1051 +#define IDS_JOY_UP 1051 +#define IDC_GGRES 1052 +#define IDS_JOY_DOWN 1052 +#define IDC_GGQUIT 1053 +#define IDS_JOY_BUTTON 1053 +#define IDC_GSDESC 1054 +#define IDS_SELECT_ROM_DIR 1054 +#define IDC_GSCODE 1055 +#define IDS_SELECT_BATTERY_DIR 1055 +#define IDC_GSADD 1056 +#define IDS_SELECT_SAVE_DIR 1056 +#define IDC_GSDEL 1057 +#define IDS_SELECT_CAPTURE_DIR 1057 +#define IDC_GSLIST 1058 +#define IDS_SELECT_BIOS_FILE 1058 +#define IDC_GSRES 1059 +#define IDS_RESET 1059 +#define IDC_GSQUIT 1060 +#define IDS_AUTOFIRE_A_DISABLED 1060 +#define IDC_FREEZE 1061 +#define IDS_AUTOFIRE_A 1061 +#define IDS_AUTOFIRE_B_DISABLED 1062 +#define IDS_AUTOFIRE_B 1063 +#define IDS_AUTOFIRE_L_DISABLED 1064 +#define IDS_AUTOFIRE_L 1065 +#define IDS_AUTOFIRE_R_DISABLED 1066 +#define IDC_REMOVE 1067 +#define IDS_AUTOFIRE_R 1067 +#define IDC_REMOVE_ALL 1068 +#define IDS_SELECT_ROM 1068 +#define IDS_SELECT_SAVE_GAME_NAME 1069 +#define IDC_ENABLE 1070 +#define IDS_LOADED_STATE 1070 +#define IDS_LOADED_STATE_N 1071 +#define IDS_WROTE_STATE 1072 +#define IDS_WROTE_STATE_N 1073 +#define IDC_RESTORE 1074 +#define IDS_LOADED_BATTERY 1074 +#define IDC_GBA 1075 +#define IDS_SELECT_CAPTURE_NAME 1075 +#define IDC_AGB 1076 +#define IDS_SCREEN_CAPTURE 1076 +#define IDC_BIN 1077 +#define IDS_ADDRESS 1077 +#define IDC_GB 1078 +#define IDS_OLD_VALUE 1078 +#define IDC_SGB 1079 +#define IDC_ROM_TITLE 1079 +#define IDS_NEW_VALUE 1079 +#define IDC_CGB 1080 +#define IDC_ROM_GAME_CODE 1080 +#define IDS_ADD_CHEAT_CODE 1080 +#define IDC_GBC 1081 +#define IDC_ROM_MAKER_CODE 1081 +#define IDS_CODE 1081 +#define IDC_ROM_UNIT_CODE 1082 +#define IDS_DESCRIPTION 1082 +#define IDC_ROM_DEVICE_TYPE 1083 +#define IDS_STATUS 1083 +#define IDC_ROM_VERSION 1084 +#define IDS_ADD_GG_CODE 1084 +#define IDC_ROM_CRC 1085 +#define IDS_ADD_GS_CODE 1085 +#define IDC_ROM_COLOR 1086 +#define IDC_CODE 1086 +#define IDS_POCKET_PRINTER 1086 +#define IDC_ROM_MAKER_NAME 1086 +#define IDC_ROM_SIZE 1087 +#define IDC_DESC 1087 +#define IDS_UNKNOWN 1087 +#define IDC_ROM_RAM_SIZE 1088 +#define IDC_ADD_GG_CHEAT 1088 +#define IDS_NONE 1088 +#define IDC_ROM_DEST_CODE 1089 +#define IDC_GB_PRINTER 1089 +#define IDS_FAILED_TO_LOAD_LIBRARY 1089 +#define IDC_ROM_LIC_CODE 1090 +#define IDC_1X 1090 +#define IDS_FAILED_TO_GET_LOCINFO 1090 +#define IDC_EDIT_AUTHOR 1090 +#define IDC_ROM_CHECKSUM 1091 +#define IDC_2X 1091 +#define IDS_SELECT_CHEAT_LIST_NAME 1091 +#define IDC_EDIT_DESCRIPTION 1091 +#define IDC_3X 1092 +#define IDS_FILTER_BIOS 1092 +#define IDC_4X 1093 +#define IDS_FILTER_ROM 1093 +#define IDC_ROM_MAKER_NAME2 1093 +#define ID_PRINT 1094 +#define IDS_FILTER_SGM 1094 +#define IDC_ADD_GSA 1095 +#define IDC_ADD_CODE 1095 +#define IDS_FILTER_CHEAT_LIST 1095 +#define IDC_TRANSLATION_BY 1096 +#define IDS_FILTER_PNG 1096 +#define IDC_LANG_STRING 1097 +#define IDS_LOADED_CHEATS 1097 +#define IDC_LANG_NAME 1098 +#define IDS_ERROR_DISP_COLOR 1098 +#define IDS_ADD_GSA_CODE 1099 +#define IDC_GAME_LIST 1099 +#define IDS_FILTER_SPS 1100 +#define IDS_SELECT_SNAPSHOT_FILE 1101 +#define IDC_ADD_CODEBREAKER 1101 +#define IDS_FILTER_SAV 1102 +#define IDS_SELECT_BATTERY_FILE 1103 +#define IDS_FILTER_GBS 1104 +#define IDS_FILTER_GCF 1105 +#define IDS_SELECT_CODE_FILE 1106 +#define IDS_SAVE_WILL_BE_LOST 1107 +#define IDS_CONFIRM_ACTION 1108 +#define IDS_CODES_WILL_BE_LOST 1109 +#define IDS_FILTER_SPC 1110 +#define IDS_ADD_CBA_CODE 1111 +#define IDS_FILTER_WAV 1112 +#define IDS_SELECT_WAV_NAME 1113 +#define IDC_FRAME_0 1113 +#define IDS_FILTER_GBROM 1114 +#define IDC_FRAME_1 1114 +#define IDC_BG0 1115 +#define IDS_FILTER_PAL 1115 +#define IDC_BG1 1116 +#define IDS_SELECT_PALETTE_NAME 1116 +#define IDC_BG2 1117 +#define IDS_SEARCH_PRODUCED_NO_RESULTS 1117 +#define IDC_BG3 1118 +#define IDS_ERROR_BINDING 1118 +#define IDS_ERROR_LISTENING 1119 +#define IDS_ERROR_CREATING_SOCKET 1120 +#define IDS_ACK_NOT_RECEIVED 1121 +#define IDS_ERROR_NOT_GBA_IMAGE 1122 +#define IDS_EEPROM_NOT_SUPPORTED 1123 +#define IDC_MAP_VIEW 1124 +#define IDS_FILTER_DUMP 1124 +#define IDC_PALETTE_VIEW 1125 +#define IDS_SELECT_DUMP_FILE 1125 +#define IDC_PALETTE_VIEW_OBJ 1126 +#define IDC_REFRESH 1126 +#define IDS_FILTER_AVI 1126 +#define IDC_SAVE 1127 +#define IDC_GOPC 1127 +#define IDS_SELECT_AVI_NAME 1127 +#define IDC_APPLY 1127 +#define IDS_INVALID_THROTTLE_VALUE 1128 +#define IDC_REFRESH2 1129 +#define IDS_FILTER_INI 1129 +#define IDS_SELECT_SKIN_FILE 1130 +#define IDC_CLOSE 1131 +#define IDS_FILTER_VMV 1131 +#define IDS_FILTER_MOVIE 1131 +#define IDS_SELECT_MOVIE_NAME 1132 +#define IDS_BUG_REPORT 1133 +#define IDS_UNSUPPORTED_MOVIE_VERSION 1134 +#define IDS_END_OF_MOVIE 1135 +#define IDC_COLOR 1136 +#define IDS_INVALID_INTERVAL_VALUE 1136 +#define IDC_SAVE_BG 1137 +#define IDS_REGISTRY 1137 +#define IDC_SAVE_OBJ 1138 +#define IDC_MAP_VIEW_ZOOM 1138 +#define IDS_MOVIE_PLAY 1138 +#define IDS_AUTOFIRE_DISABLED 1139 +#define IDC_VIEWER 1140 +#define IDS_AUTOFIRE_ALREADY_DISABLED 1140 +#define IDC_ADDRESSES 1141 +#define IDS_AUTOFIRE_START_DISABLED 1141 +#define IDS_AUTOFIRE_START 1142 +#define IDC_GO 1143 +#define IDS_AUTOFIRE_SELECT_DISABLED 1143 +#define IDC_8_BIT 1144 +#define IDS_AUTOFIRE_SELECT 1144 +#define IDC_16_BIT 1145 +#define IDS_AUTOFIRE_UP_DISABLED 1145 +#define IDC_32_BIT 1146 +#define IDS_AUTOFIRE_UP 1146 +#define IDC_OAM_VIEW 1147 +#define IDS_AUTOFIRE_DOWN_DISABLED 1147 +#define IDC_OAM_VIEW_ZOOM 1148 +#define IDS_AUTOFIRE_DOWN 1148 +#define IDS_AUTOFIRE_LEFT_DISABLED 1149 +#define IDC_SPRITE 1150 +#define IDS_AUTOFIRE_LEFT 1150 +#define IDC_POS 1151 +#define IDS_AUTOFIRE_RIGHT_DISABLED 1151 +#define IDC_MODE 1152 +#define IDS_AUTOFIRE_RIGHT 1152 +#define IDC_COLORS 1153 +#define IDC_MAPBASE 1153 +#define IDS_RERECORDED_STATE_N 1153 +#define IDC_PALETTE 1154 +#define IDC_CHARBASE 1154 +#define IDS_REPLAYED_STATE_N 1154 +#define IDC_TILE 1155 +#define IDC_DIM 1155 +#define IDC_PRIO 1156 +#define IDC_NUMCOLORS 1156 +#define IDC_SCROLLBAR 1157 +#define IDC_PRIORITY 1157 +#define IDC_MOSAIC 1158 +#define IDC_SIZE2 1159 +#define IDC_OVERFLOW 1159 +#define IDC_ROT 1160 +#define IDC_FLAGS 1161 +#define IDC_COMMANDS 1162 +#define IDC_BANK 1162 +#define IDC_CURRENTS 1163 +#define IDC_ASSIGN 1164 +#define IDC_RESET 1165 +#define IDC_EDIT_KEY 1166 +#define IDC_ALREADY_AFFECTED 1167 +#define IDC_TILE_VIEW 1168 +#define IDC_16_COLORS 1169 +#define IDC_256_COLORS 1170 +#define IDC_CHARBASE_0 1173 +#define IDC_CHARBASE_1 1174 +#define IDC_CHARBASE_2 1175 +#define IDC_CHARBASE_3 1176 +#define IDC_PALETTE_SLIDER 1177 +#define IDC_CHARBASE_4 1178 +#define IDC_COLOR_BG0 1178 +#define IDC_COLOR_BG1 1179 +#define IDC_URL 1179 +#define IDC_COLOR_BG2 1180 +#define IDC_STRETCH 1180 +#define IDC_COLOR_BG3 1181 +#define IDC_COLOR_OB0 1182 +#define IDC_COLOR_OB1 1183 +#define IDC_COLOR_OB2 1184 +#define IDC_COLOR_OB3 1185 +#define IDC_TRANSLATOR_URL 1186 +#define IDC_STATIC1 1187 +#define IDC_STATIC2 1188 +#define IDC_STATIC3 1189 +#define IDC_STATIC4 1190 +#define IDC_DEFAULT 1191 +#define IDC_USER1 1192 +#define IDC_USER2 1193 +#define IDC_DISASSEMBLE 1196 +#define IDC_AUTOMATIC 1199 +#define IDC_ARM 1200 +#define IDC_THUMB 1201 +#define IDC_RECNOW 1201 +#define IDC_RECRESET 1202 +#define IDC_JOYPAD1 1203 +#define IDC_RECSTART 1203 +#define IDC_REC_NOBIOS 1204 +#define IDC_AUTO_UPDATE 1204 +#define IDC_JOYPAD2 1204 +#define IDC_REC_EMUBIOS 1205 +#define IDC_JOYPAD3 1205 +#define IDC_REC_GBABIOS 1206 +#define IDC_JOYPAD4 1206 +#define IDC_REC_GBABIOSINTRO 1207 +#define IDC_MOVIE_FILENAME 1208 +#define IDC_N 1210 +#define IDC_LABEL_DATE 1210 +#define IDC_Z 1211 +#define IDC_LABEL_LENGTH 1211 +#define IDC_C 1212 +#define IDC_LABEL_FRAMES 1212 +#define IDC_V 1213 +#define IDC_LABEL_RERECORD 1213 +#define IDC_F 1214 +#define IDC_LABEL_FROM 1214 +#define IDC_I 1215 +#define IDC_T 1216 +#define IDC_LABEL_WARNING1 1216 +#define IDC_PORT 1217 +#define IDC_LABEL_WARNING2 1217 +#define IDC_VSCROLL 1218 +#define IDC_LABEL_FROM2 1218 +#define IDC_VERSION 1219 +#define IDC_VERBOSE_SWI 1223 +#define IDC_VERBOSE_UNALIGNED_ACCESS 1224 +#define IDC_VERBOSE_ILLEGAL_WRITE 1225 +#define IDC_VERBOSE_ILLEGAL_READ 1226 +#define IDC_LOG 1227 +#define IDC_CLEAR 1228 +#define IDC_VERBOSE_DMA0 1229 +#define IDC_VERBOSE_DMA1 1230 +#define IDC_TILE_NUMBER 1230 +#define IDC_VERBOSE_DMA2 1231 +#define IDC_XY 1231 +#define IDC_VERBOSE_DMA3 1232 +#define IDC_VERBOSE_UNDEFINED 1233 +#define IDC_TITLE 1234 +#define IDC_VERBOSE_AGBPRINT 1234 +#define IDC_CURRENT_ADDRESS 1235 +#define IDC_NOTES 1236 +#define IDC_CURRENT_ADDRESS_LABEL 1236 +#define IDC_LOAD 1238 +#define IDC_SIZE_CONTROL 1240 +#define IDC_MODES 1240 +#define IDC_DRIVERS 1241 +#define IDC_THROTTLE 1242 +#define IDC_READONLY 1242 +#define IDC_H 1243 +#define IDC_OAP 1244 +#define IDC_BANK_0 1245 +#define IDC_BANK_1 1246 +#define IDC_TIMER 1247 +#define IDC_INTERVAL 1248 +#define IDC_REWINDSLOTS 1249 +#define IDC_BIT_0 1250 +#define IDC_BIT_1 1251 +#define IDC_PREDEFINED 1251 +#define IDC_BIT_2 1252 +#define IDC_BUG_REPORT 1252 +#define IDC_BIT_3 1253 +#define IDC_COPY 1253 +#define IDC_BIT_4 1254 +#define IDC_BROWSE 1254 +#define IDC_BIT_5 1255 +#define IDC_COMBO1 1255 +#define IDC_MOVIE_REFRESH 1255 +#define IDC_BIT_6 1256 +#define IDC_REC_GBA 1257 +#define IDC_BIT_7 1257 +#define IDC_REC_GBC 1258 +#define IDC_BIT_8 1258 +#define IDC_REC_SGB 1259 +#define IDC_BIT_9 1259 +#define IDC_REC_SGB2 1260 +#define IDC_BIT_10 1260 +#define IDC_REC_GB 1260 +#define IDC_BIT_11 1261 +#define IDC_RADIO1 1261 +#define IDC_BIT_12 1262 +#define IDC_EDIT_PAUSEFRAME 1262 +#define IDC_BIT_13 1263 +#define IDC_CHECK_PAUSEFRAME 1263 +#define IDC_BIT_14 1264 +#define IDC_SLIDER1 1264 +#define IDC_BIT_15 1265 +#define IDC_CHECK_HIDEBORDER 1265 +#define IDC_RADIO_WHITE 1266 +#define IDC_RADIO_RED 1267 +#define IDC_RADIO_YELLOW 1268 +#define IDC_RADIO_GREEN 1269 +#define IDC_RADIO_CYAN 1270 +#define IDC_RADIO_BLUE 1271 +#define IDC_RADIO_MAGENTA 1272 +#define IDC_RADIO_BLACK 1273 +#define IDC_CHECK_OUTLINED 1274 +#define IDC_CHECK_TRANSPARENT 1275 +#define IDC_RADIO_PREFILTER 1276 +#define IDC_RADIO_POSTFILTER 1277 +#define IDC_RADIO_POSTRENDER 1278 +#define IDC_COMMANDS_HIDDEN 1279 +#define IDC_DECIMALDISPLAY 1281 +#define IDC_DECIMAL_DISPLAY 1281 +#define IDC_CHEATREFRESHBUTTON 1283 +#define IDC_CANCEL 1284 +#define ID_HELP_ABOUT 40001 +#define ID_FILE_EXIT 40002 +#define ID_OPTIONS_VIDEO_FRAMESKIP_0 40003 +#define ID_OPTIONS_VIDEO_FRAMESKIP_1 40004 +#define ID_OPTIONS_VIDEO_FRAMESKIP_2 40005 +#define ID_OPTIONS_VIDEO_FRAMESKIP_3 40006 +#define ID_OPTIONS_VIDEO_FRAMESKIP_4 40007 +#define ID_OPTIONS_VIDEO_FRAMESKIP_5 40008 +#define ID_OPTIONS_VIDEO_VSYNC 40009 +#define ID_OPTIONS_VIDEO_X1 40010 +#define ID_OPTIONS_VIDEO_X2 40011 +#define ID_OPTIONS_VIDEO_X3 40012 +#define ID_OPTIONS_VIDEO_X4 40013 +#define ID_FILE_PAUSE 40014 +#define ID_OPTIONS_EMULATOR_DIRECTORIES 40015 +#define ID_OPTIONS_JOYPAD 40016 +#define ID_OPTIONS_EMULATOR_SYNCHRONIZE 40017 +#define ID_FILE_RESET 40018 +#define ID_FILE_LOAD 40019 +#define ID_OPTIONS_SOUND_DIRECTSOUNDA 40020 +#define ID_OPTIONS_SOUND_DIRECTSOUNDB 40021 +#define ID_OPTIONS_SOUND_OFF 40022 +#define ID_OPTIONS_SOUND_MUTE 40023 +#define ID_OPTIONS_SOUND_ON 40024 +#define ID_OPTIONS_SOUND_CHANNEL1 40025 +#define ID_OPTIONS_SOUND_CHANNEL2 40026 +#define ID_OPTIONS_SOUND_CHANNEL3 40027 +#define ID_OPTIONS_SOUND_CHANNEL4 40028 +#define ID_OPTIONS_EMULATOR_USEBIOSFILE 40029 +#define ID_OPTIONS_EMULATOR_SELECTBIOSFILE 40030 +#define ID_CHEATS_SEARCHFORCHEATS 40031 +#define ID_CHEATS_ADDCHEAT 40032 +#define ID_OPTIONS_VIDEO_DISABLESFX 40033 +#define ID_OPTIONS_GAMEBOY_BORDER 40034 +#define ID_FILE_SAVEGAME_SLOT1 40035 +#define ID_FILE_SAVEGAME_SLOT2 40036 +#define ID_FILE_SAVEGAME_SLOT3 40037 +#define ID_FILE_SAVEGAME_SLOT4 40038 +#define ID_FILE_SAVEGAME_SLOT5 40039 +#define ID_FILE_SAVEGAME_SLOT6 40040 +#define ID_FILE_SAVEGAME_SLOT7 40041 +#define ID_FILE_SAVEGAME_SLOT8 40042 +#define ID_FILE_SAVEGAME_SLOT9 40043 +#define ID_FILE_SAVEGAME_SLOT10 40044 +#define ID_FILE_LOADGAME_SLOT1 40045 +#define ID_FILE_LOADGAME_SLOT2 40046 +#define ID_FILE_LOADGAME_SLOT3 40047 +#define ID_FILE_LOADGAME_SLOT4 40048 +#define ID_FILE_LOADGAME_SLOT5 40049 +#define ID_FILE_LOADGAME_SLOT6 40050 +#define ID_FILE_LOADGAME_SLOT7 40051 +#define ID_FILE_LOADGAME_SLOT8 40052 +#define ID_FILE_LOADGAME_SLOT9 40053 +#define ID_FILE_LOADGAME_SLOT10 40054 +#define ID_OPTIONS_GAMEBOY_AUTOMATIC 40057 +#define ID_OPTIONS_GAMEBOY_CGB 40058 +#define ID_OPTIONS_GAMEBOY_GBA 40059 +#define ID_OPTIONS_GAMEBOY_SGB 40060 +#define ID_OPTIONS_GAMEBOY_GB 40062 +#define ID_OPTIONS_GAMEBOY_REALCOLORS 40063 +#define ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS 40064 +#define ID_CHEATS_GAMEBOY 40065 +#define ID_OPTIONS_SOUND_11KHZ 40067 +#define ID_OPTIONS_SOUND_22KHZ 40068 +#define ID_OPTIONS_SOUND_44KHZ 40069 +#define ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY 40070 +#define ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY 40071 +#define ID_OPTIONS_PRIORITY_HIGHEST 40072 +#define ID_OPTIONS_PRIORITY_ABOVENORMAL 40073 +#define ID_OPTIONS_PRIORITY_NORMAL 40074 +#define ID_OPTIONS_PRIORITY_BELOWNORMAL 40075 +#define ID_OPTIONS_VIDEO_FULLSCREEN320X240 40076 +#define ID_OPTIONS_VIDEO_FULLSCREEN640X480 40077 +#define ID_OPTIONS_FILTER_NORMAL 40078 +#define ID_OPTIONS_FILTER_2XSAI 40079 +#define ID_OPTIONS_FILTER_SUPER2XSAI 40081 +#define ID_OPTIONS_FILTER_SUPEREAGLE 40082 +#define ID_OPTIONS_FILTER_TVMODE 40083 +#define ID_CHEATS_CHEATLIST 40084 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_A_OLD 40085 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_B_OLD 40086 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_L_OLD 40087 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_R_OLD 40088 +#define ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT 40089 +#define ID_OPTIONS_EMULATOR_ASSOCIATE 40091 +#define ID_OPTIONS_FILTER_DISABLEMMX 40093 +#define ID_OPTIONS_1X 40096 +#define ID_OPTIONS_2X 40097 +#define ID_OPTIONS_3X 40098 +#define ID_OPTIONS_4X 40099 +#define ID_FILE_ROMINFORMATION 40100 +#define ID_CHEATS_ADDCHEATCODE 40101 +#define ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES 40102 +#define ID_OPTIONS_JOYPAD_MOTIONCONFIGURE 40103 +#define ID_FILE_SCREENCAPTURE 40104 +#define ID_OPTIONS_LANGUAGE_SYSTEM 40105 +#define ID_OPTIONS_LANGUAGE_ENGLISH 40106 +#define ID_OPTIONS_LANGUAGE_OTHER 40107 +#define ID_OPTIONS_GAMEBOY_PRINTER 40108 +#define ID_FILE_RECENT_RESET 40109 +#define ID_CHEATS_SAVECHEATLIST 40110 +#define ID_CHEATS_LOADCHEATLIST 40111 +#define ID_CHEATS_AUTOMATICSAVELOADCHEATS 40112 +#define ID_FILE_IMPORT_GAMESHARKSNAPSHOT 40115 +#define ID_FILE_IMPORT_BATTERYFILE 40116 +#define ID_FILE_IMPORT_GAMESHARKCODEFILE 40117 +#define ID_FILE_EXPORT_BATTERYFILE 40118 +#define ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL 40121 +#define ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL 40122 +#define ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE 40124 +#define ID_OPTIONS_SOUND_STARTRECORDING 40125 +#define ID_OPTIONS_SOUND_STOPRECORDING 40126 +#define ID_OPTIONS_VIDEO_LAYERS_BG0 40127 +#define ID_OPTIONS_VIDEO_LAYERS_BG1 40128 +#define ID_OPTIONS_VIDEO_LAYERS_BG2 40129 +#define ID_OPTIONS_VIDEO_LAYERS_BG3 40130 +#define ID_OPTIONS_VIDEO_LAYERS_OBJ 40131 +#define ID_OPTIONS_VIDEO_LAYERS_WIN0 40132 +#define ID_OPTIONS_VIDEO_LAYERS_WIN1 40133 +#define ID_OPTIONS_VIDEO_LAYERS_OBJWIN 40134 +#define ID_FILE_OPENGAMEBOY 40135 +#define ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION 40136 +#define ID_DEBUG_NEXTFRAME 40137 +#define ID_TOOLS_MAPVIEW 40138 +#define ID_TOOLS_PALETTEVIEW 40139 +#define ID_OPTIONS_EMULATOR_PNGFORMAT 40140 +#define ID_OPTIONS_EMULATOR_BMPFORMAT 40141 +#define ID_TOOLS_CUSTOMIZE_COMMON 40142 +#define ID_TOOLS_MEMORYVIEWER 40143 +#define ID_TOOLS_OAMVIEWER 40144 +#define ID_TOOLS_TILEVIEWER 40146 +#define ID_OPTIONS_GAMEBOY_COLORS 40147 +#define ID_OPTIONS_SOUND_ECHO 40148 +#define ID_OPTIONS_SOUND_LOWPASSFILTER 40149 +#define ID_OPTIONS_SOUND_REVERSESTEREO 40150 +#define ID_TOOLS_DISASSEMBLE 40151 +#define ID_TOOLS_DEBUG_GDB 40152 +#define ID_TOOLS_DEBUG_LOADANDWAIT 40153 +#define ID_TOOLS_DEBUG_DISCONNECT 40154 +#define ID_TOOLS_DEBUG_BREAK 40155 +#define ID_TOOLS_LOGGING 40156 +#define ID_OPTIONS_EMULATOR_SPEEDHACK 40157 +#define ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE 40158 +#define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40159 +#define ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X 40160 +#define ID_OPTIONS_FILTER16BIT_SIMPLE2X 40161 +#define ID_FILE_RECENT_FREEZE 40162 +#define ID_FILE_EXPORT_GAMESHARKSNAPSHOT 40163 +#define ID_OPTIONS_VIDEO_FULLSCREEN800X600 40164 +#define ID_OPTIONS_VIDEO_FRAMESKIP_6 40165 +#define ID_OPTIONS_VIDEO_FRAMESKIP_7 40166 +#define ID_OPTIONS_VIDEO_FRAMESKIP_8 40167 +#define ID_OPTIONS_VIDEO_FRAMESKIP_9 40168 +#define ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC 40169 +#define ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM 40170 +#define ID_OPTIONS_EMULATOR_SAVETYPE_SRAM 40171 +#define ID_OPTIONS_EMULATOR_SAVETYPE_FLASH 40172 +#define ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR 40173 +#define ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K 40174 +#define ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M 40175 +#define ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH 40176 +#define ID_TOOLS_RECORD_STARTAVIRECORDING 40178 +#define ID_TOOLS_RECORD_STOPAVIRECORDING 40179 +#define ID_OPTIONS_SOUND_VOLUME_1X 40182 +#define ID_OPTIONS_SOUND_VOLUME_2X 40183 +#define ID_OPTIONS_SOUND_VOLUME_3X 40184 +#define ID_OPTIONS_SOUND_VOLUME_4X 40185 +#define ID_OPTIONS_FILTER_BILINEAR 40186 +#define ID_OPTIONS_FILTER_BILINEARPLUS 40187 +#define ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE 40188 +#define ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR 40189 +#define ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART 40190 +#define ID_OPTIONS_VIDEO_FULLSCREEN 40191 +#define ID_OPTIONS_VIDEO_TRIPLEBUFFERING 40192 +#define ID_OPTIONS_FRAMESKIP_AUTOMATIC 40194 +#define ID_OPTIONS_EMULATOR_SHOWSPEED_NONE 40195 +#define ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE 40196 +#define ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED 40197 +#define ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT 40198 +#define ID_OPTIONS_JOYPAD_CONFIGURE_1 40199 +#define ID_OPTIONS_JOYPAD_CONFIGURE_2 40200 +#define ID_OPTIONS_JOYPAD_CONFIGURE_3 40201 +#define ID_OPTIONS_JOYPAD_CONFIGURE_4 40202 +#define ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1 40208 +#define ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_2 40209 +#define ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_3 40210 +#define ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4 40211 +#define ID_OPTIONS_EMULATOR_STORESETTINGSINREGISTRY 40214 +#define ID_FILE_EXPORT_SETTINGSTOINI 40215 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE 40216 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER 40221 +#define ID_OPTIONS_FILTER_SCANLINES 40223 +#define ID_OPTIONS_VIDEO_RENDERMETHOD_GDI 40228 +#define ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW 40229 +#define ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D 40230 +#define ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL 40231 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER 40233 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR 40234 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DTRILINEAR 40235 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DANISOTROPIC 40236 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST 40237 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR 40238 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE 40239 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS 40240 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN 40245 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN 40246 +#define ID_OPTIONS_EMULATOR_AGBPRINT 40247 +#define ID_OPTIONS_EMULATOR_REALTIMECLOCK 40248 +#define ID_OPTIONS_GAMEBOY_SGB2 40249 +#define ID_SYSTEM_MINIMIZE 40250 +#define ID_TOOLS_RECORD_STARTMOVIERECORDING 40251 +#define ID_TOOLS_RECORD_STOPMOVIERECORDING 40252 +#define ID_TOOLS_PLAY_STARTMOVIEPLAYING 40253 +#define ID_TOOLS_PLAY_STOPMOVIEPLAYING 40254 +#define ID_OPTIONS_EMULATOR_AUTOHIDEMENU 40255 +#define ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC 40256 +#define ID_OPTIONS_EMULATOR_REWIND 40257 +#define ID_TOOLS_REWIND 40258 +#define ID_OPTIONS_EMULATOR_SKIPBIOS 40259 +#define ID_HELP_BUGREPORT 40260 +#define ID_HELP_FAQ 40261 +#define ID_OPTIONS_EMULATOR_REWINDINTERVAL 40262 +#define ID_FILE_TOGGLEMENU 40263 +#define ID_OPTIONS_EMULATOR_SAVETYPE_NONE 40264 +#define ID_OPTIONS_EMULATOR_SAVETYPE_ENHANCEDDETECTION 40265 +#define ID_TOOLS_IOVIEWER 40266 +#define ID_OPTIONS_SOUND_VOLUME_5X 40270 +#define ID_OPTIONS_SOUND_VOLUME_25X 40271 +#define ID_CHEATS_DISABLECHEATS 40272 +#define ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE 40273 +#define ID_OPTIONS_FILTER_LQ2X 40275 +#define ID_OPTIONS_FILTER_HQ2X 40276 +#define ID_OPTIONS_FILTER_HQ2X2 40277 +#define ID_OPTIONS_FILTER_HQ3X 40278 +#define ID_OPTIONS_FILTER_HQ3X2 40279 +#define ID_OPTIONS_FRAMESKIP_ACCURATEPITCH 40289 +#define ID_OPTIONS_FRAMESKIP_ACCURATESPEED 40290 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_6 40324 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_25 40326 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_37 40327 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_50 40328 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_75 40329 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_87 40330 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_100 40331 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_112 40332 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_125 40333 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_150 40334 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_200 40335 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_300 40336 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_15 40337 +#define ID_TOOLS_FRAMECOUNTER 40341 +#define ID_TOOLS_INPUTDISPLAY 40342 +#define ID_Menu 40361 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE 40364 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE 40365 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_A 40366 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_B 40367 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_L 40368 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_R 40369 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_START 40370 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT 40371 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_UP 40372 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN 40373 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT 40374 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT 40375 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR 40376 +#define ID_OPTIONS_SOUND_MUTEFRAMEADVANCE 40378 +#define ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT 40382 +#define ID_TOOLS_PLAY_READONLY 40385 +#define ID_TOOLS_PLAY_RESTART 40387 +#define ID_TOOLS_PLAY_CONTINUE 40388 +#define ID_FILE_LOADGAME_AUTOLOADMOSTRECENT 40393 +#define ID_EMULATOR_GBALAG 40394 +#define ID_EMULATOR_USEOLDGBTIMING 40395 +#define ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS 40397 +#define ID_STICKY_A 40399 +#define ID_STICKY_B 40400 +#define ID_STICKY_R 40402 +#define ID_STICKY_START 40403 +#define ID_STICKY_SELECT 40404 +#define ID_STICKY_UP 40405 +#define ID_STICKY_DOWN 40406 +#define ID_STICKY_LEFT 40407 +#define ID_STICKY_RIGHT 40408 +#define ID_STICKY_L 40410 +#define ID_STICKY_CLEAR 40412 +#define ID_FILE_SAVEGAME_DECREMENTSLOT 40416 +#define ID_Menu40417 40417 +#define ID_FILE_LOADGAME_MOSTRECENT 40420 +#define ID_FILE_LOADGAME_CURRENT 40423 +#define ID_FILE_LOADGAME_MAKECURRENT 40424 +#define ID_FILE_SAVEGAME_CURRENT 40427 +#define ID_FILE_SAVEGAME_MAKECURRENT 40428 +#define ID_FILE_SAVEGAME_OLDESTSLOT 40429 +#define ID_FILE_SAVEGAME_INCREMENTSLOT 40430 +#define ID_FILE_LOADGAME_MAKERECENT 40431 +#define ID_DEBUG_FRAMESEARCH 40432 +#define ID_DEBUG_FRAMESEARCHLOAD 40438 +#define ID_DEBUG_FRAMESEARCHPREV 40439 +#define ID_SELECT_SLOT1 40440 +#define ID_SELECT_SLOT2 40441 +#define ID_SELECT_SLOT3 40442 +#define ID_SELECT_SLOT4 40443 +#define ID_SELECT_SLOT5 40444 +#define ID_SELECT_SLOT6 40445 +#define ID_SELECT_SLOT7 40446 +#define ID_SELECT_SLOT8 40447 +#define ID_SELECT_SLOT9 40448 +#define ID_SELECT_SLOT10 40449 +#define ID_TOOLS_DEBUG 40450 +#define ID_TOOLS_CUSTOMIZE 40452 +#define ID_OPTIONS_SPEED 40453 +#define ID_SPEED_BLA 40454 +#define ID_SPEED_FRAMESKIP 40455 +#define ID_FRAMESKIP_BLA 40456 +#define ID_SPEED_SETSPEED 40457 +#define ID_SETSPEED_BLA 40458 +#define ID_SOUND_SOUNDCHANNELS 40459 +#define ID_CHEATS_PAUSEDURINGCHEATSEARCH 40463 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 40464 +#define _APS_NEXT_CONTROL_VALUE 1285 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/src/win32/skin.cpp b/src/win32/skin.cpp new file mode 100644 index 0000000..6fc76f5 --- /dev/null +++ b/src/win32/skin.cpp @@ -0,0 +1,588 @@ +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +// +// WINDOWS SKINNING TUTORIAL - by Vander Nunes - virtware.net +// This is the source-code that shows what is discussed in the tutorial. +// The code is simplified for the sake of clarity, but all the needed +// features for handling skinned windows is present. Please read +// the article for more information. +// +// skin.cpp : CSkin class implementation +// 28/02/2002 : initial release. +// +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +#include "stdafx.h" +#include "skin.h" +#include +#include "xImage.h" + +#include "../System.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +// ---------------------------------------------------------------------------- +// constructor 1 - use it when you have not already created the app window. +// this one will not subclass automatically, you must call Hook() and Enable() +// to subclass the app window and enable the skin respectively. +// will throw an exception if unable to initialize skin from resource. +// ---------------------------------------------------------------------------- + +CSkin::CSkin() +{ + // default starting values + m_bHooked = false; + m_OldWndProc = NULL; + + m_rect.top = 0; + m_rect.bottom = 0; + m_rect.right = 0; + m_rect.left = 0; + + m_dOldStyle = 0; + + m_oldRect = m_rect; + m_nButtons = 0; + m_buttons = NULL; +} + +// ---------------------------------------------------------------------------- +// destructor - just call the destroyer +// ---------------------------------------------------------------------------- +CSkin::~CSkin() +{ + Destroy(); +} + +HBITMAP CSkin::LoadImage(const char *filename) +{ + CxImage image; + image.Load(filename); + if(!image.IsValid()) { + return NULL; + } + + return image.MakeBitmap(NULL); +} + +// ---------------------------------------------------------------------------- +// Initialize the skin +// ---------------------------------------------------------------------------- +bool CSkin::Initialize(const char *skinFile) +{ + // try to retrieve the skin data from resource. + bool res = GetSkinData(skinFile); + if(!res) + systemMessage(0, m_error); + return res; +} + +// ---------------------------------------------------------------------------- +// destroy skin resources and free allocated resources +// ---------------------------------------------------------------------------- +void CSkin::Destroy() +{ + if (m_buttons) { + delete[] m_buttons; + m_buttons = NULL; + } + + // unhook the window + UnHook(); + + // free bitmaps and device context + if (m_dcSkin) { SelectObject(m_dcSkin, m_hOldBmp); DeleteDC(m_dcSkin); m_dcSkin = NULL; } + if (m_hBmp) { DeleteObject(m_hBmp); m_hBmp = NULL; } + + // free skin region + if (m_rgnSkin) { DeleteObject(m_rgnSkin); m_rgnSkin = NULL; } + +} + + + +// ---------------------------------------------------------------------------- +// toggle skin on/off - must be Hooked() before attempting to enable skin. +// ---------------------------------------------------------------------------- +bool CSkin::Enable(bool bEnable) +{ + // refuse to enable if there is no window subclassed yet. + if (!Hooked()) return false; + + // toggle + m_bEnabled = bEnable; + + // force window repainting + InvalidateRect(m_hWnd, NULL, TRUE); + + return true; +} + + + +// ---------------------------------------------------------------------------- +// tell if the skinning is enabled +// ---------------------------------------------------------------------------- +bool CSkin::Enabled() +{ + return m_bEnabled; +} + + + +// ---------------------------------------------------------------------------- +// hook a window +// ---------------------------------------------------------------------------- +bool CSkin::Hook(CWnd *pWnd) +{ + // unsubclass any other window + if (Hooked()) UnHook(); + + // this will be our new subclassed window + m_hWnd = (HWND)*pWnd; + + // -------------------------------------------------- + // change window style (get rid of the caption bar) + // -------------------------------------------------- + DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE); + m_dOldStyle = dwStyle; + dwStyle &= ~(WS_CAPTION|WS_SIZEBOX); + SetWindowLong(m_hWnd, GWL_STYLE, dwStyle); + + RECT r; + pWnd->GetWindowRect(&r); + m_oldRect = r; + pWnd->MoveWindow(r.left, + r.top, + m_iWidth, + m_iHeight, + FALSE); + + pWnd->SetMenu(NULL); + + if(m_rgnSkin != NULL) + // set the skin region to the window + pWnd->SetWindowRgn(m_rgnSkin, true); + + // subclass the window procedure + m_OldWndProc = (WNDPROC)SetWindowLong(m_hWnd, GWL_WNDPROC, (LONG)SkinWndProc); + + // store a pointer to our class instance inside the window procedure. + if (!SetProp(m_hWnd, "skin", (void*)this)) + { + // if we fail to do so, we just can't activate the skin. + UnHook(); + return false; + } + + + // update flag + m_bHooked = ( m_OldWndProc ? true : false ); + + for(int i = 0; i < m_nButtons; i++) { + RECT r; + m_buttons[i].GetRect(r); + m_buttons[i].CreateButton("", WS_VISIBLE, r, pWnd, 0); + } + + // force window repainting + RedrawWindow(NULL,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); + + // successful return if we're hooked. + return m_bHooked; +} + + + +// ---------------------------------------------------------------------------- +// unhook the window +// ---------------------------------------------------------------------------- +bool CSkin::UnHook() +{ + // just to be safe we'll check this + WNDPROC OurWnd; + + // cannot unsubclass if there is no window subclassed + // returns true anyways. + if (!Hooked()) return true; + + if(m_rgnSkin != NULL) + // remove the skin region from the window + SetWindowRgn(m_hWnd, NULL, true); + + // unsubclass the window procedure + OurWnd = (WNDPROC)SetWindowLong(m_hWnd, GWL_WNDPROC, (LONG)m_OldWndProc); + + // remove the pointer to our class instance, but if we fail we don't care. + RemoveProp(m_hWnd, "skin"); + + // update flag - if we can't get our window procedure address again, + // we failed to unhook the window. + m_bHooked = ( OurWnd ? false : true ); + + SetWindowLong(m_hWnd, GWL_STYLE, m_dOldStyle); + + RECT r; + + GetWindowRect(m_hWnd, &r); + + MoveWindow(m_hWnd, + r.left, + r.top, + m_oldRect.right - m_oldRect.left, + m_oldRect.bottom - m_oldRect.top, + FALSE); + + // force window repainting + RedrawWindow(NULL,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); + + // successful return if we're unhooked. + return !m_bHooked; +} + + + +// ---------------------------------------------------------------------------- +// tell us if there is a window subclassed +// ---------------------------------------------------------------------------- +bool CSkin::Hooked() +{ + return m_bHooked; +} + + + +// ---------------------------------------------------------------------------- +// return the skin bitmap width +// ---------------------------------------------------------------------------- +int CSkin::Width() +{ + return m_iWidth; +} + + + +// ---------------------------------------------------------------------------- +// return the skin bitmap height +// ---------------------------------------------------------------------------- +int CSkin::Height() +{ + return m_iHeight; +} + + + +// ---------------------------------------------------------------------------- +// return the skin device context +// ---------------------------------------------------------------------------- +HDC CSkin::HDC() +{ + return m_dcSkin; +} + +bool CSkin::ParseRect(char *buffer, RECT& rect) +{ + char *token = strtok(buffer, ","); + + if(token == NULL) + return false; + rect.left = atoi(token); + + token = strtok(NULL, ","); + if(token == NULL) + return false; + rect.top = atoi(token); + + token = strtok(NULL, ","); + if(token == NULL) + return false; + rect.right = rect.left + atoi(token); + + token = strtok(NULL, ","); + if(token == NULL) + return false; + rect.bottom = rect.top + atoi(token); + + token = strtok(NULL, ","); + if(token != NULL) + return false; + + return true; +} + +HRGN CSkin::LoadRegion(const char *rgn) +{ + // ------------------------------------------------- + // then, we retrieve the skin region from resource. + // ------------------------------------------------- + FILE *f = fopen(rgn, "rb"); + if(!f) return NULL; + + fseek(f, 0, SEEK_END); + int size = ftell(f); + LPRGNDATA pSkinData = (LPRGNDATA)malloc(size); + if(!pSkinData) { + fclose(f); + return NULL; + } + + fseek(f, 0, SEEK_SET); + + fread(pSkinData, 1, size, f); + + fclose(f); + + // create the region using the binary data. + HRGN r = ExtCreateRegion(NULL, size, pSkinData); + + // free the allocated resource + free(pSkinData); + + return r; +} + +// ---------------------------------------------------------------------------- +// skin retrieval helper +// ---------------------------------------------------------------------------- +bool CSkin::GetSkinData(const char *skinFile) +{ + // ------------------------------------------------- + // retrieve the skin bitmap from resource. + // ------------------------------------------------- + + char buffer[2048]; + + if(!GetPrivateProfileString("skin", "image", "", buffer, 2048, skinFile)) { + m_error = "Missing skin bitmap"; + return false; + } + CString bmpName = buffer; + CString rgn = ""; + if(GetPrivateProfileString("skin", "region", "", buffer, 2048, skinFile)) { + rgn = buffer; + } + + if(!GetPrivateProfileString("skin", "draw", "", buffer, 2048, skinFile)) { + m_error = "Missing draw rectangle"; + return false; + } + + if(!ParseRect(buffer, m_rect)) { + m_error = "Invalid draw rectangle"; + return false; + } + + m_nButtons = GetPrivateProfileInt("skin", "buttons", 0, skinFile); + + if(m_nButtons) { + m_buttons = new SkinButton[m_nButtons]; + for(int i = 0; i < m_nButtons; i++) { + if(!ReadButton(skinFile, i)) + return false; + } + } + + CString path = skinFile; + int index = path.ReverseFind('\\'); + if(index != -1) { + path = path.Left(index+1); + } + + bmpName = path + bmpName; + if(strcmp(rgn, "")) + rgn = path + rgn; + + m_hBmp = LoadImage(bmpName); + + if (!m_hBmp) { + m_error = "Error loading skin bitmap " + bmpName; + return false; + } + + // get skin info + BITMAP bmp; + GetObject(m_hBmp, sizeof(bmp), &bmp); + + // get skin dimensions + m_iWidth = bmp.bmWidth; + m_iHeight = bmp.bmHeight; + + if(strcmp(rgn, "")) { + m_rgnSkin = LoadRegion(rgn); + if(m_rgnSkin == NULL) { + m_error = "Error loading skin region " + rgn; + return false; + } + } + + // ------------------------------------------------- + // well, things are looking good... + // as a quick providence, just create and keep + // a device context for our later blittings. + // ------------------------------------------------- + + // create a context compatible with the user desktop + m_dcSkin = CreateCompatibleDC(0); + if (!m_dcSkin) return false; + + // select our bitmap + m_hOldBmp = (HBITMAP)SelectObject(m_dcSkin, m_hBmp); + + + // ------------------------------------------------- + // done + // ------------------------------------------------- + return true; +} + +bool CSkin::ReadButton(const char *skinFile, int num) +{ + char buffer[2048]; + + CString path = skinFile; + int index = path.ReverseFind('\\'); + if(index != -1) { + path = path.Left(index+1); + } + sprintf(buffer, "button-%d", num); + CString name = buffer; + + if(!GetPrivateProfileString(name, "normal", "", buffer, 2048, skinFile)) { + m_error = "Missing button bitmap for " + name; + return false; + } + + CString normalBmp = path + buffer; + + HBITMAP bmp = LoadImage(normalBmp); + if(!bmp) { + m_error = "Error loading button bitmap " + normalBmp; + return false; + } + m_buttons[num].SetNormalBitmap(bmp); + + if(!GetPrivateProfileString(name, "down", "", buffer, 2048, skinFile)) { + m_error = "Missing button down bitmap " + name; + return false; + } + + CString downBmp = path + buffer; + + bmp = LoadImage(downBmp); + + if (!bmp) { + m_error = "Error loading button down bitmap " + downBmp; + return false; + } + m_buttons[num].SetDownBitmap(bmp); + + if(GetPrivateProfileString(name, "over", "", buffer, 2048, skinFile)) { + CString overBmp = path + buffer; + + bmp = LoadImage(overBmp); + + if (!bmp) { + m_error = "Error loading button over bitmap " + overBmp; + return false; + } + m_buttons[num].SetOverBitmap(bmp); + } + + if(GetPrivateProfileString(name, "region", "", buffer, 2048, skinFile)) { + CString region = path + buffer; + + HRGN rgn = LoadRegion(region); + if(!rgn) { + m_error = "Error loading button region " + region; + return false; + } + m_buttons[num].SetRegion(rgn); + } + + if(!GetPrivateProfileString(name, "id", "", buffer, 2048, skinFile)) { + "Missing button ID for " + name; + return false; + } + m_buttons[num].SetId(buffer); + + if(!GetPrivateProfileString(name, "rect", "", buffer, 2048, skinFile)) { + m_error = "Missing button rectangle for " + name; + return false; + } + + RECT r; + if(!ParseRect(buffer, r)) { + m_error = "Invalid button rectangle for " + name; + return false; + } + m_buttons[num].SetRect(r); + + return true; +} + +// ------------------------------------------------------------------------ +// Default skin window procedure. +// Here the class will handle WM_PAINT and WM_LBUTTONDOWN, originally sent +// to the application window, but now subclassed. Any other messages will +// just pass through the procedure and reach the original app procedure. +// ------------------------------------------------------------------------ +LRESULT CALLBACK SkinWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) +{ + // we will need a pointer to the associated class instance + // (it was stored in the window before, remember?) + CSkin *pSkin = (CSkin*)GetProp(hWnd, "skin"); + + // to handle WM_PAINT + PAINTSTRUCT ps; + + // if we fail to get our class instance, we can't handle anything. + if (!pSkin) return DefWindowProc(hWnd,uMessage,wParam,lParam); + + switch(uMessage) + { + case WM_WINDOWPOSCHANGING: + { + LPWINDOWPOS pos = (LPWINDOWPOS)lParam; + pos->cx = pSkin->Width(); + pos->cy = pSkin->Height(); + return 0L; + } + break; + + case WM_PAINT: + { + // --------------------------------------------------------- + // here we just need to blit our skin + // directly to the device context + // passed by the painting message. + // --------------------------------------------------------- + BeginPaint(hWnd,&ps); + + // blit the skin + BitBlt(ps.hdc,0,0,pSkin->Width(),pSkin->Height(),pSkin->HDC(),0,0,SRCCOPY); + + EndPaint(hWnd,&ps); + break; + } + + case WM_LBUTTONDOWN: + { + // --------------------------------------------------------- + // this is a common trick for easy dragging of the window. + // this message fools windows telling that the user is + // actually dragging the application caption bar. + // --------------------------------------------------------- + SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION,NULL); + break; + } + + } + + // --------------------------------------------------------- + // call the default window procedure to keep things going. + // --------------------------------------------------------- + return CallWindowProc(pSkin->m_OldWndProc, hWnd, uMessage, wParam, lParam); +} diff --git a/src/win32/skin.h b/src/win32/skin.h new file mode 100644 index 0000000..69d3832 --- /dev/null +++ b/src/win32/skin.h @@ -0,0 +1,162 @@ +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +// +// WINDOWS SKINNING TUTORIAL - by Vander Nunes - virtware.net +// This is the source-code that shows what is discussed in the tutorial. +// The code is simplified for the sake of clarity, but all the needed +// features for handling skinned windows is present. Please read +// the article for more information. +// +// skin.h : CSkin class declaration +// 28/02/2002 : initial release. +// +// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + +#ifndef _SKIN_H_ + +#define _SKIN_H_ + +#include "skinButton.h" + + + +// -------------------------------------------------------------------------- +// The CSkin class will load the skin from a resource +// and subclass the associated window, so that the +// WM_PAINT message will be redirected to the provided +// window procedure. All the skin handling will be automatized. +// -------------------------------------------------------------------------- + +class CSkin +{ + + // -------------------------------------------------------------------------- + // the skin window procedure, where the class + // will handle WM_PAINT and WM_LBUTTONDOWN automatically. + // -------------------------------------------------------------------------- + friend LRESULT CALLBACK SkinWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam); + + private: + + // the associated window handle + HWND m_hWnd; + + // the old window procedure + WNDPROC m_OldWndProc; + + // skin region + HRGN m_rgnSkin; + + // the internal skin device context handle + HDC m_dcSkin; + + // bitmap and old bitmap from the device context + HBITMAP m_hBmp, m_hOldBmp; + + // skin dimensions + int m_iWidth, m_iHeight; + + // on|off toggle + bool m_bEnabled; + + // tell the class if it has a window subclassed. + bool m_bHooked; + + // skin retrieval helper + bool GetSkinData(const char *skin); + + RECT m_rect; + + DWORD m_dOldStyle; + RECT m_oldRect; + int m_nButtons; + SkinButton *m_buttons; + CString m_error; + + public: + + // ---------------------------------------------------------------------------- + // constructor 1 - use it when you have not already created the app window. + // this one will not subclass automatically, you must call Hook() to subclass. + // will throw an exception if unable to initialize skin from resource. + // ---------------------------------------------------------------------------- + + CSkin(); + + // ---------------------------------------------------------------------------- + // destructor - just call the destroyer + // ---------------------------------------------------------------------------- + + virtual ~CSkin(); + + // ---------------------------------------------------------------------------- + // Initialize the skin + // ---------------------------------------------------------------------------- + bool Initialize(const char *); + + + // ---------------------------------------------------------------------------- + // destroy skin resources and free allocated resources + // ---------------------------------------------------------------------------- + + void Destroy(); + + // ---------------------------------------------------------------------------- + // subclass a window. + // ---------------------------------------------------------------------------- + + bool Hook(CWnd *pWnd); + + // ---------------------------------------------------------------------------- + // unsubclass the subclassed window. + // ---------------------------------------------------------------------------- + + bool UnHook(); + + // ---------------------------------------------------------------------------- + // tell us if we have a window subclassed. + // ---------------------------------------------------------------------------- + + bool Hooked(); + + // ---------------------------------------------------------------------------- + // toggle skin on/off. + // ---------------------------------------------------------------------------- + + bool Enable(bool bEnable); + + // ---------------------------------------------------------------------------- + // tell if the skinning is enabled + // ---------------------------------------------------------------------------- + + bool Enabled(); + + // ---------------------------------------------------------------------------- + // return the skin bitmap width. + // ---------------------------------------------------------------------------- + + int Width(); + + // ---------------------------------------------------------------------------- + // return the skin bitmap height. + // ---------------------------------------------------------------------------- + + int Height(); + + // Return blit rect + RECT &GetBlitRect() { return m_rect; } + + // ---------------------------------------------------------------------------- + // return the skin device context. + // ---------------------------------------------------------------------------- + + HDC HDC(); + + private: + HBITMAP LoadImage(const char *); + bool ReadButton(const char *, int); + static bool ParseRect(char *, RECT &); + static HRGN LoadRegion(const char *); +}; + +#endif diff --git a/src/win32/skinButton.cpp b/src/win32/skinButton.cpp new file mode 100644 index 0000000..d17dbd9 --- /dev/null +++ b/src/win32/skinButton.cpp @@ -0,0 +1,328 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// skinButton.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "skinButton.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern bool winAccelGetID(const char *command, WORD& id); + +///////////////////////////////////////////////////////////////////////////// +// SkinButton + +SkinButton::SkinButton() +{ + normalBmp = NULL; + downBmp = NULL; + overBmp = NULL; + mouseOver = false; + id = ""; + idCommand = 0; + region = NULL; + buttonMask = 0; + menu = -1; +} + +SkinButton::~SkinButton() +{ + DestroyWindow(); + if(normalBmp) { + DeleteObject(normalBmp); + normalBmp = NULL; + } + if(downBmp) { + DeleteObject(downBmp); + downBmp = NULL; + } + if(overBmp) { + DeleteObject(overBmp); + overBmp = NULL; + } + if(region) { + DeleteObject(region); + region = NULL; + } +} + + +BEGIN_MESSAGE_MAP(SkinButton, CWnd) + //{{AFX_MSG_MAP(SkinButton) + ON_WM_ERASEBKGND() + ON_WM_PAINT() + ON_WM_KILLFOCUS() + ON_WM_CAPTURECHANGED() + ON_WM_CONTEXTMENU() + //}}AFX_MSG_MAP + ON_MESSAGE(WM_LBUTTONUP, OnLButtonUpMsg) + ON_MESSAGE(WM_LBUTTONDOWN, OnLButtonDownMsg) + ON_MESSAGE(WM_MOUSEMOVE, OnMouseMoveMsg) + ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeaveMsg) + END_MESSAGE_MAP() + + + ///////////////////////////////////////////////////////////////////////////// +// SkinButton message handlers + +BOOL SkinButton::OnEraseBkgnd(CDC* pDC) +{ + return TRUE; +} + +void SkinButton::OnPaint() +{ + PAINTSTRUCT ps; + HDC hDC = ::BeginPaint(m_hWnd, &ps); + HDC memDC = ::CreateCompatibleDC(hDC); + UINT state = ::SendMessage(m_hWnd, BM_GETSTATE, 0, 0); + HBITMAP oldBitmap; + if(state & BST_PUSHED) + oldBitmap = (HBITMAP)SelectObject(memDC, downBmp); + else if(mouseOver && overBmp != NULL) + oldBitmap = (HBITMAP)SelectObject(memDC, overBmp); + else + oldBitmap = (HBITMAP)SelectObject(memDC, normalBmp); + SelectClipRgn(hDC, region); + BitBlt(hDC, 0, 0, theApp.rect.right - theApp.rect.left, + theApp.rect.bottom - theApp.rect.top, memDC, 0, 0, SRCCOPY); + SelectClipRgn(hDC, NULL); + SelectObject(memDC, oldBitmap); + DeleteDC(memDC); + + ::EndPaint(m_hWnd, &ps); +} + +LRESULT SkinButton::OnLButtonUpMsg(WPARAM wParam, LPARAM lParam) +{ + POINT pt; + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + RECT r; + GetClientRect(&r); + BOOL inside = PtInRect(&r, pt); + if(region != NULL) + inside &= PtInRegion(region, pt.x, pt.y); + if(inside) { + HWND hWnd = m_hWnd; + if(idCommand != 0) + GetParent()->SendMessage(WM_COMMAND, idCommand, 0); + else if(buttonMask) + theApp.skinButtons = 0; + else if(menu != -1) { + HMENU m = GetSubMenu(theApp.menu, menu); + pt.x = r.left; + pt.y = r.bottom; + ClientToScreen(&pt); + theApp.m_pMainWnd->SendMessage(WM_INITMENUPOPUP, (WPARAM)m, menu); + TrackPopupMenu(m, 0, pt.x, pt.y, 0, *theApp.m_pMainWnd, NULL); + } + + return ::DefWindowProc(hWnd, WM_LBUTTONUP, wParam, lParam); + } + return GetParent()->SendMessage(WM_LBUTTONUP, wParam, lParam); +} + +LRESULT SkinButton::OnLButtonDownMsg(WPARAM wParam, LPARAM lParam) +{ + if(idCommand != 0) + return Default(); + + POINT pt; + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + RECT r; + GetClientRect(&r); + BOOL inside = PtInRect(&r, pt); + if(region != NULL) + inside &= PtInRegion(region, pt.x, pt.y); + if(inside) { + if(buttonMask) + theApp.skinButtons = buttonMask; + return Default(); + } + return GetParent()->SendMessage(WM_LBUTTONDOWN, wParam, lParam); +} + +LRESULT SkinButton::OnMouseMoveMsg(WPARAM wParam, LPARAM lParam) +{ + if(wParam & MK_LBUTTON && !mouseOver) + return Default(); + + if(GetCapture() != this) { + SetCapture(); + } + POINT pt; + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + // ClientToScreen(getHandle(), &p); + RECT r; + GetClientRect(&r); + BOOL inside = PtInRect(&r, pt); + if(region != NULL) + inside &= PtInRegion(region, pt.x, pt.y); + + if(!inside) { + // HWND h = WindowFromPoint(p); + // if(h != getHandle()) { + if(mouseOver) { + mouseOver = false; + Invalidate(); + } + if(!(wParam & MK_LBUTTON)) + ReleaseCapture(); + } else { + if(!mouseOver) { + mouseOver = true; + Invalidate(); + } + } + return Default(); +} + +void SkinButton::OnKillFocus(CWnd* pNewWnd) +{ + mouseOver = false; + Invalidate(); + + CWnd::OnKillFocus(pNewWnd); +} + +void SkinButton::OnCaptureChanged(CWnd *pWnd) +{ + if(mouseOver) { + ReleaseCapture(); + Invalidate(); + } + + CWnd::OnCaptureChanged(pWnd); +} + +LRESULT SkinButton::OnMouseLeaveMsg(WPARAM wParam, LPARAM lParam) +{ + if(mouseOver) { + ReleaseCapture(); + mouseOver = false; + Invalidate(); + } + + return Default(); +} + +void SkinButton::OnContextMenu(CWnd* pWnd, CPoint point) +{ +} + +void SkinButton::SetNormalBitmap(HBITMAP bmp) +{ + normalBmp = bmp; +} + +void SkinButton::SetDownBitmap(HBITMAP bmp) +{ + downBmp = bmp; +} + +void SkinButton::SetOverBitmap(HBITMAP bmp) +{ + overBmp = bmp; +} + +void SkinButton::SetRect(const RECT& r) +{ + rect = r; +} + +void SkinButton::SetId(const char *id) +{ + this->id = id; + if(!winAccelGetID(id, idCommand)) { + if(!strcmp(id, "A")) + buttonMask = 1; + else if(!strcmp("B", id)) + buttonMask = 2; + else if(!strcmp("SEL", id)) + buttonMask = 4; + else if(!strcmp("START", id)) + buttonMask = 8; + else if(!strcmp("R", id)) + buttonMask = 16; + else if(!strcmp("L", id)) + buttonMask = 32; + else if(!strcmp("U", id)) + buttonMask = 64; + else if(!strcmp("D", id)) + buttonMask = 128; + else if(!strcmp("BR", id)) + buttonMask = 256; + else if(!strcmp("BL", id)) + buttonMask = 512; + else if(!strcmp("SPEED", id)) + buttonMask = 1024; + else if(!strcmp("CAPTURE", id)) + buttonMask = 2048; + else if(!strcmp("GS", id)) + buttonMask = 4096; + else if(!strcmp("UR", id)) + buttonMask = 64+16; + else if(!strcmp("UL", id)) + buttonMask = 64+32; + else if(!strcmp("DR", id)) + buttonMask = 128+16; + else if(!strcmp("DL", id)) + buttonMask = 128+32; + else if(!strcmp("MENUFILE", id)) + menu = 0; + else if(!strcmp("MENUOPTIONS", id)) + menu = 1; + else if(!strcmp("MENUCHEATS", id)) + menu = 2; + else if(!strcmp("MENUTOOLS", id)) + menu = 3; + else if(!strcmp("MENUHELP", id)) + menu = 4; + } +} + +void SkinButton::SetRegion(HRGN rgn) +{ + region = rgn; +} + +void SkinButton::GetRect(RECT& r) +{ + r = rect; +} + +BOOL SkinButton::CreateButton(const char *name, DWORD style, const RECT& r, + CWnd *parent, UINT id) +{ + return CWnd::Create("BUTTON", + name, + style|WS_CHILDWINDOW, + r, + parent, + id); +} diff --git a/src/win32/skinButton.h b/src/win32/skinButton.h new file mode 100644 index 0000000..8fa7312 --- /dev/null +++ b/src/win32/skinButton.h @@ -0,0 +1,93 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#if !defined(AFX_SKINBUTTON_H__E51B4507_EAD7_43EE_9F54_204BC485D59C__INCLUDED_) +#define AFX_SKINBUTTON_H__E51B4507_EAD7_43EE_9F54_204BC485D59C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// skinButton.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// SkinButton window + +class SkinButton : public CWnd +{ + // Construction + public: + SkinButton(); + + // Attributes + private: + HBITMAP normalBmp; + HBITMAP downBmp; + HBITMAP overBmp; + RECT rect; + bool mouseOver; + CString id; + HRGN region; + WORD idCommand; + int buttonMask; + int menu; + + // Operations + public: + BOOL CreateButton(const char *, DWORD, const RECT&, CWnd *, UINT); + + void SetNormalBitmap(HBITMAP); + void SetDownBitmap(HBITMAP); + void SetOverBitmap(HBITMAP); + void SetRect(const RECT &); + void GetRect(RECT& r); + void SetId(const char *); + void SetRegion(HRGN); + + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(SkinButton) + //}}AFX_VIRTUAL + + // Implementation + public: + afx_msg LRESULT OnMouseLeaveMsg(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnMouseMoveMsg(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnLButtonDownMsg(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnLButtonUpMsg(WPARAM wParam, LPARAM lParam); + virtual ~SkinButton(); + + // Generated message map functions + protected: + //{{AFX_MSG(SkinButton) + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnPaint(); + afx_msg void OnKillFocus(CWnd* pNewWnd); + afx_msg void OnCaptureChanged(CWnd *pWnd); + afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + }; + + ///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SKINBUTTON_H__E51B4507_EAD7_43EE_9F54_204BC485D59C__INCLUDED_) diff --git a/src/win32/stdafx.cpp b/src/win32/stdafx.cpp new file mode 100644 index 0000000..7a2d90f --- /dev/null +++ b/src/win32/stdafx.cpp @@ -0,0 +1,26 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// stdafx.cpp : source file that includes just the standard includes +// DialogSizer.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/src/win32/stdafx.h b/src/win32/stdafx.h new file mode 100644 index 0000000..4fc1019 --- /dev/null +++ b/src/win32/stdafx.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +// some build target defines: + +#ifndef _WIN32_WINDOWS +# define _WIN32_WINDOWS 0x0410 // Windows 98 + +///# define _WIN32_WINDOWS 0x0500 // Windows NT + +///# define _WIN32_WINDOWS 0x0501 // Windows XP + +#endif + +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0410 // Windows 98 + +///# define _WIN32_WINNT 0x0500 // Windows NT + +///# define _WIN32_WINNT 0x0501 // Windows XP + +#endif + +#ifndef WINVER +///# define WINVER 0x0410 // Windows 98 + +#define WINVER 0x0500 // Windows NT + +///# define WINVER 0x0501 // Windows XP + +#endif + + + +#if !defined(AFX_STDAFX_H__A7126ECB_A234_4116_A7D0_BE50547E87F8__INCLUDED_) +#define AFX_STDAFX_H__A7126ECB_A234_4116_A7D0_BE50547E87F8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include +#include +#include "VBA.h" + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A7126ECB_A234_4116_A7D0_BE50547E87F8__INCLUDED_) diff --git a/src/win32/vba.aps b/src/win32/vba.aps new file mode 100644 index 0000000000000000000000000000000000000000..d8904f7c55d9c789817a58b901d42ea7ba1d33d8 GIT binary patch literal 187720 zcmeFa2bgR}aW-660VFa4gvb(EfW%IoA!^d@j_&NtYG!uty+SYu=?Vk_frLN=1I9#S zg0qRnCK(%>3@w?&*`{B>zzZHDl62EmhARYXB#TEM;|M+9vA9CD>kCOB5bk26CecC05FFAbP z#h09a;e+mb&cp6=?rE1^a^5-oJ^aE4Rm!BCe#v=q_dm(U`7VuWMY1?gQOYTD$>B>c zzU-3o4xfHMLBfOHbiOs3Zf$OkC$oNUjwI*PwGAoBvBvDSN2Bpn<6^N5IBmE#su)wpJdHv3YOWHO%284q))7-`AXW9Fpa?q$r)l!{q}6$9rwVj$hCb6 z`$yvgqj`I>fh=}=V=$|7Ldu-2Z*6qQ*043XjT+GfB zXX&g>8*;ru=495DQd3U!$;REmLbl}k#>{nx`RaHg5qtg4)*1*E!L&W-O%Tm!3*S{tkQ%DpLHr=pq-=n8 zx7#1~C+!(3uC!9eY^XTb#Y!s;sk)FzQ>lP8G4Cm?H<?gim^QFPvUP@SOmS1xY!`(pm!)fD?LmQDk)Dw`+iQB|s`OpV?alf2pnm|N>#}OJ z&GxWAoAo`tA!`oX-%uK>q};?xtyvgjuCW*}J_knA)}Hr!18r^$$1{yS!EL@w&AcnGz`WfXf+vSv;*w{=X;RrGB)yXytZbf zhHM(Cf6&J9CX;H)Sw`gqnw&Wg0 zpY#t5Mm=;}^k*#0QmU=UImQ}{LyOc(a!(ge``~=qMLz(tD)%xX#yqA2tNdC`<_+5n$a9!>lk=fxuY{Xj8a&pz30=3ARaJKsS{{4B}g z2-1UuVAKm7sLao@+&2OZ`>ULXK)s&>Rrpzv3nS2Eu(qzKirn9!szg=g0THURHJf1& zwvBU<1J?LilLsyWJH~mC1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LmqsKzprT0CRt!%~&q6YU*-8QzifS=v7F-yXhvj^Z`P@L0<7nbaDtdO{S3tKR^ z(P=SzGH6-M?UL?zHz+fOQ|Zt`KbtbI!7OS);B(T@r}UFkUakDJ3K>MShrYE{VZ8q$ z_@vhK>bdhsP<#3H6q9O0UIJ@!L0Nr$DUeC6g5){y7r6f|a$VIGZRQ+RU$A1>o-;=$ zbrvG8Gp#8`Ue0GN*Pr+O_y&>Ohpp3G&p#<0wOzC{-z}G{AtILZt29ZHnFB#C_F1M) z+3!?>O|rdN$-Z#G`yI&>-?$NGM1LtwFR(so-}XJ<>*+bFCn?R#Rf_x^!l(7*4W&zI zUMbR?(8c-BJfElW4f1(8r{e4J$m*JfxG-1e_?h{&#}{i ztE2SE@ek?u#Gk?Y^|z7{09sCX0hZg zO9FqQz~5B<1J?z9sK93{|Ir%)|6+mj{@9mR1pZ`!pHu%IeOKULD)50TB|F{|_)`Tw zSN(T(Rp4JP@K^O@(fb2`y1-AW{$;lX{*?lMit)W8@UIs5?ZS_JAn>mh_zdB%tq%N| z0)JCa7Oe^VaDn$L|Lu1L{`CU?iTZ!y?!b=}_!H{?)%OPejRIdK{LDz;-z;$6t2($j z@NX6P&BFV(2L5b;OEvUt+aCD03;eL?e|jwN=L&p4`0Aa3f2Y9rsr<+83;eqUepXNB z-yeAS-g@5WzUX6t>mZ^&`TXPE#CvxKu7iRN{BhBD=E1;qu&{yiF0W$`&8Rfl<-W^{ zd;gC-N*(R@{&U85bXHVAYp9MZ#;Oy;rQ4`hljTAWhNA~_a@bv}G`sAP#k@M?^KKU54 mHgf8hfo~{qVssO)1YXAI@RwizUErIF{AiUUe++zcf&T{vFER`O literal 0 HcmV?d00001 diff --git a/src/win32/vba.rc b/src/win32/vba.rc new file mode 100644 index 0000000..97849d1 --- /dev/null +++ b/src/win32/vba.rc @@ -0,0 +1,2748 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#include "vba.rc2" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,7,2,560 + PRODUCTVERSION 1,7,2,560 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x29L +#else + FILEFLAGS 0x28L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "VisualBoyAdvance comes with NO WARRANTY. Use it at your own risk." + VALUE "CompanyName", "None" + VALUE "FileDescription", "VisualBoyAdvance emulator" + VALUE "FileVersion", "1, 7, 2, 560" + VALUE "InternalName", "VisualBoyAdvance" + VALUE "LegalCopyright", "Copyright © 2004 Forgotten and the VBA team" + VALUE "OriginalFilename", "VisualBoyAdvance.exe" + VALUE "PrivateBuild", "0" + VALUE "ProductName", "VisualBoyAdvance emulator" + VALUE "ProductVersion", "1, 7, 2, 560" + VALUE "SpecialBuild", "0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "#include ""vba.rc2""\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON "gbadvance.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPENDLG DIALOG 36, 24, 202, 117 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Open" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "File &name:",1090,2,1,81,8 + EDITTEXT 1152,0,10,104,12,ES_AUTOHSCROLL | ES_OEMCONVERT + LISTBOX 1120,1,24,104,53,LBS_SORT | LBS_OWNERDRAWFIXED | + LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL | + WS_TABSTOP + LTEXT "&Folders:",-1,112,0,53,9 + LTEXT "",1088,113,10,86,9,SS_NOPREFIX + LISTBOX 1121,112,24,88,52,LBS_SORT | LBS_OWNERDRAWFIXED | + LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL | + WS_TABSTOP + LTEXT "List files of &type:",1089,1,75,81,9 + COMBOBOX 1136,1,87,104,13,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + LTEXT "Dri&ves:",1091,113,76,70,9 + COMBOBOX 1137,112,87,71,68,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | + CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | + WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,24,102,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,90,102,50,14,WS_GROUP +END + +IDD_ABOUT DIALOGEX 0, 0, 164, 101 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About VisualBoyAdvance" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,56,80,50,14 + ICON IDI_ICON,IDC_STATIC,5,12,21,20 + CTEXT "VisualBoyAdvance Emulator",IDC_STATIC,14,7,134,8 + CTEXT "Copyright (c) 2004 Forgotten and the VBA team", + IDC_STATIC,6,35,150,8 + CTEXT "http://vba.ngemu.com",IDC_URL,43,55,76,8 + CTEXT "Contribution by Costis",IDC_STATIC,30,45,102,8 + CTEXT "Version",IDC_STATIC,46,16,70,8 + CTEXT "",IDC_VERSION,36,25,98,8 + CTEXT "Re-recording additions by Nitsuja",IDC_STATIC,24,66,117, + 8 +END + +IDD_DIRECTORIES DIALOGEX 0, 0, 284, 129 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Directories" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + PUSHBUTTON "Browse...",IDC_ROM_DIR,174,7,50,14 + PUSHBUTTON "Browse...",IDC_MOVIES_DIR,174,26,50,14 + PUSHBUTTON "Browse...",IDC_BATTERY_DIR,174,45,50,14 + PUSHBUTTON "Browse...",IDC_SAVE_DIR,174,64,50,14 + PUSHBUTTON "Browse...",IDC_CAPTURE_DIR,174,83,50,14 + DEFPUSHBUTTON "OK",IDOK,88,108,50,14 + PUSHBUTTON "Cancel",IDCANCEL,145,108,50,14 + LTEXT "ROM:",IDC_STATIC,7,9,20,8 + LTEXT "Battery:",IDC_STATIC,7,47,25,8 + LTEXT "Save Game:",IDC_STATIC,7,66,40,8 + LTEXT "Capture:",IDC_STATIC,7,85,28,8 + EDITTEXT IDC_ROM_PATH,49,7,121,14,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_BATTERY_PATH,49,45,121,14,ES_AUTOHSCROLL | + WS_DISABLED + EDITTEXT IDC_SAVE_PATH,49,64,121,14,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_CAPTURE_PATH,49,83,121,14,ES_AUTOHSCROLL | + WS_DISABLED + LTEXT "Movies:",IDC_STATIC,7,28,26,8 + EDITTEXT IDC_MOVIES_PATH,49,26,121,14,ES_AUTOHSCROLL | + WS_DISABLED + PUSHBUTTON "Reset",IDC_ROM_DIR_RESET,228,6,50,14 + PUSHBUTTON "Reset",IDC_MOVIES_DIR_RESET,228,25,50,14 + PUSHBUTTON "Reset",IDC_BATTERY_DIR_RESET,228,45,50,14 + PUSHBUTTON "Reset",IDC_SAVE_DIR_RESET,228,64,50,14 + PUSHBUTTON "Reset",IDC_CAPTURE_DIR_RESET,228,83,50,14 +END + +IDD_CONFIG DIALOGEX 0, 0, 135, 211 +STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Joypad setup" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_EDIT_UP,47,5,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DOWN,47,19,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_LEFT,47,33,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RIGHT,47,47,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_A,47,61,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_B,47,75,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_L,47,89,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_R,47,103,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_SELECT,47,117,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_START,47,131,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SPEED,47,145,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CAPTURE,47,159,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_GS,47,173,81,12,ES_AUTOHSCROLL + PUSHBUTTON "OK",ID_OK,20,190,40,14 + PUSHBUTTON "Cancel",ID_CANCEL,74,190,40,14 + LTEXT "Up:",IDC_STATIC,5,5,35,10 + LTEXT "Down:",IDC_STATIC,5,19,35,10 + LTEXT "Left:",IDC_STATIC,5,33,35,10 + LTEXT "Right:",IDC_STATIC,5,47,35,10 + LTEXT "Button A:",IDC_STATIC,5,61,35,10 + LTEXT "Button B:",IDC_STATIC,5,75,35,10 + LTEXT "Button L:",IDC_STATIC,5,89,35,10 + LTEXT "Button R:",IDC_STATIC,5,103,35,10 + LTEXT "Select:",IDC_STATIC,5,117,35,10 + LTEXT "Start:",IDC_STATIC,5,131,35,10 + LTEXT "Speed:",IDC_STATIC,5,145,35,10 + LTEXT "Capture:",IDC_STATIC,5,159,35,10 + LTEXT "GS:",IDC_STATIC,5,173,35,10 +END + +IDD_CHEATS DIALOGEX 0, 0, 276, 253 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "Search for cheats" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL "",IDC_CHEAT_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,3,5,265,111 + CONTROL "Ol&d value",IDC_OLD_VALUE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,11,129,46,10 + CONTROL "Specifi&c value",IDC_SPECIFIC_VALUE,"Button", + BS_AUTORADIOBUTTON,11,141,61,10 + CONTROL "&8 bits",IDC_SIZE_8,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,11,167,33,10 + CONTROL "&16 bits",IDC_SIZE_16,"Button",BS_AUTORADIOBUTTON,11, + 179,37,10 + CONTROL "&32 bits",IDC_SIZE_32,"Button",BS_AUTORADIOBUTTON,11, + 191,37,10 + CONTROL "&Equal",IDC_EQ,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 100,128,34,10 + CONTROL "&Not equal",IDC_NE,"Button",BS_AUTORADIOBUTTON,100,140, + 47,10 + CONTROL "&Less than",IDC_LT,"Button",BS_AUTORADIOBUTTON,100,152, + 47,10 + CONTROL "Le&ss or equal",IDC_LE,"Button",BS_AUTORADIOBUTTON,100, + 164,58,10 + CONTROL "&Greather than",IDC_GT,"Button",BS_AUTORADIOBUTTON,100, + 176,59,10 + CONTROL "G&reater or equal",IDC_GE,"Button",BS_AUTORADIOBUTTON, + 100,188,67,10 + CONTROL "S&igned",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,202,130,38,10 + CONTROL "&Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON,202, + 142,46,10 + CONTROL "&Hexadecimal",IDC_HEXADECIMAL,"Button", + BS_AUTORADIOBUTTON,202,154,57,10 + CONTROL "search u&pdates vals",IDC_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,192,192,76,10 + EDITTEXT IDC_VALUE,95,211,172,14,ES_AUTOHSCROLL + PUSHBUTTON "&Start",IDC_START,15,237,50,14,WS_GROUP + PUSHBUTTON "S&earch",IDC_SEARCH,80,236,50,14 + PUSHBUTTON "&Add cheat",IDC_ADD_CHEAT,145,236,50,14 + DEFPUSHBUTTON "OK",ID_OK,210,236,50,14 + GROUPBOX "&Search type",IDC_STATIC,3,118,84,36 + GROUPBOX "&Data size",IDC_STATIC,3,158,84,44 + GROUPBOX "Compare type",IDC_STATIC,95,118,92,84 + GROUPBOX "Signed/Unsigned",IDC_STATIC,192,118,76,50 + LTEXT "Enter &value:",IDC_STATIC,3,214,69,8 + PUSHBUTTON "Refresh New &Values",IDC_CHEATREFRESHBUTTON,192,172,75, + 14,NOT WS_VISIBLE +END + +IDD_ADD_CHEAT DIALOG 0, 0, 186, 137 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add cheat" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_ADDRESS,60,6,123,14,ES_AUTOHSCROLL + EDITTEXT IDC_VALUE,60,24,123,14,ES_AUTOHSCROLL + EDITTEXT IDC_DESC,60,42,123,14,ES_AUTOHSCROLL + CONTROL "8-bit",IDC_SIZE_8,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,11,70,29,10 + CONTROL "16-bit",IDC_SIZE_16,"Button",BS_AUTORADIOBUTTON,62,70, + 33,10 + CONTROL "32-bit",IDC_SIZE_32,"Button",BS_AUTORADIOBUTTON,117,70, + 33,10 + CONTROL "&Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,11,97,38,10 + CONTROL "&Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON,62, + 98,46,10 + CONTROL "&Hexadecimal",IDC_HEXADECIMAL,"Button", + BS_AUTORADIOBUTTON,117,98,57,10 + DEFPUSHBUTTON "&OK",ID_OK,36,116,50,14,WS_GROUP + PUSHBUTTON "&Cancel",ID_CANCEL,99,116,50,14 + LTEXT "&Value:",IDC_STATIC,3,27,54,8 + GROUPBOX "Number format",IDC_STATIC,3,88,180,24 + LTEXT "&Address:",IDC_STATIC,3,9,54,8 + GROUPBOX "Size",IDC_STATIC,3,60,180,24 + LTEXT "&Description:",IDC_STATIC,3,45,55,8 +END + +IDD_CHEAT_LIST DIALOG 0, 0, 280, 250 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Cheat list" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Restore &previous values",IDC_RESTORE,"Button", + BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,5,183,92,10 + PUSHBUTTON "&Code...",IDC_ADD_CODE,9,208,64,14,WS_GROUP + PUSHBUTTON "C&heat...",IDC_ADD_CHEAT,75,208,64,14 + PUSHBUTTON "&Gameshark...",IDC_ADD_GAMESHARK,141,208,64,14 + PUSHBUTTON "CodeBreaker...",IDC_ADD_CODEBREAKER,206,208,64,14 + PUSHBUTTON "&Remove",IDC_REMOVE,9,230,64,14 + PUSHBUTTON "Remove A&ll",IDC_REMOVE_ALL,75,230,64,14 + PUSHBUTTON "&Enable/Dis.",IDC_ENABLE,141,230,64,14 + DEFPUSHBUTTON "&OK",ID_OK,206,230,64,14,WS_GROUP + CONTROL "",IDC_CHEAT_LIST,"SysListView32",LVS_REPORT | WS_BORDER | + WS_GROUP | WS_TABSTOP,5,15,269,156 + LTEXT "Status legend:",IDC_STATIC,6,3,46,8 + LTEXT "E: Enabled",IDC_STATIC,188,3,36,8 + LTEXT "D: Disabled",IDC_STATIC,234,3,38,8 + GROUPBOX "Add",IDC_STATIC,5,199,268,27 +END + +IDD_ASSOCIATIONS DIALOG 0, 0, 116, 95 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Associations" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL ".gb",IDC_GB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,15, + 26,10 + CONTROL ".sgb",IDC_SGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15, + 29,29,10 + CONTROL ".cgb",IDC_CGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15, + 43,30,10 + CONTROL ".gbc",IDC_GBC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15, + 57,30,10 + CONTROL ".gba",IDC_GBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75, + 13,30,10 + CONTROL ".agb",IDC_AGB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75, + 27,30,10 + CONTROL ".bin",IDC_BIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75, + 41,27,10 + DEFPUSHBUTTON "OK",ID_OK,3,78,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,63,78,50,14 + GROUPBOX "GBA Types",IDC_STATIC,63,3,50,51 + GROUPBOX "GB Types",IDC_STATIC,3,3,50,69 +END + +IDD_GBA_ROM_INFO DIALOG 0, 0, 220, 142 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Rom information" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,84,121,50,14 + LTEXT "Game title:",IDC_STATIC,7,10,60,8 + LTEXT "Game code:",IDC_STATIC,7,24,60,8 + LTEXT "Maker code:",IDC_STATIC,7,38,60,8 + LTEXT "Main unit code:",IDC_STATIC,7,66,60,8 + LTEXT "Device type:",IDC_STATIC,7,80,60,8 + LTEXT "ROM version:",IDC_STATIC,7,94,60,8 + LTEXT "CRC:",IDC_STATIC,7,108,60,8 + LTEXT "",IDC_ROM_TITLE,80,10,133,8 + LTEXT "",IDC_ROM_GAME_CODE,80,24,133,8 + LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8 + LTEXT "",IDC_ROM_UNIT_CODE,80,66,133,8 + LTEXT "",IDC_ROM_DEVICE_TYPE,80,80,133,8 + LTEXT "",IDC_ROM_VERSION,80,94,133,8 + LTEXT "",IDC_ROM_CRC,80,108,133,8 + LTEXT "",IDC_ROM_MAKER_NAME,80,52,133,8 + LTEXT "Maker name:",IDC_STATIC,7,52,60,8 +END + +IDD_GB_ROM_INFO DIALOG 0, 0, 220, 225 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Rom information" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,84,200,50,14 + LTEXT "Game title:",IDC_STATIC,7,10,60,8 + LTEXT "Maker code:",IDC_STATIC,7,38,60,8 + LTEXT "Unit code:",IDC_STATIC,7,68,60,8 + LTEXT "Cartridge type:",IDC_STATIC,7,82,60,8 + LTEXT "ROM version:",IDC_STATIC,7,152,60,8 + LTEXT "CRC:",IDC_STATIC,7,166,60,8 + LTEXT "",IDC_ROM_TITLE,80,10,133,8 + LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8 + LTEXT "",IDC_ROM_UNIT_CODE,80,68,133,8 + LTEXT "",IDC_ROM_DEVICE_TYPE,80,82,133,8 + LTEXT "",IDC_ROM_VERSION,80,152,133,8 + LTEXT "",IDC_ROM_CRC,80,166,133,8 + LTEXT "Color:",IDC_STATIC,7,24,60,8 + LTEXT "",IDC_ROM_COLOR,80,24,133,8 + LTEXT "ROM size:",IDC_STATIC,7,96,60,8 + LTEXT "",IDC_ROM_SIZE,80,96,133,8 + LTEXT "RAM size:",IDC_STATIC,7,110,60,8 + LTEXT "",IDC_ROM_RAM_SIZE,80,110,133,8 + LTEXT "Dest. code:",IDC_STATIC,7,124,60,8 + LTEXT "",IDC_ROM_DEST_CODE,80,124,133,8 + LTEXT "License code:",IDC_STATIC,7,138,60,8 + LTEXT "",IDC_ROM_LIC_CODE,80,138,133,8 + LTEXT "Checksum:",IDC_STATIC,7,180,60,8 + LTEXT "",IDC_ROM_CHECKSUM,80,180,133,8 + LTEXT "",IDC_ROM_MAKER_NAME2,80,52,133,8 + LTEXT "Maker name:",IDC_STATIC,7,52,60,8 +END + +IDD_GB_CHEAT_LIST DIALOG 0, 0, 286, 221 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Gameboy Cheat List" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "",IDC_CHEAT_LIST,"SysListView32",LVS_REPORT | WS_BORDER | + WS_GROUP | WS_TABSTOP,9,20,269,156 + PUSHBUTTON "Add &GameGenie...",IDC_ADD_GG_CHEAT,9,183,80,14, + WS_GROUP + PUSHBUTTON "&Add GameShark...",IDC_ADD_GS_CHEAT,103,183,80,14, + WS_GROUP + PUSHBUTTON "&Remove",IDC_REMOVE,197,183,80,14 + PUSHBUTTON "Remove A&ll",IDC_REMOVE_ALL,9,202,80,14 + PUSHBUTTON "&Enable/Dis.",IDC_ENABLE,103,202,80,14 + DEFPUSHBUTTON "&OK",ID_OK,197,202,80,14 + LTEXT "Status legend:",IDC_STATIC,10,9,46,8 + LTEXT "E: Enabled",IDC_STATIC,195,9,36,8 + LTEXT "D: Disabled",IDC_STATIC,241,9,38,8 +END + +IDD_ADD_CHEAT_DLG DIALOG 0, 0, 182, 107 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Title" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_DESC,60,7,120,14,ES_AUTOHSCROLL + EDITTEXT IDC_CODE,60,23,120,58,ES_MULTILINE | ES_UPPERCASE | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN + DEFPUSHBUTTON "OK",ID_OK,33,86,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,99,86,50,14 + LTEXT "&Description:",IDC_STATIC,3,10,54,8 + LTEXT "&Code:",IDC_STATIC,3,29,54,8 +END + +IDD_GB_PRINTER DIALOG 0, 0, 178, 209 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "GB Printer" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&1x",IDC_1X,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13, + 166,22,10 + CONTROL "&2x",IDC_2X,"Button",BS_AUTORADIOBUTTON,55,166,23,10 + CONTROL "&3x",IDC_3X,"Button",BS_AUTORADIOBUTTON,98,166,23,10 + CONTROL "&4x",IDC_4X,"Button",BS_AUTORADIOBUTTON,141,166,23,10 + DEFPUSHBUTTON "&Print...",ID_PRINT,7,190,50,14,WS_GROUP + PUSHBUTTON "&Save...",ID_SAVE,64,190,50,14 + PUSHBUTTON "&Close",ID_OK,121,190,50,14 + CONTROL "",IDC_GB_PRINTER,"Static",SS_BLACKFRAME | WS_GROUP,7,6, + 162,146 + GROUPBOX "Print Size",IDC_STATIC,7,156,162,25 +END + +IDD_MOTION_CONFIG DIALOG 0, 0, 135, 78 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Motion Sensor" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT_UP,47,2,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DOWN,47,16,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_LEFT,47,30,81,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RIGHT,47,44,81,12,ES_AUTOHSCROLL + PUSHBUTTON "OK",ID_OK,20,60,40,14 + PUSHBUTTON "Cancel",ID_CANCEL,74,60,40,14 + LTEXT "Up:",IDC_STATIC,5,2,35,10 + LTEXT "Down:",IDC_STATIC,5,16,35,10 + LTEXT "Left:",IDC_STATIC,5,30,35,10 + LTEXT "Right:",IDC_STATIC,5,44,35,10 +END + +IDD_LANG_SELECT DIALOG 0, 0, 186, 68 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Language selection" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_LANG_STRING,140,25,40,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,30,49,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,104,49,50,14 + LTEXT "Current system language is:",IDC_STATIC,6,9,123,8 + LTEXT "Enter language name (3 letter):",IDC_STATIC,6,30,127,8 + LTEXT "",IDC_LANG_NAME,140,9,40,8 +END + +IDD_CODE_SELECT DIALOG 0, 0, 316, 235 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select codes to import" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,91,214,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,174,214,50,14 + LISTBOX IDC_GAME_LIST,7,7,302,205,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP +END + +IDD_MAP_VIEW DIALOG 0, 0, 322, 238 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Map view" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Frame 0",IDC_FRAME_0,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,22,41,10 + CONTROL "Frame 1",IDC_FRAME_1,"Button",BS_AUTORADIOBUTTON,13,36, + 41,10 + CONTROL "BG0",IDC_BG0,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13, + 63,30,10 + CONTROL "BG1",IDC_BG1,"Button",BS_AUTORADIOBUTTON,13,77,30,10 + CONTROL "BG2",IDC_BG2,"Button",BS_AUTORADIOBUTTON,13,91,30,10 + CONTROL "BG3",IDC_BG3,"Button",BS_AUTORADIOBUTTON,13,105,30,10 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_GROUP | WS_TABSTOP,7,122,68,10 + CONTROL "Auto update",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | + WS_GROUP | WS_TABSTOP,7,134,55,10 + PUSHBUTTON "&Refresh",IDC_REFRESH,25,217,50,14,WS_GROUP + PUSHBUTTON "&Save...",IDC_SAVE,88,217,50,14,WS_GROUP + PUSHBUTTON "&Close",IDC_CLOSE,155,217,50,14 + CONTROL "MapView",IDC_MAP_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,187,15,128,128 + CONTROL "Zoom",IDC_MAP_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,7,148,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,187,164, + 48,47 + LTEXT "",IDC_R,245,173,50,8 + LTEXT "",IDC_G,245,185,50,8 + LTEXT "",IDC_B,245,197,50,8 + GROUPBOX "Frame",IDC_STATIC,7,11,63,37 + GROUPBOX "Background",IDC_STATIC,7,52,63,67 + LTEXT "",IDC_XY,129,95,53,8 + LTEXT "Mode:",IDC_STATIC,80,15,34,8 + LTEXT "",IDC_MODE,130,15,53,8 + LTEXT "Map Base:",IDC_STATIC,80,25,35,8 + LTEXT "",IDC_MAPBASE,130,25,53,8 + LTEXT "Char Base:",IDC_STATIC,80,35,36,8 + LTEXT "",IDC_CHARBASE,130,35,53,8 + LTEXT "Size:",IDC_STATIC,80,45,37,8 + LTEXT "",IDC_DIM,130,45,53,8 + LTEXT "Colors:",IDC_STATIC,80,55,37,8 + LTEXT "",IDC_NUMCOLORS,130,55,53,8 + LTEXT "Priority:",IDC_STATIC,80,65,37,8 + LTEXT "",IDC_PRIORITY,130,65,53,8 + LTEXT "Mosaic:",IDC_STATIC,80,75,37,8 + LTEXT "",IDC_MOSAIC,130,75,53,8 + LTEXT "Overflow:",IDC_STATIC,80,85,37,8 + LTEXT "",IDC_OVERFLOW,130,85,53,8 + LTEXT "Address:",IDC_STATIC,80,105,37,8 + LTEXT "",IDC_ADDRESS,130,105,53,8 + LTEXT "Tile:",IDC_STATIC,80,115,37,8 + LTEXT "",IDC_TILE_NUM,130,115,53,8 + LTEXT "Flip:",IDC_STATIC,80,125,37,8 + LTEXT "",IDC_FLIP,130,125,53,8 + LTEXT "Palette:",IDC_STATIC,80,135,37,8 + LTEXT "",IDC_PALETTE_NUM,130,135,53,8 +END + +IDD_PALETTE_VIEW DIALOG 0, 0, 316, 266 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Palette View" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Save BG...",IDC_SAVE_BG,30,245,50,14 + PUSHBUTTON "Save OBJ...",IDC_SAVE_OBJ,98,245,50,14 + PUSHBUTTON "&Refresh",IDC_REFRESH2,166,245,50,14 + PUSHBUTTON "&Close",IDC_CLOSE,234,245,50,14 + LTEXT "",IDC_ADDRESS,53,168,50,8 + LTEXT "",IDC_R,53,180,50,8 + LTEXT "",IDC_G,53,192,50,8 + LTEXT "",IDC_B,53,204,50,8 + LTEXT "",IDC_VALUE,53,216,50,8 + CONTROL "Custom1",IDC_COLOR,"VbaColorControl",WS_TABSTOP,161,168, + 50,50 + CONTROL "PaletteViewBG",IDC_PALETTE_VIEW,"VbaPaletteViewControl", + WS_TABSTOP,12,30,128,128 + CONTROL "PaletteViewBG",IDC_PALETTE_VIEW_OBJ, + "VbaPaletteViewControl",WS_TABSTOP,166,30,128,128 + GROUPBOX "Background",IDC_STATIC,7,20,137,143 + GROUPBOX "Sprite",IDC_STATIC,161,20,137,143 + LTEXT "Address:",IDC_STATIC,7,168,38,8 + LTEXT "R:",IDC_STATIC,7,180,41,8 + LTEXT "G:",IDC_STATIC,7,192,43,8 + LTEXT "B:",IDC_STATIC,7,204,38,8 + LTEXT "Value:",IDC_STATIC,7,216,38,8 + LTEXT "Click on a color for more information",IDC_STATIC,7,7, + 302,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,229,71,10 +END + +IDD_MEM_VIEWER DIALOGEX 0, 0, 380, 178 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Memory viewer" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + COMBOBOX IDC_ADDRESSES,7,7,109,30,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "8-bit",IDC_8_BIT,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 120,9,29,10 + CONTROL "16-bit",IDC_16_BIT,"Button",BS_AUTORADIOBUTTON,154,9,33, + 10 + CONTROL "32-bit",IDC_32_BIT,"Button",BS_AUTORADIOBUTTON,192,9,33, + 10 + EDITTEXT IDC_ADDRESS,238,7,82,14,ES_UPPERCASE | ES_AUTOHSCROLL | + ES_WANTRETURN | WS_GROUP + DEFPUSHBUTTON "&Go",IDC_GO,323,7,50,14,WS_GROUP + CONTROL "Viewer",IDC_VIEWER,"VbaMemoryViewer",WS_TABSTOP,7,22, + 366,112 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,139,71,10 + PUSHBUTTON "&Refresh",IDC_REFRESH,67,157,50,14 + PUSHBUTTON "&Load...",IDC_LOAD,132,157,50,14 + PUSHBUTTON "&Save...",IDC_SAVE,197,157,50,14 + PUSHBUTTON "&Close",IDC_CLOSE,262,157,50,14 + LTEXT "Current address:",IDC_CURRENT_ADDRESS_LABEL,210,142,77, + 8 + EDITTEXT IDC_CURRENT_ADDRESS,291,139,82,14,ES_RIGHT | + ES_AUTOHSCROLL | WS_DISABLED + CONTROL "Decimal Display",IDC_DECIMAL_DISPLAY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,102,139,66,10 +END + +IDD_OAM_VIEW DIALOG 0, 0, 234, 185 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Oam Viewer" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_SPRITE,7,19,76,14,ES_RIGHT | ES_AUTOHSCROLL | + ES_NUMBER + SCROLLBAR IDC_SCROLLBAR,7,33,76,11 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,138,79,10 + PUSHBUTTON "&Refresh",IDC_REFRESH,7,164,50,14,WS_GROUP + PUSHBUTTON "&Save...",IDC_SAVE,91,164,50,14,WS_GROUP + PUSHBUTTON "&Close",IDC_CLOSE,177,164,50,14 + CONTROL "MapView",IDC_OAM_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,87,7,64,64 + CONTROL "Zoom",IDC_OAM_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,163,7,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,87,79,48, + 47 + LTEXT "",IDC_POS,31,47,50,8 + LTEXT "",IDC_MODE,31,57,50,8 + LTEXT "",IDC_COLORS,31,67,50,8 + LTEXT "",IDC_PALETTE,31,77,50,8 + LTEXT "",IDC_TILE,31,87,50,8 + LTEXT "",IDC_PRIO,31,97,50,8 + LTEXT "",IDC_SIZE2,31,107,50,8 + LTEXT "",IDC_ROT,31,117,50,8 + LTEXT "",IDC_FLAGS,31,127,50,8 + LTEXT "",IDC_R,145,88,50,8 + LTEXT "",IDC_G,145,100,50,8 + LTEXT "",IDC_B,145,112,50,8 + LTEXT "Pos:",IDC_STATIC,7,47,24,8 + LTEXT "Mode:",IDC_STATIC,7,57,24,8 + LTEXT "Colors:",IDC_STATIC,7,67,24,8 + LTEXT "Pal:",IDC_STATIC,7,77,24,8 + LTEXT "Tile:",IDC_STATIC,7,87,24,8 + LTEXT "Prio:",IDC_STATIC,7,97,24,8 + LTEXT "Size:",IDC_STATIC,7,107,24,8 + LTEXT "Sprite:",IDC_STATIC,7,7,50,8 + LTEXT "Rot.:",IDC_STATIC,7,117,24,8 + LTEXT "Flags:",IDC_STATIC,7,127,24,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,150,71,10 +END + +IDD_ACCEL_EDITOR DIALOGEX 0, 0, 320, 130 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Accelerator Editor" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + LTEXT "&Commands:",IDC_STATIC,9,9,38,8 + LISTBOX IDC_COMMANDS,9,18,139,83,LBS_SORT | LBS_NOINTEGRALHEIGHT | + LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP + LTEXT "Current &Keys:",IDC_STATIC1,156,9,43,8 + LISTBOX IDC_CURRENTS,156,18,100,52,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",ID_OK,263,9,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,263,25,50,14 + LTEXT "Enter &New Shortcut Key:",IDC_STATIC3,156,74,79,8 + EDITTEXT IDC_EDIT_KEY,156,89,100,12,ES_AUTOHSCROLL + PUSHBUTTON "&Assign",IDC_ASSIGN,263,108,50,14 + PUSHBUTTON "&Remove",IDC_REMOVE,263,92,50,14 + PUSHBUTTON "Re&set All",IDC_RESET,283,52,6,14,NOT WS_VISIBLE | + WS_DISABLED + LTEXT "Static",IDC_ALREADY_AFFECTED,8,114,111,10, + SS_CENTERIMAGE + LTEXT "Currently assigned to :",IDC_STATIC2,8,104,73,10 + LISTBOX IDC_COMMANDS_HIDDEN,275,50,8,9,NOT LBS_NOTIFY | LBS_SORT | + LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | NOT + WS_VISIBLE | WS_DISABLED | NOT WS_BORDER | WS_VSCROLL | + WS_TABSTOP +END + +IDD_TILE_VIEWER DIALOG 0, 0, 326, 266 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Tile Viewer" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "16",IDC_16_COLORS,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,20,24,10 + CONTROL "256",IDC_256_COLORS,"Button",BS_AUTORADIOBUTTON,13,30, + 28,10 + CONTROL "0x6000000",IDC_CHARBASE_0,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,57,51,10 + CONTROL "0x6004000",IDC_CHARBASE_1,"Button",BS_AUTORADIOBUTTON, + 13,67,51,10 + CONTROL "0x6008000",IDC_CHARBASE_2,"Button",BS_AUTORADIOBUTTON, + 13,77,51,10 + CONTROL "0x600C000",IDC_CHARBASE_3,"Button",BS_AUTORADIOBUTTON, + 13,87,52,10 + CONTROL "0x6010000",IDC_CHARBASE_4,"Button",BS_AUTORADIOBUTTON, + 13,97,49,10 + CONTROL "Slider1",IDC_PALETTE_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | WS_GROUP | WS_TABSTOP,1,124,76,22 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,149,79,10 + PUSHBUTTON "Refresh",IDC_REFRESH,7,245,50,14,WS_GROUP + PUSHBUTTON "Save...",IDC_SAVE,138,245,50,14 + PUSHBUTTON "Close",IDC_CLOSE,269,245,50,14 + CONTROL "Custom1",IDC_TILE_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,191,7,128,128 + GROUPBOX "Colors",IDC_STATIC,7,7,66,38 + GROUPBOX "Char Base",IDC_STATIC,7,46,65,64 + CONTROL "Zoom",IDC_MAP_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,7,174,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,98,183,48, + 47 + LTEXT "",IDC_R,156,192,50,8 + LTEXT "",IDC_G,156,204,50,8 + LTEXT "",IDC_B,156,216,50,8 + LTEXT "Palette:",IDC_STATIC,7,113,65,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,160,71,10 + LTEXT "Tile:",IDC_STATIC,79,14,41,8 + LTEXT "Address:",IDC_STATIC,79,26,41,8 + LTEXT "",IDC_TILE_NUMBER,135,14,50,8 + LTEXT "",IDC_ADDRESS,135,26,50,8 +END + +IDD_GB_COLORS DIALOGEX 0, 0, 169, 121 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Gameboy Mono Colors" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL "Default",IDC_DEFAULT,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,7,7,39,10 + CONTROL "User 1",IDC_USER1,"Button",BS_AUTORADIOBUTTON,67,7,37, + 10 + CONTROL "User 2",IDC_USER2,"Button",BS_AUTORADIOBUTTON,125,7,37, + 10 + COMBOBOX IDC_PREDEFINED,7,21,155,30,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "",IDC_COLOR_BG0,15,47,28,14,WS_GROUP + PUSHBUTTON "",IDC_COLOR_BG1,52,47,28,14 + PUSHBUTTON "",IDC_COLOR_BG2,89,47,28,14 + PUSHBUTTON "",IDC_COLOR_BG3,126,47,28,14 + PUSHBUTTON "",IDC_COLOR_OB0,15,78,28,14 + PUSHBUTTON "",IDC_COLOR_OB1,52,78,28,14 + PUSHBUTTON "",IDC_COLOR_OB2,89,78,28,14 + PUSHBUTTON "",IDC_COLOR_OB3,126,78,28,14 + PUSHBUTTON "Reset",IDC_RESET,7,100,50,14 + DEFPUSHBUTTON "OK",ID_OK,59,100,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,111,100,50,14 + GROUPBOX "Background",IDC_STATIC,8,37,154,29 + GROUPBOX "Sprite",IDC_STATIC,8,67,154,30 +END + +IDD_DISASSEMBLE DIALOG 0, 0, 402, 225 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Disassemble" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Automatic",IDC_AUTOMATIC,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,7,9,47,10 + CONTROL "ARM",IDC_ARM,"Button",BS_AUTORADIOBUTTON,62,9,32,10 + CONTROL "THUMB",IDC_THUMB,"Button",BS_AUTORADIOBUTTON,103,9,42, + 10 + EDITTEXT IDC_ADDRESS,158,7,65,14,ES_UPPERCASE | ES_AUTOHSCROLL | + WS_GROUP + DEFPUSHBUTTON "Go",IDC_GO,232,7,50,14 + LISTBOX IDC_DISASSEMBLE,7,25,276,161,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_TABSTOP + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,191,71,10 + PUSHBUTTON "Refresh",IDC_REFRESH,120,204,50,14 + PUSHBUTTON "Next",IDC_NEXT,233,204,50,14 + PUSHBUTTON "Close",IDC_CLOSE,346,204,50,14 + LTEXT "R0:",IDC_STATIC,309,7,18,8 + LTEXT "R1:",IDC_STATIC,309,15,18,8 + LTEXT "R2:",IDC_STATIC,309,23,18,8 + LTEXT "R3:",IDC_STATIC,309,31,18,8 + LTEXT "R4:",IDC_STATIC,309,39,18,8 + LTEXT "R5:",IDC_STATIC,309,47,18,8 + LTEXT "R6:",IDC_STATIC,309,55,18,8 + LTEXT "R7:",IDC_STATIC,309,63,18,8 + LTEXT "",IDC_R0,344,7,52,8 + LTEXT "",IDC_R1,344,15,52,8 + LTEXT "",IDC_R2,344,23,52,8 + LTEXT "",IDC_R3,344,31,52,8 + LTEXT "",IDC_R4,344,39,52,8 + LTEXT "",IDC_R5,344,47,52,8 + LTEXT "",IDC_R6,344,55,52,8 + LTEXT "",IDC_R7,344,63,52,8 + LTEXT "",IDC_R8,344,71,52,8 + LTEXT "",IDC_R9,344,79,52,8 + LTEXT "",IDC_R10,344,87,52,8 + LTEXT "",IDC_R11,344,95,52,8 + LTEXT "",IDC_R12,344,103,52,8 + LTEXT "",IDC_R13,344,111,52,8 + LTEXT "",IDC_R14,344,119,52,8 + LTEXT "",IDC_R15,344,127,52,8 + LTEXT "R8:",IDC_STATIC,309,71,18,8 + LTEXT "R9:",IDC_STATIC,309,79,18,8 + LTEXT "R10:",IDC_STATIC,309,87,18,8 + LTEXT "R11:",IDC_STATIC,309,95,18,8 + LTEXT "R12:",IDC_STATIC,309,103,18,8 + LTEXT "R13:",IDC_STATIC,309,111,18,8 + LTEXT "R14:",IDC_STATIC,309,119,18,8 + LTEXT "R15:",IDC_STATIC,309,127,18,8 + LTEXT "",IDC_R16,344,135,52,8 + LTEXT "R16:",IDC_STATIC,309,135,20,8 + CONTROL "N",IDC_N,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,309,146,21,10 + CONTROL "Z",IDC_Z,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,309,156,21,10 + CONTROL "C",IDC_C,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,309,166,21,10 + CONTROL "V",IDC_V,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,309,176,21,10 + CONTROL "F",IDC_F,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,342,156,20,10 + CONTROL "I",IDC_I,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,342,146,18,10 + CONTROL "T",IDC_T,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,342,166,21,10 + LTEXT "Mode:",IDC_STATIC,341,176,21,8 + LTEXT "",IDC_MODE,376,176,20,8 + SCROLLBAR IDC_VSCROLL,283,25,10,161,SBS_VERT + PUSHBUTTON "Goto R15",IDC_GOPC,7,204,50,14 +END + +IDD_GDB_PORT DIALOG 0, 0, 186, 51 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "GDB connection" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,34,30,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,102,30,50,14 + LTEXT "Port to wait for connection:",IDC_STATIC,7,10,105,8 + EDITTEXT IDC_PORT,125,7,54,14,ES_RIGHT | ES_AUTOHSCROLL +END + +IDD_GDB_WAITING DIALOG 0, 0, 186, 44 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Waiting..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",ID_CANCEL,67,23,50,14 + LTEXT "Waiting for connection on port:",IDC_STATIC,7,7,117,8 + LTEXT "",IDC_PORT,143,7,36,8 +END + +IDD_LOGGING DIALOG 0, 0, 366, 218 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Logging" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "SWI",IDC_VERBOSE_SWI,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,17,87,10 + CONTROL "Unaligned memory",IDC_VERBOSE_UNALIGNED_ACCESS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,30,87,10 + CONTROL "Illegal write",IDC_VERBOSE_ILLEGAL_WRITE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,43,87,10 + CONTROL "Illegal read",IDC_VERBOSE_ILLEGAL_READ,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,56,87,10 + CONTROL "DMA 0",IDC_VERBOSE_DMA0,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,69,87,10 + CONTROL "DMA 1",IDC_VERBOSE_DMA1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,82,87,10 + CONTROL "DMA 2",IDC_VERBOSE_DMA2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,95,87,10 + CONTROL "DMA 3",IDC_VERBOSE_DMA3,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,108,87,10 + CONTROL "Undefined instruction",IDC_VERBOSE_UNDEFINED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,121,87,10 + CONTROL "AGBPrint",IDC_VERBOSE_AGBPRINT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,134,87,10 + EDITTEXT IDC_LOG,107,7,252,183,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + PUSHBUTTON "Save...",IDC_SAVE,75,197,50,14 + PUSHBUTTON "Clear",IDC_CLEAR,137,197,50,14 + DEFPUSHBUTTON "OK",ID_OK,197,197,50,14 + GROUPBOX "Verbose",IDC_STATIC,7,7,93,142 +END + +IDD_EXPORT_SPS DIALOG 0, 0, 248, 148 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Export Gameshark Snapshot" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_TITLE,84,7,157,14,ES_AUTOHSCROLL + EDITTEXT IDC_DESC,84,27,157,14,ES_AUTOHSCROLL + EDITTEXT IDC_NOTES,84,47,157,73,ES_MULTILINE | ES_AUTOHSCROLL | + ES_WANTRETURN + DEFPUSHBUTTON "OK",ID_OK,67,127,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,130,127,50,14 + LTEXT "Title:",IDC_STATIC,7,8,62,8 + LTEXT "Description:",IDC_STATIC,7,28,63,8 + LTEXT "Notes:",IDC_STATIC,7,48,60,8 +END + +IDD_ADDR_SIZE DIALOG 0, 0, 186, 67 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Enter address and size" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_ADDRESS,99,6,80,14,ES_AUTOHSCROLL + EDITTEXT IDC_SIZE_CONTROL,99,26,80,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,34,46,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,102,46,50,14 + LTEXT "Address:",IDC_STATIC,7,11,65,8 + LTEXT "Size:",IDC_STATIC,7,29,65,8 +END + +IDD_MODES DIALOG 0, 0, 208, 129 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select video mode" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_MODES,7,18,194,80,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",ID_OK,45,108,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,112,108,50,14 + LTEXT "Available video modes:",IDC_STATIC,7,7,194,8 +END + +IDD_DRIVERS DIALOG 0, 0, 208, 121 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select video driver" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_DRIVERS,7,17,194,80,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",ID_OK,45,104,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,112,104,50,14 + LTEXT "Available drivers:",IDC_STATIC,7,7,194,8 +END + +IDD_THROTTLE DIALOG 0, 0, 186, 63 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Throttle" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_THROTTLE,7,20,172,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,37,42,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,99,42,50,14 + LTEXT "Enter desired throttle (5%...1000%):",IDC_STATIC,7,7, + 172,8 +END + +IDD_GB_DISASSEMBLE DIALOG 0, 0, 344, 225 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "GB Disassemble" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_ADDRESS,7,7,65,14,ES_UPPERCASE | ES_AUTOHSCROLL | + WS_GROUP + DEFPUSHBUTTON "Go",IDC_GO,81,7,50,14 + LISTBOX IDC_DISASSEMBLE,7,25,222,161,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_TABSTOP + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,191,71,10 + PUSHBUTTON "Refresh",IDC_REFRESH,100,204,50,14 + PUSHBUTTON "Next",IDC_NEXT,193,204,50,14 + PUSHBUTTON "Close",IDC_CLOSE,287,204,50,14 + LTEXT "AF:",IDC_STATIC,250,25,18,8 + LTEXT "BC:",IDC_STATIC,250,35,18,8 + LTEXT "DE:",IDC_STATIC,250,45,18,8 + LTEXT "HL:",IDC_STATIC,250,55,18,8 + LTEXT "IFF:",IDC_STATIC,250,85,18,8 + LTEXT "",IDC_R0,285,25,52,8 + LTEXT "",IDC_R1,285,35,52,8 + LTEXT "",IDC_R2,285,45,52,8 + LTEXT "",IDC_R3,285,55,52,8 + LTEXT "",IDC_R6,285,85,52,8 + CONTROL "N",IDC_N,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,250,109,21,10 + CONTROL "Z",IDC_Z,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,250,97,21,10 + CONTROL "C",IDC_C,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,250,133,21,10 + CONTROL "H",IDC_H,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + WS_TABSTOP,250,121,21,10 + SCROLLBAR IDC_VSCROLL,229,25,10,161,SBS_VERT + PUSHBUTTON "Goto PC",IDC_GOPC,7,204,50,14 + LTEXT "SP:",IDC_STATIC,250,65,18,8 + LTEXT "",IDC_R4,285,65,52,8 + LTEXT "PC:",IDC_STATIC,250,75,18,8 + LTEXT "",IDC_R5,285,75,52,8 +END + +IDD_GB_OAM_VIEW DIALOG 0, 0, 234, 185 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "GB Oam Viewer" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_SPRITE,7,19,76,14,ES_RIGHT | ES_AUTOHSCROLL | + ES_NUMBER + SCROLLBAR IDC_SCROLLBAR,7,33,76,11 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,138,79,10 + PUSHBUTTON "&Refresh",IDC_REFRESH,7,164,50,14,WS_GROUP + PUSHBUTTON "&Save...",IDC_SAVE,91,164,50,14,WS_GROUP + PUSHBUTTON "&Close",IDC_CLOSE,177,164,50,14 + CONTROL "MapView",IDC_OAM_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,87,7,64,64 + CONTROL "Zoom",IDC_OAM_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,163,7,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,87,79,48, + 47 + LTEXT "",IDC_POS,31,47,50,8 + LTEXT "",IDC_PALETTE,31,87,50,8 + LTEXT "",IDC_TILE,31,57,50,8 + LTEXT "",IDC_PRIO,31,67,50,8 + LTEXT "",IDC_OAP,31,77,50,8 + LTEXT "",IDC_FLAGS,31,97,50,8 + LTEXT "",IDC_R,145,88,50,8 + LTEXT "",IDC_G,145,100,50,8 + LTEXT "",IDC_B,145,112,50,8 + LTEXT "Pos:",IDC_STATIC,7,47,24,8 + LTEXT "Pal:",IDC_STATIC,7,87,24,8 + LTEXT "Tile:",IDC_STATIC,7,57,24,8 + LTEXT "Prio:",IDC_STATIC,7,67,24,8 + LTEXT "OAP:",IDC_STATIC,7,77,24,8 + LTEXT "Sprite:",IDC_STATIC,7,7,50,8 + LTEXT "Flags:",IDC_STATIC,7,97,24,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,150,71,10 + LTEXT "",IDC_BANK,31,107,50,8 + LTEXT "Bank:",IDC_STATIC,7,107,24,8 +END + +IDD_GB_TILE_VIEWER DIALOG 0, 0, 326, 238 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "GB Tile Viewer" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "0",IDC_BANK_0,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13, + 20,20,10 + CONTROL "1",IDC_BANK_1,"Button",BS_AUTORADIOBUTTON,13,30,20,10 + CONTROL "0x8000",IDC_CHARBASE_0,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,57,39,10 + CONTROL "0x8800",IDC_CHARBASE_1,"Button",BS_AUTORADIOBUTTON,13, + 67,39,10 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,122,79,10 + PUSHBUTTON "Refresh",IDC_REFRESH,7,217,50,14,WS_GROUP + PUSHBUTTON "Save...",IDC_SAVE,138,217,50,14 + PUSHBUTTON "Close",IDC_CLOSE,269,217,50,14 + CONTROL "Custom1",IDC_TILE_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,191,7,128,128 + GROUPBOX "VRAM Bank",IDC_STATIC,7,7,66,38 + GROUPBOX "Char Base",IDC_STATIC,7,46,65,35 + CONTROL "Zoom",IDC_MAP_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,7,147,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,98,156,48, + 47 + LTEXT "",IDC_R,156,164,50,8 + LTEXT "",IDC_G,156,176,50,8 + LTEXT "",IDC_B,156,188,50,8 + LTEXT "Palette:",IDC_STATIC,7,86,65,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,133,71,10 + LTEXT "Tile:",IDC_STATIC,79,14,41,8 + LTEXT "Address:",IDC_STATIC,79,26,41,8 + LTEXT "",IDC_TILE_NUMBER,135,14,50,8 + LTEXT "",IDC_ADDRESS,135,26,50,8 + CONTROL "Slider1",IDC_PALETTE_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | WS_GROUP | WS_TABSTOP,1,98,76,22 +END + +IDD_GB_MAP_VIEW DIALOG 0, 0, 322, 238 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "GB Map Viewer" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "0x8000",IDC_BANK_0,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,22,39,10 + CONTROL "0x8800",IDC_BANK_1,"Button",BS_AUTORADIOBUTTON,13,36,39, + 10 + CONTROL "0x9800",IDC_BG0,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 13,63,39,10 + CONTROL "0x9C00",IDC_BG1,"Button",BS_AUTORADIOBUTTON,13,77,40,10 + CONTROL "Stretch to fit",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,122,68,10 + PUSHBUTTON "&Refresh",IDC_REFRESH,25,217,50,14,WS_GROUP + PUSHBUTTON "&Save...",IDC_SAVE,88,217,50,14,WS_GROUP + PUSHBUTTON "&Close",IDC_CLOSE,155,217,50,14 + CONTROL "MapView",IDC_MAP_VIEW,"VbaBitmapControl",WS_GROUP | + WS_TABSTOP,187,15,128,128 + CONTROL "Zoom",IDC_MAP_VIEW_ZOOM,"VbaZoomControl",WS_GROUP | + WS_TABSTOP,7,148,64,64 + CONTROL "Color",IDC_COLOR,"VbaColorControl",WS_TABSTOP,187,164, + 48,47 + LTEXT "",IDC_R,245,173,50,8 + LTEXT "",IDC_G,245,185,50,8 + LTEXT "",IDC_B,245,197,50,8 + GROUPBOX "Char Base",IDC_STATIC,7,11,63,37 + GROUPBOX "Map Base",IDC_STATIC,7,52,63,41 + CONTROL "Auto update",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,134,55,10 + LTEXT "",IDC_XY,129,18,53,8 + LTEXT "Priority:",IDC_STATIC,80,68,37,8 + LTEXT "",IDC_PRIORITY,130,68,53,8 + LTEXT "Address:",IDC_STATIC,80,28,37,8 + LTEXT "",IDC_ADDRESS,130,28,53,8 + LTEXT "Tile:",IDC_STATIC,80,38,37,8 + LTEXT "",IDC_TILE_NUM,130,38,53,8 + LTEXT "Flip:",IDC_STATIC,80,48,37,8 + LTEXT "",IDC_FLIP,130,48,53,8 + LTEXT "Palette:",IDC_STATIC,80,58,37,8 + LTEXT "",IDC_PALETTE_NUM,130,58,53,8 +END + +IDD_GB_PALETTE_VIEW DIALOG 0, 0, 196, 234 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "GB Palette Viewer" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Save BG...",IDC_SAVE_BG,7,191,50,14 + PUSHBUTTON "Save OBJ...",IDC_SAVE_OBJ,73,191,50,14 + PUSHBUTTON "&Refresh",IDC_REFRESH2,139,191,50,14 + PUSHBUTTON "&Close",IDC_CLOSE,73,213,50,14 + LTEXT "",IDC_ADDRESS,53,117,50,8 + LTEXT "",IDC_R,53,129,50,8 + LTEXT "",IDC_G,53,141,50,8 + LTEXT "",IDC_B,53,153,50,8 + LTEXT "",IDC_VALUE,53,165,50,8 + CONTROL "Custom1",IDC_COLOR,"VbaColorControl",WS_TABSTOP,119,117, + 50,50 + CONTROL "PaletteViewBG",IDC_PALETTE_VIEW,"VbaPaletteViewControl", + WS_TABSTOP,11,30,64,64 + CONTROL "PaletteViewBG",IDC_PALETTE_VIEW_OBJ, + "VbaPaletteViewControl",WS_TABSTOP,120,30,64,64 + GROUPBOX "BG",IDC_STATIC,6,20,74,81 + GROUPBOX "Sprite",IDC_STATIC,115,20,74,81 + LTEXT "Index:",IDC_STATIC,7,117,38,8 + LTEXT "R:",IDC_STATIC,7,129,41,8 + LTEXT "G:",IDC_STATIC,7,141,43,8 + LTEXT "B:",IDC_STATIC,7,153,38,8 + LTEXT "Value:",IDC_STATIC,7,165,38,8 + LTEXT "Click on a color for more information",IDC_STATIC,7,7, + 182,8 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,178,71,10 +END + +IDD_MODE_CONFIRM DIALOG 0, 0, 186, 57 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Confirm mode" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,31,36,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,103,36,50,14 + CTEXT "Do you want to keep the current mode?",IDC_STATIC,7,7, + 172,8 + CTEXT "",IDC_TIMER,7,19,172,8 +END + +IDD_REWIND_INTERVAL DIALOGEX 0, 0, 188, 132 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Rewind Settings" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_INTERVAL,7,26,174,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,37,111,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,99,111,50,14 + LTEXT "Enter the rewind interval (0.2 ... 600) in seconds:", + IDC_STATIC,7,7,174,8 + LTEXT "Or enter 0 to disable rewind.",IDC_STATIC,7,15,174,8 + EDITTEXT IDC_REWINDSLOTS,7,66,174,14,ES_AUTOHSCROLL + LTEXT "Enter number of rewind slots (1...256)",IDC_STATIC,7,46, + 174,8 + LTEXT "Or enter 0 to disable rewind.",IDC_STATIC,7,55,174,8 + LTEXT "If enabled, Tools->Rewind will rewind the state by seconds, as many as intervals back.", + IDC_STATIC,7,87,173,17 +END + +IDD_IO_VIEWER DIALOG 0, 0, 269, 238 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "I/O Viewer" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_ADDRESSES,7,7,255,30,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + RTEXT "",IDC_VALUE,103,23,159,8 + CONTROL "",IDC_BIT_15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34, + 255,10 + CONTROL "",IDC_BIT_14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,44, + 255,10 + CONTROL "",IDC_BIT_13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54, + 255,8 + CONTROL "",IDC_BIT_12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,64, + 255,10 + CONTROL "",IDC_BIT_11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,74, + 255,10 + CONTROL "",IDC_BIT_10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,84, + 255,10 + CONTROL "",IDC_BIT_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,94, + 255,10 + CONTROL "",IDC_BIT_8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,104, + 255,10 + CONTROL "",IDC_BIT_7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,114, + 255,10 + CONTROL "",IDC_BIT_6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,124, + 255,10 + CONTROL "",IDC_BIT_5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,134, + 255,10 + CONTROL "",IDC_BIT_4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144, + 255,10 + CONTROL "",IDC_BIT_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,154, + 255,10 + CONTROL "",IDC_BIT_2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,164, + 255,10 + CONTROL "",IDC_BIT_1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,174, + 255,10 + CONTROL "",IDC_BIT_0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,184, + 255,10 + CONTROL "Automatic update",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,201,71,10 + DEFPUSHBUTTON "&Refresh",IDC_REFRESH,54,221,50,14 + DEFPUSHBUTTON "&Apply",IDC_APPLY,110,221,50,14 + PUSHBUTTON "&Close",IDC_CLOSE,166,221,50,14 + LTEXT "Value:",IDC_STATIC,7,23,72,8 +END + +IDD_MAX_SCALE DIALOG 0, 0, 186, 68 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Fullscreen scale" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_VALUE,7,28,172,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,37,47,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,99,47,50,14 + LTEXT "Enter the maxium fullscreen scale:",IDC_STATIC,7,7,172, + 8 + LTEXT "Enter 0 to use maximum scale.",IDC_STATIC,7,17,172,8 +END + +IDD_BUG_REPORT DIALOG 0, 0, 296, 186 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Bug Report" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&OK",ID_OK,157,165,50,14 + EDITTEXT IDC_BUG_REPORT,11,22,278,131,ES_MULTILINE | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | + WS_VSCROLL + LTEXT "Bug report data:",IDC_STATIC,7,7,282,8 + DEFPUSHBUTTON "&Copy",IDC_COPY,87,164,50,14 +END + +IDD_MOVIECREATE DIALOGEX 0, 0, 320, 168 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Record Movie" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,193,147,50,14 + PUSHBUTTON "Cancel",IDCANCEL,256,147,50,14 + EDITTEXT IDC_MOVIE_FILENAME,7,18,250,13,ES_AUTOHSCROLL + LTEXT "Movie File",-1,7,7,33,8 + PUSHBUTTON "&Browse...",IDC_BROWSE,264,17,48,14 + EDITTEXT IDC_EDIT_AUTHOR,57,35,200,14,ES_AUTOHSCROLL + LTEXT "Author:",-1,7,38,43,8,0,WS_EX_RIGHT + EDITTEXT IDC_EDIT_DESCRIPTION,57,52,255,14,ES_AUTOHSCROLL + LTEXT "Description:",-1,7,55,43,8,0,WS_EX_RIGHT + GROUPBOX "Game System",-1,116,74,85,64 + CONTROL "Game Boy Advance",IDC_REC_GBA,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,119,86,79,10 + CONTROL "Game Boy Color",IDC_REC_GBC,"Button",BS_AUTORADIOBUTTON, + 119,99,67,10 + CONTROL "Super Game Boy",IDC_REC_SGB,"Button",BS_AUTORADIOBUTTON, + 119,112,69,10 + CONTROL "Game Boy",IDC_REC_GB,"Button",BS_AUTORADIOBUTTON,119, + 124,49,10 + GROUPBOX "Bios Settings",-1,214,74,86,64 + GROUPBOX "Record Options",-1,18,74,85,64 + CONTROL "From now (snapshot)",IDC_RECNOW,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,21,118,77,10 + CONTROL "From reset (SRAM)",IDC_RECRESET,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,21,104,75,10 + CONTROL "From start (power-on)",IDC_RECSTART,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,21,90,78,10 + CONTROL "No BIOS",IDC_REC_NOBIOS,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,218,86,44,10 + CONTROL "Emulator's BIOS",IDC_REC_EMUBIOS,"Button", + BS_AUTORADIOBUTTON,218,99,67,10 + CONTROL "GBA BIOS",IDC_REC_GBABIOS,"Button",BS_AUTORADIOBUTTON, + 218,112,49,10 + CONTROL "GBA BIOS with intro",IDC_REC_GBABIOSINTRO,"Button", + BS_AUTORADIOBUTTON,218,124,79,10 +END + +IDD_MOVIEOPEN DIALOGEX 0, 0, 320, 240 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Play Movie" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,196,214,50,14 + PUSHBUTTON "Cancel",IDCANCEL,255,214,50,14 + EDITTEXT IDC_MOVIE_FILENAME,7,18,250,13,ES_AUTOHSCROLL + LTEXT "Movie File",-1,7,7,33,8 + PUSHBUTTON "&Browse...",IDC_BROWSE,265,17,48,14 + LTEXT "Recording Date:",-1,12,87,53,8 + LTEXT "Length:",-1,40,99,25,8 + LTEXT "Frames:",-1,40,111,26,8 + LTEXT "Re-record Count:",-1,10,123,55,8 + LTEXT "DATE",IDC_LABEL_DATE,68,87,124,8 + LTEXT "LENGTH",IDC_LABEL_LENGTH,68,99,93,8 + LTEXT "FRAMES",IDC_LABEL_FRAMES,68,111,67,8 + LTEXT "RERECORD",IDC_LABEL_RERECORD,68,123,46,8 + CONTROL "Open Read-Only",IDC_READONLY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,189,7,70,10 + LTEXT "Press OK to start playing the movie.\nNote that this will erase or overwrite your game's SRAM,\nand may change other emulator settings.", + -1,8,209,177,24 + LTEXT "Movie ROM: ...",IDC_LABEL_WARNING1,8,34,300,8 + LTEXT "Your ROM: ...",IDC_LABEL_WARNING2,12,43,295,9,0, + WS_EX_TRANSPARENT + EDITTEXT IDC_EDIT_AUTHOR,57,54,200,12,ES_AUTOHSCROLL | + ES_READONLY + LTEXT "Author:",-1,7,56,43,8,0,WS_EX_RIGHT + EDITTEXT IDC_EDIT_DESCRIPTION,57,68,255,12,ES_AUTOHSCROLL + LTEXT "Description:",-1,7,69,43,8,0,WS_EX_RIGHT + GROUPBOX "Game System",-1,112,137,85,64 + RADIOBUTTON "Game Boy Advance",IDC_REC_GBA,116,149,79,10,WS_GROUP + RADIOBUTTON "Game Boy Color",IDC_REC_GBC,116,162,67,10 + RADIOBUTTON "Super Game Boy",IDC_REC_SGB,116,175,69,10 + RADIOBUTTON "Game Boy",IDC_REC_GB,116,187,49,10 + GROUPBOX "Record Options",-1,18,137,77,64 + RADIOBUTTON "From snapshot",IDC_RECNOW,22,180,62,10,WS_GROUP | + WS_TABSTOP + RADIOBUTTON "From reset/SRAM",IDC_RECRESET,22,167,70,10,WS_TABSTOP + RADIOBUTTON "From power-on",IDC_RECSTART,22,153,63,10,WS_TABSTOP + RADIOBUTTON "No BIOS",IDC_REC_NOBIOS,219,149,44,10,WS_GROUP + RADIOBUTTON "Emulator's BIOS",IDC_REC_EMUBIOS,219,162,67,10 + RADIOBUTTON "GBA BIOS",IDC_REC_GBABIOS,219,175,49,10 + RADIOBUTTON "GBA BIOS with intro",IDC_REC_GBABIOSINTRO,219,187,79,10 + GROUPBOX "Bios Settings",-1,214,137,86,64 + PUSHBUTTON "&Refresh",IDC_MOVIE_REFRESH,265,3,48,14 + EDITTEXT IDC_EDIT_PAUSEFRAME,254,109,45,12,ES_AUTOHSCROLL + CONTROL "Pause at frame:",IDC_CHECK_PAUSEFRAME,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,189,110,63,10 + CONTROL "Hide SGB Border",IDC_CHECK_HIDEBORDER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,116,123,70,10 +END + +IDD_TEXTCONFIG DIALOGEX 0, 0, 139, 120 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Text Options" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,69,99,63,14 + PUSHBUTTON "Cancel",IDCANCEL,7,99,53,14 + GROUPBOX "Color",IDC_STATIC,7,7,54,86 + CONTROL "White",IDC_RADIO_WHITE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,16,35,8 + CONTROL "Red",IDC_RADIO_RED,"Button",BS_AUTORADIOBUTTON,13,25,29, + 8 + CONTROL "Yellow",IDC_RADIO_YELLOW,"Button",BS_AUTORADIOBUTTON,13, + 34,36,9 + CONTROL "Green",IDC_RADIO_GREEN,"Button",BS_AUTORADIOBUTTON,13, + 43,35,9 + CONTROL "Cyan",IDC_RADIO_CYAN,"Button",BS_AUTORADIOBUTTON,13,53, + 33,8 + CONTROL "Blue",IDC_RADIO_BLUE,"Button",BS_AUTORADIOBUTTON,13,63, + 29,8 + CONTROL "Magenta",IDC_RADIO_MAGENTA,"Button",BS_AUTORADIOBUTTON, + 13,72,44,8 + CONTROL "Black",IDC_RADIO_BLACK,"Button",BS_AUTORADIOBUTTON,13, + 82,32,8 + CONTROL "Outlined",IDC_CHECK_OUTLINED,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,74,17,43,10 + CONTROL "Transparent",IDC_CHECK_TRANSPARENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,74,28,55,10 + GROUPBOX "Mode",IDC_STATIC,69,7,63,36 + GROUPBOX "Display",IDC_STATIC,69,48,63,45 + CONTROL "In Game",IDC_RADIO_PREFILTER,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,73,58,43,10 + CONTROL "On Game",IDC_RADIO_POSTFILTER,"Button", + BS_AUTORADIOBUTTON,73,69,45,10 + CONTROL "On Screen",IDC_RADIO_POSTRENDER,"Button", + BS_AUTORADIOBUTTON,73,80,49,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPENDLG, DIALOG + BEGIN + RIGHTMARGIN, 165 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 157 + TOPMARGIN, 7 + BOTTOMMARGIN, 94 + END + + IDD_DIRECTORIES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 128 + TOPMARGIN, 7 + BOTTOMMARGIN, 204 + END + + IDD_CHEATS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 246 + END + + IDD_ADD_CHEAT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 130 + END + + IDD_CHEAT_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 273 + TOPMARGIN, 7 + BOTTOMMARGIN, 243 + END + + IDD_ASSOCIATIONS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 109 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_GBA_ROM_INFO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 135 + END + + IDD_GB_ROM_INFO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_GB_CHEAT_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 279 + TOPMARGIN, 7 + BOTTOMMARGIN, 214 + END + + IDD_ADD_CHEAT_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 100 + END + + IDD_GB_PRINTER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 171 + TOPMARGIN, 7 + BOTTOMMARGIN, 202 + END + + IDD_MOTION_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 128 + TOPMARGIN, 7 + BOTTOMMARGIN, 71 + END + + IDD_LANG_SELECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 61 + END + + IDD_CODE_SELECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 309 + TOPMARGIN, 7 + BOTTOMMARGIN, 228 + END + + IDD_MAP_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 315 + TOPMARGIN, 7 + BOTTOMMARGIN, 231 + END + + IDD_PALETTE_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 309 + TOPMARGIN, 7 + BOTTOMMARGIN, 259 + END + + IDD_MEM_VIEWER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 373 + TOPMARGIN, 7 + BOTTOMMARGIN, 171 + END + + IDD_OAM_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 227 + TOPMARGIN, 7 + BOTTOMMARGIN, 178 + END + + IDD_ACCEL_EDITOR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 313 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_TILE_VIEWER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 319 + TOPMARGIN, 7 + BOTTOMMARGIN, 259 + END + + IDD_GB_COLORS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 162 + TOPMARGIN, 7 + BOTTOMMARGIN, 114 + END + + IDD_DISASSEMBLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 396 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_GDB_PORT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 44 + END + + IDD_GDB_WAITING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 37 + END + + IDD_LOGGING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 359 + TOPMARGIN, 7 + BOTTOMMARGIN, 211 + END + + IDD_EXPORT_SPS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 241 + TOPMARGIN, 7 + BOTTOMMARGIN, 141 + END + + IDD_ADDR_SIZE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 60 + END + + IDD_MODES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 201 + TOPMARGIN, 7 + BOTTOMMARGIN, 122 + END + + IDD_DRIVERS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 201 + TOPMARGIN, 7 + BOTTOMMARGIN, 114 + END + + IDD_THROTTLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 56 + END + + IDD_GB_DISASSEMBLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 337 + TOPMARGIN, 7 + BOTTOMMARGIN, 218 + END + + IDD_GB_OAM_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 227 + TOPMARGIN, 7 + BOTTOMMARGIN, 178 + END + + IDD_GB_TILE_VIEWER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 319 + TOPMARGIN, 7 + BOTTOMMARGIN, 231 + END + + IDD_GB_MAP_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 315 + TOPMARGIN, 7 + BOTTOMMARGIN, 231 + END + + IDD_GB_PALETTE_VIEW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 189 + TOPMARGIN, 7 + BOTTOMMARGIN, 227 + END + + IDD_MODE_CONFIRM, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 50 + END + + IDD_REWIND_INTERVAL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 181 + TOPMARGIN, 7 + BOTTOMMARGIN, 125 + END + + IDD_IO_VIEWER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 262 + TOPMARGIN, 7 + BOTTOMMARGIN, 235 + END + + IDD_MAX_SCALE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 61 + END + + IDD_BUG_REPORT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 289 + TOPMARGIN, 7 + BOTTOMMARGIN, 179 + END + + IDD_MOVIECREATE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 312 + TOPMARGIN, 7 + BOTTOMMARGIN, 161 + END + + IDD_MOVIEOPEN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 313 + TOPMARGIN, 7 + BOTTOMMARGIN, 235 + END + + IDD_TEXTCONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 132 + TOPMARGIN, 7 + BOTTOMMARGIN, 113 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open ROM...", ID_FILE_OPEN + POPUP "Rece&nt ROM" + BEGIN + MENUITEM "&Clear", ID_FILE_RECENT_RESET + MENUITEM "&Lock", ID_FILE_RECENT_FREEZE + MENUITEM SEPARATOR + END + MENUITEM SEPARATOR + POPUP "Loa&d Game" + BEGIN + MENUITEM "Current slot", ID_FILE_LOADGAME_CURRENT + MENUITEM "Most recent slot", ID_FILE_LOADGAME_MOSTRECENT + + MENUITEM "Load from file...", ID_FILE_LOAD + MENUITEM SEPARATOR + MENUITEM "Slot #1", ID_FILE_LOADGAME_SLOT1 + MENUITEM "Slot #2", ID_FILE_LOADGAME_SLOT2 + MENUITEM "Slot #3", ID_FILE_LOADGAME_SLOT3 + MENUITEM "Slot #4", ID_FILE_LOADGAME_SLOT4 + MENUITEM "Slot #5", ID_FILE_LOADGAME_SLOT5 + MENUITEM "Slot #6", ID_FILE_LOADGAME_SLOT6 + MENUITEM "Slot #7", ID_FILE_LOADGAME_SLOT7 + MENUITEM "Slot #8", ID_FILE_LOADGAME_SLOT8 + MENUITEM "Slot #9", ID_FILE_LOADGAME_SLOT9 + MENUITEM "Slot #10", ID_FILE_LOADGAME_SLOT10 + MENUITEM SEPARATOR + MENUITEM "Auto load most recent", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT + + MENUITEM "Make recent on load", ID_FILE_LOADGAME_MAKERECENT + + MENUITEM "Make current on load", ID_FILE_LOADGAME_MAKECURRENT + + END + POPUP "S&ave Game" + BEGIN + MENUITEM "Current slot", ID_FILE_SAVEGAME_CURRENT + MENUITEM "Oldest slot", ID_FILE_SAVEGAME_OLDESTSLOT + + MENUITEM "Save to file...", ID_FILE_SAVE + MENUITEM SEPARATOR + MENUITEM "Slot #1", ID_FILE_SAVEGAME_SLOT1 + MENUITEM "Slot #2", ID_FILE_SAVEGAME_SLOT2 + MENUITEM "Slot #3", ID_FILE_SAVEGAME_SLOT3 + MENUITEM "Slot #4", ID_FILE_SAVEGAME_SLOT4 + MENUITEM "Slot #5", ID_FILE_SAVEGAME_SLOT5 + MENUITEM "Slot #6", ID_FILE_SAVEGAME_SLOT6 + MENUITEM "Slot #7", ID_FILE_SAVEGAME_SLOT7 + MENUITEM "Slot #8", ID_FILE_SAVEGAME_SLOT8 + MENUITEM "Slot #9", ID_FILE_SAVEGAME_SLOT9 + MENUITEM "Slot #10", ID_FILE_SAVEGAME_SLOT10 + MENUITEM SEPARATOR + MENUITEM "Increase current slot", ID_FILE_SAVEGAME_INCREMENTSLOT + + MENUITEM "Decrease current slot", ID_FILE_SAVEGAME_DECREMENTSLOT + + MENUITEM SEPARATOR + MENUITEM "Make current on save", ID_FILE_SAVEGAME_MAKECURRENT + + END + MENUITEM SEPARATOR + MENUITEM "&Pause", ID_FILE_PAUSE + MENUITEM "&Reset", ID_FILE_RESET + MENUITEM "&Close", ID_FILE_CLOSE + MENUITEM SEPARATOR + POPUP "&Import" + BEGIN + MENUITEM "&Battery file...", ID_FILE_IMPORT_BATTERYFILE + + MENUITEM "Gameshark &code file...", ID_FILE_IMPORT_GAMESHARKCODEFILE + + MENUITEM "&Gameshark Snapshot...", ID_FILE_IMPORT_GAMESHARKSNAPSHOT + + END + POPUP "E&xport" + BEGIN + MENUITEM "&Battery file...", ID_FILE_EXPORT_BATTERYFILE + + MENUITEM "&Gameshark Snapshot...", ID_FILE_EXPORT_GAMESHARKSNAPSHOT + + END + MENUITEM SEPARATOR + MENUITEM "Screen capt&ure...", ID_FILE_SCREENCAPTURE + MENUITEM "Ro&m information...", ID_FILE_ROMINFORMATION + MENUITEM "&Toggle menu", ID_FILE_TOGGLEMENU + MENUITEM SEPARATOR + MENUITEM "&Exit", ID_FILE_EXIT + END + POPUP "&Options" + BEGIN + POPUP "&Controls" + BEGIN + MENUITEM "&Configure Controls...", ID_OPTIONS_JOYPAD_CONFIGURE_1 + + MENUITEM "Configure Motion Sensor...", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE + + POPUP "Configure Other Controllers" + BEGIN + MENUITEM "Controller &2...", ID_OPTIONS_JOYPAD_CONFIGURE_2 + + MENUITEM "Controller &3...", ID_OPTIONS_JOYPAD_CONFIGURE_3 + + MENUITEM "Controller &4...", ID_OPTIONS_JOYPAD_CONFIGURE_4 + + END + POPUP "Default Controller" + BEGIN + MENUITEM "1", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1 + + MENUITEM "2", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_2 + + MENUITEM "3", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_3 + + MENUITEM "4", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4 + + END + MENUITEM SEPARATOR + MENUITEM "Allow Left+Right / Up+Down", ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT + + MENUITEM SEPARATOR + POPUP "&Auto-fire" + BEGIN + MENUITEM "&A", ID_OPTIONS_JOYPAD_AUTOFIRE_A + + MENUITEM "&B", ID_OPTIONS_JOYPAD_AUTOFIRE_B + + MENUITEM "&L", ID_OPTIONS_JOYPAD_AUTOFIRE_L + + MENUITEM "&R", ID_OPTIONS_JOYPAD_AUTOFIRE_R + + MENUITEM "&Start", ID_OPTIONS_JOYPAD_AUTOFIRE_START + + MENUITEM "S&elect", ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT + + MENUITEM "Up", ID_OPTIONS_JOYPAD_AUTOFIRE_UP + + MENUITEM "Down", ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN + + MENUITEM "Left", ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT + + MENUITEM "Right", ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT + + MENUITEM "&Clear All", ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR + + END + POPUP "Auto-hold" + BEGIN + MENUITEM "&A", ID_STICKY_A + MENUITEM "&B", ID_STICKY_B + MENUITEM "&L", ID_STICKY_L + MENUITEM "&R", ID_STICKY_R + MENUITEM "&Start", ID_STICKY_START + MENUITEM "&Select", ID_STICKY_SELECT + MENUITEM "Up", ID_STICKY_UP + MENUITEM "Down", ID_STICKY_DOWN + MENUITEM "Left", ID_STICKY_LEFT + MENUITEM "Right", ID_STICKY_RIGHT + MENUITEM "&Clear All", ID_STICKY_CLEAR + END + END + POPUP "Speed" + BEGIN + POPUP "&Frame Skip" + BEGIN + MENUITEM "skip &0 (don't skip any frames)", + ID_OPTIONS_VIDEO_FRAMESKIP_0 + + MENUITEM "skip &1 (skip every other frame)", + ID_OPTIONS_VIDEO_FRAMESKIP_1 + + MENUITEM "skip &2 (skip 2 out of every 3 frames)", + ID_OPTIONS_VIDEO_FRAMESKIP_2 + + MENUITEM "skip &3", ID_OPTIONS_VIDEO_FRAMESKIP_3 + + MENUITEM "skip &4", ID_OPTIONS_VIDEO_FRAMESKIP_4 + + MENUITEM "skip &5", ID_OPTIONS_VIDEO_FRAMESKIP_5 + + MENUITEM "skip &6", ID_OPTIONS_VIDEO_FRAMESKIP_6 + + MENUITEM "skip &7", ID_OPTIONS_VIDEO_FRAMESKIP_7 + + MENUITEM "skip &8", ID_OPTIONS_VIDEO_FRAMESKIP_8 + + MENUITEM "skip &9 (skip 9 out of every 10 frames)", + ID_OPTIONS_VIDEO_FRAMESKIP_9 + + END + POPUP "Set Speed" + BEGIN + MENUITEM "6% (very slow)", ID_OPTIONS_FRAMESKIP_THROTTLE_6 + + MENUITEM "25%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 + + MENUITEM "50% (half speed)", ID_OPTIONS_FRAMESKIP_THROTTLE_50 + + MENUITEM "75%", ID_OPTIONS_FRAMESKIP_THROTTLE_75 + + MENUITEM "100% (normal speed)", ID_OPTIONS_FRAMESKIP_THROTTLE_100 + + MENUITEM "150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 + + MENUITEM "200% (double speed)", ID_OPTIONS_FRAMESKIP_THROTTLE_200 + + MENUITEM "Other...", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER + + MENUITEM SEPARATOR + MENUITEM "Increase", ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE + + MENUITEM "Decrease", ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE + + END + MENUITEM SEPARATOR + MENUITEM "Accurate Sound &Pitch", ID_OPTIONS_FRAMESKIP_ACCURATEPITCH + + MENUITEM "Accurate Emulation &Speed", ID_OPTIONS_FRAMESKIP_ACCURATESPEED + + MENUITEM SEPARATOR + POPUP "Process &Priority" + BEGIN + MENUITEM "&Highest", ID_OPTIONS_PRIORITY_HIGHEST + + MENUITEM "&Above Normal", ID_OPTIONS_PRIORITY_ABOVENORMAL + + MENUITEM "&Normal", ID_OPTIONS_PRIORITY_NORMAL + + MENUITEM "&Below Normal", ID_OPTIONS_PRIORITY_BELOWNORMAL + + END + END + MENUITEM SEPARATOR + POPUP "&Video" + BEGIN + MENUITEM "&Vsync", ID_OPTIONS_VIDEO_VSYNC + POPUP "Render Method" + BEGIN + MENUITEM "GDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI + + MENUITEM "DirectDraw", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW + + MENUITEM "Direct3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D + + MENUITEM "OpenGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL + + MENUITEM SEPARATOR + MENUITEM "DDraw &Emulation Only", ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY + + MENUITEM "DDraw Use &Video Memory", ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY + + MENUITEM "DDraw Triple Buffering", ID_OPTIONS_VIDEO_TRIPLEBUFFERING + + MENUITEM SEPARATOR + MENUITEM "D3D Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER + + MENUITEM "D3D Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR + + MENUITEM SEPARATOR + MENUITEM "GL Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST + + MENUITEM "GL Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR + + MENUITEM "GL Triangle", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE + + MENUITEM "GL Quads", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS + + MENUITEM SEPARATOR + MENUITEM "Select skin...", ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN + + MENUITEM "Skin", ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN + + END + MENUITEM SEPARATOR + MENUITEM "x&1", ID_OPTIONS_VIDEO_X1 + MENUITEM "x&2", ID_OPTIONS_VIDEO_X2 + MENUITEM "x&3", ID_OPTIONS_VIDEO_X3 + MENUITEM "x&4", ID_OPTIONS_VIDEO_X4 + MENUITEM "Full Screen (320x240)", ID_OPTIONS_VIDEO_FULLSCREEN320X240 + + MENUITEM "Full Screen (640x480)", ID_OPTIONS_VIDEO_FULLSCREEN640X480 + + MENUITEM "Full Screen (800x600)", ID_OPTIONS_VIDEO_FULLSCREEN800X600 + + MENUITEM "&Other Full Screen...", ID_OPTIONS_VIDEO_FULLSCREEN + + MENUITEM "Full screen max scale...", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE + + MENUITEM SEPARATOR + MENUITEM "Text display options...", ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS + + MENUITEM "D&isable status messages", ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES + + MENUITEM SEPARATOR + MENUITEM "&Disable SFX", ID_OPTIONS_VIDEO_DISABLESFX + + MENUITEM "Fullscreen stretch to &fit", ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT + + MENUITEM SEPARATOR + POPUP "Graphics &Layers" + BEGIN + MENUITEM "BG 0", ID_OPTIONS_VIDEO_LAYERS_BG0 + + MENUITEM "BG 1", ID_OPTIONS_VIDEO_LAYERS_BG1 + + MENUITEM "BG 2", ID_OPTIONS_VIDEO_LAYERS_BG2 + + MENUITEM "BG 3", ID_OPTIONS_VIDEO_LAYERS_BG3 + + MENUITEM "OBJ", ID_OPTIONS_VIDEO_LAYERS_OBJ + + MENUITEM "WIN 0", ID_OPTIONS_VIDEO_LAYERS_WIN0 + + MENUITEM "WIN 1", ID_OPTIONS_VIDEO_LAYERS_WIN1 + + MENUITEM "OBJ WIN", ID_OPTIONS_VIDEO_LAYERS_OBJWIN + + END + END + POPUP "F&ilter" + BEGIN + POPUP "Interframe Blending" + BEGIN + MENUITEM "None", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE + + MENUITEM "Motion Blur", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR + + MENUITEM "Smart", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART + + END + MENUITEM SEPARATOR + MENUITEM "&Normal", ID_OPTIONS_FILTER_NORMAL + MENUITEM "&TV Mode", ID_OPTIONS_FILTER_TVMODE + MENUITEM "&2xSaI", ID_OPTIONS_FILTER_2XSAI + MENUITEM "&Super 2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI + + MENUITEM "Super &Eagle", ID_OPTIONS_FILTER_SUPEREAGLE + + MENUITEM "Pixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL + + MENUITEM "Motion Blur", ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL + + MENUITEM "AdvanceMAME Scale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X + + MENUITEM "Simple 2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X + + MENUITEM "Bilinear", ID_OPTIONS_FILTER_BILINEAR + + MENUITEM "Bilinear Plus", ID_OPTIONS_FILTER_BILINEARPLUS + + MENUITEM "Scanlines", ID_OPTIONS_FILTER_SCANLINES + + MENUITEM "hq2xS", ID_OPTIONS_FILTER_HQ2X2 + MENUITEM "hq2x", ID_OPTIONS_FILTER_HQ2X + MENUITEM "lq2x", ID_OPTIONS_FILTER_LQ2X + MENUITEM "hq3xS", ID_OPTIONS_FILTER_HQ3X2 + MENUITEM "hq3x", ID_OPTIONS_FILTER_HQ3X + MENUITEM SEPARATOR + MENUITEM "&Disable MMX optimizations", ID_OPTIONS_FILTER_DISABLEMMX + + END + POPUP "&Sound" + BEGIN + MENUITEM "&On", ID_OPTIONS_SOUND_ON + MENUITEM "&Mute", ID_OPTIONS_SOUND_MUTE + MENUITEM "Off", ID_OPTIONS_SOUND_OFF + MENUITEM SEPARATOR + MENUITEM "Echo", ID_OPTIONS_SOUND_ECHO + MENUITEM "Low pass filter", ID_OPTIONS_SOUND_LOWPASSFILTER + + MENUITEM "Reverse Stereo", ID_OPTIONS_SOUND_REVERSESTEREO + + MENUITEM "Use old synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION + + MENUITEM "Mute frame advance", ID_OPTIONS_SOUND_MUTEFRAMEADVANCE + + MENUITEM SEPARATOR + POPUP "&Volume" + BEGIN + MENUITEM ".25X", ID_OPTIONS_SOUND_VOLUME_25X + + MENUITEM ".5X", ID_OPTIONS_SOUND_VOLUME_5X + + MENUITEM "&1x", ID_OPTIONS_SOUND_VOLUME_1X + + MENUITEM "&2x", ID_OPTIONS_SOUND_VOLUME_2X + + MENUITEM "&3x", ID_OPTIONS_SOUND_VOLUME_3X + + MENUITEM "&4x", ID_OPTIONS_SOUND_VOLUME_4X + + END + POPUP "Sound &channels" + BEGIN + MENUITEM "Channel &1", ID_OPTIONS_SOUND_CHANNEL1 + , CHECKED + MENUITEM "Channel &2", ID_OPTIONS_SOUND_CHANNEL2 + , CHECKED + MENUITEM "Channel &3", ID_OPTIONS_SOUND_CHANNEL3 + , CHECKED + MENUITEM "Channel &4", ID_OPTIONS_SOUND_CHANNEL4 + , CHECKED + MENUITEM "Direct Sound &A", ID_OPTIONS_SOUND_DIRECTSOUNDA + , CHECKED + MENUITEM "Direct Sound &B", ID_OPTIONS_SOUND_DIRECTSOUNDB + , CHECKED + END + MENUITEM SEPARATOR + MENUITEM "11 &Khz", ID_OPTIONS_SOUND_11KHZ + MENUITEM "22 K&hz", ID_OPTIONS_SOUND_22KHZ + MENUITEM "44 Kh&z", ID_OPTIONS_SOUND_44KHZ + END + MENUITEM SEPARATOR + POPUP "&Emulator" + BEGIN + MENUITEM "Pause when inactive window", ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE + + MENUITEM "Auto hide menu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU + + MENUITEM "Rewind settings...", ID_OPTIONS_EMULATOR_REWINDINTERVAL + + POPUP "Show speed" + BEGIN + MENUITEM "None", ID_OPTIONS_EMULATOR_SHOWSPEED_NONE + + MENUITEM "Percentage", ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE + + MENUITEM "Detailed", ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED + + MENUITEM SEPARATOR + MENUITEM "Transparent", ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT + + END + MENUITEM SEPARATOR + MENUITEM "&Directories...", ID_OPTIONS_EMULATOR_DIRECTORIES + + MENUITEM "&Associate...", ID_OPTIONS_EMULATOR_ASSOCIATE + + MENUITEM "PNG format", ID_OPTIONS_EMULATOR_PNGFORMAT + + MENUITEM "BMP format", ID_OPTIONS_EMULATOR_BMPFORMAT + + MENUITEM SEPARATOR + MENUITEM "&Synchronize emulation speed", + ID_OPTIONS_EMULATOR_SYNCHRONIZE + + MENUITEM "Automatic IPS patching", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH + + MENUITEM "Speed up toggle", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE + + MENUITEM "AGB Print", ID_OPTIONS_EMULATOR_AGBPRINT + + MENUITEM "Real Time Clock", ID_OPTIONS_EMULATOR_REALTIMECLOCK + + MENUITEM "Lag Reduction (GBA)", ID_EMULATOR_GBALAG + MENUITEM "Use Old Frame Timing", ID_EMULATOR_USEOLDGBTIMING + + POPUP "Save Type" + BEGIN + MENUITEM "&Automatic", ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC + + MENUITEM "EEPROM", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM + + MENUITEM "SRAM", ID_OPTIONS_EMULATOR_SAVETYPE_SRAM + + MENUITEM "Flash", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH + + MENUITEM "EEPROM+Sensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR + + MENUITEM "None", ID_OPTIONS_EMULATOR_SAVETYPE_NONE + + MENUITEM SEPARATOR + MENUITEM "Flash 64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K + + MENUITEM "Flash 128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M + + MENUITEM SEPARATOR + MENUITEM "Enhanced detection", ID_OPTIONS_EMULATOR_SAVETYPE_ENHANCEDDETECTION + + END + MENUITEM SEPARATOR + MENUITEM "&Use BIOS file", ID_OPTIONS_EMULATOR_USEBIOSFILE + + MENUITEM "Skip BIOS intro", ID_OPTIONS_EMULATOR_SKIPBIOS + + MENUITEM "S&elect BIOS file...", ID_OPTIONS_EMULATOR_SELECTBIOSFILE + + END + POPUP "&Gameboy" + BEGIN + MENUITEM "&Automatic Mode", ID_OPTIONS_GAMEBOY_AUTOMATIC + + MENUITEM "&Game Boy Advance (GBA/AGB)", ID_OPTIONS_GAMEBOY_GBA + MENUITEM "&Game Boy Color (GBC/CGB)", ID_OPTIONS_GAMEBOY_CGB + MENUITEM "Game Boy Color + SGB borders", ID_OPTIONS_GAMEBOY_SGB2 + MENUITEM "&Super Game Boy (SGB)", ID_OPTIONS_GAMEBOY_SGB + MENUITEM "Game &Boy (GB)", ID_OPTIONS_GAMEBOY_GB + MENUITEM SEPARATOR + MENUITEM "Border Automatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC + + MENUITEM "Border Always", ID_OPTIONS_GAMEBOY_BORDER + + MENUITEM "Emulate &Printer", ID_OPTIONS_GAMEBOY_PRINTER + + MENUITEM SEPARATOR + MENUITEM "&Real Colors", ID_OPTIONS_GAMEBOY_REALCOLORS + + MENUITEM "Ga&meboy Colors", ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS + + MENUITEM "Customize Colors...", ID_OPTIONS_GAMEBOY_COLORS + + END + MENUITEM SEPARATOR + POPUP "&Language" + BEGIN + MENUITEM "&System", ID_OPTIONS_LANGUAGE_SYSTEM + + MENUITEM "&English", ID_OPTIONS_LANGUAGE_ENGLISH + + MENUITEM "&Other...", ID_OPTIONS_LANGUAGE_OTHER + + END + END + POPUP "&Cheats" + BEGIN + MENUITEM "&Search for cheats...", ID_CHEATS_SEARCHFORCHEATS + MENUITEM "Pause during cheat search", ID_CHEATS_PAUSEDURINGCHEATSEARCH + + MENUITEM "&Cheat list...", ID_CHEATS_CHEATLIST + MENUITEM SEPARATOR + MENUITEM "&Automatic save/load cheats", ID_CHEATS_AUTOMATICSAVELOADCHEATS + + MENUITEM "Disable cheats", ID_CHEATS_DISABLECHEATS + MENUITEM "&Load cheat list...", ID_CHEATS_LOADCHEATLIST + MENUITEM "Sa&ve cheat list...", ID_CHEATS_SAVECHEATLIST + END + POPUP "&Tools" + BEGIN + POPUP "Debug" + BEGIN + MENUITEM "Disassemble...", ID_TOOLS_DISASSEMBLE + MENUITEM "Logging...", ID_TOOLS_LOGGING + MENUITEM "&IO Viewer...", ID_TOOLS_IOVIEWER + MENUITEM "&Map Viewer...", ID_TOOLS_MAPVIEW + MENUITEM "M&emory viewer...", ID_TOOLS_MEMORYVIEWER + MENUITEM "OAM Viewer...", ID_TOOLS_OAMVIEWER + MENUITEM "&Palette Viewer...", ID_TOOLS_PALETTEVIEW + MENUITEM "Tile Viewer...", ID_TOOLS_TILEVIEWER + POPUP "GDB" + BEGIN + MENUITEM "Wait for connection...", ID_TOOLS_DEBUG_GDB + MENUITEM "Load and wait...", ID_TOOLS_DEBUG_LOADANDWAIT + + MENUITEM "Break into GDB", ID_TOOLS_DEBUG_BREAK + MENUITEM "Disconnect", ID_TOOLS_DEBUG_DISCONNECT + + END + END + MENUITEM SEPARATOR + MENUITEM "Frame Counter", ID_TOOLS_FRAMECOUNTER + MENUITEM "Input Display", ID_TOOLS_INPUTDISPLAY + MENUITEM SEPARATOR + MENUITEM "&Frame Advance", ID_DEBUG_NEXTFRAME + MENUITEM "Rewind", ID_TOOLS_REWIND + MENUITEM "Frame Search", ID_DEBUG_FRAMESEARCH + MENUITEM "Frame Search Prev", ID_DEBUG_FRAMESEARCHPREV + MENUITEM "Frame Search End", ID_DEBUG_FRAMESEARCHLOAD + MENUITEM SEPARATOR + POPUP "Play" + BEGIN + MENUITEM "Start playing movie...", ID_TOOLS_PLAY_STARTMOVIEPLAYING + + MENUITEM "Stop playing movie", ID_TOOLS_PLAY_STOPMOVIEPLAYING + + MENUITEM SEPARATOR + MENUITEM "Read-only mode", ID_TOOLS_PLAY_READONLY + MENUITEM SEPARATOR + MENUITEM "Continue recording from here", ID_TOOLS_PLAY_CONTINUE + MENUITEM "Watch from beginning", ID_TOOLS_PLAY_RESTART + END + POPUP "Record" + BEGIN + MENUITEM "Start movie recording...", ID_TOOLS_RECORD_STARTMOVIERECORDING + + MENUITEM "Stop movie recording", ID_TOOLS_RECORD_STOPMOVIERECORDING + + MENUITEM SEPARATOR + MENUITEM "Start AVI recording...", ID_TOOLS_RECORD_STARTAVIRECORDING + + MENUITEM "Stop AVI recording", ID_TOOLS_RECORD_STOPAVIRECORDING + + MENUITEM SEPARATOR + MENUITEM "Start sound recording...", ID_OPTIONS_SOUND_STARTRECORDING + + MENUITEM "Stop sound recording", ID_OPTIONS_SOUND_STOPRECORDING + + END + MENUITEM SEPARATOR + MENUITEM "Customize All Commands...", ID_TOOLS_CUSTOMIZE + MENUITEM "Customize Common Hotkeys...", ID_TOOLS_CUSTOMIZE_COMMON + END + POPUP "&Help" + BEGIN + MENUITEM "Bug Report", ID_HELP_BUGREPORT + MENUITEM "FAQ (website)", ID_HELP_FAQ + MENUITEM SEPARATOR + MENUITEM "&About...", ID_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_ACCELERATOR ACCELERATORS +BEGIN + "C", ID_CHEATS_SEARCHFORCHEATS, VIRTKEY, CONTROL, NOINVERT + VK_OEM_6, ID_DEBUG_FRAMESEARCH, VIRTKEY, NOINVERT + "L", ID_DEBUG_FRAMESEARCHLOAD, VIRTKEY, NOINVERT + VK_OEM_4, ID_DEBUG_FRAMESEARCHPREV, VIRTKEY, NOINVERT + "N", ID_DEBUG_NEXTFRAME, VIRTKEY, CONTROL, NOINVERT + VK_OEM_5, ID_DEBUG_NEXTFRAME, VIRTKEY, NOINVERT + "X", ID_FILE_EXIT, VIRTKEY, CONTROL, NOINVERT + "L", ID_FILE_LOAD, VIRTKEY, SHIFT, CONTROL, + NOINVERT + VK_F1, ID_FILE_LOADGAME_SLOT1, VIRTKEY, NOINVERT + VK_F10, ID_FILE_LOADGAME_SLOT10, VIRTKEY, NOINVERT + VK_F2, ID_FILE_LOADGAME_SLOT2, VIRTKEY, NOINVERT + VK_F3, ID_FILE_LOADGAME_SLOT3, VIRTKEY, NOINVERT + VK_F4, ID_FILE_LOADGAME_SLOT4, VIRTKEY, NOINVERT + VK_F5, ID_FILE_LOADGAME_SLOT5, VIRTKEY, NOINVERT + VK_F6, ID_FILE_LOADGAME_SLOT6, VIRTKEY, NOINVERT + VK_F7, ID_FILE_LOADGAME_SLOT7, VIRTKEY, NOINVERT + VK_F8, ID_FILE_LOADGAME_SLOT8, VIRTKEY, NOINVERT + VK_F9, ID_FILE_LOADGAME_SLOT9, VIRTKEY, NOINVERT + VK_F1, ID_FILE_MRU_FILE1, VIRTKEY, CONTROL, NOINVERT + VK_F10, ID_FILE_MRU_FILE10, VIRTKEY, CONTROL, NOINVERT + VK_F2, ID_FILE_MRU_FILE2, VIRTKEY, CONTROL, NOINVERT + VK_F3, ID_FILE_MRU_FILE3, VIRTKEY, CONTROL, NOINVERT + VK_F4, ID_FILE_MRU_FILE4, VIRTKEY, CONTROL, NOINVERT + VK_F5, ID_FILE_MRU_FILE5, VIRTKEY, CONTROL, NOINVERT + VK_F6, ID_FILE_MRU_FILE6, VIRTKEY, CONTROL, NOINVERT + VK_F7, ID_FILE_MRU_FILE7, VIRTKEY, CONTROL, NOINVERT + VK_F8, ID_FILE_MRU_FILE8, VIRTKEY, CONTROL, NOINVERT + VK_F9, ID_FILE_MRU_FILE9, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", ID_FILE_PAUSE, VIRTKEY, CONTROL, NOINVERT + VK_PAUSE, ID_FILE_PAUSE, VIRTKEY, NOINVERT + "R", ID_FILE_RESET, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, SHIFT, CONTROL, + NOINVERT + VK_F1, ID_FILE_SAVEGAME_SLOT1, VIRTKEY, SHIFT, NOINVERT + VK_F10, ID_FILE_SAVEGAME_SLOT10, VIRTKEY, SHIFT, NOINVERT + VK_F2, ID_FILE_SAVEGAME_SLOT2, VIRTKEY, SHIFT, NOINVERT + VK_F3, ID_FILE_SAVEGAME_SLOT3, VIRTKEY, SHIFT, NOINVERT + VK_F4, ID_FILE_SAVEGAME_SLOT4, VIRTKEY, SHIFT, NOINVERT + VK_F5, ID_FILE_SAVEGAME_SLOT5, VIRTKEY, SHIFT, NOINVERT + VK_F6, ID_FILE_SAVEGAME_SLOT6, VIRTKEY, SHIFT, NOINVERT + VK_F7, ID_FILE_SAVEGAME_SLOT7, VIRTKEY, SHIFT, NOINVERT + VK_F8, ID_FILE_SAVEGAME_SLOT8, VIRTKEY, SHIFT, NOINVERT + VK_F9, ID_FILE_SAVEGAME_SLOT9, VIRTKEY, SHIFT, NOINVERT + VK_ESCAPE, ID_FILE_TOGGLEMENU, VIRTKEY, NOINVERT + VK_OEM_MINUS, ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE, VIRTKEY, + NOINVERT + VK_OEM_PLUS, ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE, VIRTKEY, + NOINVERT + "1", ID_OPTIONS_JOYPAD_AUTOFIRE_A, VIRTKEY, ALT, NOINVERT + "2", ID_OPTIONS_JOYPAD_AUTOFIRE_B, VIRTKEY, ALT, NOINVERT + VK_OEM_3, ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR, VIRTKEY, ALT, NOINVERT + "8", ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN, VIRTKEY, ALT, NOINVERT + "3", ID_OPTIONS_JOYPAD_AUTOFIRE_L, VIRTKEY, ALT, NOINVERT + "9", ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT, VIRTKEY, ALT, NOINVERT + "4", ID_OPTIONS_JOYPAD_AUTOFIRE_R, VIRTKEY, ALT, NOINVERT + "0", ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT, VIRTKEY, ALT, NOINVERT + "6", ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT, VIRTKEY, ALT, + NOINVERT + "5", ID_OPTIONS_JOYPAD_AUTOFIRE_START, VIRTKEY, ALT, NOINVERT + "7", ID_OPTIONS_JOYPAD_AUTOFIRE_UP, VIRTKEY, ALT, NOINVERT + "1", ID_OPTIONS_VIDEO_LAYERS_BG0, VIRTKEY, CONTROL, NOINVERT + "2", ID_OPTIONS_VIDEO_LAYERS_BG1, VIRTKEY, CONTROL, NOINVERT + "3", ID_OPTIONS_VIDEO_LAYERS_BG2, VIRTKEY, CONTROL, NOINVERT + "4", ID_OPTIONS_VIDEO_LAYERS_BG3, VIRTKEY, CONTROL, NOINVERT + "5", ID_OPTIONS_VIDEO_LAYERS_OBJ, VIRTKEY, CONTROL, NOINVERT + "8", ID_OPTIONS_VIDEO_LAYERS_OBJWIN, VIRTKEY, CONTROL, + NOINVERT + "6", ID_OPTIONS_VIDEO_LAYERS_WIN0, VIRTKEY, CONTROL, NOINVERT + "7", ID_OPTIONS_VIDEO_LAYERS_WIN1, VIRTKEY, CONTROL, NOINVERT + VK_OEM_PERIOD, ID_TOOLS_FRAMECOUNTER, VIRTKEY, NOINVERT + VK_OEM_COMMA, ID_TOOLS_INPUTDISPLAY, VIRTKEY, NOINVERT + "8", ID_TOOLS_PLAY_READONLY, VIRTKEY, SHIFT, NOINVERT + "B", ID_TOOLS_REWIND, VIRTKEY, CONTROL, NOINVERT + "1", ID_SELECT_SLOT1, VIRTKEY, NOINVERT + "2", ID_SELECT_SLOT2, VIRTKEY, NOINVERT + "3", ID_SELECT_SLOT3, VIRTKEY, NOINVERT + "4", ID_SELECT_SLOT4, VIRTKEY, NOINVERT + "5", ID_SELECT_SLOT5, VIRTKEY, NOINVERT + "6", ID_SELECT_SLOT6, VIRTKEY, NOINVERT + "7", ID_SELECT_SLOT7, VIRTKEY, NOINVERT + "8", ID_SELECT_SLOT8, VIRTKEY, NOINVERT + "9", ID_SELECT_SLOT9, VIRTKEY, NOINVERT + "0", ID_SELECT_SLOT10, VIRTKEY, NOINVERT + "L", ID_FILE_LOADGAME_CURRENT, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVEGAME_CURRENT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "VisualBoyAdvance.exe.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_UNSUPPORTED_VBA_SGM "Unsupported VisualBoyAdvance save game version %d" + IDS_CANNOT_LOAD_SGM "Cannot load save game for %s" + IDS_SAVE_GAME_NOT_USING_BIOS "Save game is not using the BIOS file" + IDS_SAVE_GAME_USING_BIOS "Save game is using the BIOS file" + IDS_UNSUPPORTED_SAVE_TYPE "Unsupported save type %d" + IDS_CANNOT_OPEN_FILE "Cannot open file %s" + IDS_BAD_ZIP_FILE "Bad ZIP file %s" + IDS_NO_IMAGE_ON_ZIP "No image found on ZIP file %s" + IDS_ERROR_OPENING_IMAGE "Error opening image %s" + IDS_ERROR_READING_IMAGE "Error reading image %s" + IDS_UNSUPPORTED_BIOS_FUNCTION + "Unsupported BIOS function %02x called from %08x. A BIOS file is needed in order to get correct behaviour." + IDS_INVALID_BIOS_FILE_SIZE "Invalid BIOS file size" + IDS_INVALID_CHEAT_CODE "Invalid cheat code '%s'. Supported formats are:\nXXXXXXXX:YY, XXXXXXXX:YYYY, XXXXXXXX:YYYYYYYY." + IDS_UNKNOWN_ARM_OPCDOE "Unimplemented opcode %08x from %08x" + IDS_UNKNOWN_THUMB_OPCODE "Unknown opcode %04x from %08x" +END + +STRINGTABLE +BEGIN + IDS_ERROR_CREATING_FILE "Error creating file %s" + IDS_FAILED_TO_READ_SGM "Failed to read complete save game %s (%d)" + IDS_FAILED_TO_READ_RTC "Failed to read RTC from save game %s (continuing)" + IDS_UNSUPPORTED_VB_SGM "Unsupported VisualBoy save game version %d" + IDS_CANNOT_LOAD_SGM_FOR "Cannot load save game for %s. Playing %s" + IDS_ERROR_OPENING_IMAGE_FROM "Error opening image %s from zip file %s" + IDS_ERROR_READING_IMAGE_FROM "Error reading image %s from zip file %s" + IDS_UNSUPPORTED_ROM_SIZE "Unsupported rom size %02x" + IDS_UNSUPPORTED_RAM_SIZE "Unsupported ram size %02x" + IDS_UNKNOWN_CARTRIDGE_TYPE "Unknown cartridge type %02x" + IDS_MAXIMUM_NUMBER_OF_CHEATS "Maximum number of cheats reached." + IDS_INVALID_GAMESHARK_CODE "Invalid GameShark code: %s" + IDS_INVALID_GAMEGENIE_CODE "Invalid GameGenie code: %s" + IDS_INVALID_CHEAT_TO_REMOVE "Invalid cheat to remove %d" + IDS_INVALID_CHEAT_CODE_ADDRESS "Invalid cheat code address: %08x" + IDS_UNSUPPORTED_CHEAT_LIST_VERSION "Unsupported cheat list version %d" +END + +STRINGTABLE +BEGIN + IDS_DIRECTX_7_REQUIRED "DirectX 7.0 or greater is required to run.\nDownload at http://www.microsoft.com/directx.\n\nError found at: %s" + IDS_DISABLING_VIDEO_MEMORY "Disabling Use Video Memory setting" + IDS_SETTING_WILL_BE_EFFECTIVE + "Setting will be effective the next time you start the emulator" + IDS_DISABLING_EMULATION_ONLY "Disabling Emulation Only setting" + IDS_FAILED_TO_OPEN_FILE "Failed to open file %s" + IDS_FAILED_TO_READ_ZIP_DIR "Failed to read zip directory for file %s" + IDS_UNSUPPORTED_FILE_TYPE "The file ""%s"" is an unsupported type." + IDS_CANNOT_CREATE_DIRECTSOUND "Cannot create DirectSound %08x" + IDS_CANNOT_SETCOOPERATIVELEVEL "Cannot SetCooperativeLevel %08x" + IDS_CANNOT_CREATESOUNDBUFFER "Cannot CreateSoundBuffer %08x" + IDS_CANNOT_SETFORMAT_PRIMARY "Cannot SetFormat for primary %08x" + IDS_CANNOT_CREATESOUNDBUFFER_SEC "Cannot CreateSoundBuffer secondary %08x" + IDS_CANNOT_PLAY_PRIMARY "Cannot Play primary %08x" + IDS_SEARCH_PRODUCED_TOO_MANY + "Search produced %d results.\nThey have been remembered, but are too many to display.\nPlease refine it better by performing additional searches." + IDS_NUMBER_CANNOT_BE_EMPTY "Number cannot be empty" + IDS_INVALID_ADDRESS "Invalid address: %08x" +END + +STRINGTABLE +BEGIN + IDS_MISALIGNED_HALFWORD "Misaligned half-word address: %08x" + IDS_MISALIGNED_WORD "Misaligned word address: %08x" + IDS_VALUE_CANNOT_BE_EMPTY "Value cannot be empty" + IDS_ERROR_ON_STARTDOC "Error on StartDoc" + IDS_ERROR_ON_STARTPAGE "Error on StartPage" + IDS_ERROR_PRINTING_ON_STRETCH "Error printing on StretchDIBits" + IDS_ERROR_ON_ENDPAGE "Error on EndPage" + IDS_ERROR_ON_ENDDOC "Error on EndDoc" + IDS_ERROR "Error" + IDS_JOY_LEFT "Joy %d Left" + IDS_JOY_RIGHT "Joy %d Right" + IDS_JOY_UP "Joy %d Up" + IDS_JOY_DOWN "Joy %d Down" + IDS_JOY_BUTTON "Joy %d %s" + IDS_SELECT_ROM_DIR "Select ROM directory:" + IDS_SELECT_BATTERY_DIR "Select Battery directory:" +END + +STRINGTABLE +BEGIN + IDS_SELECT_SAVE_DIR "Select Save Directory:" + IDS_SELECT_CAPTURE_DIR "Select Capture directory:" + IDS_SELECT_BIOS_FILE "Select BIOS file" + IDS_RESET "Reset" + IDS_AUTOFIRE_A_DISABLED "turbo A off" + IDS_AUTOFIRE_A "turbo A on" + IDS_AUTOFIRE_B_DISABLED "turbo B off" + IDS_AUTOFIRE_B "turbo B on" + IDS_AUTOFIRE_L_DISABLED "turbo L off" + IDS_AUTOFIRE_L "turbo L on" + IDS_AUTOFIRE_R_DISABLED "turbo R off" + IDS_AUTOFIRE_R "turbo R on" + IDS_SELECT_ROM "Select ROM" + IDS_SELECT_SAVE_GAME_NAME "Select save game name" + IDS_LOADED_STATE "Loaded state" + IDS_LOADED_STATE_N "Loaded %d" +END + +STRINGTABLE +BEGIN + IDS_WROTE_STATE "Saved state" + IDS_WROTE_STATE_N "Saved %d" + IDS_LOADED_BATTERY "Loaded battery" + IDS_SELECT_CAPTURE_NAME "Select screen capture name" + IDS_SCREEN_CAPTURE "Screen capture" + IDS_ADDRESS "Address" + IDS_OLD_VALUE "Old Value" + IDS_NEW_VALUE "New Value" + IDS_ADD_CHEAT_CODE "Add cheat code" + IDS_CODE "Code" + IDS_DESCRIPTION "Description" + IDS_STATUS "Status" + IDS_ADD_GG_CODE "Add GameGenie code" + IDS_ADD_GS_CODE "Add GameShark code" + IDS_POCKET_PRINTER "Pocket Printer" + IDS_UNKNOWN "Unknown" +END + +STRINGTABLE +BEGIN + IDS_NONE "None" + IDS_FAILED_TO_LOAD_LIBRARY "Failed to load library %s" + IDS_FAILED_TO_GET_LOCINFO "Failed to get locale information" + IDS_SELECT_CHEAT_LIST_NAME "Select cheat list name" + IDS_FILTER_BIOS "Gameboy Advance_*.BIN;*.AGB;*.GBA;*.BIOS;*.ZIP;*.Z;*.GZ__" + IDS_FILTER_ROM "All Gameboy / Gameboy Advance_*.BIN;*.AGB;*.GBA;*.MB;*.ELF;*.GB;*.SGB;*.CGB;*.GBC;*.ZIP;*.Z;*.GZ_Gameboy Advance_*.BIN;*.AGB;*.GBA_Gameboy_*.GB;*.SGB;*.CGB;*.GBC__" + IDS_FILTER_SGM "VisualBoyAdvance Save Game_*.SGM__" + IDS_FILTER_CHEAT_LIST "VisualBoyAdvance Cheat List_*.CLT__" + IDS_FILTER_PNG "PNG Image_*.PNG_BMP Image_*.BMP__" + IDS_LOADED_CHEATS "Loaded cheats" + IDS_ERROR_DISP_COLOR "Unsupported display setting for color depth: %d bits. \nWindows desktop must be in either 16-bit, 24-bit or 32-bit mode for this program to work in window mode." + IDS_ADD_GSA_CODE "Add GamesharkAdvance code" + IDS_FILTER_SPS "Gameshark Snapshot_*.SPS__" + IDS_SELECT_SNAPSHOT_FILE "Select snapshot file" + IDS_FILTER_SAV "Battery file_*.SAV_Flash save_*.DAT__" + IDS_SELECT_BATTERY_FILE "Select battery file" +END + +STRINGTABLE +BEGIN + IDS_UNSUPPORTED_CHEAT_LIST_TYPE "Unsupported cheat list type %d" + IDS_INVALID_GSA_CODE "Invalid GSA code. Format is XXXXXXXXYYYYYYYY." + IDS_CANNOT_IMPORT_SNAPSHOT_FOR + "Cannot import snapshot for %s. Current game is %s" + IDS_UNSUPPORTED_SNAPSHOT_FILE "Unsupported snapshot file %s" + IDS_UNSUPPORTED_ARM_MODE "Unsupported ARM mode %02x" + IDS_UNSUPPORTED_CODE_FILE "Unsupported code file %s" + IDS_GSA_CODE_WARNING "Warning: cheats are for game %s. Current game is %s.\nCodes may not work correctly." + IDS_INVALID_CBA_CODE "Invalid CBA code. Format is XXXXXXXX YYYY." + IDS_CBA_CODE_WARNING "Warning: Codes seem to be for a different game.\nCodes may not work correctly." + IDS_OUT_OF_MEMORY "Failed to allocate memory for %s" +END + +STRINGTABLE +BEGIN + IDS_FILTER_GBS "Gameboy Snapshot_*.GBS__" + IDS_FILTER_GCF "Gameshark Code File_*.GCF__" + IDS_SELECT_CODE_FILE "Select code file" + IDS_SAVE_WILL_BE_LOST "Importing a snapshot file will erase any saved games and reset the emulator. Do you want to continue?" + IDS_CONFIRM_ACTION "Please confirm action" + IDS_CODES_WILL_BE_LOST "Importing a code file will erase any entered codes. Do you want to continue?" + IDS_FILTER_SPC "Gameshark Code File_*.SPC;*.XPC__" + IDS_ADD_CBA_CODE "Add CodeBreakerAdvance code" + IDS_FILTER_WAV "Wave file_*.WAV__" + IDS_SELECT_WAV_NAME "Select wave file name" + IDS_FILTER_GBROM "All Gameboy_*.GB;*.SGB;*.CGB;*.GBC;*.ZIP;*.Z;*.GZ_Gameboy_*.GB_Super Gameboy_*.SGB_Color Gameboy_*.CGB;*.GBC__" + IDS_FILTER_PAL "Windows Palette (*.PAL)_*.PAL_PaintShop Palette (*.PAL)_*.PAL_Adobe Color Table (*.ACT)_*.ACT__" + IDS_SELECT_PALETTE_NAME "Select palette name:" + IDS_SEARCH_PRODUCED_NO_RESULTS "Search produced no results." + IDS_ERROR_BINDING "Error binding socket. Port probably in use." + IDS_ERROR_LISTENING "Error listening on socket." +END + +STRINGTABLE +BEGIN + IDS_ERROR_CREATING_SOCKET "Error creating socket." + IDS_ACK_NOT_RECEIVED "ACK not received from GDB." + IDS_ERROR_NOT_GBA_IMAGE "Error: not a GBA image." + IDS_EEPROM_NOT_SUPPORTED "EEPROM saves cannot be exported." + IDS_FILTER_DUMP "Memory Dump_*.DMP__" + IDS_SELECT_DUMP_FILE "Select dump file name" + IDS_FILTER_AVI "AVI File_*.AVI__" + IDS_SELECT_AVI_NAME "Select AVI file name" + IDS_INVALID_THROTTLE_VALUE + "Invalid throttle value. Please enter a number between 5 and 1000." + IDS_FILTER_INI "Skin INI File_*.INI__" + IDS_SELECT_SKIN_FILE "Select the skin file name" + IDS_FILTER_MOVIE "VisualBoyAdvance Movie (.vbm)_*.vbm__" + IDS_SELECT_MOVIE_NAME "Select movie name" + IDS_BUG_REPORT "The bug report information is now available on the Windows Clipboard. Please paste it into any bug report made by email or on forums to help solve problems more easily." + IDS_UNSUPPORTED_MOVIE_VERSION "Unsupported movie version %d." + IDS_END_OF_MOVIE "end of movie" +END + +STRINGTABLE +BEGIN + IDS_INVALID_INTERVAL_VALUE + "Invalid rewind interval value. Please enter a number between 0 and 600 seconds." + IDS_REGISTRY "VisualBoyAdvance no longer uses the registry to store its settings. Your previous settings have been exported into the file: %s" + IDS_MOVIE_PLAY "Playing a movie will load a save state which may erase your previous battery saves. Please be sure to have a saved state if you don't want to loose any previous data." + IDS_AUTOFIRE_DISABLED "autofire off" + IDS_AUTOFIRE_ALREADY_DISABLED "autofire already off" + IDS_AUTOFIRE_START_DISABLED "turbo Start off" + IDS_AUTOFIRE_START "turbo Start on" + IDS_AUTOFIRE_SELECT_DISABLED "turbo Select off" + IDS_AUTOFIRE_SELECT "turbo Select on" + IDS_AUTOFIRE_UP_DISABLED "turbo Up off" + IDS_AUTOFIRE_UP "turbo Up on" + IDS_AUTOFIRE_DOWN_DISABLED "turbo Down off" + IDS_AUTOFIRE_DOWN "turbo Down on" + IDS_AUTOFIRE_LEFT_DISABLED "turbo Left off" + IDS_AUTOFIRE_LEFT "turbo Left on" + IDS_AUTOFIRE_RIGHT_DISABLED "turbo Right off" +END + +STRINGTABLE +BEGIN + IDS_AUTOFIRE_RIGHT "turbo Right on" + IDS_RERECORDED_STATE_N "Re-record from %d" + IDS_REPLAYED_STATE_N "Rewind to %d" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/win32/vba.rc2 b/src/win32/vba.rc2 new file mode 100644 index 0000000..f4cbf4a --- /dev/null +++ b/src/win32/vba.rc2 @@ -0,0 +1,50 @@ + +// what the hell? all this file does is cause enigmatic build errors... + +/* +#ifndef _MAC +#include "../AutoBuild.h" +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION FILEVER + PRODUCTVERSION PRODUCTVER + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x29L +#else + FILEFLAGS 0x28L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "VisualBoyAdvance comes with NO WARRANTY. Use it at your own risk.\0" + VALUE "CompanyName", "None\0" + VALUE "FileDescription", "VisualBoyAdvance emulator\0" + VALUE "FileVersion", STRFILEVER + VALUE "InternalName", "VisualBoyAdvance\0" + VALUE "LegalCopyright", "Copyright © 2004 Forgotten and the VBA team\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "VisualBoyAdvance.exe\0" + VALUE "PrivateBuild", "0\0" + VALUE "ProductName", "VisualBoyAdvance emulator\0" + VALUE "ProductVersion", STRPRODUCTVER + VALUE "SpecialBuild", "0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC +*/ \ No newline at end of file diff --git a/win32/GBA.vcproj b/win32/GBA.vcproj new file mode 100644 index 0000000..09ff1f4 --- /dev/null +++ b/win32/GBA.vcproj @@ -0,0 +1,1419 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/win32/Makefile.am b/win32/Makefile.am new file mode 100644 index 0000000..556b49c --- /dev/null +++ b/win32/Makefile.am @@ -0,0 +1,9 @@ +EXTRA_DIST = \ + gba.sln \ + GBA.vcproj \ + lib \ + include \ + directx + +dist-hook: + rm -rf `find $(distdir) -name CVS` diff --git a/win32/Makefile.in b/win32/Makefile.in new file mode 100644 index 0000000..5162e02 --- /dev/null +++ b/win32/Makefile.in @@ -0,0 +1,311 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GTKMM_CFLAGS = @GTKMM_CFLAGS@ +GTKMM_CPPFLAGS = @GTKMM_CPPFLAGS@ +GTKMM_LIBS = @GTKMM_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VBA_EXTRA = @VBA_EXTRA@ +VBA_LIBS = @VBA_LIBS@ +VBA_SRC_EXTRA = @VBA_SRC_EXTRA@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +EXTRA_DIST = \ + gba_sdl.dsp \ + gba_sdl.dsw \ + gba_sdl.sln \ + gba_sdl.vcproj \ + GBA.dsp \ + GBA.dsw \ + gba.sln \ + GBA.vcproj \ + SDL-1.2.2 \ + lib \ + include + +subdir = win32 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu win32/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + + +dist-hook: + rm -rf `find $(distdir) -name CVS` +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/win32/directx/d3d8.h b/win32/directx/d3d8.h new file mode 100644 index 0000000..2600282 --- /dev/null +++ b/win32/directx/d3d8.h @@ -0,0 +1,1279 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D8_H_ +#define _D3D8_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + + +/* This identifier is passed to Direct3DCreate8 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate8 will fail. + * (The number itself has no meaning.)*/ + +#define D3D_SDK_VERSION 220 + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D8 */ +/* {1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512} */ +DEFINE_GUID(IID_IDirect3D8, 0x1dd9e8da, 0x1c77, 0x4d40, 0xb0, 0xcf, 0x98, 0xfe, 0xfd, 0xff, 0x95, 0x12); + +/* IID_IDirect3DDevice8 */ +/* {7385E5DF-8FE8-41D5-86B6-D7B48547B6CF} */ +DEFINE_GUID(IID_IDirect3DDevice8, 0x7385e5df, 0x8fe8, 0x41d5, 0x86, 0xb6, 0xd7, 0xb4, 0x85, 0x47, 0xb6, 0xcf); + +/* IID_IDirect3DResource8 */ +/* {1B36BB7B-09B7-410a-B445-7D1430D7B33F} */ +DEFINE_GUID(IID_IDirect3DResource8, 0x1b36bb7b, 0x9b7, 0x410a, 0xb4, 0x45, 0x7d, 0x14, 0x30, 0xd7, 0xb3, 0x3f); + +/* IID_IDirect3DBaseTexture8 */ +/* {B4211CFA-51B9-4a9f-AB78-DB99B2BB678E} */ +DEFINE_GUID(IID_IDirect3DBaseTexture8, 0xb4211cfa, 0x51b9, 0x4a9f, 0xab, 0x78, 0xdb, 0x99, 0xb2, 0xbb, 0x67, 0x8e); + +/* IID_IDirect3DTexture8 */ +/* {E4CDD575-2866-4f01-B12E-7EECE1EC9358} */ +DEFINE_GUID(IID_IDirect3DTexture8, 0xe4cdd575, 0x2866, 0x4f01, 0xb1, 0x2e, 0x7e, 0xec, 0xe1, 0xec, 0x93, 0x58); + +/* IID_IDirect3DCubeTexture8 */ +/* {3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750} */ +DEFINE_GUID(IID_IDirect3DCubeTexture8, 0x3ee5b968, 0x2aca, 0x4c34, 0x8b, 0xb5, 0x7e, 0x0c, 0x3d, 0x19, 0xb7, 0x50); + +/* IID_IDirect3DVolumeTexture8 */ +/* {4B8AAAFA-140F-42ba-9131-597EAFAA2EAD} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture8, 0x4b8aaafa, 0x140f, 0x42ba, 0x91, 0x31, 0x59, 0x7e, 0xaf, 0xaa, 0x2e, 0xad); + +/* IID_IDirect3DVertexBuffer8 */ +/* {8AEEEAC7-05F9-44d4-B591-000B0DF1CB95} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0x8aeeeac7, 0x05f9, 0x44d4, 0xb5, 0x91, 0x00, 0x0b, 0x0d, 0xf1, 0xcb, 0x95); + +/* IID_IDirect3DIndexBuffer8 */ +/* {0E689C9A-053D-44a0-9D92-DB0E3D750F86} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0x0e689c9a, 0x053d, 0x44a0, 0x9d, 0x92, 0xdb, 0x0e, 0x3d, 0x75, 0x0f, 0x86); + +/* IID_IDirect3DSurface8 */ +/* {B96EEBCA-B326-4ea5-882F-2FF5BAE021DD} */ +DEFINE_GUID(IID_IDirect3DSurface8, 0xb96eebca, 0xb326, 0x4ea5, 0x88, 0x2f, 0x2f, 0xf5, 0xba, 0xe0, 0x21, 0xdd); + +/* IID_IDirect3DVolume8 */ +/* {BD7349F5-14F1-42e4-9C79-972380DB40C0} */ +DEFINE_GUID(IID_IDirect3DVolume8, 0xbd7349f5, 0x14f1, 0x42e4, 0x9c, 0x79, 0x97, 0x23, 0x80, 0xdb, 0x40, 0xc0); + +/* IID_IDirect3DSwapChain8 */ +/* {928C088B-76B9-4C6B-A536-A590853876CD} */ +DEFINE_GUID(IID_IDirect3DSwapChain8, 0x928c088b, 0x76b9, 0x4c6b, 0xa5, 0x36, 0xa5, 0x90, 0x85, 0x38, 0x76, 0xcd); + +#endif + +#ifdef __cplusplus + +interface IDirect3D8; +interface IDirect3DDevice8; + +interface IDirect3DResource8; +interface IDirect3DBaseTexture8; +interface IDirect3DTexture8; +interface IDirect3DVolumeTexture8; +interface IDirect3DCubeTexture8; + +interface IDirect3DVertexBuffer8; +interface IDirect3DIndexBuffer8; + +interface IDirect3DSurface8; +interface IDirect3DVolume8; + +interface IDirect3DSwapChain8; + +#endif + + +typedef interface IDirect3D8 IDirect3D8; +typedef interface IDirect3DDevice8 IDirect3DDevice8; +typedef interface IDirect3DResource8 IDirect3DResource8; +typedef interface IDirect3DBaseTexture8 IDirect3DBaseTexture8; +typedef interface IDirect3DTexture8 IDirect3DTexture8; +typedef interface IDirect3DVolumeTexture8 IDirect3DVolumeTexture8; +typedef interface IDirect3DCubeTexture8 IDirect3DCubeTexture8; +typedef interface IDirect3DVertexBuffer8 IDirect3DVertexBuffer8; +typedef interface IDirect3DIndexBuffer8 IDirect3DIndexBuffer8; +typedef interface IDirect3DSurface8 IDirect3DSurface8; +typedef interface IDirect3DVolume8 IDirect3DVolume8; +typedef interface IDirect3DSwapChain8 IDirect3DSwapChain8; + +#include "d3d8types.h" +#include "d3d8caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D8 object. This object supports + * enumeration and allows the creation of Direct3DDevice8 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D8 * WINAPI Direct3DCreate8(UINT SDKVersion); + + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D8 + +DECLARE_INTERFACE_(IDirect3D8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D8 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface) PURE; +}; + +typedef struct IDirect3D8 *LPDIRECT3D8, *PDIRECT3D8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D8_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->lpVtbl->GetAdapterModeCount(p,a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->lpVtbl->EnumAdapterModes(p,a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D8_AddRef(p) (p)->AddRef() +#define IDirect3D8_Release(p) (p)->Release() +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D8_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->GetAdapterModeCount(a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->EnumAdapterModes(a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->CheckDeviceMultiSampleType(a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice8 + +DECLARE_INTERFACE_(IDirect3DDevice8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice8 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(ResourceManagerDiscardBytes)(THIS_ DWORD Bytes) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D8** ppD3D8) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS8* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface8* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateImageSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CopyRects)(THIS_ IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture) PURE; + STDMETHOD(GetFrontBuffer)(THIS_ IDirect3DSurface8* pDestSurface) PURE; + STDMETHOD(SetRenderTarget)(THIS_ IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil) PURE; + STDMETHOD(GetRenderTarget)(THIS_ IDirect3DSurface8** ppRenderTarget) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface8** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT8*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT8*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,DWORD* pToken) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) PURE; + STDMETHOD(SetVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle) PURE; + STDMETHOD(SetPixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; +}; + +typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->lpVtbl->ResourceManagerDiscardBytes(p,a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->lpVtbl->GetGammaRamp(p,a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->lpVtbl->CreateImageSurface(p,a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->lpVtbl->CopyRects(p,a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->lpVtbl->GetFrontBuffer(p,a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice8_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice8_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->lpVtbl->DeleteVertexShader(p,a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->lpVtbl->GetVertexShaderDeclaration(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->lpVtbl->GetVertexShaderFunction(p,a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->lpVtbl->SetStreamSource(p,a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->lpVtbl->GetStreamSource(p,a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->lpVtbl->SetIndices(p,a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->lpVtbl->DeletePixelShader(p,a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->lpVtbl->GetPixelShaderFunction(p,a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#else +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice8_AddRef(p) (p)->AddRef() +#define IDirect3DDevice8_Release(p) (p)->Release() +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->ResourceManagerDiscardBytes(a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->SetGammaRamp(a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->GetGammaRamp(a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->CreateTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->CreateCubeTexture(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->CreateVertexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->CreateIndexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->CreateRenderTarget(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->CreateDepthStencilSurface(a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->CreateImageSurface(a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->CopyRects(a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->GetFrontBuffer(a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice8_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice8_EndScene(p) (p)->EndScene() +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->DrawIndexedPrimitive(a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->ProcessVertices(a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->CreateVertexShader(a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->DeleteVertexShader(a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->SetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->GetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->GetVertexShaderDeclaration(a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->GetVertexShaderFunction(a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->SetStreamSource(a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->GetStreamSource(a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->SetIndices(a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->GetIndices(a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->DeletePixelShader(a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->SetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->GetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->GetPixelShaderFunction(a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->DeletePatch(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain8 + +DECLARE_INTERFACE_(IDirect3DSwapChain8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain8 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; +}; + +typedef struct IDirect3DSwapChain8 *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#else +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain8_Release(p) (p)->Release() +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource8 + +DECLARE_INTERFACE_(IDirect3DResource8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource8 *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource8_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource8_AddRef(p) (p)->AddRef() +#define IDirect3DResource8_Release(p) (p)->Release() +#define IDirect3DResource8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource8_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource8_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource8_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture8 + +DECLARE_INTERFACE_(IDirect3DBaseTexture8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture8 *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#else +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture8_Release(p) (p)->Release() +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture8_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->GetLevelCount() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture8 + +DECLARE_INTERFACE_(IDirect3DTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface8** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DTexture8 *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DTexture8_Release(p) (p)->Release() +#define IDirect3DTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture8_GetType(p) (p)->GetType() +#define IDirect3DTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture8 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; + +typedef struct IDirect3DVolumeTexture8 *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture8_Release(p) (p)->Release() +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture8_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture8 + +DECLARE_INTERFACE_(IDirect3DCubeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DCubeTexture8 *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture8_Release(p) (p)->Release() +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture8_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer8 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DVertexBuffer8 *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer8_Release(p) (p)->Release() +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer8 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DIndexBuffer8 *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer8_Release(p) (p)->Release() +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface8 + +DECLARE_INTERFACE_(IDirect3DSurface8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSurface8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; +}; + +typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#else +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface8_AddRef(p) (p)->AddRef() +#define IDirect3DSurface8_Release(p) (p)->Release() +#define IDirect3DSurface8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->UnlockRect() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume8 + +DECLARE_INTERFACE_(IDirect3DVolume8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; +}; + +typedef struct IDirect3DVolume8 *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume8_AddRef(p) (p)->AddRef() +#define IDirect3DVolume8_Release(p) (p)->Release() +#define IDirect3DVolume8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->UnlockBox() +#endif + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D8 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D8 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for + * the current mode only. + * + ****************************************************************************/ + +#define D3DCURRENT_DISPLAY_MODE 0x00EFFFFFL + +/**************************************************************************** + * + * Flags for IDirect3D8::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L + + +/**************************************************************************** + * + * Parameter for IDirect3D8::CreateDevice's iAdapter + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D8::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_NO_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/win32/directx/d3d8.lib b/win32/directx/d3d8.lib new file mode 100644 index 0000000000000000000000000000000000000000..828ed30d39be6311952ab12dfd47332e625396ea GIT binary patch literal 2466 zcmcIm&2G~`5FR@uEm0&Qeh#1@8MTLU2_k#=`}c6VlXzFGUhT6@^(uE!rq(^M=z z&J=TUt}v~ZR+*eF<8s;{2CFv`_cqueqz+^1wT6jiOhEEy$Dea&{8YpJ)$=LLBP7gY#|A0%YOUu z{c^(<0XC5N%mp^8kSwRE9NNnnZn}-kH*7zd0zm;PtRAy@SjjF?ng7AY=aE(g=~%?^ zhJzW5g&%4KZY3AcK${T}f4X#YtJfJ0J`CQCq?P(ZNw3tZj&-(6pn_J?DnJ+#m&6{i ziX8WW?mL6sJ&f~o=`Ng|ac?xAhyoLVA6Er%LhW*mb1?D};ToCdpaQ%(xv_@y_o-t< zyJOifi3SmL>@Vw)i}Pa!#YaX~Ch#FT`1tCCMZx*w!*WdHZUP@!t|feY;Q|{8A6Jm~ zAo-*mT==~ReP@O9HT44>xXJauvwzf7j$ac&kZNj@CTdFNdYbp03v9f^yA5)m_t35X z0~H#93jaBf=%0WJQWxlzT0<8CB= 0x0800) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DCAPS8 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture8's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture8's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture8's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float MaxPixelShaderValue; // max value of pixel shader arithmetic component + +} D3DCAPS8; + +// +// BIT DEFINES FOR D3DCAPS8 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_NO2DDURING3DSCENE 0x00000002L +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANRENDERWINDOWED 0x00080000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE 0x00800000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +// +// SourceBlendCaps, DestBlendCaps +// +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// Device can use non-POW2 textures if: +// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage +// 2) D3DRS_WRAP(N) is zero for this texture's coordinates +// 3) mip mapping is not enabled (use magnification filter only) +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ + +// +// TextureFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L + +// +// TextureOpCaps +// +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_NO_VSDT_UBYTE4 0x00000080L /* device does not support D3DVSDT_UBYTE4 */ + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8CAPS_H_ */ + diff --git a/win32/directx/d3d8types.h b/win32/directx/d3d8types.h new file mode 100644 index 0000000..0303762 --- /dev/null +++ b/win32/directx/d3d8types.h @@ -0,0 +1,1684 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8TYPES_H_ +#define _D3D8TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT8 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT8; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS8 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS8 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS8; + +typedef struct _D3DMATERIAL8 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL8; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT8 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT8; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRS_ZBIAS = 47, /* LONG Z bias */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_SOFTWAREVERTEXPROCESSING = 153, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_PATCHSEGMENTS = 164, // Number of segments per edge when drawing patches + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONORDER = 172, // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + D3DRS_NORMALORDER = 173, // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L +#define D3DWRAP_W 0x00000004L + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage texture processing. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* float Mipmap LOD bias */ + D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_ADDRESSW = 25, /* D3DTEXTUREADDRESS for W coordinate */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +typedef enum _D3DTEXTUREOP +{ + // Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + + // Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + + // Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DTSS_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_FLATCUBIC = 4, // cubic + D3DTEXF_GAUSSIANCUBIC = 5, // different cubic kernel + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_LASTBETA_UBYTE4 0x1000 + +#define D3DFVF_RESERVED2 0xE000 // 4 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +/* + +Vertex Shader Declaration + +The declaration portion of a vertex shader defines the static external +interface of the shader. The information in the declaration includes: + +- Assignments of vertex shader input registers to data streams. These +assignments bind a specific vertex register to a single component within a +vertex stream. A vertex stream element is identified by a byte offset +within the stream and a type. The type specifies the arithmetic data type +plus the dimensionality (1, 2, 3, or 4 values). Stream data which is +less than 4 values are always expanded out to 4 values with zero or more +0.F values and one 1.F value. + +- Assignment of vertex shader input registers to implicit data from the +primitive tessellator. This controls the loading of vertex data which is +not loaded from a stream, but rather is generated during primitive +tessellation prior to the vertex shader. + +- Loading data into the constant memory at the time a shader is set as the +current shader. Each token specifies values for one or more contiguous 4 +DWORD constant registers. This allows the shader to update an arbitrary +subset of the constant memory, overwriting the device state (which +contains the current values of the constant memory). Note that these +values can be subsequently overwritten (between DrawPrimitive calls) +during the time a shader is bound to a device via the +SetVertexShaderConstant method. + + +Declaration arrays are single-dimensional arrays of DWORDs composed of +multiple tokens each of which is one or more DWORDs. The single-DWORD +token value 0xFFFFFFFF is a special token used to indicate the end of the +declaration array. The single DWORD token value 0x00000000 is a NOP token +with is ignored during the declaration parsing. Note that 0x00000000 is a +valid value for DWORDs following the first DWORD for multiple word tokens. + +[31:29] TokenType + 0x0 - NOP (requires all DWORD bits to be zero) + 0x1 - stream selector + 0x2 - stream data definition (map to vertex input memory) + 0x3 - vertex input memory from tessellator + 0x4 - constant memory from shader + 0x5 - extension + 0x6 - reserved + 0x7 - end-of-array (requires all DWORD bits to be 1) + +NOP Token (single DWORD token) + [31:29] 0x0 + [28:00] 0x0 + +Stream Selector (single DWORD token) + [31:29] 0x1 + [28] indicates whether this is a tessellator stream + [27:04] 0x0 + [03:00] stream selector (0..15) + +Stream Data Definition (single DWORD token) + Vertex Input Register Load + [31:29] 0x2 + [28] 0x0 + [27:20] 0x0 + [19:16] type (dimensionality and data type) + [15:04] 0x0 + [03:00] vertex register address (0..15) + Data Skip (no register load) + [31:29] 0x2 + [28] 0x1 + [27:20] 0x0 + [19:16] count of DWORDS to skip over (0..15) + [15:00] 0x0 + Vertex Input Memory from Tessellator Data (single DWORD token) + [31:29] 0x3 + [28] indicates whether data is normals or u/v + [27:24] 0x0 + [23:20] vertex register address (0..15) + [19:16] type (dimensionality) + [15:04] 0x0 + [03:00] vertex register address (0..15) + +Constant Memory from Shader (multiple DWORD token) + [31:29] 0x4 + [28:25] count of 4*DWORD constants to load (0..15) + [24:07] 0x0 + [06:00] constant memory address (0..95) + +Extension Token (single or multiple DWORD token) + [31:29] 0x5 + [28:24] count of additional DWORDs in token (0..31) + [23:00] extension-specific information + +End-of-array token (single DWORD token) + [31:29] 0x7 + [28:00] 0x1fffffff + +The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. +Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. +The token sequence: +Stream Select: stream=0 +Stream Data Definition (Load): type=FLOAT3; register=3 +Stream Data Definition (Load): type=FLOAT3; register=4 +Stream Data Definition (Skip): count=2 +Stream Data Definition (Load): type=FLOAT2; register=7 + +defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. +Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. + +*/ + +typedef enum _D3DVSD_TOKENTYPE +{ + D3DVSD_TOKEN_NOP = 0, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_TOKEN_END = 7, // end-of-array (requires all DWORD bits to be 1) + D3DVSD_FORCE_DWORD = 0x7fffffff,// force 32-bit size enum +} D3DVSD_TOKENTYPE; + +#define D3DVSD_TOKENTYPESHIFT 29 +#define D3DVSD_TOKENTYPEMASK (7 << D3DVSD_TOKENTYPESHIFT) + +#define D3DVSD_STREAMNUMBERSHIFT 0 +#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) + +#define D3DVSD_DATALOADTYPESHIFT 28 +#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) + +#define D3DVSD_DATATYPESHIFT 16 +#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) + +#define D3DVSD_SKIPCOUNTSHIFT 16 +#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) + +#define D3DVSD_VERTEXREGSHIFT 0 +#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) + +#define D3DVSD_VERTEXREGINSHIFT 20 +#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) + +#define D3DVSD_CONSTCOUNTSHIFT 25 +#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) + +#define D3DVSD_CONSTADDRESSSHIFT 0 +#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) + +#define D3DVSD_CONSTRSSHIFT 16 +#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) + +#define D3DVSD_EXTCOUNTSHIFT 24 +#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) + +#define D3DVSD_EXTINFOSHIFT 0 +#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) + +#define D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) + +// macros for generation of CreateVertexShader Declaration token array + +// Set current stream +// _StreamNumber [0..(MaxStreams-1)] stream to get data from +// +#define D3DVSD_STREAM( _StreamNumber ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) + +// Set tessellator stream +// +#define D3DVSD_STREAMTESSSHIFT 28 +#define D3DVSD_STREAMTESSMASK (1 << D3DVSD_STREAMTESSSHIFT) +#define D3DVSD_STREAM_TESS( ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) + +// bind single vertex register to vertex element from vertex stream +// +// _VertexRegister [0..15] address of the vertex register +// _Type [D3DVSDT_*] dimensionality and arithmetic data type + +#define D3DVSD_REG( _VertexRegister, _Type ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ + ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Skip _DWORDCount DWORDs in vertex +// +#define D3DVSD_SKIP( _DWORDCount ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ + ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) + +// load data into vertex shader constant memory +// +// _ConstantAddress [0..95] - address of constant array to begin filling data +// _Count [0..15] - number of constant vectors to load (4 DWORDs each) +// followed by 4*_Count DWORDS of data +// +#define D3DVSD_CONST( _ConstantAddress, _Count ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ + ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) + +// enable tessellator generated normals +// +// _VertexRegisterIn [0..15] address of vertex register whose input stream +// will be used in normal computation +// _VertexRegisterOut [0..15] address of vertex register to output the normal to +// +#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ + ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ + ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) + +// enable tessellator generated surface parameters +// +// _VertexRegister [0..15] address of vertex register to output parameters +// +#define D3DVSD_TESSUV( _VertexRegister ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ + ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Generates END token +// +#define D3DVSD_END() 0xFFFFFFFF + +// Generates NOP token +#define D3DVSD_NOP() 0x00000000 + +// bit declarations for _Type fields +#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.) +#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.) +#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.) +#define D3DVSDT_FLOAT4 0x03 // 4D float +#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) +#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte +#define D3DVSDT_SHORT2 0x06 // 2D signed short expanded to (value, value, 0., 1.) +#define D3DVSDT_SHORT4 0x07 // 4D signed short + +// assignments of vertex input registers for fixed function vertex shader +// +#define D3DVSDE_POSITION 0 +#define D3DVSDE_BLENDWEIGHT 1 +#define D3DVSDE_BLENDINDICES 2 +#define D3DVSDE_NORMAL 3 +#define D3DVSDE_PSIZE 4 +#define D3DVSDE_DIFFUSE 5 +#define D3DVSDE_SPECULAR 6 +#define D3DVSDE_TEXCOORD0 7 +#define D3DVSDE_TEXCOORD1 8 +#define D3DVSDE_TEXCOORD2 9 +#define D3DVSDE_TEXCOORD3 10 +#define D3DVSDE_TEXCOORD4 11 +#define D3DVSDE_TEXCOORD5 12 +#define D3DVSDE_TEXCOORD6 13 +#define D3DVSDE_TEXCOORD7 14 +#define D3DVSDE_POSITION2 15 +#define D3DVSDE_NORMAL2 16 + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, // PS/VS + D3DSIO_MOV , // PS/VS + D3DSIO_ADD , // PS/VS + D3DSIO_SUB , // PS + D3DSIO_MAD , // PS/VS + D3DSIO_MUL , // PS/VS + D3DSIO_RCP , // VS + D3DSIO_RSQ , // VS + D3DSIO_DP3 , // PS/VS + D3DSIO_DP4 , // PS/VS + D3DSIO_MIN , // VS + D3DSIO_MAX , // VS + D3DSIO_SLT , // VS + D3DSIO_SGE , // VS + D3DSIO_EXP , // VS + D3DSIO_LOG , // VS + D3DSIO_LIT , // VS + D3DSIO_DST , // VS + D3DSIO_LRP , // PS + D3DSIO_FRC , // VS + D3DSIO_M4x4 , // VS + D3DSIO_M4x3 , // VS + D3DSIO_M3x4 , // VS + D3DSIO_M3x3 , // VS + D3DSIO_M3x2 , // VS + + D3DSIO_TEXCOORD = 64, // PS + D3DSIO_TEXKILL , // PS + D3DSIO_TEX , // PS + D3DSIO_TEXBEM , // PS + D3DSIO_TEXBEML , // PS + D3DSIO_TEXREG2AR , // PS + D3DSIO_TEXREG2GB , // PS + D3DSIO_TEXM3x2PAD , // PS + D3DSIO_TEXM3x2TEX , // PS + D3DSIO_TEXM3x3PAD , // PS + D3DSIO_TEXM3x3TEX , // PS + D3DSIO_TEXM3x3DIFF , // PS + D3DSIO_TEXM3x3SPEC , // PS + D3DSIO_TEXM3x3VSPEC , // PS + D3DSIO_EXPP , // VS + D3DSIO_LOGP , // VS + D3DSIO_CND , // PS + D3DSIO_DEF , // PS + D3DSIO_TEXREG2RGB , // PS + D3DSIO_TEXDP3TEX , // PS + D3DSIO_TEXM3x2DEPTH , // PS + D3DSIO_TEXDP3 , // PS + D3DSIO_TEXM3x3 , // PS + D3DSIO_TEXDEPTH , // PS + D3DSIO_CMP , // PS + D3DSIO_BEM , // PS + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +// +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +// +// Parameter Token Bit Definitions +// +#define D3DSP_REGNUM_MASK 0x00001FFF + +// destination parameter write mask +#define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red) +#define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green) +#define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue) +#define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha) +#define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components + +// destination parameter modifiers +#define D3DSP_DSTMOD_SHIFT 20 +#define D3DSP_DSTMOD_MASK 0x00F00000 + +typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE +{ + D3DSPDM_NONE = 0<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8TYPES(P)_H_ */ + diff --git a/win32/directx/d3dx8.h b/win32/directx/d3dx8.h new file mode 100644 index 0000000..89f602d --- /dev/null +++ b/win32/directx/d3dx8.h @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8.h +// Content: D3DX utility library +// +/////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX8_H__ +#define __D3DX8_H__ + +#include "d3d8.h" +#include + +#ifndef D3DXINLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DXINLINE __forceinline + #else + #define D3DXINLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DXINLINE inline + #else + #define D3DXINLINE + #endif +#endif +#endif + + +#define D3DX_DEFAULT ULONG_MAX +#define D3DX_DEFAULT_FLOAT FLT_MAX + +#include "d3dx8math.h" +#include "d3dx8core.h" +#include "d3dx8tex.h" +#include "d3dx8mesh.h" +#include "d3dx8shape.h" +#include "d3dx8effect.h" + + +#endif //__D3DX8_H__ + diff --git a/win32/directx/d3dx8.lib b/win32/directx/d3dx8.lib new file mode 100644 index 0000000000000000000000000000000000000000..8305ff4c2132877d299251b2cf8ce0ef9e253f5e GIT binary patch literal 2151212 zcmeFaeT;0&b|2J=c#i#SL;L}L@4ol0ALt52!I+upnK?5OVfOd#-Mzo=bkCeQSAlWQ zOwT#}?o9XGo}PQoc|cHzfJpccWJSmzVF?K(B7gXg5IG?rA}o^-goFsfLI@%&Ac2q- zAqz+pgW$KScI{nNyY}wg=ic}7Y|gR!y*InoTD5A`s#U92t*ZJ*|LN)K`qe-4)qm>S z>c8Ec{?YOAPXF*w{k~KDxqJBR;F$gK3t#Q^e*91LzVcI_{Qdv^<5ur0zaM`8>`(T- zB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