From f33aafcbdfed63f7e7ac5bc1c90a1e5632b0a350 Mon Sep 17 00:00:00 2001 From: Nach Date: Wed, 14 Nov 2007 12:28:27 +0000 Subject: [PATCH] Trimmed whitespace, and set propper line endings for SVN. --- res/DevInfo.txt | 38 +- res/ReadMe.txt | 160 +- res/gpl.txt | 678 +- res/resource.h | 1498 +-- src/2xSaI.cpp | 284 +- src/2xSaImmx.asm | 28 +- src/CheatSearch.cpp | 18 +- src/CheatSearch.h | 4 +- src/Cheats.cpp | 148 +- src/EEprom.cpp | 6 +- src/Flash.cpp | 2 +- src/GBA.cpp | 8922 ++++++++--------- src/GBAinline.h | 996 +- src/Gfx.h | 222 +- src/Link.cpp | 2166 ++-- src/Link.h | 248 +- src/Mode0.cpp | 108 +- src/Mode1.cpp | 96 +- src/Mode2.cpp | 94 +- src/Mode3.cpp | 100 +- src/Mode4.cpp | 84 +- src/Mode5.cpp | 82 +- src/Port.h | 4 +- src/RTC.cpp | 14 +- src/Sound.cpp | 3008 +++--- src/Sound.h | 180 +- src/System.h | 2 +- src/Text.cpp | 18 +- src/Util.cpp | 2370 ++--- src/admame.cpp | 36 +- src/agbprint.cpp | 4 +- src/arm-new.h | 164 +- src/armdis.cpp | 18 +- src/bilinear.cpp | 76 +- src/bios.cpp | 124 +- src/elf.cpp | 248 +- src/elf.h | 6 +- src/expr-lex.cpp | 2 +- src/expr.cpp | 10 +- src/exprNode.cpp | 38 +- src/gb/GB.cpp | 416 +- src/gb/gbCheats.cpp | 48 +- src/gb/gbCodes.h | 34 +- src/gb/gbDis.cpp | 4 +- src/gb/gbGfx.cpp | 132 +- src/gb/gbMemory.cpp | 24 +- src/gb/gbPrinter.cpp | 8 +- src/gb/gbSGB.cpp | 84 +- src/gb/gbSound.cpp | 128 +- src/gbafilter.cpp | 454 +- src/gbafilter.h | 10 +- src/hq2x.cpp | 28 +- src/hq2x.h | 512 +- src/hq3x32.cpp | 292 +- src/hq3x32.h | 7268 +++++++------- src/hq3x_16.asm | 5052 +++++----- src/hq3x_32.asm | 5140 +++++----- src/hq4x_16.asm | 7914 +++++++-------- src/hq4x_32.asm | 7856 +++++++-------- src/hq_shared32.cpp | 4 +- src/hq_shared32.h | 180 +- src/interframe.cpp | 74 +- src/libresample-0.1.3/src/filterkit.c | 16 +- src/libresample-0.1.3/src/resample.c | 12 +- src/libresample-0.1.3/src/resamplesubs.c | 20 +- .../tests/resample-sndfile.c | 2 +- src/libresample-0.1.3/tests/testresample.c | 2 +- src/lq2x.h | 512 +- src/memgzio.c | 22 +- src/memgzio.h | 2 +- src/motionblur.cpp | 48 +- src/pixel.cpp | 36 +- src/portable.cpp | 2 +- src/portable.h | 2 +- src/remote.cpp | 66 +- src/scanline.cpp | 64 +- src/sdl/SDL.cpp | 278 +- src/sdl/debugger.cpp | 240 +- src/simpleFilter.cpp | 606 +- src/snd_interp.cpp | 962 +- src/snd_interp.h | 70 +- src/thumb.h | 126 +- src/unzip.cpp | 122 +- src/unzip.h | 22 +- src/win32/AVIWrite.cpp | 16 +- src/win32/AboutDialog.cpp | 4 +- src/win32/AccelEditor.cpp | 26 +- src/win32/AcceleratorManager.cpp | 52 +- src/win32/AcceleratorManager.h | 2 +- src/win32/Associate.cpp | 12 +- src/win32/BitmapControl.cpp | 26 +- src/win32/BugReport.cpp | 54 +- src/win32/CmdAccelOb.cpp | 34 +- src/win32/CmdAccelOb.h | 2 +- src/win32/ColorButton.cpp | 8 +- src/win32/ColorControl.cpp | 4 +- src/win32/Commands.cpp | 8 +- src/win32/Direct3D.cpp | 1336 +-- src/win32/DirectDraw.cpp | 1630 +-- src/win32/DirectDraw.cpp.orig | 1690 ++-- src/win32/DirectInput.cpp | 1892 ++-- src/win32/DirectSound.cpp | 46 +- src/win32/Directories.cpp | 52 +- src/win32/Disassemble.cpp | 52 +- src/win32/ExportGSASnapshot.cpp | 12 +- src/win32/FileDlg.cpp | 16 +- src/win32/FileDlg.h | 4 +- src/win32/GBACheats.cpp | 190 +- src/win32/GBCheatsDlg.cpp | 166 +- src/win32/GBCheatsDlg.h | 2 +- src/win32/GBColorDlg.cpp | 56 +- src/win32/GBDisassemble.cpp | 50 +- src/win32/GBMapView.cpp | 92 +- src/win32/GBMemoryViewerDlg.cpp | 80 +- src/win32/GBOamView.cpp | 84 +- src/win32/GBPaletteView.cpp | 42 +- src/win32/GBPrinterDlg.cpp | 62 +- src/win32/GBTileView.cpp | 62 +- src/win32/GDBConnection.cpp | 32 +- src/win32/GDIDisplay.cpp | 48 +- src/win32/GSACodeSelect.cpp | 16 +- src/win32/GameOverrides.cpp | 28 +- src/win32/Hyperlink.cpp | 16 +- src/win32/IOViewer.cpp | 44 +- src/win32/IOViewerRegs.h | 2 +- src/win32/Input.h | 134 +- src/win32/Joypad.cpp | 50 +- src/win32/Joypad.h | 352 +- src/win32/KeyboardEdit.cpp | 8 +- src/win32/KeyboardEdit.h | 2 +- src/win32/LangSelect.cpp | 16 +- src/win32/LinkOptions.cpp | 1286 +-- src/win32/LinkOptions.h | 462 +- src/win32/Logging.cpp | 42 +- src/win32/MainWnd.cpp | 106 +- src/win32/MainWnd.h | 6 +- src/win32/MainWndCheats.cpp | 24 +- src/win32/MainWndFile.cpp | 154 +- src/win32/MainWndHelp.cpp | 14 +- src/win32/MainWndOptions.cpp | 472 +- src/win32/MainWndTools.cpp | 148 +- src/win32/MapView.cpp | 148 +- src/win32/MaxScale.cpp | 10 +- src/win32/MemoryViewer.cpp | 84 +- src/win32/MemoryViewerAddressSize.cpp | 14 +- src/win32/MemoryViewerDlg.cpp | 72 +- src/win32/ModeConfirm.cpp | 20 +- src/win32/OamView.cpp | 86 +- src/win32/OpenGL.cpp | 1438 +-- src/win32/PaletteView.cpp | 44 +- src/win32/PaletteViewControl.cpp | 32 +- src/win32/PaletteViewControl.h | 2 +- src/win32/Reg.cpp | 28 +- src/win32/ResizeDlg.cpp | 66 +- src/win32/ResizeDlg.h | 2 +- src/win32/RewindInterval.cpp | 12 +- src/win32/RomInfo.cpp | 28 +- src/win32/Sound.h | 2 +- src/win32/StringTokenizer.cpp | 2 +- src/win32/StringTokenizer.h | 2 +- src/win32/Throttle.cpp | 10 +- src/win32/TileView.cpp | 66 +- src/win32/UniVideoModeDlg.cpp | 558 +- src/win32/UniVideoModeDlg.h | 90 +- src/win32/VBA.cpp | 198 +- src/win32/VBA.h | 6 +- src/win32/VBA.rc | 4312 ++++---- src/win32/VideoMode.cpp | 68 +- src/win32/WavWriter.cpp | 2 +- src/win32/WavWriter.h | 2 +- src/win32/WinHelper.h | 6 +- src/win32/WinResUtil.cpp | 10 +- src/win32/ZoomControl.cpp | 22 +- src/win32/glfont.c | 308 +- src/win32/glfont.h | 126 +- src/win32/gzglfont.h | 514 +- src/win32/resource.h | 1624 +-- src/win32/skin.cpp | 54 +- src/win32/skin.h | 4 +- src/win32/skinButton.cpp | 14 +- src/win32/vba.rc2 | 112 +- 181 files changed, 41361 insertions(+), 41361 deletions(-) diff --git a/res/DevInfo.txt b/res/DevInfo.txt index fb151094..5fe10228 100644 --- a/res/DevInfo.txt +++ b/res/DevInfo.txt @@ -1,20 +1,20 @@ -Developer Information File: - -- Don't use the global optimization switch (/Og) because it causes a black screen in Metroid Prime. - -- Project Configurations: - - Debug: Debug ON | Optimizations OFF | UPX OFF - - Release: Debug OFF | Optimizations OFF | UPX OFF - - Optimized: Debug OFF | Optimizations ON | UPX ON - -Software Used: -OPTIONAL UPX 1.25 +/- -NEEDED nasm 0.98.39 +/- -INCLUDED zlib 1.2.3 +/- -INCLUDED libpng 1.2.8 +/- -NEEDED Microsoft Platform SDK 2003 SP1 +/- -NEEDED Microsoft DirectX 9.0c SDK (June 2005) + -NEEDED Microsoft Visual Studio .NET Professional 2003 German + - -+ newer is ok +Developer Information File: + +- Don't use the global optimization switch (/Og) because it causes a black screen in Metroid Prime. + +- Project Configurations: + - Debug: Debug ON | Optimizations OFF | UPX OFF + - Release: Debug OFF | Optimizations OFF | UPX OFF + - Optimized: Debug OFF | Optimizations ON | UPX ON + +Software Used: +OPTIONAL UPX 1.25 +/- +NEEDED nasm 0.98.39 +/- +INCLUDED zlib 1.2.3 +/- +INCLUDED libpng 1.2.8 +/- +NEEDED Microsoft Platform SDK 2003 SP1 +/- +NEEDED Microsoft DirectX 9.0c SDK (June 2005) + +NEEDED Microsoft Visual Studio .NET Professional 2003 German + + ++ newer is ok +/- newer and older is ok \ No newline at end of file diff --git a/res/ReadMe.txt b/res/ReadMe.txt index 5323920b..d0c8f28f 100644 --- a/res/ReadMe.txt +++ b/res/ReadMe.txt @@ -1,81 +1,81 @@ -VisualBoyAdvance S1.7.6 -Nintendo Game Boy / Game Boy Advance Emulator - -This program is distributed under the GNU General Public License -http://www.gnu.org/licenses/gpl.html - -VBA Official Version 1.7.2 with changes by Spacy -Spacy51@gmx.de (Write in english or in german) -Special Build Aturhors Homepage: www.spacyhacks.de.vu -Original Project Homepage: vba.ngemu.com - -My aim: -I want to make this emulator fit my needs and hopefully the needs of others, -which want a light-weight small, fast and multimedial emulator for the GBA -that makes as much use of the power of modern PCs as possible (but with sense). -If you need one of the removed features, just use the original VBA emulator. - -Thanks go to: -suanyuan For help in compilation and other fixes -Tauwasser For help in assembler -WingX For fixing a linker error - - -The following changes have been made: - -S1.7.6: -Emu: -- Readded MMX macro -- Updated zlib to 1.2.3 -- Changed some first start options -- Other small changes -- Put zlib & libpng in seperate Projects -- Added some changes from the latest CVS source -- Small changes to ROM Header Info (just4fun) -- Fixed the linker error (new&delete defined twice) - -Filters: -- Speeded up HQ3X code -- Fixed LQ2X using HQ2X functions - -Display: -- Added extended display mode selection - (Display Adapter, Resolution, Bit Depth, Frequency) -- No more unnecessary black borders in full screen -- Direct3D doesn't take the whole screen (only if you want) -- Direct3D shows menu and windows correct -- Direct3D doesn't show a black screen if left fullscreen to Windows -- Changes on max scale are applied immediately - -Sound: -- Updated sound to DirectSound8 - - -S1.7.5: -- Removed screen flickering when switching to GDI mode. -- Changed some first start options. -- Rearranged Menu -- Added HQ3X in 32 bit mode -- Changed App Icon -- Added FINAL_VERSION definition again. -- Added 3x/4x filter support to OpenGL mode -- Some minor fixes - - -S1.7.4: -- optimized build: (many thanks to suanyuan) - - libpng, zlib, MFC linked static - - Target OS: Windows 2000 -- Keep in mind that HQ3X/HQ4X is NOT added - at the moment, but everything is ready for it - - -S1.7.3: -- Optimized build and project file - - Removed Skin support - - Removed SDL support - - Removed Linux support - - Removed Motion Blur Experimental Filter (the none-IFB version) -- Reworked GDI - - 3x / 4x filter support +VisualBoyAdvance S1.7.6 +Nintendo Game Boy / Game Boy Advance Emulator + +This program is distributed under the GNU General Public License +http://www.gnu.org/licenses/gpl.html + +VBA Official Version 1.7.2 with changes by Spacy +Spacy51@gmx.de (Write in english or in german) +Special Build Aturhors Homepage: www.spacyhacks.de.vu +Original Project Homepage: vba.ngemu.com + +My aim: +I want to make this emulator fit my needs and hopefully the needs of others, +which want a light-weight small, fast and multimedial emulator for the GBA +that makes as much use of the power of modern PCs as possible (but with sense). +If you need one of the removed features, just use the original VBA emulator. + +Thanks go to: +suanyuan For help in compilation and other fixes +Tauwasser For help in assembler +WingX For fixing a linker error + + +The following changes have been made: + +S1.7.6: +Emu: +- Readded MMX macro +- Updated zlib to 1.2.3 +- Changed some first start options +- Other small changes +- Put zlib & libpng in seperate Projects +- Added some changes from the latest CVS source +- Small changes to ROM Header Info (just4fun) +- Fixed the linker error (new&delete defined twice) + +Filters: +- Speeded up HQ3X code +- Fixed LQ2X using HQ2X functions + +Display: +- Added extended display mode selection + (Display Adapter, Resolution, Bit Depth, Frequency) +- No more unnecessary black borders in full screen +- Direct3D doesn't take the whole screen (only if you want) +- Direct3D shows menu and windows correct +- Direct3D doesn't show a black screen if left fullscreen to Windows +- Changes on max scale are applied immediately + +Sound: +- Updated sound to DirectSound8 + + +S1.7.5: +- Removed screen flickering when switching to GDI mode. +- Changed some first start options. +- Rearranged Menu +- Added HQ3X in 32 bit mode +- Changed App Icon +- Added FINAL_VERSION definition again. +- Added 3x/4x filter support to OpenGL mode +- Some minor fixes + + +S1.7.4: +- optimized build: (many thanks to suanyuan) + - libpng, zlib, MFC linked static + - Target OS: Windows 2000 +- Keep in mind that HQ3X/HQ4X is NOT added + at the moment, but everything is ready for it + + +S1.7.3: +- Optimized build and project file + - Removed Skin support + - Removed SDL support + - Removed Linux support + - Removed Motion Blur Experimental Filter (the none-IFB version) +- Reworked GDI + - 3x / 4x filter support - Fullscreen modes available \ No newline at end of file diff --git a/res/gpl.txt b/res/gpl.txt index a9702813..07459407 100644 --- a/res/gpl.txt +++ b/res/gpl.txt @@ -1,340 +1,340 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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. \ No newline at end of file diff --git a/res/resource.h b/res/resource.h index 0b17f24d..cb23d40b 100644 --- a/res/resource.h +++ b/res/resource.h @@ -1,749 +1,749 @@ -//{{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 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_CHEAT_LIST 113 -#define IDD_ASSOCIATIONS 114 -#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_UNIVIDMODE 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_ROM_DIR 1018 -#define IDC_NEXT 1019 -#define IDC_BATTERY_DIR 1019 -#define IDC_SAVE_DIR 1020 -#define IDC_CAPTURE_DIR 1021 -#define IDC_CHEAT_LIST 1021 -#define IDC_ROM_PATH 1022 -#define IDC_START 1022 -#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_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_SPECIFIC_VALUE 1026 -#define IDS_SETTING_WILL_BE_EFFECTIVE 1026 -#define IDC_GBROM_DIR 1026 -#define IDS_DISABLING_EMULATION_ONLY 1027 -#define IDC_GBROM_PATH 1027 -#define IDC_SIZE_8 1028 -#define IDS_FAILED_TO_OPEN_FILE 1028 -#define IDC_ROM_DIR_RESET 1028 -#define IDC_SIZE_16 1029 -#define IDS_FAILED_TO_READ_ZIP_DIR 1029 -#define IDC_GBROM_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 IDS_ERROR_ON_ENDDOC 1047 -#define IDC_FLIP 1047 -#define IDS_ERROR 1048 -#define IDC_PALETTE_NUM 1048 -#define IDS_JOY_LEFT 1049 -#define IDS_JOY_RIGHT 1050 -#define IDS_JOY_UP 1051 -#define IDS_JOY_DOWN 1052 -#define IDS_JOY_BUTTON 1053 -#define IDS_SELECT_ROM_DIR 1054 -#define IDS_SELECT_BATTERY_DIR 1055 -#define IDS_SELECT_SAVE_DIR 1056 -#define IDS_SELECT_CAPTURE_DIR 1057 -#define IDS_SELECT_BIOS_FILE 1058 -#define IDS_RESET 1059 -#define IDS_AUTOFIRE_A_DISABLED 1060 -#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_ROM_CHECKSUM 1091 -#define IDC_2X 1091 -#define IDS_SELECT_CHEAT_LIST_NAME 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_CODE 1095 -#define IDS_FILTER_CHEAT_LIST 1095 -#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 IDC_CLOSE 1131 -#define IDS_FILTER_VMV 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 IDC_VIEWER 1140 -#define IDC_ADDRESSES 1141 -#define IDC_GO 1143 -#define IDC_8_BIT 1144 -#define IDC_16_BIT 1145 -#define IDC_32_BIT 1146 -#define IDC_OAM_VIEW 1147 -#define IDC_OAM_VIEW_ZOOM 1148 -#define IDC_SPRITE 1150 -#define IDC_POS 1151 -#define IDC_MODE 1152 -#define IDC_COLORS 1153 -#define IDC_MAPBASE 1153 -#define IDC_PALETTE 1154 -#define IDC_CHARBASE 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_URL2 1180 -#define IDC_COLOR_BG3 1181 -#define IDC_URL3 1181 -#define IDC_COLOR_OB0 1182 -#define IDC_COLOR_OB1 1183 -#define IDC_COLOR_OB2 1184 -#define IDC_COLOR_OB3 1185 -#define IDC_STATIC1 1187 -#define IDC_STATIC2 1188 -#define IDC_STATIC3 1189 -#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_AUTO_UPDATE 1204 -#define IDC_N 1210 -#define IDC_Z 1211 -#define IDC_C 1212 -#define IDC_V 1213 -#define IDC_F 1214 -#define IDC_I 1215 -#define IDC_T 1216 -#define IDC_PORT 1217 -#define IDC_VSCROLL 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_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_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_APINAME 1254 -#define IDC_BIT_5 1255 -#define IDC_DISPLAYDEVICE 1255 -#define IDC_BIT_6 1256 -#define IDC_LISTMODES 1256 -#define IDC_BIT_7 1257 -#define IDC_BIT_8 1258 -#define IDC_BIT_9 1259 -#define IDC_BUTTON1 1259 -#define IDC_BUTTON_MAXSCALE 1259 -#define IDC_BIT_10 1260 -#define IDC_CHECK_STRETCHTOFIT 1260 -#define IDC_BIT_11 1261 -#define IDC_CHECK1 1261 -#define IDC_APPENDMODE 1261 -#define IDC_BIT_12 1262 -#define IDC_BIT_13 1263 -#define IDC_BIT_14 1264 -#define IDC_BIT_15 1265 -#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_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_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_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 40085 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_B 40086 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_L 40087 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_R 40088 -#define ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT 40089 -#define ID_OPTIONS_EMULATOR_ASSOCIATE 40091 -#define ID_OPTIONS_FILTER_DISABLEMMX 40093 -#define ID_FILE_ROMINFORMATION 40100 -#define ID_OPTIONS_EMULATOR_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_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_MEMORYVIEWER 40143 -#define ID_TOOLS_OAMVIEWER 40144 -#define ID_TOOLS_CUSTOMIZE 40145 -#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_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_FRAMESKIP_THROTTLE_NOTHROTTLE 40216 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_50 40217 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_150 40218 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_200 40219 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_25 40220 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER 40221 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_100 40222 -#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_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_EMULATOR_REALTIMECLOCK 40248 -#define ID_OPTIONS_GAMEBOY_SGB2 40249 -#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_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_FILE_LOADGAME_MOSTRECENT 40267 -#define ID_FILE_SAVEGAME_OLDESTSLOT 40268 -#define ID_FILE_LOADGAME_AUTOLOADMOSTRECENT 40269 -#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_HQ2X 40274 -#define ID_OPTIONS_FILTER_LQ2X 40275 -#define ID_OPTIONS_EMULATOR_AGBPRINT 40281 -#define ID_OPTIONS_VIDEO_FULLSCREEN1024X768 40282 -#define ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 40283 -#define ID_OPTIONS_FILTER_SIMPLE3X 40287 -#define ID_OPTIONS_FILTER_SIMPLE4X 40288 -#define ID_OPTIONS_FILTER_HQ3X 40290 -#define ID_OPTIONS_FILTER_HQ4X 40291 -#define ID_VIDEO_WINDOWED 40292 -#define ID_VIDEO_FULL 40293 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE 40294 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR 40295 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298 -#define ID_OPTIONS_FILTER_LCDCOLORS 40299 -#define IDD_LINKTAB1 40300 -#define IDD_LINKTAB 40301 -#define IDD_LINKTAB2 40302 -#define IDD_LINKTAB3 40303 -#define IDD_SERVERWAIT 40304 -#define IDC_TAB1 40305 -#define IDC_LINK_SINGLE 40306 -#define IDC_LINK_TIMEOUT 40307 -#define IDC_LINK_LAN 40308 -#define IDC_LINK2P 40309 -#define IDC_LINKTCP 40310 -#define IDC_SSPEED 40311 -#define IDC_SERVERSTART 40312 -#define IDC_SERVERIP 40313 -#define IDC_CLINKIP 40314 -#define IDC_SPEEDOFF 40315 -#define IDC_LINKCONNECT 40316 -#define IDC_STATIC4 40317 -#define ID_OPTIONS_LINK_OPTIONS 40318 -#define ID_OPTIONS_LINK_LOG 40319 -#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320 -#define IDC_LINKTIMEOUT 40321 -#define IDC_CLINKTCP 40322 -#define IDC_SERVERWAIT 40323 -#define IDC_LINKUDP 40324 -#define IDC_LINK3P 40325 -#define IDC_LINK4P 40326 -#define IDC_CLINKUDP 40327 -#define IDC_SPEEDON 40328 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 159 -#define _APS_NEXT_COMMAND_VALUE 40300 -#define _APS_NEXT_CONTROL_VALUE 1262 -#define _APS_NEXT_SYMED_VALUE 103 -#endif -#endif +//{{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 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_CHEAT_LIST 113 +#define IDD_ASSOCIATIONS 114 +#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_UNIVIDMODE 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_ROM_DIR 1018 +#define IDC_NEXT 1019 +#define IDC_BATTERY_DIR 1019 +#define IDC_SAVE_DIR 1020 +#define IDC_CAPTURE_DIR 1021 +#define IDC_CHEAT_LIST 1021 +#define IDC_ROM_PATH 1022 +#define IDC_START 1022 +#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_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_SPECIFIC_VALUE 1026 +#define IDS_SETTING_WILL_BE_EFFECTIVE 1026 +#define IDC_GBROM_DIR 1026 +#define IDS_DISABLING_EMULATION_ONLY 1027 +#define IDC_GBROM_PATH 1027 +#define IDC_SIZE_8 1028 +#define IDS_FAILED_TO_OPEN_FILE 1028 +#define IDC_ROM_DIR_RESET 1028 +#define IDC_SIZE_16 1029 +#define IDS_FAILED_TO_READ_ZIP_DIR 1029 +#define IDC_GBROM_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 IDS_ERROR_ON_ENDDOC 1047 +#define IDC_FLIP 1047 +#define IDS_ERROR 1048 +#define IDC_PALETTE_NUM 1048 +#define IDS_JOY_LEFT 1049 +#define IDS_JOY_RIGHT 1050 +#define IDS_JOY_UP 1051 +#define IDS_JOY_DOWN 1052 +#define IDS_JOY_BUTTON 1053 +#define IDS_SELECT_ROM_DIR 1054 +#define IDS_SELECT_BATTERY_DIR 1055 +#define IDS_SELECT_SAVE_DIR 1056 +#define IDS_SELECT_CAPTURE_DIR 1057 +#define IDS_SELECT_BIOS_FILE 1058 +#define IDS_RESET 1059 +#define IDS_AUTOFIRE_A_DISABLED 1060 +#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_ROM_CHECKSUM 1091 +#define IDC_2X 1091 +#define IDS_SELECT_CHEAT_LIST_NAME 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_CODE 1095 +#define IDS_FILTER_CHEAT_LIST 1095 +#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 IDC_CLOSE 1131 +#define IDS_FILTER_VMV 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 IDC_VIEWER 1140 +#define IDC_ADDRESSES 1141 +#define IDC_GO 1143 +#define IDC_8_BIT 1144 +#define IDC_16_BIT 1145 +#define IDC_32_BIT 1146 +#define IDC_OAM_VIEW 1147 +#define IDC_OAM_VIEW_ZOOM 1148 +#define IDC_SPRITE 1150 +#define IDC_POS 1151 +#define IDC_MODE 1152 +#define IDC_COLORS 1153 +#define IDC_MAPBASE 1153 +#define IDC_PALETTE 1154 +#define IDC_CHARBASE 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_URL2 1180 +#define IDC_COLOR_BG3 1181 +#define IDC_URL3 1181 +#define IDC_COLOR_OB0 1182 +#define IDC_COLOR_OB1 1183 +#define IDC_COLOR_OB2 1184 +#define IDC_COLOR_OB3 1185 +#define IDC_STATIC1 1187 +#define IDC_STATIC2 1188 +#define IDC_STATIC3 1189 +#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_AUTO_UPDATE 1204 +#define IDC_N 1210 +#define IDC_Z 1211 +#define IDC_C 1212 +#define IDC_V 1213 +#define IDC_F 1214 +#define IDC_I 1215 +#define IDC_T 1216 +#define IDC_PORT 1217 +#define IDC_VSCROLL 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_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_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_APINAME 1254 +#define IDC_BIT_5 1255 +#define IDC_DISPLAYDEVICE 1255 +#define IDC_BIT_6 1256 +#define IDC_LISTMODES 1256 +#define IDC_BIT_7 1257 +#define IDC_BIT_8 1258 +#define IDC_BIT_9 1259 +#define IDC_BUTTON1 1259 +#define IDC_BUTTON_MAXSCALE 1259 +#define IDC_BIT_10 1260 +#define IDC_CHECK_STRETCHTOFIT 1260 +#define IDC_BIT_11 1261 +#define IDC_CHECK1 1261 +#define IDC_APPENDMODE 1261 +#define IDC_BIT_12 1262 +#define IDC_BIT_13 1263 +#define IDC_BIT_14 1264 +#define IDC_BIT_15 1265 +#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_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_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_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 40085 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_B 40086 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_L 40087 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_R 40088 +#define ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT 40089 +#define ID_OPTIONS_EMULATOR_ASSOCIATE 40091 +#define ID_OPTIONS_FILTER_DISABLEMMX 40093 +#define ID_FILE_ROMINFORMATION 40100 +#define ID_OPTIONS_EMULATOR_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_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_MEMORYVIEWER 40143 +#define ID_TOOLS_OAMVIEWER 40144 +#define ID_TOOLS_CUSTOMIZE 40145 +#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_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_FRAMESKIP_THROTTLE_NOTHROTTLE 40216 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_50 40217 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_150 40218 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_200 40219 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_25 40220 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER 40221 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_100 40222 +#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_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_EMULATOR_REALTIMECLOCK 40248 +#define ID_OPTIONS_GAMEBOY_SGB2 40249 +#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_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_FILE_LOADGAME_MOSTRECENT 40267 +#define ID_FILE_SAVEGAME_OLDESTSLOT 40268 +#define ID_FILE_LOADGAME_AUTOLOADMOSTRECENT 40269 +#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_HQ2X 40274 +#define ID_OPTIONS_FILTER_LQ2X 40275 +#define ID_OPTIONS_EMULATOR_AGBPRINT 40281 +#define ID_OPTIONS_VIDEO_FULLSCREEN1024X768 40282 +#define ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 40283 +#define ID_OPTIONS_FILTER_SIMPLE3X 40287 +#define ID_OPTIONS_FILTER_SIMPLE4X 40288 +#define ID_OPTIONS_FILTER_HQ3X 40290 +#define ID_OPTIONS_FILTER_HQ4X 40291 +#define ID_VIDEO_WINDOWED 40292 +#define ID_VIDEO_FULL 40293 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE 40294 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR 40295 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298 +#define ID_OPTIONS_FILTER_LCDCOLORS 40299 +#define IDD_LINKTAB1 40300 +#define IDD_LINKTAB 40301 +#define IDD_LINKTAB2 40302 +#define IDD_LINKTAB3 40303 +#define IDD_SERVERWAIT 40304 +#define IDC_TAB1 40305 +#define IDC_LINK_SINGLE 40306 +#define IDC_LINK_TIMEOUT 40307 +#define IDC_LINK_LAN 40308 +#define IDC_LINK2P 40309 +#define IDC_LINKTCP 40310 +#define IDC_SSPEED 40311 +#define IDC_SERVERSTART 40312 +#define IDC_SERVERIP 40313 +#define IDC_CLINKIP 40314 +#define IDC_SPEEDOFF 40315 +#define IDC_LINKCONNECT 40316 +#define IDC_STATIC4 40317 +#define ID_OPTIONS_LINK_OPTIONS 40318 +#define ID_OPTIONS_LINK_LOG 40319 +#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320 +#define IDC_LINKTIMEOUT 40321 +#define IDC_CLINKTCP 40322 +#define IDC_SERVERWAIT 40323 +#define IDC_LINKUDP 40324 +#define IDC_LINK3P 40325 +#define IDC_LINK4P 40326 +#define IDC_CLINKUDP 40327 +#define IDC_SPEEDON 40328 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 40300 +#define _APS_NEXT_CONTROL_VALUE 1262 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/src/2xSaI.cpp b/src/2xSaI.cpp index 1aacc0a8..ebf7f37a 100644 --- a/src/2xSaI.cpp +++ b/src/2xSaI.cpp @@ -23,10 +23,10 @@ extern "C" 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; @@ -50,7 +50,7 @@ int Init_2xSaI(u32 BitFormat) greenMask = 0x7E0; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xF7DEF7DE; hq2x_init(16); - RGB_LOW_BITS_MASK = 0x0821; + RGB_LOW_BITS_MASK = 0x0821; } else if (BitFormat == 555) { colorMask = 0x7BDE7BDE; lowPixelMask = 0x04210421; @@ -60,7 +60,7 @@ int Init_2xSaI(u32 BitFormat) greenMask = 0x3E0; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0x7BDE7BDE; hq2x_init(15); - RGB_LOW_BITS_MASK = 0x0421; + RGB_LOW_BITS_MASK = 0x0421; } else { return 0; } @@ -71,14 +71,14 @@ int Init_2xSaI(u32 BitFormat) qlowpixelMask = 0x030303; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xfefefe; hq2x_init(32); - RGB_LOW_BITS_MASK = 0x010101; + RGB_LOW_BITS_MASK = 0x010101; } else return 0; #ifdef MMX Init_2xSaIMMX (BitFormat); #endif - + return 1; } @@ -110,7 +110,7 @@ static inline int GetResult2 (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) @@ -131,7 +131,7 @@ 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) @@ -163,7 +163,7 @@ static inline u32 Q_INTERPOLATE (u32 A, u32 B, u32 C, u32 D) ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); register u32 y = (A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); - + y = (y >> 2) & qlowpixelMask; return x + y; } @@ -196,7 +196,7 @@ static inline int GetResult2_32 (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) @@ -241,43 +241,43 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, #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; @@ -285,12 +285,12 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, 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) @@ -309,7 +309,7 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, Q_INTERPOLATE (color2, color2, color2, color3); else product2b = INTERPOLATE (color2, color3); - + if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) product1b = @@ -321,7 +321,7 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, else product1b = INTERPOLATE (color5, color6); } - + if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) product2a = INTERPOLATE (color2, color5); @@ -331,7 +331,7 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, product2a = INTERPOLATE (color2, color5); else product2a = color2; - + if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) product1a = INTERPOLATE (color2, color5); @@ -341,7 +341,7 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, product1a = INTERPOLATE (color2, color5); else product1a = color5; - + #ifdef WORDS_BIGENDIAN product1a = (product1a << 16) | product1b; product2a = (product2a << 16) | product2b; @@ -349,14 +349,14 @@ void Super2xSaI (u8 *srcPtr, u32 srcPitch, 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; @@ -373,43 +373,43 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, 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; @@ -417,12 +417,12 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, 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) @@ -441,7 +441,7 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, Q_INTERPOLATE (color2, color2, color2, color3); else product2b = INTERPOLATE (color2, color3); - + if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) product1b = @@ -453,7 +453,7 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, else product1b = INTERPOLATE (color5, color6); } - + if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) product2a = INTERPOLATE (color2, color5); @@ -463,7 +463,7 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, product2a = INTERPOLATE (color2, color5); else product2a = color2; - + if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) product1a = INTERPOLATE (color2, color5); @@ -477,18 +477,18 @@ void Super2xSaI32 (u8 *srcPtr, u32 srcPitch, *(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, +void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height) { u8 *dP; @@ -506,12 +506,12 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, deltaPtr += srcPitch; } } else -#endif +#endif { inc_bP = 1; - + u32 Nextline = srcPitch >> 1; - + for (; height; height--) { bP = (u16 *) srcPtr; xP = (u16 *) deltaPtr; @@ -521,23 +521,23 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -548,7 +548,7 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product1a = INTERPOLATE (color5, color6); } - + if ((color6 == colorS2) || (color2 == colorA1)) { product2b = INTERPOLATE (color2, color3); product2b = INTERPOLATE (color2, product2b); @@ -558,7 +558,7 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } else if (color5 == color3 && color2 != color6) { product2b = product1a = color5; - + if ((colorB1 == color5) || (color3 == colorS1)) { product1b = INTERPOLATE (color5, color6); product1b = INTERPOLATE (color5, product1b); @@ -566,7 +566,7 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product1b = INTERPOLATE (color5, color6); } - + if ((color3 == colorA2) || (color4 == color5)) { product2a = INTERPOLATE (color5, color2); product2a = INTERPOLATE (color5, product2a); @@ -574,15 +574,15 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } 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); @@ -599,13 +599,13 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -618,16 +618,16 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -635,7 +635,7 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } -void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, +void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height) { u32 *dP; @@ -644,9 +644,9 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u32 inc_bP; inc_bP = 1; - + u32 Nextline = srcPitch >> 2; - + for (; height; height--) { bP = (u32 *) srcPtr; xP = (u32 *) deltaPtr; @@ -656,23 +656,23 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -683,7 +683,7 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product1a = INTERPOLATE (color5, color6); } - + if ((color6 == colorS2) || (color2 == colorA1)) { product2b = INTERPOLATE (color2, color3); product2b = INTERPOLATE (color2, product2b); @@ -693,7 +693,7 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } else if (color5 == color3 && color2 != color6) { product2b = product1a = color5; - + if ((colorB1 == color5) || (color3 == colorS1)) { product1b = INTERPOLATE (color5, color6); product1b = INTERPOLATE (color5, product1b); @@ -701,7 +701,7 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product1b = INTERPOLATE (color5, color6); } - + if ((color3 == colorA2) || (color4 == color5)) { product2a = INTERPOLATE (color5, color2); product2a = INTERPOLATE (color5, product2a); @@ -709,15 +709,15 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } 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); @@ -734,13 +734,13 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -751,12 +751,12 @@ void SuperEagle32 (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, *(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; @@ -769,7 +769,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dP; u16 *bP; u32 inc_bP; - + #ifdef MMX if (cpu_mmx) { for (; height; height -= 1) { @@ -782,23 +782,23 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, #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 @@ -808,22 +808,22 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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) @@ -832,7 +832,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product = INTERPOLATE (colorA, colorB); } - + if (((colorA == colorG) && (colorC == colorO)) || ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))) { @@ -849,7 +849,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product = INTERPOLATE (colorA, colorB); } - + if (((colorC == colorH) && (colorA == colorF)) || ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))) { @@ -865,10 +865,10 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, product2 = colorA; } else { register int r = 0; - + product1 = INTERPOLATE (colorA, colorC); product = INTERPOLATE (colorA, colorB); - + r += GetResult1 (colorA, colorB, colorG, colorE, colorI); @@ -881,7 +881,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, r += GetResult1 (colorA, colorB, colorL, colorO, colorP); - + if (r > 0) product2 = colorA; else if (r < 0) @@ -894,7 +894,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } } else { product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD); - + if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) { product = colorA; @@ -904,7 +904,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, } else { product = INTERPOLATE (colorA, colorB); } - + if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) { product1 = colorA; @@ -915,7 +915,7 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, product1 = INTERPOLATE (colorA, colorC); } } - + #ifdef WORDS_BIGENDIAN product = (colorA << 16) | product ; product1 = (product1 << 16) | product2 ; @@ -925,11 +925,11 @@ void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, #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; @@ -943,22 +943,22 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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 @@ -968,22 +968,22 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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) @@ -992,7 +992,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } else { product = INTERPOLATE (colorA, colorB); } - + if (((colorA == colorG) && (colorC == colorO)) || ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))) { @@ -1009,7 +1009,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } else { product = INTERPOLATE (colorA, colorB); } - + if (((colorC == colorH) && (colorA == colorF)) || ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))) { @@ -1025,10 +1025,10 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, product2 = colorA; } else { register int r = 0; - + product1 = INTERPOLATE (colorA, colorC); product = INTERPOLATE (colorA, colorB); - + r += GetResult1 (colorA, colorB, colorG, colorE, colorI); @@ -1041,7 +1041,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, r += GetResult1 (colorA, colorB, colorL, colorO, colorP); - + if (r > 0) product2 = colorA; else if (r < 0) @@ -1054,7 +1054,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } } else { product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD); - + if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) { product = colorA; @@ -1064,7 +1064,7 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } else { product = INTERPOLATE (colorA, colorB); } - + if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) { product1 = colorA; @@ -1079,11 +1079,11 @@ void _2xSaI32 (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, *(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; @@ -1094,18 +1094,18 @@ 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); } @@ -1114,28 +1114,28 @@ static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x, { 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, + u8 *dstPtr, u32 dstPitch, u32 dstWidth, u32 dstHeight, int width, int height) { u8 *dP; @@ -1147,31 +1147,31 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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 @@ -1185,11 +1185,11 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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*/ + + /*0*/ if (A == B && C == D && A == C) product1 = A; else /*1*/ if (A == D && B != C) { @@ -1226,7 +1226,7 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, } } else - /*2*/ + /*2*/ if (B == C && A != D) { f1 = (x1 >> 1) + (0x10000 >> 2); @@ -1267,7 +1267,7 @@ void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { product1 = Bilinear4 (A, B, C, D, x1, y1); } - + //end First Pixel *(u32 *) dP = product1; dP += 2; diff --git a/src/2xSaImmx.asm b/src/2xSaImmx.asm index 6bef8106..6ec45756 100644 --- a/src/2xSaImmx.asm +++ b/src/2xSaImmx.asm @@ -102,7 +102,7 @@ _2xSaISuper2xSaILine: 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 + sub eax, ebx ;eax points to B1 which is the base ; Main Loop .Loop: push ecx @@ -153,7 +153,7 @@ _2xSaISuper2xSaILine: packsswb mm7, mm7 movd ecx, mm7 - test ecx, ecx + test ecx, ecx jz near .SKIP_PROCESS ;no, so we can skip ;End Delta @@ -432,7 +432,7 @@ _2xSaISuper2xSaILine: pcmpgtw mm0, mm1 por mm7, [Mask35] - por mm0, [Mask26] + por mm0, [Mask26] movq [Mask35], mm7 movq [Mask26], mm0 @@ -440,7 +440,7 @@ _2xSaISuper2xSaILine: ;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 @@ -516,7 +516,7 @@ _2xSaISuper2xSaILine: pand mm6, mm2 por mm7, mm6 - + movq mm6, mm7 pcmpeqw mm6, mm5 pand mm7, mm0 @@ -527,8 +527,8 @@ _2xSaISuper2xSaILine: movq [final1a], mm7 ;finished 1a - - ;-------------------------------- + + ;-------------------------------- movq mm7, [Mask35] push eax @@ -568,7 +568,7 @@ _2xSaISuper2xSaILine: pand mm6, mm2 por mm7, mm6 - + movq mm6, mm7 pcmpeqw mm6, mm5 pand mm7, mm0 @@ -580,7 +580,7 @@ _2xSaISuper2xSaILine: ;-------------------------------------------- - + %ifdef dfhsdfhsdahdsfhdsfh if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) @@ -647,7 +647,7 @@ _2xSaISuper2xSaILine: movq mm4, [Mask35] movq mm3, [Mask26] - + movq mm6, mm4 pand mm6, mm7 pxor mm4, mm6 @@ -679,7 +679,7 @@ _2xSaISuper2xSaILine: movq [final2b], mm0 ;----------------------------------- - + pxor mm7, mm7 movq mm0, [eax+colorB0] @@ -721,7 +721,7 @@ _2xSaISuper2xSaILine: movq mm4, [Mask35] movq mm3, [Mask26] - + movq mm6, mm4 pand mm6, mm7 pxor mm4, mm6 @@ -751,7 +751,7 @@ _2xSaISuper2xSaILine: por mm0, mm3 por mm0, mm2 movq [final1b], mm0 - + ;--------- movq mm0, [final1a] @@ -2052,7 +2052,7 @@ Bits565: mov [eax+4], edx mov eax, 0 jmp end3 -end3: +end3: pop edx mov esp, ebp pop ebp diff --git a/src/CheatSearch.cpp b/src/CheatSearch.cpp index ca344ab4..655d8f59 100644 --- a/src/CheatSearch.cpp +++ b/src/CheatSearch.cpp @@ -120,7 +120,7 @@ void cheatSearchCleanup(CheatSearchData *cs) void cheatSearchStart(const CheatSearchData *cs) { int count = cs->count; - + for(int i = 0; i < count; i++) { CheatSearchBlock *block = &cs->blocks[i]; @@ -163,7 +163,7 @@ u32 cheatSearchRead(u8 *data, int off, int size) return res; } -void cheatSearch(const CheatSearchData *cs, int compare, int size, +void cheatSearch(const CheatSearchData *cs, int compare, int size, bool isSigned) { if(compare < 0 || compare > SEARCH_GE) @@ -183,7 +183,7 @@ void cheatSearch(const CheatSearchData *cs, int compare, int 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); @@ -210,7 +210,7 @@ void cheatSearch(const CheatSearchData *cs, int compare, int 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); @@ -231,7 +231,7 @@ void cheatSearch(const CheatSearchData *cs, int compare, int size, } } -void cheatSearchValue(const CheatSearchData *cs, int compare, int size, +void cheatSearchValue(const CheatSearchData *cs, int compare, int size, bool isSigned, u32 value) { if(compare < 0 || compare > SEARCH_GE) @@ -250,7 +250,7 @@ void cheatSearchValue(const CheatSearchData *cs, int compare, int size, 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); @@ -276,7 +276,7 @@ void cheatSearchValue(const CheatSearchData *cs, int compare, int size, 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); @@ -296,7 +296,7 @@ void cheatSearchValue(const CheatSearchData *cs, int compare, int size, } } -int cheatSearchGetCount(const CheatSearchData *cs, int size) +int cheatSearchGetCount(const CheatSearchData *cs, int size) { int res = 0; int inc = 1; @@ -307,7 +307,7 @@ int cheatSearchGetCount(const CheatSearchData *cs, int size) 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) { diff --git a/src/CheatSearch.h b/src/CheatSearch.h index 10db35d2..5cbcd188 100644 --- a/src/CheatSearch.h +++ b/src/CheatSearch.h @@ -62,9 +62,9 @@ enum { extern CheatSearchData cheatSearchData; extern void cheatSearchCleanup(CheatSearchData *cs); extern void cheatSearchStart(const CheatSearchData *cs); -extern void cheatSearch(const CheatSearchData *cs, int compare, int size, +extern void cheatSearch(const CheatSearchData *cs, int compare, int size, bool isSigned); -extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size, +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); diff --git a/src/Cheats.cpp b/src/Cheats.cpp index c8290495..147c3f1c 100644 --- a/src/Cheats.cpp +++ b/src/Cheats.cpp @@ -66,7 +66,7 @@ * 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, 2*CCCC is count) - * BBBBBBBB BBBB + * BBBBBBBB BBBB * 6AAAAAAA YYYY - 16-bit and * 7AAAAAAA YYYY - if address contains 16-bit value enable next code * 8AAAAAAA YYYY - 16-bit constant write @@ -115,7 +115,7 @@ #define CBA_ADD 32 #define CBA_OR 33 #define CBA_LT 34 -#define CBA_GT 35 +#define CBA_GT 35 #define CBA_SUPER 36 #define GSA_8_BIT_POINTER 37 #define GSA_16_BIT_POINTER 38 @@ -322,7 +322,7 @@ u8 v3_deadtable2[256] = { WRITE16LE(((u16 *)&rom[(a) & 0x1ffffff]), v); #define CHEAT_PATCH_ROM_32BIT(a,v) \ - WRITE32LE(((u32 *)&rom[(a) & 0x1ffffff]), v); + WRITE32LE(((u32 *)&rom[(a) & 0x1ffffff]), v); static bool isMultilineWithData(int i) { @@ -613,7 +613,7 @@ int cheatsCheckKeys(u32 keys, u32 extended) cheatsList[i].status |= 4; else cheatsList[i].status &= ~4; - + if(cheatsList[i].status & 1) ticks += ((cheatsList[i].value & 0xFFFF) * 7); break; @@ -752,12 +752,12 @@ int cheatsCheckKeys(u32 keys, u32 extended) break; case GSA_16_BIT_GS_WRITE: if(extended & 4) { - CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value); + CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value); } break; case GSA_32_BIT_GS_WRITE: if(extended & 4) { - CPUWriteMemory(cheatsList[i].address, cheatsList[i].value); + CPUWriteMemory(cheatsList[i].address, cheatsList[i].value); } break; case CBA_IF_KEYS_PRESSED: @@ -884,12 +884,12 @@ int cheatsCheckKeys(u32 keys, u32 extended) } break; case CBA_ADD: - if ((cheatsList[i].address & 1) == 0) { - CPUWriteHalfWord(cheatsList[i].address, + if ((cheatsList[i].address & 1) == 0) { + CPUWriteHalfWord(cheatsList[i].address, CPUReadHalfWord(cheatsList[i].address) + cheatsList[i].value); } else { - CPUWriteMemory(cheatsList[i].address & 0x0FFFFFFE, + CPUWriteMemory(cheatsList[i].address & 0x0FFFFFFE, CPUReadMemory(cheatsList[i].address & 0x0FFFFFFE) + cheatsList[i].value); } @@ -1121,11 +1121,11 @@ int cheatsCheckKeys(u32 keys, u32 extended) break; case GSA_16_BIT_WRITE_IOREGS: if ((cheatsList[i].address <= 0x3FF) && (cheatsList[i].address != 0x6) && - (cheatsList[i].address != 0x130)) + (cheatsList[i].address != 0x130)) ioMem[cheatsList[i].address & 0x3FE]=cheatsList[i].value & 0xFFFF; break; case GSA_32_BIT_WRITE_IOREGS: - if (cheatsList[i].address<=0x3FF) + if (cheatsList[i].address<=0x3FF) { if (((cheatsList[i].address & 0x3FC) != 0x6) && ((cheatsList[i].address & 0x3FC) != 0x130)) ioMem[cheatsList[i].address & 0x3FC]= (cheatsList[i].value & 0xFFFF); @@ -1400,7 +1400,7 @@ void cheatsDelete(int number, bool restore) if(cheatsList[x].status & 1) { cheatsList[x].status &= ~1; CHEAT_PATCH_ROM_16BIT(cheatsList[x].address, - cheatsList[x].oldValue); + cheatsList[x].oldValue); } break; case GSA_16_BIT_ROM_PATCH2C: @@ -1476,7 +1476,7 @@ bool cheatsVerifyCheatCode(const char *code, const char *desc) if(code[8] != ':') { systemMessage(MSG_INVALID_CHEAT_CODE, N_("Invalid cheat code '%s'"), code); - return false; + return false; } size_t i; @@ -1496,10 +1496,10 @@ bool cheatsVerifyCheatCode(const char *code, const char *desc) return false; } } - + u32 address = 0; u32 value = 0; - + char buffer[10]; strncpy(buffer, code, 8); buffer[8] = 0; @@ -1525,8 +1525,8 @@ bool cheatsVerifyCheatCode(const char *code, const char *desc) address); return false; } - - strncpy(buffer, &code[9], 8); + + strncpy(buffer, &code[9], 8); sscanf(buffer, "%x", &value); int type = 0; if(len == 13) @@ -1575,7 +1575,7 @@ u32 seed_gen(u8 upper, u8 seed, u8 *deadtable1, u8 *deadtable2) { for (i = 0; i < 4; i++) newseed = ((newseed << 8) | ((deadtable1[(i + upper) & 0xFF] + deadtable2[seed]) & 0xFF)); - + return newseed; } @@ -1583,7 +1583,7 @@ void cheatsDecryptGSACode(u32& address, u32& value, bool v3) { u32 rollingseed = 0xC6EF3720; u32 *seeds = v3 ? seeds_v3 : seeds_v1; - + int bitsleft = 32; while (bitsleft > 0) { value -= ((((address << 4) + seeds[2]) ^ (address + rollingseed)) ^ @@ -1603,7 +1603,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) N_("Invalid GSA code. Format is XXXXXXXXYYYYYYYY")); return; } - + int i; for(i = 0; i < 16; i++) { if(!CHEAT_IS_HEX(code[i])) { @@ -1613,7 +1613,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) return; } } - + char buffer[10]; strncpy(buffer, code, 8); buffer[8] = 0; @@ -1638,7 +1638,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) 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, address & 0x0FFFFFFF, value, v3 ? 257 : 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, v3 ? 257 : 256, UNKNOWN_CODE); return; } @@ -1940,7 +1940,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) break; } } else { - int type = (address >> 28) & 15; + int type = (address >> 28) & 15; switch(type) { case 0: case 1: @@ -1972,7 +1972,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) break; default: // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; } @@ -1981,27 +1981,27 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) address <<= 1; type = (value >> 24) & 0xFF; if(type == 0x00) { - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, GSA_16_BIT_ROM_PATCH); break; } // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; case 8: switch((address >> 20) & 15) { case 1: - cheatsAdd(code, desc, address, address & 0x0F0FFFFF, value, 256, + cheatsAdd(code, desc, address, address & 0x0F0FFFFF, value, 256, GSA_8_BIT_GS_WRITE); break; case 2: - cheatsAdd(code, desc, address, address & 0x0F0FFFFF, value, 256, + cheatsAdd(code, desc, address, address & 0x0F0FFFFF, value, 256, GSA_16_BIT_GS_WRITE); break; case 4: // This code is buggy : the value is always set to 0 ! - cheatsAdd(code, desc, address, address & 0x0F0FFFFF, 0, 256, + cheatsAdd(code, desc, address, address & 0x0F0FFFFF, 0, 256, GSA_32_BIT_GS_WRITE); break; case 15: @@ -2009,7 +2009,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) break; default: // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; } @@ -2018,52 +2018,52 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) if(address != 0xDEADFACE) { switch((value >> 20) & 0xF) { case 0: - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, CBA_IF_TRUE); break; case 1: - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, CBA_IF_FALSE); break; case 2: - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, GSA_16_BIT_IF_LOWER_OR_EQ_U); break; case 3: - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value & 0xFFFF, 256, GSA_16_BIT_IF_HIGHER_OR_EQ_U); break; default: // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; } } else - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; case 0x0e: switch((value >> 28) & 0xF) { case 0: - cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, + cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, GSA_16_BIT_MIF_TRUE); break; case 1: - cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, + cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, GSA_16_BIT_MIF_FALSE); break; case 2: - cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, + cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, GSA_16_BIT_MIF_LOWER_OR_EQ_U); break; case 3: - cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, + cheatsAdd(code, desc, address, value & 0x0FFFFFFF, address & 0xFFFF, 256, GSA_16_BIT_MIF_HIGHER_OR_EQ_U); break; default: // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; } @@ -2074,7 +2074,7 @@ void cheatsAddGSACode(const char *code, const char *desc, bool v3) break; default: // unsupported code - cheatsAdd(code, desc, address, address, value, 256, + cheatsAdd(code, desc, address, address, value, 256, UNKNOWN_CODE); break; } @@ -2086,7 +2086,7 @@ 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); @@ -2371,7 +2371,7 @@ void cheatsCBAGenTable() { u16 cheatsCBACalcCRC(u8 *rom, int count) { u32 crc = 0xffffffff; - + if (count & 3) { // 0x08000EAE } else { @@ -2458,7 +2458,7 @@ void cheatsAddCBACode(const char *code, const char *desc) N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); return; } - + int i; for(i = 0; i < 8; i++) { if(!CHEAT_IS_HEX(code[i])) { @@ -2472,9 +2472,9 @@ void cheatsAddCBACode(const char *code, const char *desc) if(code[8] != ' ') { systemMessage(MSG_INVALID_CBA_CODE, N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); - return; + return; } - + for(i = 9; i < 13; i++) { if(!CHEAT_IS_HEX(code[i])) { // wrong cheat @@ -2482,8 +2482,8 @@ void cheatsAddCBACode(const char *code, const char *desc) N_("Invalid CBA code. Format is XXXXXXXX YYYY.")); return; } - } - + } + char buffer[10]; strncpy(buffer, code, 8); buffer[8] = 0; @@ -2517,7 +2517,7 @@ void cheatsAddCBACode(const char *code, const char *desc) address = READ32LE(((u32 *)array)); value = READ16LE(((u16 *)&array[4])); - + int type = (address >> 28) & 15; if(isMultilineWithData(cheatsNumber-1) || (super>0)) { @@ -2526,7 +2526,7 @@ void cheatsAddCBACode(const char *code, const char *desc) super-= 1; return; } - + switch(type) { case 0x00: { @@ -2537,7 +2537,7 @@ void cheatsAddCBACode(const char *code, const char *desc) systemMessage(MSG_CBA_CODE_WARNING, N_("Warning: Codes seem to be for a different game.\nCodes may not work correctly.")); } - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, 512, UNKNOWN_CODE); } break; @@ -2546,15 +2546,15 @@ void cheatsAddCBACode(const char *code, const char *desc) mastercode = (address & 0x1FFFFFF) | 0x08000000; break; case 0x02: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_OR); break; case 0x03: - cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFF, value, 512, INT_8_BIT_WRITE); break; case 0x04: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_SLIDE_CODE); break; case 0x05: @@ -2563,32 +2563,32 @@ void cheatsAddCBACode(const char *code, const char *desc) super = getCodeLength(cheatsNumber-1); break; case 0x06: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_AND); break; case 0x07: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_IF_TRUE); break; case 0x08: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, INT_16_BIT_WRITE); break; case 0x0a: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_IF_FALSE); break; case 0x0b: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_GT); break; case 0x0c: - cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, + cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512, CBA_LT); break; case 0x0d: if ((address & 0xF0)<0x30) - cheatsAdd(code, desc, address, address & 0xF0, value, 512, + cheatsAdd(code, desc, address, address & 0xF0, value, 512, CBA_IF_KEYS_PRESSED); break; case 0x0e: @@ -2601,7 +2601,7 @@ void cheatsAddCBACode(const char *code, const char *desc) break; default: // unsupported code - cheatsAdd(code, desc, address, address & 0xFFFFFFFF, value, 512, + cheatsAdd(code, desc, address, address & 0xFFFFFFFF, value, 512, UNKNOWN_CODE); break; } @@ -2611,14 +2611,14 @@ void cheatsAddCBACode(const char *code, const char *desc) void cheatsSaveGame(gzFile file) { utilWriteInt(file, cheatsNumber); - + utilGzWrite(file, cheatsList, sizeof(cheatsList)); } void cheatsReadGame(gzFile file, int version) { cheatsNumber = 0; - + cheatsNumber = utilReadInt(file); if (version > 8) @@ -2626,7 +2626,7 @@ void cheatsReadGame(gzFile file, int version) bool firstCodeBreaker = true; - + for(int i = 0; i < cheatsNumber; i++) { if (version <9) { @@ -2676,7 +2676,7 @@ void cheatsReadGame(gzFile file, int version) buffer[4] = 0; u32 value; sscanf(buffer, "%x", &value); - + u32 seed[8]; cheatsCBAParseSeedCode(address, value, seed); cheatsCBAChangeEncryption(seed); @@ -2717,7 +2717,7 @@ bool cheatsLoadCheatList(const char *file) fclose(f); return false; } - + if(version != 1) { systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_VERSION, N_("Unsupported cheat list version %d"), version); @@ -2738,7 +2738,7 @@ bool cheatsLoadCheatList(const char *file) fclose(f); return false; } - + if(fread(&count, 1, sizeof(count), f) != sizeof(count)) { fclose(f); return false; @@ -2771,7 +2771,7 @@ bool cheatsLoadCheatList(const char *file) } 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]) { @@ -2790,7 +2790,7 @@ bool cheatsLoadCheatList(const char *file) break; } } - + if(cheatsList[i].code == 512 && firstCodeBreaker) { firstCodeBreaker = false; char buffer[10]; @@ -2803,11 +2803,11 @@ bool cheatsLoadCheatList(const char *file) buffer[4] = 0; u32 value; sscanf(buffer, "%x", &value); - + u32 seed[8]; cheatsCBAParseSeedCode(address, value, seed); cheatsCBAChangeEncryption(seed); - } + } } } cheatsNumber = count; @@ -2817,7 +2817,7 @@ bool cheatsLoadCheatList(const char *file) extern int cpuNextEvent; -extern void debuggerBreakOnWrite(u32 , u32, u32, int, int); +extern void debuggerBreakOnWrite(u32 , u32, u32, int, int); static u8 cheatsGetType(u32 address) { diff --git a/src/EEprom.cpp b/src/EEprom.cpp index 0e456c08..7280339f 100644 --- a/src/EEprom.cpp +++ b/src/EEprom.cpp @@ -140,7 +140,7 @@ void eepromWrite(u32 /* address */, u8 value) eepromAddress = ((eepromBuffer[0] & 0x3F) << 8) | ((eepromBuffer[1] & 0xFF)); if(!(eepromBuffer[0] & 0x40)) { - eepromBuffer[0] = bit; + eepromBuffer[0] = bit; eepromBits = 1; eepromByte = 0; eepromMode = EEPROM_WRITEDATA; @@ -157,7 +157,7 @@ void eepromWrite(u32 /* address */, u8 value) if(!(eepromBuffer[0] & 0x40)) { eepromBuffer[0] = bit; eepromBits = 1; - eepromByte = 0; + eepromByte = 0; eepromMode = EEPROM_WRITEDATA; } else { eepromMode = EEPROM_READDATA; @@ -194,4 +194,4 @@ void eepromWrite(u32 /* address */, u8 value) break; } } - + diff --git a/src/Flash.cpp b/src/Flash.cpp index a04adc4a..2cb81c71 100644 --- a/src/Flash.cpp +++ b/src/Flash.cpp @@ -53,7 +53,7 @@ static variable_desc flashSaveData[] = { static variable_desc flashSaveData2[] = { { &flashState, sizeof(int) }, { &flashReadState, sizeof(int) }, - { &flashSize, sizeof(int) }, + { &flashSize, sizeof(int) }, { &flashSaveMemory[0], 0x20000 }, { NULL, 0 } }; diff --git a/src/GBA.cpp b/src/GBA.cpp index 3a359bf1..a613caae 100644 --- a/src/GBA.cpp +++ b/src/GBA.cpp @@ -1,4461 +1,4461 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2005-2006 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 "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 - -#define UPDATE_REG(address, value)\ - {\ - WRITE16LE(((u16 *)&ioMem[address]),value);\ - }\ - -#define ARM_PREFETCH \ - {\ - cpuPrefetch[0] = CPUReadMemoryQuick(armNextPC);\ - cpuPrefetch[1] = CPUReadMemoryQuick(armNextPC+4);\ - } - -#define THUMB_PREFETCH \ - {\ - cpuPrefetch[0] = CPUReadHalfWordQuick(armNextPC);\ - cpuPrefetch[1] = CPUReadHalfWordQuick(armNextPC+2);\ - } - -#define ARM_PREFETCH_NEXT \ - cpuPrefetch[1] = CPUReadMemoryQuick(armNextPC+4); - -#define THUMB_PREFETCH_NEXT\ - cpuPrefetch[1] = CPUReadHalfWordQuick(armNextPC+2); - -#ifdef __GNUC__ -#define _stricmp strcasecmp -#endif - - -extern int emulating; -extern int linktime; -extern void StartLink(u16); -extern void StartJOYLink(u16); -extern void StartGPLink(u16); -extern void LinkSSend(u16); -extern void LinkUpdate(int); -extern int linktime2; - -int SWITicks = 0; -int IRQTicks = 0; - -u32 mastercode = 0; -int layerEnableDelay = 0; -bool busPrefetch = false; -bool busPrefetchEnable = false; -u32 busPrefetchCount = 0; -int cpuDmaTicksToUpdate = 0; -int cpuDmaCount = 0; -bool cpuDmaHack = false; -bool cpuDmaHack2 = false; -u32 cpuDmaLast = 0; -int dummyAddress = 0; - -bool cpuBreakLoop = false; -int cpuNextEvent = 0; - -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; - -u32 cpuPrefetch[2]; - -int cpuTotalTicks = 0; -#ifdef PROFILING -int profilingTicks = 0; -int profilingTicksReload = 0; -static profile_segment *profilSegment = NULL; -#endif - -u8 freezeWorkRAM[0x40000]; -u8 freezeInternalRAM[0x8000]; -u8 freezeVRAM[0x18000]; -u8 freezePRAM[0x400]; -u8 freezeOAM[0x400]; -bool debugger_last; - -int lcdTicks = (useBios && !skipBios) ? 1008 : 208; -u8 timerOnOffDelay = 0; -u16 timer0Value = 0; -bool timer0On = false; -int timer0Ticks = 0; -int timer0Reload = 0; -int timer0ClockReload = 0; -u16 timer1Value = 0; -bool timer1On = false; -int timer1Ticks = 0; -int timer1Reload = 0; -int timer1ClockReload = 0; -u16 timer2Value = 0; -bool timer2On = false; -int timer2Ticks = 0; -int timer2Reload = 0; -int timer2ClockReload = 0; -u16 timer3Value = 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; - -int capture = 0; -int capturePrevious = 0; -int captureNumber = 0; - -const int TIMER_TICKS[4] = { - 0, - 6, - 8, - 10 -}; - -const u32 objTilesAddress [3] = {0x010000, 0x014000, 0x014000}; -const u8 gamepakRamWaitState[4] = { 4, 3, 2, 8 }; -const u8 gamepakWaitState[4] = { 4, 3, 2, 8 }; -const u8 gamepakWaitState0[2] = { 2, 1 }; -const u8 gamepakWaitState1[2] = { 4, 1 }; -const u8 gamepakWaitState2[2] = { 8, 1 }; -const bool isInRom [16]= - { false, false, false, false, false, false, false, false, - true, true, true, true, true, true, false, false }; - -u8 memoryWait[16] = - { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; -u8 memoryWait32[16] = - { 0, 0, 5, 0, 0, 1, 1, 0, 7, 7, 9, 9, 13, 13, 4, 0 }; -u8 memoryWaitSeq[16] = - { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; -u8 memoryWaitSeq32[16] = - { 0, 0, 5, 0, 0, 1, 1, 0, 5, 5, 9, 9, 17, 17, 4, 0 }; - -// The videoMemoryWait constants are used to add some waitstates -// if the opcode access video memory data outside of vblank/hblank -// It seems to happen on only one ticks for each pixel. -// Not used for now (too problematic with current code). -//const u8 videoMemoryWait[16] = -// {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - - -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, -0xE3A03000, -0xE3A04001, -0xE3500000, -0x1B000004, -0xE5CC3301, -0xEB000002, -0x0AFFFFFC, -0xE8BD4010, -0xE12FFF1E, -0xE3A0C301, -0xE5CC3208, -0xE15C20B8, -0xE0110002, -0x10222000, -0x114C20B8, -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 } -}; - -static int romSize = 0x2000000; - -#ifdef PROFILING -void cpuProfil(profile_segment *seg) -{ - profilSegment = seg; -} - -void cpuEnableProfiling(int hz) -{ - if(hz == 0) - hz = 100; - profilingTicks = profilingTicksReload = 16777216 / hz; - profSetHertz(hz); -} -#endif - - -// Waitstates when accessing data -inline int dataTicksAccess16(u32 address) // DATA 8/16bits NON SEQ -{ - int addr = (address>>24)&15; - int value = memoryWait[addr]; - - if ((addr>=0x08) || (addr < 0x02)) - { - busPrefetchCount=0; - busPrefetch=false; - } - else if (busPrefetch) - { - int waitState = value; - if (!waitState) - waitState = 1; - busPrefetchCount = ((++busPrefetchCount)<>24)&15; - int value = memoryWait32[addr]; - - if ((addr>=0x08) || (addr < 0x02)) - { - busPrefetchCount=0; - busPrefetch=false; - } - else if (busPrefetch) - { - int waitState = value; - if (!waitState) - waitState = 1; - busPrefetchCount = ((++busPrefetchCount)<>24)&15; - int value = memoryWaitSeq[addr]; - - if ((addr>=0x08) || (addr < 0x02)) - { - busPrefetchCount=0; - busPrefetch=false; - } - else if (busPrefetch) - { - int waitState = value; - if (!waitState) - waitState = 1; - busPrefetchCount = ((++busPrefetchCount)<>24)&15; - int value = memoryWaitSeq32[addr]; - - if ((addr>=0x08) || (addr < 0x02)) - { - busPrefetchCount=0; - busPrefetch=false; - } - else if (busPrefetch) - { - int waitState = value; - if (!waitState) - waitState = 1; - busPrefetchCount = ((++busPrefetchCount)<>24)&15; - - if ((addr>=0x08) && (addr<=0x0D)) - { - if (busPrefetchCount&0x1) - { - if (busPrefetchCount&0x2) - { - busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); - return 0; - } - busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); - return memoryWaitSeq[addr]-1; - } - else - { - busPrefetchCount=0; - return memoryWait[addr]; - } - } - else - { - busPrefetchCount = 0; - return memoryWait[addr]; - } -} - -inline int codeTicksAccess32(u32 address) // ARM NON SEQ -{ - int addr = (address>>24)&15; - - if ((addr>=0x08) && (addr<=0x0D)) - { - if (busPrefetchCount&0x1) - { - if (busPrefetchCount&0x2) - { - busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); - return 0; - } - busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); - return memoryWaitSeq[addr] - 1; - } - else - { - busPrefetchCount = 0; - return memoryWait32[addr]; - } - } - else - { - busPrefetchCount = 0; - return memoryWait32[addr]; - } -} - -inline int codeTicksAccessSeq16(u32 address) // THUMB SEQ -{ - int addr = (address>>24)&15; - - if ((addr>=0x08) && (addr<=0x0D)) - { - if (busPrefetchCount&0x1) - { - busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); - return 0; - } - else - if (busPrefetchCount>0xFF) - { - busPrefetchCount=0; - return memoryWait[addr]; - } - else - return memoryWaitSeq[addr]; - } - else - { - busPrefetchCount = 0; - return memoryWaitSeq[addr]; - } -} - -inline int codeTicksAccessSeq32(u32 address) // ARM SEQ -{ - int addr = (address>>24)&15; - - if ((addr>=0x08) && (addr<=0x0D)) - { - if (busPrefetchCount&0x1) - { - if (busPrefetchCount&0x2) - { - busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); - return 0; - } - busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); - return memoryWaitSeq[addr]; - } - else - if (busPrefetchCount>0xFF) - { - busPrefetchCount=0; - return memoryWait32[addr]; - } - else - return memoryWaitSeq32[addr]; - } - else - { - return memoryWaitSeq32[addr]; - } -} - - -inline int CPUUpdateTicks() -{ - int cpuLoopTicks = lcdTicks; - - if(soundTicks < cpuLoopTicks) - cpuLoopTicks = soundTicks; - - if(timer0On && (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 - - if (SWITicks) { - if (SWITicks < cpuLoopTicks) - cpuLoopTicks = SWITicks; - } - - if (IRQTicks) { - if (IRQTicks < cpuLoopTicks) - cpuLoopTicks = IRQTicks; - } - - 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); - } -} - -static bool CPUWriteState(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, IRQTicks); - - 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); - - 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 = CPUWriteState(gzFile); - - utilGzClose(gzFile); - - return res; -} - -bool CPUWriteMemState(char *memory, int available) -{ - gzFile gzFile = utilMemGzOpen(memory, available, "w"); - - if(gzFile == NULL) { - return false; - } - - bool res = CPUWriteState(gzFile); - - long pos = utilGzMemTell(gzFile)+8; - - if(pos >= (available)) - res = false; - - utilGzClose(gzFile); - - return res; -} - -static bool CPUReadState(gzFile gzFile) -{ - 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); - return false; - } - - 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); - return false; - } - - bool 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")); - return false; - } - - 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) - { - IRQTicks = 0; - intState = false; - } - else - { - IRQTicks = utilReadInt(gzFile); - if (IRQTicks>0) - intState = true; - else - { - intState = false; - IRQTicks = 0; - } - } - - 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, version); - } - 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); - } - - if(version <= SAVE_GAME_VERSION_8) { - timer0ClockReload = TIMER_TICKS[TM0CNT & 3]; - timer1ClockReload = TIMER_TICKS[TM1CNT & 3]; - timer2ClockReload = TIMER_TICKS[TM2CNT & 3]; - timer3ClockReload = TIMER_TICKS[TM3CNT & 3]; - - timer0Ticks = ((0x10000 - TM0D) << timer0ClockReload) - timer0Ticks; - timer1Ticks = ((0x10000 - TM1D) << timer1ClockReload) - timer1Ticks; - timer2Ticks = ((0x10000 - TM2D) << timer2ClockReload) - timer2Ticks; - timer3Ticks = ((0x10000 - TM3D) << timer3ClockReload) - timer3Ticks; - interp_rate(); - } - - // 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; - case 3: - break; - case 5: - gbaSaveType = 5; - break; - default: - systemMessage(MSG_UNSUPPORTED_SAVE_TYPE, - N_("Unsupported save type %d"), saveType); - break; - } - if(eepromInUse) - gbaSaveType = 3; - - systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; - if(armState) { - ARM_PREFETCH; - } else { - THUMB_PREFETCH; - } - - CPUUpdateRegister(0x204, CPUReadHalfWordQuick(0x4000204)); - - return true; -} - -bool CPUReadMemState(char *memory, int available) -{ - gzFile gzFile = utilMemGzOpen(memory, available, "r"); - - bool res = CPUReadState(gzFile); - - utilGzClose(gzFile); - - return res; -} - -bool CPUReadState(const char * file) -{ - gzFile gzFile = utilGzOpen(file, "rb"); - - if(gzFile == NULL) - return false; - - bool res = CPUReadState(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 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) && (gbaSaveType!=5)) { - 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, (u32)strlen(title)); - fwrite(buffer, 1, 4, file); // title length - fwrite(title, 1, strlen(title), file); - utilPutDword(buffer, (u32)strlen(desc)); - fwrite(buffer, 1, 4, file); // desc length - fwrite(desc, 1, strlen(desc), file); - utilPutDword(buffer, (u32)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 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() -{ -#ifdef PROFILING - if(profilingTicksReload) { - profCleanup(); - } -#endif - - if(rom != NULL) { - free(rom); - rom = NULL; - } - - if(vram != NULL) { - free(vram); - vram = NULL; - } - - if(paletteRAM != NULL) { - free(paletteRAM); - paletteRAM = NULL; - } - - if(internalRAM != NULL) { - free(internalRAM); - internalRAM = NULL; - } - - if(workRAM != NULL) { - free(workRAM); - workRAM = NULL; - } - - if(bios != NULL) { - free(bios); - bios = NULL; - } - - if(pix != NULL) { - free(pix); - pix = NULL; - } - - if(oam != NULL) { - free(oam); - oam = NULL; - } - - if(ioMem != NULL) { - free(ioMem); - ioMem = NULL; - } - - elfCleanUp(); - - systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; - - emulating = 0; -} - -int CPULoadRom(const char *szFile) -{ - romSize = 0x2000000; - if(rom != NULL) { - CPUCleanUp(); - } - - systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; - - rom = (u8 *)malloc(0x2000000); - if(rom == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "ROM"); - return 0; - } - workRAM = (u8 *)calloc(1, 0x40000); - if(workRAM == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "WRAM"); - return 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, romSize, f); - if(!res || romSize == 0) { - free(rom); - rom = NULL; - free(workRAM); - workRAM = NULL; - elfCleanUp(); - return 0; - } - } else if(!utilLoad(szFile, - utilIsGBAImage, - whereToLoad, - romSize)) { - free(rom); - rom = NULL; - free(workRAM); - workRAM = NULL; - return 0; - } - - u16 *temp = (u16 *)(rom+((romSize+1)&~1)); - int i; - for(i = (romSize+1)&~1; i < 0x2000000; i+=2) { - WRITE16LE(temp, (i >> 1) & 0xFFFF); - temp++; - } - - bios = (u8 *)calloc(1,0x4000); - if(bios == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "BIOS"); - CPUCleanUp(); - return 0; - } - internalRAM = (u8 *)calloc(1,0x8000); - if(internalRAM == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "IRAM"); - CPUCleanUp(); - return 0; - } - paletteRAM = (u8 *)calloc(1,0x400); - if(paletteRAM == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "PRAM"); - CPUCleanUp(); - return 0; - } - vram = (u8 *)calloc(1, 0x20000); - if(vram == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "VRAM"); - CPUCleanUp(); - return 0; - } - oam = (u8 *)calloc(1, 0x400); - if(oam == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "OAM"); - CPUCleanUp(); - return 0; - } - pix = (u8 *)calloc(1, 4 * 241 * 162); - if(pix == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "PIX"); - CPUCleanUp(); - return 0; - } - ioMem = (u8 *)calloc(1, 0x400); - if(ioMem == NULL) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "IO"); - CPUCleanUp(); - return 0; - } - - flashInit(); - eepromInit(); - - CPUUpdateRenderBuffers(true); - - return romSize; -} - -void doMirroring (bool b) -{ - u32 mirroredRomSize = (((romSize)>>20) & 0x3F)<<20; - u32 mirroredRomAddress = romSize; - if ((mirroredRomSize <=0x800000) && (b)) - { - mirroredRomAddress = mirroredRomSize; - if (mirroredRomSize==0) - mirroredRomSize=0x100000; - while (mirroredRomAddress<0x01000000) - { - memcpy ((u16 *)(rom+mirroredRomAddress), (u16 *)(rom), mirroredRomSize); - mirroredRomAddress+=mirroredRomSize; - } - } -} - -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)) - cpuNextEvent = cpuTotalTicks; - } -} - -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; - ARM_PREFETCH; - 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; - ARM_PREFETCH; - 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; - cpuNextEvent = cpuTotalTicks; - cpuBreakLoop = true; - 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(); - ARM_PREFETCH; - 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; - cpuNextEvent = cpuTotalTicks; - break; - case 0x03: -#ifdef DEV_VERSION - if(systemVerbose & VERBOSE_SWI) { - log("Stop: (VCOUNT = %2d)\n", - VCOUNT); - } -#endif - holdState = true; - holdType = -1; - stopState = true; - cpuNextEvent = cpuTotalTicks; - 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: - { - int len = (reg[2].I & 0x1FFFFF) >>1; - if (!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + len) & 0xe000000) == 0)) - { - if ((reg[2].I >> 24) & 1) - { - if ((reg[2].I >> 26) & 1) - SWITicks = (7 + memoryWait32[(reg[1].I>>24) & 0xF]) * (len>>1); - else - SWITicks = (8 + memoryWait[(reg[1].I>>24) & 0xF]) * (len); - } - else - { - if ((reg[2].I >> 26) & 1) - SWITicks = (10 + memoryWait32[(reg[0].I>>24) & 0xF] + - memoryWait32[(reg[1].I>>24) & 0xF]) * (len>>1); - else - SWITicks = (11 + memoryWait[(reg[0].I>>24) & 0xF] + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - } - } - BIOS_CpuSet(); - break; - case 0x0C: - { - int len = (reg[2].I & 0x1FFFFF) >>5; - if (!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + len) & 0xe000000) == 0)) - { - if ((reg[2].I >> 24) & 1) - SWITicks = (6 + memoryWait32[(reg[1].I>>24) & 0xF] + - 7 * (memoryWaitSeq32[(reg[1].I>>24) & 0xF] + 1)) * len; - else - SWITicks = (9 + memoryWait32[(reg[0].I>>24) & 0xF] + - memoryWait32[(reg[1].I>>24) & 0xF] + - 7 * (memoryWaitSeq32[(reg[0].I>>24) & 0xF] + - memoryWaitSeq32[(reg[1].I>>24) & 0xF] + 2)) * len; - } - } - BIOS_CpuFastSet(); - break; - case 0x0D: - BIOS_GetBiosChecksum(); - break; - case 0x0E: - BIOS_BgAffineSet(); - break; - case 0x0F: - BIOS_ObjAffineSet(); - break; - case 0x10: - { - int len = CPUReadHalfWord(reg[2].I); - if (!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + len) & 0xe000000) == 0)) - SWITicks = (32 + memoryWait[(reg[0].I>>24) & 0xF]) * len; - } - BIOS_BitUnPack(); - break; - case 0x11: - { - u32 len = CPUReadMemory(reg[0].I) >> 8; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (9 + memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_LZ77UnCompWram(); - break; - case 0x12: - { - u32 len = CPUReadMemory(reg[0].I) >> 8; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (19 + memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_LZ77UnCompVram(); - break; - case 0x13: - { - u32 len = CPUReadMemory(reg[0].I) >> 8; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (29 + (memoryWait[(reg[0].I>>24) & 0xF]<<1)) * len; - } - BIOS_HuffUnComp(); - break; - case 0x14: - { - u32 len = CPUReadMemory(reg[0].I) >> 8; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (11 + memoryWait[(reg[0].I>>24) & 0xF] + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_RLUnCompWram(); - break; - case 0x15: - { - u32 len = CPUReadMemory(reg[0].I) >> 9; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (34 + (memoryWait[(reg[0].I>>24) & 0xF] << 1) + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_RLUnCompVram(); - break; - case 0x16: - { - u32 len = CPUReadMemory(reg[0].I) >> 8; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (13 + memoryWait[(reg[0].I>>24) & 0xF] + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_Diff8bitUnFilterWram(); - break; - case 0x17: - { - u32 len = CPUReadMemory(reg[0].I) >> 9; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (39 + (memoryWait[(reg[0].I>>24) & 0xF]<<1) + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - BIOS_Diff8bitUnFilterVram(); - break; - case 0x18: - { - u32 len = CPUReadMemory(reg[0].I) >> 9; - if(!(((reg[0].I & 0xe000000) == 0) || - ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) - SWITicks = (13 + memoryWait[(reg[0].I>>24) & 0xF] + - memoryWait[(reg[1].I>>24) & 0xF]) * len; - } - 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 - systemSoundResume(); - break; - case 0x1F: - BIOS_MidiKey2Freq(); - break; - case 0x2A: - BIOS_SndDriverJmpTableCopy(); - // let it go, because we don't really emulate this function - 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); - } - if (layerEnableDelay>0) - { - layerEnableDelay--; - if (layerEnableDelay==1) - layerEnable = layerSettings & DISPCNT; - } - -} - -void doDMA(u32 &s, u32 &d, u32 si, u32 di, u32 c, int transfer32) -{ - int sm = s >> 24; - int dm = d >> 24; - int sw = 0; - int dw = 0; - int sc = c; - - cpuDmaCount = c; - // This is done to get the correct waitstates. - if (sm>15) - sm=15; - if (dm>15) - dm=15; - - //if ((sm>=0x05) && (sm<=0x07) || (dm>=0x05) && (dm <=0x07)) - // blank = (((DISPSTAT | ((DISPSTAT>>1)&1))==1) ? true : false); - - if(transfer32) { - s &= 0xFFFFFFFC; - if(s < 0x02000000 && (reg[15].I >> 24)) { - while(c != 0) { - CPUWriteMemory(d, 0); - d += di; - c--; - } - } else { - while(c != 0) { - cpuDmaLast = CPUReadMemory(s); - CPUWriteMemory(d, cpuDmaLast); - 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); - cpuDmaLast |= (cpuDmaLast<<16); - d += di; - s += si; - c--; - } - } - } - - cpuDmaCount = 0; - - int totalTicks = 0; - - if(transfer32) { - sw =1+memoryWaitSeq32[sm & 15]; - dw =1+memoryWaitSeq32[dm & 15]; - totalTicks = (sw+dw)*(sc-1) + 6 + memoryWait32[sm & 15] + - memoryWaitSeq32[dm & 15]; - } - else - { - sw = 1+memoryWaitSeq[sm & 15]; - dw = 1+memoryWaitSeq[dm & 15]; - totalTicks = (sw+dw)*(sc-1) + 6 + memoryWait[sm & 15] + - memoryWaitSeq[dm & 15]; - } - - cpuDmaTicksToUpdate += totalTicks; - -} - -bool CPUCheckDMA(int reason, int dmamask) -{ - bool res = false; - cpuDmaHack = 0; - - // DMA 0 - if((DM0CNT_H & 0x8000) && (dmamask & 1)) { - if(((DM0CNT_H >> 12) & 3) == reason) { - res = true; - 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 = true; - - if(DM0CNT_H & 0x4000) { - IF |= 0x0100; - UPDATE_REG(0x202, IF); - cpuNextEvent = cpuTotalTicks; - } - - 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) { - res = true; - - 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 = true; - - if(DM1CNT_H & 0x4000) { - IF |= 0x0200; - UPDATE_REG(0x202, IF); - cpuNextEvent = cpuTotalTicks; - } - - 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) { - res = true; - 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 = true; - - if(DM2CNT_H & 0x4000) { - IF |= 0x0400; - UPDATE_REG(0x202, IF); - cpuNextEvent = cpuTotalTicks; - } - - 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) { - res = true; - 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); - cpuNextEvent = cpuTotalTicks; - } - - 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 = false; - return res; -} - -void CPUUpdateRegister(u32 address, u16 value) -{ - switch(address) { - case 0x00: - { - if ((value & 7) >5) - DISPCNT = (value &7); - bool change = ((DISPCNT ^ value) & 0x80) ? true : false; - bool changeBG = ((DISPCNT ^ value) & 0x0F00) ? true : false; - u16 changeBGon = (((~DISPCNT) & value) & 0x0F00); - DISPCNT = (value & 0xFFF7); - UPDATE_REG(0x00, DISPCNT); - - if (changeBGon) - { - layerEnableDelay=4; - layerEnable = layerSettings & value & (~changeBGon); - } - else - layerEnable = layerSettings & value; - // CPUUpdateTicks(); - - windowOn = (layerEnable & 0x6000) ? true : false; - if(change && !((value & 0x80))) { - if(!(DISPSTAT & 1)) { - lcdTicks = 1008; - // 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); - } - 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; - interp_rate(); - break; - case 0x102: - timer0Value = value; - timerOnOffDelay|=1; - cpuNextEvent = cpuTotalTicks; - break; - case 0x104: - timer1Reload = value; - interp_rate(); - break; - case 0x106: - timer1Value = value; - timerOnOffDelay|=2; - cpuNextEvent = cpuTotalTicks; - break; - case 0x108: - timer2Reload = value; - break; - case 0x10A: - timer2Value = value; - timerOnOffDelay|=4; - cpuNextEvent = cpuTotalTicks; - break; - case 0x10C: - timer3Reload = value; - break; - case 0x10E: - timer3Value = value; - timerOnOffDelay|=8; - cpuNextEvent = cpuTotalTicks; - break; - case 0x128: - if (linkenable) - { - StartLink(value); - } - else - { - 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 0x12a: - if(linkenable && lspeed) - { - LinkSSend(value); - UPDATE_REG(0x134, value); - } - break; - case 0x130: - P1 |= (value & 0x3FF); - UPDATE_REG(0x130, P1); - break; - case 0x132: - UPDATE_REG(0x132, value & 0xC3FF); - break; - case 0x134: - if (linkenable) - StartGPLink(value); - else - UPDATE_REG(0x134, value); - - break; - case 0x140: - if (linkenable) - StartJOYLink(value); - else - UPDATE_REG(0x140, value); - - break; - case 0x200: - IE = value & 0x3FFF; - UPDATE_REG(0x200, IE); - if ((IME & 1) && (IF & IE) && armIrqEnable) - cpuNextEvent = cpuTotalTicks; - break; - case 0x202: - IF ^= (value & IF); - UPDATE_REG(0x202, IF); - break; - case 0x204: - { - memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; - - if(!speedHack) { - memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 3]; - memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = - gamepakWaitState0[(value >> 4) & 1]; - - memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 3]; - memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = - gamepakWaitState1[(value >> 7) & 1]; - - memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 3]; - memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = - gamepakWaitState2[(value >> 10) & 1]; - } else { - memoryWait[0x08] = memoryWait[0x09] = 3; - memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 1; - - memoryWait[0x0a] = memoryWait[0x0b] = 3; - memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 1; - - memoryWait[0x0c] = memoryWait[0x0d] = 3; - memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 1; - } - - for(int i = 8; i < 15; i++) { - memoryWait32[i] = memoryWait[i] + memoryWaitSeq[i] + 1; - memoryWaitSeq32[i] = memoryWaitSeq[i]*2 + 1; - } - - if((value & 0x4000) == 0x4000) { - busPrefetchEnable = true; - busPrefetch = false; - busPrefetchCount = 0; - } else { - busPrefetchEnable = false; - busPrefetch = false; - busPrefetchCount = 0; - } - UPDATE_REG(0x204, value & 0x7FFF); - - } - break; - case 0x208: - IME = value & 1; - UPDATE_REG(0x208, IME); - if ((IME & 1) && (IF & IE) && armIrqEnable) - cpuNextEvent = cpuTotalTicks; - break; - case 0x300: - if(value != 0) - value &= 0xFFFE; - UPDATE_REG(0x300, value); - break; - default: - UPDATE_REG(address&0x3FE, value); - break; - } -} - -void applyTimer () -{ - if (timerOnOffDelay & 1) - { - timer0ClockReload = TIMER_TICKS[timer0Value & 3]; - if(!timer0On && (timer0Value & 0x80)) { - // reload the counter - TM0D = timer0Reload; - timer0Ticks = (0x10000 - TM0D) << timer0ClockReload; - UPDATE_REG(0x100, TM0D); - } - timer0On = timer0Value & 0x80 ? true : false; - TM0CNT = timer0Value & 0xC7; - interp_rate(); - UPDATE_REG(0x102, TM0CNT); - // CPUUpdateTicks(); - } - if (timerOnOffDelay & 2) - { - timer1ClockReload = TIMER_TICKS[timer1Value & 3]; - if(!timer1On && (timer1Value & 0x80)) { - // reload the counter - TM1D = timer1Reload; - timer1Ticks = (0x10000 - TM1D) << timer1ClockReload; - UPDATE_REG(0x104, TM1D); - } - timer1On = timer1Value & 0x80 ? true : false; - TM1CNT = timer1Value & 0xC7; - interp_rate(); - UPDATE_REG(0x106, TM1CNT); - } - if (timerOnOffDelay & 4) - { - timer2ClockReload = TIMER_TICKS[timer2Value & 3]; - if(!timer2On && (timer2Value & 0x80)) { - // reload the counter - TM2D = timer2Reload; - timer2Ticks = (0x10000 - TM2D) << timer2ClockReload; - UPDATE_REG(0x108, TM2D); - } - timer2On = timer2Value & 0x80 ? true : false; - TM2CNT = timer2Value & 0xC7; - UPDATE_REG(0x10A, TM2CNT); - } - if (timerOnOffDelay & 8) - { - timer3ClockReload = TIMER_TICKS[timer3Value & 3]; - if(!timer3On && (timer3Value & 0x80)) { - // reload the counter - TM3D = timer3Reload; - timer3Ticks = (0x10000 - TM3D) << timer3ClockReload; - UPDATE_REG(0x10C, TM3D); - } - timer3On = timer3Value & 0x80 ? true : false; - TM3CNT = timer3Value & 0xC7; - UPDATE_REG(0x10E, TM3CNT); - } - cpuNextEvent = CPUUpdateTicks(); - timerOnOffDelay = 0; -} - -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 BKPT_SUPPORT - if(*((u16 *)&freezeWorkRAM[address & 0x3FFFE])) - cheatsWriteHalfWord(address & 0x203FFFE, - value); - else -#endif - WRITE16LE(((u16 *)&workRAM[address & 0x3FFFE]),value); - break; - case 3: -#ifdef BKPT_SUPPORT - if(*((u16 *)&freezeInternalRAM[address & 0x7ffe])) - cheatsWriteHalfWord(address & 0x3007ffe, - value); - else -#endif - WRITE16LE(((u16 *)&internalRAM[address & 0x7ffe]), value); - break; - case 4: - if(address < 0x4000400) - CPUUpdateRegister(address & 0x3fe, value); - else goto unwritable; - break; - case 5: -#ifdef BKPT_SUPPORT - if(*((u16 *)&freezePRAM[address & 0x03fe])) - cheatsWriteHalfWord(address & 0x70003fe, - value); - else -#endif - WRITE16LE(((u16 *)&paletteRAM[address & 0x3fe]), value); - break; - case 6: - address = (address & 0x1fffe); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - return; - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; -#ifdef BKPT_SUPPORT - if(*((u16 *)&freezeVRAM[address])) - cheatsWriteHalfWord(address + 0x06000000, - value); - else -#endif - WRITE16LE(((u16 *)&vram[address]), value); - break; - case 7: -#ifdef BKPT_SUPPORT - if(*((u16 *)&freezeOAM[address & 0x03fe])) - cheatsWriteHalfWord(address & 0x70003fe, - value); - else -#endif - 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 BKPT_SUPPORT - if(freezeWorkRAM[address & 0x3FFFF]) - cheatsWriteByte(address & 0x203FFFF, b); - else -#endif - workRAM[address & 0x3FFFF] = b; - break; - case 3: -#ifdef BKPT_SUPPORT - if(freezeInternalRAM[address & 0x7fff]) - cheatsWriteByte(address & 0x3007fff, b); - else -#endif - internalRAM[address & 0x7fff] = b; - break; - case 4: - if(address < 0x4000400) { - switch(address & 0x3FF) { - case 0x301: - if(b == 0x80) - stopState = true; - holdState = 1; - holdType = -1; - cpuNextEvent = cpuTotalTicks; - 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) - CPUUpdateRegister(address & 0x3fe, - ((READ16LE(((u16 *)&ioMem[address & 0x3fe]))) - & 0x00FF) | - b<<8); - else - CPUUpdateRegister(address & 0x3fe, - ((READ16LE(((u16 *)&ioMem[address & 0x3fe])) & 0xFF00) | b)); - } - break; - } else goto unwritable; - break; - case 5: - // no need to switch - *((u16 *)&paletteRAM[address & 0x3FE]) = (b << 8) | b; - break; - case 6: - address = (address & 0x1fffe); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - return; - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; - - // no need to switch - // byte writes to OBJ VRAM are ignored - if ((address) < objTilesAddress[((DISPCNT&7)+1)>>2]) - { -#ifdef BKPT_SUPPORT - if(freezeVRAM[address]) - cheatsWriteByte(address + 0x06000000, b); - else -#endif - *((u16 *)&vram[address]) = (b << 8) | b; - } - break; - case 7: - // no need to switch - // byte writes to OAM are ignored - // *((u16 *)&oam[address & 0x3FE]) = (b << 8) | b; - break; - case 13: - if(cpuEEPROMEnabled) { - eepromWrite(address, b); - break; - } - goto unwritable; - case 14: - if (!(saveType == 5) && (!eepromInUse | cpuSramEnabled | cpuFlashEnabled)) { - - //if(!cpuEEPROMEnabled && (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; - - if(romSize < 0x1fe2000) { - *((u16 *)&rom[0x1fe209c]) = 0xdffa; // SWI 0xFA - *((u16 *)&rom[0x1fe209e]) = 0x4770; // BX LR - } else { - agbPrintEnable(false); - } -} - -void CPUReset() -{ - 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); - - DISPCNT = 0x0080; - DISPSTAT = 0x0000; - VCOUNT = (useBios && !skipBios) ? 0 :0x007E; - 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(0x06, VCOUNT); - 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; - - lcdTicks = (useBios && !skipBios) ? 1008 : 208; - 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; - saveType = gbaSaveType = 0; - break; - case 1: // EEPROM - cpuSramEnabled = false; - cpuFlashEnabled = false; - cpuEEPROMEnabled = true; - cpuEEPROMSensorEnabled = false; - saveType = gbaSaveType = 3; - // EEPROM usage is automatically detected - break; - case 2: // SRAM - cpuSramEnabled = true; - cpuFlashEnabled = false; - cpuEEPROMEnabled = false; - cpuEEPROMSensorEnabled = false; - cpuSaveGameFunc = sramDelayedWrite; // to insure we detect the write - saveType = gbaSaveType = 1; - break; - case 3: // FLASH - cpuSramEnabled = false; - cpuFlashEnabled = true; - cpuEEPROMEnabled = false; - cpuEEPROMSensorEnabled = false; - cpuSaveGameFunc = flashDelayedWrite; // to insure we detect the write - saveType = gbaSaveType = 2; - break; - case 4: // EEPROM+Sensor - cpuSramEnabled = false; - cpuFlashEnabled = false; - cpuEEPROMEnabled = true; - cpuEEPROMSensorEnabled = true; - // EEPROM usage is automatically detected - saveType = gbaSaveType = 3; - break; - case 5: // NONE - cpuSramEnabled = false; - cpuFlashEnabled = false; - cpuEEPROMEnabled = false; - cpuEEPROMSensorEnabled = false; - // no save at all - saveType = gbaSaveType = 5; - break; - } - - ARM_PREFETCH; - - systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; - - cpuDmaHack = false; - - lastTime = systemGetClock(); - - SWITicks = 0; -} - -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; - ARM_PREFETCH; - - // if(!holdState) - biosProtected[0] = 0x02; - biosProtected[1] = 0xc0; - biosProtected[2] = 0x5e; - biosProtected[3] = 0xe5; -} - -#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 - -void CPULoop(int ticks) -{ - int clockTicks; - int timerOverflow = 0; - // variable used by the CPU core - cpuTotalTicks = 0; - if(linkenable && cpuDmaHack2) - cpuNextEvent = 1; - cpuBreakLoop = false; - cpuNextEvent = CPUUpdateTicks(); - if(cpuNextEvent > ticks) - cpuNextEvent = ticks; - - - for(;;) { -#ifndef FINAL_VERSION - if(systemDebug) { - if(systemDebug >= 10 && !holdState) { - CPUUpdateCPSR(); -#ifdef BKPT_SUPPORT - if (debugger_last) - { - 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", - oldreg[0], oldreg[1], oldreg[2], oldreg[3], oldreg[4], oldreg[5], - oldreg[6], oldreg[7], oldreg[8], oldreg[9], oldreg[10], oldreg[11], - oldreg[12], oldreg[13], oldreg[14], oldreg[15], oldreg[16], - oldreg[17]); - } -#endif - 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 /* FINAL_VERSION */ - - if(!holdState && !SWITicks) { - - // Emulates the Cheat System (m) code - if((cheatsEnabled) && (mastercode) && (mastercode == armNextPC)) - { - u32 joy = 0; - if(systemReadJoypads()) - joy = systemReadJoypad(-1); - u32 ext = (joy >> 10); - cpuTotalTicks += cheatsCheckKeys(P1^0x3FF, ext); - } - - if ((armNextPC & 0x0803FFFF) == 0x08020000) - busPrefetchCount=0x100; - - if(armState) { -#include "arm-new.h" - } else { -#include "thumb.h" - } - } else - clockTicks = CPUUpdateTicks(); - - cpuTotalTicks += clockTicks; - - - if(cpuTotalTicks >= cpuNextEvent) { - int remainingTicks = cpuTotalTicks - cpuNextEvent; - - if (SWITicks) - { - SWITicks-=clockTicks; - if (SWITicks<0) - SWITicks = 0; - } - - clockTicks = cpuNextEvent; - cpuTotalTicks = 0; - cpuDmaHack = false; - - updateLoop: - - if (IRQTicks) - { - IRQTicks -= clockTicks; - if (IRQTicks<0) - IRQTicks = 0; - } - - lcdTicks -= clockTicks; - - - if(lcdTicks <= 0) { - if(DISPSTAT & 1) { // V-BLANK - // if in V-Blank mode, keep computing... - if(DISPSTAT & 2) { - lcdTicks += 1008; - VCOUNT++; - UPDATE_REG(0x06, VCOUNT); - DISPSTAT &= 0xFFFD; - UPDATE_REG(0x04, DISPSTAT); - CPUCompareVCOUNT(); - } else { - lcdTicks += 224; - DISPSTAT |= 2; - UPDATE_REG(0x04, DISPSTAT); - if(DISPSTAT & 16) { - IF |= 2; - UPDATE_REG(0x202, IF); - } - } - - if(VCOUNT >= 228) { //Reaching last line - DISPSTAT &= 0xFFFC; - UPDATE_REG(0x04, DISPSTAT); - VCOUNT = 0; - UPDATE_REG(0x06, VCOUNT); - CPUCompareVCOUNT(); - } - } else { - int framesToSkip = systemFrameSkip; - if(speedup) - framesToSkip = 9; // try 6 FPS during speedup - - if(DISPSTAT & 2) { - // if in H-Blank, leave it and move to drawing mode - VCOUNT++; - UPDATE_REG(0x06, VCOUNT); - - lcdTicks += 1008; - DISPSTAT &= 0xFFFD; - if(VCOUNT == 160) { - count++; - systemFrame(); - - if((count % 10) == 0) { - system10Frames(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); - P1 = 0x03FF ^ (joy & 0x3FF); - if(cpuEEPROMSensorEnabled) - systemUpdateMotionSensor(); - 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); - // If no (m) code is enabled, apply the cheats at each LCDline - if((cheatsEnabled) && (mastercode==0)) - remainingTicks += cheatsCheckKeys(P1^0x3FF, ext); - 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); - } - cpuDmaHack2 = CPUCheckDMA(1, 0x0f); - if(frameCount >= framesToSkip) { - systemDrawScreen(); - frameCount = 0; - } else - frameCount++; - if(systemPauseOnFrame()) - ticks = 0; - } - - UPDATE_REG(0x04, DISPSTAT); - CPUCompareVCOUNT(); - - } else { - if(frameCount >= framesToSkip) - { - (*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 += 224; - cpuDmaHack2 = CPUCheckDMA(2, 0x0f); - if(DISPSTAT & 16) { - IF |= 2; - UPDATE_REG(0x202, IF); - } - } - } - } - - if(!stopState) { - if(timer0On) { - timer0Ticks -= clockTicks; - if(timer0Ticks <= 0) { - timer0Ticks += (0x10000 - timer0Reload) << timer0ClockReload; - timerOverflow |= 1; - soundTimerOverflow(0); - if(TM0CNT & 0x40) { - IF |= 0x08; - UPDATE_REG(0x202, IF); - } - } - TM0D = 0xFFFF - (timer0Ticks >> timer0ClockReload); - 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 { - timer1Ticks -= clockTicks; - if(timer1Ticks <= 0) { - timer1Ticks += (0x10000 - timer1Reload) << timer1ClockReload; - timerOverflow |= 2; - soundTimerOverflow(1); - if(TM1CNT & 0x40) { - IF |= 0x10; - UPDATE_REG(0x202, IF); - } - } - TM1D = 0xFFFF - (timer1Ticks >> timer1ClockReload); - 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 { - timer2Ticks -= clockTicks; - if(timer2Ticks <= 0) { - timer2Ticks += (0x10000 - timer2Reload) << timer2ClockReload; - timerOverflow |= 4; - if(TM2CNT & 0x40) { - IF |= 0x20; - UPDATE_REG(0x202, IF); - } - } - TM2D = 0xFFFF - (timer2Ticks >> timer2ClockReload); - 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 { - timer3Ticks -= clockTicks; - if(timer3Ticks <= 0) { - timer3Ticks += (0x10000 - timer3Reload) << timer3ClockReload; - if(TM3CNT & 0x40) { - IF |= 0x40; - UPDATE_REG(0x202, IF); - } - } - TM3D = 0xFFFF - (timer3Ticks >> timer3ClockReload); - UPDATE_REG(0x10C, TM3D); - } - } - } - - timerOverflow = 0; - - // we shouldn't be doing sound in stop state, but we loose synchronization - // if sound is disabled, so in stop state, soundTick will just produce - // mute sound - soundTicks -= clockTicks; - if(soundTicks <= 0) { - psoundTickfn(); - soundTicks += SOUND_CLOCK_TICKS; - } - -#ifdef PROFILING - profilingTicks -= clockTicks; - if(profilingTicks <= 0) { - profilingTicks += profilingTicksReload; - if(profilSegment) { - profile_segment *seg = profilSegment; - do { - u16 *b = (u16 *)seg->sbuf; - int pc = ((reg[15].I - seg->s_lowpc) * seg->s_scale)/0x10000; - if(pc >= 0 && pc < seg->ssiz) { - b[pc]++; - break; - } - - seg = seg->next; - } while(seg); - } - } -#endif - - ticks -= clockTicks; - - if (linkenable) - LinkUpdate(clockTicks); - - cpuNextEvent = CPUUpdateTicks(); - - if(cpuDmaTicksToUpdate > 0) { - if(cpuDmaTicksToUpdate > cpuNextEvent) - clockTicks = cpuNextEvent; - else - clockTicks = cpuDmaTicksToUpdate; - cpuDmaTicksToUpdate -= clockTicks; - if(cpuDmaTicksToUpdate < 0) - cpuDmaTicksToUpdate = 0; - cpuDmaHack = true; - goto updateLoop; - } - - if(linkenable && cpuDmaHack2) - cpuNextEvent = 1; - - if(IF && (IME & 1) && armIrqEnable) { - int res = IF & IE; - if(stopState) - res &= 0x3080; - if(res) { - if (intState) - { - if (!IRQTicks) - { - CPUInterrupt(); - intState = false; - holdState = false; - stopState = false; - holdType = 0; - } - } - else - { - if (!holdState) - { - intState = true; - IRQTicks=7; - if (cpuNextEvent> IRQTicks) - cpuNextEvent = IRQTicks; - } - else - { - CPUInterrupt(); - holdState = false; - stopState = false; - holdType = 0; - } - } - - // Stops the SWI Ticks emulation if an IRQ is executed - //(to avoid problems with nested IRQ/SWI) - if (SWITicks) - SWITicks = 0; - } - } - - if(remainingTicks > 0) { - if(remainingTicks > cpuNextEvent) - clockTicks = cpuNextEvent; - else - clockTicks = remainingTicks; - remainingTicks -= clockTicks; - if(remainingTicks < 0) - remainingTicks = 0; - goto updateLoop; - } - - if (timerOnOffDelay) - applyTimer(); - - if(cpuNextEvent > ticks) - cpuNextEvent = ticks; - - if(ticks <= 0 || cpuBreakLoop) - break; - - } - } -} - - - -struct EmulatedSystem GBASystem = { - // emuMain - CPULoop, - // emuReset - CPUReset, - // emuCleanUp - CPUCleanUp, - // emuReadBattery - CPUReadBatteryFile, - // emuWriteBattery - CPUWriteBatteryFile, - // emuReadState - CPUReadState, - // emuWriteState - CPUWriteState, - // emuReadMemState - CPUReadMemState, - // emuWriteMemState - CPUWriteMemState, - // emuWritePNG - CPUWritePNGFile, - // emuWriteBMP - CPUWriteBMPFile, - // emuUpdateCPSR - CPUUpdateCPSR, - // emuHasDebugger - true, - // emuCount -#ifdef FINAL_VERSION - 250000 -#else - 5000 -#endif -}; +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2005-2006 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 "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 + +#define UPDATE_REG(address, value)\ + {\ + WRITE16LE(((u16 *)&ioMem[address]),value);\ + }\ + +#define ARM_PREFETCH \ + {\ + cpuPrefetch[0] = CPUReadMemoryQuick(armNextPC);\ + cpuPrefetch[1] = CPUReadMemoryQuick(armNextPC+4);\ + } + +#define THUMB_PREFETCH \ + {\ + cpuPrefetch[0] = CPUReadHalfWordQuick(armNextPC);\ + cpuPrefetch[1] = CPUReadHalfWordQuick(armNextPC+2);\ + } + +#define ARM_PREFETCH_NEXT \ + cpuPrefetch[1] = CPUReadMemoryQuick(armNextPC+4); + +#define THUMB_PREFETCH_NEXT\ + cpuPrefetch[1] = CPUReadHalfWordQuick(armNextPC+2); + +#ifdef __GNUC__ +#define _stricmp strcasecmp +#endif + + +extern int emulating; +extern int linktime; +extern void StartLink(u16); +extern void StartJOYLink(u16); +extern void StartGPLink(u16); +extern void LinkSSend(u16); +extern void LinkUpdate(int); +extern int linktime2; + +int SWITicks = 0; +int IRQTicks = 0; + +u32 mastercode = 0; +int layerEnableDelay = 0; +bool busPrefetch = false; +bool busPrefetchEnable = false; +u32 busPrefetchCount = 0; +int cpuDmaTicksToUpdate = 0; +int cpuDmaCount = 0; +bool cpuDmaHack = false; +bool cpuDmaHack2 = false; +u32 cpuDmaLast = 0; +int dummyAddress = 0; + +bool cpuBreakLoop = false; +int cpuNextEvent = 0; + +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; + +u32 cpuPrefetch[2]; + +int cpuTotalTicks = 0; +#ifdef PROFILING +int profilingTicks = 0; +int profilingTicksReload = 0; +static profile_segment *profilSegment = NULL; +#endif + +u8 freezeWorkRAM[0x40000]; +u8 freezeInternalRAM[0x8000]; +u8 freezeVRAM[0x18000]; +u8 freezePRAM[0x400]; +u8 freezeOAM[0x400]; +bool debugger_last; + +int lcdTicks = (useBios && !skipBios) ? 1008 : 208; +u8 timerOnOffDelay = 0; +u16 timer0Value = 0; +bool timer0On = false; +int timer0Ticks = 0; +int timer0Reload = 0; +int timer0ClockReload = 0; +u16 timer1Value = 0; +bool timer1On = false; +int timer1Ticks = 0; +int timer1Reload = 0; +int timer1ClockReload = 0; +u16 timer2Value = 0; +bool timer2On = false; +int timer2Ticks = 0; +int timer2Reload = 0; +int timer2ClockReload = 0; +u16 timer3Value = 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; + +int capture = 0; +int capturePrevious = 0; +int captureNumber = 0; + +const int TIMER_TICKS[4] = { + 0, + 6, + 8, + 10 +}; + +const u32 objTilesAddress [3] = {0x010000, 0x014000, 0x014000}; +const u8 gamepakRamWaitState[4] = { 4, 3, 2, 8 }; +const u8 gamepakWaitState[4] = { 4, 3, 2, 8 }; +const u8 gamepakWaitState0[2] = { 2, 1 }; +const u8 gamepakWaitState1[2] = { 4, 1 }; +const u8 gamepakWaitState2[2] = { 8, 1 }; +const bool isInRom [16]= + { false, false, false, false, false, false, false, false, + true, true, true, true, true, true, false, false }; + +u8 memoryWait[16] = + { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; +u8 memoryWait32[16] = + { 0, 0, 5, 0, 0, 1, 1, 0, 7, 7, 9, 9, 13, 13, 4, 0 }; +u8 memoryWaitSeq[16] = + { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; +u8 memoryWaitSeq32[16] = + { 0, 0, 5, 0, 0, 1, 1, 0, 5, 5, 9, 9, 17, 17, 4, 0 }; + +// The videoMemoryWait constants are used to add some waitstates +// if the opcode access video memory data outside of vblank/hblank +// It seems to happen on only one ticks for each pixel. +// Not used for now (too problematic with current code). +//const u8 videoMemoryWait[16] = +// {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + +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, +0xE3A03000, +0xE3A04001, +0xE3500000, +0x1B000004, +0xE5CC3301, +0xEB000002, +0x0AFFFFFC, +0xE8BD4010, +0xE12FFF1E, +0xE3A0C301, +0xE5CC3208, +0xE15C20B8, +0xE0110002, +0x10222000, +0x114C20B8, +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 } +}; + +static int romSize = 0x2000000; + +#ifdef PROFILING +void cpuProfil(profile_segment *seg) +{ + profilSegment = seg; +} + +void cpuEnableProfiling(int hz) +{ + if(hz == 0) + hz = 100; + profilingTicks = profilingTicksReload = 16777216 / hz; + profSetHertz(hz); +} +#endif + + +// Waitstates when accessing data +inline int dataTicksAccess16(u32 address) // DATA 8/16bits NON SEQ +{ + int addr = (address>>24)&15; + int value = memoryWait[addr]; + + if ((addr>=0x08) || (addr < 0x02)) + { + busPrefetchCount=0; + busPrefetch=false; + } + else if (busPrefetch) + { + int waitState = value; + if (!waitState) + waitState = 1; + busPrefetchCount = ((++busPrefetchCount)<>24)&15; + int value = memoryWait32[addr]; + + if ((addr>=0x08) || (addr < 0x02)) + { + busPrefetchCount=0; + busPrefetch=false; + } + else if (busPrefetch) + { + int waitState = value; + if (!waitState) + waitState = 1; + busPrefetchCount = ((++busPrefetchCount)<>24)&15; + int value = memoryWaitSeq[addr]; + + if ((addr>=0x08) || (addr < 0x02)) + { + busPrefetchCount=0; + busPrefetch=false; + } + else if (busPrefetch) + { + int waitState = value; + if (!waitState) + waitState = 1; + busPrefetchCount = ((++busPrefetchCount)<>24)&15; + int value = memoryWaitSeq32[addr]; + + if ((addr>=0x08) || (addr < 0x02)) + { + busPrefetchCount=0; + busPrefetch=false; + } + else if (busPrefetch) + { + int waitState = value; + if (!waitState) + waitState = 1; + busPrefetchCount = ((++busPrefetchCount)<>24)&15; + + if ((addr>=0x08) && (addr<=0x0D)) + { + if (busPrefetchCount&0x1) + { + if (busPrefetchCount&0x2) + { + busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); + return 0; + } + busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); + return memoryWaitSeq[addr]-1; + } + else + { + busPrefetchCount=0; + return memoryWait[addr]; + } + } + else + { + busPrefetchCount = 0; + return memoryWait[addr]; + } +} + +inline int codeTicksAccess32(u32 address) // ARM NON SEQ +{ + int addr = (address>>24)&15; + + if ((addr>=0x08) && (addr<=0x0D)) + { + if (busPrefetchCount&0x1) + { + if (busPrefetchCount&0x2) + { + busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); + return 0; + } + busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); + return memoryWaitSeq[addr] - 1; + } + else + { + busPrefetchCount = 0; + return memoryWait32[addr]; + } + } + else + { + busPrefetchCount = 0; + return memoryWait32[addr]; + } +} + +inline int codeTicksAccessSeq16(u32 address) // THUMB SEQ +{ + int addr = (address>>24)&15; + + if ((addr>=0x08) && (addr<=0x0D)) + { + if (busPrefetchCount&0x1) + { + busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); + return 0; + } + else + if (busPrefetchCount>0xFF) + { + busPrefetchCount=0; + return memoryWait[addr]; + } + else + return memoryWaitSeq[addr]; + } + else + { + busPrefetchCount = 0; + return memoryWaitSeq[addr]; + } +} + +inline int codeTicksAccessSeq32(u32 address) // ARM SEQ +{ + int addr = (address>>24)&15; + + if ((addr>=0x08) && (addr<=0x0D)) + { + if (busPrefetchCount&0x1) + { + if (busPrefetchCount&0x2) + { + busPrefetchCount = ((busPrefetchCount&0xFF)>>2) | (busPrefetchCount&0xFFFFFF00); + return 0; + } + busPrefetchCount = ((busPrefetchCount&0xFF)>>1) | (busPrefetchCount&0xFFFFFF00); + return memoryWaitSeq[addr]; + } + else + if (busPrefetchCount>0xFF) + { + busPrefetchCount=0; + return memoryWait32[addr]; + } + else + return memoryWaitSeq32[addr]; + } + else + { + return memoryWaitSeq32[addr]; + } +} + + +inline int CPUUpdateTicks() +{ + int cpuLoopTicks = lcdTicks; + + if(soundTicks < cpuLoopTicks) + cpuLoopTicks = soundTicks; + + if(timer0On && (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 + + if (SWITicks) { + if (SWITicks < cpuLoopTicks) + cpuLoopTicks = SWITicks; + } + + if (IRQTicks) { + if (IRQTicks < cpuLoopTicks) + cpuLoopTicks = IRQTicks; + } + + 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); + } +} + +static bool CPUWriteState(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, IRQTicks); + + 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); + + 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 = CPUWriteState(gzFile); + + utilGzClose(gzFile); + + return res; +} + +bool CPUWriteMemState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "w"); + + if(gzFile == NULL) { + return false; + } + + bool res = CPUWriteState(gzFile); + + long pos = utilGzMemTell(gzFile)+8; + + if(pos >= (available)) + res = false; + + utilGzClose(gzFile); + + return res; +} + +static bool CPUReadState(gzFile gzFile) +{ + 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); + return false; + } + + 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); + return false; + } + + bool 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")); + return false; + } + + 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) + { + IRQTicks = 0; + intState = false; + } + else + { + IRQTicks = utilReadInt(gzFile); + if (IRQTicks>0) + intState = true; + else + { + intState = false; + IRQTicks = 0; + } + } + + 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, version); + } + 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); + } + + if(version <= SAVE_GAME_VERSION_8) { + timer0ClockReload = TIMER_TICKS[TM0CNT & 3]; + timer1ClockReload = TIMER_TICKS[TM1CNT & 3]; + timer2ClockReload = TIMER_TICKS[TM2CNT & 3]; + timer3ClockReload = TIMER_TICKS[TM3CNT & 3]; + + timer0Ticks = ((0x10000 - TM0D) << timer0ClockReload) - timer0Ticks; + timer1Ticks = ((0x10000 - TM1D) << timer1ClockReload) - timer1Ticks; + timer2Ticks = ((0x10000 - TM2D) << timer2ClockReload) - timer2Ticks; + timer3Ticks = ((0x10000 - TM3D) << timer3ClockReload) - timer3Ticks; + interp_rate(); + } + + // 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; + case 3: + break; + case 5: + gbaSaveType = 5; + break; + default: + systemMessage(MSG_UNSUPPORTED_SAVE_TYPE, + N_("Unsupported save type %d"), saveType); + break; + } + if(eepromInUse) + gbaSaveType = 3; + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + if(armState) { + ARM_PREFETCH; + } else { + THUMB_PREFETCH; + } + + CPUUpdateRegister(0x204, CPUReadHalfWordQuick(0x4000204)); + + return true; +} + +bool CPUReadMemState(char *memory, int available) +{ + gzFile gzFile = utilMemGzOpen(memory, available, "r"); + + bool res = CPUReadState(gzFile); + + utilGzClose(gzFile); + + return res; +} + +bool CPUReadState(const char * file) +{ + gzFile gzFile = utilGzOpen(file, "rb"); + + if(gzFile == NULL) + return false; + + bool res = CPUReadState(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 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) && (gbaSaveType!=5)) { + 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, (u32)strlen(title)); + fwrite(buffer, 1, 4, file); // title length + fwrite(title, 1, strlen(title), file); + utilPutDword(buffer, (u32)strlen(desc)); + fwrite(buffer, 1, 4, file); // desc length + fwrite(desc, 1, strlen(desc), file); + utilPutDword(buffer, (u32)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 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() +{ +#ifdef PROFILING + if(profilingTicksReload) { + profCleanup(); + } +#endif + + if(rom != NULL) { + free(rom); + rom = NULL; + } + + if(vram != NULL) { + free(vram); + vram = NULL; + } + + if(paletteRAM != NULL) { + free(paletteRAM); + paletteRAM = NULL; + } + + if(internalRAM != NULL) { + free(internalRAM); + internalRAM = NULL; + } + + if(workRAM != NULL) { + free(workRAM); + workRAM = NULL; + } + + if(bios != NULL) { + free(bios); + bios = NULL; + } + + if(pix != NULL) { + free(pix); + pix = NULL; + } + + if(oam != NULL) { + free(oam); + oam = NULL; + } + + if(ioMem != NULL) { + free(ioMem); + ioMem = NULL; + } + + elfCleanUp(); + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + emulating = 0; +} + +int CPULoadRom(const char *szFile) +{ + romSize = 0x2000000; + if(rom != NULL) { + CPUCleanUp(); + } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + rom = (u8 *)malloc(0x2000000); + if(rom == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "ROM"); + return 0; + } + workRAM = (u8 *)calloc(1, 0x40000); + if(workRAM == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "WRAM"); + return 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, romSize, f); + if(!res || romSize == 0) { + free(rom); + rom = NULL; + free(workRAM); + workRAM = NULL; + elfCleanUp(); + return 0; + } + } else if(!utilLoad(szFile, + utilIsGBAImage, + whereToLoad, + romSize)) { + free(rom); + rom = NULL; + free(workRAM); + workRAM = NULL; + return 0; + } + + u16 *temp = (u16 *)(rom+((romSize+1)&~1)); + int i; + for(i = (romSize+1)&~1; i < 0x2000000; i+=2) { + WRITE16LE(temp, (i >> 1) & 0xFFFF); + temp++; + } + + bios = (u8 *)calloc(1,0x4000); + if(bios == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "BIOS"); + CPUCleanUp(); + return 0; + } + internalRAM = (u8 *)calloc(1,0x8000); + if(internalRAM == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "IRAM"); + CPUCleanUp(); + return 0; + } + paletteRAM = (u8 *)calloc(1,0x400); + if(paletteRAM == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "PRAM"); + CPUCleanUp(); + return 0; + } + vram = (u8 *)calloc(1, 0x20000); + if(vram == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "VRAM"); + CPUCleanUp(); + return 0; + } + oam = (u8 *)calloc(1, 0x400); + if(oam == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "OAM"); + CPUCleanUp(); + return 0; + } + pix = (u8 *)calloc(1, 4 * 241 * 162); + if(pix == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "PIX"); + CPUCleanUp(); + return 0; + } + ioMem = (u8 *)calloc(1, 0x400); + if(ioMem == NULL) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "IO"); + CPUCleanUp(); + return 0; + } + + flashInit(); + eepromInit(); + + CPUUpdateRenderBuffers(true); + + return romSize; +} + +void doMirroring (bool b) +{ + u32 mirroredRomSize = (((romSize)>>20) & 0x3F)<<20; + u32 mirroredRomAddress = romSize; + if ((mirroredRomSize <=0x800000) && (b)) + { + mirroredRomAddress = mirroredRomSize; + if (mirroredRomSize==0) + mirroredRomSize=0x100000; + while (mirroredRomAddress<0x01000000) + { + memcpy ((u16 *)(rom+mirroredRomAddress), (u16 *)(rom), mirroredRomSize); + mirroredRomAddress+=mirroredRomSize; + } + } +} + +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)) + cpuNextEvent = cpuTotalTicks; + } +} + +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; + ARM_PREFETCH; + 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; + ARM_PREFETCH; + 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; + cpuNextEvent = cpuTotalTicks; + cpuBreakLoop = true; + 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(); + ARM_PREFETCH; + 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; + cpuNextEvent = cpuTotalTicks; + break; + case 0x03: +#ifdef DEV_VERSION + if(systemVerbose & VERBOSE_SWI) { + log("Stop: (VCOUNT = %2d)\n", + VCOUNT); + } +#endif + holdState = true; + holdType = -1; + stopState = true; + cpuNextEvent = cpuTotalTicks; + 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: + { + int len = (reg[2].I & 0x1FFFFF) >>1; + if (!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + len) & 0xe000000) == 0)) + { + if ((reg[2].I >> 24) & 1) + { + if ((reg[2].I >> 26) & 1) + SWITicks = (7 + memoryWait32[(reg[1].I>>24) & 0xF]) * (len>>1); + else + SWITicks = (8 + memoryWait[(reg[1].I>>24) & 0xF]) * (len); + } + else + { + if ((reg[2].I >> 26) & 1) + SWITicks = (10 + memoryWait32[(reg[0].I>>24) & 0xF] + + memoryWait32[(reg[1].I>>24) & 0xF]) * (len>>1); + else + SWITicks = (11 + memoryWait[(reg[0].I>>24) & 0xF] + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + } + } + BIOS_CpuSet(); + break; + case 0x0C: + { + int len = (reg[2].I & 0x1FFFFF) >>5; + if (!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + len) & 0xe000000) == 0)) + { + if ((reg[2].I >> 24) & 1) + SWITicks = (6 + memoryWait32[(reg[1].I>>24) & 0xF] + + 7 * (memoryWaitSeq32[(reg[1].I>>24) & 0xF] + 1)) * len; + else + SWITicks = (9 + memoryWait32[(reg[0].I>>24) & 0xF] + + memoryWait32[(reg[1].I>>24) & 0xF] + + 7 * (memoryWaitSeq32[(reg[0].I>>24) & 0xF] + + memoryWaitSeq32[(reg[1].I>>24) & 0xF] + 2)) * len; + } + } + BIOS_CpuFastSet(); + break; + case 0x0D: + BIOS_GetBiosChecksum(); + break; + case 0x0E: + BIOS_BgAffineSet(); + break; + case 0x0F: + BIOS_ObjAffineSet(); + break; + case 0x10: + { + int len = CPUReadHalfWord(reg[2].I); + if (!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + len) & 0xe000000) == 0)) + SWITicks = (32 + memoryWait[(reg[0].I>>24) & 0xF]) * len; + } + BIOS_BitUnPack(); + break; + case 0x11: + { + u32 len = CPUReadMemory(reg[0].I) >> 8; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (9 + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_LZ77UnCompWram(); + break; + case 0x12: + { + u32 len = CPUReadMemory(reg[0].I) >> 8; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (19 + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_LZ77UnCompVram(); + break; + case 0x13: + { + u32 len = CPUReadMemory(reg[0].I) >> 8; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (29 + (memoryWait[(reg[0].I>>24) & 0xF]<<1)) * len; + } + BIOS_HuffUnComp(); + break; + case 0x14: + { + u32 len = CPUReadMemory(reg[0].I) >> 8; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (11 + memoryWait[(reg[0].I>>24) & 0xF] + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_RLUnCompWram(); + break; + case 0x15: + { + u32 len = CPUReadMemory(reg[0].I) >> 9; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (34 + (memoryWait[(reg[0].I>>24) & 0xF] << 1) + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_RLUnCompVram(); + break; + case 0x16: + { + u32 len = CPUReadMemory(reg[0].I) >> 8; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (13 + memoryWait[(reg[0].I>>24) & 0xF] + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_Diff8bitUnFilterWram(); + break; + case 0x17: + { + u32 len = CPUReadMemory(reg[0].I) >> 9; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (39 + (memoryWait[(reg[0].I>>24) & 0xF]<<1) + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + BIOS_Diff8bitUnFilterVram(); + break; + case 0x18: + { + u32 len = CPUReadMemory(reg[0].I) >> 9; + if(!(((reg[0].I & 0xe000000) == 0) || + ((reg[0].I + (len & 0x1fffff)) & 0xe000000) == 0)) + SWITicks = (13 + memoryWait[(reg[0].I>>24) & 0xF] + + memoryWait[(reg[1].I>>24) & 0xF]) * len; + } + 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 + systemSoundResume(); + break; + case 0x1F: + BIOS_MidiKey2Freq(); + break; + case 0x2A: + BIOS_SndDriverJmpTableCopy(); + // let it go, because we don't really emulate this function + 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); + } + if (layerEnableDelay>0) + { + layerEnableDelay--; + if (layerEnableDelay==1) + layerEnable = layerSettings & DISPCNT; + } + +} + +void doDMA(u32 &s, u32 &d, u32 si, u32 di, u32 c, int transfer32) +{ + int sm = s >> 24; + int dm = d >> 24; + int sw = 0; + int dw = 0; + int sc = c; + + cpuDmaCount = c; + // This is done to get the correct waitstates. + if (sm>15) + sm=15; + if (dm>15) + dm=15; + + //if ((sm>=0x05) && (sm<=0x07) || (dm>=0x05) && (dm <=0x07)) + // blank = (((DISPSTAT | ((DISPSTAT>>1)&1))==1) ? true : false); + + if(transfer32) { + s &= 0xFFFFFFFC; + if(s < 0x02000000 && (reg[15].I >> 24)) { + while(c != 0) { + CPUWriteMemory(d, 0); + d += di; + c--; + } + } else { + while(c != 0) { + cpuDmaLast = CPUReadMemory(s); + CPUWriteMemory(d, cpuDmaLast); + 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); + cpuDmaLast |= (cpuDmaLast<<16); + d += di; + s += si; + c--; + } + } + } + + cpuDmaCount = 0; + + int totalTicks = 0; + + if(transfer32) { + sw =1+memoryWaitSeq32[sm & 15]; + dw =1+memoryWaitSeq32[dm & 15]; + totalTicks = (sw+dw)*(sc-1) + 6 + memoryWait32[sm & 15] + + memoryWaitSeq32[dm & 15]; + } + else + { + sw = 1+memoryWaitSeq[sm & 15]; + dw = 1+memoryWaitSeq[dm & 15]; + totalTicks = (sw+dw)*(sc-1) + 6 + memoryWait[sm & 15] + + memoryWaitSeq[dm & 15]; + } + + cpuDmaTicksToUpdate += totalTicks; + +} + +bool CPUCheckDMA(int reason, int dmamask) +{ + bool res = false; + cpuDmaHack = 0; + + // DMA 0 + if((DM0CNT_H & 0x8000) && (dmamask & 1)) { + if(((DM0CNT_H >> 12) & 3) == reason) { + res = true; + 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 = true; + + if(DM0CNT_H & 0x4000) { + IF |= 0x0100; + UPDATE_REG(0x202, IF); + cpuNextEvent = cpuTotalTicks; + } + + 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) { + res = true; + + 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 = true; + + if(DM1CNT_H & 0x4000) { + IF |= 0x0200; + UPDATE_REG(0x202, IF); + cpuNextEvent = cpuTotalTicks; + } + + 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) { + res = true; + 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 = true; + + if(DM2CNT_H & 0x4000) { + IF |= 0x0400; + UPDATE_REG(0x202, IF); + cpuNextEvent = cpuTotalTicks; + } + + 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) { + res = true; + 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); + cpuNextEvent = cpuTotalTicks; + } + + 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 = false; + return res; +} + +void CPUUpdateRegister(u32 address, u16 value) +{ + switch(address) { + case 0x00: + { + if ((value & 7) >5) + DISPCNT = (value &7); + bool change = ((DISPCNT ^ value) & 0x80) ? true : false; + bool changeBG = ((DISPCNT ^ value) & 0x0F00) ? true : false; + u16 changeBGon = (((~DISPCNT) & value) & 0x0F00); + DISPCNT = (value & 0xFFF7); + UPDATE_REG(0x00, DISPCNT); + + if (changeBGon) + { + layerEnableDelay=4; + layerEnable = layerSettings & value & (~changeBGon); + } + else + layerEnable = layerSettings & value; + // CPUUpdateTicks(); + + windowOn = (layerEnable & 0x6000) ? true : false; + if(change && !((value & 0x80))) { + if(!(DISPSTAT & 1)) { + lcdTicks = 1008; + // 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); + } + 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; + interp_rate(); + break; + case 0x102: + timer0Value = value; + timerOnOffDelay|=1; + cpuNextEvent = cpuTotalTicks; + break; + case 0x104: + timer1Reload = value; + interp_rate(); + break; + case 0x106: + timer1Value = value; + timerOnOffDelay|=2; + cpuNextEvent = cpuTotalTicks; + break; + case 0x108: + timer2Reload = value; + break; + case 0x10A: + timer2Value = value; + timerOnOffDelay|=4; + cpuNextEvent = cpuTotalTicks; + break; + case 0x10C: + timer3Reload = value; + break; + case 0x10E: + timer3Value = value; + timerOnOffDelay|=8; + cpuNextEvent = cpuTotalTicks; + break; + case 0x128: + if (linkenable) + { + StartLink(value); + } + else + { + 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 0x12a: + if(linkenable && lspeed) + { + LinkSSend(value); + UPDATE_REG(0x134, value); + } + break; + case 0x130: + P1 |= (value & 0x3FF); + UPDATE_REG(0x130, P1); + break; + case 0x132: + UPDATE_REG(0x132, value & 0xC3FF); + break; + case 0x134: + if (linkenable) + StartGPLink(value); + else + UPDATE_REG(0x134, value); + + break; + case 0x140: + if (linkenable) + StartJOYLink(value); + else + UPDATE_REG(0x140, value); + + break; + case 0x200: + IE = value & 0x3FFF; + UPDATE_REG(0x200, IE); + if ((IME & 1) && (IF & IE) && armIrqEnable) + cpuNextEvent = cpuTotalTicks; + break; + case 0x202: + IF ^= (value & IF); + UPDATE_REG(0x202, IF); + break; + case 0x204: + { + memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; + + if(!speedHack) { + memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 3]; + memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = + gamepakWaitState0[(value >> 4) & 1]; + + memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 3]; + memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = + gamepakWaitState1[(value >> 7) & 1]; + + memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 3]; + memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = + gamepakWaitState2[(value >> 10) & 1]; + } else { + memoryWait[0x08] = memoryWait[0x09] = 3; + memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 1; + + memoryWait[0x0a] = memoryWait[0x0b] = 3; + memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 1; + + memoryWait[0x0c] = memoryWait[0x0d] = 3; + memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 1; + } + + for(int i = 8; i < 15; i++) { + memoryWait32[i] = memoryWait[i] + memoryWaitSeq[i] + 1; + memoryWaitSeq32[i] = memoryWaitSeq[i]*2 + 1; + } + + if((value & 0x4000) == 0x4000) { + busPrefetchEnable = true; + busPrefetch = false; + busPrefetchCount = 0; + } else { + busPrefetchEnable = false; + busPrefetch = false; + busPrefetchCount = 0; + } + UPDATE_REG(0x204, value & 0x7FFF); + + } + break; + case 0x208: + IME = value & 1; + UPDATE_REG(0x208, IME); + if ((IME & 1) && (IF & IE) && armIrqEnable) + cpuNextEvent = cpuTotalTicks; + break; + case 0x300: + if(value != 0) + value &= 0xFFFE; + UPDATE_REG(0x300, value); + break; + default: + UPDATE_REG(address&0x3FE, value); + break; + } +} + +void applyTimer () +{ + if (timerOnOffDelay & 1) + { + timer0ClockReload = TIMER_TICKS[timer0Value & 3]; + if(!timer0On && (timer0Value & 0x80)) { + // reload the counter + TM0D = timer0Reload; + timer0Ticks = (0x10000 - TM0D) << timer0ClockReload; + UPDATE_REG(0x100, TM0D); + } + timer0On = timer0Value & 0x80 ? true : false; + TM0CNT = timer0Value & 0xC7; + interp_rate(); + UPDATE_REG(0x102, TM0CNT); + // CPUUpdateTicks(); + } + if (timerOnOffDelay & 2) + { + timer1ClockReload = TIMER_TICKS[timer1Value & 3]; + if(!timer1On && (timer1Value & 0x80)) { + // reload the counter + TM1D = timer1Reload; + timer1Ticks = (0x10000 - TM1D) << timer1ClockReload; + UPDATE_REG(0x104, TM1D); + } + timer1On = timer1Value & 0x80 ? true : false; + TM1CNT = timer1Value & 0xC7; + interp_rate(); + UPDATE_REG(0x106, TM1CNT); + } + if (timerOnOffDelay & 4) + { + timer2ClockReload = TIMER_TICKS[timer2Value & 3]; + if(!timer2On && (timer2Value & 0x80)) { + // reload the counter + TM2D = timer2Reload; + timer2Ticks = (0x10000 - TM2D) << timer2ClockReload; + UPDATE_REG(0x108, TM2D); + } + timer2On = timer2Value & 0x80 ? true : false; + TM2CNT = timer2Value & 0xC7; + UPDATE_REG(0x10A, TM2CNT); + } + if (timerOnOffDelay & 8) + { + timer3ClockReload = TIMER_TICKS[timer3Value & 3]; + if(!timer3On && (timer3Value & 0x80)) { + // reload the counter + TM3D = timer3Reload; + timer3Ticks = (0x10000 - TM3D) << timer3ClockReload; + UPDATE_REG(0x10C, TM3D); + } + timer3On = timer3Value & 0x80 ? true : false; + TM3CNT = timer3Value & 0xC7; + UPDATE_REG(0x10E, TM3CNT); + } + cpuNextEvent = CPUUpdateTicks(); + timerOnOffDelay = 0; +} + +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 BKPT_SUPPORT + if(*((u16 *)&freezeWorkRAM[address & 0x3FFFE])) + cheatsWriteHalfWord(address & 0x203FFFE, + value); + else +#endif + WRITE16LE(((u16 *)&workRAM[address & 0x3FFFE]),value); + break; + case 3: +#ifdef BKPT_SUPPORT + if(*((u16 *)&freezeInternalRAM[address & 0x7ffe])) + cheatsWriteHalfWord(address & 0x3007ffe, + value); + else +#endif + WRITE16LE(((u16 *)&internalRAM[address & 0x7ffe]), value); + break; + case 4: + if(address < 0x4000400) + CPUUpdateRegister(address & 0x3fe, value); + else goto unwritable; + break; + case 5: +#ifdef BKPT_SUPPORT + if(*((u16 *)&freezePRAM[address & 0x03fe])) + cheatsWriteHalfWord(address & 0x70003fe, + value); + else +#endif + WRITE16LE(((u16 *)&paletteRAM[address & 0x3fe]), value); + break; + case 6: + address = (address & 0x1fffe); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + return; + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; +#ifdef BKPT_SUPPORT + if(*((u16 *)&freezeVRAM[address])) + cheatsWriteHalfWord(address + 0x06000000, + value); + else +#endif + WRITE16LE(((u16 *)&vram[address]), value); + break; + case 7: +#ifdef BKPT_SUPPORT + if(*((u16 *)&freezeOAM[address & 0x03fe])) + cheatsWriteHalfWord(address & 0x70003fe, + value); + else +#endif + 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 BKPT_SUPPORT + if(freezeWorkRAM[address & 0x3FFFF]) + cheatsWriteByte(address & 0x203FFFF, b); + else +#endif + workRAM[address & 0x3FFFF] = b; + break; + case 3: +#ifdef BKPT_SUPPORT + if(freezeInternalRAM[address & 0x7fff]) + cheatsWriteByte(address & 0x3007fff, b); + else +#endif + internalRAM[address & 0x7fff] = b; + break; + case 4: + if(address < 0x4000400) { + switch(address & 0x3FF) { + case 0x301: + if(b == 0x80) + stopState = true; + holdState = 1; + holdType = -1; + cpuNextEvent = cpuTotalTicks; + 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) + CPUUpdateRegister(address & 0x3fe, + ((READ16LE(((u16 *)&ioMem[address & 0x3fe]))) + & 0x00FF) | + b<<8); + else + CPUUpdateRegister(address & 0x3fe, + ((READ16LE(((u16 *)&ioMem[address & 0x3fe])) & 0xFF00) | b)); + } + break; + } else goto unwritable; + break; + case 5: + // no need to switch + *((u16 *)&paletteRAM[address & 0x3FE]) = (b << 8) | b; + break; + case 6: + address = (address & 0x1fffe); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + return; + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; + + // no need to switch + // byte writes to OBJ VRAM are ignored + if ((address) < objTilesAddress[((DISPCNT&7)+1)>>2]) + { +#ifdef BKPT_SUPPORT + if(freezeVRAM[address]) + cheatsWriteByte(address + 0x06000000, b); + else +#endif + *((u16 *)&vram[address]) = (b << 8) | b; + } + break; + case 7: + // no need to switch + // byte writes to OAM are ignored + // *((u16 *)&oam[address & 0x3FE]) = (b << 8) | b; + break; + case 13: + if(cpuEEPROMEnabled) { + eepromWrite(address, b); + break; + } + goto unwritable; + case 14: + if (!(saveType == 5) && (!eepromInUse | cpuSramEnabled | cpuFlashEnabled)) { + + //if(!cpuEEPROMEnabled && (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; + + if(romSize < 0x1fe2000) { + *((u16 *)&rom[0x1fe209c]) = 0xdffa; // SWI 0xFA + *((u16 *)&rom[0x1fe209e]) = 0x4770; // BX LR + } else { + agbPrintEnable(false); + } +} + +void CPUReset() +{ + 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); + + DISPCNT = 0x0080; + DISPSTAT = 0x0000; + VCOUNT = (useBios && !skipBios) ? 0 :0x007E; + 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(0x06, VCOUNT); + 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; + + lcdTicks = (useBios && !skipBios) ? 1008 : 208; + 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; + saveType = gbaSaveType = 0; + break; + case 1: // EEPROM + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = true; + cpuEEPROMSensorEnabled = false; + saveType = gbaSaveType = 3; + // EEPROM usage is automatically detected + break; + case 2: // SRAM + cpuSramEnabled = true; + cpuFlashEnabled = false; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + cpuSaveGameFunc = sramDelayedWrite; // to insure we detect the write + saveType = gbaSaveType = 1; + break; + case 3: // FLASH + cpuSramEnabled = false; + cpuFlashEnabled = true; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + cpuSaveGameFunc = flashDelayedWrite; // to insure we detect the write + saveType = gbaSaveType = 2; + break; + case 4: // EEPROM+Sensor + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = true; + cpuEEPROMSensorEnabled = true; + // EEPROM usage is automatically detected + saveType = gbaSaveType = 3; + break; + case 5: // NONE + cpuSramEnabled = false; + cpuFlashEnabled = false; + cpuEEPROMEnabled = false; + cpuEEPROMSensorEnabled = false; + // no save at all + saveType = gbaSaveType = 5; + break; + } + + ARM_PREFETCH; + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + + cpuDmaHack = false; + + lastTime = systemGetClock(); + + SWITicks = 0; +} + +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; + ARM_PREFETCH; + + // if(!holdState) + biosProtected[0] = 0x02; + biosProtected[1] = 0xc0; + biosProtected[2] = 0x5e; + biosProtected[3] = 0xe5; +} + +#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 + +void CPULoop(int ticks) +{ + int clockTicks; + int timerOverflow = 0; + // variable used by the CPU core + cpuTotalTicks = 0; + if(linkenable && cpuDmaHack2) + cpuNextEvent = 1; + cpuBreakLoop = false; + cpuNextEvent = CPUUpdateTicks(); + if(cpuNextEvent > ticks) + cpuNextEvent = ticks; + + + for(;;) { +#ifndef FINAL_VERSION + if(systemDebug) { + if(systemDebug >= 10 && !holdState) { + CPUUpdateCPSR(); +#ifdef BKPT_SUPPORT + if (debugger_last) + { + 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", + oldreg[0], oldreg[1], oldreg[2], oldreg[3], oldreg[4], oldreg[5], + oldreg[6], oldreg[7], oldreg[8], oldreg[9], oldreg[10], oldreg[11], + oldreg[12], oldreg[13], oldreg[14], oldreg[15], oldreg[16], + oldreg[17]); + } +#endif + 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 /* FINAL_VERSION */ + + if(!holdState && !SWITicks) { + + // Emulates the Cheat System (m) code + if((cheatsEnabled) && (mastercode) && (mastercode == armNextPC)) + { + u32 joy = 0; + if(systemReadJoypads()) + joy = systemReadJoypad(-1); + u32 ext = (joy >> 10); + cpuTotalTicks += cheatsCheckKeys(P1^0x3FF, ext); + } + + if ((armNextPC & 0x0803FFFF) == 0x08020000) + busPrefetchCount=0x100; + + if(armState) { +#include "arm-new.h" + } else { +#include "thumb.h" + } + } else + clockTicks = CPUUpdateTicks(); + + cpuTotalTicks += clockTicks; + + + if(cpuTotalTicks >= cpuNextEvent) { + int remainingTicks = cpuTotalTicks - cpuNextEvent; + + if (SWITicks) + { + SWITicks-=clockTicks; + if (SWITicks<0) + SWITicks = 0; + } + + clockTicks = cpuNextEvent; + cpuTotalTicks = 0; + cpuDmaHack = false; + + updateLoop: + + if (IRQTicks) + { + IRQTicks -= clockTicks; + if (IRQTicks<0) + IRQTicks = 0; + } + + lcdTicks -= clockTicks; + + + if(lcdTicks <= 0) { + if(DISPSTAT & 1) { // V-BLANK + // if in V-Blank mode, keep computing... + if(DISPSTAT & 2) { + lcdTicks += 1008; + VCOUNT++; + UPDATE_REG(0x06, VCOUNT); + DISPSTAT &= 0xFFFD; + UPDATE_REG(0x04, DISPSTAT); + CPUCompareVCOUNT(); + } else { + lcdTicks += 224; + DISPSTAT |= 2; + UPDATE_REG(0x04, DISPSTAT); + if(DISPSTAT & 16) { + IF |= 2; + UPDATE_REG(0x202, IF); + } + } + + if(VCOUNT >= 228) { //Reaching last line + DISPSTAT &= 0xFFFC; + UPDATE_REG(0x04, DISPSTAT); + VCOUNT = 0; + UPDATE_REG(0x06, VCOUNT); + CPUCompareVCOUNT(); + } + } else { + int framesToSkip = systemFrameSkip; + if(speedup) + framesToSkip = 9; // try 6 FPS during speedup + + if(DISPSTAT & 2) { + // if in H-Blank, leave it and move to drawing mode + VCOUNT++; + UPDATE_REG(0x06, VCOUNT); + + lcdTicks += 1008; + DISPSTAT &= 0xFFFD; + if(VCOUNT == 160) { + count++; + systemFrame(); + + if((count % 10) == 0) { + system10Frames(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); + P1 = 0x03FF ^ (joy & 0x3FF); + if(cpuEEPROMSensorEnabled) + systemUpdateMotionSensor(); + 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); + // If no (m) code is enabled, apply the cheats at each LCDline + if((cheatsEnabled) && (mastercode==0)) + remainingTicks += cheatsCheckKeys(P1^0x3FF, ext); + 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); + } + cpuDmaHack2 = CPUCheckDMA(1, 0x0f); + if(frameCount >= framesToSkip) { + systemDrawScreen(); + frameCount = 0; + } else + frameCount++; + if(systemPauseOnFrame()) + ticks = 0; + } + + UPDATE_REG(0x04, DISPSTAT); + CPUCompareVCOUNT(); + + } else { + if(frameCount >= framesToSkip) + { + (*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 += 224; + cpuDmaHack2 = CPUCheckDMA(2, 0x0f); + if(DISPSTAT & 16) { + IF |= 2; + UPDATE_REG(0x202, IF); + } + } + } + } + + if(!stopState) { + if(timer0On) { + timer0Ticks -= clockTicks; + if(timer0Ticks <= 0) { + timer0Ticks += (0x10000 - timer0Reload) << timer0ClockReload; + timerOverflow |= 1; + soundTimerOverflow(0); + if(TM0CNT & 0x40) { + IF |= 0x08; + UPDATE_REG(0x202, IF); + } + } + TM0D = 0xFFFF - (timer0Ticks >> timer0ClockReload); + 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 { + timer1Ticks -= clockTicks; + if(timer1Ticks <= 0) { + timer1Ticks += (0x10000 - timer1Reload) << timer1ClockReload; + timerOverflow |= 2; + soundTimerOverflow(1); + if(TM1CNT & 0x40) { + IF |= 0x10; + UPDATE_REG(0x202, IF); + } + } + TM1D = 0xFFFF - (timer1Ticks >> timer1ClockReload); + 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 { + timer2Ticks -= clockTicks; + if(timer2Ticks <= 0) { + timer2Ticks += (0x10000 - timer2Reload) << timer2ClockReload; + timerOverflow |= 4; + if(TM2CNT & 0x40) { + IF |= 0x20; + UPDATE_REG(0x202, IF); + } + } + TM2D = 0xFFFF - (timer2Ticks >> timer2ClockReload); + 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 { + timer3Ticks -= clockTicks; + if(timer3Ticks <= 0) { + timer3Ticks += (0x10000 - timer3Reload) << timer3ClockReload; + if(TM3CNT & 0x40) { + IF |= 0x40; + UPDATE_REG(0x202, IF); + } + } + TM3D = 0xFFFF - (timer3Ticks >> timer3ClockReload); + UPDATE_REG(0x10C, TM3D); + } + } + } + + timerOverflow = 0; + + // we shouldn't be doing sound in stop state, but we loose synchronization + // if sound is disabled, so in stop state, soundTick will just produce + // mute sound + soundTicks -= clockTicks; + if(soundTicks <= 0) { + psoundTickfn(); + soundTicks += SOUND_CLOCK_TICKS; + } + +#ifdef PROFILING + profilingTicks -= clockTicks; + if(profilingTicks <= 0) { + profilingTicks += profilingTicksReload; + if(profilSegment) { + profile_segment *seg = profilSegment; + do { + u16 *b = (u16 *)seg->sbuf; + int pc = ((reg[15].I - seg->s_lowpc) * seg->s_scale)/0x10000; + if(pc >= 0 && pc < seg->ssiz) { + b[pc]++; + break; + } + + seg = seg->next; + } while(seg); + } + } +#endif + + ticks -= clockTicks; + + if (linkenable) + LinkUpdate(clockTicks); + + cpuNextEvent = CPUUpdateTicks(); + + if(cpuDmaTicksToUpdate > 0) { + if(cpuDmaTicksToUpdate > cpuNextEvent) + clockTicks = cpuNextEvent; + else + clockTicks = cpuDmaTicksToUpdate; + cpuDmaTicksToUpdate -= clockTicks; + if(cpuDmaTicksToUpdate < 0) + cpuDmaTicksToUpdate = 0; + cpuDmaHack = true; + goto updateLoop; + } + + if(linkenable && cpuDmaHack2) + cpuNextEvent = 1; + + if(IF && (IME & 1) && armIrqEnable) { + int res = IF & IE; + if(stopState) + res &= 0x3080; + if(res) { + if (intState) + { + if (!IRQTicks) + { + CPUInterrupt(); + intState = false; + holdState = false; + stopState = false; + holdType = 0; + } + } + else + { + if (!holdState) + { + intState = true; + IRQTicks=7; + if (cpuNextEvent> IRQTicks) + cpuNextEvent = IRQTicks; + } + else + { + CPUInterrupt(); + holdState = false; + stopState = false; + holdType = 0; + } + } + + // Stops the SWI Ticks emulation if an IRQ is executed + //(to avoid problems with nested IRQ/SWI) + if (SWITicks) + SWITicks = 0; + } + } + + if(remainingTicks > 0) { + if(remainingTicks > cpuNextEvent) + clockTicks = cpuNextEvent; + else + clockTicks = remainingTicks; + remainingTicks -= clockTicks; + if(remainingTicks < 0) + remainingTicks = 0; + goto updateLoop; + } + + if (timerOnOffDelay) + applyTimer(); + + if(cpuNextEvent > ticks) + cpuNextEvent = ticks; + + if(ticks <= 0 || cpuBreakLoop) + break; + + } + } +} + + + +struct EmulatedSystem GBASystem = { + // emuMain + CPULoop, + // emuReset + CPUReset, + // emuCleanUp + CPUCleanUp, + // emuReadBattery + CPUReadBatteryFile, + // emuWriteBattery + CPUWriteBatteryFile, + // emuReadState + CPUReadState, + // emuWriteState + CPUWriteState, + // emuReadMemState + CPUReadMemState, + // emuWriteMemState + CPUWriteMemState, + // emuWritePNG + CPUWritePNGFile, + // emuWriteBMP + CPUWriteBMPFile, + // emuUpdateCPSR + CPUUpdateCPSR, + // emuHasDebugger + true, + // emuCount +#ifdef FINAL_VERSION + 250000 +#else + 5000 +#endif +}; diff --git a/src/GBAinline.h b/src/GBAinline.h index 07bf765f..ded35c6c 100644 --- a/src/GBAinline.h +++ b/src/GBAinline.h @@ -1,498 +1,498 @@ -// -*- 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. - -#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; -extern int lspeed; -extern bool linkenable; -extern void LinkSStop(void); -extern bool cpuDmaHack; -extern bool cpuDmaHack2; -extern u32 cpuDmaLast; -extern bool timer0On; -extern int timer0Ticks; -extern int timer0ClockReload; -extern bool timer1On; -extern int timer1Ticks; -extern int timer1ClockReload; -extern bool timer2On; -extern int timer2Ticks; -extern int timer2ClockReload; -extern bool timer3On; -extern int timer3Ticks; -extern int timer3ClockReload; -extern int cpuTotalTicks; - -#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])) - -static 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(linkenable && (address>=0x4000120||address<=0x4000126)&&lspeed) - LinkSStop(); - 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: - address = (address & 0x1fffc); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - { - value = 0; - break; - } - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; - value = READ32LE(((u32 *)&vram[address])); - 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(cpuDmaHack || cpuDmaHack2) { - value = cpuDmaLast; - } else { - if(armState) { - value = CPUReadMemoryQuick(reg[15].I); - } else { - value = CPUReadHalfWordQuick(reg[15].I) | - CPUReadHalfWordQuick(reg[15].I) << 16; - } - } - } - - 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[]; - -static 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(linkenable && (address>=0x4000120||address<=0x4000126)&&lspeed) - LinkSStop(); - if((address < 0x4000400) && ioReadable[address & 0x3fe]) - { - value = READ16LE(((u16 *)&ioMem[address & 0x3fe])); - if (((address & 0x3fe)>0xFF) && ((address & 0x3fe)<0x10E)) - { - if (((address & 0x3fe) == 0x100) && timer0On) - value = 0xFFFF - ((timer0Ticks-cpuTotalTicks) >> timer0ClockReload); - else - if (((address & 0x3fe) == 0x104) && timer1On && !(TM1CNT & 4)) - value = 0xFFFF - ((timer1Ticks-cpuTotalTicks) >> timer1ClockReload); - else - if (((address & 0x3fe) == 0x108) && timer2On && !(TM2CNT & 4)) - value = 0xFFFF - ((timer2Ticks-cpuTotalTicks) >> timer2ClockReload); - else - if (((address & 0x3fe) == 0x10C) && timer3On && !(TM3CNT & 4)) - value = 0xFFFF - ((timer3Ticks-cpuTotalTicks) >> timer3ClockReload); - } - } - else goto unreadable; - break; - case 5: - value = READ16LE(((u16 *)&paletteRAM[address & 0x3fe])); - break; - case 6: - address = (address & 0x1fffe); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - { - value = 0; - break; - } - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; - value = READ16LE(((u16 *)&vram[address])); - 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 - if(cpuDmaHack2 || cpuDmaHack) { - value = cpuDmaLast & 0xFFFF; - } else { - if(armState) { - value = CPUReadHalfWordQuick(reg[15].I + (address & 2)); - } else { - value = CPUReadHalfWordQuick(reg[15].I); - } - } - break; - } - - if(address & 1) { - value = (value >> 8) | (value << 24); - } - - return value; -} - -static inline u16 CPUReadHalfWordSigned(u32 address) -{ - u16 value = CPUReadHalfWord(address); - if((address & 1)) - value = (s8)value; - return value; -} - -static 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(linkenable&&(address>=0x4000120||address<=0x4000126)&&lspeed) - LinkSStop(); - if((address < 0x4000400) && ioReadable[address & 0x3ff]) - return ioMem[address & 0x3ff]; - else goto unreadable; - case 5: - return paletteRAM[address & 0x3ff]; - case 6: - address = (address & 0x1ffff); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - return 0; - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; - return vram[address]; - 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(cpuDmaHack || cpuDmaHack2) { - return cpuDmaLast & 0xFF; - } else { - if(armState) { - return CPUReadByteQuick(reg[15].I+(address & 3)); - } else { - return CPUReadByteQuick(reg[15].I+(address & 1)); - } - } - break; - } -} - -static inline void CPUWriteMemory(u32 address, u32 value) -{ - -#ifdef DEV_VERSION - if(address & 3) { - if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { - log("Unaligned word write: %08x to %08x from %08x\n", - value, - address, - armMode ? armNextPC - 4 : armNextPC - 2); - } - } -#endif - - switch(address >> 24) { - case 0x02: -#ifdef BKPT_SUPPORT - if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC])) - cheatsWriteMemory(address & 0x203FFFC, - value); - else -#endif - WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value); - break; - case 0x03: -#ifdef BKPT_SUPPORT - if(*((u32 *)&freezeInternalRAM[address & 0x7ffc])) - cheatsWriteMemory(address & 0x3007FFC, - value); - else -#endif - WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value); - break; - case 0x04: - if(address < 0x4000400) { - CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); - CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16)); - } else goto unwritable; - break; - case 0x05: -#ifdef BKPT_SUPPORT - if(*((u32 *)&freezePRAM[address & 0x3fc])) - cheatsWriteMemory(address & 0x70003FC, - value); - else -#endif - WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value); - break; - case 0x06: - address = (address & 0x1fffc); - if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) - return; - if ((address & 0x18000) == 0x18000) - address &= 0x17fff; - -#ifdef BKPT_SUPPORT - if(*((u32 *)&freezeVRAM[address])) - cheatsWriteMemory(address + 0x06000000, value); - else -#endif - - WRITE32LE(((u32 *)&vram[address]), value); - break; - case 0x07: -#ifdef BKPT_SUPPORT - if(*((u32 *)&freezeOAM[address & 0x3fc])) - cheatsWriteMemory(address & 0x70003FC, - value); - else -#endif - 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 +// -*- 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. + +#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; +extern int lspeed; +extern bool linkenable; +extern void LinkSStop(void); +extern bool cpuDmaHack; +extern bool cpuDmaHack2; +extern u32 cpuDmaLast; +extern bool timer0On; +extern int timer0Ticks; +extern int timer0ClockReload; +extern bool timer1On; +extern int timer1Ticks; +extern int timer1ClockReload; +extern bool timer2On; +extern int timer2Ticks; +extern int timer2ClockReload; +extern bool timer3On; +extern int timer3Ticks; +extern int timer3ClockReload; +extern int cpuTotalTicks; + +#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])) + +static 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(linkenable && (address>=0x4000120||address<=0x4000126)&&lspeed) + LinkSStop(); + 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: + address = (address & 0x1fffc); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + { + value = 0; + break; + } + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; + value = READ32LE(((u32 *)&vram[address])); + 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(cpuDmaHack || cpuDmaHack2) { + value = cpuDmaLast; + } else { + if(armState) { + value = CPUReadMemoryQuick(reg[15].I); + } else { + value = CPUReadHalfWordQuick(reg[15].I) | + CPUReadHalfWordQuick(reg[15].I) << 16; + } + } + } + + 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[]; + +static 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(linkenable && (address>=0x4000120||address<=0x4000126)&&lspeed) + LinkSStop(); + if((address < 0x4000400) && ioReadable[address & 0x3fe]) + { + value = READ16LE(((u16 *)&ioMem[address & 0x3fe])); + if (((address & 0x3fe)>0xFF) && ((address & 0x3fe)<0x10E)) + { + if (((address & 0x3fe) == 0x100) && timer0On) + value = 0xFFFF - ((timer0Ticks-cpuTotalTicks) >> timer0ClockReload); + else + if (((address & 0x3fe) == 0x104) && timer1On && !(TM1CNT & 4)) + value = 0xFFFF - ((timer1Ticks-cpuTotalTicks) >> timer1ClockReload); + else + if (((address & 0x3fe) == 0x108) && timer2On && !(TM2CNT & 4)) + value = 0xFFFF - ((timer2Ticks-cpuTotalTicks) >> timer2ClockReload); + else + if (((address & 0x3fe) == 0x10C) && timer3On && !(TM3CNT & 4)) + value = 0xFFFF - ((timer3Ticks-cpuTotalTicks) >> timer3ClockReload); + } + } + else goto unreadable; + break; + case 5: + value = READ16LE(((u16 *)&paletteRAM[address & 0x3fe])); + break; + case 6: + address = (address & 0x1fffe); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + { + value = 0; + break; + } + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; + value = READ16LE(((u16 *)&vram[address])); + 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 + if(cpuDmaHack2 || cpuDmaHack) { + value = cpuDmaLast & 0xFFFF; + } else { + if(armState) { + value = CPUReadHalfWordQuick(reg[15].I + (address & 2)); + } else { + value = CPUReadHalfWordQuick(reg[15].I); + } + } + break; + } + + if(address & 1) { + value = (value >> 8) | (value << 24); + } + + return value; +} + +static inline u16 CPUReadHalfWordSigned(u32 address) +{ + u16 value = CPUReadHalfWord(address); + if((address & 1)) + value = (s8)value; + return value; +} + +static 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(linkenable&&(address>=0x4000120||address<=0x4000126)&&lspeed) + LinkSStop(); + if((address < 0x4000400) && ioReadable[address & 0x3ff]) + return ioMem[address & 0x3ff]; + else goto unreadable; + case 5: + return paletteRAM[address & 0x3ff]; + case 6: + address = (address & 0x1ffff); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + return 0; + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; + return vram[address]; + 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(cpuDmaHack || cpuDmaHack2) { + return cpuDmaLast & 0xFF; + } else { + if(armState) { + return CPUReadByteQuick(reg[15].I+(address & 3)); + } else { + return CPUReadByteQuick(reg[15].I+(address & 1)); + } + } + break; + } +} + +static inline void CPUWriteMemory(u32 address, u32 value) +{ + +#ifdef DEV_VERSION + if(address & 3) { + if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { + log("Unaligned word write: %08x to %08x from %08x\n", + value, + address, + armMode ? armNextPC - 4 : armNextPC - 2); + } + } +#endif + + switch(address >> 24) { + case 0x02: +#ifdef BKPT_SUPPORT + if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC])) + cheatsWriteMemory(address & 0x203FFFC, + value); + else +#endif + WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value); + break; + case 0x03: +#ifdef BKPT_SUPPORT + if(*((u32 *)&freezeInternalRAM[address & 0x7ffc])) + cheatsWriteMemory(address & 0x3007FFC, + value); + else +#endif + WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value); + break; + case 0x04: + if(address < 0x4000400) { + CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); + CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16)); + } else goto unwritable; + break; + case 0x05: +#ifdef BKPT_SUPPORT + if(*((u32 *)&freezePRAM[address & 0x3fc])) + cheatsWriteMemory(address & 0x70003FC, + value); + else +#endif + WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value); + break; + case 0x06: + address = (address & 0x1fffc); + if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000)) + return; + if ((address & 0x18000) == 0x18000) + address &= 0x17fff; + +#ifdef BKPT_SUPPORT + if(*((u32 *)&freezeVRAM[address])) + cheatsWriteMemory(address + 0x06000000, value); + else +#endif + + WRITE32LE(((u32 *)&vram[address]), value); + break; + case 0x07: +#ifdef BKPT_SUPPORT + if(*((u32 *)&freezeOAM[address & 0x3fc])) + cheatsWriteMemory(address & 0x70003FC, + value); + else +#endif + 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.h b/src/Gfx.h index 2e9625bc..20c2f054 100644 --- a/src/Gfx.h +++ b/src/Gfx.h @@ -148,7 +148,7 @@ static inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, int maskX = sizeX-1; int maskY = sizeY-1; - + bool mosaicOn = (control & 0x40) ? true : false; int xxx = hofs & maskX; @@ -169,26 +169,26 @@ static inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, 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++; @@ -212,7 +212,7 @@ static inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, yshift; for(int x = 0; x < 240; x++) { u16 data = READ16LE(screenSource); - + int tile = data & 0x3FF; int tileX = (xxx & 7); int tileY = yyy & 7; @@ -229,7 +229,7 @@ static inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, } else { color &= 0x0F; } - + int pal = (READ16LE(screenSource)>>8) & 0xF0; line[x] = color ? (READ16LE(&palette[pal + color])|prio): 0x80000000; @@ -267,7 +267,7 @@ static inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs, } } -static inline void gfxDrawRotScreen(u16 control, +static inline void gfxDrawRotScreen(u16 control, u16 x_l, u16 x_h, u16 y_l, u16 y_h, u16 pa, u16 pb, @@ -327,8 +327,8 @@ static inline void gfxDrawRotScreen(u16 control, currentY |= 0xF8000000; } else { currentY += dmy; - } - + } + int realX = currentX; int realY = currentY; @@ -338,10 +338,10 @@ static inline void gfxDrawRotScreen(u16 control, realX -= y*dmx; realY -= y*dmy; } - + int xxx = (realX >> 8); int yyy = (realY >> 8); - + if(control & 0x2000) { xxx %= sizeX; yyy %= sizeY; @@ -350,7 +350,7 @@ static inline void gfxDrawRotScreen(u16 control, if(yyy < 0) yyy += sizeY; } - + if(control & 0x80) { for(int x = 0; x < 240; x++) { if(xxx < 0 || @@ -360,20 +360,20 @@ static inline void gfxDrawRotScreen(u16 control, 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; @@ -392,20 +392,20 @@ static inline void gfxDrawRotScreen(u16 control, 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; @@ -414,10 +414,10 @@ static inline void gfxDrawRotScreen(u16 control, if(yyy < 0) yyy += sizeY; } - } + } } - if(control & 0x40) { + if(control & 0x40) { int mosaicX = (MOSAIC & 0xF) + 1; if(mosaicX > 1) { int m = 1; @@ -430,7 +430,7 @@ static inline void gfxDrawRotScreen(u16 control, } } } - } + } } static inline void gfxDrawRotScreen16Bit(u16 control, @@ -446,7 +446,7 @@ static inline void gfxDrawRotScreen16Bit(u16 control, 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; @@ -469,7 +469,7 @@ static inline void gfxDrawRotScreen16Bit(u16 control, if(VCOUNT == 0) changed = 3; - + if(changed & 1) { currentX = (x_l) | ((x_h & 0x07FF)<<16); if(x_h & 0x0800) @@ -483,8 +483,8 @@ static inline void gfxDrawRotScreen16Bit(u16 control, currentY |= 0xF8000000; } else { currentY += dmy; - } - + } + int realX = currentX; int realY = currentY; @@ -494,10 +494,10 @@ static inline void gfxDrawRotScreen16Bit(u16 control, 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 || @@ -509,12 +509,12 @@ static inline void gfxDrawRotScreen16Bit(u16 control, } realX += dx; realY += dy; - + xxx = (realX >> 8); yyy = (realY >> 8); } - if(control & 0x40) { + if(control & 0x40) { int mosaicX = (MOSAIC & 0xF) + 1; if(mosaicX > 1) { int m = 1; @@ -527,10 +527,10 @@ static inline void gfxDrawRotScreen16Bit(u16 control, } } } - } + } } -static inline void gfxDrawRotScreen256(u16 control, +static inline void gfxDrawRotScreen256(u16 control, u16 x_l, u16 x_h, u16 y_l, u16 y_h, u16 pa, u16 pb, @@ -544,7 +544,7 @@ static inline void gfxDrawRotScreen256(u16 control, 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; @@ -582,8 +582,8 @@ static inline void gfxDrawRotScreen256(u16 control, currentY |= 0xF8000000; } else { currentY += dmy; - } - + } + int realX = currentX; int realY = currentY; @@ -593,10 +593,10 @@ static inline void gfxDrawRotScreen256(u16 control, 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 || @@ -605,17 +605,17 @@ static inline void gfxDrawRotScreen256(u16 control, 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) { + if(control & 0x40) { int mosaicX = (MOSAIC & 0xF) + 1; if(mosaicX > 1) { int m = 1; @@ -628,7 +628,7 @@ static inline void gfxDrawRotScreen256(u16 control, } } } - } + } } static inline void gfxDrawRotScreen16Bit160(u16 control, @@ -645,7 +645,7 @@ static inline void gfxDrawRotScreen16Bit160(u16 control, 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; @@ -683,8 +683,8 @@ static inline void gfxDrawRotScreen16Bit160(u16 control, currentY |= 0xF8000000; } else { currentY += dmy; - } - + } + int realX = currentX; int realY = currentY; @@ -694,10 +694,10 @@ static inline void gfxDrawRotScreen16Bit160(u16 control, 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 || @@ -709,12 +709,12 @@ static inline void gfxDrawRotScreen16Bit160(u16 control, } realX += dx; realY += dy; - + xxx = (realX >> 8); yyy = (realY >> 8); } - if(control & 0x40) { + if(control & 0x40) { int mosaicX = (MOSAIC & 0xF) + 1; if(mosaicX > 1) { int m = 1; @@ -727,7 +727,7 @@ static inline void gfxDrawRotScreen16Bit160(u16 control, } } } - } + } } static inline void gfxDrawSprites(u32 *lineOBJ) @@ -742,7 +742,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) u16 *sprites = (u16 *)oam; u16 *spritePalette = &((u16 *)paletteRAM)[256]; int mosaicY = ((MOSAIC & 0xF000)>>12) + 1; - int mosaicX = ((MOSAIC & 0xF00)>>8) + 1; + int mosaicX = ((MOSAIC & 0xF00)>>8) + 1; for(int x = 0; x < 128 ; x++) { u16 a0 = READ16LE(sprites++); u16 a1 = READ16LE(sprites++); @@ -763,7 +763,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) a0 &= 0x3FFF; a1 &= 0x3FFF; } - + int sizeX = 8<<(a1>>14); int sizeY = sizeX; @@ -827,7 +827,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) continue; - + if(a0 & 0x0100) { int fieldX = sizeX; int fieldY = sizeY; @@ -846,7 +846,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) } if (lineOBJpix>0) if((sx < 240) || startpix) { - lineOBJpix-=8; + lineOBJpix-=8; // int t2 = t - (fieldY >> 1); int rot = (a1 >> 9) & 0x1F; u16 *OAM = (u16 *)oam; @@ -862,7 +862,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) int dmy = READ16LE(&OAM[15 + (rot << 4)]); if(dmy & 0x8000) dmy |= 0xFFFF8000; - + if(a0 & 0x1000) { t -= (t % mosaicY); } @@ -873,7 +873,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) + t * dmy; u32 prio = (((a2 >> 10) & 3) << 25) | ((a0 & 0x0c00)<<6); - + if(a0 & 0x2000) { int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) @@ -890,7 +890,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) continue; int xxx = realX >> 8; int yyy = realY >> 8; - + if(xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240); @@ -898,7 +898,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) u32 color = vram[0x10000 + ((((c + (yyy>>3) * inc)<<5) + ((yyy & 7)<<3) + ((xxx >> 3)<<6) + (xxx & 7))&0x7FFF)]; - if ((color==0) && (((prio >> 25)&3) < + if ((color==0) && (((prio >> 25)&3) < ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; if((a0 & 0x1000) && m) @@ -927,7 +927,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) continue; - + int inc = 32; if(DISPCNT & 0x40) inc = sizeX >> 3; @@ -950,8 +950,8 @@ static inline void gfxDrawSprites(u32 *lineOBJ) color >>= 4; else color &= 0x0F; - - if ((color==0) && (((prio >> 25)&3) < + + if ((color==0) && (((prio >> 25)&3) < ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; if((a0 & 0x1000) && m) @@ -975,8 +975,8 @@ static inline void gfxDrawSprites(u32 *lineOBJ) sx = (sx+1)&511; realX += dx; realY += dy; - - } + + } } } } @@ -998,7 +998,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) continue; - + int inc = 32; if(DISPCNT & 0x40) { inc = sizeX >> 2; @@ -1015,11 +1015,11 @@ static inline void gfxDrawSprites(u32 *lineOBJ) 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 (xx >= startpix) lineOBJpix--; @@ -1027,7 +1027,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) continue; if(sx < 240) { u8 color = vram[address]; - if ((color==0) && (((prio >> 25)&3) < + if ((color==0) && (((prio >> 25)&3) < ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; if((a0 & 0x1000) && m) @@ -1049,7 +1049,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) lineOBJ[sx] = 0x001F; #endif } - + sx = (sx+1) & 511; if(a1 & 0x1000) { xxx--; @@ -1077,7 +1077,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) continue; - + int inc = 32; if(DISPCNT & 0x40) { inc = sizeX >> 3; @@ -1085,7 +1085,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) int xxx = 0; if(a1 & 0x1000) xxx = sizeX - 1; - + if(a0 & 0x1000) { t -= (t % mosaicY); } @@ -1093,7 +1093,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) 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; + int palette = (a2 >> 8) & 0xF0; if(a1 & 0x1000) { xxx = 7; for(int xx = sizeX - 1; xx >= 0; xx--) { @@ -1107,8 +1107,8 @@ static inline void gfxDrawSprites(u32 *lineOBJ) color = (color >> 4); } else color &= 0x0F; - - if ((color==0) && (((prio >> 25)&3) < + + if ((color==0) && (((prio >> 25)&3) < ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; if((a0 & 0x1000) && m) @@ -1138,8 +1138,8 @@ static inline void gfxDrawSprites(u32 *lineOBJ) } if(address < 0x10000) address += 0x8000; - } - } else { + } + } else { for(int xx = 0; xx < sizeX; xx++) { if (xx >= startpix) lineOBJpix--; @@ -1151,8 +1151,8 @@ static inline void gfxDrawSprites(u32 *lineOBJ) color = (color >> 4); } else color &= 0x0F; - - if ((color==0) && (((prio >> 25)&3) < + + if ((color==0) && (((prio >> 25)&3) < ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; if((a0 & 0x1000) && m) @@ -1183,7 +1183,7 @@ static inline void gfxDrawSprites(u32 *lineOBJ) } if(address > 0x17fff) address -= 0x8000; - } + } } } } @@ -1215,13 +1215,13 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) if ((a0 & 0x0c00) == 0x0c00) a0 &=0xF3FF; - + if ((a0>>14) == 3) { a0 &= 0x3FFF; a1 &= 0x3FFF; } - + int sizeX = 8<<(a1>>14); int sizeY = sizeX; @@ -1241,7 +1241,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) } int sy = (a0 & 255); - + if(a0 & 0x0100) { int fieldX = sizeX; int fieldY = sizeY; @@ -1276,14 +1276,14 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) 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)) @@ -1300,7 +1300,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) continue; int xxx = realX >> 8; int yyy = realY >> 8; - + if(xxx < 0 || xxx >= sizeX || yyy < 0 || yyy >= sizeY || sx >= 240) { @@ -1320,11 +1320,11 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) 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; + // int palette = (a2 >> 8) & 0xF0; for(int x = 0; x < fieldX; x++) { if (x >= startpix) lineOBJpix-=2; @@ -1348,7 +1348,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) color >>= 4; else color &= 0x0F; - + if(color) { lineOBJWin[sx] = 1; } @@ -1357,7 +1357,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) sx = (sx+1)&511; realX += dx; realY += dy; - } + } } } } @@ -1380,7 +1380,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) continue; - + int inc = 32; if(DISPCNT & 0x40) { inc = sizeX >> 2; @@ -1406,7 +1406,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) lineOBJWin[sx] = 1; } } - + sx = (sx+1) & 511; if(a1 & 0x1000) { xxx--; @@ -1434,7 +1434,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) int c = (a2 & 0x3FF); if((DISPCNT & 7) > 2 && (c < 512)) continue; - + int inc = 32; if(DISPCNT & 0x40) { inc = sizeX >> 3; @@ -1445,7 +1445,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) 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; + // int palette = (a2 >> 8) & 0xF0; if(a1 & 0x1000) { xxx = 7; for(int xx = sizeX - 1; xx >= 0; xx--) { @@ -1459,7 +1459,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) color = (color >> 4); } else color &= 0x0F; - + if(color) { lineOBJWin[sx] = 1; } @@ -1474,8 +1474,8 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) } if(address < 0x10000) address += 0x8000; - } - } else { + } + } else { for(int xx = 0; xx < sizeX; xx++) { if (xx >= startpix) lineOBJpix--; @@ -1487,7 +1487,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) color = (color >> 4); } else color &= 0x0F; - + if(color) { lineOBJWin[sx] = 1; } @@ -1502,7 +1502,7 @@ static inline void gfxDrawOBJWin(u32 *lineOBJWin) } if(address > 0x17fff) address -= 0x8000; - } + } } } } @@ -1517,7 +1517,7 @@ static 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); @@ -1538,7 +1538,7 @@ static inline void gfxIncreaseBrightness(u32 *line, 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); @@ -1557,7 +1557,7 @@ static 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); @@ -1568,7 +1568,7 @@ static inline u32 gfxDecreaseBrightness(u32 color, int coeff) if(b < 0) b = 0; color = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; - + return color; } @@ -1579,7 +1579,7 @@ static inline void gfxDecreaseBrightness(u32 *line, 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); @@ -1602,7 +1602,7 @@ static inline u32 gfxAlphaBlend(u32 color, u32 color2, int ca, int cb) int r0 = (color2 & 0x1F); int g0 = ((color2 >> 5) & 0x1F); int b0 = ((color2 >> 10) & 0x1F); - + r = ((r * ca) + (r0 * cb)) >> 4; g = ((g * ca) + (g0 * cb)) >> 4; b = ((b * ca) + (b0 * cb)) >> 4; @@ -1631,18 +1631,18 @@ static inline void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb) int r0 = (color2 & 0x1F); int g0 = ((color2 >> 5) & 0x1F); int b0 = ((color2 >> 10) & 0x1F); - + r = ((r * ca) + (r0 * cb)) >> 4; g = ((g * ca) + (g0 * cb)) >> 4; b = ((b * ca) + (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++; diff --git a/src/Link.cpp b/src/Link.cpp index b492cbbc..436e4bbe 100644 --- a/src/Link.cpp +++ b/src/Link.cpp @@ -1,1083 +1,1083 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team -// This file was written by denopqrihg - -// 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. - -// Link.cpp : Emulation of GBA link accessories -// - -#include "GBA.h" -#include -#include "win32/stdafx.h" -#include "port.h" -#include "Link.h" -#include "win32/vba.h" -#include "win32/MainWnd.h" -#include "win32/LinkOptions.h" -#include "win32/Reg.h" - -#define UPDATE_REG(address, value) WRITE16LE(((u16 *)&ioMem[address]),value) -#define GBLINK_READY 8 - -int linktime = 0; -u8 tspeed=3; -u8 transfer=0; -LINKDATA *linkmem=NULL; -int linkid = 0, vbaid = 0; -HANDLE linksync[4]; -int savedlinktime=0; -HANDLE mmf=NULL; -char linkevent[] = "VBA link event "; -static int i, j; -int linktimeout = 1000; -int linklog = 0; -FILE *linklogfile = NULL; -LANLINKDATA lanlink; -u16 linkdata[4]; -int lspeed = 0; -lserver ls; -lclient lc; -bool oncewait = false, after = false; -bool adapter = false; -bool linkenable = false; -u8 rfu_cmd, rfu_qsend, rfu_qrecv; -int rfu_state, rfu_polarity, linktime2, counter, rfu_masterq; -int transferend, numtransfers = 0; -u32 rfu_masterdata[32]; - -extern unsigned char *gbMemory; -extern int gbInterrupt; - -int trtimedata[4][4] = {{34080, 8520, 5680, 2840}, {65536, 16384, 10923, 5461}, {99609, 24903, 16602, 8301}, {133692, 33423, 22282, 11141}}; -int trtimeend[3][4] = {{72527, 18132, 12088, 6044}, {106608, 26652, 17768, 8884}, {133692, 33423, 22282, 11141}}; -int gbtime = 1024; - -DWORD WINAPI LinkClientThread(void *); -DWORD WINAPI LinkServerThread(void *); -int StartServer(void); -int GetSioMode(u16, u16); -u16 StartRFU(u16); - -char *MakeInstanceFilename(const char *Input) -{ - if (vbaid == 0) - return (char *)Input; - - static char *result=NULL; - if (result!=NULL) - free(result); - - result = (char *)malloc(strlen(Input)+3); - char *p = strrchr((char *)Input, '.'); - sprintf(result, "%.*s-%d.%s", (int)(p-Input), Input, vbaid+1, p+1); - return result; -} - - -void StartLink(WORD value){ - if(ioMem==NULL) return; - if(adapter){ - UPDATE_REG(0x128, StartRFU(value)); - return; - } - switch(GetSioMode(value, READ16LE(&ioMem[0x134]))){ - case MULTIPLAYER: - if(value & 0x80){ - if(!linkid){ - if(!transfer){ - if(lanlink.active){ - if(lanlink.connected){ - linkdata[0] = READ16LE(&ioMem[0x12a]); - savedlinktime = linktime; - tspeed = value & 3; - ls.Send(); - transfer = 1; - linktime = 0; - UPDATE_REG(0x120, linkdata[0]); - UPDATE_REG(0x122, 0xffff); - WRITE32LE(&ioMem[0x124], 0xffffffff); - if(lanlink.speed&&oncewait==false) ls.howmanytimes++; - after = false; - } - } else if(linkmem->numgbas>1){ - ResetEvent(linksync[0]); - linkmem->linkcmd[0] = ('M'<<8)+(value&3); - linkmem->linkdata[0] = READ16LE(&ioMem[0x12a]); - if(linkmem->numtransfers!=0) linkmem->lastlinktime = linktime; - else linkmem->lastlinktime = 0; - if((++linkmem->numtransfers)==0) linkmem->numtransfers=2; - transfer = 1; - linktime = 0; - tspeed = value & 3; - WRITE32LE(&ioMem[0x120], 0xffffffff); - WRITE32LE(&ioMem[0x124], 0xffffffff); - } - } - } - value &= 0xff7f; - value |= (transfer!=0)<<7; - } - value &= 0xff8b; - value |= (linkid ? 0xc : 8); - value |= linkid<<4; - UPDATE_REG(0x128, value); - if(linkid) UPDATE_REG(0x134, 7); - else UPDATE_REG(0x134, 3); - break; - case NORMAL8: - if(linklog) fprintf(linklogfile, "Attempt to use 8-bit Normal mode %04x\n", value); - UPDATE_REG(0x128, value); - break; - case NORMAL32: - if(linklog) fprintf(linklogfile, "Attempt to use 32-bit Normal mode %04x %x%x\n", value, READ16LE(&ioMem[0x122]), READ16LE(&ioMem[0x120])); - UPDATE_REG(0x128, value); - break; - case UART: - if(linklog) fprintf(linklogfile, "Attempt to use UART mode %04x\n", value); - UPDATE_REG(0x128, value); - break; - default: - UPDATE_REG(0x128, value); - break; - } -} - -void StartGPLink(u16 value){ - if(!value){ - UPDATE_REG(0x134, 0); - return; - } - switch(GetSioMode(READ16LE(&ioMem[0x128]), value)){ - case MULTIPLAYER: - value &= 0xc0f0; - value |= 3; - if(linkid) value |= 4; - UPDATE_REG(0x134, value); - UPDATE_REG(0x128, ((READ16LE(&ioMem[0x128])&0xff8b)|(linkid ? 0xc : 8)|(linkid<<4))); - return; - break; - case GP: - if(linklog){ - if(value==0x8000) fprintf(linklogfile, "Circuit reset\n"); - else if(!adapter) fprintf(linklogfile, "Attempt to use General-purpose mode %04x\n", value); - } - if(adapter) rfu_state = RFU_INIT; - // This was not there, but sonic games won't start if it's not here. - UPDATE_REG(0x134, value); - break; - case JOYBUS: - UPDATE_REG(0x134, value); - break; - default: - UPDATE_REG(0x134, value); - break; - } - return; -} - -void StartJOYLink(u16 value){ - if(!value){ - UPDATE_REG(0x140, 0); - return; - } - if(GetSioMode(READ16LE(&ioMem[0x128]), READ16LE(&ioMem[0x134]))==JOYBUS&&linklog) fprintf(linklogfile, "Attempt to use JOY-BUS mode %04x\n", value); - return; -} - -void LinkUpdate(int ticks){ - linktime += ticks; - if(adapter){ - linktime2 += ticks; - transferend -= ticks; - if(transfer&&transferend<=0){ - transfer = 0; - if(READ16LE(&ioMem[0x128])&0x4000){ - IF |= 0x80; - UPDATE_REG(0x202, IF); - } - UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) & 0xff7f); - } - return; - } - - if(lanlink.active){ - if(lanlink.connected){ - if(after){ - if(linkid&&linktime>6044){ - lc.Recv(); - oncewait = true; - } else return; - } - if(linkid&&!transfer&&lc.numtransfers>0&&linktime>=savedlinktime){ - linkdata[linkid] = READ16LE(&ioMem[0x12a]); - if(!lc.oncesend) lc.Send(); - lc.oncesend = false; - UPDATE_REG(0x120, linkdata[0]); - UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) | 0x80); - transfer = 1; - if(lc.numtransfers==1) linktime = 0; - else linktime -= savedlinktime; - } - if(transfer&&linktime>=trtimeend[lanlink.numgbas-1][tspeed]){ - if(READ16LE(&ioMem[0x128]) & 0x4000){ - IF |= 0x80; - UPDATE_REG(0x202, IF); - } - UPDATE_REG(0x128, (READ16LE(&ioMem[0x128]) & 0xff0f) | (linkid << 4)); - transfer = 0; - linktime -= trtimeend[lanlink.numgbas-1][tspeed]; - oncewait = false; - if(!lanlink.speed){ - if(linkid) lc.Recv(); - else ls.Recv(); - UPDATE_REG(0x122, linkdata[1]); - UPDATE_REG(0x124, linkdata[2]); - UPDATE_REG(0x126, linkdata[3]); - if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", linkdata[0], linkdata[1], linkdata[2], linkdata[3], savedlinktime); - oncewait = true; - } else { - after = true; - if(lanlink.numgbas==1){ - UPDATE_REG(0x122, linkdata[1]); - UPDATE_REG(0x124, linkdata[2]); - UPDATE_REG(0x126, linkdata[3]); - if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", linkdata[0], linkdata[1], linkdata[2], linkdata[3], savedlinktime); - } - - } - } - } - return; - } - // ** CRASH ** linkmem is NULL, todo investigate why, added null check - if(linkid&&!transfer&&linkmem&&linktime>=linkmem->lastlinktime&&linkmem->numtransfers){ - linkmem->linkdata[linkid] = READ16LE(&ioMem[0x12a]); - - if(linkmem->numtransfers==1){ - linktime = 0; - if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) linkmem->numtransfers=0; - } else linktime -= linkmem->lastlinktime; - - switch((linkmem->linkcmd[0])>>8){ - case 'M': - tspeed = (linkmem->linkcmd[0]) & 3; - transfer = 1; - WRITE32LE(&ioMem[0x120], 0xffffffff); - WRITE32LE(&ioMem[0x124], 0xffffffff); - UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) | 0x80); - break; - } - } - - if(!transfer) return; - - if(transfer&&linktime>=trtimedata[transfer-1][tspeed]&&transfer<=linkmem->numgbas){ - if(transfer-linkid==2){ - SetEvent(linksync[linkid+1]); - if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) - linkmem->numtransfers=0; - ResetEvent(linksync[linkid]); - if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", - linkmem->linkdata[0], linkmem->linkdata[1], linkmem->linkdata[2], linkmem->linkdata[3], linkmem->lastlinktime); - } - - - UPDATE_REG(0x11e + (transfer<<1), linkmem->linkdata[transfer-1]); - transfer++; - } - - if(transfer&&linktime>=trtimeend[linkmem->numgbas-2][tspeed]){ - if(linkid==linkmem->numgbas-1){ - SetEvent(linksync[0]); - if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) - linkmem->numtransfers=0; - ResetEvent(linksync[linkid]); - if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", - linkmem->linkdata[0], linkmem->linkdata[1], linkmem->linkdata[2], linkmem->linkdata[3], linkmem->lastlinktime); - } - transfer = 0; - linktime -= trtimeend[0][tspeed]; - if(READ16LE(&ioMem[0x128]) & 0x4000){ - IF |= 0x80; - UPDATE_REG(0x202, IF); - } - UPDATE_REG(0x128, (READ16LE(&ioMem[0x128]) & 0xff0f) | (linkid << 4)); - linkmem->linkdata[linkid] = 0xffff; - } - - return; -} - -inline int GetSioMode(u16 reg1, u16 reg2){ - if(!(reg2&0x8000)){ - switch(reg1&0x3000){ - case 0x0000: - return NORMAL8; - case 0x1000: - return NORMAL32; - case 0x2000: - return MULTIPLAYER; - case 0x3000: - return UART; - } - } - if(reg2&0x4000) return JOYBUS; - return GP; -} - -u16 StartRFU(u16 value){ - switch(GetSioMode(value, READ16LE(&ioMem[0x134]))){ - case NORMAL8: - rfu_polarity = 0; - return value; - break; - case NORMAL32: - if(value&8) value &= 0xfffb; // A kind of acknowledge procedure - else value |= 4; - if(value&0x80){ - if((value&3)==1) transferend = 2048; - else transferend = 256; - u16 a = READ16LE(&ioMem[0x122]); - switch(rfu_state){ - case RFU_INIT: - if(READ32LE(&ioMem[0x120])==0xb0bb8001){ - rfu_state = RFU_COMM; // end of startup - } - UPDATE_REG(0x122, READ16LE(&ioMem[0x120])); - UPDATE_REG(0x120, a); - break; - case RFU_COMM: - if(a==0x9966){ - rfu_cmd = ioMem[0x120]; - if((rfu_qsend=ioMem[0x121])!=0){ - rfu_state = RFU_SEND; - counter = 0; - } - if(rfu_cmd==0x25||rfu_cmd==0x24){ - linkmem->rfu_q[vbaid] = rfu_qsend; - } - UPDATE_REG(0x120, 0); - UPDATE_REG(0x122, 0x8000); - } else if(a==0x8000){ - switch(rfu_cmd){ - case 0x1a: // check if someone joined - if(linkmem->rfu_request[vbaid]!=0){ - rfu_state = RFU_RECV; - rfu_qrecv = 1; - } - linkid = -1; - rfu_cmd |= 0x80; - break; - case 0x1e: // receive broadcast data - case 0x1d: // no visible difference - rfu_polarity = 0; - rfu_state = RFU_RECV; - rfu_qrecv = 7; - counter = 0; - rfu_cmd |= 0x80; - break; - case 0x30: - linkmem->rfu_request[vbaid] = 0; - linkmem->rfu_q[vbaid] = 0; - linkid = 0; - numtransfers = 0; - rfu_cmd |= 0x80; - if(linkmem->numgbas==2) SetEvent(linksync[1-vbaid]); - break; - case 0x11: // ? always receives 0xff - I suspect it's something for 3+ players - case 0x13: // unknown - case 0x20: // this has something to do with 0x1f - case 0x21: // this too - rfu_cmd |= 0x80; - rfu_polarity = 0; - rfu_state = 3; - rfu_qrecv = 1; - break; - case 0x26: - if(linkid>0){ - rfu_qrecv = rfu_masterq; - } - if((rfu_qrecv=linkmem->rfu_q[1-vbaid])!=0){ - rfu_state = RFU_RECV; - counter = 0; - } - rfu_cmd |= 0x80; - break; - case 0x24: // send data - if((numtransfers++)==0) linktime = 1; - linkmem->rfu_linktime[vbaid] = linktime; - if(linkmem->numgbas==2){ - SetEvent(linksync[1-vbaid]); - WaitForSingleObject(linksync[vbaid], linktimeout); - ResetEvent(linksync[vbaid]); - } - rfu_cmd |= 0x80; - linktime = 0; - linkid = -1; - break; - case 0x25: // send & wait for data - case 0x1f: // pick a server - case 0x10: // init - case 0x16: // send broadcast data - case 0x17: // setup or something ? - case 0x27: // wait for data ? - case 0x3d: // init - default: - rfu_cmd |= 0x80; - break; - case 0xa5: // 2nd part of send&wait function 0x25 - case 0xa7: // 2nd part of wait function 0x27 - if(linkid==-1){ - linkid++; - linkmem->rfu_linktime[vbaid] = 0; - } - if(linkid&&linkmem->rfu_request[1-vbaid]==0){ - linkmem->rfu_q[1-vbaid] = 0; - transferend = 256; - rfu_polarity = 1; - rfu_cmd = 0x29; - linktime = 0; - break; - } - if((numtransfers++)==0) linktime = 0; - linkmem->rfu_linktime[vbaid] = linktime; - if(linkmem->numgbas==2){ - if(!linkid||(linkid&&numtransfers)) SetEvent(linksync[1-vbaid]); - WaitForSingleObject(linksync[vbaid], linktimeout); - ResetEvent(linksync[vbaid]); - } - if(linkid>0){ - memcpy(rfu_masterdata, linkmem->rfu_data[1-vbaid], 128); - rfu_masterq = linkmem->rfu_q[1-vbaid]; - } - transferend = linkmem->rfu_linktime[1-vbaid] - linktime + 256; - if(transferend<256) transferend = 256; - linktime = -transferend; - rfu_polarity = 1; - rfu_cmd = 0x28; - break; - } - UPDATE_REG(0x122, 0x9966); - UPDATE_REG(0x120, (rfu_qrecv<<8) | rfu_cmd); - } else { - UPDATE_REG(0x120, 0); - UPDATE_REG(0x122, 0x8000); - } - break; - case RFU_SEND: - if(--rfu_qsend==0) rfu_state = RFU_COMM; - switch(rfu_cmd){ - case 0x16: - linkmem->rfu_bdata[vbaid][counter++] = READ32LE(&ioMem[0x120]); - break; - case 0x17: - linkid = 1; - break; - case 0x1f: - linkmem->rfu_request[1-vbaid] = 1; - break; - case 0x24: - case 0x25: - linkmem->rfu_data[vbaid][counter++] = READ32LE(&ioMem[0x120]); - break; - } - UPDATE_REG(0x120, 0); - UPDATE_REG(0x122, 0x8000); - break; - case RFU_RECV: - if(--rfu_qrecv==0) rfu_state = RFU_COMM; - switch(rfu_cmd){ - case 0x9d: - case 0x9e: - if(counter==0){ - UPDATE_REG(0x120, 0x61f1); - UPDATE_REG(0x122, 0); - counter++; - break; - } - UPDATE_REG(0x120, linkmem->rfu_bdata[1-vbaid][counter-1]&0xffff); - UPDATE_REG(0x122, linkmem->rfu_bdata[1-vbaid][counter-1]>>16); - counter++; - break; - case 0xa6: - if(linkid>0){ - UPDATE_REG(0x120, rfu_masterdata[counter]&0xffff); - UPDATE_REG(0x122, rfu_masterdata[counter++]>>16); - } else { - UPDATE_REG(0x120, linkmem->rfu_data[1-vbaid][counter]&0xffff); - UPDATE_REG(0x122, linkmem->rfu_data[1-vbaid][counter++]>>16); - } - break; - case 0x93: // it seems like the game doesn't care about this value - UPDATE_REG(0x120, 0x1234); // put anything in here - UPDATE_REG(0x122, 0x0200); // also here, but it should be 0200 - break; - case 0xa0: - case 0xa1: - UPDATE_REG(0x120, 0x641b); - UPDATE_REG(0x122, 0x0000); - break; - case 0x9a: - UPDATE_REG(0x120, 0x61f9); - UPDATE_REG(0x122, 0); - break; - case 0x91: - UPDATE_REG(0x120, 0x00ff); - UPDATE_REG(0x122, 0x0000); - break; - default: - UPDATE_REG(0x120, 0x0173); - UPDATE_REG(0x122, 0x0000); - break; - } - break; - } - transfer = 1; - } - if(rfu_polarity) value ^= 4; // sometimes it's the other way around - default: - return value; - } -} - -void gbLinkStart(u8 value){ -// Not in this version :-) -} - - -void gbLinkUpdate(void){ -} - -int InitLink(void){ - WSADATA wsadata; - BOOL disable = true; - - linkid = 0; - - if(WSAStartup(MAKEWORD(1,1), &wsadata)!=0){ - WSACleanup(); - return 0; - } - - if((lanlink.tcpsocket=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET){ - MessageBox(NULL, "Couldn't create socket.", "Error!", MB_OK); - WSACleanup(); - return 0; - } - - setsockopt(lanlink.tcpsocket, IPPROTO_TCP, TCP_NODELAY, (char*)&disable, sizeof(BOOL)); - - if((mmf=CreateFileMapping((HANDLE)0xffffffff, NULL, PAGE_READWRITE, 0, sizeof(LINKDATA), "VBA link memory"))==NULL){ - closesocket(lanlink.tcpsocket); - WSACleanup(); - MessageBox(NULL, "Error creating file mapping", "Error", MB_OK|MB_ICONEXCLAMATION); - return 0; - } - - if(GetLastError() == ERROR_ALREADY_EXISTS) - vbaid = 1; - else - vbaid = 0; - - if((linkmem=(LINKDATA *)MapViewOfFile(mmf, FILE_MAP_WRITE, 0, 0, sizeof(LINKDATA)))==NULL){ - closesocket(lanlink.tcpsocket); - WSACleanup(); - CloseHandle(mmf); - MessageBox(NULL, "Error mapping file", "Error", MB_OK|MB_ICONEXCLAMATION); - return 0; - } - - if(linkmem->linkflags&LINK_PARENTLOST) - vbaid = 0; - - if(vbaid==0){ - linkid = 0; - if(linkmem->linkflags&LINK_PARENTLOST){ - linkmem->numgbas++; - linkmem->linkflags &= ~LINK_PARENTLOST; - } - else - linkmem->numgbas=1; - - for(i=0;i<4;i++){ - linkevent[15]=(char)i+'1'; - if((linksync[i]=CreateEvent(NULL, true, false, linkevent))==NULL){ - closesocket(lanlink.tcpsocket); - WSACleanup(); - UnmapViewOfFile(linkmem); - CloseHandle(mmf); - for(j=0;jnumgbas; - linkid = vbaid; - linkmem->numgbas++; - - linklog = 0; - if(linkmem->numgbas>4){ - linkmem->numgbas=4; - closesocket(lanlink.tcpsocket); - WSACleanup(); - MessageBox(NULL, "5 or more GBAs not supported.", "Error!", MB_OK|MB_ICONEXCLAMATION); - UnmapViewOfFile(linkmem); - CloseHandle(mmf); - return 0; - } - for(i=0;i<4;i++){ - linkevent[15]=(char)i+'1'; - if((linksync[i]=OpenEvent(EVENT_ALL_ACCESS, false, linkevent))==NULL){ - closesocket(lanlink.tcpsocket); - WSACleanup(); - CloseHandle(mmf); - UnmapViewOfFile(linkmem); - for(j=0;jlastlinktime=0xffffffff; - linkmem->numtransfers=0; - linkmem->linkflags=0; - lanlink.connected = false; - lanlink.thread = NULL; - lanlink.speed = false; - for(i=0;i<4;i++){ - linkmem->linkdata[i] = 0xffff; - linkdata[i] = 0xffff; - } -return 1; -} - -int openLinkLog(void){ - char filename[20]; - if(linklog){ - sprintf(filename, "vbalog%1d.txt", vbaid+1); - if((linklogfile=fopen(filename, "at"))==NULL){ - linklog=false; - return 0; - } - fprintf(linklogfile, "----- Log opened -----\n"); - } - return 1; -} - -void closeLinkLog() -{ - if(linklogfile) - { - fclose(linklogfile); - linklogfile=NULL; - } -} - -void CloseLink(void){ - if(lanlink.connected){ - if(linkid){ - char outbuffer[4]; - outbuffer[0] = 4; - outbuffer[1] = -32; - if(lanlink.type==0) send(lanlink.tcpsocket, outbuffer, 4, 0); - } else { - char outbuffer[12]; - int i; - outbuffer[0] = 12; - outbuffer[1] = -32; - for(i=1;i<=lanlink.numgbas;i++){ - if(lanlink.type==0){ - send(ls.tcpsocket[i], outbuffer, 12, 0); - } - closesocket(ls.tcpsocket[i]); - } - } - } - linkmem->numgbas--; - if(!linkid&&linkmem->numgbas!=0) - linkmem->linkflags|=LINK_PARENTLOST; - CloseHandle(mmf); - UnmapViewOfFile(linkmem); - - for(i=0;i<4;i++){ - if(linksync[i]!=NULL){ - PulseEvent(linksync[i]); - CloseHandle(linksync[i]); - } - } - regSetDwordValue("LAN", lanlink.active); - if(linklog) closeLinkLog(); - closesocket(lanlink.tcpsocket); - WSACleanup(); -return; -} - -lserver::lserver(void){ - intinbuffer = (int*)inbuffer; - u16inbuffer = (u16*)inbuffer; - intoutbuffer = (int*)outbuffer; - u16outbuffer = (u16*)outbuffer; - oncewait = false; -} - -int lserver::Init(void *serverdlg){ - SOCKADDR_IN info; - DWORD nothing; - char str[100]; - - info.sin_family = AF_INET; - info.sin_addr.S_un.S_addr = INADDR_ANY; - info.sin_port = htons(5738); - - if(bind(lanlink.tcpsocket, (LPSOCKADDR)&info, sizeof(SOCKADDR_IN))==SOCKET_ERROR){ - closesocket(lanlink.tcpsocket); - if((lanlink.tcpsocket=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET) - return WSAGetLastError(); - if(bind(lanlink.tcpsocket, (LPSOCKADDR)&info, sizeof(SOCKADDR_IN))==SOCKET_ERROR) - return WSAGetLastError(); - } - - if(listen(lanlink.tcpsocket, lanlink.numgbas)==SOCKET_ERROR) - return WSAGetLastError(); - - if(lanlink.thread!=NULL){ - lanlink.terminate = true; - WaitForSingleObject(linksync[vbaid], 500); - lanlink.thread = NULL; - } - lanlink.terminate = false; - linkid = 0; - - gethostname(str, 100); - ((ServerWait*)serverdlg)->m_serveraddress.Format("Server IP address is: %s", inet_ntoa(*(LPIN_ADDR)(gethostbyname(str)->h_addr_list[0]))); - - lanlink.thread = CreateThread(NULL, 0, LinkServerThread, serverdlg, 0, ¬hing); - - return 0; - -} - -DWORD WINAPI LinkServerThread(void *serverdlg){ - fd_set fdset; - timeval wsocktimeout; - char inbuffer[256], outbuffer[256]; - int *intinbuffer = (int*)inbuffer; - u16 *u16inbuffer = (u16*)inbuffer; - int *intoutbuffer = (int*)outbuffer; - u16 *u16outbuffer = (u16*)outbuffer; - BOOL disable = true; - - wsocktimeout.tv_sec = 1; - wsocktimeout.tv_usec = 0; - i = 0; - - while(im_plconn[i].Format("Player %d connected", i+1); - ((ServerWait*)serverdlg)->UpdateData(false); - i++; - } - } - ((ServerWait*)serverdlg)->m_prgctrl.StepIt(); - } - MessageBox(NULL, "All players connected", "Link", MB_OK); - ((ServerWait*)serverdlg)->SendMessage(WM_CLOSE, 0, 0); - - for(i=1;i<=lanlink.numgbas;i++){ - outbuffer[0] = 4; - send(ls.tcpsocket[i], outbuffer, 4, 0); - } - - lanlink.connected = true; - - return 0; -} - -void lserver::Send(void){ - if(lanlink.type==0){ // TCP - if(savedlinktime==-1){ - outbuffer[0] = 4; - outbuffer[1] = -32; //0xe0 - for(i=1;i<=lanlink.numgbas;i++){ - send(tcpsocket[i], outbuffer, 4, 0); - recv(tcpsocket[i], inbuffer, 4, 0); - } - } - outbuffer[1] = tspeed; - u16outbuffer[1] = linkdata[0]; - intoutbuffer[1] = savedlinktime; - if(lanlink.numgbas==1){ - if(lanlink.type==0){ - outbuffer[0] = 8; - send(tcpsocket[1], outbuffer, 8, 0); - } - } - else if(lanlink.numgbas==2){ - u16outbuffer[4] = linkdata[2]; - if(lanlink.type==0){ - outbuffer[0] = 10; - send(tcpsocket[1], outbuffer, 10, 0); - u16outbuffer[4] = linkdata[1]; - send(tcpsocket[2], outbuffer, 10, 0); - } - } else { - if(lanlink.type==0){ - outbuffer[0] = 12; - u16outbuffer[4] = linkdata[2]; - u16outbuffer[5] = linkdata[3]; - send(tcpsocket[1], outbuffer, 12, 0); - u16outbuffer[4] = linkdata[1]; - send(tcpsocket[2], outbuffer, 12, 0); - u16outbuffer[5] = linkdata[2]; - send(tcpsocket[3], outbuffer, 12, 0); - } - } - } - return; -} - -void lserver::Recv(void){ - int numbytes; - if(lanlink.type==0){ // TCP - wsocktimeout.tv_usec = 0; - wsocktimeout.tv_sec = linktimeout / 1000; - fdset.fd_count = lanlink.numgbas; - for(i=0;i1) memcpy(inbuffer, inbuffer+inbuffer[0]*(howmanytimes-1), inbuffer[0]); - if(inbuffer[1]==-32){ - char message[30]; - lanlink.connected = false; - sprintf(message, "Player %d disconnected.", i+2); - MessageBox(NULL, message, "Link", MB_OK); - outbuffer[0] = 4; - outbuffer[1] = -32; - for(i=1;ih_addr_list); - - if(ioctlsocket(lanlink.tcpsocket, FIONBIO, ¬block)==SOCKET_ERROR) - return WSAGetLastError(); - - if(lanlink.thread!=NULL){ - lanlink.terminate = true; - WaitForSingleObject(linksync[vbaid], 500); - lanlink.thread = NULL; - } - - ((ServerWait*)waitdlg)->SetWindowText("Connecting..."); - lanlink.terminate = false; - lanlink.thread = CreateThread(NULL, 0, LinkClientThread, waitdlg, 0, ¬hing); - return 0; -} - -DWORD WINAPI LinkClientThread(void *waitdlg){ - fd_set fdset; - timeval wsocktimeout; - int numbytes; - char inbuffer[16]; - u16 *u16inbuffer = (u16*)inbuffer; - unsigned long block = 0; - - if(connect(lanlink.tcpsocket, (LPSOCKADDR)&lc.serverinfo, sizeof(SOCKADDR_IN))==SOCKET_ERROR){ - if(WSAGetLastError()!=WSAEWOULDBLOCK){ - MessageBox(NULL, "Couldn't connect to server.", "Link", MB_OK); - return 1; - } - wsocktimeout.tv_sec = 1; - wsocktimeout.tv_usec = 0; - do{ - if(lanlink.terminate) return 0; - fdset.fd_count = 1; - fdset.fd_array[0] = lanlink.tcpsocket; - ((ServerWait*)waitdlg)->m_prgctrl.StepIt(); - } while(select(0, NULL, &fdset, NULL, &wsocktimeout)!=1&&connect(lanlink.tcpsocket, (LPSOCKADDR)&lc.serverinfo, sizeof(SOCKADDR_IN))!=0); - } - - ioctlsocket(lanlink.tcpsocket, FIONBIO, &block); - - numbytes = 0; - while(numbytes<4) - numbytes += recv(lanlink.tcpsocket, inbuffer+numbytes, 16, 0); - linkid = (int)u16inbuffer[0]; - lanlink.numgbas = (int)u16inbuffer[1]; - - ((ServerWait*)waitdlg)->m_serveraddress.Format("Connected as #%d", linkid+1); - if(lanlink.numgbas!=linkid) ((ServerWait*)waitdlg)->m_plconn[0].Format("Waiting for %d players to join", lanlink.numgbas-linkid); - else ((ServerWait*)waitdlg)->m_plconn[0].Format("All players joined."); - - numbytes = 0; - inbuffer[0] = 1; - while(numbytesSendMessage(WM_CLOSE, 0, 0); - - block = 1; - - ioctlsocket(lanlink.tcpsocket, FIONBIO, &block); - - lanlink.connected = true; - return 0; -} - -void lclient::CheckConn(void){ - if((numbytes=recv(lanlink.tcpsocket, inbuffer, 256, 0))>0){ - while(numbytes +#include "win32/stdafx.h" +#include "port.h" +#include "Link.h" +#include "win32/vba.h" +#include "win32/MainWnd.h" +#include "win32/LinkOptions.h" +#include "win32/Reg.h" + +#define UPDATE_REG(address, value) WRITE16LE(((u16 *)&ioMem[address]),value) +#define GBLINK_READY 8 + +int linktime = 0; +u8 tspeed=3; +u8 transfer=0; +LINKDATA *linkmem=NULL; +int linkid = 0, vbaid = 0; +HANDLE linksync[4]; +int savedlinktime=0; +HANDLE mmf=NULL; +char linkevent[] = "VBA link event "; +static int i, j; +int linktimeout = 1000; +int linklog = 0; +FILE *linklogfile = NULL; +LANLINKDATA lanlink; +u16 linkdata[4]; +int lspeed = 0; +lserver ls; +lclient lc; +bool oncewait = false, after = false; +bool adapter = false; +bool linkenable = false; +u8 rfu_cmd, rfu_qsend, rfu_qrecv; +int rfu_state, rfu_polarity, linktime2, counter, rfu_masterq; +int transferend, numtransfers = 0; +u32 rfu_masterdata[32]; + +extern unsigned char *gbMemory; +extern int gbInterrupt; + +int trtimedata[4][4] = {{34080, 8520, 5680, 2840}, {65536, 16384, 10923, 5461}, {99609, 24903, 16602, 8301}, {133692, 33423, 22282, 11141}}; +int trtimeend[3][4] = {{72527, 18132, 12088, 6044}, {106608, 26652, 17768, 8884}, {133692, 33423, 22282, 11141}}; +int gbtime = 1024; + +DWORD WINAPI LinkClientThread(void *); +DWORD WINAPI LinkServerThread(void *); +int StartServer(void); +int GetSioMode(u16, u16); +u16 StartRFU(u16); + +char *MakeInstanceFilename(const char *Input) +{ + if (vbaid == 0) + return (char *)Input; + + static char *result=NULL; + if (result!=NULL) + free(result); + + result = (char *)malloc(strlen(Input)+3); + char *p = strrchr((char *)Input, '.'); + sprintf(result, "%.*s-%d.%s", (int)(p-Input), Input, vbaid+1, p+1); + return result; +} + + +void StartLink(WORD value){ + if(ioMem==NULL) return; + if(adapter){ + UPDATE_REG(0x128, StartRFU(value)); + return; + } + switch(GetSioMode(value, READ16LE(&ioMem[0x134]))){ + case MULTIPLAYER: + if(value & 0x80){ + if(!linkid){ + if(!transfer){ + if(lanlink.active){ + if(lanlink.connected){ + linkdata[0] = READ16LE(&ioMem[0x12a]); + savedlinktime = linktime; + tspeed = value & 3; + ls.Send(); + transfer = 1; + linktime = 0; + UPDATE_REG(0x120, linkdata[0]); + UPDATE_REG(0x122, 0xffff); + WRITE32LE(&ioMem[0x124], 0xffffffff); + if(lanlink.speed&&oncewait==false) ls.howmanytimes++; + after = false; + } + } else if(linkmem->numgbas>1){ + ResetEvent(linksync[0]); + linkmem->linkcmd[0] = ('M'<<8)+(value&3); + linkmem->linkdata[0] = READ16LE(&ioMem[0x12a]); + if(linkmem->numtransfers!=0) linkmem->lastlinktime = linktime; + else linkmem->lastlinktime = 0; + if((++linkmem->numtransfers)==0) linkmem->numtransfers=2; + transfer = 1; + linktime = 0; + tspeed = value & 3; + WRITE32LE(&ioMem[0x120], 0xffffffff); + WRITE32LE(&ioMem[0x124], 0xffffffff); + } + } + } + value &= 0xff7f; + value |= (transfer!=0)<<7; + } + value &= 0xff8b; + value |= (linkid ? 0xc : 8); + value |= linkid<<4; + UPDATE_REG(0x128, value); + if(linkid) UPDATE_REG(0x134, 7); + else UPDATE_REG(0x134, 3); + break; + case NORMAL8: + if(linklog) fprintf(linklogfile, "Attempt to use 8-bit Normal mode %04x\n", value); + UPDATE_REG(0x128, value); + break; + case NORMAL32: + if(linklog) fprintf(linklogfile, "Attempt to use 32-bit Normal mode %04x %x%x\n", value, READ16LE(&ioMem[0x122]), READ16LE(&ioMem[0x120])); + UPDATE_REG(0x128, value); + break; + case UART: + if(linklog) fprintf(linklogfile, "Attempt to use UART mode %04x\n", value); + UPDATE_REG(0x128, value); + break; + default: + UPDATE_REG(0x128, value); + break; + } +} + +void StartGPLink(u16 value){ + if(!value){ + UPDATE_REG(0x134, 0); + return; + } + switch(GetSioMode(READ16LE(&ioMem[0x128]), value)){ + case MULTIPLAYER: + value &= 0xc0f0; + value |= 3; + if(linkid) value |= 4; + UPDATE_REG(0x134, value); + UPDATE_REG(0x128, ((READ16LE(&ioMem[0x128])&0xff8b)|(linkid ? 0xc : 8)|(linkid<<4))); + return; + break; + case GP: + if(linklog){ + if(value==0x8000) fprintf(linklogfile, "Circuit reset\n"); + else if(!adapter) fprintf(linklogfile, "Attempt to use General-purpose mode %04x\n", value); + } + if(adapter) rfu_state = RFU_INIT; + // This was not there, but sonic games won't start if it's not here. + UPDATE_REG(0x134, value); + break; + case JOYBUS: + UPDATE_REG(0x134, value); + break; + default: + UPDATE_REG(0x134, value); + break; + } + return; +} + +void StartJOYLink(u16 value){ + if(!value){ + UPDATE_REG(0x140, 0); + return; + } + if(GetSioMode(READ16LE(&ioMem[0x128]), READ16LE(&ioMem[0x134]))==JOYBUS&&linklog) fprintf(linklogfile, "Attempt to use JOY-BUS mode %04x\n", value); + return; +} + +void LinkUpdate(int ticks){ + linktime += ticks; + if(adapter){ + linktime2 += ticks; + transferend -= ticks; + if(transfer&&transferend<=0){ + transfer = 0; + if(READ16LE(&ioMem[0x128])&0x4000){ + IF |= 0x80; + UPDATE_REG(0x202, IF); + } + UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) & 0xff7f); + } + return; + } + + if(lanlink.active){ + if(lanlink.connected){ + if(after){ + if(linkid&&linktime>6044){ + lc.Recv(); + oncewait = true; + } else return; + } + if(linkid&&!transfer&&lc.numtransfers>0&&linktime>=savedlinktime){ + linkdata[linkid] = READ16LE(&ioMem[0x12a]); + if(!lc.oncesend) lc.Send(); + lc.oncesend = false; + UPDATE_REG(0x120, linkdata[0]); + UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) | 0x80); + transfer = 1; + if(lc.numtransfers==1) linktime = 0; + else linktime -= savedlinktime; + } + if(transfer&&linktime>=trtimeend[lanlink.numgbas-1][tspeed]){ + if(READ16LE(&ioMem[0x128]) & 0x4000){ + IF |= 0x80; + UPDATE_REG(0x202, IF); + } + UPDATE_REG(0x128, (READ16LE(&ioMem[0x128]) & 0xff0f) | (linkid << 4)); + transfer = 0; + linktime -= trtimeend[lanlink.numgbas-1][tspeed]; + oncewait = false; + if(!lanlink.speed){ + if(linkid) lc.Recv(); + else ls.Recv(); + UPDATE_REG(0x122, linkdata[1]); + UPDATE_REG(0x124, linkdata[2]); + UPDATE_REG(0x126, linkdata[3]); + if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", linkdata[0], linkdata[1], linkdata[2], linkdata[3], savedlinktime); + oncewait = true; + } else { + after = true; + if(lanlink.numgbas==1){ + UPDATE_REG(0x122, linkdata[1]); + UPDATE_REG(0x124, linkdata[2]); + UPDATE_REG(0x126, linkdata[3]); + if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", linkdata[0], linkdata[1], linkdata[2], linkdata[3], savedlinktime); + } + + } + } + } + return; + } + // ** CRASH ** linkmem is NULL, todo investigate why, added null check + if(linkid&&!transfer&&linkmem&&linktime>=linkmem->lastlinktime&&linkmem->numtransfers){ + linkmem->linkdata[linkid] = READ16LE(&ioMem[0x12a]); + + if(linkmem->numtransfers==1){ + linktime = 0; + if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) linkmem->numtransfers=0; + } else linktime -= linkmem->lastlinktime; + + switch((linkmem->linkcmd[0])>>8){ + case 'M': + tspeed = (linkmem->linkcmd[0]) & 3; + transfer = 1; + WRITE32LE(&ioMem[0x120], 0xffffffff); + WRITE32LE(&ioMem[0x124], 0xffffffff); + UPDATE_REG(0x128, READ16LE(&ioMem[0x128]) | 0x80); + break; + } + } + + if(!transfer) return; + + if(transfer&&linktime>=trtimedata[transfer-1][tspeed]&&transfer<=linkmem->numgbas){ + if(transfer-linkid==2){ + SetEvent(linksync[linkid+1]); + if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) + linkmem->numtransfers=0; + ResetEvent(linksync[linkid]); + if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", + linkmem->linkdata[0], linkmem->linkdata[1], linkmem->linkdata[2], linkmem->linkdata[3], linkmem->lastlinktime); + } + + + UPDATE_REG(0x11e + (transfer<<1), linkmem->linkdata[transfer-1]); + transfer++; + } + + if(transfer&&linktime>=trtimeend[linkmem->numgbas-2][tspeed]){ + if(linkid==linkmem->numgbas-1){ + SetEvent(linksync[0]); + if(WaitForSingleObject(linksync[linkid], linktimeout)==WAIT_TIMEOUT) + linkmem->numtransfers=0; + ResetEvent(linksync[linkid]); + if(linklog) fprintf(linklogfile, "%04x %04x %04x %04x %10u\n", + linkmem->linkdata[0], linkmem->linkdata[1], linkmem->linkdata[2], linkmem->linkdata[3], linkmem->lastlinktime); + } + transfer = 0; + linktime -= trtimeend[0][tspeed]; + if(READ16LE(&ioMem[0x128]) & 0x4000){ + IF |= 0x80; + UPDATE_REG(0x202, IF); + } + UPDATE_REG(0x128, (READ16LE(&ioMem[0x128]) & 0xff0f) | (linkid << 4)); + linkmem->linkdata[linkid] = 0xffff; + } + + return; +} + +inline int GetSioMode(u16 reg1, u16 reg2){ + if(!(reg2&0x8000)){ + switch(reg1&0x3000){ + case 0x0000: + return NORMAL8; + case 0x1000: + return NORMAL32; + case 0x2000: + return MULTIPLAYER; + case 0x3000: + return UART; + } + } + if(reg2&0x4000) return JOYBUS; + return GP; +} + +u16 StartRFU(u16 value){ + switch(GetSioMode(value, READ16LE(&ioMem[0x134]))){ + case NORMAL8: + rfu_polarity = 0; + return value; + break; + case NORMAL32: + if(value&8) value &= 0xfffb; // A kind of acknowledge procedure + else value |= 4; + if(value&0x80){ + if((value&3)==1) transferend = 2048; + else transferend = 256; + u16 a = READ16LE(&ioMem[0x122]); + switch(rfu_state){ + case RFU_INIT: + if(READ32LE(&ioMem[0x120])==0xb0bb8001){ + rfu_state = RFU_COMM; // end of startup + } + UPDATE_REG(0x122, READ16LE(&ioMem[0x120])); + UPDATE_REG(0x120, a); + break; + case RFU_COMM: + if(a==0x9966){ + rfu_cmd = ioMem[0x120]; + if((rfu_qsend=ioMem[0x121])!=0){ + rfu_state = RFU_SEND; + counter = 0; + } + if(rfu_cmd==0x25||rfu_cmd==0x24){ + linkmem->rfu_q[vbaid] = rfu_qsend; + } + UPDATE_REG(0x120, 0); + UPDATE_REG(0x122, 0x8000); + } else if(a==0x8000){ + switch(rfu_cmd){ + case 0x1a: // check if someone joined + if(linkmem->rfu_request[vbaid]!=0){ + rfu_state = RFU_RECV; + rfu_qrecv = 1; + } + linkid = -1; + rfu_cmd |= 0x80; + break; + case 0x1e: // receive broadcast data + case 0x1d: // no visible difference + rfu_polarity = 0; + rfu_state = RFU_RECV; + rfu_qrecv = 7; + counter = 0; + rfu_cmd |= 0x80; + break; + case 0x30: + linkmem->rfu_request[vbaid] = 0; + linkmem->rfu_q[vbaid] = 0; + linkid = 0; + numtransfers = 0; + rfu_cmd |= 0x80; + if(linkmem->numgbas==2) SetEvent(linksync[1-vbaid]); + break; + case 0x11: // ? always receives 0xff - I suspect it's something for 3+ players + case 0x13: // unknown + case 0x20: // this has something to do with 0x1f + case 0x21: // this too + rfu_cmd |= 0x80; + rfu_polarity = 0; + rfu_state = 3; + rfu_qrecv = 1; + break; + case 0x26: + if(linkid>0){ + rfu_qrecv = rfu_masterq; + } + if((rfu_qrecv=linkmem->rfu_q[1-vbaid])!=0){ + rfu_state = RFU_RECV; + counter = 0; + } + rfu_cmd |= 0x80; + break; + case 0x24: // send data + if((numtransfers++)==0) linktime = 1; + linkmem->rfu_linktime[vbaid] = linktime; + if(linkmem->numgbas==2){ + SetEvent(linksync[1-vbaid]); + WaitForSingleObject(linksync[vbaid], linktimeout); + ResetEvent(linksync[vbaid]); + } + rfu_cmd |= 0x80; + linktime = 0; + linkid = -1; + break; + case 0x25: // send & wait for data + case 0x1f: // pick a server + case 0x10: // init + case 0x16: // send broadcast data + case 0x17: // setup or something ? + case 0x27: // wait for data ? + case 0x3d: // init + default: + rfu_cmd |= 0x80; + break; + case 0xa5: // 2nd part of send&wait function 0x25 + case 0xa7: // 2nd part of wait function 0x27 + if(linkid==-1){ + linkid++; + linkmem->rfu_linktime[vbaid] = 0; + } + if(linkid&&linkmem->rfu_request[1-vbaid]==0){ + linkmem->rfu_q[1-vbaid] = 0; + transferend = 256; + rfu_polarity = 1; + rfu_cmd = 0x29; + linktime = 0; + break; + } + if((numtransfers++)==0) linktime = 0; + linkmem->rfu_linktime[vbaid] = linktime; + if(linkmem->numgbas==2){ + if(!linkid||(linkid&&numtransfers)) SetEvent(linksync[1-vbaid]); + WaitForSingleObject(linksync[vbaid], linktimeout); + ResetEvent(linksync[vbaid]); + } + if(linkid>0){ + memcpy(rfu_masterdata, linkmem->rfu_data[1-vbaid], 128); + rfu_masterq = linkmem->rfu_q[1-vbaid]; + } + transferend = linkmem->rfu_linktime[1-vbaid] - linktime + 256; + if(transferend<256) transferend = 256; + linktime = -transferend; + rfu_polarity = 1; + rfu_cmd = 0x28; + break; + } + UPDATE_REG(0x122, 0x9966); + UPDATE_REG(0x120, (rfu_qrecv<<8) | rfu_cmd); + } else { + UPDATE_REG(0x120, 0); + UPDATE_REG(0x122, 0x8000); + } + break; + case RFU_SEND: + if(--rfu_qsend==0) rfu_state = RFU_COMM; + switch(rfu_cmd){ + case 0x16: + linkmem->rfu_bdata[vbaid][counter++] = READ32LE(&ioMem[0x120]); + break; + case 0x17: + linkid = 1; + break; + case 0x1f: + linkmem->rfu_request[1-vbaid] = 1; + break; + case 0x24: + case 0x25: + linkmem->rfu_data[vbaid][counter++] = READ32LE(&ioMem[0x120]); + break; + } + UPDATE_REG(0x120, 0); + UPDATE_REG(0x122, 0x8000); + break; + case RFU_RECV: + if(--rfu_qrecv==0) rfu_state = RFU_COMM; + switch(rfu_cmd){ + case 0x9d: + case 0x9e: + if(counter==0){ + UPDATE_REG(0x120, 0x61f1); + UPDATE_REG(0x122, 0); + counter++; + break; + } + UPDATE_REG(0x120, linkmem->rfu_bdata[1-vbaid][counter-1]&0xffff); + UPDATE_REG(0x122, linkmem->rfu_bdata[1-vbaid][counter-1]>>16); + counter++; + break; + case 0xa6: + if(linkid>0){ + UPDATE_REG(0x120, rfu_masterdata[counter]&0xffff); + UPDATE_REG(0x122, rfu_masterdata[counter++]>>16); + } else { + UPDATE_REG(0x120, linkmem->rfu_data[1-vbaid][counter]&0xffff); + UPDATE_REG(0x122, linkmem->rfu_data[1-vbaid][counter++]>>16); + } + break; + case 0x93: // it seems like the game doesn't care about this value + UPDATE_REG(0x120, 0x1234); // put anything in here + UPDATE_REG(0x122, 0x0200); // also here, but it should be 0200 + break; + case 0xa0: + case 0xa1: + UPDATE_REG(0x120, 0x641b); + UPDATE_REG(0x122, 0x0000); + break; + case 0x9a: + UPDATE_REG(0x120, 0x61f9); + UPDATE_REG(0x122, 0); + break; + case 0x91: + UPDATE_REG(0x120, 0x00ff); + UPDATE_REG(0x122, 0x0000); + break; + default: + UPDATE_REG(0x120, 0x0173); + UPDATE_REG(0x122, 0x0000); + break; + } + break; + } + transfer = 1; + } + if(rfu_polarity) value ^= 4; // sometimes it's the other way around + default: + return value; + } +} + +void gbLinkStart(u8 value){ +// Not in this version :-) +} + + +void gbLinkUpdate(void){ +} + +int InitLink(void){ + WSADATA wsadata; + BOOL disable = true; + + linkid = 0; + + if(WSAStartup(MAKEWORD(1,1), &wsadata)!=0){ + WSACleanup(); + return 0; + } + + if((lanlink.tcpsocket=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET){ + MessageBox(NULL, "Couldn't create socket.", "Error!", MB_OK); + WSACleanup(); + return 0; + } + + setsockopt(lanlink.tcpsocket, IPPROTO_TCP, TCP_NODELAY, (char*)&disable, sizeof(BOOL)); + + if((mmf=CreateFileMapping((HANDLE)0xffffffff, NULL, PAGE_READWRITE, 0, sizeof(LINKDATA), "VBA link memory"))==NULL){ + closesocket(lanlink.tcpsocket); + WSACleanup(); + MessageBox(NULL, "Error creating file mapping", "Error", MB_OK|MB_ICONEXCLAMATION); + return 0; + } + + if(GetLastError() == ERROR_ALREADY_EXISTS) + vbaid = 1; + else + vbaid = 0; + + if((linkmem=(LINKDATA *)MapViewOfFile(mmf, FILE_MAP_WRITE, 0, 0, sizeof(LINKDATA)))==NULL){ + closesocket(lanlink.tcpsocket); + WSACleanup(); + CloseHandle(mmf); + MessageBox(NULL, "Error mapping file", "Error", MB_OK|MB_ICONEXCLAMATION); + return 0; + } + + if(linkmem->linkflags&LINK_PARENTLOST) + vbaid = 0; + + if(vbaid==0){ + linkid = 0; + if(linkmem->linkflags&LINK_PARENTLOST){ + linkmem->numgbas++; + linkmem->linkflags &= ~LINK_PARENTLOST; + } + else + linkmem->numgbas=1; + + for(i=0;i<4;i++){ + linkevent[15]=(char)i+'1'; + if((linksync[i]=CreateEvent(NULL, true, false, linkevent))==NULL){ + closesocket(lanlink.tcpsocket); + WSACleanup(); + UnmapViewOfFile(linkmem); + CloseHandle(mmf); + for(j=0;jnumgbas; + linkid = vbaid; + linkmem->numgbas++; + + linklog = 0; + if(linkmem->numgbas>4){ + linkmem->numgbas=4; + closesocket(lanlink.tcpsocket); + WSACleanup(); + MessageBox(NULL, "5 or more GBAs not supported.", "Error!", MB_OK|MB_ICONEXCLAMATION); + UnmapViewOfFile(linkmem); + CloseHandle(mmf); + return 0; + } + for(i=0;i<4;i++){ + linkevent[15]=(char)i+'1'; + if((linksync[i]=OpenEvent(EVENT_ALL_ACCESS, false, linkevent))==NULL){ + closesocket(lanlink.tcpsocket); + WSACleanup(); + CloseHandle(mmf); + UnmapViewOfFile(linkmem); + for(j=0;jlastlinktime=0xffffffff; + linkmem->numtransfers=0; + linkmem->linkflags=0; + lanlink.connected = false; + lanlink.thread = NULL; + lanlink.speed = false; + for(i=0;i<4;i++){ + linkmem->linkdata[i] = 0xffff; + linkdata[i] = 0xffff; + } +return 1; +} + +int openLinkLog(void){ + char filename[20]; + if(linklog){ + sprintf(filename, "vbalog%1d.txt", vbaid+1); + if((linklogfile=fopen(filename, "at"))==NULL){ + linklog=false; + return 0; + } + fprintf(linklogfile, "----- Log opened -----\n"); + } + return 1; +} + +void closeLinkLog() +{ + if(linklogfile) + { + fclose(linklogfile); + linklogfile=NULL; + } +} + +void CloseLink(void){ + if(lanlink.connected){ + if(linkid){ + char outbuffer[4]; + outbuffer[0] = 4; + outbuffer[1] = -32; + if(lanlink.type==0) send(lanlink.tcpsocket, outbuffer, 4, 0); + } else { + char outbuffer[12]; + int i; + outbuffer[0] = 12; + outbuffer[1] = -32; + for(i=1;i<=lanlink.numgbas;i++){ + if(lanlink.type==0){ + send(ls.tcpsocket[i], outbuffer, 12, 0); + } + closesocket(ls.tcpsocket[i]); + } + } + } + linkmem->numgbas--; + if(!linkid&&linkmem->numgbas!=0) + linkmem->linkflags|=LINK_PARENTLOST; + CloseHandle(mmf); + UnmapViewOfFile(linkmem); + + for(i=0;i<4;i++){ + if(linksync[i]!=NULL){ + PulseEvent(linksync[i]); + CloseHandle(linksync[i]); + } + } + regSetDwordValue("LAN", lanlink.active); + if(linklog) closeLinkLog(); + closesocket(lanlink.tcpsocket); + WSACleanup(); +return; +} + +lserver::lserver(void){ + intinbuffer = (int*)inbuffer; + u16inbuffer = (u16*)inbuffer; + intoutbuffer = (int*)outbuffer; + u16outbuffer = (u16*)outbuffer; + oncewait = false; +} + +int lserver::Init(void *serverdlg){ + SOCKADDR_IN info; + DWORD nothing; + char str[100]; + + info.sin_family = AF_INET; + info.sin_addr.S_un.S_addr = INADDR_ANY; + info.sin_port = htons(5738); + + if(bind(lanlink.tcpsocket, (LPSOCKADDR)&info, sizeof(SOCKADDR_IN))==SOCKET_ERROR){ + closesocket(lanlink.tcpsocket); + if((lanlink.tcpsocket=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET) + return WSAGetLastError(); + if(bind(lanlink.tcpsocket, (LPSOCKADDR)&info, sizeof(SOCKADDR_IN))==SOCKET_ERROR) + return WSAGetLastError(); + } + + if(listen(lanlink.tcpsocket, lanlink.numgbas)==SOCKET_ERROR) + return WSAGetLastError(); + + if(lanlink.thread!=NULL){ + lanlink.terminate = true; + WaitForSingleObject(linksync[vbaid], 500); + lanlink.thread = NULL; + } + lanlink.terminate = false; + linkid = 0; + + gethostname(str, 100); + ((ServerWait*)serverdlg)->m_serveraddress.Format("Server IP address is: %s", inet_ntoa(*(LPIN_ADDR)(gethostbyname(str)->h_addr_list[0]))); + + lanlink.thread = CreateThread(NULL, 0, LinkServerThread, serverdlg, 0, ¬hing); + + return 0; + +} + +DWORD WINAPI LinkServerThread(void *serverdlg){ + fd_set fdset; + timeval wsocktimeout; + char inbuffer[256], outbuffer[256]; + int *intinbuffer = (int*)inbuffer; + u16 *u16inbuffer = (u16*)inbuffer; + int *intoutbuffer = (int*)outbuffer; + u16 *u16outbuffer = (u16*)outbuffer; + BOOL disable = true; + + wsocktimeout.tv_sec = 1; + wsocktimeout.tv_usec = 0; + i = 0; + + while(im_plconn[i].Format("Player %d connected", i+1); + ((ServerWait*)serverdlg)->UpdateData(false); + i++; + } + } + ((ServerWait*)serverdlg)->m_prgctrl.StepIt(); + } + MessageBox(NULL, "All players connected", "Link", MB_OK); + ((ServerWait*)serverdlg)->SendMessage(WM_CLOSE, 0, 0); + + for(i=1;i<=lanlink.numgbas;i++){ + outbuffer[0] = 4; + send(ls.tcpsocket[i], outbuffer, 4, 0); + } + + lanlink.connected = true; + + return 0; +} + +void lserver::Send(void){ + if(lanlink.type==0){ // TCP + if(savedlinktime==-1){ + outbuffer[0] = 4; + outbuffer[1] = -32; //0xe0 + for(i=1;i<=lanlink.numgbas;i++){ + send(tcpsocket[i], outbuffer, 4, 0); + recv(tcpsocket[i], inbuffer, 4, 0); + } + } + outbuffer[1] = tspeed; + u16outbuffer[1] = linkdata[0]; + intoutbuffer[1] = savedlinktime; + if(lanlink.numgbas==1){ + if(lanlink.type==0){ + outbuffer[0] = 8; + send(tcpsocket[1], outbuffer, 8, 0); + } + } + else if(lanlink.numgbas==2){ + u16outbuffer[4] = linkdata[2]; + if(lanlink.type==0){ + outbuffer[0] = 10; + send(tcpsocket[1], outbuffer, 10, 0); + u16outbuffer[4] = linkdata[1]; + send(tcpsocket[2], outbuffer, 10, 0); + } + } else { + if(lanlink.type==0){ + outbuffer[0] = 12; + u16outbuffer[4] = linkdata[2]; + u16outbuffer[5] = linkdata[3]; + send(tcpsocket[1], outbuffer, 12, 0); + u16outbuffer[4] = linkdata[1]; + send(tcpsocket[2], outbuffer, 12, 0); + u16outbuffer[5] = linkdata[2]; + send(tcpsocket[3], outbuffer, 12, 0); + } + } + } + return; +} + +void lserver::Recv(void){ + int numbytes; + if(lanlink.type==0){ // TCP + wsocktimeout.tv_usec = 0; + wsocktimeout.tv_sec = linktimeout / 1000; + fdset.fd_count = lanlink.numgbas; + for(i=0;i1) memcpy(inbuffer, inbuffer+inbuffer[0]*(howmanytimes-1), inbuffer[0]); + if(inbuffer[1]==-32){ + char message[30]; + lanlink.connected = false; + sprintf(message, "Player %d disconnected.", i+2); + MessageBox(NULL, message, "Link", MB_OK); + outbuffer[0] = 4; + outbuffer[1] = -32; + for(i=1;ih_addr_list); + + if(ioctlsocket(lanlink.tcpsocket, FIONBIO, ¬block)==SOCKET_ERROR) + return WSAGetLastError(); + + if(lanlink.thread!=NULL){ + lanlink.terminate = true; + WaitForSingleObject(linksync[vbaid], 500); + lanlink.thread = NULL; + } + + ((ServerWait*)waitdlg)->SetWindowText("Connecting..."); + lanlink.terminate = false; + lanlink.thread = CreateThread(NULL, 0, LinkClientThread, waitdlg, 0, ¬hing); + return 0; +} + +DWORD WINAPI LinkClientThread(void *waitdlg){ + fd_set fdset; + timeval wsocktimeout; + int numbytes; + char inbuffer[16]; + u16 *u16inbuffer = (u16*)inbuffer; + unsigned long block = 0; + + if(connect(lanlink.tcpsocket, (LPSOCKADDR)&lc.serverinfo, sizeof(SOCKADDR_IN))==SOCKET_ERROR){ + if(WSAGetLastError()!=WSAEWOULDBLOCK){ + MessageBox(NULL, "Couldn't connect to server.", "Link", MB_OK); + return 1; + } + wsocktimeout.tv_sec = 1; + wsocktimeout.tv_usec = 0; + do{ + if(lanlink.terminate) return 0; + fdset.fd_count = 1; + fdset.fd_array[0] = lanlink.tcpsocket; + ((ServerWait*)waitdlg)->m_prgctrl.StepIt(); + } while(select(0, NULL, &fdset, NULL, &wsocktimeout)!=1&&connect(lanlink.tcpsocket, (LPSOCKADDR)&lc.serverinfo, sizeof(SOCKADDR_IN))!=0); + } + + ioctlsocket(lanlink.tcpsocket, FIONBIO, &block); + + numbytes = 0; + while(numbytes<4) + numbytes += recv(lanlink.tcpsocket, inbuffer+numbytes, 16, 0); + linkid = (int)u16inbuffer[0]; + lanlink.numgbas = (int)u16inbuffer[1]; + + ((ServerWait*)waitdlg)->m_serveraddress.Format("Connected as #%d", linkid+1); + if(lanlink.numgbas!=linkid) ((ServerWait*)waitdlg)->m_plconn[0].Format("Waiting for %d players to join", lanlink.numgbas-linkid); + else ((ServerWait*)waitdlg)->m_plconn[0].Format("All players joined."); + + numbytes = 0; + inbuffer[0] = 1; + while(numbytesSendMessage(WM_CLOSE, 0, 0); + + block = 1; + + ioctlsocket(lanlink.tcpsocket, FIONBIO, &block); + + lanlink.connected = true; + return 0; +} + +void lclient::CheckConn(void){ + if((numbytes=recv(lanlink.tcpsocket, inbuffer, 256, 0))>0){ + while(numbytes - -#ifndef LINKH -#define LINKH -#define LINK_PARENTLOST 0x80 -#define UNSUPPORTED -1 -#define MULTIPLAYER 0 -#define NORMAL8 1 -#define NORMAL32 2 -#define UART 3 -#define JOYBUS 4 -#define GP 5 -#define RFU_INIT 0 -#define RFU_COMM 1 -#define RFU_SEND 2 -#define RFU_RECV 3 - -typedef struct { - WORD linkdata[4]; - WORD linkcmd[4]; - WORD numtransfers; - int lastlinktime; - unsigned char numgbas; - unsigned char linkflags; - int rfu_q[4]; - u8 rfu_request[4]; - int rfu_linktime[4]; - u32 rfu_bdata[4][7]; - u32 rfu_data[4][32]; -} LINKDATA; - -class lserver{ - int numbytes; - fd_set fdset; - timeval wsocktimeout; - //timeval udptimeout; - char inbuffer[256], outbuffer[256]; - int *intinbuffer; - u16 *u16inbuffer; - int *intoutbuffer; - u16 *u16outbuffer; - int counter; - int done; -public: - int howmanytimes; - SOCKET tcpsocket[4]; - SOCKADDR_IN udpaddr[4]; - lserver(void); - int Init(void*); - void Send(void); - void Recv(void); -}; - -class lclient{ - fd_set fdset; - timeval wsocktimeout; - char inbuffer[256], outbuffer[256]; - int *intinbuffer; - u16 *u16inbuffer; - int *intoutbuffer; - u16 *u16outbuffer; - int numbytes; -public: - bool oncesend; - SOCKADDR_IN serverinfo; - SOCKET noblock; - int numtransfers; - lclient(void); - int Init(LPHOSTENT, void*); - void Send(void); - void Recv(void); - void CheckConn(void); -}; - -typedef struct { - SOCKET tcpsocket; - //SOCKET udpsocket; - int numgbas; - HANDLE thread; - u8 type; - u8 server; - bool terminate; - bool connected; - bool speed; - bool active; -} LANLINKDATA; - -extern void LinkUpdate(void); -extern void LinkChildStop(void); -extern void LinkChildSend(u16); -extern int openLinkLog(void); -extern void closeLinkLog(); -extern void CloseLanLink(void); -extern char *MakeInstanceFilename(const char *Input); - -extern LANLINKDATA lanlink; -extern FILE *linklogfile; -extern int vbaid; -extern int linklog; -extern bool adapter; -extern bool linkenable; -extern int linktimeout; -extern lclient lc; -extern int linkid; - -#endif +// 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 + +#ifndef LINKH +#define LINKH +#define LINK_PARENTLOST 0x80 +#define UNSUPPORTED -1 +#define MULTIPLAYER 0 +#define NORMAL8 1 +#define NORMAL32 2 +#define UART 3 +#define JOYBUS 4 +#define GP 5 +#define RFU_INIT 0 +#define RFU_COMM 1 +#define RFU_SEND 2 +#define RFU_RECV 3 + +typedef struct { + WORD linkdata[4]; + WORD linkcmd[4]; + WORD numtransfers; + int lastlinktime; + unsigned char numgbas; + unsigned char linkflags; + int rfu_q[4]; + u8 rfu_request[4]; + int rfu_linktime[4]; + u32 rfu_bdata[4][7]; + u32 rfu_data[4][32]; +} LINKDATA; + +class lserver{ + int numbytes; + fd_set fdset; + timeval wsocktimeout; + //timeval udptimeout; + char inbuffer[256], outbuffer[256]; + int *intinbuffer; + u16 *u16inbuffer; + int *intoutbuffer; + u16 *u16outbuffer; + int counter; + int done; +public: + int howmanytimes; + SOCKET tcpsocket[4]; + SOCKADDR_IN udpaddr[4]; + lserver(void); + int Init(void*); + void Send(void); + void Recv(void); +}; + +class lclient{ + fd_set fdset; + timeval wsocktimeout; + char inbuffer[256], outbuffer[256]; + int *intinbuffer; + u16 *u16inbuffer; + int *intoutbuffer; + u16 *u16outbuffer; + int numbytes; +public: + bool oncesend; + SOCKADDR_IN serverinfo; + SOCKET noblock; + int numtransfers; + lclient(void); + int Init(LPHOSTENT, void*); + void Send(void); + void Recv(void); + void CheckConn(void); +}; + +typedef struct { + SOCKET tcpsocket; + //SOCKET udpsocket; + int numgbas; + HANDLE thread; + u8 type; + u8 server; + bool terminate; + bool connected; + bool speed; + bool active; +} LANLINKDATA; + +extern void LinkUpdate(void); +extern void LinkChildStop(void); +extern void LinkChildSend(u16); +extern int openLinkLog(void); +extern void closeLinkLog(); +extern void CloseLanLink(void); +extern char *MakeInstanceFilename(const char *Input); + +extern LANLINKDATA lanlink; +extern FILE *linklogfile; +extern int vbaid; +extern int linklog; +extern bool adapter; +extern bool linkenable; +extern int linktimeout; +extern lclient lc; +extern int linkid; + +#endif diff --git a/src/Mode0.cpp b/src/Mode0.cpp index 5d30d7fc..438812ca 100644 --- a/src/Mode0.cpp +++ b/src/Mode0.cpp @@ -30,7 +30,7 @@ void mode0RenderLine() } return; } - + if(layerEnable & 0x0100) { gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); } @@ -38,7 +38,7 @@ void mode0RenderLine() if(layerEnable & 0x0200) { gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); } - + if(layerEnable & 0x0400) { gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); } @@ -50,11 +50,11 @@ void mode0RenderLine() 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; @@ -74,7 +74,7 @@ void mode0RenderLine() color = line3[x]; top = 0x08; } - + if((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)) { color = lineOBJ[x]; top = 0x10; @@ -84,17 +84,17 @@ void mode0RenderLine() // 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; @@ -119,8 +119,8 @@ void mode0RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } lineMix[x] = color; @@ -137,7 +137,7 @@ void mode0RenderLineNoWindow() } return; } - + if(layerEnable & 0x0100) { gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); } @@ -145,7 +145,7 @@ void mode0RenderLineNoWindow() if(layerEnable & 0x0200) { gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); } - + if(layerEnable & 0x0400) { gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); } @@ -159,11 +159,11 @@ void mode0RenderLineNoWindow() 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; @@ -183,7 +183,7 @@ void mode0RenderLineNoWindow() color = line3[x]; top = 0x08; } - + if(lineOBJ[x] < (color & 0xFF000000)) { color = lineOBJ[x]; top = 0x10; @@ -204,40 +204,40 @@ void mode0RenderLineNoWindow() 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; @@ -254,17 +254,17 @@ void mode0RenderLineNoWindow() // 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; @@ -289,7 +289,7 @@ void mode0RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } } @@ -323,13 +323,13 @@ void mode0RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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); } @@ -337,7 +337,7 @@ void mode0RenderLineAll() if((layerEnable & 0x0200)) { gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); } - + if((layerEnable & 0x0400)) { gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2); } @@ -347,14 +347,14 @@ void mode0RenderLineAll() } gfxDrawSprites(lineOBJ); - gfxDrawOBJWin(lineOBJWin); + 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; @@ -374,32 +374,32 @@ void mode0RenderLineAll() 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)) { @@ -417,35 +417,35 @@ void mode0RenderLineAll() 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], @@ -466,27 +466,27 @@ void mode0RenderLineAll() // 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], @@ -501,34 +501,34 @@ void mode0RenderLineAll() 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], @@ -543,10 +543,10 @@ void mode0RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } } - + lineMix[x] = color; } } diff --git a/src/Mode1.cpp b/src/Mode1.cpp index 03491580..7f706e7a 100644 --- a/src/Mode1.cpp +++ b/src/Mode1.cpp @@ -23,19 +23,19 @@ void mode1RenderLine() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } if(layerEnable & 0x0100) { gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); } - + if(layerEnable & 0x0200) { gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); } @@ -81,17 +81,17 @@ void mode1RenderLine() // 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; @@ -111,25 +111,25 @@ void mode1RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode1RenderLineNoWindow() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -137,7 +137,7 @@ void mode1RenderLineNoWindow() gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0); } - + if(layerEnable & 0x0200) { gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1); } @@ -194,28 +194,28 @@ void mode1RenderLineNoWindow() 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], @@ -236,17 +236,17 @@ void mode1RenderLineNoWindow() // 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; @@ -266,25 +266,25 @@ void mode1RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode1RenderLineAll() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -303,17 +303,17 @@ void mode1RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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); } @@ -329,13 +329,13 @@ void mode1RenderLineAll() 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; @@ -355,7 +355,7 @@ void mode1RenderLineAll() mask = inWin0Mask; } } - + if(line0[x] < color && (mask & 1)) { color = line0[x]; top = 0x01; @@ -393,28 +393,28 @@ void mode1RenderLineAll() 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], @@ -435,22 +435,22 @@ void mode1RenderLineAll() // 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], @@ -465,29 +465,29 @@ void mode1RenderLineAll() 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], @@ -502,12 +502,12 @@ void mode1RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } diff --git a/src/Mode2.cpp b/src/Mode2.cpp index 462f2b00..a3f746af 100644 --- a/src/Mode2.cpp +++ b/src/Mode2.cpp @@ -31,12 +31,12 @@ void mode2RenderLine() 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); @@ -46,7 +46,7 @@ void mode2RenderLine() 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); @@ -80,12 +80,12 @@ void mode2RenderLine() // 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; @@ -105,15 +105,15 @@ void mode2RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; gfxBG3Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode2RenderLineNoWindow() @@ -127,12 +127,12 @@ void mode2RenderLineNoWindow() 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); @@ -142,7 +142,7 @@ void mode2RenderLineNoWindow() 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); @@ -181,28 +181,28 @@ void mode2RenderLineNoWindow() 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], @@ -223,12 +223,12 @@ void mode2RenderLineNoWindow() // 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; @@ -248,15 +248,15 @@ void mode2RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; gfxBG3Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode2RenderLineAll() @@ -286,18 +286,18 @@ void mode2RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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); @@ -307,7 +307,7 @@ void mode2RenderLineAll() 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); @@ -325,8 +325,8 @@ void mode2RenderLineAll() for(int x = 0; x < 240; x++) { u32 color = backdrop; u8 top = 0x20; - u8 mask = outMask; - + u8 mask = outMask; + if(!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; } @@ -341,22 +341,22 @@ void mode2RenderLineAll() 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) { @@ -367,32 +367,32 @@ void mode2RenderLineAll() 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]); + coeff[(COLEV >> 8) & 0x1F]); } } break; @@ -409,17 +409,17 @@ void mode2RenderLineAll() // 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], @@ -434,24 +434,24 @@ void mode2RenderLineAll() 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], @@ -466,13 +466,13 @@ void mode2RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } } - + lineMix[x] = color; } gfxBG2Changed = 0; gfxBG3Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } diff --git a/src/Mode3.cpp b/src/Mode3.cpp index 8a87308d..273e8731 100644 --- a/src/Mode3.cpp +++ b/src/Mode3.cpp @@ -23,32 +23,32 @@ void mode3RenderLine() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + 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, + 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; @@ -67,12 +67,12 @@ void mode3RenderLine() // 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], @@ -87,25 +87,25 @@ void mode3RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } - } - + } + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode3RenderLineNoWindow() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -114,18 +114,18 @@ void mode3RenderLineNoWindow() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen16Bit(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, - gfxBG2X, gfxBG2Y, changed, + 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; @@ -149,26 +149,26 @@ void mode3RenderLineNoWindow() 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; @@ -185,12 +185,12 @@ void mode3RenderLineNoWindow() // 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], @@ -205,25 +205,25 @@ void mode3RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } - } - + } + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode3RenderLineAll() { u16 *palette = (u16 *)paletteRAM; - + if(DISPCNT & 0x80) { for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -242,35 +242,35 @@ void mode3RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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, + 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; @@ -290,7 +290,7 @@ void mode3RenderLineAll() mask = inWin0Mask; } } - + if((mask & 4) && (line2[x] < color)) { color = line2[x]; top = 0x04; @@ -311,26 +311,26 @@ void mode3RenderLineAll() 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; @@ -347,12 +347,12 @@ void mode3RenderLineAll() // 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], @@ -367,19 +367,19 @@ void mode3RenderLineAll() 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], @@ -394,12 +394,12 @@ void mode3RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } diff --git a/src/Mode4.cpp b/src/Mode4.cpp index 8e815230..c370b05f 100644 --- a/src/Mode4.cpp +++ b/src/Mode4.cpp @@ -28,7 +28,7 @@ void mode4RenderLine() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -37,7 +37,7 @@ void mode4RenderLine() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y, changed, @@ -47,7 +47,7 @@ void mode4RenderLine() gfxDrawSprites(lineOBJ); u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); - + for(int x = 0; x < 240; x++) { u32 color = backdrop; u8 top = 0x20; @@ -66,12 +66,12 @@ void mode4RenderLine() // 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], @@ -86,14 +86,14 @@ void mode4RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode4RenderLineNoWindow() @@ -104,7 +104,7 @@ void mode4RenderLineNoWindow() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -113,7 +113,7 @@ void mode4RenderLineNoWindow() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen256(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, gfxBG2X, gfxBG2Y, changed, @@ -123,7 +123,7 @@ void mode4RenderLineNoWindow() gfxDrawSprites(lineOBJ); u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); - + for(int x = 0; x < 240; x++) { u32 color = backdrop; u8 top = 0x20; @@ -147,26 +147,26 @@ void mode4RenderLineNoWindow() 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; @@ -183,7 +183,7 @@ void mode4RenderLineNoWindow() // semi-transparent OBJ u32 back = backdrop; u8 top2 = 0x20; - + if(line2[x] < back) { back = line2[x]; top2 = 0x04; @@ -203,14 +203,14 @@ void mode4RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode4RenderLineAll() @@ -221,7 +221,7 @@ void mode4RenderLineAll() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -240,19 +240,19 @@ void mode4RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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, @@ -260,18 +260,18 @@ void mode4RenderLineAll() } gfxDrawSprites(lineOBJ); - gfxDrawOBJWin(lineOBJWin); + 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; + u8 mask = outMask; if(!(lineOBJWin[x] & 0x80000000)) { mask = WINOUT >> 8; @@ -287,7 +287,7 @@ void mode4RenderLineAll() mask = inWin0Mask; } } - + if((mask & 4) && (line2[x] < color)) { color = line2[x]; top = 0x04; @@ -308,26 +308,26 @@ void mode4RenderLineAll() 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; @@ -344,12 +344,12 @@ void mode4RenderLineAll() // 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], @@ -364,19 +364,19 @@ void mode4RenderLineAll() 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], @@ -391,12 +391,12 @@ void mode4RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } + } + } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } diff --git a/src/Mode5.cpp b/src/Mode5.cpp index d3e97102..250a9d62 100644 --- a/src/Mode5.cpp +++ b/src/Mode5.cpp @@ -26,7 +26,7 @@ void mode5RenderLine() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -37,7 +37,7 @@ void mode5RenderLine() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, @@ -48,7 +48,7 @@ void mode5RenderLine() gfxDrawSprites(lineOBJ); u32 background = (READ16LE(&palette[0]) | 0x30000000); - + for(int x = 0; x < 240; x++) { u32 color = background; u8 top = 0x20; @@ -67,12 +67,12 @@ void mode5RenderLine() // 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], @@ -87,14 +87,14 @@ void mode5RenderLine() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } - } - + } + } + } + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode5RenderLineNoWindow() @@ -103,7 +103,7 @@ void mode5RenderLineNoWindow() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -114,7 +114,7 @@ void mode5RenderLineNoWindow() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, @@ -125,7 +125,7 @@ void mode5RenderLineNoWindow() gfxDrawSprites(lineOBJ); u32 background = ( READ16LE(&palette[0]) | 0x30000000); - + for(int x = 0; x < 240; x++) { u32 color = background; u8 top = 0x20; @@ -149,26 +149,26 @@ void mode5RenderLineNoWindow() 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; @@ -185,12 +185,12 @@ void mode5RenderLineNoWindow() // 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], @@ -205,14 +205,14 @@ void mode5RenderLineNoWindow() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } - } - } - + } + } + } + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } void mode5RenderLineAll() @@ -221,7 +221,7 @@ void mode5RenderLineAll() for(int x = 0; x < 240; x++) { lineMix[x] = 0x7fff; } - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; return; } @@ -232,7 +232,7 @@ void mode5RenderLineAll() if(gfxLastVCOUNT > VCOUNT) changed = 3; - + gfxDrawRotScreen16Bit160(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H, BG2PA, BG2PB, BG2PC, BG2PD, @@ -258,19 +258,19 @@ void mode5RenderLineAll() if(layerEnable & 0x4000) { u8 v0 = WIN1V >> 8; u8 v1 = WIN1V & 255; - inWindow1 = ((v0 == v1) && (v0 >= 0xe8)); + 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; @@ -311,26 +311,26 @@ void mode5RenderLineAll() 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; @@ -347,12 +347,12 @@ void mode5RenderLineAll() // 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], @@ -367,19 +367,19 @@ void mode5RenderLineAll() 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], @@ -394,12 +394,12 @@ void mode5RenderLineAll() if(BLDMOD & top) color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]); break; - } + } } } - + lineMix[x] = color; } gfxBG2Changed = 0; - gfxLastVCOUNT = VCOUNT; + gfxLastVCOUNT = VCOUNT; } diff --git a/src/Port.h b/src/Port.h index 3716bf9c..7dffc1d5 100644 --- a/src/Port.h +++ b/src/Port.h @@ -47,10 +47,10 @@ static inline u32 swap32(u32 v) #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))) diff --git a/src/RTC.cpp b/src/RTC.cpp index 9a69ecc5..7767c140 100644 --- a/src/RTC.cpp +++ b/src/RTC.cpp @@ -67,7 +67,7 @@ u16 rtcRead(u32 address) return rtcClockData.byte0; } } - + return READ16LE((&rom[address & 0x1FFFFFE])); } @@ -83,7 +83,7 @@ bool rtcWrite(u32 address, u16 value) { if(!rtcEnabled) return false; - + if(address == 0x80000c8) { rtcClockData.byte2 = (u8)value; // enable ? } else if(address == 0x80000c6) { @@ -95,7 +95,7 @@ bool rtcWrite(u32 address, u16 value) rtcClockData.bits = 0; rtcClockData.command = 0; } else if(!(rtcClockData.byte0 & 1) && (value & 1)) { // bit transfer - rtcClockData.byte0 = (u8)value; + rtcClockData.byte0 = (u8)value; switch(rtcClockData.state) { case COMMAND: rtcClockData.command |= ((value & 2) >> 1) << (7-rtcClockData.bits); @@ -128,7 +128,7 @@ bool rtcWrite(u32 address, u16 value) 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); @@ -139,7 +139,7 @@ bool rtcWrite(u32 address, u16 value) rtcClockData.data[6] = toBCD(newtime->tm_sec); rtcClockData.state = DATA; } - break; + break; case 0x67: { struct tm *newtime; @@ -147,7 +147,7 @@ bool rtcWrite(u32 address, u16 value) 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); @@ -201,7 +201,7 @@ bool rtcWrite(u32 address, u16 value) void rtcReset() { memset(&rtcClockData, 0, sizeof(rtcClockData)); - + rtcClockData.byte0 = 0; rtcClockData.byte1 = 0; rtcClockData.byte2 = 0; diff --git a/src/Sound.cpp b/src/Sound.cpp index 8177ad5e..3449fb34 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -1,1504 +1,1504 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team -// Copyright (C) 2004-2006 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 "Sound.h" - -#include "GBA.h" -#include "Globals.h" -#include "Util.h" - -#include "snd_interp.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 directBuffer[2][735]; -u16 soundFinalWave[1470]; - -int soundBufferLen = 1470; -int soundBufferTotalLen = 14700; -int soundQuality = 2; -int soundInterpolation = 0; -bool soundPaused = true; -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 } -}; - - -// *** Begin snd_interp code - - -// and here is the implementation specific code, in a messier state than the stuff above - -extern bool timer0On; -extern int timer0Reload; -extern int timer0ClockReload; -extern bool timer1On; -extern int timer1Reload; -extern int timer1ClockReload; - -extern int SOUND_CLOCK_TICKS; -extern int soundInterpolation; - -inline double calc_rate(int timer) -{ - if (timer ? timer1On : timer0On) - { - return double(SOUND_CLOCK_TICKS) / - double((0x10000 - (timer ? timer1Reload : timer0Reload)) * - 1 << (timer ? timer1ClockReload : timer0ClockReload)); - } - else - { - return 1.; - } -} - -static foo_interpolate * interp[2]; - -class foo_interpolate_setup -{ -public: - foo_interpolate_setup() - { - for (int i = 0; i < 2; i++) - { - interp[i] = get_filter(0); - } - } - - ~foo_interpolate_setup() - { - for (int i = 0; i < 2; i++) - { - delete interp[i]; - } - } -}; - -static foo_interpolate_setup blah; - -static int interpolation = 0; - -void interp_reset(int ch) -{ - setSoundFn(); - interp[ch]->reset(); - interp_rate(); -} - -void interp_switch(int which) -{ - for (int i = 0; i < 2; i++) - { - delete interp[i]; - interp[i] = get_filter(which); - } - interpolation = which; - interp_rate(); -} - - -void interp_rate() -{ - interp[0]->rate(calc_rate(soundDSATimer)); - interp[1]->rate(calc_rate(soundDSBTimer)); -} - - - -inline void interp_push(int ch, int sample) -{ - interp[ch]->push(sample); -} - -inline int interp_pop(int ch) -{ - return interp[ch]->pop(); -} - -// *** End snd_interp code - - - - -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; - } - ioMem[address] = data; - break; - 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]) = soundControl; - 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; - } - } - } -} - - -extern bool cpuDmaHack2; - -void soundDirectSoundATimer() -{ - if(soundDSAEnabled) { - if(soundDSFifoACount <= 16) { - cpuDmaHack2 = 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]); - interp_push(0, (s8)soundDSAValue << 8); - soundDSFifoAIndex = (++soundDSFifoAIndex) & 31; - soundDSFifoACount--; - } else - soundDSAValue = 0; -} - -void soundDirectSoundA() -{ - directBuffer[0][soundIndex] = interp_pop(0); //soundDSAValue; -} - -void soundDirectSoundB() -{ - directBuffer[1][soundIndex] = interp_pop(1); //soundDSBValue; -} - -void soundDirectSoundBTimer() -{ - if(soundDSBEnabled) { - if(soundDSFifoBCount <= 16) { - cpuDmaHack2 = 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]); - interp_push(1, (s8)soundDSBValue << 8); - 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 = ((s16)directBuffer[0][soundIndex])>>1; - else - res = ((s16)directBuffer[0][soundIndex]); - } - - if((soundControl & 0x2000) && (soundEnableFlag & 0x200)){ - if(!dsbRatio) - res += ((s16)directBuffer[1][soundIndex])>>1; - else - res += ((s16)directBuffer[1][soundIndex]); - } - - res = (res * 170) >> 8; - 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 = ((s16)directBuffer[0][soundIndex])>>1; - else - res = ((s16)directBuffer[0][soundIndex]); - } - - if((soundControl & 0x1000) && (soundEnableFlag & 0x200)){ - if(!dsbRatio) - res += ((s16)directBuffer[1][soundIndex])>>1; - else - res += ((s16)directBuffer[1][soundIndex]); - } - - res = (res * 170) >> 8; - 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; -} - -// soundTick gets called a lot -// if we are operating normally -// call normalSoundTick to avoid -// all the comparison checks. - -void normalsoundTick() -{ - soundChannel1(); - soundChannel2(); - soundChannel3(); - soundChannel4(); - soundDirectSoundA(); - soundDirectSoundB(); - soundMix(); - soundIndex++; - - if(2*soundBufferIndex >= soundBufferLen) - { - systemWriteDataToSoundBuffer(); - soundIndex = 0; - soundBufferIndex = 0; - } -} - - -void soundTick() -{ - if(systemSoundOn) { - if(soundMasterOn && !stopState) { - soundChannel1(); - soundChannel2(); - soundChannel3(); - soundChannel4(); - soundDirectSoundA(); - soundDirectSoundB(); - soundMix(); - } else { - soundFinalWave[soundBufferIndex++] = 0; - soundFinalWave[soundBufferIndex++] = 0; - } - - soundIndex++; - - if(2*soundBufferIndex >= soundBufferLen) { - if(systemSoundOn) { - if(soundPaused) { - soundResume(); - setSoundFn(); - } - - systemWriteDataToSoundBuffer(); - } - soundIndex = 0; - soundBufferIndex = 0; - } - } -} - -void (*psoundTickfn)()=soundTick; - - -void setSoundFn() -{ - if (systemSoundOn && !soundPaused && soundMasterOn) - psoundTickfn = normalsoundTick; - else - psoundTickfn = soundTick; - - if (soundInterpolation != interpolation) - interp_switch(soundInterpolation); - -} - -void setsystemSoundOn(bool value) -{ - systemSoundOn = value; - setSoundFn(); -} - -void setsoundPaused(bool value) -{ - soundPaused = value; - setSoundFn(); -} - -void setsoundMasterOn(bool value) -{ - soundMasterOn = value; - setSoundFn(); -} - - - -void soundShutdown() -{ - systemSoundShutdown(); -} - -void soundPause() -{ - systemSoundPause(); - setsoundPaused(true); -} - -void soundResume() -{ - systemSoundResume(); - setsoundPaused(false); -} - -void soundEnable(int channels) -{ - int c = channels & 0x0f; - - soundEnableFlag |= ((channels & 0x30f) |c | (c << 4)); - if(ioMem) - soundBalance = (ioMem[NR51] & soundEnableFlag); -} - -void soundDisable(int channels) -{ - int c = channels & 0x0f; - - soundEnableFlag &= (~((channels & 0x30f)|c|(c<<4))); - if(ioMem) - soundBalance = (ioMem[NR51] & soundEnableFlag); -} - -int soundGetEnable() -{ - return (soundEnableFlag & 0x30f); -} - -void soundReset() -{ - systemSoundReset(); - - setsoundPaused(true); - soundPlay = 0; - SOUND_CLOCK_TICKS = soundQuality * USE_TICKS_AS; - soundTicks = SOUND_CLOCK_TICKS; - soundNextPosition = 0; - setsoundMasterOn(true); - 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]; -} +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team +// Copyright (C) 2004-2006 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 "Sound.h" + +#include "GBA.h" +#include "Globals.h" +#include "Util.h" + +#include "snd_interp.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 directBuffer[2][735]; +u16 soundFinalWave[1470]; + +int soundBufferLen = 1470; +int soundBufferTotalLen = 14700; +int soundQuality = 2; +int soundInterpolation = 0; +bool soundPaused = true; +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 } +}; + + +// *** Begin snd_interp code + + +// and here is the implementation specific code, in a messier state than the stuff above + +extern bool timer0On; +extern int timer0Reload; +extern int timer0ClockReload; +extern bool timer1On; +extern int timer1Reload; +extern int timer1ClockReload; + +extern int SOUND_CLOCK_TICKS; +extern int soundInterpolation; + +inline double calc_rate(int timer) +{ + if (timer ? timer1On : timer0On) + { + return double(SOUND_CLOCK_TICKS) / + double((0x10000 - (timer ? timer1Reload : timer0Reload)) * + 1 << (timer ? timer1ClockReload : timer0ClockReload)); + } + else + { + return 1.; + } +} + +static foo_interpolate * interp[2]; + +class foo_interpolate_setup +{ +public: + foo_interpolate_setup() + { + for (int i = 0; i < 2; i++) + { + interp[i] = get_filter(0); + } + } + + ~foo_interpolate_setup() + { + for (int i = 0; i < 2; i++) + { + delete interp[i]; + } + } +}; + +static foo_interpolate_setup blah; + +static int interpolation = 0; + +void interp_reset(int ch) +{ + setSoundFn(); + interp[ch]->reset(); + interp_rate(); +} + +void interp_switch(int which) +{ + for (int i = 0; i < 2; i++) + { + delete interp[i]; + interp[i] = get_filter(which); + } + interpolation = which; + interp_rate(); +} + + +void interp_rate() +{ + interp[0]->rate(calc_rate(soundDSATimer)); + interp[1]->rate(calc_rate(soundDSBTimer)); +} + + + +inline void interp_push(int ch, int sample) +{ + interp[ch]->push(sample); +} + +inline int interp_pop(int ch) +{ + return interp[ch]->pop(); +} + +// *** End snd_interp code + + + + +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; + } + ioMem[address] = data; + break; + 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]) = soundControl; + 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; + } + } + } +} + + +extern bool cpuDmaHack2; + +void soundDirectSoundATimer() +{ + if(soundDSAEnabled) { + if(soundDSFifoACount <= 16) { + cpuDmaHack2 = 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]); + interp_push(0, (s8)soundDSAValue << 8); + soundDSFifoAIndex = (++soundDSFifoAIndex) & 31; + soundDSFifoACount--; + } else + soundDSAValue = 0; +} + +void soundDirectSoundA() +{ + directBuffer[0][soundIndex] = interp_pop(0); //soundDSAValue; +} + +void soundDirectSoundB() +{ + directBuffer[1][soundIndex] = interp_pop(1); //soundDSBValue; +} + +void soundDirectSoundBTimer() +{ + if(soundDSBEnabled) { + if(soundDSFifoBCount <= 16) { + cpuDmaHack2 = 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]); + interp_push(1, (s8)soundDSBValue << 8); + 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 = ((s16)directBuffer[0][soundIndex])>>1; + else + res = ((s16)directBuffer[0][soundIndex]); + } + + if((soundControl & 0x2000) && (soundEnableFlag & 0x200)){ + if(!dsbRatio) + res += ((s16)directBuffer[1][soundIndex])>>1; + else + res += ((s16)directBuffer[1][soundIndex]); + } + + res = (res * 170) >> 8; + 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 = ((s16)directBuffer[0][soundIndex])>>1; + else + res = ((s16)directBuffer[0][soundIndex]); + } + + if((soundControl & 0x1000) && (soundEnableFlag & 0x200)){ + if(!dsbRatio) + res += ((s16)directBuffer[1][soundIndex])>>1; + else + res += ((s16)directBuffer[1][soundIndex]); + } + + res = (res * 170) >> 8; + 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; +} + +// soundTick gets called a lot +// if we are operating normally +// call normalSoundTick to avoid +// all the comparison checks. + +void normalsoundTick() +{ + soundChannel1(); + soundChannel2(); + soundChannel3(); + soundChannel4(); + soundDirectSoundA(); + soundDirectSoundB(); + soundMix(); + soundIndex++; + + if(2*soundBufferIndex >= soundBufferLen) + { + systemWriteDataToSoundBuffer(); + soundIndex = 0; + soundBufferIndex = 0; + } +} + + +void soundTick() +{ + if(systemSoundOn) { + if(soundMasterOn && !stopState) { + soundChannel1(); + soundChannel2(); + soundChannel3(); + soundChannel4(); + soundDirectSoundA(); + soundDirectSoundB(); + soundMix(); + } else { + soundFinalWave[soundBufferIndex++] = 0; + soundFinalWave[soundBufferIndex++] = 0; + } + + soundIndex++; + + if(2*soundBufferIndex >= soundBufferLen) { + if(systemSoundOn) { + if(soundPaused) { + soundResume(); + setSoundFn(); + } + + systemWriteDataToSoundBuffer(); + } + soundIndex = 0; + soundBufferIndex = 0; + } + } +} + +void (*psoundTickfn)()=soundTick; + + +void setSoundFn() +{ + if (systemSoundOn && !soundPaused && soundMasterOn) + psoundTickfn = normalsoundTick; + else + psoundTickfn = soundTick; + + if (soundInterpolation != interpolation) + interp_switch(soundInterpolation); + +} + +void setsystemSoundOn(bool value) +{ + systemSoundOn = value; + setSoundFn(); +} + +void setsoundPaused(bool value) +{ + soundPaused = value; + setSoundFn(); +} + +void setsoundMasterOn(bool value) +{ + soundMasterOn = value; + setSoundFn(); +} + + + +void soundShutdown() +{ + systemSoundShutdown(); +} + +void soundPause() +{ + systemSoundPause(); + setsoundPaused(true); +} + +void soundResume() +{ + systemSoundResume(); + setsoundPaused(false); +} + +void soundEnable(int channels) +{ + int c = channels & 0x0f; + + soundEnableFlag |= ((channels & 0x30f) |c | (c << 4)); + if(ioMem) + soundBalance = (ioMem[NR51] & soundEnableFlag); +} + +void soundDisable(int channels) +{ + int c = channels & 0x0f; + + soundEnableFlag &= (~((channels & 0x30f)|c|(c<<4))); + if(ioMem) + soundBalance = (ioMem[NR51] & soundEnableFlag); +} + +int soundGetEnable() +{ + return (soundEnableFlag & 0x30f); +} + +void soundReset() +{ + systemSoundReset(); + + setsoundPaused(true); + soundPlay = 0; + SOUND_CLOCK_TICKS = soundQuality * USE_TICKS_AS; + soundTicks = SOUND_CLOCK_TICKS; + soundNextPosition = 0; + setsoundMasterOn(true); + 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 index 43d633b4..a6799b97 100644 --- a/src/Sound.h +++ b/src/Sound.h @@ -1,90 +1,90 @@ -// -*- C++ -*- -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team -// Copyright (C) 2004-2006 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 - -#include "System.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 setSoundFn(); -extern void (*psoundTickfn)(); -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 void setsystemSoundOn(bool value); -extern void setsoundPaused(bool value); -extern void setsoundMasterOn(bool value); -extern void interp_rate(); - -extern int SOUND_CLOCK_TICKS; -extern int soundTicks; -extern bool soundOffFlag; -extern bool soundPaused; -extern int soundQuality; -extern int soundBufferLen; -extern int soundBufferTotalLen; -extern u32 soundNextPosition; -extern u16 soundFinalWave[1470]; -extern int soundVolume; -extern int soundInterpolation; - -extern bool soundEcho; -extern bool soundLowPass; -extern bool soundReverse; - -#endif // VBA_SOUND_H +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team +// Copyright (C) 2004-2006 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 + +#include "System.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 setSoundFn(); +extern void (*psoundTickfn)(); +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 void setsystemSoundOn(bool value); +extern void setsoundPaused(bool value); +extern void setsoundMasterOn(bool value); +extern void interp_rate(); + +extern int SOUND_CLOCK_TICKS; +extern int soundTicks; +extern bool soundOffFlag; +extern bool soundPaused; +extern int soundQuality; +extern int soundBufferLen; +extern int soundBufferTotalLen; +extern u32 soundNextPosition; +extern u16 soundFinalWave[1470]; +extern int soundVolume; +extern int soundInterpolation; + +extern bool soundEcho; +extern bool soundLowPass; +extern bool soundReverse; + +#endif // VBA_SOUND_H diff --git a/src/System.h b/src/System.h index 21dc21cc..6a550b1d 100644 --- a/src/System.h +++ b/src/System.h @@ -58,7 +58,7 @@ struct EmulatedSystem { // write battery file bool (*emuWriteBattery)(const char *); // load state - bool (*emuReadState)(const char *); + bool (*emuReadState)(const char *); // save state bool (*emuWriteState)(const char *); // load memory state (rewind) diff --git a/src/Text.cpp b/src/Text.cpp index 811a12c3..cf4e68f5 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -35,7 +35,7 @@ static const u8 fontdata2[2048] = { 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 drawTextInternal(u8 *screen, int pitch, int x, int y, +static void drawTextInternal(u8 *screen, int pitch, int x, int y, const char *string, bool trans) { screen += y*pitch; @@ -56,14 +56,14 @@ static void drawTextInternal(u8 *screen, int pitch, int x, int y, while(*string) { char c = *string++; u8 *scr = screen; - + u16 mask = ~RGB_LOW_BITS_MASK; int h, w; u16 *s = (u16 *)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s++) { int on = (fontdata2[(c<<3)+h]>>w)&1; - + if(trans) { if(on) *s = ((0xf) << systemRedShift) + @@ -85,13 +85,13 @@ static void drawTextInternal(u8 *screen, int pitch, int x, int y, while(*string) { char c = *string++; u8 *scr = screen; - + int h, w; u8 *s = (u8 *)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s+=3) { int on = (fontdata2[(c<<3)+h]>>w)&1; - + if(trans) { if(on) { u32 color = (0x1f) << systemRedShift; @@ -114,20 +114,20 @@ static void drawTextInternal(u8 *screen, int pitch, int x, int y, screen += inc*8; } } - break; + break; case 32: { while(*string) { char c = *string++; u8 *scr = screen; - + int h, w; u32 mask = 0xfefefe; u32 *s = (u32 *)scr; for (h = 0; h < 8; h++) { for (w = 0; w < 8; w++, s++) { int on = (fontdata2[(c<<3)+h]>>w)&1; - + if(trans) { if(on) *s = ((0xf) << systemRedShift) + ((*s & mask)>>1); @@ -142,7 +142,7 @@ static void drawTextInternal(u8 *screen, int pitch, int x, int y, screen += inc*8; } } - break; + break; } } diff --git a/src/Util.cpp b/src/Util.cpp index 2b473277..11bce0c8 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -1,1185 +1,1185 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004-2006 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 -} - -#ifdef HAS_FILE_EXTRACTOR -#include -#include -#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, u8 *pix) -{ - u8 *b = (u8 *)buf; - - 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); - } - } - 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; -} - -#ifdef HAS_FILE_EXTRACTOR - -bool utilIs7ZipFile(const char *file) -{ - if(strlen(file) > 3) { - const char * p = strrchr(file,'.'); - - if(p != NULL) { - if(_stricmp(p, ".7z") == 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]; -#ifdef HAS_FILE_EXTRACTOR - int type = -1; - if (utilIsZipFile(file)) type = 0; - else if (utilIs7ZipFile(file)) type = 1; - - if(type >= 0) { - - Std_File_Reader in; - File_Extractor * ex = 0; - - switch (type) { - case 0: ex = new Zip_Extractor; break; - case 1: ex = new Zip7_Extractor; break; - default: type = -1; break; - } - - if (!ex) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "archive extractor"); - return IMAGE_UNKNOWN; - } - - if(in.open(file) != NULL) { - delete ex; - systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); - return IMAGE_UNKNOWN; - } - - if(ex->open(&in) != NULL) { - delete ex; - systemMessage(MSG_BAD_ZIP_FILE, N_("Bad archive file %s"), file); - return IMAGE_UNKNOWN; - } - - ex->scan_only(); - - IMAGE_TYPE found = IMAGE_UNKNOWN; - - while(!ex->done()) { - if(utilIsGBAImage(ex->name())) { - found = IMAGE_GBA; - break; - } - - if(utilIsGBImage(ex->name())) { - found = IMAGE_GB; - break; - } - - if(ex->next() != NULL) - break; - } - delete ex; - - if(found == IMAGE_UNKNOWN) { - systemMessage(MSG_NO_IMAGE_ON_ZIP, - N_("No image found on archive file %s"), file); - return found; - } - return found; - -#else - 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; -#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; -} - -#ifdef HAS_FILE_EXTRACTOR -static u8 *utilLoadFromFE(const char *file, - int type, - bool (*accept)(const char *), - u8 *data, - int &size) -{ - Std_File_Reader in; - File_Extractor * ex = 0; - - switch (type) { - case 0: ex = new Zip_Extractor; break; - case 1: ex = new Zip7_Extractor; break; - default: type = -1; break; - } - - if (!ex) { - if (type >= 0) { - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "data"); - } - return NULL; - } - - if(in.open(file) != NULL) { - delete ex; - systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); - return NULL; - } - - if(ex->open(&in) != NULL) { - delete ex; - systemMessage(MSG_BAD_ZIP_FILE, N_("Bad archive file %s"), file); - return NULL; - } - - bool found = false; - - while(!ex->done()) { - if(accept(ex->name())) { - found = true; - break; - } - - if(ex->next() != NULL) - break; - } - - if(!found) { - delete ex; - systemMessage(MSG_NO_IMAGE_ON_ZIP, - N_("No image found on archive file %s"), file); - return NULL; - } - - int fileSize = ex->size(); - if(size == 0 || data == NULL) - size = fileSize; - int read = fileSize <= size ? fileSize : size; - - u8 *image = data; - if(image == NULL) - { - image = (u8 *)malloc(utilGetSize(size)); - if(image == NULL) { - delete ex; - systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), - "data"); - return NULL; - } - } - Mem_Writer mwimage(image, size, 1); - const char * err = ex->extract(mwimage); - - if(err != NULL) { - systemMessage(MSG_ERROR_READING_IMAGE, - N_("Error reading image %s"), ex->name()); - delete ex; - if (data==NULL) - free(image); - return NULL; - } - delete ex; - size = fileSize; - return image; -} -#else -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; -} -#endif - -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; -} - -u8 *utilLoad(const char *file, - bool (*accept)(const char *), - u8 *data, - int &size) -{ -#ifdef HAS_FILE_EXTRACTOR - int type = -1; - if (utilIsZipFile(file)) type = 0; - else if (utilIs7ZipFile(file)) type = 1; - - if(type>=0) { - return utilLoadFromFE(file, type, accept, data, size); -#else - if(utilIsZipFile(file)) { - return utilLoadFromZip(file, accept, data, size); -#endif - } - if(utilIsGzipFile(file)) { - return utilLoadGzipFile(file, accept, data, size); - } - - 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; - } - size_t read = fileSize <= size ? fileSize : size; - size_t r = fread(image, 1, read, f); - fclose(f); - - if(r != 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 utilMemGzOpen(char *memory, int available, const 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 = 3; - } - } else if (d == 0x4D415253) { - if(memcmp(p, "SRAM_", 5) == 0) { - if(saveType == 0) - saveType = 1; - } - } else if (d == 0x53414C46) { - if(memcmp(p, "FLASH1M_", 8) == 0) { - if(saveType == 0) { - saveType = 2; - flashSize = 0x20000; - } - } else if(memcmp(p, "FLASH", 5) == 0) { - if(saveType == 0) { - saveType = 2; - 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; - } -} +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004-2006 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 +} + +#ifdef HAS_FILE_EXTRACTOR +#include +#include +#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, u8 *pix) +{ + u8 *b = (u8 *)buf; + + 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); + } + } + 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; +} + +#ifdef HAS_FILE_EXTRACTOR + +bool utilIs7ZipFile(const char *file) +{ + if(strlen(file) > 3) { + const char * p = strrchr(file,'.'); + + if(p != NULL) { + if(_stricmp(p, ".7z") == 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]; +#ifdef HAS_FILE_EXTRACTOR + int type = -1; + if (utilIsZipFile(file)) type = 0; + else if (utilIs7ZipFile(file)) type = 1; + + if(type >= 0) { + + Std_File_Reader in; + File_Extractor * ex = 0; + + switch (type) { + case 0: ex = new Zip_Extractor; break; + case 1: ex = new Zip7_Extractor; break; + default: type = -1; break; + } + + if (!ex) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "archive extractor"); + return IMAGE_UNKNOWN; + } + + if(in.open(file) != NULL) { + delete ex; + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); + return IMAGE_UNKNOWN; + } + + if(ex->open(&in) != NULL) { + delete ex; + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad archive file %s"), file); + return IMAGE_UNKNOWN; + } + + ex->scan_only(); + + IMAGE_TYPE found = IMAGE_UNKNOWN; + + while(!ex->done()) { + if(utilIsGBAImage(ex->name())) { + found = IMAGE_GBA; + break; + } + + if(utilIsGBImage(ex->name())) { + found = IMAGE_GB; + break; + } + + if(ex->next() != NULL) + break; + } + delete ex; + + if(found == IMAGE_UNKNOWN) { + systemMessage(MSG_NO_IMAGE_ON_ZIP, + N_("No image found on archive file %s"), file); + return found; + } + return found; + +#else + 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; +#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; +} + +#ifdef HAS_FILE_EXTRACTOR +static u8 *utilLoadFromFE(const char *file, + int type, + bool (*accept)(const char *), + u8 *data, + int &size) +{ + Std_File_Reader in; + File_Extractor * ex = 0; + + switch (type) { + case 0: ex = new Zip_Extractor; break; + case 1: ex = new Zip7_Extractor; break; + default: type = -1; break; + } + + if (!ex) { + if (type >= 0) { + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "data"); + } + return NULL; + } + + if(in.open(file) != NULL) { + delete ex; + systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s"), file); + return NULL; + } + + if(ex->open(&in) != NULL) { + delete ex; + systemMessage(MSG_BAD_ZIP_FILE, N_("Bad archive file %s"), file); + return NULL; + } + + bool found = false; + + while(!ex->done()) { + if(accept(ex->name())) { + found = true; + break; + } + + if(ex->next() != NULL) + break; + } + + if(!found) { + delete ex; + systemMessage(MSG_NO_IMAGE_ON_ZIP, + N_("No image found on archive file %s"), file); + return NULL; + } + + int fileSize = ex->size(); + if(size == 0 || data == NULL) + size = fileSize; + int read = fileSize <= size ? fileSize : size; + + u8 *image = data; + if(image == NULL) + { + image = (u8 *)malloc(utilGetSize(size)); + if(image == NULL) { + delete ex; + systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), + "data"); + return NULL; + } + } + Mem_Writer mwimage(image, size, 1); + const char * err = ex->extract(mwimage); + + if(err != NULL) { + systemMessage(MSG_ERROR_READING_IMAGE, + N_("Error reading image %s"), ex->name()); + delete ex; + if (data==NULL) + free(image); + return NULL; + } + delete ex; + size = fileSize; + return image; +} +#else +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; +} +#endif + +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; +} + +u8 *utilLoad(const char *file, + bool (*accept)(const char *), + u8 *data, + int &size) +{ +#ifdef HAS_FILE_EXTRACTOR + int type = -1; + if (utilIsZipFile(file)) type = 0; + else if (utilIs7ZipFile(file)) type = 1; + + if(type>=0) { + return utilLoadFromFE(file, type, accept, data, size); +#else + if(utilIsZipFile(file)) { + return utilLoadFromZip(file, accept, data, size); +#endif + } + if(utilIsGzipFile(file)) { + return utilLoadGzipFile(file, accept, data, size); + } + + 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; + } + size_t read = fileSize <= size ? fileSize : size; + size_t r = fread(image, 1, read, f); + fclose(f); + + if(r != 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 utilMemGzOpen(char *memory, int available, const 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 = 3; + } + } else if (d == 0x4D415253) { + if(memcmp(p, "SRAM_", 5) == 0) { + if(saveType == 0) + saveType = 1; + } + } else if (d == 0x53414C46) { + if(memcmp(p, "FLASH1M_", 8) == 0) { + if(saveType == 0) { + saveType = 2; + flashSize = 0x20000; + } + } else if(memcmp(p, "FLASH", 5) == 0) { + if(saveType == 0) { + saveType = 2; + 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/admame.cpp b/src/admame.cpp index bdde667f..b6792c2a 100644 --- a/src/admame.cpp +++ b/src/admame.cpp @@ -63,14 +63,14 @@ static void internal_scale2x_16_def(u16 *dst, const u16* src0, const u16* src1, 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]; @@ -83,7 +83,7 @@ static void internal_scale2x_32_def(u32* dst, const u32* src0, const u32* src1, const u32* src2, - unsigned count) + unsigned count) { /* first pixel */ dst[0] = src1[0]; @@ -95,7 +95,7 @@ static void internal_scale2x_32_def(u32* dst, ++src1; ++src2; dst += 2; - + /* central pixels */ count -= 2; while (count) { @@ -106,14 +106,14 @@ static void internal_scale2x_32_def(u32* dst, 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]; @@ -127,7 +127,7 @@ static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* /* always do the first and last run */ count -= 2*4; -#ifdef __GNUC__ +#ifdef __GNUC__ __asm__ __volatile__( /* first run */ /* set the current, current_pre, current_next registers */ @@ -317,7 +317,7 @@ static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* mov ecx, src2; mov edx, dst; mov esi, count; - + /* first run */ /* set the current, current_pre, current_next registers */ movq mm0, qword ptr [ebx]; @@ -437,7 +437,7 @@ static void internal_scale2x_16_mmx_single(u16* dst, const u16* src0, const u16* add ebx,8; add ecx,8; add edx,16; - + dec esi; jnz label0; label1: @@ -699,7 +699,7 @@ static void internal_scale2x_32_mmx_single(u32* dst, const u32* src0, const u32* mov ecx, src2; mov edx, dst; mov esi, count; - + /* first run */ /* set the current, current_pre, current_next registers */ movq mm0,qword ptr [ebx]; @@ -762,7 +762,7 @@ static void internal_scale2x_32_mmx_single(u32* dst, const u32* src0, const u32* 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]; @@ -822,7 +822,7 @@ label0: dec esi; jnz label0; label1: - + /* final run */ /* set the current, current_pre, current_next registers */ movq mm1,qword ptr [ebx]; @@ -904,14 +904,14 @@ void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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; @@ -931,7 +931,7 @@ void AdMame2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, #endif internal_scale2x_16_def(dst0, src0, src0, src1, width); internal_scale2x_16_def(dst1, src1, src0, src0, width); - + int count = height; count -= 2; @@ -959,14 +959,14 @@ void AdMame2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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; @@ -986,7 +986,7 @@ void AdMame2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, #endif internal_scale2x_32_def(dst0, src0, src0, src1, width); internal_scale2x_32_def(dst1, src1, src0, src0, width); - + int count = height; count -= 2; diff --git a/src/agbprint.cpp b/src/agbprint.cpp index 0eba4543..9b3ba566 100644 --- a/src/agbprint.cpp +++ b/src/agbprint.cpp @@ -68,7 +68,7 @@ bool agbPrintIsEnabled() } extern void (*dbgOutput)(const char *, u32); - + void agbPrintFlush() { u16 get = debuggerReadHalfWord(0x9fe20fc); @@ -78,7 +78,7 @@ void agbPrintFlush() 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); + debuggerWriteHalfWord(0x9fe20fc, put); return; } diff --git a/src/arm-new.h b/src/arm-new.h index 0a1daaff..014c14dd 100644 --- a/src/arm-new.h +++ b/src/arm-new.h @@ -442,7 +442,7 @@ C_FLAG = (Flags >> 25) & 1; \ V_FLAG = (Flags >> 26) & 1; \ } - + #define LOGICAL_LSL_REG \ {\ u32 v = reg[opcode & 0x0f].I;\ @@ -666,14 +666,14 @@ asm("ror %%cl, %%eax;"\ "setcb %%cl;"\ : "=a" (value), "=c" (C_OUT)\ - : "a" (reg[opcode & 0x0f].I), "c" (shift)); + : "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)); + : "a" (reg[opcode & 0x0f].I)); #define LOGICAL_ROR_IMM \ asm("ror %%cl, %%eax;"\ @@ -702,14 +702,14 @@ asm("\ ror %%cl, %%eax;"\ : "=a" (value)\ - : "a" (reg[opcode & 0x0f].I), "c" (shift)); + : "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)); + : "a" (reg[opcode & 0x0f].I)); #define ARITHMETIC_ROR_IMM \ asm("\ @@ -2410,13 +2410,13 @@ if(cond == 0x0e) { cond_res = true; } else { - switch(cond) { - case 0x00: // EQ + switch(cond) { + case 0x00: // EQ cond_res = Z_FLAG; break; case 0x01: // NE cond_res = !Z_FLAG; - break; + break; case 0x02: // CS cond_res = C_FLAG; break; @@ -2449,12 +2449,12 @@ break; case 0x0C: // GT cond_res = !Z_FLAG &&(N_FLAG == V_FLAG); - break; + break; case 0x0D: // LE cond_res = Z_FLAG || (N_FLAG != V_FLAG); - break; - case 0x0E: - cond_res = true; + break; + case 0x0E: + cond_res = true; break; case 0x0F: default: @@ -2463,7 +2463,7 @@ break; } } - + if(cond_res) { switch(((opcode>>16)&0xFF0) | ((opcode>>4)&0x0F)) { LOGICAL_DATA_OPCODE_WITHOUT_base(OP_AND, OP_AND, 0x000); @@ -2473,7 +2473,7 @@ if(cond_res) { // MUL Rd, Rm, Rs int dest = (opcode >> 16) & 0x0F; int mult = (opcode & 0x0F); - clockTicks = 1; + clockTicks = 1; u32 rs = reg[(opcode >> 8) & 0x0F].I; reg[dest].I = reg[mult].I * rs; if(((s32)rs)<0) @@ -3605,7 +3605,7 @@ if(cond_res) { clockTicks = 2; u32 umult = reg[(opcode & 0x0F)].I; u32 usource = reg[(opcode >> 8) & 0x0F].I; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u64 uTemp = ((u64)umult)*((u64)usource); reg[destLo].I = (u32)uTemp; @@ -3629,7 +3629,7 @@ if(cond_res) { clockTicks = 2; u32 umult = reg[(opcode & 0x0F)].I; u32 usource = reg[(opcode >> 8) & 0x0F].I; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u64 uTemp = ((u64)umult)*((u64)usource); reg[destLo].I = (u32)uTemp; @@ -3657,7 +3657,7 @@ if(cond_res) { clockTicks = 3; u32 umult = reg[(opcode & 0x0F)].I; u32 usource = reg[(opcode >> 8) & 0x0F].I; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u64 uTemp = (u64)reg[destHi].I; uTemp <<= 32; @@ -3684,7 +3684,7 @@ if(cond_res) { clockTicks = 3; u32 umult = reg[(opcode & 0x0F)].I; u32 usource = reg[(opcode >> 8) & 0x0F].I; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u64 uTemp = (u64)reg[destHi].I; uTemp <<= 32; @@ -3713,7 +3713,7 @@ if(cond_res) { { // SMULL RdLo, RdHi, Rm, Rs clockTicks = 2; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u32 rs = reg[(opcode >> 8) & 0x0F].I; s64 m = (s32)reg[(opcode & 0x0F)].I; @@ -3740,7 +3740,7 @@ if(cond_res) { { // SMULLS RdLo, RdHi, Rm, Rs clockTicks = 2; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u32 rs = reg[(opcode >> 8) & 0x0F].I; s64 m = (s32)reg[(opcode & 0x0F)].I; @@ -3771,7 +3771,7 @@ if(cond_res) { { // SMLAL RdLo, RdHi, Rm, Rs clockTicks = codeTicksAccess32(armNextPC) + 4; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u32 rs = reg[(opcode >> 8) & 0x0F].I; s64 m = (s32)reg[(opcode & 0x0F)].I; @@ -3800,7 +3800,7 @@ if(cond_res) { { // SMLALS RdLo, RdHi, Rm, Rs clockTicks = codeTicksAccess32(armNextPC) + 4; - int destLo = (opcode >> 12) & 0x0F; + int destLo = (opcode >> 12) & 0x0F; int destHi = (opcode >> 16) & 0x0F; u32 rs = reg[(opcode >> 8) & 0x0F].I; s64 m = (s32)reg[(opcode & 0x0F)].I; @@ -4030,7 +4030,7 @@ if(cond_res) { } break; CASE_16(0x400) - // T versions shouldn't be different on GBA + // T versions shouldn't be different on GBA CASE_16(0x420) { // STR Rd, [Rn], -# @@ -4310,7 +4310,7 @@ if(cond_res) { } break; CASE_16(0x440) - // T versions shouldn't be different on GBA + // T versions shouldn't be different on GBA CASE_16(0x460) { // STRB Rd, [Rn], -# @@ -4825,7 +4825,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I - offset; - reg[base].I = address; + reg[base].I = address; CPUWriteMemory(address, reg[dest].I); clockTicks = 2 + dataTicksAccess32(address) + codeTicksAccess32(armNextPC); @@ -4870,7 +4870,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I - value; - reg[base].I = address; + reg[base].I = address; CPUWriteMemory(address, reg[dest].I); clockTicks = 2 + dataTicksAccess32(address) + codeTicksAccess32(armNextPC); @@ -4977,7 +4977,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I + offset; - reg[base].I = address; + reg[base].I = address; CPUWriteMemory(address, reg[dest].I); clockTicks = 2 + dataTicksAccess32(address) + codeTicksAccess32(armNextPC); @@ -5022,7 +5022,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I + value; - reg[base].I = address; + reg[base].I = address; CPUWriteMemory(address, reg[dest].I); clockTicks = 2 + dataTicksAccess32(address) + codeTicksAccess32(armNextPC); @@ -5424,7 +5424,7 @@ if(cond_res) { u32 address = reg[base].I - offset; reg[dest].I = CPUReadMemory(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -5487,7 +5487,7 @@ if(cond_res) { u32 address = reg[base].I - value; reg[dest].I = CPUReadMemory(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -5644,7 +5644,7 @@ if(cond_res) { u32 address = reg[base].I + offset; reg[dest].I = CPUReadMemory(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -6001,7 +6001,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I - offset; - reg[base].I = address; + reg[base].I = address; CPUWriteByte(address, reg[dest].B.B0); clockTicks = 2 + dataTicksAccess16(address) + codeTicksAccess32(armNextPC); @@ -6046,7 +6046,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I - value; - reg[base].I = address; + reg[base].I = address; CPUWriteByte(address, reg[dest].B.B0); clockTicks = 2 + dataTicksAccess16(address) + codeTicksAccess32(armNextPC); @@ -6153,7 +6153,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I + offset; - reg[base].I = address; + reg[base].I = address; CPUWriteByte(address, reg[dest].B.B0); clockTicks = 2 + dataTicksAccess16(address) + codeTicksAccess32(armNextPC); @@ -6198,7 +6198,7 @@ if(cond_res) { int dest = (opcode >> 12) & 15; int base = (opcode >> 16) & 15; u32 address = reg[base].I + value; - reg[base].I = address; + reg[base].I = address; CPUWriteByte(address, reg[dest].B.B0); clockTicks = 2 + dataTicksAccess16(address) + codeTicksAccess32(armNextPC); @@ -6600,7 +6600,7 @@ if(cond_res) { u32 address = reg[base].I - offset; reg[dest].I = CPUReadByte(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -6663,7 +6663,7 @@ if(cond_res) { u32 address = reg[base].I - value; reg[dest].I = CPUReadByte(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -6820,7 +6820,7 @@ if(cond_res) { u32 address = reg[base].I + offset; reg[dest].I = CPUReadByte(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -6883,7 +6883,7 @@ if(cond_res) { u32 address = reg[base].I + value; reg[dest].I = CPUReadByte(address); if(dest != base) - reg[base].I = address; + reg[base].I = address; clockTicks = 0; if(dest == 15) { reg[15].I &= 0xFFFFFFFC; @@ -6919,14 +6919,14 @@ if(cond_res) { }\ address += 4;\ } - + CASE_16(0x800) { // STMDA Rn, {Rlist} if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp + 4) & 0xFFFFFFFC; int offset = 0; @@ -6961,7 +6961,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp+4) & 0xFFFFFFFC; int offset = 0; @@ -6998,7 +6998,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp+4) & 0xFFFFFFFC; int offset = 0; @@ -7050,7 +7050,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp+4) & 0xFFFFFFFC; int offset = 0; @@ -7097,7 +7097,7 @@ if(cond_res) { clockTicks += 1 + codeTicksAccess32(armNextPC); } break; - + CASE_16(0x880) { // STMIA Rn, {Rlist} @@ -7194,7 +7194,7 @@ if(cond_res) { STM_REG(512, 9); STM_REG(1024, 10); STM_REG(2048, 11); - STM_REG(4096, 12); + STM_REG(4096, 12); } if(armMode != 0x10 && armMode != 0x1f) { STM_REG(8192, R13_USR); @@ -7222,7 +7222,7 @@ if(cond_res) { u32 address = reg[base].I & 0xFFFFFFFC; int offset = 0; u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + - cpuBitsSet[(opcode >> 8) & 255]); + cpuBitsSet[(opcode >> 8) & 255]); STMW_REG(1, 0); STMW_REG(2, 1); STMW_REG(4, 2); @@ -7242,7 +7242,7 @@ if(cond_res) { STMW_REG(512, 9); STMW_REG(1024, 10); STMW_REG(2048, 11); - STMW_REG(4096, 12); + STMW_REG(4096, 12); } if(armMode != 0x10 && armMode != 0x1f) { STMW_REG(8192, R13_USR); @@ -7262,14 +7262,14 @@ if(cond_res) { clockTicks += 1 + codeTicksAccess32(armNextPC); } break; - + CASE_16(0x900) { // STMDB Rn, {Rlist} if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; int offset = 0; @@ -7304,7 +7304,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; int offset = 0; @@ -7341,7 +7341,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; int offset = 0; @@ -7393,7 +7393,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; int offset = 0; @@ -7537,7 +7537,7 @@ if(cond_res) { STM_REG(512, 9); STM_REG(1024, 10); STM_REG(2048, 11); - STM_REG(4096, 12); + STM_REG(4096, 12); } if(armMode != 0x10 && armMode != 0x1f) { STM_REG(8192, R13_USR); @@ -7565,7 +7565,7 @@ if(cond_res) { u32 address = (reg[base].I+4) & 0xFFFFFFFC; int offset = 0; u32 temp = reg[base].I + 4*(cpuBitsSet[opcode & 0xFF] + - cpuBitsSet[(opcode >> 8) & 255]); + cpuBitsSet[(opcode >> 8) & 255]); STMW_REG(1, 0); STMW_REG(2, 1); STMW_REG(4, 2); @@ -7585,7 +7585,7 @@ if(cond_res) { STMW_REG(512, 9); STMW_REG(1024, 10); STMW_REG(2048, 11); - STMW_REG(4096, 12); + STMW_REG(4096, 12); } if(armMode != 0x10 && armMode != 0x1f) { STMW_REG(8192, R13_USR); @@ -7605,7 +7605,7 @@ if(cond_res) { clockTicks += 1 + codeTicksAccess32(armNextPC); } break; - + #define LDM_REG(val,num) \ if(opcode & (val)) {\ reg[(num)].I = CPUReadMemory(address);\ @@ -7624,7 +7624,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp + 4) & 0xFFFFFFFC; clockTicks = 0; @@ -7664,7 +7664,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp + 4) & 0xFFFFFFFC; clockTicks = 0; @@ -7707,7 +7707,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp + 4) & 0xFFFFFFFC; clockTicks = 0; @@ -7787,7 +7787,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (temp + 4) & 0xFFFFFFFC; clockTicks = 0; @@ -7811,7 +7811,7 @@ if(cond_res) { reg[15].I = CPUReadMemory(address); - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; CPUSwitchMode(reg[17].I & 0x1f, false); @@ -7856,7 +7856,7 @@ if(cond_res) { LDM_REG(16384, 14); } - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; if (!offset) clockTicks += 1 + dataTicksAccess32(address); @@ -7867,7 +7867,7 @@ if(cond_res) { clockTicks += 2 + codeTicksAccess32(armNextPC); } break; - + CASE_16(0x890) { // LDMIA Rn, {Rlist} @@ -7913,7 +7913,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I + + u32 temp = reg[base].I + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = reg[base].I & 0xFFFFFFFC; clockTicks = 0; @@ -8058,7 +8058,7 @@ if(cond_res) { reg[15].I = CPUReadMemory(address); - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; CPUSwitchMode(reg[17].I & 0x1f, false); @@ -8103,7 +8103,7 @@ if(cond_res) { LDM_REG(16384, 14); } - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; if (!offset) clockTicks += 1 + dataTicksAccess32(address); @@ -8114,14 +8114,14 @@ if(cond_res) { clockTicks += 2 + codeTicksAccess32(armNextPC); } break; - + CASE_16(0x910) { // LDMDB Rn, {Rlist} if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; clockTicks = 0; @@ -8162,7 +8162,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; clockTicks = 0; @@ -8205,7 +8205,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; clockTicks = 0; @@ -8285,7 +8285,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I - + u32 temp = reg[base].I - 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = temp & 0xFFFFFFFC; clockTicks = 0; @@ -8309,7 +8309,7 @@ if(cond_res) { reg[15].I = CPUReadMemory(address); - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; CPUSwitchMode(reg[17].I & 0x1f, false); @@ -8354,7 +8354,7 @@ if(cond_res) { LDM_REG(16384, 14); } - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; if (!offset) clockTicks += 1 + dataTicksAccess32(address); @@ -8365,7 +8365,7 @@ if(cond_res) { clockTicks += 2 + codeTicksAccess32(armNextPC); } break; - + CASE_16(0x990) { // LDMIB Rn, {Rlist} @@ -8411,7 +8411,7 @@ if(cond_res) { if (!busPrefetchCount) busPrefetch = busPrefetchEnable; int base = (opcode & 0x000F0000) >> 16; - u32 temp = reg[base].I + + u32 temp = reg[base].I + 4 * (cpuBitsSet[opcode & 255] + cpuBitsSet[(opcode >> 8) & 255]); u32 address = (reg[base].I+4) & 0xFFFFFFFC; clockTicks = 0; @@ -8452,7 +8452,7 @@ if(cond_res) { if(!(opcode & (1 << base))) reg[base].I = temp; } - break; + break; CASE_16(0x9d0) { // LDMIB Rn, {Rlist}^ @@ -8561,7 +8561,7 @@ if(cond_res) { reg[15].I = CPUReadMemory(address); - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; CPUSwitchMode(reg[17].I & 0x1f, false); @@ -8606,7 +8606,7 @@ if(cond_res) { LDM_REG(16384, 14); } - if(!(opcode & (1 << base))) + if(!(opcode & (1 << base))) reg[base].I = temp; if (!offset) clockTicks += 1 + dataTicksAccess32(address); @@ -8616,7 +8616,7 @@ if(cond_res) { } clockTicks += 2 + codeTicksAccess32(armNextPC); } - break; + break; CASE_256(0xa00) { // B @@ -8660,7 +8660,7 @@ if(cond_res) { clockTicks += 2 + codeTicksAccess32(armNextPC) + codeTicksAccessSeq32(armNextPC); busPrefetchCount=0; - CPUSoftwareInterrupt(opcode & 0x00FFFFFF); + CPUSoftwareInterrupt(opcode & 0x00FFFFFF); break; #ifdef GP_SUPPORT @@ -8683,7 +8683,7 @@ if(cond_res) { case 0xe0d: case 0xe0f: // MRC - break; + break; #endif default: #ifdef DEV_VERSION diff --git a/src/armdis.cpp b/src/armdis.cpp index 3ca4a331..b7517f4e 100644 --- a/src/armdis.cpp +++ b/src/armdis.cpp @@ -135,11 +135,11 @@ const Opcodes thumbOpcodes[] = { // Format 13 {0xff00, 0xb000, "add sp, %s"}, // Format 14 - {0xffff, 0xb500, "push {lr}"}, + {0xffff, 0xb500, "push {lr}"}, {0xff00, 0xb400, "push {%l}"}, {0xff00, 0xb500, "push {%l,lr}"}, {0xffff, 0xbd00, "pop {pc}"}, - {0xff00, 0xbd00, "pop {%l,pc}"}, + {0xff00, 0xbd00, "pop {%l,pc}"}, {0xff00, 0xbc00, "pop {%l}"}, // Format 15 {0xf800, 0xc000, "stmia %r8!, {%l}"}, @@ -232,7 +232,7 @@ char* addHex(char *dest, int siz, u32 val){ int disArm(u32 offset, char *dest, int flags){ u32 opcode = debuggerReadMemory(offset); - + const Opcodes *sp = armOpcodes; while( sp->cval != (opcode & sp->mask) ) sp++; @@ -431,7 +431,7 @@ int disArm(u32 offset, char *dest, int flags){ if(opcode & 0x00100000) dest = addStr(dest, armMultLoadStore[8+((opcode>>23)&3)]); else - dest = addStr(dest, armMultLoadStore[4+((opcode>>23)&3)]); + dest = addStr(dest, armMultLoadStore[4+((opcode>>23)&3)]); } else dest = addStr(dest, armMultLoadStore[(opcode>>23)&3]); break; @@ -540,18 +540,18 @@ int disArm(u32 offset, char *dest, int flags){ } } *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++ = ' '; @@ -560,7 +560,7 @@ int disThumb(u32 offset, char *dest, int flags){ dest = addHex(dest, 16, opcode); *dest++ = ' '; } - + const char *src = sp->mnemonic; while (*src){ if (*src!='%') @@ -636,7 +636,7 @@ int disThumb(u32 offset, char *dest, int flags){ if(*s) { *dest++ = ' '; dest = addStr(dest, s); - } + } } break; case 'b': diff --git a/src/bilinear.cpp b/src/bilinear.cpp index bf09ae57..00e7a1c8 100644 --- a/src/bilinear.cpp +++ b/src/bilinear.cpp @@ -93,13 +93,13 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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, + 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 @@ -123,18 +123,18 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // 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; @@ -143,14 +143,14 @@ void Bilinear(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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)); @@ -171,13 +171,13 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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, + 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 @@ -198,7 +198,7 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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 @@ -212,18 +212,18 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, (((*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; @@ -232,14 +232,14 @@ void BilinearPlus(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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)); @@ -262,13 +262,13 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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, + 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 @@ -292,18 +292,18 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, // 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; @@ -312,14 +312,14 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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)); @@ -342,13 +342,13 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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, + 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 @@ -369,7 +369,7 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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 @@ -383,18 +383,18 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, (((*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; @@ -403,14 +403,14 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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)); diff --git a/src/bios.cpp b/src/bios.cpp index b817ec7e..b8459174 100644 --- a/src/bios.cpp +++ b/src/bios.cpp @@ -99,7 +99,7 @@ void BIOS_ArcTan2() VCOUNT); } #endif - + s32 x = reg[0].I; s32 y = reg[1].I; u32 res = 0; @@ -127,18 +127,18 @@ void BIOS_ArcTan2() } } reg[0].I = res; - + #ifdef DEV_VERSION if(systemVerbose & VERBOSE_SWI) { log("ArcTan2: return=%08x\n", reg[0].I); } #endif -} +} void BIOS_BitUnPack() { -#ifdef DEV_VERSION +#ifdef DEV_VERSION if(systemVerbose & VERBOSE_SWI) { log("BitUnPack: %08x,%08x,%08x (VCOUNT=%2d)\n", reg[0].I, @@ -151,7 +151,7 @@ void BIOS_BitUnPack() u32 source = reg[0].I; u32 dest = reg[1].I; u32 header = reg[2].I; - + int len = CPUReadHalfWord(header); // check address if(((source & 0xe000000) == 0) || @@ -159,21 +159,21 @@ void BIOS_BitUnPack() return; int bits = CPUReadByte(header+2); - int revbits = 8 - bits; + 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; + int data = 0; + int bitwritecount = 0; while(1) { len -= 1; if(len < 0) break; - int mask = 0xff >> revbits; - u8 b = CPUReadByte(source); + int mask = 0xff >> revbits; + u8 b = CPUReadByte(source); source++; int bitcount = 0; while(1) { @@ -205,7 +205,7 @@ void BIOS_GetBiosChecksum() void BIOS_BgAffineSet() { -#ifdef DEV_VERSION +#ifdef DEV_VERSION if(systemVerbose & VERBOSE_SWI) { log("BgAffineSet: %08x,%08x,%08x (VCOUNT=%2d)\n", reg[0].I, @@ -214,7 +214,7 @@ void BIOS_BgAffineSet() VCOUNT); } #endif - + u32 src = reg[0].I; u32 dest = reg[1].I; int num = reg[2].I; @@ -241,7 +241,7 @@ void BIOS_BgAffineSet() s16 dmx = (rx * b)>>14; s16 dy = (ry * b)>>14; s16 dmy = (ry * a)>>14; - + CPUWriteHalfWord(dest, dx); dest += 2; CPUWriteHalfWord(dest, -dmx); @@ -253,13 +253,13 @@ void BIOS_BgAffineSet() 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() { @@ -269,7 +269,7 @@ void BIOS_CpuSet() reg[2].I, VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; u32 cnt = reg[2].I; @@ -331,7 +331,7 @@ void BIOS_CpuFastSet() reg[2].I, VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; u32 cnt = reg[2].I; @@ -343,9 +343,9 @@ void BIOS_CpuFastSet() // needed for 32-bit mode! source &= 0xFFFFFFFC; dest &= 0xFFFFFFFC; - + int count = cnt & 0x1FFFFF; - + // fill? if((cnt >> 24) & 1) { while(count > 0) { @@ -379,7 +379,7 @@ void BIOS_Diff8bitUnFilterWram() reg[1].I, VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -388,20 +388,20 @@ void BIOS_Diff8bitUnFilterWram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff) & 0xe000000) == 0)) - return; + 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() @@ -412,7 +412,7 @@ void BIOS_Diff8bitUnFilterVram() reg[1].I, VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -421,15 +421,15 @@ void BIOS_Diff8bitUnFilterVram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + 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; @@ -444,7 +444,7 @@ void BIOS_Diff8bitUnFilterVram() writeData = 0; shift = 0; } - } + } } void BIOS_Diff16bitUnFilter() @@ -455,7 +455,7 @@ void BIOS_Diff16bitUnFilter() reg[1].I, VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -464,8 +464,8 @@ void BIOS_Diff16bitUnFilter() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + int len = header >> 8; u16 data = CPUReadHalfWord(source); @@ -473,7 +473,7 @@ void BIOS_Diff16bitUnFilter() CPUWriteHalfWord(dest, data); dest += 2; len -= 2; - + while(len >= 2) { u16 diff = CPUReadHalfWord(source); source += 2; @@ -494,7 +494,7 @@ void BIOS_Div() VCOUNT); } #endif - + int number = reg[0].I; int denom = reg[1].I; @@ -523,7 +523,7 @@ void BIOS_DivARM() VCOUNT); } #endif - + u32 temp = reg[0].I; reg[0].I = reg[1].I; reg[1].I = temp; @@ -540,7 +540,7 @@ void BIOS_HuffUnComp() VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -549,14 +549,14 @@ void BIOS_HuffUnComp() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + u8 treeSize = CPUReadByte(source++); u32 treeStart = source; source += ((treeSize+1)<<1)-1; // minus because we already skipped one byte - + int len = header >> 8; u32 mask = 0x80000000; @@ -578,7 +578,7 @@ void BIOS_HuffUnComp() pos++; else pos += (((currentNode & 0x3F)+1)<<1); - + if(data & mask) { // right if(currentNode & 0x40) @@ -590,7 +590,7 @@ void BIOS_HuffUnComp() writeData = true; currentNode = CPUReadByte(treeStart+pos); } - + if(writeData) { writeValue |= (currentNode << byteShift); byteCount++; @@ -637,7 +637,7 @@ void BIOS_HuffUnComp() writeData = true; currentNode = CPUReadByte(treeStart+pos); } - + if(writeData) { if(halfLen == 0) value |= currentNode; @@ -649,7 +649,7 @@ void BIOS_HuffUnComp() writeValue |= (value << byteShift); byteCount++; byteShift += 8; - + halfLen = 0; value = 0; @@ -672,7 +672,7 @@ void BIOS_HuffUnComp() data = CPUReadMemory(source); source += 4; } - } + } } } @@ -686,7 +686,7 @@ void BIOS_LZ77UnCompVram() VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -695,12 +695,12 @@ void BIOS_LZ77UnCompVram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + int byteCount = 0; int byteShift = 0; u32 writeValue = 0; - + int len = header >> 8; while(len > 0) { @@ -754,7 +754,7 @@ void BIOS_LZ77UnCompVram() byteCount++; if(byteCount == 2) { CPUWriteHalfWord(dest, writeValue); - dest += 2; + dest += 2; byteShift = 0; byteCount = 0; writeValue = 0; @@ -775,7 +775,7 @@ void BIOS_LZ77UnCompWram() VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -784,8 +784,8 @@ void BIOS_LZ77UnCompWram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + int len = header >> 8; while(len > 0) { @@ -836,7 +836,7 @@ void BIOS_ObjAffineSet() VCOUNT); } #endif - + u32 src = reg[0].I; u32 dest = reg[1].I; int num = reg[2].I; @@ -857,7 +857,7 @@ void BIOS_ObjAffineSet() 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); @@ -875,7 +875,7 @@ void BIOS_RegisterRamReset(u32 flags) // to emulate bios initialization CPUUpdateRegister(0x0, 0x80); - + if(flags) { if(flags & 0x01) { // clear work RAM @@ -918,7 +918,7 @@ void BIOS_RegisterRamReset(u32 flags) CPUUpdateRegister(0x26, 0x100); CPUUpdateRegister(0x36, 0x100); } - + if(flags & 0x20) { int i; for(i = 0; i < 8; i++) @@ -968,7 +968,7 @@ void BIOS_RLUnCompVram() VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -977,8 +977,8 @@ void BIOS_RLUnCompVram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + int len = header >> 8; int byteCount = 0; int byteShift = 0; @@ -1037,7 +1037,7 @@ void BIOS_RLUnCompWram() VCOUNT); } #endif - + u32 source = reg[0].I; u32 dest = reg[1].I; @@ -1046,8 +1046,8 @@ void BIOS_RLUnCompWram() if(((source & 0xe000000) == 0) || ((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0) - return; - + return; + int len = header >> 8; while(len > 0) { @@ -1092,7 +1092,7 @@ void BIOS_SoftReset() reg[R13_IRQ].I = 0x03007FA0; reg[R14_IRQ].I = 0x00000000; reg[SPSR_IRQ].I = 0x00000000; - reg[R13_SVC].I = 0x03007FE0; + reg[R13_SVC].I = 0x03007FE0; reg[R14_SVC].I = 0x00000000; reg[SPSR_SVC].I = 0x00000000; u8 b = internalRAM[0x7ffa]; diff --git a/src/elf.cpp b/src/elf.cpp index cf68ee50..1521cadc 100644 --- a/src/elf.cpp +++ b/src/elf.cpp @@ -54,7 +54,7 @@ #define DW_AT_sibling 0x01 #define DW_AT_location 0x02 -#define DW_AT_name 0x03 +#define DW_AT_name 0x03 #define DW_AT_byte_size 0x0b #define DW_AT_bit_offset 0x0c #define DW_AT_bit_size 0x0d @@ -328,7 +328,7 @@ const char *elfGetAddressSymbol(u32 addr) } } } - + return ""; } @@ -448,9 +448,9 @@ bool elfGetObject(const char *name, Function *f, CompileUnit *u, Object **o) v = v->next; } } - + CompileUnit *c = elfCompileUnits; - + while(c) { if(c != u) { Object *v = c->variables; @@ -464,7 +464,7 @@ bool elfGetObject(const char *name, Function *f, CompileUnit *u, Object **o) } c = c->next; } - + return false; } @@ -626,7 +626,7 @@ ELFFrameState *elfGetFrameState(ELFfde *fde, u32 address) state->dataAlign = fde->cie->dataAlign; state->codeAlign = fde->cie->codeAlign; state->returnAddress = fde->cie->returnAddress; - + elfExecuteCFAInstructions(state, fde->cie->data, fde->cie->dataLen, @@ -647,33 +647,33 @@ void elfPrintCallChain(u32 address) reg_pair newRegs[15]; memcpy(®s[0], ®[0], sizeof(reg_pair) * 15); - + while(count < 20) { const 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); + 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; @@ -742,7 +742,7 @@ u32 elfDecodeLocation(Function *f, ELFBlock *o, LocationType *type, u32 base) break; } } - + ELFBlock *loc = o; u32 location = 0; int bytes = 0; @@ -771,7 +771,7 @@ u32 elfDecodeLocation(Function *f, ELFBlock *o, LocationType *type, u32 base) case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14: - case DW_OP_reg15: + case DW_OP_reg15: location = *loc->data - 0x50; *type = LOCATION_register; break; @@ -829,7 +829,7 @@ s32 elfReadSignedLEB128(u8 *data, int *bytesRead) s32 result = 0; int shift = 0; int count = 0; - + u8 byte; do { byte = *data++; @@ -971,7 +971,7 @@ u8 *elfReadAttribute(u8 *data, ELFAttr *attr) case DW_FORM_ref_udata: attr->value = (u32)((elfDebugInfo->infodata + (elfGetCompileUnitForData(data)->top - elfDebugInfo->infodata) + elfReadLEB128(data, &bytes)) - elfCurrentUnit->top); data += bytes; - break; + break; case DW_FORM_indirect: form = elfReadLEB128(data, &bytes); data += bytes; @@ -1063,17 +1063,17 @@ void elfParseCFA(u8 *top) u8 *end = data + READ32LE(&h->size); ELFcie *cies = NULL; - + while(data < end) { u32 offset = (u32)(data - topOffset); u32 len = elfRead4Bytes(data); data += 4; u8 *dataEnd = data + len; - + u32 id = elfRead4Bytes(data); data += 4; - + if(id == 0xffffffff) { // skip version *data++; @@ -1084,24 +1084,24 @@ void elfParseCFA(u8 *top) 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; @@ -1123,10 +1123,10 @@ void elfParseCFA(u8 *top) } fde->cie = cie; - + fde->address = elfRead4Bytes(data); data += 4; - + fde->end = fde->address + elfRead4Bytes(data); data += 4; @@ -1169,7 +1169,7 @@ void elfParseLineInfo(CompileUnit *unit, u8 *top) 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); @@ -1202,10 +1202,10 @@ void elfParseLineInfo(CompileUnit *unit, u8 *top) 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); @@ -1293,7 +1293,7 @@ void elfParseLineInfo(CompileUnit *unit, u8 *top) op = op - opcodeBase; address += (op / lineRange) * minInstrSize; line += lineBase + (op % lineRange); - elfAddLine(l, address, file, line, &max); + elfAddLine(l, address, file, line, &max); // fprintf(stderr, "Address %08x line %d (%d)\n", address, line,file); basicBlock = 1; break; @@ -1307,32 +1307,32 @@ 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++; } @@ -1356,7 +1356,7 @@ void elfAddType(Type *type, CompileUnit *unit, u32 offset) type->next = unit->types; unit->types = type; } - } + } } void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, @@ -1366,7 +1366,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, case DW_TAG_typedef: { u32 typeref = 0; - char *name = NULL; + char *name = NULL; for(int i = 0; i < abbrev->numAttrs; i++) { ELFAttr *attr = &abbrev->attrs[i]; data = elfReadAttribute(data, attr); @@ -1379,7 +1379,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, break; case DW_AT_decl_file: case DW_AT_decl_line: - break; + break; default: fprintf(stderr, "Unknown attribute for typedef %02x\n", attr->name); break; @@ -1401,11 +1401,11 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1435,7 +1435,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, int index = 0; while(num) { ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); - + switch(abbr->tag) { case DW_TAG_member: { @@ -1561,7 +1561,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1590,7 +1590,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1615,7 +1615,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1638,7 +1638,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1690,7 +1690,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, data += bytes; while(num) { ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); - + switch(abbr->tag) { case DW_TAG_enumerator: { @@ -1717,7 +1717,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, break; default: fprintf(stderr, "Unknown enum tag %02x\n", abbr->tag); - data = elfSkipData(data, abbr, unit->abbrevs); + data = elfSkipData(data, abbr, unit->abbrevs); break; } num = elfReadLEB128(data, &bytes); @@ -1734,14 +1734,14 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, Type *t = (Type *)calloc(sizeof(Type), 1); t->type = TYPE_function; FunctionType *f = (FunctionType *)calloc(sizeof(FunctionType), 1); - t->function = f; + 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: + case DW_AT_sibling: break; case DW_AT_type: f->returnType = elfParseType(unit, attr->value); @@ -1754,10 +1754,10 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, int bytes; u32 num = elfReadLEB128(data, &bytes); data += bytes; - Object *lastVar = NULL; + Object *lastVar = NULL; while(num) { ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); - + switch(abbr->tag) { case DW_TAG_formal_parameter: { @@ -1780,7 +1780,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, break; default: fprintf(stderr, "Unknown subroutine tag %02x\n", abbr->tag); - data = elfSkipData(data, abbr, unit->abbrevs); + data = elfSkipData(data, abbr, unit->abbrevs); break; } num = elfReadLEB128(data, &bytes); @@ -1799,7 +1799,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -1822,7 +1822,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, int maxBounds = 0; while(num) { ELFAbbrev *abbr = elfGetAbbrev(unit->abbrevs, num); - + switch(abbr->tag) { case DW_TAG_subrange_type: { @@ -1850,7 +1850,7 @@ void elfParseType(u8 *data, u32 offset, ELFAbbrev *abbrev, CompileUnit *unit, break; default: fprintf(stderr, "Unknown array tag %02x\n", abbr->tag); - data = elfSkipData(data, abbr, unit->abbrevs); + data = elfSkipData(data, abbr, unit->abbrevs); break; } num = elfReadLEB128(data, &bytes); @@ -1895,7 +1895,7 @@ Type *elfParseType(CompileUnit *unit, u32 offset) Type *type = NULL; ELFAbbrev *abbrev = elfGetAbbrev(unit->abbrevs, abbrevNum); - + elfParseType(data, offset, abbrev, unit, &type); return type; } @@ -1906,13 +1906,13 @@ void elfGetObjectAttributes(CompileUnit *unit, u32 offset, Object *o) 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); @@ -1939,7 +1939,7 @@ void elfGetObjectAttributes(CompileUnit *unit, u32 offset, Object *o) case DW_AT_external: o->external = attr->flag; break; - case DW_AT_const_value: + case DW_AT_const_value: case DW_AT_abstract_origin: case DW_AT_declaration: case DW_AT_artificial: @@ -1952,7 +1952,7 @@ void elfGetObjectAttributes(CompileUnit *unit, u32 offset, Object *o) fprintf(stderr, "Unknown object attribute %02x\n", attr->name); break; } - } + } } u8 *elfParseObject(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, @@ -1991,7 +1991,7 @@ u8 *elfParseObject(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, case DW_AT_abstract_origin: elfGetObjectAttributes(unit, attr->value, o); break; - case DW_AT_const_value: + case DW_AT_const_value: case DW_AT_declaration: case DW_AT_artificial: break; @@ -2013,7 +2013,7 @@ u8 *elfParseBlock(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, 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); @@ -2033,26 +2033,26 @@ u8 *elfParseBlock(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, 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; + break; case DW_TAG_lexical_block: data = elfParseBlock(data, abbrev, unit, func, lastVar); break; @@ -2081,7 +2081,7 @@ u8 *elfParseBlock(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, (*lastVar)->next = o; else func->variables = o; - *lastVar = o; + *lastVar = o; } break; case DW_TAG_inlined_subroutine: @@ -2091,13 +2091,13 @@ u8 *elfParseBlock(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, default: { fprintf(stderr, "Unknown block TAG %02x\n", abbrev->tag); - data = elfSkipData(data, abbrev, unit->abbrevs); + data = elfSkipData(data, abbrev, unit->abbrevs); } break; } } } - return data; + return data; } void elfGetFunctionAttributes(CompileUnit *unit, u32 offset, Function *func) @@ -2106,7 +2106,7 @@ void elfGetFunctionAttributes(CompileUnit *unit, u32 offset, Function *func) int bytes; u32 abbrevNum = elfReadLEB128(data, &bytes); data += bytes; - + if(!abbrevNum) { return; } @@ -2116,10 +2116,10 @@ void elfGetFunctionAttributes(CompileUnit *unit, u32 offset, Function *func) 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; + break; case DW_AT_name: if(func->name == NULL) func->name = attr->string; @@ -2166,7 +2166,7 @@ void elfGetFunctionAttributes(CompileUnit *unit, u32 offset, Function *func) break; default: fprintf(stderr, "Unknown function attribute %02x\n", attr->name); - break; + break; } } @@ -2178,7 +2178,7 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, { Function *func = (Function *)calloc(sizeof(Function), 1); *f = func; - + int bytes; bool mangled = false; bool declaration = false; @@ -2233,7 +2233,7 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, case DW_AT_user_2002: case DW_AT_virtuality: case DW_AT_containing_type: - case DW_AT_accessibility: + case DW_AT_accessibility: // todo; break; case DW_AT_vtable_elem_location: @@ -2263,7 +2263,7 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, data = elfSkipData(data, abbrev, unit->abbrevs); } } - + if(abbrev->hasChildren) { int nesting = 1; Object *lastParam = NULL; @@ -2272,14 +2272,14 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, 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 @@ -2334,7 +2334,7 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, if(abbrev->attrs[i].form == DW_FORM_block1) free(abbrev->attrs[i].block); } - + if(abbrev->hasChildren) nesting++; } @@ -2342,7 +2342,7 @@ u8 *elfParseFunction(u8 *data, ELFAbbrev *abbrev, CompileUnit *unit, default: { fprintf(stderr, "Unknown function TAG %02x\n", abbrev->tag); - data = elfSkipData(data, abbrev, unit->abbrevs); + data = elfSkipData(data, abbrev, unit->abbrevs); } break; } @@ -2358,34 +2358,34 @@ u8 *elfParseUnknownData(u8 *data, ELFAbbrev *abbrev, ELFAbbrev **abbrevs) // 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++; } @@ -2435,7 +2435,7 @@ u8 *elfParseCompileUnitChildren(u8 *data, CompileUnit *unit) data = elfParseUnknownData(data, abbrev, unit->abbrevs); break; } - + abbrevNum = elfReadLEB128(data, &bytes); data += bytes; } @@ -2447,23 +2447,23 @@ 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; @@ -2483,9 +2483,9 @@ CompileUnit *elfParseCompUnit(u8 *data, u8 *abbrevData) unit->next = NULL; elfCurrentUnit = unit; - + int i; - + for(i = 0; i < abbrev->numAttrs; i++) { ELFAttr *attr = &abbrev->attrs[i]; data = elfReadAttribute(data, attr); @@ -2540,7 +2540,7 @@ void elfParseAranges(u8 *data) ARanges *ranges = (ARanges *)calloc(sizeof(ARanges), 4); int index = 0; - + while(data < end) { u32 len = elfRead4Bytes(data); data += 4; @@ -2583,7 +2583,7 @@ void elfReadSymtab(u8 *data) 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); @@ -2592,7 +2592,7 @@ void elfReadSymtab(u8 *data) elfSymbols = (Symbol *)malloc(sizeof(Symbol)*count); int i; - + for(i = 0; i < count; i++) { ELFSymbol *s = &symtab[i]; int type = s->info & 15; @@ -2622,7 +2622,7 @@ void elfReadSymtab(u8 *data) sym->size = READ32LE(&s->size); elfSymbolsCount++; } - } + } elfSymbolsStrTab = strtable; // free(symtab); } @@ -2631,7 +2631,7 @@ 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; @@ -2655,7 +2655,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) data + READ32LE(&ph->offset), READ32LE(&ph->filesz)); size += READ32LE(&ph->filesz); - } + } } else { if(READ32LE(&ph->paddr) >= 0x8000000 && READ32LE(&ph->paddr) <= 0x9ffffff) { @@ -2675,7 +2675,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) ELFSectionHeader **sh = (ELFSectionHeader **) malloc(sizeof(ELFSectionHeader *) * count); - + for(i = 0; i < count; i++) { sh[i] = (ELFSectionHeader *)p; p += sizeof(ELFSectionHeader); @@ -2687,7 +2687,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) stringTable = (char *)elfReadSection(data, sh[READ16LE(&eh->e_shstrndx)]); } - + elfSectionHeaders = sh; elfSectionHeadersStringTable = stringTable; elfSectionHeadersCount = count; @@ -2705,7 +2705,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) READ32LE(&sh[i]->offset), READ32LE(&sh[i]->size)); size += READ32LE(&sh[i]->size); - } + } } else { if(READ32LE(&sh[i]->addr) >= 0x8000000 && READ32LE(&sh[i]->addr) <= 0x9ffffff) { @@ -2714,7 +2714,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) READ32LE(&sh[i]->size)); size += READ32LE(&sh[i]->size); } - } + } } } @@ -2724,7 +2724,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) ELFSectionHeader *dbgHeader = elfGetSectionByName(".debug_info"); if(dbgHeader == NULL) { fprintf(stderr, "Cannot find debug information\n"); - goto end; + goto end; } ELFSectionHeader *h = elfGetSectionByName(".debug_abbrev"); @@ -2732,7 +2732,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) fprintf(stderr, "Cannot find abbreviation table\n"); goto end; } - + elfDebugInfo = (DebugInfo *)calloc(sizeof(DebugInfo), 1); u8 *abbrevdata = elfReadSection(data, h); @@ -2742,19 +2742,19 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) 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 = (u32)(ddata-debugdata); @@ -2780,7 +2780,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) elfParseCFA(data); elfReadSymtab(data); } - end: + end: if(sh) { free(sh); } @@ -2788,7 +2788,7 @@ bool elfReadProgram(ELFHeader *eh, u8 *data, int& size, bool parseDebug) elfSectionHeaders = NULL; elfSectionHeadersStringTable = NULL; elfSectionHeadersCount = 0; - + return true; } @@ -2802,9 +2802,9 @@ bool elfRead(const char *name, int& siz, FILE *f) 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) { @@ -2819,7 +2819,7 @@ bool elfRead(const char *name, int& siz, FILE *f) elfFileData = NULL; return false; } - + return true; } @@ -2857,7 +2857,7 @@ void elfCleanUp(ELFAbbrev **abbrevs) free(abbrev->attrs); ELFAbbrev *next = abbrev->next; free(abbrev); - + abbrev = next; } } @@ -2875,7 +2875,7 @@ void elfCleanUp(Type *t) free(o); o = next; } - free(t->function); + free(t->function); } break; case TYPE_array: @@ -2974,7 +2974,7 @@ void elfCleanUp() free(elfFdes[i]); } free(elfFdes); - + elfFdes = NULL; elfFdeCount = 0; } diff --git a/src/elf.h b/src/elf.h index 9ba7bfcf..274e17b9 100644 --- a/src/elf.h +++ b/src/elf.h @@ -206,7 +206,7 @@ struct Function { struct LineInfoItem { u32 address; - char *file; + char *file; int line; }; @@ -235,7 +235,7 @@ struct CompileUnit { ELFAbbrev **abbrevs; ARanges *ranges; char *name; - char *compdir; + char *compdir; u32 lowPC; u32 highPC; bool hasLineInfo; @@ -245,7 +245,7 @@ struct CompileUnit { Function *lastFunction; Object *variables; Type *types; - CompileUnit *next; + CompileUnit *next; }; struct DebugInfo { diff --git a/src/expr-lex.cpp b/src/expr-lex.cpp index 6bc20685..4885bbd8 100644 --- a/src/expr-lex.cpp +++ b/src/expr-lex.cpp @@ -662,7 +662,7 @@ YY_RULE_SETUP #line 45 "expr.l" { return TOKEN_DOT; -} +} YY_BREAK case 5: YY_RULE_SETUP diff --git a/src/expr.cpp b/src/expr.cpp index 25c68f69..d1b1c686 100644 --- a/src/expr.cpp +++ b/src/expr.cpp @@ -14,7 +14,7 @@ #line 1 "expr.y" -namespace std { +namespace std { #include #include #include @@ -22,16 +22,16 @@ namespace std { } using namespace std; - + #include "System.h" #include "elf.h" -#include "exprNode.h" +#include "exprNode.h" extern int yyerror(char *); -extern int yylex(); +extern int yylex(); extern char *yytext; - + //#define YYERROR_VERBOSE 1 //#define YYDEBUG 1 diff --git a/src/exprNode.cpp b/src/exprNode.cpp index cc38c2a2..f7d8c64c 100644 --- a/src/exprNode.cpp +++ b/src/exprNode.cpp @@ -56,9 +56,9 @@ Node *exprNodeIdentifier() Node *n = (Node *)calloc(1, sizeof(Node)); n->name = strdup(yytext); - exprNodeClean(n->name); + exprNodeClean(n->name); exprNodeClean(n); - + n->print = exprNodeIdentifierPrint; n->resolve = exprNodeIdentifierResolve; return n; @@ -89,7 +89,7 @@ Node *exprNodeNumber() exprNodeClean(n); n->location = atoi(yytext); n->type = &exprNodeType; - n->locType = LOCATION_value; + n->locType = LOCATION_value; n->print = exprNodeNumberPrint; n->resolve = exprNodeNumberResolve; return n; @@ -109,9 +109,9 @@ Node *exprNodeStar(Node *exp) { Node *n = (Node *)calloc(1, sizeof(Node)); exprNodeClean(n); - + n->expression = exp; - + n->print = exprNodeStarPrint; n->resolve = exprNodeStarResolve; return n; @@ -149,10 +149,10 @@ 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; @@ -162,7 +162,7 @@ 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; @@ -206,10 +206,10 @@ 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; @@ -224,7 +224,7 @@ bool exprNodeArrowResolve(Node *n, Function *f, CompileUnit *u) return false; } tt = n->expression->type->pointer->type; - + if(tt == TYPE_struct || tt == TYPE_union) { u32 loc = debuggerReadMemory(n->expression->location); @@ -268,9 +268,9 @@ Node *exprNodeAddr(Node *exp) { Node *n = (Node *)calloc(1, sizeof(Node)); exprNodeClean(n); - + n->expression = exp; - + n->print = exprNodeAddrPrint; n->resolve = exprNodeAddrResolve; return n; @@ -303,9 +303,9 @@ Node *exprNodeSizeof(Node *exp) { Node *n = (Node *)calloc(1, sizeof(Node)); exprNodeClean(n); - + n->expression = exp; - + n->print = exprNodeSizeofPrint; n->resolve = exprNodeSizeofResolve; return n; @@ -333,10 +333,10 @@ 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; @@ -349,7 +349,7 @@ int exprNodeGetSize(Array *a, int index) 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]; } @@ -369,7 +369,7 @@ bool exprNodeArrayResolve(Node *n, Function *f, CompileUnit *u) if(tt == TYPE_array) { Array *a = n->expression->type->array; - + u32 loc = n->expression->location; Type *t = a->type; if(a->maxBounds > 1) { diff --git a/src/gb/GB.cpp b/src/gb/GB.cpp index ea18adb3..2606b39d 100644 --- a/src/gb/GB.cpp +++ b/src/gb/GB.cpp @@ -154,7 +154,7 @@ bool gbIncreased = false; // writing to register_DIV... int gbInternalTimer = 0x55; const u8 gbTimerMask [4] = {0xff, 0x3, 0xf, 0x3f}; -const u8 gbTimerBug [8] = {0x80, 0x80, 0x02, 0x02, 0x0, 0xff, 0x0, 0xff}; +const u8 gbTimerBug [8] = {0x80, 0x80, 0x02, 0x02, 0x0, 0xff, 0x0, 0xff}; bool gbTimerModeChange = false; bool gbTimerOnChange = false; // lcd @@ -274,7 +274,7 @@ int gbCycles[] = { }; int gbCyclesCB[] = { -// 0 1 2 3 4 5 6 7 8 9 a b c d e f +// 0 1 2 3 4 5 6 7 8 9 a b c d e f 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 0 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 1 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 2 @@ -631,7 +631,7 @@ bool gbIsGameboyRom(char * file) if(_stricmp(p, ".cgb") == 0) return true; if(_stricmp(p, ".sgb") == 0) - return true; + return true; } } @@ -662,13 +662,13 @@ void gbDoHdma() gbHdmaSource += 0x10; if (gbHdmaSource == 0x8000) gbHdmaSource = 0xa000; - + register_HDMA2 = gbHdmaSource & 0xff; register_HDMA1 = gbHdmaSource>>8; - + register_HDMA4 = gbHdmaDestination & 0xff; register_HDMA3 = gbHdmaDestination>>8; - + gbHdmaBytes -= 0x10; gbMemory[0xff55] = --register_HDMA5; if(register_HDMA5 == 0xff) @@ -693,7 +693,7 @@ void gbCompareLYToLYC() // mark that we have a match register_STAT |= 4; - + // check if we need an interrupt if (register_STAT & 0x40) { @@ -717,7 +717,7 @@ void gbWriteMemory(register u16 address, register u8 value) { if(address < 0x8000) { -#ifndef FINAL_VERSION +#ifndef FINAL_VERSION if(memorydebug && (address>0x3fff || address < 0x2000)) { log("Memory register write %04x=%02x PC=%04x\n", address, @@ -791,7 +791,7 @@ void gbWriteMemory(register u16 address, register u8 value) if((address > 0xfea0) && (address < 0xff00)){ // GBC allows reading/writing to that area gbMemory[address] = value; return; - } + } switch(address & 0x00ff) { @@ -808,11 +808,11 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff01] = value; return; } - + // serial control case 0x02: { gbSerialOn = (value & 0x80); - gbMemory[0xff02] = value; + gbMemory[0xff02] = value; if(gbSerialOn) { gbSerialTicks = GBSERIAL_CLOCK_TICKS; #ifdef LINK_EMULATION @@ -828,7 +828,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbSerialBits = 0; return; } - + case 0x04: { // DIV register resets on any write // (not totally perfect, but better than nothing) @@ -843,10 +843,10 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff05] = ++register_TIMA; if(register_TIMA == 0) { // timer overflow! - + // reload timer modulo gbMemory[0xff05] = register_TIMA = register_TMA; - + // flag interrupt gbMemory[0xff0f] = register_IF |= 4; } @@ -861,14 +861,14 @@ void gbWriteMemory(register u16 address, register u8 value) case 0x06: gbMemory[0xff06] = register_TMA = value; return; - + // TIMER control case 0x07: { gbTimerModeChange = (((value & 3) != (register_TAC&3)) && (value & register_TAC & 4)) ? true : false; gbTimerOnChange = (((value ^ register_TAC) & 4) == 4) ? true : false; - - gbTimerOn = (value & 4) ? true : false; + + gbTimerOn = (value & 4) ? true : false; if (gbTimerOnChange || gbTimerModeChange) { @@ -894,8 +894,8 @@ void gbWriteMemory(register u16 address, register u8 value) // This looks weird, but this emulates a bug in which register_TIMA // is increased when writing to register_TAC // (This fixes Korodice's long-delay between menus bug). - - if (gbTimerOnChange || gbTimerModeChange) + + if (gbTimerOnChange || gbTimerModeChange) { bool temp = false; @@ -913,7 +913,7 @@ void gbWriteMemory(register u16 address, register u8 value) temp = false; break; case 0x01: - if (((gbInternalTimer & 0x82) == 2) && (gbTimerTicks>(clockTicks+1))) + if (((gbInternalTimer & 0x82) == 2) && (gbTimerTicks>(clockTicks+1))) temp = true; break; case 0x02: @@ -932,10 +932,10 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff05] = ++register_TIMA; if((register_TIMA & 0xff) == 0) { // timer overflow! - + // reload timer modulo gbMemory[0xff05] = register_TIMA = register_TMA; - + // flag interrupt gbMemory[0xff0f] = register_IF |= 4; } @@ -950,7 +950,7 @@ void gbWriteMemory(register u16 address, register u8 value) //gbMemory[0xff0f] = register_IE |= value; return; } - + case 0x10: case 0x11: case 0x12: @@ -1058,7 +1058,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbCompareLYToLYC(); } else { - + register_LCDCBusy = clockTicks+6; //used to update the screen with white lines when it's off. @@ -1097,7 +1097,7 @@ void gbWriteMemory(register u16 address, register u8 value) { gbMemory[0xff0f] = register_IF |=2; } - + gbInt48Signal &= ((register_STAT>>3) & 0xF); if((register_LCDC & 0x80)) { @@ -1129,7 +1129,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff0f] = register_IF; gbMemory[0xff41] = register_STAT; - + } return; } @@ -1139,7 +1139,7 @@ void gbWriteMemory(register u16 address, register u8 value) int temp = -1; if ((gbLcdMode == 3) || (gbLcdModeDelayed == 3)) - temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - + temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - gbLcdLYIncrementTicks); if (temp >=0) @@ -1148,20 +1148,20 @@ void gbWriteMemory(register u16 address, register u8 value) if (temp < 300) gbSCYLine[i] = value; } - - else + + else memset(gbSCYLine, value, sizeof(gbSCYLine)); gbMemory[0xff42] = register_SCY = value; return; } - + // SCX case 0x43: { int temp = -1; if (gbLcdModeDelayed == 3) - temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - + temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - gbLcdLYIncrementTicksDelayed); if (temp >=0) @@ -1170,14 +1170,14 @@ void gbWriteMemory(register u16 address, register u8 value) if (temp < 300) gbSCXLine[i] = value; } - - else + + else memset(gbSCXLine, value, sizeof(gbSCXLine)); gbMemory[0xff43] = register_SCX = value; return; } - + // LY case 0x44: { // read only @@ -1195,7 +1195,7 @@ void gbWriteMemory(register u16 address, register u8 value) } return; } - + // DMA! case 0x46: { int source = value * 0x0100; @@ -1206,7 +1206,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff46] = register_DMA = value; return; } - + // BGP case 0x47: { @@ -1215,7 +1215,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff47] = value; if (gbLcdModeDelayed == 3) - temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - + temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - gbLcdLYIncrementTicksDelayed); if (temp >=0) @@ -1233,7 +1233,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbBgp[3] = (value & 0xc0)>>6; break; } - + // OBP0 case 0x48: { int temp = -1; @@ -1241,7 +1241,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff48] = value; if (gbLcdModeDelayed == 3) - temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - + temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - gbLcdLYIncrementTicksDelayed); if (temp >=0) @@ -1267,7 +1267,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff49] = value; if (gbLcdModeDelayed == 3) - temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - + temp = ((GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS) - gbLcdLYIncrementTicksDelayed); if (temp >=0) @@ -1300,7 +1300,7 @@ void gbWriteMemory(register u16 address, register u8 value) case 0x4b: gbMemory[0xff4b] = register_WX = value; return; - + // KEY1 case 0x4d: { if(gbCgbMode) { @@ -1309,18 +1309,18 @@ void gbWriteMemory(register u16 address, register u8 value) } } 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; } @@ -1344,22 +1344,22 @@ void gbWriteMemory(register u16 address, register u8 value) if(gbCgbMode) { if(value > 0x7f && value < 0xa0) value = 0; - + gbHdmaSource = (value << 8) | (gbHdmaSource & 0xf0); - + register_HDMA1 = value; return; } } break; - + // HDMA2 case 0x52: { if(gbCgbMode) { value = value & 0xf0; - + gbHdmaSource = (gbHdmaSource & 0xff00) | (value); - + register_HDMA2 = value; return; } @@ -1377,7 +1377,7 @@ void gbWriteMemory(register u16 address, register u8 value) } } break; - + // HDMA4 case 0x54: { if(gbCgbMode) { @@ -1389,7 +1389,7 @@ void gbWriteMemory(register u16 address, register u8 value) } } break; - + // HDMA5 case 0x55: { @@ -1423,7 +1423,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbHdmaBytes); gbHdmaDestination += gbHdmaBytes; gbHdmaSource += gbHdmaBytes; - + gbMemory[0xff51] = register_HDMA1 = 0xff;// = (gbHdmaSource >> 8) & 0xff; gbMemory[0xff52] = register_HDMA2 = 0xff;// = gbHdmaSource & 0xf0; gbMemory[0xff53] = register_HDMA3 = 0xff;// = ((gbHdmaDestination - 0x8000) >> 8) & 0x1f; @@ -1435,15 +1435,15 @@ void gbWriteMemory(register u16 address, register u8 value) } } 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)); @@ -1451,11 +1451,11 @@ void gbWriteMemory(register u16 address, register u8 value) } } break; - + // BCPD case 0x69: { if(gbCgbMode) { - int v = gbMemory[0xff68]; + int v = gbMemory[0xff68]; int paletteIndex = (v & 0x3f) >> 1; int paletteHiLo = (v & 0x01); @@ -1471,10 +1471,10 @@ void gbWriteMemory(register u16 address, register u8 value) ((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) : @@ -1484,13 +1484,13 @@ void gbWriteMemory(register u16 address, register u8 value) } } break; - - // OCPS + + // OCPS case 0x6a: { if(gbCgbMode) { int paletteIndex = (value & 0x3f) >> 1; int paletteHiLo = (value & 0x01); - + paletteIndex += 32; gbMemory[0xff6a] = value; @@ -1502,17 +1502,17 @@ void gbWriteMemory(register u16 address, register u8 value) } } break; - + // OCPD case 0x6b: { if(gbCgbMode) { - int v = gbMemory[0xff6a]; + int v = gbMemory[0xff6a]; int paletteIndex = (v & 0x3f) >> 1; int paletteHiLo = (v & 0x01); - + paletteIndex += 32; - + // No access to gbPalette during mode 3 (Color Panel Demo) if (((gbLcdModeDelayed != 3) && (!((gbLcdMode == 0) && (gbLcdTicks>=(GBLCD_MODE_0_CLOCK_TICKS-gbSpritesTicks[299]-1)))) && (!gbSpeed)) || (gbSpeed && ((gbLcdMode == 1) || (gbLcdMode == 2) || @@ -1527,13 +1527,13 @@ void gbWriteMemory(register u16 address, register u8 value) 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; } } @@ -1544,7 +1544,7 @@ void gbWriteMemory(register u16 address, register u8 value) return; } - + // SVBK case 0x70: { if(gbCgbMode) { @@ -1553,13 +1553,13 @@ void gbWriteMemory(register u16 address, register u8 value) int bank = value; if(value == 0) bank = 1; - + if(bank == gbWramBank) return; - + int wramAddress = bank * 0x1000; gbMemoryMap[0x0d] = &gbWram[wramAddress]; - + gbWramBank = bank; gbMemory[0xff70] = register_SVBK = value; return; @@ -1570,7 +1570,7 @@ void gbWriteMemory(register u16 address, register u8 value) gbMemory[0xff75] = 0x8f | value; return; } - + case 0xff: { gbMemory[0xffff] = register_IE = value; return; @@ -1599,7 +1599,7 @@ u8 gbReadOpcode(register u16 address) // A lot of 'ugly' checks... But only way to emulate this particular behaviour... if (((gbHardware & 0xa) && ((gbLcdModeDelayed !=3) || ((register_LY == 0) && (gbScreenOn==false) && (register_LCDC & 0x80)) && - (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) || + (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) || ((gbHardware & 0x5) && (gbLcdModeDelayed !=3) && ((gbLcdMode !=3) || ((register_LY == 0) && ((gbScreenOn==false) && (register_LCDC & 0x80)) && @@ -1749,7 +1749,7 @@ u8 gbReadMemory(register u16 address) // A lot of 'ugly' checks... But only way to emulate this particular behaviour... if (((gbHardware & 0xa) && ((gbLcdModeDelayed !=3) || ((register_LY == 0) && (gbScreenOn==false) && (register_LCDC & 0x80)) && - (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) || + (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) || ((gbHardware & 0x5) && (gbLcdModeDelayed !=3) && ((gbLcdMode !=3) || ((register_LY == 0) && ((gbScreenOn==false) && (register_LCDC & 0x80)) && @@ -1790,7 +1790,7 @@ u8 gbReadMemory(register u16 address) gbSgbReadingController |= 4; gbSgbResetPacketState(); } - + int b = gbMemory[0xff00]; if((b & 0x30) == 0x20) { @@ -1824,7 +1824,7 @@ u8 gbReadMemory(register u16 address) b |= 0x02; if(!(joystate & 16)) b |= 0x01; - + gbMemory[0xff00] = b; } else if((b & 0x30) == 0x10) { b &= 0xf0; @@ -1857,7 +1857,7 @@ u8 gbReadMemory(register u16 address) b |= 0x02; if(!(joystate & 1)) b |= 0x01; - + gbMemory[0xff00] = b; } else { if(gbSgbMode && gbSgbMultiplayer) { @@ -1902,8 +1902,8 @@ u8 gbReadMemory(register u16 address) if ((gbMemory[NR30] & 0x80) && (gbMemory[NR34] & 0x80)) return 0xFF; else - return gbMemoryMap[address>>12][address & 0x0fff]; - case 0x40: + return gbMemoryMap[address>>12][address & 0x0fff]; + case 0x40: return register_LCDC; case 0x41: // This is a GB/C only bug (ie. not GBA/SP). @@ -2081,7 +2081,7 @@ void gbSpeedSwitch() gbLcdLYIncrementTicksDelayed >>= 1; gbSerialTicks /= 2; SOUND_CLOCK_TICKS = soundQuality * 24; - soundTicks /= 2; + soundTicks /= 2; gbLine99Ticks = 1; if (gbHardware & 8) gbLine99Ticks++; @@ -2103,7 +2103,7 @@ bool CPUIsGBBios(const char * file) return true; } } - + return false; } @@ -2220,7 +2220,7 @@ void gbReset() } - + // clean LineBuffer if (gbLineBuffer != NULL) memset(gbLineBuffer, 0, sizeof(gbLineBuffer)); @@ -2267,7 +2267,7 @@ void gbReset() PC.W = 0x0100; IFF = 0; gbInt48Signal = 0; - + register_TIMA = 0; register_TMA = 0; register_TAC = 0; @@ -2289,7 +2289,7 @@ void gbReset() gbMemory[0xff56] = 0xff; register_SCY = 0; - register_SCX = 0; + register_SCX = 0; register_LYC = 0; register_DMA = 0xff; register_WY = 0; @@ -2301,7 +2301,7 @@ void gbReset() register_HDMA4 = 0xff; register_HDMA5 = 0xff; register_SVBK = 0; - register_IE = 0; + register_IE = 0; if (gbCgbMode) gbMemory[0xff02] = 0x7c; @@ -2385,12 +2385,12 @@ void gbReset() DE.W = 0xff56; HL.W = 0x000d; - + register_HDMA5 = 0xff; gbMemory[0xff68] = 0xc0; gbMemory[0xff6a] = 0xc0; - + gbMemory[0xff41] = register_STAT = 0x81; gbLcdMode = 1; } @@ -2410,7 +2410,7 @@ void gbReset() gbInternalTimer = gbDivTicks--; gbMemory[0xff04] = register_DIV = 0xAB; gbMemory[0xff41] = register_STAT = 0x85; - gbMemory[0xff44] = register_LY = 0x00; + gbMemory[0xff44] = register_LY = 0x00; gbLcdTicks = 15; gbLcdLYIncrementTicks = 114+gbLcdTicks; gbLcdMode = 1; @@ -2467,7 +2467,7 @@ void gbReset() gbPalette[0x20] = 0x0600; gbPalette[0x21] = 0xfdf3; gbPalette[0x22] = 0x041c; - gbPalette[0x23] = 0xf5db; + gbPalette[0x23] = 0xf5db; gbPalette[0x24] = 0x4419; gbPalette[0x25] = 0x57ea; gbPalette[0x26] = 0x2808; @@ -2581,7 +2581,7 @@ void gbReset() GBTIMER_MODE_1_CLOCK_TICKS = 4; GBTIMER_MODE_2_CLOCK_TICKS = 16; GBTIMER_MODE_3_CLOCK_TICKS = 64; - + GBLY_INCREMENT_CLOCK_TICKS = 114; gbTimerTicks = GBTIMER_MODE_0_CLOCK_TICKS; gbTimerClockTicks = GBTIMER_MODE_0_CLOCK_TICKS; @@ -2593,7 +2593,7 @@ void gbReset() gbTimerMode = 0; gbSpeed = 0; gbJoymask[0] = gbJoymask[1] = gbJoymask[2] = gbJoymask[3] = 0; - + if(gbCgbMode) { gbSpeed = 0; gbHdmaOn = 0; @@ -2667,7 +2667,7 @@ void gbReset() gbMemoryMap[0x0c] = &gbMemory[0xc000]; gbMemoryMap[0x0d] = &gbWram[0x1000]; gbMemoryMap[0x0e] = &gbMemory[0xe000]; - gbMemoryMap[0x0f] = &gbMemory[0xf000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; } else { gbMemoryMap[0x08] = &gbMemory[0x8000]; gbMemoryMap[0x09] = &gbMemory[0x9000]; @@ -2676,7 +2676,7 @@ void gbReset() gbMemoryMap[0x0c] = &gbMemory[0xc000]; gbMemoryMap[0x0d] = &gbMemory[0xd000]; gbMemoryMap[0x0e] = &gbMemory[0xe000]; - gbMemoryMap[0x0f] = &gbMemory[0xf000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; } if(gbRam) { @@ -2708,12 +2708,12 @@ void gbWriteSaveMBC1(const char * name) systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); return; } - + fwrite(gbRam, 1, (gbRamSizeMask+1), gzFile); - + fclose(gzFile); } } @@ -2750,7 +2750,7 @@ void gbWriteSaveMBC3(const char * name, bool extendedSave) systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); return; } - + fwrite(gbRam, 1, (gbRamSizeMask+1), @@ -2777,7 +2777,7 @@ void gbWriteSaveMBC5(const char * name) systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); return; } - + fwrite(gbRam, 1, (gbRamSizeMask+1), @@ -2831,7 +2831,7 @@ void gbWriteSaveTAMA5(const char * name, bool extendedSave) 1, 14*sizeof(int) + sizeof(time_t), gzFile); - + fclose(gzFile); } @@ -2845,12 +2845,12 @@ void gbWriteSaveMMM01(const char * name) systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), name); return; } - + fwrite(gbRam, 1, (gbRamSizeMask+1), gzFile); - + fclose(gzFile); } } @@ -2865,11 +2865,11 @@ bool gbReadSaveMBC1(const char * name) if(gzFile == NULL) { return false; } - + int read = gzread(gzFile, gbRam, (gbRamSizeMask+1)); - + if(read != (gbRamSizeMask+1)) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -2878,7 +2878,7 @@ bool gbReadSaveMBC1(const char * name) return false; } - // Also checks if the battery file it bigger than gbRamSizeMask+1 ! + // Also checks if the battery file it bigger than gbRamSizeMask+1 ! u8 data[1]; data[0] = 0; @@ -2892,7 +2892,7 @@ bool gbReadSaveMBC1(const char * name) gbBatteryError = true; return false; } - + gzclose(gzFile); return true; } @@ -2915,7 +2915,7 @@ bool gbReadSaveMBC2(const char * name) 1, 256, file); - + if(read != 256) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -2924,7 +2924,7 @@ bool gbReadSaveMBC2(const char * name) return false; } - // Also checks if the battery file it bigger than gbRamSizeMask+1 ! + // Also checks if the battery file it bigger than gbRamSizeMask+1 ! u8 data[1]; data[0] = 0; @@ -2939,7 +2939,7 @@ bool gbReadSaveMBC2(const char * name) gbBatteryError = true; return false; } - + fclose(file); return true; } @@ -2963,10 +2963,10 @@ bool gbReadSaveMBC3(const char * name) (gbRamSizeMask+1)); else read = (gbRamSizeMask+1); - + bool res = true; - + if(read != (gbRamSizeMask+1)) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -2990,7 +2990,7 @@ bool gbReadSaveMBC3(const char * name) } else { - // Also checks if the battery file it bigger than gbRamSizeMask+1+RTC ! + // Also checks if the battery file it bigger than gbRamSizeMask+1+RTC ! u8 data[1]; data[0] = 0; @@ -3005,7 +3005,7 @@ bool gbReadSaveMBC3(const char * name) } } } - + gzclose(gzFile); return res; } @@ -3023,7 +3023,7 @@ bool gbReadSaveMBC5(const char * name) int read = gzread(gzFile, gbRam, (gbRamSizeMask+1)); - + if(read != (gbRamSizeMask+1)) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -3033,7 +3033,7 @@ bool gbReadSaveMBC5(const char * name) } - // Also checks if the battery file it bigger than gbRamSizeMask+1 ! + // Also checks if the battery file it bigger than gbRamSizeMask+1 ! u8 data[1]; data[0] = 0; @@ -3047,7 +3047,7 @@ bool gbReadSaveMBC5(const char * name) gbBatteryError = true; return false; } - + gzclose(gzFile); return true; } @@ -3069,7 +3069,7 @@ bool gbReadSaveMBC7(const char * name) 1, 256, file); - + if(read != 256) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -3078,7 +3078,7 @@ bool gbReadSaveMBC7(const char * name) return false; } - // Also checks if the battery file it bigger than gbRamSizeMask+1 ! + // Also checks if the battery file it bigger than gbRamSizeMask+1 ! u8 data[1]; data[0] = 0; @@ -3093,7 +3093,7 @@ bool gbReadSaveMBC7(const char * name) gbBatteryError = true; return false; } - + fclose(file); return true; } @@ -3123,7 +3123,7 @@ bool gbReadSaveTAMA5(const char * name) gbTAMA5ramSize); bool res = true; - + if(read != (gbRamSizeMask+gbTAMA5ramSize+1)) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -3147,7 +3147,7 @@ bool gbReadSaveTAMA5(const char * name) } else { - // Also checks if the battery file it bigger than gbRamSizeMask+1+RTC ! + // Also checks if the battery file it bigger than gbRamSizeMask+1+RTC ! u8 data[1]; data[0] = 0; @@ -3162,7 +3162,7 @@ bool gbReadSaveTAMA5(const char * name) } } } - + gzclose(gzFile); return res; } @@ -3176,12 +3176,12 @@ bool gbReadSaveMMM01(const char * name) if(gzFile == NULL) { return false; - } - + } + int read = gzread(gzFile, gbRam, (gbRamSizeMask+1)); - + if(read != (gbRamSizeMask+1)) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); @@ -3190,7 +3190,7 @@ bool gbReadSaveMMM01(const char * name) return false; } - // Also checks if the battery file it bigger than gbRamSizeMask+1 ! + // Also checks if the battery file it bigger than gbRamSizeMask+1 ! u8 data[1]; data[0] = 0; @@ -3204,7 +3204,7 @@ bool gbReadSaveMMM01(const char * name) gbBatteryError = true; return false; } - + gzclose(gzFile); return true; } @@ -3218,9 +3218,9 @@ void gbInit() gbSgbInit(); gbMemory = (u8 *)malloc(65536); - + pix = (u8 *)calloc(1,4*257*226); - + gbLineBuffer = (u16 *)malloc(160 * sizeof(u16)); } @@ -3363,12 +3363,12 @@ bool gbReadBatteryFile(const char *file) 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; } - + fseek(file, 0x4, SEEK_SET); char buffer[16]; char buffer2[16]; @@ -3409,10 +3409,10 @@ bool gbReadGSASnapshot(const char *fileName) fileName); fclose(file); return false; - } + } fclose(file); gbReset(); - return true; + return true; } variable_desc gbSaveGameStruct[] = { @@ -3499,18 +3499,18 @@ variable_desc gbSaveGameStruct[] = { static bool gbWriteSaveState(gzFile gzFile) { - + utilWriteInt(gzFile, GBSAVE_GAME_VERSION); utilGzWrite(gzFile, &gbRom[0x134], 15); utilWriteInt(gzFile, useBios); utilWriteInt(gzFile, inBios); - + utilWriteData(gzFile, gbSaveGameStruct); utilGzWrite(gzFile, &IFF, 2); - + if(gbSgbMode) { gbSgbSaveGame(gzFile); } @@ -3527,9 +3527,9 @@ static bool gbWriteSaveState(gzFile gzFile) utilGzWrite(gzFile, &gbDataMMM01, sizeof(gbDataMMM01)); utilGzWrite(gzFile, gbPalette, 128 * sizeof(u16)); - + utilGzWrite(gzFile, &gbMemory[0x8000], 0x8000); - + if(gbRamSize && gbRam) { utilWriteInt(gzFile, gbRamSize); utilGzWrite(gzFile, gbRam, gbRamSize); @@ -3540,7 +3540,7 @@ static bool gbWriteSaveState(gzFile gzFile) utilGzWrite(gzFile, gbWram, 0x8000); } - gbSoundSaveGame(gzFile); + gbSoundSaveGame(gzFile); gbCheatsSaveGame(gzFile); @@ -3585,9 +3585,9 @@ bool gbWriteSaveState(const char *name) if(gzFile == NULL) return false; - + bool res = gbWriteSaveState(gzFile); - + utilGzClose(gzFile); return res; } @@ -3601,9 +3601,9 @@ static bool gbReadSaveState(gzFile gzFile) N_("Unsupported VisualBoy save game version %d"), version); return false; } - + u8 romname[20]; - + utilGzRead(gzFile, romname, 15); if(memcmp(&gbRom[0x134], romname, 15) != 0) { @@ -3636,7 +3636,7 @@ static bool gbReadSaveState(gzFile gzFile) gbReset(); inBios = ib; - + utilReadData(gzFile, gbSaveGameStruct); @@ -3667,7 +3667,7 @@ static bool gbReadSaveState(gzFile gzFile) if(version >= GBSAVE_GAME_VERSION_7) { utilGzRead(gzFile, &IFF, 2); } - + if(gbSgbMode) { gbSgbReadGame(gzFile, version); } else { @@ -3708,14 +3708,14 @@ static bool gbReadSaveState(gzFile gzFile) if (version < 11) 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) { @@ -3739,7 +3739,7 @@ static bool gbReadSaveState(gzFile gzFile) memset(gbObp1Line, (gbObp1[0] | (gbObp1[1]<<2) | (gbObp1[2]<<4) | (gbObp1[3]<<6)), sizeof(gbObp1Line)); memset(gbSpritesTicks, 0x0, sizeof(gbSpritesTicks)); - + if (inBios) { gbMemoryMap[0x00] = &gbMemory[0x0000]; @@ -3762,7 +3762,7 @@ static bool gbReadSaveState(gzFile gzFile) gbMemoryMap[0x0c] = &gbMemory[0xc000]; gbMemoryMap[0x0d] = &gbMemory[0xd000]; gbMemoryMap[0x0e] = &gbMemory[0xe000]; - gbMemoryMap[0x0f] = &gbMemory[0xf000]; + gbMemoryMap[0x0f] = &gbMemory[0xf000]; switch(gbRomType) { case 0x00: @@ -3832,7 +3832,7 @@ static bool gbReadSaveState(gzFile gzFile) 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]; @@ -3847,7 +3847,7 @@ static bool gbReadSaveState(gzFile gzFile) if(gbBorderOn && !gbSgbMask) { gbSgbRenderBorder(); } - + systemDrawScreen(); if(version > GBSAVE_GAME_VERSION_1) @@ -3955,11 +3955,11 @@ bool gbReadSaveState(const char *name) if(gzFile == NULL) { return false; } - + bool res = gbReadSaveState(gzFile); - + utilGzClose(gzFile); - + return res; } @@ -4003,9 +4003,9 @@ void gbCleanUp() free(pix); pix = NULL; } - + gbSgbShutdown(); - + if(gbVram != NULL) { free(gbVram); gbVram = NULL; @@ -4050,7 +4050,7 @@ bool gbLoadRom(const char *szFile) bios = NULL; } bios = (u8 *)calloc(1,0x100); - + return gbUpdateSizes(); } @@ -4149,7 +4149,7 @@ bool gbUpdateSizes() gbRom[0x147] = gbRomType; mapperReadRAM = NULL; - + switch(gbRomType) { case 0x00: case 0x01: @@ -4334,17 +4334,17 @@ void gbDrawLine() *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++]]; @@ -4370,7 +4370,7 @@ void gbDrawLine() dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; - + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; @@ -4379,7 +4379,7 @@ void gbDrawLine() dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; - + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; @@ -4388,7 +4388,7 @@ void gbDrawLine() dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; - + *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; dest+= 3; *((u32 *)dest) = systemColorMap32[gbLineMix[x++]]; @@ -4411,17 +4411,17 @@ void gbDrawLine() *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++]]; @@ -4437,7 +4437,7 @@ void gbEmulate(int ticksToStop) gbRegister tempRegister; u8 tempValue; s8 offset; - + clockTicks = 0; gbDmaTicks = 0; @@ -4446,7 +4446,7 @@ void gbEmulate(int ticksToStop) int opcode1 = 0; int opcode2 = 0; bool execute = false; - + while(1) { #ifndef FINAL_VERSION if(systemDebug) { @@ -4492,7 +4492,7 @@ void gbEmulate(int ticksToStop) if ((clockTicks<=0) || (gbInterruptWait)) clockTicks = 1;*/ - + } else { // First we apply the clockTicks, then we execute the opcodes. @@ -4509,15 +4509,15 @@ void gbEmulate(int ticksToStop) PC.W--; IFF &= ~2; } - + clockTicks = gbCycles[opcode]; - + switch(opcode) { case 0xCB: // extended opcode opcode2 = opcode = gbReadOpcode(PC.W++); clockTicks = gbCyclesCB[opcode]; - break; + break; } gbOldClockTicks = clockTicks-1; gbIntBreak = 1; @@ -4552,7 +4552,7 @@ void gbEmulate(int ticksToStop) if (IFF & 0x38) { int tempIFF = (IFF >> 4) & 3; - + if (tempIFF <=clockTicks) { tempIFF = 0; @@ -4578,14 +4578,14 @@ void gbEmulate(int ticksToStop) if(gbSgbMode) { if(gbSgbPacketTimeout) { gbSgbPacketTimeout -= clockTicks; - + if(gbSgbPacketTimeout <= 0) gbSgbResetPacketState(); } } - + ticksToStop -= clockTicks; - + // DIV register emulation gbDivTicks -= clockTicks; while(gbDivTicks <= 0) { @@ -4664,8 +4664,8 @@ void gbEmulate(int ticksToStop) { case 0: { - // H-Blank - // check if we reached the V-Blank period + // H-Blank + // check if we reached the V-Blank period if(register_LY == 144) { // Yes, V-Blank // set the LY increment counter @@ -4760,9 +4760,9 @@ void gbEmulate(int ticksToStop) if (register_LY>oldRegister_WY) tempgbWindowLine = 146; } - + int wy = inUseRegister_WY; - + if(register_LY >= inUseRegister_WY) { if (tempgbWindowLine == -1) @@ -4772,7 +4772,7 @@ void gbEmulate(int ticksToStop) wx -= 7; if (wx<0) wx = 0; - + if((wx <= 159) && (tempgbWindowLine <= 143)) for (int i = wx; i<300; i++) if (gbSpeed) @@ -4832,8 +4832,8 @@ void gbEmulate(int ticksToStop) switch(gbLcdModeDelayed) { case 0: { - // H-Blank - + // H-Blank + memset(gbSCYLine,gbSCYLine[299],sizeof(gbSCYLine)); memset(gbSCXLine,gbSCXLine[299],sizeof(gbSCXLine)); memset(gbBgpLine,gbBgpLine[299],sizeof(gbBgpLine)); @@ -4843,7 +4843,7 @@ void gbEmulate(int ticksToStop) if (gbWindowLine <0) oldRegister_WY = register_WY; - // check if we reached the V-Blank period + // check if we reached the V-Blank period if(register_LY == 144) { // Yes, V-Blank // set the LY increment counter @@ -4851,14 +4851,14 @@ void gbEmulate(int ticksToStop) if(register_LCDC & 0x80) { if (gbHardware & 0xa) { - + register_IF |= 1; // V-Blank interrupt gbInterruptLaunched |=1; } - + } - + gbLcdTicksDelayed += GBLCD_MODE_1_CLOCK_TICKS; gbLcdModeDelayed = 1; @@ -4875,7 +4875,7 @@ void gbEmulate(int ticksToStop) else systemShowSpeed(0); gbLastTime = currentTime; - gbFrameCount = 0; + gbFrameCount = 0; } if(systemReadJoypads()) { @@ -4892,14 +4892,14 @@ void gbEmulate(int ticksToStop) } } else { gbJoymask[0] = systemReadJoypad(-1); - } + } } int newmask = gbJoymask[0] & 255; if(gbRomType == 0x22) { systemUpdateMotionSensor(); } - + if(newmask) { gbMemory[0xff0f] |= 16; @@ -4907,7 +4907,7 @@ void gbEmulate(int ticksToStop) newmask = (gbJoymask[0] >> 10); - + speedup = (newmask & 1) ? true : false; gbCapture = (newmask & 2) ? true : false; @@ -4916,7 +4916,7 @@ void gbEmulate(int ticksToStop) systemScreenCapture(gbCaptureNumber); } gbCapturePrevious = gbCapture; - + if(gbFrameSkipCount >= framesToSkip) { if(!gbSgbMask) @@ -5048,7 +5048,7 @@ void gbEmulate(int ticksToStop) while (gbLcdLYIncrementTicks <=0) { register_LY = ((register_LY+1)%154); - gbLcdLYIncrementTicks+=GBLY_INCREMENT_CLOCK_TICKS; + gbLcdLYIncrementTicks+=GBLY_INCREMENT_CLOCK_TICKS; } if (gbScreenTicks <= 0) { @@ -5071,7 +5071,7 @@ void gbEmulate(int ticksToStop) register_LY = register_LYLcdOff; } } - + if (gbWhiteScreen) { gbLcdLYIncrementTicks -= clockTicks; @@ -5079,7 +5079,7 @@ void gbEmulate(int ticksToStop) while (gbLcdLYIncrementTicks <=0) { register_LY = ((register_LY+1)%154); - gbLcdLYIncrementTicks+=GBLY_INCREMENT_CLOCK_TICKS; + gbLcdLYIncrementTicks+=GBLY_INCREMENT_CLOCK_TICKS; if (register_LY<144) { @@ -5125,7 +5125,7 @@ void gbEmulate(int ticksToStop) } } else { gbJoymask[0] = systemReadJoypad(-1); - } + } } gbFrameCount++; @@ -5141,7 +5141,7 @@ void gbEmulate(int ticksToStop) else systemShowSpeed(0); gbLastTime = currentTime; - gbFrameCount = 0; + gbFrameCount = 0; } } } @@ -5176,7 +5176,7 @@ void gbEmulate(int ticksToStop) #endif if(gbMemory[0xff02] & 1) { gbSerialTicks -= clockTicks; - + // overflow while(gbSerialTicks <= 0) { // shift serial byte to right and put a 1 bit in its place @@ -5202,7 +5202,7 @@ void gbEmulate(int ticksToStop) } #endif } - + soundTicks -= clockTicks; @@ -5244,13 +5244,13 @@ void gbEmulate(int ticksToStop) 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); @@ -5272,7 +5272,7 @@ void gbEmulate(int ticksToStop) if (gbIntBreak == 1) { gbIntBreak = 0; - if ((register_IE & register_IF & gbInterruptLaunched & 0x3) && + if ((register_IE & register_IF & gbInterruptLaunched & 0x3) && ((IFF & 0x81) == 1) && (!gbInterruptWait) && (execute)) { gbIntBreak = 2; @@ -5298,7 +5298,7 @@ void gbEmulate(int ticksToStop) #include "gbCodesCB.h" } break; -#include "gbCodes.h" +#include "gbCodes.h" } execute = false; @@ -5332,7 +5332,7 @@ void gbEmulate(int ticksToStop) if ((register_IE & register_IF & 0x1f) && (IFF & 0x81) && (!gbInterruptWait)) - { + { if (IFF & 1) { @@ -5363,7 +5363,7 @@ void gbEmulate(int ticksToStop) if (IFF & 0x08) IFF &=~0x79; - + // Used to apply the interrupt's execution time. if (gbDmaTicks) { @@ -5398,7 +5398,7 @@ void gbEmulate(int ticksToStop) } } else { gbJoymask[0] = systemReadJoypad(-1); - } + } } } return; diff --git a/src/gb/gbCheats.cpp b/src/gb/gbCheats.cpp index 0914d9ec..37f52889 100644 --- a/src/gb/gbCheats.cpp +++ b/src/gb/gbCheats.cpp @@ -69,9 +69,9 @@ void gbCheatsReadGame(gzFile gzFile, int version) gbAddGgCheat(tmpCheat.cheatCode, tmpCheat.cheatDesc); } } - + int gbGsOn = utilReadInt(gzFile); - + if(gbGsOn) { int n = utilReadInt(gzFile); gbXxCheat tmpCheat; @@ -112,7 +112,7 @@ bool gbCheatsLoadCheatList(const char *file) gbCheatNumber = 0; gbCheatUpdateMap(); - + int count = 0; FILE *f = fopen(file, "rb"); @@ -126,7 +126,7 @@ bool gbCheatsLoadCheatList(const char *file) fclose(f); return false; } - + if(version != 1) { systemMessage(MSG_UNSUPPORTED_CHEAT_LIST_VERSION, N_("Unsupported cheat list version %d"), version); @@ -146,12 +146,12 @@ bool gbCheatsLoadCheatList(const char *file) 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; @@ -159,7 +159,7 @@ bool gbCheatsLoadCheatList(const char *file) gbCheatNumber = count; gbCheatUpdateMap(); - + return true; } @@ -169,7 +169,7 @@ bool gbVerifyGsCode(const char *code) if(len == 0) return true; - + if(len != 8) return false; @@ -198,12 +198,12 @@ void gbAddGsCheat(const char *code, const char *desc) 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]); @@ -244,7 +244,7 @@ bool gbVerifyGgCode(const char *code) if(len == 0) return true; - + if(!GBCHEAT_IS_HEX(code[0])) return false; if(!GBCHEAT_IS_HEX(code[1])) @@ -296,7 +296,7 @@ bool gbVerifyGgCode(const char *code) compare ^= 0x45; int cloak = (GBCHEAT_HEX_VALUE(code[8])) ^ (GBCHEAT_HEX_VALUE(code[9])); - + if(cloak >=1 && cloak <= 7) return false; @@ -316,27 +316,27 @@ void gbAddGgCheat(const char *code, const char *desc) N_("Invalid GameGenie code: %s"), code); return; } - + int i = gbCheatNumber; size_t len = strlen(code); - + strcpy(gbCheatList[i].cheatCode, code); strcpy(gbCheatList[i].cheatDesc, desc); gbCheatList[i].code = 0x101; 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; @@ -351,9 +351,9 @@ void gbAddGgCheat(const char *code, const char *desc) gbCheatList[i].enabled = true; - + gbCheatMap[gbCheatList[i].address] = true; - + gbCheatNumber++; } @@ -364,12 +364,12 @@ void gbCheatRemove(int i) 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(); @@ -404,12 +404,12 @@ void gbCheatDisable(int i) 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); @@ -419,7 +419,7 @@ bool gbCheatReadGSCodeFile(const char *fileName) char code[9]; int i; for(i = 0; i < count; i++) { - fread(&dummy, 1, 2, file); + fread(&dummy, 1, 2, file); fread(desc, 1, 12, file); desc[12] = 0; fread(code, 1, 8, file); diff --git a/src/gb/gbCodes.h b/src/gb/gbCodes.h index 73dd088b..5cbae965 100644 --- a/src/gb/gbCodes.h +++ b/src/gb/gbCodes.h @@ -17,10 +17,10 @@ // 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: + case 0x00: // NOP break; - case 0x01: + case 0x01: // LD BC, NNNN BC.B.B0=gbReadOpcode(PC.W++); BC.B.B1=gbReadOpcode(PC.W++); @@ -33,14 +33,14 @@ // INC BC BC.W++; break; - case 0x04: + case 0x04: // INC B - BC.B.B1++; + 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--; + 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; @@ -75,7 +75,7 @@ case 0x0b: // DEC BC BC.W--; - break; + break; case 0x0c: // INC C BC.B.B0++; @@ -86,7 +86,7 @@ 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; + break; case 0x0e: // LD C, NN BC.B.B0=gbReadOpcode(PC.W++); @@ -102,10 +102,10 @@ opcode = gbReadOpcode(PC.W++); if(gbCgbMode) { if(gbMemory[0xff4d] & 1) { - + gbSpeedSwitch(); //clockTicks += 228*144-(gbSpeed ? 62 : 63); - + if(gbSpeed == 0) gbMemory[0xff4d] = 0x00; else @@ -161,7 +161,7 @@ case 0x1a: // LD A,(DE) AF.B.B1=gbReadMemory(DE.W); - break; + break; case 0x1b: // DEC DE DE.W--; @@ -180,7 +180,7 @@ case 0x1e: // LD E,NN DE.B.B0=gbReadOpcode(PC.W++); - break; + break; case 0x1f: // RRA tempValue=AF.B.B1&0x01; @@ -200,7 +200,7 @@ // LD HL,NNNN HL.B.B0=gbReadOpcode(PC.W++); HL.B.B1=gbReadOpcode(PC.W++); - break; + break; case 0x22: // LDI (HL),A gbWriteMemory(HL.W++,AF.B.B1); @@ -254,7 +254,7 @@ case 0x2b: // DEC HL HL.W--; - break; + break; case 0x2c: // INC L HL.B.B0++; @@ -269,7 +269,7 @@ case 0x2e: // LD L,NN HL.B.B0=gbReadOpcode(PC.W++); - break; + break; case 0x2f: // CPL AF.B.B1 ^= 255; @@ -316,7 +316,7 @@ case 0x37: // SCF AF.B.B0 = AF.B.B0 & Z_FLAG | C_FLAG; - break; + break; case 0x38: // JR C,NN if(AF.B.B0&C_FLAG) { @@ -587,7 +587,7 @@ case 0x38: } else { - // if (IE & IF) and interrupts are disabeld, + // if (IE & IF) and interrupts are disabeld, // Halt is cancelled. if ((register_IE & register_IF & 0x1f) && !(IFF & 1)) { @@ -1309,7 +1309,7 @@ case 0x38: 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) | diff --git a/src/gb/gbDis.cpp b/src/gb/gbDis.cpp index 85651fd4..4a589ae5 100644 --- a/src/gb/gbDis.cpp +++ b/src/gb/gbDis.cpp @@ -160,7 +160,7 @@ int gbDis(char *buffer, u16 address) u16 addr = address; sprintf(p, "%04x ", address); p += 12; - + u8 opcode = GB_READ(address); address++; const char *mnen; @@ -175,7 +175,7 @@ int gbDis(char *buffer, u16 address) } while(op->value != (opcode & op->mask)) op++; mnen = op->mnen; - + u8 b0, b1; s8 disp; int shift; diff --git a/src/gb/gbGfx.cpp b/src/gb/gbGfx.cpp index 07872e88..6b8140e9 100644 --- a/src/gb/gbGfx.cpp +++ b/src/gb/gbGfx.cpp @@ -73,7 +73,7 @@ void gbRenderLine() bank0 = &gbMemory[0x8000]; bank1 = NULL; } - + int tile_map = 0x1800; if((register_LCDC & 8) != 0) tile_map = 0x1c00; @@ -82,7 +82,7 @@ void gbRenderLine() if((register_LCDC & 16) != 0) tile_pattern = 0x0000; - + int x = 0; int y = register_LY; @@ -96,7 +96,7 @@ void gbRenderLine() sy+=y; sy &= 255; - + int tx = sx >> 3; int ty = sy >> 3; @@ -104,17 +104,17 @@ void gbRenderLine() 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 & 0x10)) tile ^= 0x80; @@ -128,11 +128,11 @@ void gbRenderLine() 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]; @@ -140,34 +140,34 @@ void gbRenderLine() 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 = (gbBgpLine[x+(gbSpeed ? 5 : 11)+SpritesTicks]>>(c<<1)) &3; + c = (gbBgpLine[x+(gbSpeed ? 5 : 11)+SpritesTicks]>>(c<<1)) &3; 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; } } @@ -178,9 +178,9 @@ void gbRenderLine() break; bx >>= 1; } - + bx = 128; - + SpritesTicks = gbSpritesTicks[x]*(gbSpeed ? 2 : 4); sx = gbSCXLine[x+(gbSpeed ? 0 : 4)+SpritesTicks]; @@ -188,7 +188,7 @@ void gbRenderLine() sy = gbSCYLine[x+(gbSpeed ? 11 : 5)+SpritesTicks]; - tx = ((sx+x)>>3) & 0x1f; + tx = ((sx+x)>>3) & 0x1f; sy+=y; @@ -206,7 +206,7 @@ void gbRenderLine() if(bank1) attrs = bank1[tile_map_line_y + tx]; - + tile = bank0[tile_map_line_y + tx]; if(!(register_LCDC & 0x10)) @@ -229,7 +229,7 @@ void gbRenderLine() gbLineBuffer[i] = 0; } } - + // do the window display // LCDC.0 also enables/disables the window in !gbCgbMode ?!?! // (tested on real hardware) @@ -249,7 +249,7 @@ void gbRenderLine() } int wy = inUseRegister_WY; - + if(y >= inUseRegister_WY) { if (gbWindowLine == -1) @@ -258,21 +258,21 @@ void gbRenderLine() int wx = register_WX; int swx = 0; wx -= 7; - + if( wx <= 159 && gbWindowLine <= 143) { - + tile_map = 0x1800; - + if((register_LCDC & 0x40) != 0) tile_map = 0x1c00; - - + + tx = 0; ty = gbWindowLine >> 3; - + bx = 128; by = gbWindowLine & 7; - + // Tries to emulate the 'window scrolling bug' when wx == 0 (ie. wx-7 == -7). // Nothing close to perfect, but good enought for now... if (wx == -7) @@ -281,7 +281,7 @@ void gbRenderLine() bx >>= ((gbSCXLine[0]+((swx != 1) ? 1 : 0)) & 7); if (swx == 1) swx = 2; - + //bx >>= ((gbSCXLine[0]+(((swx>1) && (swx != 7)) ? 1 : 0)) & 7); if ((swx == 7)) @@ -296,24 +296,24 @@ void gbRenderLine() 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((register_LCDC & 16) == 0) { if(tile < 128) tile += 128; else tile -= 128; } - + tile_pattern_address = tile_pattern + tile * 16 + by*2; if (wx) @@ -323,11 +323,11 @@ void gbRenderLine() 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]; @@ -335,12 +335,12 @@ void gbRenderLine() 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); @@ -351,21 +351,21 @@ void gbRenderLine() gbLineBuffer[x] = 0x300 + c; else gbLineBuffer[x] = 0x100 + c; - + if(gbCgbMode) { c = c + (attrs & 7) * 4; } else { - c = (gbBgpLine[x+(gbSpeed ? 5 : 11)+gbSpritesTicks[x]*(gbSpeed ? 2 : 4)]>>(c<<1)) &3; + c = (gbBgpLine[x+(gbSpeed ? 5 : 11)+gbSpritesTicks[x]*(gbSpeed ? 2 : 4)]>>(c<<1)) &3; 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; + + c = c + 4*palette; } } gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] : @@ -383,8 +383,8 @@ void gbRenderLine() tile = bank0[tile_map_line_y + tx]; if(bank1) attrs = bank1[tile_map_line_y + tx]; - - if((register_LCDC & 16) == 0) { + + if((register_LCDC & 16) == 0) { if(tile < 128) tile += 128; else tile -= 128; } @@ -436,7 +436,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, bank0 = &gbMemory[0x8000]; bank1 = NULL; } - + int init = 0x0000; for (int i = 0; i<4; i++) @@ -448,7 +448,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, int flipx = (flags & 0x20); int flipy = (flags & 0x40); - + if((flags & 0x10)) pal = gbObp1; @@ -457,7 +457,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, } int prio = flags & 0x80; - + int address = init + tile * 16 + 2*t; int a = 0; int b = 0; @@ -469,7 +469,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, a = bank0[address++]; b = bank0[address++]; } - + for(int xx = 0; xx < 8; xx++) { u8 mask = 1 << (7-xx); u8 c = 0; @@ -477,7 +477,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, c++; if( (b & mask)) c+=2; - + if(c==0) continue; int xxx = xx+x; @@ -516,8 +516,8 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, continue; } } - } - + } + gbLineBuffer[xxx] = 0x200 + spriteNumber; @@ -530,13 +530,13 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags, 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; + + c = c + 4*palette; } else { c += 4; } @@ -552,7 +552,7 @@ void gbDrawSprites(bool draw) int x = 0; int y = 0; int count = 0; - + int size = (register_LCDC & 4); if (!draw) @@ -560,10 +560,10 @@ void gbDrawSprites(bool draw) 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++]; @@ -595,7 +595,7 @@ void gbDrawSprites(bool draw) // sprite limit reached! if(count >= 10) break; - } + } } return; } diff --git a/src/gb/gbMemory.cpp b/src/gb/gbMemory.cpp index 7ea6d979..2c24f331 100644 --- a/src/gb/gbMemory.cpp +++ b/src/gb/gbMemory.cpp @@ -190,7 +190,7 @@ void mapperMBC1RAM(u16 address, u8 value) // MBC1 read RAM u8 mapperMBC1ReadRAM(u16 address) { - + if(gbDataMBC1.mapperRAMEnable) return gbMemoryMap[address>>12][address & 0x0fff]; @@ -627,7 +627,7 @@ void mapperMBC5RAM(u16 address, u8 value) // MBC5 read RAM u8 mapperMBC5ReadRAM(u16 address) { - + if(gbDataMBC5.mapperRAMEnable) return gbMemoryMap[address>>12][address & 0x0fff]; @@ -790,10 +790,10 @@ 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) { @@ -808,7 +808,7 @@ void mapperMBC7RAM(u16 address, u8 value) gbDataMBC7.state=0; } } - + if(!oldSk && gbDataMBC7.sk) { if(gbDataMBC7.idle) { if(value & 0x02) { @@ -855,7 +855,7 @@ void mapperMBC7RAM(u16 address, u8 value) gbDataMBC7.buffer <<= 1; gbDataMBC7.buffer |= (value&0x02)?1:0; gbDataMBC7.count++; - + switch(gbDataMBC7.code) { case 0: if(gbDataMBC7.count==16) { @@ -897,7 +897,7 @@ void mapperMBC7RAM(u16 address, u8 value) gbDataMBC7.state=4; gbDataMBC7.count=0; gbDataMBC7.buffer = (gbMemory[0xa000+gbDataMBC7.address*2]<<8)| - (gbMemory[0xa000+gbDataMBC7.address*2+1]); + (gbMemory[0xa000+gbDataMBC7.address*2+1]); } break; case 3: @@ -913,9 +913,9 @@ void mapperMBC7RAM(u16 address, u8 value) } } } - + if (oldSk && !gbDataMBC7.sk) { - if (gbDataMBC7.state==4) { + if (gbDataMBC7.state==4) { gbDataMBC7.value = (gbDataMBC7.buffer & 0x8000)?1:0; gbDataMBC7.buffer <<= 1; gbDataMBC7.count++; @@ -1446,7 +1446,7 @@ void mapperTAMA5RAM(u16 address, u8 value) { gbDataTAMA5.mapperHours = (data/16)*10 + data%16; } - else + else { gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = data; } @@ -1457,7 +1457,7 @@ void mapperTAMA5RAM(u16 address, u8 value) case 1: // 'Commands' Register { gbMemoryMap[0xa][1] = gbDataTAMA5.mapperCommandNumber = value; - + // This should be only a 'is the flashrom ready ?' command. // However as I couldn't find any 'copy' command // (that seems to be needed for the saving system to work) @@ -1501,7 +1501,7 @@ void mapperTAMA5RAM(u16 address, u8 value) systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; } } - } + } } } diff --git a/src/gb/gbPrinter.cpp b/src/gb/gbPrinter.cpp index cf676c9b..1f6debb6 100644 --- a/src/gb/gbPrinter.cpp +++ b/src/gb/gbPrinter.cpp @@ -78,7 +78,7 @@ void gbPrinterShowData() pal[3].g = 0; pal[3].b = 0; set_palette(pal); - acquire_screen(); + acquire_screen(); u8 *data = gbPrinterData; for(int y = 0; y < 0x12; y++) { for(int x = 0; x < 0x14; x++) { @@ -100,7 +100,7 @@ void gbPrinterShowData() release_screen(); while(!keypressed()) { } - */ + */ } void gbPrinterReceiveData() @@ -165,12 +165,12 @@ u8 gbPrinterSend(u8 b) gbPrinterPacket[gbPrinterCount++] = b; gbPrinterState++; } else { - // todo: handle failure + // todo: handle failure gbPrinterReset(); } break; case 1: - // receiving preamble + // receiving preamble if(b == 0x33) { gbPrinterPacket[gbPrinterCount++] = b; gbPrinterState++; diff --git a/src/gb/gbSGB.cpp b/src/gb/gbSGB.cpp index 4f516d87..677d1ad9 100644 --- a/src/gb/gbSGB.cpp +++ b/src/gb/gbSGB.cpp @@ -91,12 +91,12 @@ void gbSgbReset() 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 < 32; i++) { gbPalette[i*4] = (0x1f) | (0x1f << 5) | (0x1f << 10); gbPalette[i*4+1] = (0x15) | (0x15 << 5) | (0x15 << 10); @@ -123,7 +123,7 @@ void gbSgbShutdown() if(gbSgbBorder != NULL) { free(gbSgbBorder); gbSgbBorder = NULL; - } + } } void gbSgbFillScreen(u16 color) @@ -178,7 +178,7 @@ void gbSgbRenderScreenToBuffer() u16 patternAddress = 0x8800; int flag = 1; - + if(register_LCDC & 0x10) { patternAddress = 0x8000; flag = 0; @@ -209,7 +209,7 @@ 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]; @@ -221,10 +221,10 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr) palette += 4; palette *= 16; - + u8 xx = 0; u8 yy = 0; - + int flipX = attr & 0x40; int flipY = attr & 0x80; @@ -234,9 +234,9 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr) u8 b = *tileAddress++; u8 c = *tileAddress2++; u8 d = *tileAddress2++; - + while(mask > 0) { - + u8 color = 0; if(a & mask) color++; @@ -249,7 +249,7 @@ void gbSgbDrawBorderTile(int x, int y, int tile, int attr) u8 xxx = xx; u8 yyy = yy; - + if(flipX) xxx = 7 - xx; if(flipY) @@ -290,12 +290,12 @@ 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); } } @@ -307,9 +307,9 @@ void gbSgbPicture() gbSgbRenderScreenToBuffer(); memcpy(gbSgbBorder, gbSgbScreenBuffer, 2048); - + u16 *paletteAddr = (u16 *)&gbSgbScreenBuffer[2048]; - + for(int i = 64; i < 128; i++) { gbPalette[i] = READ16LE(paletteAddr++); } @@ -321,9 +321,9 @@ void gbSgbPicture() systemGbBorderOn(); } - if(gbBorderOn && !gbSgbMask) + if(gbBorderOn && !gbSgbMask) gbSgbRenderBorder(); - + if(gbSgbMode && gbCgbMode && gbSgbCGBSupport > 4) { gbSgbCGBSupport = 0; gbSgbMode = 0; @@ -340,15 +340,15 @@ 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(); @@ -357,9 +357,9 @@ void gbSgbSetPalette(int a,int b,u16 *p) void gbSgbScpPalette() { gbSgbRenderScreenToBuffer(); - + u16 *fromAddress = (u16 *)gbSgbScreenBuffer; - + for(int i = 0; i < 512*4; i++) { gbSgbSCPPalette[i] = READ16LE(fromAddress++); } @@ -399,7 +399,7 @@ void gbSgbSetPalette() if(atf & 0x80) { gbSgbSetATF(atf & 0x3f); } - + if(atf & 0x40) { gbSgbMask = 0; if(gbBorderOn) @@ -418,7 +418,7 @@ void gbSgbAttributeBlock() nDataSet = 1; while(nDataSet) { - u8 controlCode = (*fromAddress++) & 7; + u8 controlCode = (*fromAddress++) & 7; u8 paletteDesignation = (*fromAddress++) & 0x3f; u8 startH = (*fromAddress++) & 0x1f; u8 startV = (*fromAddress++) & 0x1f; @@ -426,7 +426,7 @@ void gbSgbAttributeBlock() 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 || @@ -444,7 +444,7 @@ void gbSgbAttributeBlock() if(controlCode & 0x02) *toAddress = (paletteDesignation>>2) & 0x03; else if(controlCode == 0x01) - *toAddress = paletteDesignation & 0x03; + *toAddress = paletteDesignation & 0x03; } toAddress++; } @@ -461,9 +461,9 @@ void gbSgbSetColumnPalette(u8 col, u8 p) col = 19; p &= 3; - + u8 *toAddress = &gbSgbATF[col]; - + for(u8 y = 0; y < 18; y++) { *toAddress = p; toAddress += 20; @@ -478,9 +478,9 @@ void gbSgbSetRowPalette(u8 row, u8 p) row = 17; p &= 3; - + u8 *toAddress = &gbSgbATF[row*20]; - + for(u8 x = 0; x < 20; x++) { *toAddress++ = p; } @@ -516,7 +516,7 @@ void gbSgbAttributeDivide() else if ( i > coord) gbSgbSetColumnPalette(i, colorBR); else - gbSgbSetColumnPalette(i, colorOL); + gbSgbSetColumnPalette(i, colorOL); } } } @@ -561,7 +561,7 @@ void gbSgbAttributeCharacter() u8 s = 6; u8 *fromAddress = &gbSgbPacket[6]; u8 v = *fromAddress++; - + if(style) { while(nDataSet) { u8 p = (v >> s) & 3; @@ -593,14 +593,14 @@ void gbSgbAttributeCharacter() if(startV == 18) break; } - + if(s) s -= 2; else { s = 6; v = *fromAddress++; nDataSet--; - } + } } } } @@ -608,7 +608,7 @@ void gbSgbAttributeCharacter() void gbSgbSetATFList() { gbSgbRenderScreenToBuffer(); - + u8 *fromAddress = gbSgbScreenBuffer; u8 *toAddress = gbSgbATFList; @@ -631,7 +631,7 @@ void gbSgbMaskEnable() int gbSgbMaskFlag = gbSgbPacket[1] & 3; gbSgbMask = gbSgbMaskFlag; - + switch(gbSgbMaskFlag) { case 1: break; @@ -652,14 +652,14 @@ void gbSgbMaskEnable() 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) { @@ -676,7 +676,7 @@ void gbSgbChrTransfer() gbSgbMask = 0; gbSgbRenderBorder(); gbReset(); - } + } if(gbSgbCGBSupport > 4) gbSgbCGBSupport = 0; @@ -787,13 +787,13 @@ void gbSgbDoBitTransfer(u8 value) gbSgbReadingController &= 3; } } - gbSgbPacketTimeout = 0; + gbSgbPacketTimeout = 0; } else { if(value == 0x10) gbSgbReadingController |= 0x2; else if(value == 0x20) gbSgbReadingController |= 0x01; - gbSgbPacketTimeout = 0; + gbSgbPacketTimeout = 0; } gbSgbPacketTimeout = 0; break; @@ -887,7 +887,7 @@ void gbSgbSaveGame(gzFile gzFile) utilGzWrite(gzFile, gbSgbBorder, 2048); utilGzWrite(gzFile, gbSgbBorderChar, 32*256); - + utilGzWrite(gzFile, gbSgbPacket, 16*7); utilGzWrite(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16)); @@ -908,7 +908,7 @@ void gbSgbReadGame(gzFile gzFile, int version) utilGzRead(gzFile, gbSgbBorder, 2048); utilGzRead(gzFile, gbSgbBorderChar, 32*256); } - + utilGzRead(gzFile, gbSgbPacket, 16*7); utilGzRead(gzFile, gbSgbSCPPalette, 4 * 512 * sizeof(u16)); diff --git a/src/gb/gbSound.cpp b/src/gb/gbSound.cpp index 69721477..1113faba 100644 --- a/src/gb/gbSound.cpp +++ b/src/gb/gbSound.cpp @@ -137,7 +137,7 @@ bool gbDigitalSound = false; void gbSoundEvent(register u16 address, register int data) { int freq = 0; - + gbMemory[address] = data; #ifndef FINAL_VERSION @@ -195,7 +195,7 @@ void gbSoundEvent(register u16 address, register int data) sound1SweepSteps = gbMemory[NR10] & 7; sound1SweepUpDown = gbMemory[NR10] & 0x08; sound1SweepStep = 0; - + sound1Index = 0; sound1On = 1; } @@ -238,7 +238,7 @@ void gbSoundEvent(register u16 address, register int data) sound2EnvelopeUpDown = gbMemory[NR22] & 0x08; sound2ATL = sound2ATLreload; sound2EnvelopeATLReload = sound2EnvelopeATL = 689 * (gbMemory[NR22] & 7); - + sound2Index = 0; sound2On = 1; } @@ -297,13 +297,13 @@ void gbSoundEvent(register u16 address, register int data) sound4NSteps = data & 0x08; sound4Skip = (freq << 8) / NOISE_MAGIC; - + sound4Clock = data >> 4; freq = freq / soundShiftClock[sound4Clock]; sound4ShiftSkip = (freq << 8) / NOISE_MAGIC; - + break; case NR44: gbMemory[address] = data | 0xbf; @@ -316,10 +316,10 @@ void gbSoundEvent(register u16 address, register int data) sound4EnvelopeATLReload = sound4EnvelopeATL = 689 * (gbMemory[NR42] & 7); sound4On = 1; - + sound4Index = 0; sound4ShiftIndex = 0; - + if(sound4NSteps) sound4ShiftRight = 0x7fff; else @@ -366,7 +366,7 @@ void gbSoundEvent(register u16 address, register int data) int freq = 0; int value = 0; - + if(sound1On && (sound1ATL || !sound1Continue)) { sound1Index += soundQuality*sound1Skip; sound1Index &= 0x1fffffff; @@ -376,20 +376,20 @@ void gbSoundEvent(register u16 address, register int data) 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) @@ -398,22 +398,22 @@ void gbSoundEvent(register u16 address, register int data) if(sound1EnvelopeVolume) sound1EnvelopeVolume--; } - + sound1EnvelopeATL += sound1EnvelopeATLReload; } } - + if(sound1SweepATL) { sound1SweepATL-=soundQuality; - + if(sound1SweepATL<=0) { freq = (((int)(freq1high & 7)) << 8) | freq1low; - + int updown = 1; - + if(sound1SweepUpDown) updown = -1; - + int newfreq = 0; if(sound1SweepSteps) { newfreq = freq + updown * freq / (1 << sound1SweepSteps); @@ -421,7 +421,7 @@ void gbSoundEvent(register u16 address, register int data) newfreq = 0; } else newfreq = freq; - + if(newfreq < 0) { sound1SweepATL += sound1SweepATLReload; } else if(newfreq > 2047) { @@ -431,7 +431,7 @@ void gbSoundEvent(register u16 address, register int data) } else { sound1SweepATL += sound1SweepATLReload; sound1Skip = SOUND_MAGIC/(2048 - newfreq); - + freq1low = newfreq & 0xff; freq1high = (freq1high & 0xf8) |((newfreq >> 8) & 7); } @@ -446,29 +446,29 @@ void gbSoundChannel2() 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) @@ -481,21 +481,21 @@ void gbSoundChannel2() } } } -} +} void gbSoundChannel3() { int value = 0; - + if(sound3On && (sound3ATL || !sound3Continue)) { value = sound3Last; sound3Index += soundQuality*sound3Skip; sound3Index &= 0x1fffffff; - + value = gbMemory[0xff30 + (sound3Index>>25)]; - + if( (sound3Index & 0x01000000)) { value &= 0x0f; } else { @@ -503,7 +503,7 @@ void gbSoundChannel3() } value -= 8; - + switch(sound3OutputLevel) { case 0: value = 0; @@ -519,13 +519,13 @@ void gbSoundChannel3() } sound3Last = value; } - + soundBuffer[2][soundIndex] = value; - + if(sound3On) { if(sound3ATL) { sound3ATL-=soundQuality; - + if(sound3ATL <= 0 && sound3Continue) { gbMemory[NR52] &= 0xfb; sound3On = 0; @@ -558,34 +558,34 @@ void gbSoundChannel4() (sound4ShiftRight << 13)) & 0x4000) | (sound4ShiftRight >> 1); - sound4ShiftIndex -= 0x200000; + sound4ShiftIndex -= 0x200000; } } - sound4Index &= 0x1fffff; - sound4ShiftIndex &= 0x1fffff; - + 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] &= 0xf7; sound4On = 0; } } - + if(sound4EnvelopeATL) { sound4EnvelopeATL-=soundQuality; - + if(sound4EnvelopeATL <= 0) { if(sound4EnvelopeUpDown) { if(sound4EnvelopeVolume < 15) @@ -621,7 +621,7 @@ void gbSoundMix() res *= soundLevel1*256; else res *= soundLevel1*60; - + if(soundEcho) { res *= 2; res += soundFilter[soundEchoIndex]; @@ -653,7 +653,7 @@ void gbSoundMix() res >>= 1; break; } - + if(res > 32767) res = 32767; if(res < -32768) @@ -663,7 +663,7 @@ void gbSoundMix() soundFinalWave[++soundBufferIndex] = res; else soundFinalWave[soundBufferIndex++] = res; - + res = 0; if(soundBalance & 1) { @@ -683,7 +683,7 @@ void gbSoundMix() res *= soundLevel2*256; else res *= soundLevel2*60; - + if(soundEcho) { res *= 2; res += soundFilter[soundEchoIndex]; @@ -691,7 +691,7 @@ void gbSoundMix() soundFilter[soundEchoIndex++] = res; if(soundEchoIndex >= 4000) - soundEchoIndex = 0; + soundEchoIndex = 0; } if(soundLowPass) { @@ -699,7 +699,7 @@ void gbSoundMix() soundRight[3] = soundRight[2]; soundRight[2] = soundRight[1]; soundRight[1] = soundRight[0]; - soundRight[0] = res; + soundRight[0] = res; res = (soundRight[4] + 2*soundRight[3] + 8*soundRight[2] + 2*soundRight[1] + soundRight[0])/14; } @@ -718,7 +718,7 @@ void gbSoundMix() res >>= 1; break; } - + if(res > 32767) res = 32767; if(res < -32768) @@ -738,21 +738,21 @@ void gbSoundTick() gbSoundChannel2(); gbSoundChannel3(); gbSoundChannel4(); - + gbSoundMix(); } else { soundFinalWave[soundBufferIndex++] = 0; soundFinalWave[soundBufferIndex++] = 0; } - + soundIndex++; - + if(2*soundBufferIndex >= soundBufferLen) { if(systemSoundOn) { if(soundPaused) { soundResume(); - } - + } + systemWriteDataToSoundBuffer(); } soundIndex = 0; @@ -765,7 +765,7 @@ void gbSoundReset() { soundPaused = 1; soundPlay = 0; - SOUND_CLOCK_TICKS = soundQuality * 24; + SOUND_CLOCK_TICKS = soundQuality * 24; soundTicks = SOUND_CLOCK_TICKS; soundNextPosition = 0; soundMasterOn = 1; @@ -774,7 +774,7 @@ void gbSoundReset() soundLevel1 = 7; soundLevel2 = 7; soundVIN = 0; - + sound1On = 0; sound1ATL = 0; sound1Skip = 0; @@ -790,7 +790,7 @@ void gbSoundReset() sound1SweepUpDown = 0; sound1SweepStep = 0; sound1Wave = soundWavePattern[2]; - + sound2On = 0; sound2ATL = 0; sound2Skip = 0; @@ -801,14 +801,14 @@ void gbSoundReset() 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; @@ -837,10 +837,10 @@ void gbSoundReset() gbSoundEvent(0xff17, 0x00); gbSoundEvent(0xff19, 0xbf); - gbSoundEvent(0xff1a, 0x7f); + gbSoundEvent(0xff1a, 0x7f); gbSoundEvent(0xff1b, 0xff); gbSoundEvent(0xff1c, 0xbf); - gbSoundEvent(0xff1e, 0xbf); + gbSoundEvent(0xff1e, 0xbf); gbSoundEvent(0xff20, 0xff); gbSoundEvent(0xff21, 0x00); @@ -864,7 +864,7 @@ void gbSoundReset() sound2On = 0; sound3On = 0; sound4On = 0; - + int addr = 0xff30; while(addr < 0xff40) { @@ -1016,7 +1016,7 @@ void gbSoundReadGame(int version,gzFile gzFile) } soundBufferIndex = soundIndex * 2; - + utilGzRead(gzFile, soundBuffer, 4*735); utilGzRead(gzFile, soundFinalWave, 2*735); @@ -1028,7 +1028,7 @@ void gbSoundReadGame(int version,gzFile gzFile) soundQuality = -1; gbSoundSetQuality(1); } - + sound1Wave = soundWavePattern[gbMemory[NR11] >> 6]; sound2Wave = soundWavePattern[gbMemory[NR21] >> 6]; } diff --git a/src/gbafilter.cpp b/src/gbafilter.cpp index 7aef6f51..1b5aee99 100644 --- a/src/gbafilter.cpp +++ b/src/gbafilter.cpp @@ -1,227 +1,227 @@ -#include "gbafilter.h" - -#include - -extern int systemColorDepth; -extern int systemRedShift; -extern int systemGreenShift; -extern int systemBlueShift; - -extern u16 systemColorMap16[0x10000]; -extern u32 systemColorMap32[0x10000]; - -static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12, - 0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38, - 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80, - 0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0}; - -// output R G B -static const unsigned char influence[3 * 3] = { 16, 4, 4, // red - 8, 16, 8, // green - 0, 8, 16};// blue - -inline void swap(short & a, short & b) -{ - short temp = a; - a = b; - b = temp; -} - -void gbafilter_pal(u16 * buf, int count) -{ - short temp[3 * 3], s; - unsigned pix; - u8 red, green, blue; - - while (count--) - { - pix = *buf; - - s = curve[(pix >> systemGreenShift) & 0x1f]; - temp[3] = s * influence[3]; - temp[4] = s * influence[4]; - temp[5] = s * influence[5]; - - s = curve[(pix >> systemRedShift) & 0x1f]; - temp[0] = s * influence[0]; - temp[1] = s * influence[1]; - temp[2] = s * influence[2]; - - s = curve[(pix >> systemBlueShift) & 0x1f]; - temp[6] = s * influence[6]; - temp[7] = s * influence[7]; - temp[8] = s * influence[8]; - - if (temp[0] < temp[3]) swap(temp[0], temp[3]); - if (temp[0] < temp[6]) swap(temp[0], temp[6]); - if (temp[3] < temp[6]) swap(temp[3], temp[6]); - temp[3] <<= 1; - temp[0] <<= 2; - temp[0] += temp[3] + temp[6]; - - red = ((int(temp[0]) * 160) >> 17) + 4; - if (red > 31) red = 31; - - if (temp[2] < temp[5]) swap(temp[2], temp[5]); - if (temp[2] < temp[8]) swap(temp[2], temp[8]); - if (temp[5] < temp[8]) swap(temp[5], temp[8]); - temp[5] <<= 1; - temp[2] <<= 2; - temp[2] += temp[5] + temp[8]; - - blue = ((int(temp[2]) * 160) >> 17) + 4; - if (blue > 31) blue = 31; - - if (temp[1] < temp[4]) swap(temp[1], temp[4]); - if (temp[1] < temp[7]) swap(temp[1], temp[7]); - if (temp[4] < temp[7]) swap(temp[4], temp[7]); - temp[4] <<= 1; - temp[1] <<= 2; - temp[1] += temp[4] + temp[7]; - - green = ((int(temp[1]) * 160) >> 17) + 4; - if (green > 31) green = 31; - - pix = red << systemRedShift; - pix += green << systemGreenShift; - pix += blue << systemBlueShift; - - *buf++ = pix; - } -} - -void gbafilter_pal32(u32 * buf, int count) -{ - short temp[3 * 3], s; - unsigned pix; - u8 red, green, blue; - - while (count--) - { - pix = *buf; - - s = curve[(pix >> systemGreenShift) & 0x1f]; - temp[3] = s * influence[3]; - temp[4] = s * influence[4]; - temp[5] = s * influence[5]; - - s = curve[(pix >> systemRedShift) & 0x1f]; - temp[0] = s * influence[0]; - temp[1] = s * influence[1]; - temp[2] = s * influence[2]; - - s = curve[(pix >> systemBlueShift) & 0x1f]; - temp[6] = s * influence[6]; - temp[7] = s * influence[7]; - temp[8] = s * influence[8]; - - if (temp[0] < temp[3]) swap(temp[0], temp[3]); - if (temp[0] < temp[6]) swap(temp[0], temp[6]); - if (temp[3] < temp[6]) swap(temp[3], temp[6]); - temp[3] <<= 1; - temp[0] <<= 2; - temp[0] += temp[3] + temp[6]; - - //red = ((int(temp[0]) * 160) >> 17) + 4; - red = ((int(temp[0]) * 160) >> 14) + 32; - - if (temp[2] < temp[5]) swap(temp[2], temp[5]); - if (temp[2] < temp[8]) swap(temp[2], temp[8]); - if (temp[5] < temp[8]) swap(temp[5], temp[8]); - temp[5] <<= 1; - temp[2] <<= 2; - temp[2] += temp[5] + temp[8]; - - //blue = ((int(temp[2]) * 160) >> 17) + 4; - blue = ((int(temp[2]) * 160) >> 14) + 32; - - if (temp[1] < temp[4]) swap(temp[1], temp[4]); - if (temp[1] < temp[7]) swap(temp[1], temp[7]); - if (temp[4] < temp[7]) swap(temp[4], temp[7]); - temp[4] <<= 1; - temp[1] <<= 2; - temp[1] += temp[4] + temp[7]; - - //green = ((int(temp[1]) * 160) >> 17) + 4; - green = ((int(temp[1]) * 160) >> 14) + 32; - - //pix = red << redshift; - //pix += green << greenshift; - //pix += blue << blueshift; - - pix = red << (systemRedShift - 3); - pix += green << (systemGreenShift - 3); - pix += blue << (systemBlueShift - 3); - - *buf++ = pix; - } -} - -// for palette mode to work with the three spoony filters in 32bpp depth - -void gbafilter_pad(u8 * buf, int count) -{ - union - { - struct - { - u8 r; - u8 g; - u8 b; - u8 a; - } part; - unsigned whole; - } - mask; - - mask.whole = 0x1f << systemRedShift; - mask.whole += 0x1f << systemGreenShift; - mask.whole += 0x1f << systemBlueShift; - - switch (systemColorDepth) - { - case 24: - while (count--) - { - *buf++ &= mask.part.r; - *buf++ &= mask.part.g; - *buf++ &= mask.part.b; - } - break; - case 32: - while (count--) - { - *((u32*)buf) &= mask.whole; - buf += 4; - } - } -} - -/* -void UpdateSystemColorMaps(int lcd) -{ - switch(systemColorDepth) { - case 16: - { - for(int i = 0; i < 0x10000; i++) { - systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | - (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); - } - if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000); - } - 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); - } - if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000); - } - break; - } -} -*/ +#include "gbafilter.h" + +#include + +extern int systemColorDepth; +extern int systemRedShift; +extern int systemGreenShift; +extern int systemBlueShift; + +extern u16 systemColorMap16[0x10000]; +extern u32 systemColorMap32[0x10000]; + +static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12, + 0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38, + 0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80, + 0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0}; + +// output R G B +static const unsigned char influence[3 * 3] = { 16, 4, 4, // red + 8, 16, 8, // green + 0, 8, 16};// blue + +inline void swap(short & a, short & b) +{ + short temp = a; + a = b; + b = temp; +} + +void gbafilter_pal(u16 * buf, int count) +{ + short temp[3 * 3], s; + unsigned pix; + u8 red, green, blue; + + while (count--) + { + pix = *buf; + + s = curve[(pix >> systemGreenShift) & 0x1f]; + temp[3] = s * influence[3]; + temp[4] = s * influence[4]; + temp[5] = s * influence[5]; + + s = curve[(pix >> systemRedShift) & 0x1f]; + temp[0] = s * influence[0]; + temp[1] = s * influence[1]; + temp[2] = s * influence[2]; + + s = curve[(pix >> systemBlueShift) & 0x1f]; + temp[6] = s * influence[6]; + temp[7] = s * influence[7]; + temp[8] = s * influence[8]; + + if (temp[0] < temp[3]) swap(temp[0], temp[3]); + if (temp[0] < temp[6]) swap(temp[0], temp[6]); + if (temp[3] < temp[6]) swap(temp[3], temp[6]); + temp[3] <<= 1; + temp[0] <<= 2; + temp[0] += temp[3] + temp[6]; + + red = ((int(temp[0]) * 160) >> 17) + 4; + if (red > 31) red = 31; + + if (temp[2] < temp[5]) swap(temp[2], temp[5]); + if (temp[2] < temp[8]) swap(temp[2], temp[8]); + if (temp[5] < temp[8]) swap(temp[5], temp[8]); + temp[5] <<= 1; + temp[2] <<= 2; + temp[2] += temp[5] + temp[8]; + + blue = ((int(temp[2]) * 160) >> 17) + 4; + if (blue > 31) blue = 31; + + if (temp[1] < temp[4]) swap(temp[1], temp[4]); + if (temp[1] < temp[7]) swap(temp[1], temp[7]); + if (temp[4] < temp[7]) swap(temp[4], temp[7]); + temp[4] <<= 1; + temp[1] <<= 2; + temp[1] += temp[4] + temp[7]; + + green = ((int(temp[1]) * 160) >> 17) + 4; + if (green > 31) green = 31; + + pix = red << systemRedShift; + pix += green << systemGreenShift; + pix += blue << systemBlueShift; + + *buf++ = pix; + } +} + +void gbafilter_pal32(u32 * buf, int count) +{ + short temp[3 * 3], s; + unsigned pix; + u8 red, green, blue; + + while (count--) + { + pix = *buf; + + s = curve[(pix >> systemGreenShift) & 0x1f]; + temp[3] = s * influence[3]; + temp[4] = s * influence[4]; + temp[5] = s * influence[5]; + + s = curve[(pix >> systemRedShift) & 0x1f]; + temp[0] = s * influence[0]; + temp[1] = s * influence[1]; + temp[2] = s * influence[2]; + + s = curve[(pix >> systemBlueShift) & 0x1f]; + temp[6] = s * influence[6]; + temp[7] = s * influence[7]; + temp[8] = s * influence[8]; + + if (temp[0] < temp[3]) swap(temp[0], temp[3]); + if (temp[0] < temp[6]) swap(temp[0], temp[6]); + if (temp[3] < temp[6]) swap(temp[3], temp[6]); + temp[3] <<= 1; + temp[0] <<= 2; + temp[0] += temp[3] + temp[6]; + + //red = ((int(temp[0]) * 160) >> 17) + 4; + red = ((int(temp[0]) * 160) >> 14) + 32; + + if (temp[2] < temp[5]) swap(temp[2], temp[5]); + if (temp[2] < temp[8]) swap(temp[2], temp[8]); + if (temp[5] < temp[8]) swap(temp[5], temp[8]); + temp[5] <<= 1; + temp[2] <<= 2; + temp[2] += temp[5] + temp[8]; + + //blue = ((int(temp[2]) * 160) >> 17) + 4; + blue = ((int(temp[2]) * 160) >> 14) + 32; + + if (temp[1] < temp[4]) swap(temp[1], temp[4]); + if (temp[1] < temp[7]) swap(temp[1], temp[7]); + if (temp[4] < temp[7]) swap(temp[4], temp[7]); + temp[4] <<= 1; + temp[1] <<= 2; + temp[1] += temp[4] + temp[7]; + + //green = ((int(temp[1]) * 160) >> 17) + 4; + green = ((int(temp[1]) * 160) >> 14) + 32; + + //pix = red << redshift; + //pix += green << greenshift; + //pix += blue << blueshift; + + pix = red << (systemRedShift - 3); + pix += green << (systemGreenShift - 3); + pix += blue << (systemBlueShift - 3); + + *buf++ = pix; + } +} + +// for palette mode to work with the three spoony filters in 32bpp depth + +void gbafilter_pad(u8 * buf, int count) +{ + union + { + struct + { + u8 r; + u8 g; + u8 b; + u8 a; + } part; + unsigned whole; + } + mask; + + mask.whole = 0x1f << systemRedShift; + mask.whole += 0x1f << systemGreenShift; + mask.whole += 0x1f << systemBlueShift; + + switch (systemColorDepth) + { + case 24: + while (count--) + { + *buf++ &= mask.part.r; + *buf++ &= mask.part.g; + *buf++ &= mask.part.b; + } + break; + case 32: + while (count--) + { + *((u32*)buf) &= mask.whole; + buf += 4; + } + } +} + +/* +void UpdateSystemColorMaps(int lcd) +{ + switch(systemColorDepth) { + case 16: + { + for(int i = 0; i < 0x10000; i++) { + systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | + (((i & 0x3e0) >> 5) << systemGreenShift) | + (((i & 0x7c00) >> 10) << systemBlueShift); + } + if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000); + } + 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); + } + if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000); + } + break; + } +} +*/ diff --git a/src/gbafilter.h b/src/gbafilter.h index 3c171e07..f1d25daf 100644 --- a/src/gbafilter.h +++ b/src/gbafilter.h @@ -1,5 +1,5 @@ -#include "System.h" - -void gbafilter_pal(u16 * buf, int count); -void gbafilter_pal32(u32 * buf, int count); -void gbafilter_pad(u8 * buf, int count); +#include "System.h" + +void gbafilter_pal(u16 * buf, int count); +void gbafilter_pal32(u32 * buf, int count); +void gbafilter_pad(u8 * buf, int count); diff --git a/src/hq2x.cpp b/src/hq2x.cpp index e5cac32f..d14b8023 100644 --- a/src/hq2x.cpp +++ b/src/hq2x.cpp @@ -489,15 +489,15 @@ void hq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { u16 *dst0 = (u16 *)dstPtr; u16 *dst1 = dst0 + (dstPitch >> 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; @@ -518,14 +518,14 @@ void hq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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; @@ -546,15 +546,15 @@ void lq2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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; @@ -575,14 +575,14 @@ void lq2x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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; diff --git a/src/hq2x.h b/src/hq2x.h index 64c5778b..49c0b268 100644 --- a/src/hq2x.h +++ b/src/hq2x.h @@ -1,87 +1,87 @@ -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 : +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 : +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 : +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 : +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 : +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 : +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 : +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 : +case 10 : +case 138 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -92,8 +92,8 @@ case 138 : P0 = I211(4, 1, 3); } } break; -case 11 : -case 139 : +case 11 : +case 139 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -104,8 +104,8 @@ case 139 : P0 = I211(4, 1, 3); } } break; -case 14 : -case 142 : +case 14 : +case 142 : { P2 = I31(4, 6); P3 = I211(4, 5, 7); @@ -117,8 +117,8 @@ case 142 : P1 = I521(4, 1, 5); } } break; -case 15 : -case 143 : +case 15 : +case 143 : { P2 = I31(4, 6); P3 = I211(4, 5, 7); @@ -130,18 +130,18 @@ case 143 : P1 = I521(4, 1, 5); } } break; -case 16 : -case 17 : -case 48 : -case 49 : +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 : +case 18 : +case 50 : { P0 = I31(4, 0); P2 = I211(4, 3, 7); @@ -152,8 +152,8 @@ case 50 : P1 = I211(4, 1, 5); } } break; -case 19 : -case 51 : +case 19 : +case 51 : { P2 = I211(4, 3, 7); P3 = I31(4, 8); @@ -165,18 +165,18 @@ case 51 : P1 = I332(1, 5, 4); } } break; -case 20 : -case 21 : -case 52 : -case 53 : +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 : +case 22 : +case 54 : { P0 = I31(4, 0); P2 = I211(4, 3, 7); @@ -187,8 +187,8 @@ case 54 : P1 = I211(4, 1, 5); } } break; -case 23 : -case 55 : +case 23 : +case 55 : { P2 = I211(4, 3, 7); P3 = I31(4, 8); @@ -200,24 +200,24 @@ case 55 : P1 = I332(1, 5, 4); } } break; -case 24 : -case 66 : +case 24 : +case 66 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 25 : +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 : +case 26 : +case 31 : +case 95 : { P2 = I31(4, 6); P3 = I31(4, 8); @@ -232,8 +232,8 @@ case 95 : P1 = I211(4, 1, 5); } } break; -case 27 : -case 75 : +case 27 : +case 75 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -244,22 +244,22 @@ case 75 : P0 = I211(4, 1, 3); } } break; -case 28 : +case 28 : { P0 = I31(4, 0); P1 = I31(4, 1); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 29 : +case 29 : { P0 = I31(4, 1); P1 = I31(4, 1); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 30 : -case 86 : +case 30 : +case 86 : { P0 = I31(4, 0); P2 = I31(4, 6); @@ -270,28 +270,28 @@ case 86 : P1 = I211(4, 1, 5); } } break; -case 40 : -case 44 : -case 168 : -case 172 : +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 : +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 : +case 42 : +case 170 : { P1 = I31(4, 2); P3 = I211(4, 5, 7); @@ -303,8 +303,8 @@ case 170 : P2 = I521(4, 3, 7); } } break; -case 43 : -case 171 : +case 43 : +case 171 : { P1 = I31(4, 2); P3 = I211(4, 5, 7); @@ -316,8 +316,8 @@ case 171 : P2 = I521(4, 3, 7); } } break; -case 46 : -case 174 : +case 46 : +case 174 : { P1 = I31(4, 5); P2 = I31(4, 7); @@ -328,8 +328,8 @@ case 174 : P0 = I611(4, 1, 3); } } break; -case 47 : -case 175 : +case 47 : +case 175 : { P1 = I31(4, 5); P2 = I31(4, 7); @@ -340,21 +340,21 @@ case 175 : P0 = I1411(4, 1, 3); } } break; -case 56 : +case 56 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 7); P3 = I31(4, 8); } break; -case 57 : +case 57 : { P0 = I31(4, 1); P1 = I31(4, 2); P2 = I31(4, 7); P3 = I31(4, 8); } break; -case 58 : +case 58 : { P2 = I31(4, 7); P3 = I31(4, 8); @@ -369,7 +369,7 @@ case 58 : P1 = I611(4, 1, 5); } } break; -case 59 : +case 59 : { P2 = I31(4, 7); P3 = I31(4, 8); @@ -384,21 +384,21 @@ case 59 : P1 = I611(4, 1, 5); } } break; -case 60 : +case 60 : { P0 = I31(4, 0); P1 = I31(4, 1); P2 = I31(4, 7); P3 = I31(4, 8); } break; -case 61 : +case 61 : { P0 = I31(4, 1); P1 = I31(4, 1); P2 = I31(4, 7); P3 = I31(4, 8); } break; -case 62 : +case 62 : { P0 = I31(4, 0); P2 = I31(4, 7); @@ -409,7 +409,7 @@ case 62 : P1 = I211(4, 1, 5); } } break; -case 63 : +case 63 : { P2 = I31(4, 7); P3 = I31(4, 8); @@ -424,39 +424,39 @@ case 63 : P1 = I211(4, 1, 5); } } break; -case 64 : -case 65 : -case 68 : -case 69 : +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 : +case 67 : { P0 = I31(4, 3); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 70 : +case 70 : { P0 = I31(4, 0); P1 = I31(4, 5); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 71 : +case 71 : { P0 = I31(4, 3); P1 = I31(4, 5); P2 = I31(4, 6); P3 = I31(4, 8); } break; -case 72 : -case 76 : +case 72 : +case 76 : { P0 = I31(4, 0); P1 = I211(4, 1, 5); @@ -467,8 +467,8 @@ case 76 : P2 = I211(4, 3, 7); } } break; -case 73 : -case 77 : +case 73 : +case 77 : { P1 = I211(4, 1, 5); P3 = I31(4, 8); @@ -480,9 +480,9 @@ case 77 : P2 = I332(3, 7, 4); } } break; -case 74 : -case 107 : -case 123 : +case 74 : +case 107 : +case 123 : { P1 = I31(4, 2); P3 = I31(4, 8); @@ -497,7 +497,7 @@ case 123 : P0 = I211(4, 1, 3); } } break; -case 78 : +case 78 : { P1 = I31(4, 5); P3 = I31(4, 8); @@ -512,7 +512,7 @@ case 78 : P0 = I611(4, 1, 3); } } break; -case 79 : +case 79 : { P1 = I31(4, 5); P3 = I31(4, 8); @@ -527,8 +527,8 @@ case 79 : P0 = I211(4, 1, 3); } } break; -case 80 : -case 81 : +case 80 : +case 81 : { P0 = I211(4, 1, 3); P1 = I31(4, 2); @@ -539,9 +539,9 @@ case 81 : P3 = I211(4, 5, 7); } } break; -case 82 : -case 214 : -case 222 : +case 82 : +case 214 : +case 222 : { P0 = I31(4, 0); P2 = I31(4, 6); @@ -556,7 +556,7 @@ case 222 : P1 = I211(4, 1, 5); } } break; -case 83 : +case 83 : { P0 = I31(4, 3); P2 = I31(4, 6); @@ -571,8 +571,8 @@ case 83 : P1 = I611(4, 1, 5); } } break; -case 84 : -case 85 : +case 84 : +case 85 : { P0 = I211(4, 1, 3); P2 = I31(4, 6); @@ -584,7 +584,7 @@ case 85 : P3 = I332(5, 7, 4); } } break; -case 87 : +case 87 : { P0 = I31(4, 3); P2 = I31(4, 6); @@ -599,9 +599,9 @@ case 87 : P1 = I211(4, 1, 5); } } break; -case 88 : -case 248 : -case 250 : +case 88 : +case 248 : +case 250 : { P0 = I31(4, 0); P1 = I31(4, 2); @@ -616,7 +616,7 @@ case 250 : P3 = I211(4, 5, 7); } } break; -case 89 : +case 89 : { P0 = I31(4, 1); P1 = I31(4, 2); @@ -631,7 +631,7 @@ case 89 : P3 = I611(4, 5, 7); } } break; -case 90 : +case 90 : { if (MDL) { P2 = I31(4, 6); @@ -654,7 +654,7 @@ case 90 : P1 = I611(4, 1, 5); } } break; -case 91 : +case 91 : { if (MDL) { P2 = I31(4, 6); @@ -677,7 +677,7 @@ case 91 : P1 = I611(4, 1, 5); } } break; -case 92 : +case 92 : { P0 = I31(4, 0); P1 = I31(4, 1); @@ -692,7 +692,7 @@ case 92 : P3 = I611(4, 5, 7); } } break; -case 93 : +case 93 : { P0 = I31(4, 1); P1 = I31(4, 1); @@ -707,7 +707,7 @@ case 93 : P3 = I611(4, 5, 7); } } break; -case 94 : +case 94 : { if (MDL) { P2 = I31(4, 6); @@ -730,46 +730,46 @@ case 94 : P1 = I211(4, 1, 5); } } break; -case 96 : -case 97 : -case 100 : -case 101 : +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 : +case 98 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 3); P3 = I31(4, 8); } break; -case 99 : +case 99 : { P0 = I31(4, 3); P1 = I31(4, 2); P2 = I31(4, 3); P3 = I31(4, 8); } break; -case 102 : +case 102 : { P0 = I31(4, 0); P1 = I31(4, 5); P2 = I31(4, 3); P3 = I31(4, 8); } break; -case 103 : +case 103 : { P0 = I31(4, 3); P1 = I31(4, 5); P2 = I31(4, 3); P3 = I31(4, 8); } break; -case 104 : -case 108 : +case 104 : +case 108 : { P0 = I31(4, 0); P1 = I211(4, 1, 5); @@ -780,8 +780,8 @@ case 108 : P2 = I211(4, 3, 7); } } break; -case 105 : -case 109 : +case 105 : +case 109 : { P1 = I211(4, 1, 5); P3 = I31(4, 8); @@ -793,8 +793,8 @@ case 109 : P2 = I332(3, 7, 4); } } break; -case 106 : -case 120 : +case 106 : +case 120 : { P0 = I31(4, 0); P1 = I31(4, 2); @@ -805,7 +805,7 @@ case 120 : P2 = I211(4, 3, 7); } } break; -case 110 : +case 110 : { P0 = I31(4, 0); P1 = I31(4, 5); @@ -816,7 +816,7 @@ case 110 : P2 = I211(4, 3, 7); } } break; -case 111 : +case 111 : { P1 = I31(4, 5); P3 = I31(4, 8); @@ -831,8 +831,8 @@ case 111 : P0 = I1411(4, 1, 3); } } break; -case 112 : -case 113 : +case 112 : +case 113 : { P0 = I211(4, 1, 3); P1 = I31(4, 2); @@ -844,7 +844,7 @@ case 113 : P3 = I332(5, 7, 4); } } break; -case 114 : +case 114 : { P0 = I31(4, 0); P2 = I31(4, 3); @@ -859,7 +859,7 @@ case 114 : P1 = I611(4, 1, 5); } } break; -case 115 : +case 115 : { P0 = I31(4, 3); P2 = I31(4, 3); @@ -874,8 +874,8 @@ case 115 : P1 = I611(4, 1, 5); } } break; -case 116 : -case 117 : +case 116 : +case 117 : { P0 = I211(4, 1, 3); P1 = I31(4, 1); @@ -886,7 +886,7 @@ case 117 : P3 = I611(4, 5, 7); } } break; -case 118 : +case 118 : { P0 = I31(4, 0); P2 = I31(4, 3); @@ -897,7 +897,7 @@ case 118 : P1 = I211(4, 1, 5); } } break; -case 119 : +case 119 : { P2 = I31(4, 3); P3 = I31(4, 8); @@ -909,7 +909,7 @@ case 119 : P1 = I332(1, 5, 4); } } break; -case 121 : +case 121 : { P0 = I31(4, 1); P1 = I31(4, 2); @@ -924,7 +924,7 @@ case 121 : P3 = I611(4, 5, 7); } } break; -case 122 : +case 122 : { if (MDL) { P2 = IC(4); @@ -947,7 +947,7 @@ case 122 : P1 = I611(4, 1, 5); } } break; -case 124 : +case 124 : { P0 = I31(4, 0); P1 = I31(4, 1); @@ -958,7 +958,7 @@ case 124 : P2 = I211(4, 3, 7); } } break; -case 125 : +case 125 : { P1 = I31(4, 1); P3 = I31(4, 8); @@ -970,7 +970,7 @@ case 125 : P2 = I332(3, 7, 4); } } break; -case 126 : +case 126 : { P0 = I31(4, 0); P3 = I31(4, 8); @@ -985,7 +985,7 @@ case 126 : P1 = I211(4, 1, 5); } } break; -case 127 : +case 127 : { P3 = I31(4, 8); if (MDL) { @@ -1004,18 +1004,18 @@ case 127 : P1 = I211(4, 1, 5); } } break; -case 144 : -case 145 : -case 176 : -case 177 : +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 : +case 146 : +case 178 : { P0 = I31(4, 0); P2 = I211(4, 3, 7); @@ -1027,8 +1027,8 @@ case 178 : P3 = I521(4, 5, 7); } } break; -case 147 : -case 179 : +case 147 : +case 179 : { P0 = I31(4, 3); P2 = I211(4, 3, 7); @@ -1039,18 +1039,18 @@ case 179 : P1 = I611(4, 1, 5); } } break; -case 148 : -case 149 : -case 180 : -case 181 : +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 : +case 150 : +case 182 : { P0 = I31(4, 0); P2 = I211(4, 3, 7); @@ -1062,8 +1062,8 @@ case 182 : P3 = I521(4, 5, 7); } } break; -case 151 : -case 183 : +case 151 : +case 183 : { P0 = I31(4, 3); P2 = I211(4, 3, 7); @@ -1074,21 +1074,21 @@ case 183 : P1 = I1411(4, 1, 5); } } break; -case 152 : +case 152 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 7); } break; -case 153 : +case 153 : { P0 = I31(4, 1); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 7); } break; -case 154 : +case 154 : { P2 = I31(4, 6); P3 = I31(4, 7); @@ -1103,7 +1103,7 @@ case 154 : P1 = I611(4, 1, 5); } } break; -case 155 : +case 155 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -1114,21 +1114,21 @@ case 155 : P0 = I211(4, 1, 3); } } break; -case 156 : +case 156 : { P0 = I31(4, 0); P1 = I31(4, 1); P2 = I31(4, 6); P3 = I31(4, 7); } break; -case 157 : +case 157 : { P0 = I31(4, 1); P1 = I31(4, 1); P2 = I31(4, 6); P3 = I31(4, 7); } break; -case 158 : +case 158 : { P2 = I31(4, 6); P3 = I31(4, 7); @@ -1143,7 +1143,7 @@ case 158 : P1 = I211(4, 1, 5); } } break; -case 159 : +case 159 : { P2 = I31(4, 6); P3 = I31(4, 7); @@ -1158,21 +1158,21 @@ case 159 : P1 = I1411(4, 1, 5); } } break; -case 184 : +case 184 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 7); P3 = I31(4, 7); } break; -case 185 : +case 185 : { P0 = I31(4, 1); P1 = I31(4, 2); P2 = I31(4, 7); P3 = I31(4, 7); } break; -case 186 : +case 186 : { P2 = I31(4, 7); P3 = I31(4, 7); @@ -1187,7 +1187,7 @@ case 186 : P1 = I611(4, 1, 5); } } break; -case 187 : +case 187 : { P1 = I31(4, 2); P3 = I31(4, 7); @@ -1199,21 +1199,21 @@ case 187 : P2 = I521(4, 3, 7); } } break; -case 188 : +case 188 : { P0 = I31(4, 0); P1 = I31(4, 1); P2 = I31(4, 7); P3 = I31(4, 7); } break; -case 189 : +case 189 : { P0 = I31(4, 1); P1 = I31(4, 1); P2 = I31(4, 7); P3 = I31(4, 7); } break; -case 190 : +case 190 : { P0 = I31(4, 0); P2 = I31(4, 7); @@ -1225,7 +1225,7 @@ case 190 : P3 = I521(4, 5, 7); } } break; -case 191 : +case 191 : { P2 = I31(4, 7); P3 = I31(4, 7); @@ -1240,46 +1240,46 @@ case 191 : P1 = I1411(4, 1, 5); } } break; -case 192 : -case 193 : -case 196 : -case 197 : +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 : +case 194 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 5); } break; -case 195 : +case 195 : { P0 = I31(4, 3); P1 = I31(4, 2); P2 = I31(4, 6); P3 = I31(4, 5); } break; -case 198 : +case 198 : { P0 = I31(4, 0); P1 = I31(4, 5); P2 = I31(4, 6); P3 = I31(4, 5); } break; -case 199 : +case 199 : { P0 = I31(4, 3); P1 = I31(4, 5); P2 = I31(4, 6); P3 = I31(4, 5); } break; -case 200 : -case 204 : +case 200 : +case 204 : { P0 = I31(4, 0); P1 = I211(4, 1, 5); @@ -1291,8 +1291,8 @@ case 204 : P3 = I521(4, 7, 5); } } break; -case 201 : -case 205 : +case 201 : +case 205 : { P0 = I31(4, 1); P1 = I211(4, 1, 5); @@ -1303,7 +1303,7 @@ case 205 : P2 = I611(4, 3, 7); } } break; -case 202 : +case 202 : { P1 = I31(4, 2); P3 = I31(4, 5); @@ -1318,7 +1318,7 @@ case 202 : P0 = I611(4, 1, 3); } } break; -case 203 : +case 203 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -1329,7 +1329,7 @@ case 203 : P0 = I211(4, 1, 3); } } break; -case 206 : +case 206 : { P1 = I31(4, 5); P3 = I31(4, 5); @@ -1344,7 +1344,7 @@ case 206 : P0 = I611(4, 1, 3); } } break; -case 207 : +case 207 : { P2 = I31(4, 6); P3 = I31(4, 5); @@ -1356,8 +1356,8 @@ case 207 : P1 = I521(4, 1, 5); } } break; -case 208 : -case 209 : +case 208 : +case 209 : { P0 = I211(4, 1, 3); P1 = I31(4, 2); @@ -1368,8 +1368,8 @@ case 209 : P3 = I211(4, 5, 7); } } break; -case 210 : -case 216 : +case 210 : +case 216 : { P0 = I31(4, 0); P1 = I31(4, 2); @@ -1380,7 +1380,7 @@ case 216 : P3 = I211(4, 5, 7); } } break; -case 211 : +case 211 : { P0 = I31(4, 3); P1 = I31(4, 2); @@ -1391,8 +1391,8 @@ case 211 : P3 = I211(4, 5, 7); } } break; -case 212 : -case 213 : +case 212 : +case 213 : { P0 = I211(4, 1, 3); P2 = I31(4, 6); @@ -1404,7 +1404,7 @@ case 213 : P3 = I332(5, 7, 4); } } break; -case 215 : +case 215 : { P0 = I31(4, 3); P2 = I31(4, 6); @@ -1419,7 +1419,7 @@ case 215 : P1 = I1411(4, 1, 5); } } break; -case 217 : +case 217 : { P0 = I31(4, 1); P1 = I31(4, 2); @@ -1430,7 +1430,7 @@ case 217 : P3 = I211(4, 5, 7); } } break; -case 218 : +case 218 : { if (MDL) { P2 = I31(4, 6); @@ -1453,7 +1453,7 @@ case 218 : P1 = I611(4, 1, 5); } } break; -case 219 : +case 219 : { P1 = I31(4, 2); P2 = I31(4, 6); @@ -1468,7 +1468,7 @@ case 219 : P0 = I211(4, 1, 3); } } break; -case 220 : +case 220 : { P0 = I31(4, 0); P1 = I31(4, 1); @@ -1483,7 +1483,7 @@ case 220 : P3 = I211(4, 5, 7); } } break; -case 221 : +case 221 : { P0 = I31(4, 1); P2 = I31(4, 6); @@ -1495,7 +1495,7 @@ case 221 : P3 = I332(5, 7, 4); } } break; -case 223 : +case 223 : { P2 = I31(4, 6); if (MDR) { @@ -1514,46 +1514,46 @@ case 223 : P1 = I1411(4, 1, 5); } } break; -case 224 : -case 225 : -case 228 : -case 229 : +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 : +case 226 : { P0 = I31(4, 0); P1 = I31(4, 2); P2 = I31(4, 3); P3 = I31(4, 5); } break; -case 227 : +case 227 : { P0 = I31(4, 3); P1 = I31(4, 2); P2 = I31(4, 3); P3 = I31(4, 5); } break; -case 230 : +case 230 : { P0 = I31(4, 0); P1 = I31(4, 5); P2 = I31(4, 3); P3 = I31(4, 5); } break; -case 231 : +case 231 : { P0 = I31(4, 3); P1 = I31(4, 5); P2 = I31(4, 3); P3 = I31(4, 5); } break; -case 232 : -case 236 : +case 232 : +case 236 : { P0 = I31(4, 0); P1 = I211(4, 1, 5); @@ -1565,8 +1565,8 @@ case 236 : P3 = I521(4, 7, 5); } } break; -case 233 : -case 237 : +case 233 : +case 237 : { P0 = I31(4, 1); P1 = I211(4, 1, 5); @@ -1577,7 +1577,7 @@ case 237 : P2 = I1411(4, 3, 7); } } break; -case 234 : +case 234 : { P1 = I31(4, 2); P3 = I31(4, 5); @@ -1592,7 +1592,7 @@ case 234 : P0 = I611(4, 1, 3); } } break; -case 235 : +case 235 : { P1 = I31(4, 2); P3 = I31(4, 5); @@ -1607,7 +1607,7 @@ case 235 : P0 = I211(4, 1, 3); } } break; -case 238 : +case 238 : { P0 = I31(4, 0); P1 = I31(4, 5); @@ -1619,7 +1619,7 @@ case 238 : P3 = I521(4, 7, 5); } } break; -case 239 : +case 239 : { P1 = I31(4, 5); P3 = I31(4, 5); @@ -1634,8 +1634,8 @@ case 239 : P0 = I1411(4, 1, 3); } } break; -case 240 : -case 241 : +case 240 : +case 241 : { P0 = I211(4, 1, 3); P1 = I31(4, 2); @@ -1647,7 +1647,7 @@ case 241 : P3 = I332(5, 7, 4); } } break; -case 242 : +case 242 : { P0 = I31(4, 0); P2 = I31(4, 3); @@ -1662,7 +1662,7 @@ case 242 : P1 = I611(4, 1, 5); } } break; -case 243 : +case 243 : { P0 = I31(4, 3); P1 = I31(4, 2); @@ -1674,8 +1674,8 @@ case 243 : P3 = I332(5, 7, 4); } } break; -case 244 : -case 245 : +case 244 : +case 245 : { P0 = I211(4, 1, 3); P1 = I31(4, 1); @@ -1686,7 +1686,7 @@ case 245 : P3 = I1411(4, 5, 7); } } break; -case 246 : +case 246 : { P0 = I31(4, 0); P2 = I31(4, 3); @@ -1701,7 +1701,7 @@ case 246 : P1 = I211(4, 1, 5); } } break; -case 247 : +case 247 : { P0 = I31(4, 3); P2 = I31(4, 3); @@ -1716,7 +1716,7 @@ case 247 : P1 = I1411(4, 1, 5); } } break; -case 249 : +case 249 : { P0 = I31(4, 1); P1 = I31(4, 2); @@ -1731,7 +1731,7 @@ case 249 : P3 = I211(4, 5, 7); } } break; -case 251 : +case 251 : { P1 = I31(4, 2); if (MDL) { @@ -1750,7 +1750,7 @@ case 251 : P0 = I211(4, 1, 3); } } break; -case 252 : +case 252 : { P0 = I31(4, 0); P1 = I31(4, 1); @@ -1765,7 +1765,7 @@ case 252 : P3 = I1411(4, 5, 7); } } break; -case 253 : +case 253 : { P0 = I31(4, 1); P1 = I31(4, 1); @@ -1780,7 +1780,7 @@ case 253 : P3 = I1411(4, 5, 7); } } break; -case 254 : +case 254 : { P0 = I31(4, 0); if (MDL) { @@ -1799,7 +1799,7 @@ case 254 : P1 = I211(4, 1, 5); } } break; -case 255 : +case 255 : { if (MDL) { P2 = IC(4); diff --git a/src/hq3x32.cpp b/src/hq3x32.cpp index 4418b3af..e8d48d58 100644 --- a/src/hq3x32.cpp +++ b/src/hq3x32.cpp @@ -1,146 +1,146 @@ -// 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 "Util.h" -#define __STDC_CONSTANT_MACROS -#include - -extern "C" -{ -void hq3x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); -void hq3x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); -void hq4x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); -void hq4x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); - -unsigned int LUT16to32[65536]; -unsigned int RGBtoYUV[65536]; -} - -void InitLUTs(void) -{ - int i, j, k, r, g, b, Y, u, v; - - for (i=0; i<65536; i++) - LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3); - - for (i=0; i<32; i++) - for (j=0; j<64; j++) - for (k=0; k<32; k++) - { - r = i << 3; - g = j << 2; - b = k << 3; - Y = (r + g + b) >> 2; - u = 128 + ((r - b) >> 2); - v = 128 + ((-r + 2*g -b)>>3); - RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v; - } -} - -int hq3xinited=0; -extern int realsystemRedShift, realsystemBlueShift; - -void hq3x32(unsigned char * pIn, unsigned int srcPitch, - unsigned char *, - unsigned char * pOut, unsigned int dstPitch, - int Xres, int Yres) -{ - // NOTICE! This driver wants 16 bit, not 32 bit input! - - if (!hq3xinited) - { - InitLUTs(); - hq3xinited=1; - } - hq3x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2) ); - if (realsystemRedShift == 3) - { // damn you opengl... - int offset = (dstPitch - (Xres *12)) / 4; - unsigned int *p = (unsigned int *)pOut; - Yres *= 3; - while(Yres--) - { - for(int i=0;i> 16 | - (*p & 0x0000FF) << 16 | - (*p & 0x00FF00); - p++; - } - p += offset; - } - } -} - -void hq3x16(unsigned char * pIn, unsigned int srcPitch, - unsigned char *, - unsigned char * pOut, unsigned int dstPitch, - int Xres, int Yres) -{ - if (!hq3xinited) - { - InitLUTs(); - hq3xinited=1; - } - hq3x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); -} - - -void hq4x16(unsigned char * pIn, unsigned int srcPitch, - unsigned char *, - unsigned char * pOut, unsigned int dstPitch, - int Xres, int Yres) -{ - if (!hq3xinited) - { - InitLUTs(); - hq3xinited=1; - } - hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); -} - -void hq4x32(unsigned char * pIn, unsigned int srcPitch, - unsigned char *, - unsigned char * pOut, unsigned int dstPitch, - int Xres, int Yres) -{ - // NOTICE! This driver wants 16 bit, not 32 bit input! - - if (!hq3xinited) - { - InitLUTs(); - hq3xinited=1; - } - hq4x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); - if (realsystemRedShift == 3) - { // damn you opengl... - int offset = (dstPitch - (Xres *16)) / 4; - unsigned int *p = (unsigned int *)pOut; - Yres *= 4; - while(Yres--) - { - for(int i=0;i> 16 | - (*p & 0x0000FF) << 16 | - (*p & 0x00FF00); - p++; - } - p += offset; - } - } -} +// 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 "Util.h" +#define __STDC_CONSTANT_MACROS +#include + +extern "C" +{ +void hq3x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); +void hq3x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); +void hq4x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); +void hq4x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t); + +unsigned int LUT16to32[65536]; +unsigned int RGBtoYUV[65536]; +} + +void InitLUTs(void) +{ + int i, j, k, r, g, b, Y, u, v; + + for (i=0; i<65536; i++) + LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3); + + for (i=0; i<32; i++) + for (j=0; j<64; j++) + for (k=0; k<32; k++) + { + r = i << 3; + g = j << 2; + b = k << 3; + Y = (r + g + b) >> 2; + u = 128 + ((r - b) >> 2); + v = 128 + ((-r + 2*g -b)>>3); + RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v; + } +} + +int hq3xinited=0; +extern int realsystemRedShift, realsystemBlueShift; + +void hq3x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + // NOTICE! This driver wants 16 bit, not 32 bit input! + + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq3x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2) ); + if (realsystemRedShift == 3) + { // damn you opengl... + int offset = (dstPitch - (Xres *12)) / 4; + unsigned int *p = (unsigned int *)pOut; + Yres *= 3; + while(Yres--) + { + for(int i=0;i> 16 | + (*p & 0x0000FF) << 16 | + (*p & 0x00FF00); + p++; + } + p += offset; + } + } +} + +void hq3x16(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq3x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); +} + + +void hq4x16(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); +} + +void hq4x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + // NOTICE! This driver wants 16 bit, not 32 bit input! + + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq4x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); + if (realsystemRedShift == 3) + { // damn you opengl... + int offset = (dstPitch - (Xres *16)) / 4; + unsigned int *p = (unsigned int *)pOut; + Yres *= 4; + while(Yres--) + { + for(int i=0;i> 16 | + (*p & 0x0000FF) << 16 | + (*p & 0x00FF00); + p++; + } + p += offset; + } + } +} diff --git a/src/hq3x32.h b/src/hq3x32.h index 6d1533c0..b02e943f 100644 --- a/src/hq3x32.h +++ b/src/hq3x32.h @@ -1,3634 +1,3634 @@ -// 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. - - 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(c[2], c[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(c[6], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_1M - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 10: - case 138: - { - if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 11: - case 139: - { - if (Diff(c[4], c[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(c[2], c[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(c[2], c[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(c[6], c[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(c[6], c[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(c[8], c[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(c[8], c[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(c[4], c[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(c[4], c[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(c[4], c[2])) - { - PIXEL00_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL10_3 - } - PIXEL01_C - if (Diff(c[2], c[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(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - } - else - { - PIXEL01_3 - PIXEL02_4 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - if (Diff(c[6], c[8])) - { - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 88: - case 248: - { - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - } - else - { - PIXEL10_3 - PIXEL20_4 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL22_4 - } - break; - } - case 74: - case 107: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - } - else - { - PIXEL00_4 - PIXEL01_3 - } - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 27: - { - if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 30: - { - PIXEL00_1M - if (Diff(c[2], c[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(c[6], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 75: - { - if (Diff(c[4], c[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(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[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(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 92: - { - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 202: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1R - break; - } - case 78: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1M - break; - } - case 154: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[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(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 89: - { - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 90: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 55: - case 23: - { - if (Diff(c[2], c[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(c[2], c[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(c[6], c[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(c[6], c[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(c[8], c[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(c[8], c[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(c[4], c[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(c[4], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 203: - { - if (Diff(c[4], c[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(c[2], c[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(c[6], c[8])) - { - PIXEL12_C - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 118: - { - PIXEL00_1M - if (Diff(c[2], c[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(c[6], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 155: - { - if (Diff(c[4], c[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(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 158: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - if (Diff(c[2], c[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(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[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(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL20_1L - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 59: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL01_3 - PIXEL10_3 - } - if (Diff(c[2], c[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(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 87: - { - PIXEL00_1L - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL01_3 - PIXEL02_4 - PIXEL12_3 - } - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 79: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL01_3 - PIXEL10_3 - } - PIXEL02_1R - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1M - break; - } - case 122: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 94: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL01_3 - PIXEL02_4 - PIXEL12_3 - } - PIXEL10_C - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 218: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_C - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 91: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL01_3 - PIXEL10_3 - } - if (Diff(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[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(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[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(c[2], c[6])) - { - PIXEL02_1M - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 93: - { - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_1M - } - else - { - PIXEL22_2 - } - break; - } - case 206: - { - if (Diff(c[4], c[2])) - { - PIXEL00_1M - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[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(c[8], c[4])) - { - PIXEL20_1M - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1R - break; - } - case 174: - case 46: - { - if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL01_3 - PIXEL02_4 - PIXEL12_3 - } - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 219: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL01_3 - PIXEL10_3 - } - PIXEL02_1M - PIXEL11 - PIXEL20_1M - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 125: - { - if (Diff(c[8], c[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(c[6], c[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(c[4], c[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(c[8], c[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(c[2], c[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(c[4], c[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(c[6], c[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(c[2], c[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(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1R - break; - } - case 175: - case 47: - { - if (Diff(c[4], c[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(c[2], c[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(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - case 250: - { - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - } - else - { - PIXEL10_3 - PIXEL20_4 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL22_4 - } - break; - } - case 123: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - } - else - { - PIXEL00_4 - PIXEL01_3 - } - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 95: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL10_3 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL02_4 - PIXEL12_3 - } - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - break; - } - case 222: - { - PIXEL00_1M - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - } - else - { - PIXEL01_3 - PIXEL02_4 - } - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - if (Diff(c[6], c[8])) - { - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 252: - { - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - } - else - { - PIXEL10_3 - PIXEL20_4 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - case 249: - { - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL22_4 - } - break; - } - case 235: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - } - else - { - PIXEL00_4 - PIXEL01_3 - } - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1R - break; - } - case 111: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 63: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL02_4 - PIXEL12_3 - } - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - break; - } - case 159: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL10_3 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - } - else - { - PIXEL02_2 - } - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - break; - } - case 215: - { - PIXEL00_1L - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - if (Diff(c[6], c[8])) - { - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 246: - { - PIXEL00_1M - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - } - else - { - PIXEL01_3 - PIXEL02_4 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - case 254: - { - PIXEL00_1M - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - } - else - { - PIXEL01_3 - PIXEL02_4 - } - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - } - else - { - PIXEL10_3 - PIXEL20_4 - } - if (Diff(c[6], c[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(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - case 251: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - } - else - { - PIXEL00_4 - PIXEL01_3 - } - PIXEL02_1M - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL10_C - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL10_3 - PIXEL20_2 - PIXEL21_3 - } - if (Diff(c[6], c[8])) - { - PIXEL12_C - PIXEL22_C - } - else - { - PIXEL12_3 - PIXEL22_4 - } - break; - } - case 239: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - } - else - { - PIXEL00_2 - } - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - if (Diff(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - PIXEL22_1R - break; - } - case 127: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL01_C - PIXEL10_C - } - else - { - PIXEL00_2 - PIXEL01_3 - PIXEL10_3 - } - if (Diff(c[2], c[6])) - { - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL02_4 - PIXEL12_3 - } - PIXEL11 - if (Diff(c[8], c[4])) - { - PIXEL20_C - PIXEL21_C - } - else - { - PIXEL20_4 - PIXEL21_3 - } - PIXEL22_1M - break; - } - case 191: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - } - else - { - PIXEL02_2 - } - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - break; - } - case 223: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - PIXEL10_C - } - else - { - PIXEL00_4 - PIXEL10_3 - } - if (Diff(c[2], c[6])) - { - PIXEL01_C - PIXEL02_C - PIXEL12_C - } - else - { - PIXEL01_3 - PIXEL02_2 - PIXEL12_3 - } - PIXEL11 - PIXEL20_1M - if (Diff(c[6], c[8])) - { - PIXEL21_C - PIXEL22_C - } - else - { - PIXEL21_3 - PIXEL22_4 - } - break; - } - case 247: - { - PIXEL00_1L - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - } - else - { - PIXEL02_2 - } - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - case 255: - { - if (Diff(c[4], c[2])) - { - PIXEL00_C - } - else - { - PIXEL00_2 - } - PIXEL01_C - if (Diff(c[2], c[6])) - { - PIXEL02_C - } - else - { - PIXEL02_2 - } - PIXEL10_C - PIXEL11 - PIXEL12_C - if (Diff(c[8], c[4])) - { - PIXEL20_C - } - else - { - PIXEL20_2 - } - PIXEL21_C - if (Diff(c[6], c[8])) - { - PIXEL22_C - } - else - { - PIXEL22_2 - } - break; - } - } +// 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. + + 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(c[2], c[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(c[6], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_1M + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 10: + case 138: + { + if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 11: + case 139: + { + if (Diff(c[4], c[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(c[2], c[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(c[2], c[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(c[6], c[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(c[6], c[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(c[8], c[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(c[8], c[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(c[4], c[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(c[4], c[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(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[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(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 88: + case 248: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 74: + case 107: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 27: + { + if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 30: + { + PIXEL00_1M + if (Diff(c[2], c[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(c[6], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 75: + { + if (Diff(c[4], c[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(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[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(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 92: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 202: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 78: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } + case 154: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[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(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 89: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 90: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 55: + case 23: + { + if (Diff(c[2], c[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(c[2], c[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(c[6], c[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(c[6], c[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(c[8], c[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(c[8], c[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(c[4], c[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(c[4], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 203: + { + if (Diff(c[4], c[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(c[2], c[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(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 118: + { + PIXEL00_1M + if (Diff(c[2], c[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(c[6], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 155: + { + if (Diff(c[4], c[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(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 158: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(c[2], c[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(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[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(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 59: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[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(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 87: + { + PIXEL00_1L + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 79: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1R + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } + case 122: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 94: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 218: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 91: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[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(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[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(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 93: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } + case 206: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[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(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 174: + case 46: + { + if (Diff(c[4], c[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(c[2], c[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(c[6], c[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(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 219: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 125: + { + if (Diff(c[8], c[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(c[6], c[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(c[4], c[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(c[8], c[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(c[2], c[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(c[4], c[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(c[6], c[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(c[2], c[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(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 175: + case 47: + { + if (Diff(c[4], c[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(c[2], c[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(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 250: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 123: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 95: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } + case 222: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 252: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 249: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 235: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 111: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 63: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } + case 159: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } + case 215: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 246: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 254: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + if (Diff(c[6], c[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(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 251: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_2 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } + case 239: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } + case 127: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_2 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } + case 191: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } + case 223: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_2 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } + case 247: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + case 255: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } + } diff --git a/src/hq3x_16.asm b/src/hq3x_16.asm index d98587e7..0de9c6f6 100644 --- a/src/hq3x_16.asm +++ b/src/hq3x_16.asm @@ -1,2526 +1,2526 @@ -;hq3x filter -;16bpp output -;---------------------------------------------------------- -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -; -;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. - -%include "macros.mac" - -EXTSYM LUT16to32,RGBtoYUV - -SECTION .bss -linesleft resd 1 -xcounter resd 1 -cross resd 1 -nextline resd 1 -prevline resd 1 -w1 resd 1 -w2 resd 1 -w3 resd 1 -w4 resd 1 -w5 resd 1 -w6 resd 1 -w7 resd 1 -w8 resd 1 -w9 resd 1 - -SECTION .data - -reg_blank dd 0,0 -const7 dd 0x00070007,0x00000007 -threshold dd 0x00300706,0x00000000 -zerolowbits dd 0xF7DEF7DE - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,RGBtoYUV - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp2 4 - mov edx,%3 - mov ecx,%4 - cmp edx,ecx - je %%fin1 - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 -%%fin1 - mov edx,%2 - cmp edx,ecx - je %%fin2 - and ecx,[zerolowbits] - and edx,[zerolowbits] - add edx,ecx - shr edx,1 -%%fin2 - mov %1,dx -%endmacro - -%macro Interp3 2 - mov ecx, LUT16to32 - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp4 3 - mov ecx, LUT16to32 - movd mm1, [ecx+eax*4] - mov edx, %2 - movd mm2, [ecx+edx*4] - mov edx, %3 - movd mm3, [ecx+edx*4] - 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, 6 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp5 3 - mov edx,%2 - mov ecx,%3 - cmp edx,ecx - je %%fin - and edx,[zerolowbits] - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro PIXEL00_1M 0 - Interp1 [edi],eax,[w1] -%endmacro - -%macro PIXEL00_1U 0 - Interp1 [edi],eax,[w2] -%endmacro - -%macro PIXEL00_1L 0 - Interp1 [edi],eax,[w4] -%endmacro - -%macro PIXEL00_2 0 - Interp2 [edi],eax,[w4],[w2] -%endmacro - -%macro PIXEL00_4 0 - Interp4 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_5 0 - Interp5 [edi],[w4],[w2] -%endmacro - -%macro PIXEL00_C 0 - mov [edi],ax -%endmacro - -%macro PIXEL01_1 0 - Interp1 [edi+2],eax,[w2] -%endmacro - -%macro PIXEL01_3 0 - Interp3 [edi+2],[w2] -%endmacro - -%macro PIXEL01_6 0 - Interp1 [edi+2],[w2],eax -%endmacro - -%macro PIXEL01_C 0 - mov [edi+2],ax -%endmacro - -%macro PIXEL02_1M 0 - Interp1 [edi+4],eax,[w3] -%endmacro - -%macro PIXEL02_1U 0 - Interp1 [edi+4],eax,[w2] -%endmacro - -%macro PIXEL02_1R 0 - Interp1 [edi+4],eax,[w6] -%endmacro - -%macro PIXEL02_2 0 - Interp2 [edi+4],eax,[w2],[w6] -%endmacro - -%macro PIXEL02_4 0 - Interp4 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL02_5 0 - Interp5 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL02_C 0 - mov [edi+4],ax -%endmacro - -%macro PIXEL10_1 0 - Interp1 [edi+ebx],eax,[w4] -%endmacro - -%macro PIXEL10_3 0 - Interp3 [edi+ebx],[w4] -%endmacro - -%macro PIXEL10_6 0 - Interp1 [edi+ebx],[w4],eax -%endmacro - -%macro PIXEL10_C 0 - mov [edi+ebx],ax -%endmacro - -%macro PIXEL11 0 - mov [edi+ebx+2],ax -%endmacro - -%macro PIXEL12_1 0 - Interp1 [edi+ebx+4],eax,[w6] -%endmacro - -%macro PIXEL12_3 0 - Interp3 [edi+ebx+4],[w6] -%endmacro - -%macro PIXEL12_6 0 - Interp1 [edi+ebx+4],[w6],eax -%endmacro - -%macro PIXEL12_C 0 - mov [edi+ebx+4],ax -%endmacro - -%macro PIXEL20_1M 0 - Interp1 [edi+ebx*2],eax,[w7] -%endmacro - -%macro PIXEL20_1D 0 - Interp1 [edi+ebx*2],eax,[w8] -%endmacro - -%macro PIXEL20_1L 0 - Interp1 [edi+ebx*2],eax,[w4] -%endmacro - -%macro PIXEL20_2 0 - Interp2 [edi+ebx*2],eax,[w8],[w4] -%endmacro - -%macro PIXEL20_4 0 - Interp4 [edi+ebx*2],[w8],[w4] -%endmacro - -%macro PIXEL20_5 0 - Interp5 [edi+ebx*2],[w8],[w4] -%endmacro - -%macro PIXEL20_C 0 - mov [edi+ebx*2],ax -%endmacro - -%macro PIXEL21_1 0 - Interp1 [edi+ebx*2+2],eax,[w8] -%endmacro - -%macro PIXEL21_3 0 - Interp3 [edi+ebx*2+2],[w8] -%endmacro - -%macro PIXEL21_6 0 - Interp1 [edi+ebx*2+2],[w8],eax -%endmacro - -%macro PIXEL21_C 0 - mov [edi+ebx*2+2],ax -%endmacro - -%macro PIXEL22_1M 0 - Interp1 [edi+ebx*2+4],eax,[w9] -%endmacro - -%macro PIXEL22_1D 0 - Interp1 [edi+ebx*2+4],eax,[w8] -%endmacro - -%macro PIXEL22_1R 0 - Interp1 [edi+ebx*2+4],eax,[w6] -%endmacro - -%macro PIXEL22_2 0 - Interp2 [edi+ebx*2+4],eax,[w6],[w8] -%endmacro - -%macro PIXEL22_4 0 - Interp4 [edi+ebx*2+4],[w6],[w8] -%endmacro - -%macro PIXEL22_5 0 - Interp5 [edi+ebx*2+4],[w6],[w8] -%endmacro - -%macro PIXEL22_C 0 - mov [edi+ebx*2+4],ax -%endmacro - -inbuffer equ 8 -outbuffer equ 12 -Xres equ 16 -Yres equ 20 -pitch equ 24 -offset equ 28 - -NEWSYM hq3x_16 - push ebp - mov ebp,esp - pushad - - mov esi,[ebp+inbuffer] - mov edi,[ebp+outbuffer] - mov edx,[ebp+Yres] - mov [linesleft],edx - mov ebx,[ebp+Xres] - shl ebx,1 - mov dword[prevline],0 - mov dword[nextline],ebx -.loopy - mov ecx,[ebp+Xres] - sub ecx,2 ; x={Xres-2, Xres-1} are special cases. - mov dword[xcounter],ecx - ; x=0 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx] - movq mm6,[esi] - mov ebx,[nextline] - movq mm7,[esi+ebx] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov ebx,[prevline] - movq mm5,[esi+ebx-2] - movq mm6,[esi-2] - mov ebx,[nextline] - movq mm7,[esi+ebx-2] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,RGBtoYUV - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,[ebp+pitch] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[ebp+pitch] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag66 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag24 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag146 -..@flag178 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag84 -..@flag85 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag112 -..@flag113 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag200 -..@flag204 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag67 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag70 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag28 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag152 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag194 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag98 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag56 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag25 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag86 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag216 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag106 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag30 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag210 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag120 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag29 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag198 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag184 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag99 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag57 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag71 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag156 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag226 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag60 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag195 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag102 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag153 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag83 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag92 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag114 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag89 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag182 -..@flag150 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag213 -..@flag212 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag241 -..@flag240 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag236 -..@flag232 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag124 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag62 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag211 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag118 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag217 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag110 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag188 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag185 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag61 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag157 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag103 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag227 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag230 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag199 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag220 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1R - jmp .loopx_end -..@flag242 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag121 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag87 - PIXEL00_1L - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag229 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag167 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag173 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag181 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag115 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag93 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag189 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag231 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag126 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - PIXEL22_1M - jmp .loopx_end -..@flag221 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_1U - PIXEL01_1 - PIXEL10_C - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag238 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag190 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag243 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag250 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag222 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag252 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag249 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag215 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag246 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag254 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 - jmp .loopx_end -..@flag253 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag247 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end - -..@cross0 - mov edx,eax - shl eax,16 - or eax,edx - mov [edi],eax - mov [edi+4],ax - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],ax - jmp .loopx_end -..@cross1 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w2] - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 - mov [edi],dx - mov [edi+2],dx - mov [edi+4],dx - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],ax - jmp .loopx_end -..@cross2 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w4] - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 - mov [edi],dx - mov [edi+2],eax - mov [edi+ebx],dx - mov [edi+ebx+2],eax - mov [edi+ebx*2],dx - mov [edi+ebx*2+2],eax - jmp .loopx_end -..@cross4 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w6] - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 - mov [edi],eax - mov [edi+4],dx - mov [edi+ebx],eax - mov [edi+ebx+4],dx - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],dx - jmp .loopx_end -..@cross8 - mov edx,eax - shl eax,16 - or eax,edx - mov ecx,[w8] - and edx,[zerolowbits] - and ecx,[zerolowbits] - add ecx,edx - shr ecx,1 - add ecx,0x0821 - and ecx,[zerolowbits] - add edx,ecx - shr edx,1 - mov [edi],eax - mov [edi+4],ax - mov [edi+ebx],eax - mov [edi+ebx+4],ax - mov [edi+ebx*2],dx - mov [edi+ebx*2+2],dx - mov [edi+ebx*2+4],dx - jmp .loopx_end - -.loopx_end - add esi,2 - add edi,6 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl .xres_1 - mov ebx,[prevline] - movq mm5,[esi+ebx-4] - movq mm6,[esi-4] - mov ebx,[nextline] - movq mm7,[esi+ebx-4] - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl .nexty - ; x=Xres-1 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx-6] - movq mm6,[esi-6] - mov ebx,[nextline] - movq mm7,[esi+ebx-6] - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.nexty - add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset - shl ebx, 1 - sub edi, ebx - sub edi, ebx - sub edi, ebx - dec dword[linesleft] - jz .fin - add ebx, [ebp+offset]; - cmp dword[linesleft],1 - je .lastline - mov dword[nextline],ebx - neg ebx - mov dword[prevline],ebx - jmp .loopy -.lastline - mov dword[nextline],0 - neg ebx - mov dword[prevline],ebx - jmp .loopy -.fin - emms - popad - mov esp,ebp - pop ebp - ret - -SECTION .data -FuncTable - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2 - dd ..@cross0, ..@cross1, ..@cross2, ..@flag0, - dd ..@cross4, ..@flag0, ..@flag0, ..@flag0, - dd ..@cross8, ..@flag0, ..@flag0, ..@flag0, - dd ..@flag0, ..@flag0, ..@flag0, ..@flag0 - +;hq3x filter +;16bpp output +;---------------------------------------------------------- +;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) +; +;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. + +%include "macros.mac" + +EXTSYM LUT16to32,RGBtoYUV + +SECTION .bss +linesleft resd 1 +xcounter resd 1 +cross resd 1 +nextline resd 1 +prevline resd 1 +w1 resd 1 +w2 resd 1 +w3 resd 1 +w4 resd 1 +w5 resd 1 +w6 resd 1 +w7 resd 1 +w8 resd 1 +w9 resd 1 + +SECTION .data + +reg_blank dd 0,0 +const7 dd 0x00070007,0x00000007 +threshold dd 0x00300706,0x00000000 +zerolowbits dd 0xF7DEF7DE + +SECTION .text + +%macro TestDiff 2 + xor ecx,ecx + mov edx,[%1] + cmp edx,[%2] + je %%fin + mov ecx,RGBtoYUV + movd mm1,[ecx+edx*4] + movq mm5,mm1 + mov edx,[%2] + movd mm2,[ecx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd ecx,mm1 +%%fin: +%endmacro + +%macro DiffOrNot 4 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + jmp %%fin +%%same: + %4 +%%fin +%endmacro + +%macro DiffOrNot 6 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + jmp %%fin +%%same: + %5 + %6 +%%fin +%endmacro + +%macro DiffOrNot 8 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + %5 + jmp %%fin +%%same: + %6 + %7 + %8 +%%fin +%endmacro + +%macro DiffOrNot 10 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + %5 + %6 + jmp %%fin +%%same: + %7 + %8 + %9 + %10 +%%fin +%endmacro + +%macro Interp1 3 + mov edx,%2 + mov ecx,%3 + cmp edx,ecx + je %%fin + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 +%%fin + mov %1,dx +%endmacro + +%macro Interp2 4 + mov edx,%3 + mov ecx,%4 + cmp edx,ecx + je %%fin1 + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 +%%fin1 + mov edx,%2 + cmp edx,ecx + je %%fin2 + and ecx,[zerolowbits] + and edx,[zerolowbits] + add edx,ecx + shr edx,1 +%%fin2 + mov %1,dx +%endmacro + +%macro Interp3 2 + mov ecx, LUT16to32 + movd mm1, [ecx+eax*4] + mov edx, %2 + movd mm2, [ecx+edx*4] + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const7] + paddw mm1, mm2 + psrlw mm1, 5 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro Interp4 3 + mov ecx, LUT16to32 + movd mm1, [ecx+eax*4] + mov edx, %2 + movd mm2, [ecx+edx*4] + mov edx, %3 + movd mm3, [ecx+edx*4] + 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, 6 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro Interp5 3 + mov edx,%2 + mov ecx,%3 + cmp edx,ecx + je %%fin + and edx,[zerolowbits] + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 +%%fin + mov %1,dx +%endmacro + +%macro PIXEL00_1M 0 + Interp1 [edi],eax,[w1] +%endmacro + +%macro PIXEL00_1U 0 + Interp1 [edi],eax,[w2] +%endmacro + +%macro PIXEL00_1L 0 + Interp1 [edi],eax,[w4] +%endmacro + +%macro PIXEL00_2 0 + Interp2 [edi],eax,[w4],[w2] +%endmacro + +%macro PIXEL00_4 0 + Interp4 [edi],[w4],[w2] +%endmacro + +%macro PIXEL00_5 0 + Interp5 [edi],[w4],[w2] +%endmacro + +%macro PIXEL00_C 0 + mov [edi],ax +%endmacro + +%macro PIXEL01_1 0 + Interp1 [edi+2],eax,[w2] +%endmacro + +%macro PIXEL01_3 0 + Interp3 [edi+2],[w2] +%endmacro + +%macro PIXEL01_6 0 + Interp1 [edi+2],[w2],eax +%endmacro + +%macro PIXEL01_C 0 + mov [edi+2],ax +%endmacro + +%macro PIXEL02_1M 0 + Interp1 [edi+4],eax,[w3] +%endmacro + +%macro PIXEL02_1U 0 + Interp1 [edi+4],eax,[w2] +%endmacro + +%macro PIXEL02_1R 0 + Interp1 [edi+4],eax,[w6] +%endmacro + +%macro PIXEL02_2 0 + Interp2 [edi+4],eax,[w2],[w6] +%endmacro + +%macro PIXEL02_4 0 + Interp4 [edi+4],[w2],[w6] +%endmacro + +%macro PIXEL02_5 0 + Interp5 [edi+4],[w2],[w6] +%endmacro + +%macro PIXEL02_C 0 + mov [edi+4],ax +%endmacro + +%macro PIXEL10_1 0 + Interp1 [edi+ebx],eax,[w4] +%endmacro + +%macro PIXEL10_3 0 + Interp3 [edi+ebx],[w4] +%endmacro + +%macro PIXEL10_6 0 + Interp1 [edi+ebx],[w4],eax +%endmacro + +%macro PIXEL10_C 0 + mov [edi+ebx],ax +%endmacro + +%macro PIXEL11 0 + mov [edi+ebx+2],ax +%endmacro + +%macro PIXEL12_1 0 + Interp1 [edi+ebx+4],eax,[w6] +%endmacro + +%macro PIXEL12_3 0 + Interp3 [edi+ebx+4],[w6] +%endmacro + +%macro PIXEL12_6 0 + Interp1 [edi+ebx+4],[w6],eax +%endmacro + +%macro PIXEL12_C 0 + mov [edi+ebx+4],ax +%endmacro + +%macro PIXEL20_1M 0 + Interp1 [edi+ebx*2],eax,[w7] +%endmacro + +%macro PIXEL20_1D 0 + Interp1 [edi+ebx*2],eax,[w8] +%endmacro + +%macro PIXEL20_1L 0 + Interp1 [edi+ebx*2],eax,[w4] +%endmacro + +%macro PIXEL20_2 0 + Interp2 [edi+ebx*2],eax,[w8],[w4] +%endmacro + +%macro PIXEL20_4 0 + Interp4 [edi+ebx*2],[w8],[w4] +%endmacro + +%macro PIXEL20_5 0 + Interp5 [edi+ebx*2],[w8],[w4] +%endmacro + +%macro PIXEL20_C 0 + mov [edi+ebx*2],ax +%endmacro + +%macro PIXEL21_1 0 + Interp1 [edi+ebx*2+2],eax,[w8] +%endmacro + +%macro PIXEL21_3 0 + Interp3 [edi+ebx*2+2],[w8] +%endmacro + +%macro PIXEL21_6 0 + Interp1 [edi+ebx*2+2],[w8],eax +%endmacro + +%macro PIXEL21_C 0 + mov [edi+ebx*2+2],ax +%endmacro + +%macro PIXEL22_1M 0 + Interp1 [edi+ebx*2+4],eax,[w9] +%endmacro + +%macro PIXEL22_1D 0 + Interp1 [edi+ebx*2+4],eax,[w8] +%endmacro + +%macro PIXEL22_1R 0 + Interp1 [edi+ebx*2+4],eax,[w6] +%endmacro + +%macro PIXEL22_2 0 + Interp2 [edi+ebx*2+4],eax,[w6],[w8] +%endmacro + +%macro PIXEL22_4 0 + Interp4 [edi+ebx*2+4],[w6],[w8] +%endmacro + +%macro PIXEL22_5 0 + Interp5 [edi+ebx*2+4],[w6],[w8] +%endmacro + +%macro PIXEL22_C 0 + mov [edi+ebx*2+4],ax +%endmacro + +inbuffer equ 8 +outbuffer equ 12 +Xres equ 16 +Yres equ 20 +pitch equ 24 +offset equ 28 + +NEWSYM hq3x_16 + push ebp + mov ebp,esp + pushad + + mov esi,[ebp+inbuffer] + mov edi,[ebp+outbuffer] + mov edx,[ebp+Yres] + mov [linesleft],edx + mov ebx,[ebp+Xres] + shl ebx,1 + mov dword[prevline],0 + mov dword[nextline],ebx +.loopy + mov ecx,[ebp+Xres] + sub ecx,2 ; x={Xres-2, Xres-1} are special cases. + mov dword[xcounter],ecx + ; x=0 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx] + movq mm6,[esi] + mov ebx,[nextline] + movq mm7,[esi+ebx] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + mov [w2],edx + shr eax,16 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + mov [w5],edx + shr eax,16 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + mov [w8],edx + shr eax,16 + mov [w9],eax + jmp .flags +.loopx + mov ebx,[prevline] + movq mm5,[esi+ebx-2] + movq mm6,[esi-2] + mov ebx,[nextline] + movq mm7,[esi+ebx-2] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + movzx edx,ax + mov [w3],edx + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + movzx edx,ax + mov [w6],edx + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + movzx edx,ax + mov [w9],edx +.flags + mov ebx,RGBtoYUV + mov eax,[w5] + xor ecx,ecx + movd mm5,[ebx+eax*4] + mov dword[cross],0 + + mov edx,[w2] + cmp eax,edx + je .noflag2 + or dword[cross],1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag2 + or ecx,2 +.noflag2 + mov edx,[w4] + cmp eax,edx + je .noflag4 + or dword[cross],2 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag4 + or ecx,8 +.noflag4 + mov edx,[w6] + cmp eax,edx + je .noflag6 + or dword[cross],4 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag6 + or ecx,16 +.noflag6 + mov edx,[w8] + cmp eax,edx + je .noflag8 + or dword[cross],8 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag8 + or ecx,64 +.noflag8 + test ecx,ecx + jnz .testflag1 + mov ecx,[cross] + mov ebx,[ebp+pitch] + jmp [FuncTable2+ecx*4] +.testflag1 + mov edx,[w1] + cmp eax,edx + je .noflag1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag1 + or ecx,1 +.noflag1 + mov edx,[w3] + cmp eax,edx + je .noflag3 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag3 + or ecx,4 +.noflag3 + mov edx,[w7] + cmp eax,edx + je .noflag7 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag7 + or ecx,32 +.noflag7 + mov edx,[w9] + cmp eax,edx + je .noflag9 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag9 + or ecx,128 +.noflag9 + mov ebx,[ebp+pitch] + jmp [FuncTable+ecx*4] + +..@flag0 +..@flag1 +..@flag4 +..@flag32 +..@flag128 +..@flag5 +..@flag132 +..@flag160 +..@flag33 +..@flag129 +..@flag36 +..@flag133 +..@flag164 +..@flag161 +..@flag37 +..@flag165 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag2 +..@flag34 +..@flag130 +..@flag162 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag16 +..@flag17 +..@flag48 +..@flag49 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag64 +..@flag65 +..@flag68 +..@flag69 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag8 +..@flag12 +..@flag136 +..@flag140 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag3 +..@flag35 +..@flag131 +..@flag163 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag6 +..@flag38 +..@flag134 +..@flag166 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag20 +..@flag21 +..@flag52 +..@flag53 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag144 +..@flag145 +..@flag176 +..@flag177 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag192 +..@flag193 +..@flag196 +..@flag197 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag96 +..@flag97 +..@flag100 +..@flag101 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag40 +..@flag44 +..@flag168 +..@flag172 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag9 +..@flag13 +..@flag137 +..@flag141 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag18 +..@flag50 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag80 +..@flag81 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag72 +..@flag76 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag10 +..@flag138 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag66 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag24 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag7 +..@flag39 +..@flag135 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag148 +..@flag149 +..@flag180 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag224 +..@flag228 +..@flag225 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag41 +..@flag169 +..@flag45 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag22 +..@flag54 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag208 +..@flag209 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag104 +..@flag108 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag11 +..@flag139 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag19 +..@flag51 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag146 +..@flag178 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + jmp .loopx_end +..@flag84 +..@flag85 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag112 +..@flag113 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag200 +..@flag204 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag73 +..@flag77 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + jmp .loopx_end +..@flag42 +..@flag170 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag14 +..@flag142 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag67 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag70 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag28 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag152 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag194 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag98 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag56 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag25 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag26 +..@flag31 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag82 +..@flag214 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag88 +..@flag248 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag74 +..@flag107 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag27 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag86 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag216 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag106 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag30 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag210 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag120 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag75 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag29 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag198 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag184 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag99 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag57 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag71 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag156 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag226 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag60 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag195 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag102 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag153 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag58 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag83 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag92 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag202 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag78 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag154 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag114 + PIXEL00_1M + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag89 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag90 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag55 +..@flag23 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag182 +..@flag150 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + jmp .loopx_end +..@flag213 +..@flag212 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag241 +..@flag240 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag236 +..@flag232 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag109 +..@flag105 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + jmp .loopx_end +..@flag171 +..@flag43 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag143 +..@flag15 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag124 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag203 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag62 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag211 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag118 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag217 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag110 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag155 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag188 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag185 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag61 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag157 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag103 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag227 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag230 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag199 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag220 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag158 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag234 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1R + jmp .loopx_end +..@flag242 + PIXEL00_1M + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag59 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag121 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag87 + PIXEL00_1L + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag79 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1R + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag122 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag94 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag218 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag91 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag229 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag167 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag173 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag181 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag186 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag115 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag93 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag206 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag205 +..@flag201 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag174 +..@flag46 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag179 +..@flag147 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag117 +..@flag116 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag189 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag231 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag126 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag219 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag125 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + PIXEL22_1M + jmp .loopx_end +..@flag221 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_1U + PIXEL01_1 + PIXEL10_C + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag207 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag238 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag190 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + jmp .loopx_end +..@flag187 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag243 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag119 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag237 +..@flag233 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag175 +..@flag47 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag183 +..@flag151 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag245 +..@flag244 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag250 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag123 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag95 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag222 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag252 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag249 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag235 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag111 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag63 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag159 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag215 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag246 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag254 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 + jmp .loopx_end +..@flag253 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag251 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag239 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag127 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag191 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag223 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag247 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag255 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end + +..@cross0 + mov edx,eax + shl eax,16 + or eax,edx + mov [edi],eax + mov [edi+4],ax + mov [edi+ebx],eax + mov [edi+ebx+4],ax + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],ax + jmp .loopx_end +..@cross1 + mov edx,eax + shl eax,16 + or eax,edx + mov ecx,[w2] + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 + mov [edi],dx + mov [edi+2],dx + mov [edi+4],dx + mov [edi+ebx],eax + mov [edi+ebx+4],ax + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],ax + jmp .loopx_end +..@cross2 + mov edx,eax + shl eax,16 + or eax,edx + mov ecx,[w4] + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 + mov [edi],dx + mov [edi+2],eax + mov [edi+ebx],dx + mov [edi+ebx+2],eax + mov [edi+ebx*2],dx + mov [edi+ebx*2+2],eax + jmp .loopx_end +..@cross4 + mov edx,eax + shl eax,16 + or eax,edx + mov ecx,[w6] + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 + mov [edi],eax + mov [edi+4],dx + mov [edi+ebx],eax + mov [edi+ebx+4],dx + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],dx + jmp .loopx_end +..@cross8 + mov edx,eax + shl eax,16 + or eax,edx + mov ecx,[w8] + and edx,[zerolowbits] + and ecx,[zerolowbits] + add ecx,edx + shr ecx,1 + add ecx,0x0821 + and ecx,[zerolowbits] + add edx,ecx + shr edx,1 + mov [edi],eax + mov [edi+4],ax + mov [edi+ebx],eax + mov [edi+ebx+4],ax + mov [edi+ebx*2],dx + mov [edi+ebx*2+2],dx + mov [edi+ebx*2+4],dx + jmp .loopx_end + +.loopx_end + add esi,2 + add edi,6 + dec dword[xcounter] + jle .xres_2 + jmp .loopx +.xres_2 + ; x=Xres-2 - special case + jl .xres_1 + mov ebx,[prevline] + movq mm5,[esi+ebx-4] + movq mm6,[esi-4] + mov ebx,[nextline] + movq mm7,[esi+ebx-4] + psrlq mm5,16 + psrlq mm6,16 + psrlq mm7,16 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + mov [w9],eax + jmp .flags +.xres_1 + cmp dword[xcounter],-1 + jl .nexty + ; x=Xres-1 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx-6] + movq mm6,[esi-6] + mov ebx,[nextline] + movq mm7,[esi+ebx-6] + psrlq mm5,32 + psrlq mm6,32 + psrlq mm7,32 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + mov [w9],eax + jmp .flags +.nexty + add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks + add edi,ebx + add edi,ebx + add edi,ebx + mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset + shl ebx, 1 + sub edi, ebx + sub edi, ebx + sub edi, ebx + dec dword[linesleft] + jz .fin + add ebx, [ebp+offset]; + cmp dword[linesleft],1 + je .lastline + mov dword[nextline],ebx + neg ebx + mov dword[prevline],ebx + jmp .loopy +.lastline + mov dword[nextline],0 + neg ebx + mov dword[prevline],ebx + jmp .loopy +.fin + emms + popad + mov esp,ebp + pop ebp + ret + +SECTION .data +FuncTable + dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 + dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 + dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 + dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 + dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 + dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 + dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 + dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 + dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 + dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 + dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 + dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 + dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 + dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 + dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 + dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 + dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 + dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 + dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 + dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 + dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 + dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 + dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 + dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 + dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 + dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 + dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 + dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 + dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 + dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 + dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 + dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 + +FuncTable2 + dd ..@cross0, ..@cross1, ..@cross2, ..@flag0, + dd ..@cross4, ..@flag0, ..@flag0, ..@flag0, + dd ..@cross8, ..@flag0, ..@flag0, ..@flag0, + dd ..@flag0, ..@flag0, ..@flag0, ..@flag0 + diff --git a/src/hq3x_32.asm b/src/hq3x_32.asm index 19ade71a..6dc314fe 100644 --- a/src/hq3x_32.asm +++ b/src/hq3x_32.asm @@ -1,2570 +1,2570 @@ -;hq3x filter -;32bpp output -;---------------------------------------------------------- -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -; -;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. - -%include "macros.mac" - -EXTSYM LUT16to32,RGBtoYUV - -SECTION .bss -linesleft resd 1 -xcounter resd 1 -cross resd 1 -nextline resd 1 -prevline resd 1 -w1 resd 1 -w2 resd 1 -w3 resd 1 -w4 resd 1 -w5 resd 1 -w6 resd 1 -w7 resd 1 -w8 resd 1 -w9 resd 1 -c1 resd 1 -c2 resd 1 -c3 resd 1 -c4 resd 1 -c5 resd 1 -c6 resd 1 -c7 resd 1 -c8 resd 1 -c9 resd 1 - -SECTION .data - -reg_blank dd 0,0 -const7 dd 0x00070007,0x00000007 -threshold dd 0x00300706,0x00000000 - -SECTION .text - -%macro TestDiff 2 - xor ecx,ecx - mov edx,[%1] - cmp edx,[%2] - je %%fin - mov ecx,RGBtoYUV - movd mm1,[ecx+edx*4] - movq mm5,mm1 - mov edx,[%2] - movd mm2,[ecx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd ecx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 6 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - jmp %%fin -%%same: - %5 - %6 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test ecx,ecx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - shl edx,2 - add edx,%3 - sub edx,%2 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp2 4 - mov edx,%2 - shl edx,1 - add edx,%3 - add edx,%4 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp3 2 - movd mm1, eax - movd mm2, %2 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp4 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - 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 %1, mm1 -%endmacro - -%macro Interp5 3 - mov edx,%2 - add edx,%3 - shr edx,1 - mov %1,edx -%endmacro - -%macro PIXEL00_1M 0 - Interp1 [edi],eax,[c1] -%endmacro - -%macro PIXEL00_1U 0 - Interp1 [edi],eax,[c2] -%endmacro - -%macro PIXEL00_1L 0 - Interp1 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_2 0 - Interp2 [edi],eax,[c4],[c2] -%endmacro - -%macro PIXEL00_4 0 - Interp4 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_5 0 - Interp5 [edi],[c4],[c2] -%endmacro - -%macro PIXEL00_C 0 - mov [edi],eax -%endmacro - -%macro PIXEL01_1 0 - Interp1 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_3 0 - Interp3 [edi+4],[c2] -%endmacro - -%macro PIXEL01_6 0 - Interp1 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_C 0 - mov [edi+4],eax -%endmacro - -%macro PIXEL02_1M 0 - Interp1 [edi+8],eax,[c3] -%endmacro - -%macro PIXEL02_1U 0 - Interp1 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_1R 0 - Interp1 [edi+8],eax,[c6] -%endmacro - -%macro PIXEL02_2 0 - Interp2 [edi+8],eax,[c2],[c6] -%endmacro - -%macro PIXEL02_4 0 - Interp4 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_5 0 - Interp5 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_C 0 - mov [edi+8],eax -%endmacro - -%macro PIXEL10_1 0 - Interp1 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_3 0 - Interp3 [edi+ebx],[c4] -%endmacro - -%macro PIXEL10_6 0 - Interp1 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_C 0 - mov [edi+ebx],eax -%endmacro - -%macro PIXEL11 0 - mov [edi+ebx+4],eax -%endmacro - -%macro PIXEL12_1 0 - Interp1 [edi+ebx+8],eax,[c6] -%endmacro - -%macro PIXEL12_3 0 - Interp3 [edi+ebx+8],[c6] -%endmacro - -%macro PIXEL12_6 0 - Interp1 [edi+ebx+8],[c6],eax -%endmacro - -%macro PIXEL12_C 0 - mov [edi+ebx+8],eax -%endmacro - -%macro PIXEL20_1M 0 - Interp1 [edi+ebx*2],eax,[c7] -%endmacro - -%macro PIXEL20_1D 0 - Interp1 [edi+ebx*2],eax,[c8] -%endmacro - -%macro PIXEL20_1L 0 - Interp1 [edi+ebx*2],eax,[c4] -%endmacro - -%macro PIXEL20_2 0 - Interp2 [edi+ebx*2],eax,[c8],[c4] -%endmacro - -%macro PIXEL20_4 0 - Interp4 [edi+ebx*2],[c8],[c4] -%endmacro - -%macro PIXEL20_5 0 - Interp5 [edi+ebx*2],[c8],[c4] -%endmacro - -%macro PIXEL20_C 0 - mov [edi+ebx*2],eax -%endmacro - -%macro PIXEL21_1 0 - Interp1 [edi+ebx*2+4],eax,[c8] -%endmacro - -%macro PIXEL21_3 0 - Interp3 [edi+ebx*2+4],[c8] -%endmacro - -%macro PIXEL21_6 0 - Interp1 [edi+ebx*2+4],[c8],eax -%endmacro - -%macro PIXEL21_C 0 - mov [edi+ebx*2+4],eax -%endmacro - -%macro PIXEL22_1M 0 - Interp1 [edi+ebx*2+8],eax,[c9] -%endmacro - -%macro PIXEL22_1D 0 - Interp1 [edi+ebx*2+8],eax,[c8] -%endmacro - -%macro PIXEL22_1R 0 - Interp1 [edi+ebx*2+8],eax,[c6] -%endmacro - -%macro PIXEL22_2 0 - Interp2 [edi+ebx*2+8],eax,[c6],[c8] -%endmacro - -%macro PIXEL22_4 0 - Interp4 [edi+ebx*2+8],[c6],[c8] -%endmacro - -%macro PIXEL22_5 0 - Interp5 [edi+ebx*2+8],[c6],[c8] -%endmacro - -%macro PIXEL22_C 0 - mov [edi+ebx*2+8],eax -%endmacro - -inbuffer equ 8 -outbuffer equ 12 -Xres equ 16 -Yres equ 20 -pitch equ 24 -offset equ 28 - -NEWSYM hq3x_32 - push ebp - mov ebp,esp - pushad - - mov esi,[ebp+inbuffer] - mov edi,[ebp+outbuffer] - mov edx,[ebp+Yres] - mov [linesleft],edx - mov ebx,[ebp+Xres] - shl ebx,1 - mov dword[prevline],0 - mov dword[nextline],ebx -.loopy - mov ecx,[ebp+Xres] - sub ecx,2 ; x={Xres-2, Xres-1} are special cases. - mov dword[xcounter],ecx - ; x=0 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx] - movq mm6,[esi] - mov ebx,[nextline] - movq mm7,[esi+ebx] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov ebx,[prevline] - movq mm5,[esi+ebx-2] - movq mm6,[esi-2] - mov ebx,[nextline] - movq mm7,[esi+ebx-2] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,RGBtoYUV - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - test ecx,ecx - jnz .testflag1 - mov ecx,[cross] - mov ebx,LUT16to32 - mov eax,[ebx+eax*4] - jmp [FuncTable2+ecx*4] -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,LUT16to32 - mov eax,[ebx+eax*4] - mov edx,[w2] - mov edx,[ebx+edx*4] - mov [c2],edx - mov edx,[w4] - mov edx,[ebx+edx*4] - mov [c4],edx - mov edx,[w6] - mov edx,[ebx+edx*4] - mov [c6],edx - mov edx,[w8] - mov edx,[ebx+edx*4] - mov [c8],edx - test ecx,0x005A - jz .switch - mov edx,[w1] - mov edx,[ebx+edx*4] - mov [c1],edx - mov edx,[w3] - mov edx,[ebx+edx*4] - mov [c3],edx - mov edx,[w7] - mov edx,[ebx+edx*4] - mov [c7],edx - mov edx,[w9] - mov edx,[ebx+edx*4] - mov [c9],edx -.switch - mov ebx,[ebp+pitch] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 -; PIXEL00_2 -; PIXEL01_1 -; PIXEL02_2 -; PIXEL10_1 -; PIXEL11 -; PIXEL12_1 -; PIXEL20_2 -; PIXEL21_1 -; PIXEL22_2 - -; the same, only optimized - mov ecx,eax - shl ecx,1 - add ecx,[c2] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi],edx - mov edx,ecx - add edx,eax - shr edx,2 - mov [edi+4],edx - add ecx,[c6] - shr ecx,2 - mov [edi+8],ecx - mov ecx,eax - shl ecx,2 - sub ecx,eax - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi+ebx],edx - mov [edi+ebx+4],eax - add ecx,[c6] - shr ecx,2 - mov [edi+ebx+8],ecx - mov ecx,eax - shl ecx,1 - add ecx,[c8] - mov edx,ecx - add edx,[c4] - shr edx,2 - mov [edi+ebx*2],edx - mov edx,ecx - add edx,eax - shr edx,2 - mov [edi+ebx*2+4],edx - add ecx,[c6] - shr ecx,2 - mov [edi+ebx*2+8],ecx - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag18 -..@flag50 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag80 -..@flag81 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag72 -..@flag76 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag10 -..@flag138 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag66 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag24 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag22 -..@flag54 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag208 -..@flag209 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag104 -..@flag108 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag11 -..@flag139 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag19 -..@flag51 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag146 -..@flag178 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag84 -..@flag85 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag112 -..@flag113 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag200 -..@flag204 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag73 -..@flag77 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag42 -..@flag170 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag14 -..@flag142 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag67 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag70 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag28 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag152 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag194 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag98 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag56 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag25 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag26 -..@flag31 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag82 -..@flag214 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag88 -..@flag248 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag74 -..@flag107 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag27 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag86 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag216 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag106 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag30 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag210 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag120 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag75 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag29 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag198 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag184 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag99 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag57 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag71 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag156 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag226 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag60 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag195 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag102 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag153 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag58 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag83 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag92 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag202 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag78 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag154 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag114 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag89 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag90 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag55 -..@flag23 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag182 -..@flag150 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_1 - PIXEL11 - PIXEL20_2 - PIXEL21_1 - jmp .loopx_end -..@flag213 -..@flag212 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag241 -..@flag240 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag236 -..@flag232 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag109 -..@flag105 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_2 - PIXEL11 - PIXEL12_1 - PIXEL22_1M - jmp .loopx_end -..@flag171 -..@flag43 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag143 -..@flag15 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag124 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag203 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag62 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag211 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag118 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag217 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag110 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag155 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag188 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag185 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag61 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag157 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag103 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag227 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag230 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag199 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag220 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag158 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag234 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1M - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1R - jmp .loopx_end -..@flag242 - PIXEL00_1M - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag59 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag121 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag87 - PIXEL00_1L - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_1 - PIXEL11 - PIXEL20_1M - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag79 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1R - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag122 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag94 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag218 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag91 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag229 - PIXEL00_2 - PIXEL01_1 - PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag167 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_2 - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag173 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag181 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag186 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag115 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag93 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag206 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag205 -..@flag201 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag174 -..@flag46 - DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag179 -..@flag147 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag117 -..@flag116 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 - jmp .loopx_end -..@flag189 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag231 - PIXEL00_1L - PIXEL01_C - PIXEL02_1R - PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1L - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag126 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag219 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 - PIXEL02_1M - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag125 - DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - PIXEL22_1M - jmp .loopx_end -..@flag221 - DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 - PIXEL00_1U - PIXEL01_1 - PIXEL10_C - PIXEL11 - PIXEL20_1M - jmp .loopx_end -..@flag207 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 - PIXEL11 - PIXEL12_1 - PIXEL20_1M - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag238 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 - PIXEL00_1M - PIXEL01_C - PIXEL02_1R - PIXEL11 - PIXEL12_1 - jmp .loopx_end -..@flag190 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 - PIXEL00_1M - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - jmp .loopx_end -..@flag187 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 - PIXEL02_1M - PIXEL11 - PIXEL12_C - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag243 - DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 - PIXEL00_1L - PIXEL01_C - PIXEL02_1M - PIXEL10_1 - PIXEL11 - jmp .loopx_end -..@flag119 - DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 - PIXEL10_1 - PIXEL11 - PIXEL20_1L - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag237 -..@flag233 - PIXEL00_1U - PIXEL01_1 - PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag175 -..@flag47 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - PIXEL20_1D - PIXEL21_1 - PIXEL22_2 - jmp .loopx_end -..@flag183 -..@flag151 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_2 - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag245 -..@flag244 - PIXEL00_2 - PIXEL01_1 - PIXEL02_1U - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag250 - PIXEL00_1M - PIXEL01_C - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag123 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag95 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - PIXEL20_1M - PIXEL21_C - PIXEL22_1M - jmp .loopx_end -..@flag222 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag252 - PIXEL00_1M - PIXEL01_1 - PIXEL02_1U - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag249 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1M - PIXEL10_C - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag235 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag111 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag63 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL10_C - PIXEL11 - PIXEL20_1D - PIXEL21_1 - PIXEL22_1M - jmp .loopx_end -..@flag159 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL11 - PIXEL12_C - PIXEL20_1M - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag215 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag246 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag254 - PIXEL00_1M - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 - DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 - jmp .loopx_end -..@flag253 - PIXEL00_1U - PIXEL01_1 - PIXEL02_1U - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag251 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 - PIXEL02_1M - PIXEL11 - DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 - DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 - jmp .loopx_end -..@flag239 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - PIXEL02_1R - PIXEL10_C - PIXEL11 - PIXEL12_1 - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - PIXEL22_1R - jmp .loopx_end -..@flag127 - DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 - DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 - PIXEL11 - DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 - PIXEL22_1M - jmp .loopx_end -..@flag191 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - PIXEL20_1D - PIXEL21_1 - PIXEL22_1D - jmp .loopx_end -..@flag223 - DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 - DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 - PIXEL11 - PIXEL20_1M - DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 - jmp .loopx_end -..@flag247 - PIXEL00_1L - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_1 - PIXEL11 - PIXEL12_C - PIXEL20_1L - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end -..@flag255 - DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 - PIXEL01_C - DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 - PIXEL10_C - PIXEL11 - PIXEL12_C - DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 - PIXEL21_C - DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 - jmp .loopx_end - -..@cross0 - mov ebx,[ebp+pitch] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross1 - mov ecx,[w2] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[ebp+pitch] - mov [edi],edx - mov [edi+4],edx - mov [edi+8],edx - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross2 - mov ecx,[w4] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[ebp+pitch] - mov [edi],edx - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],edx - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],eax - jmp .loopx_end -..@cross4 - mov ecx,[w6] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[ebp+pitch] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],edx - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],edx - mov [edi+ebx*2],eax - mov [edi+ebx*2+4],eax - mov [edi+ebx*2+8],edx - jmp .loopx_end -..@cross8 - mov ecx,[w8] - mov edx,eax - shl edx,2 - add edx,[ebx+ecx*4] - sub edx,eax - shr edx,2 - mov ebx,[ebp+pitch] - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx*2],edx - mov [edi+ebx*2+4],edx - mov [edi+ebx*2+8],edx - jmp .loopx_end -..@crossN - mov edx,[w2] - mov ecx,[ebx+edx*4] - mov [c2],ecx - mov edx,[w4] - mov ecx,[ebx+edx*4] - mov [c4],ecx - mov edx,[w6] - mov ecx,[ebx+edx*4] - mov [c6],ecx - mov edx,[w8] - mov ecx,[ebx+edx*4] - mov [c8],ecx - mov ebx,[ebp+pitch] - jmp ..@flag0 - -.loopx_end - add esi,2 - add edi,12 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl .xres_1 - mov ebx,[prevline] - movq mm5,[esi+ebx-4] - movq mm6,[esi-4] - mov ebx,[nextline] - movq mm7,[esi+ebx-4] - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl .nexty - ; x=Xres-1 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx-6] - movq mm6,[esi-6] - mov ebx,[nextline] - movq mm7,[esi+ebx-6] - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.nexty - add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset - shl ebx, 2 - sub edi, ebx - sub edi, ebx - sub edi, ebx - shr ebx, 1 - dec dword[linesleft] - jz .fin - add ebx, [ebp+offset]; - cmp dword[linesleft],1 - je .lastline - mov dword[nextline],ebx - neg ebx - mov dword[prevline],ebx - jmp .loopy -.lastline - mov dword[nextline],0 - neg ebx - mov dword[prevline],ebx - jmp .loopy -.fin - emms - popad - mov esp,ebp - pop ebp - ret - -SECTION .data -FuncTable - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - -FuncTable2 - dd ..@cross0, ..@cross1, ..@cross2, ..@crossN, - dd ..@cross4, ..@crossN, ..@crossN, ..@crossN, - dd ..@cross8, ..@crossN, ..@crossN, ..@crossN, - dd ..@crossN, ..@crossN, ..@crossN, ..@crossN - +;hq3x filter +;32bpp output +;---------------------------------------------------------- +;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) +; +;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. + +%include "macros.mac" + +EXTSYM LUT16to32,RGBtoYUV + +SECTION .bss +linesleft resd 1 +xcounter resd 1 +cross resd 1 +nextline resd 1 +prevline resd 1 +w1 resd 1 +w2 resd 1 +w3 resd 1 +w4 resd 1 +w5 resd 1 +w6 resd 1 +w7 resd 1 +w8 resd 1 +w9 resd 1 +c1 resd 1 +c2 resd 1 +c3 resd 1 +c4 resd 1 +c5 resd 1 +c6 resd 1 +c7 resd 1 +c8 resd 1 +c9 resd 1 + +SECTION .data + +reg_blank dd 0,0 +const7 dd 0x00070007,0x00000007 +threshold dd 0x00300706,0x00000000 + +SECTION .text + +%macro TestDiff 2 + xor ecx,ecx + mov edx,[%1] + cmp edx,[%2] + je %%fin + mov ecx,RGBtoYUV + movd mm1,[ecx+edx*4] + movq mm5,mm1 + mov edx,[%2] + movd mm2,[ecx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd ecx,mm1 +%%fin: +%endmacro + +%macro DiffOrNot 4 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + jmp %%fin +%%same: + %4 +%%fin +%endmacro + +%macro DiffOrNot 6 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + jmp %%fin +%%same: + %5 + %6 +%%fin +%endmacro + +%macro DiffOrNot 8 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + %5 + jmp %%fin +%%same: + %6 + %7 + %8 +%%fin +%endmacro + +%macro DiffOrNot 10 + TestDiff %1,%2 + test ecx,ecx + jz %%same + %3 + %4 + %5 + %6 + jmp %%fin +%%same: + %7 + %8 + %9 + %10 +%%fin +%endmacro + +%macro Interp1 3 + mov edx,%2 + shl edx,2 + add edx,%3 + sub edx,%2 + shr edx,2 + mov %1,edx +%endmacro + +%macro Interp2 4 + mov edx,%2 + shl edx,1 + add edx,%3 + add edx,%4 + shr edx,2 + mov %1,edx +%endmacro + +%macro Interp3 2 + movd mm1, eax + movd mm2, %2 + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const7] + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, [reg_blank] + movd %1, mm1 +%endmacro + +%macro Interp4 3 + movd mm1, eax + movd mm2, %2 + movd mm3, %3 + 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 %1, mm1 +%endmacro + +%macro Interp5 3 + mov edx,%2 + add edx,%3 + shr edx,1 + mov %1,edx +%endmacro + +%macro PIXEL00_1M 0 + Interp1 [edi],eax,[c1] +%endmacro + +%macro PIXEL00_1U 0 + Interp1 [edi],eax,[c2] +%endmacro + +%macro PIXEL00_1L 0 + Interp1 [edi],eax,[c4] +%endmacro + +%macro PIXEL00_2 0 + Interp2 [edi],eax,[c4],[c2] +%endmacro + +%macro PIXEL00_4 0 + Interp4 [edi],[c4],[c2] +%endmacro + +%macro PIXEL00_5 0 + Interp5 [edi],[c4],[c2] +%endmacro + +%macro PIXEL00_C 0 + mov [edi],eax +%endmacro + +%macro PIXEL01_1 0 + Interp1 [edi+4],eax,[c2] +%endmacro + +%macro PIXEL01_3 0 + Interp3 [edi+4],[c2] +%endmacro + +%macro PIXEL01_6 0 + Interp1 [edi+4],[c2],eax +%endmacro + +%macro PIXEL01_C 0 + mov [edi+4],eax +%endmacro + +%macro PIXEL02_1M 0 + Interp1 [edi+8],eax,[c3] +%endmacro + +%macro PIXEL02_1U 0 + Interp1 [edi+8],eax,[c2] +%endmacro + +%macro PIXEL02_1R 0 + Interp1 [edi+8],eax,[c6] +%endmacro + +%macro PIXEL02_2 0 + Interp2 [edi+8],eax,[c2],[c6] +%endmacro + +%macro PIXEL02_4 0 + Interp4 [edi+8],[c2],[c6] +%endmacro + +%macro PIXEL02_5 0 + Interp5 [edi+8],[c2],[c6] +%endmacro + +%macro PIXEL02_C 0 + mov [edi+8],eax +%endmacro + +%macro PIXEL10_1 0 + Interp1 [edi+ebx],eax,[c4] +%endmacro + +%macro PIXEL10_3 0 + Interp3 [edi+ebx],[c4] +%endmacro + +%macro PIXEL10_6 0 + Interp1 [edi+ebx],[c4],eax +%endmacro + +%macro PIXEL10_C 0 + mov [edi+ebx],eax +%endmacro + +%macro PIXEL11 0 + mov [edi+ebx+4],eax +%endmacro + +%macro PIXEL12_1 0 + Interp1 [edi+ebx+8],eax,[c6] +%endmacro + +%macro PIXEL12_3 0 + Interp3 [edi+ebx+8],[c6] +%endmacro + +%macro PIXEL12_6 0 + Interp1 [edi+ebx+8],[c6],eax +%endmacro + +%macro PIXEL12_C 0 + mov [edi+ebx+8],eax +%endmacro + +%macro PIXEL20_1M 0 + Interp1 [edi+ebx*2],eax,[c7] +%endmacro + +%macro PIXEL20_1D 0 + Interp1 [edi+ebx*2],eax,[c8] +%endmacro + +%macro PIXEL20_1L 0 + Interp1 [edi+ebx*2],eax,[c4] +%endmacro + +%macro PIXEL20_2 0 + Interp2 [edi+ebx*2],eax,[c8],[c4] +%endmacro + +%macro PIXEL20_4 0 + Interp4 [edi+ebx*2],[c8],[c4] +%endmacro + +%macro PIXEL20_5 0 + Interp5 [edi+ebx*2],[c8],[c4] +%endmacro + +%macro PIXEL20_C 0 + mov [edi+ebx*2],eax +%endmacro + +%macro PIXEL21_1 0 + Interp1 [edi+ebx*2+4],eax,[c8] +%endmacro + +%macro PIXEL21_3 0 + Interp3 [edi+ebx*2+4],[c8] +%endmacro + +%macro PIXEL21_6 0 + Interp1 [edi+ebx*2+4],[c8],eax +%endmacro + +%macro PIXEL21_C 0 + mov [edi+ebx*2+4],eax +%endmacro + +%macro PIXEL22_1M 0 + Interp1 [edi+ebx*2+8],eax,[c9] +%endmacro + +%macro PIXEL22_1D 0 + Interp1 [edi+ebx*2+8],eax,[c8] +%endmacro + +%macro PIXEL22_1R 0 + Interp1 [edi+ebx*2+8],eax,[c6] +%endmacro + +%macro PIXEL22_2 0 + Interp2 [edi+ebx*2+8],eax,[c6],[c8] +%endmacro + +%macro PIXEL22_4 0 + Interp4 [edi+ebx*2+8],[c6],[c8] +%endmacro + +%macro PIXEL22_5 0 + Interp5 [edi+ebx*2+8],[c6],[c8] +%endmacro + +%macro PIXEL22_C 0 + mov [edi+ebx*2+8],eax +%endmacro + +inbuffer equ 8 +outbuffer equ 12 +Xres equ 16 +Yres equ 20 +pitch equ 24 +offset equ 28 + +NEWSYM hq3x_32 + push ebp + mov ebp,esp + pushad + + mov esi,[ebp+inbuffer] + mov edi,[ebp+outbuffer] + mov edx,[ebp+Yres] + mov [linesleft],edx + mov ebx,[ebp+Xres] + shl ebx,1 + mov dword[prevline],0 + mov dword[nextline],ebx +.loopy + mov ecx,[ebp+Xres] + sub ecx,2 ; x={Xres-2, Xres-1} are special cases. + mov dword[xcounter],ecx + ; x=0 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx] + movq mm6,[esi] + mov ebx,[nextline] + movq mm7,[esi+ebx] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + mov [w2],edx + shr eax,16 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + mov [w5],edx + shr eax,16 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + mov [w8],edx + shr eax,16 + mov [w9],eax + jmp .flags +.loopx + mov ebx,[prevline] + movq mm5,[esi+ebx-2] + movq mm6,[esi-2] + mov ebx,[nextline] + movq mm7,[esi+ebx-2] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + movzx edx,ax + mov [w3],edx + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + movzx edx,ax + mov [w6],edx + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + movzx edx,ax + mov [w9],edx +.flags + mov ebx,RGBtoYUV + mov eax,[w5] + xor ecx,ecx + movd mm5,[ebx+eax*4] + mov dword[cross],0 + + mov edx,[w2] + cmp eax,edx + je .noflag2 + or dword[cross],1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag2 + or ecx,2 +.noflag2 + mov edx,[w4] + cmp eax,edx + je .noflag4 + or dword[cross],2 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag4 + or ecx,8 +.noflag4 + mov edx,[w6] + cmp eax,edx + je .noflag6 + or dword[cross],4 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag6 + or ecx,16 +.noflag6 + mov edx,[w8] + cmp eax,edx + je .noflag8 + or dword[cross],8 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag8 + or ecx,64 +.noflag8 + test ecx,ecx + jnz .testflag1 + mov ecx,[cross] + mov ebx,LUT16to32 + mov eax,[ebx+eax*4] + jmp [FuncTable2+ecx*4] +.testflag1 + mov edx,[w1] + cmp eax,edx + je .noflag1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag1 + or ecx,1 +.noflag1 + mov edx,[w3] + cmp eax,edx + je .noflag3 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag3 + or ecx,4 +.noflag3 + mov edx,[w7] + cmp eax,edx + je .noflag7 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag7 + or ecx,32 +.noflag7 + mov edx,[w9] + cmp eax,edx + je .noflag9 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag9 + or ecx,128 +.noflag9 + mov ebx,LUT16to32 + mov eax,[ebx+eax*4] + mov edx,[w2] + mov edx,[ebx+edx*4] + mov [c2],edx + mov edx,[w4] + mov edx,[ebx+edx*4] + mov [c4],edx + mov edx,[w6] + mov edx,[ebx+edx*4] + mov [c6],edx + mov edx,[w8] + mov edx,[ebx+edx*4] + mov [c8],edx + test ecx,0x005A + jz .switch + mov edx,[w1] + mov edx,[ebx+edx*4] + mov [c1],edx + mov edx,[w3] + mov edx,[ebx+edx*4] + mov [c3],edx + mov edx,[w7] + mov edx,[ebx+edx*4] + mov [c7],edx + mov edx,[w9] + mov edx,[ebx+edx*4] + mov [c9],edx +.switch + mov ebx,[ebp+pitch] + jmp [FuncTable+ecx*4] + +..@flag0 +..@flag1 +..@flag4 +..@flag32 +..@flag128 +..@flag5 +..@flag132 +..@flag160 +..@flag33 +..@flag129 +..@flag36 +..@flag133 +..@flag164 +..@flag161 +..@flag37 +..@flag165 +; PIXEL00_2 +; PIXEL01_1 +; PIXEL02_2 +; PIXEL10_1 +; PIXEL11 +; PIXEL12_1 +; PIXEL20_2 +; PIXEL21_1 +; PIXEL22_2 + +; the same, only optimized + mov ecx,eax + shl ecx,1 + add ecx,[c2] + mov edx,ecx + add edx,[c4] + shr edx,2 + mov [edi],edx + mov edx,ecx + add edx,eax + shr edx,2 + mov [edi+4],edx + add ecx,[c6] + shr ecx,2 + mov [edi+8],ecx + mov ecx,eax + shl ecx,2 + sub ecx,eax + mov edx,ecx + add edx,[c4] + shr edx,2 + mov [edi+ebx],edx + mov [edi+ebx+4],eax + add ecx,[c6] + shr ecx,2 + mov [edi+ebx+8],ecx + mov ecx,eax + shl ecx,1 + add ecx,[c8] + mov edx,ecx + add edx,[c4] + shr edx,2 + mov [edi+ebx*2],edx + mov edx,ecx + add edx,eax + shr edx,2 + mov [edi+ebx*2+4],edx + add ecx,[c6] + shr ecx,2 + mov [edi+ebx*2+8],ecx + jmp .loopx_end +..@flag2 +..@flag34 +..@flag130 +..@flag162 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag16 +..@flag17 +..@flag48 +..@flag49 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag64 +..@flag65 +..@flag68 +..@flag69 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag8 +..@flag12 +..@flag136 +..@flag140 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag3 +..@flag35 +..@flag131 +..@flag163 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag6 +..@flag38 +..@flag134 +..@flag166 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag20 +..@flag21 +..@flag52 +..@flag53 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag144 +..@flag145 +..@flag176 +..@flag177 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag192 +..@flag193 +..@flag196 +..@flag197 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag96 +..@flag97 +..@flag100 +..@flag101 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag40 +..@flag44 +..@flag168 +..@flag172 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag9 +..@flag13 +..@flag137 +..@flag141 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag18 +..@flag50 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag80 +..@flag81 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag72 +..@flag76 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag10 +..@flag138 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag66 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag24 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag7 +..@flag39 +..@flag135 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag148 +..@flag149 +..@flag180 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag224 +..@flag228 +..@flag225 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag41 +..@flag169 +..@flag45 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag22 +..@flag54 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag208 +..@flag209 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag104 +..@flag108 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag11 +..@flag139 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag19 +..@flag51 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag146 +..@flag178 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_1M,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + jmp .loopx_end +..@flag84 +..@flag85 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_1M,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag112 +..@flag113 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_1M,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag200 +..@flag204 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag73 +..@flag77 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_1M,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + jmp .loopx_end +..@flag42 +..@flag170 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag14 +..@flag142 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag67 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag70 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag28 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag152 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag194 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag98 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag56 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag25 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag26 +..@flag31 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag82 +..@flag214 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag88 +..@flag248 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag74 +..@flag107 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag27 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag86 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag216 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag106 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag30 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag210 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag120 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag75 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag29 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag198 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag184 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag99 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag57 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag71 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag156 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag226 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag60 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag195 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag102 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag153 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag58 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag83 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag92 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag202 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag78 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag154 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag114 + PIXEL00_1M + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag89 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag90 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag55 +..@flag23 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag182 +..@flag150 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + jmp .loopx_end +..@flag213 +..@flag212 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag241 +..@flag240 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag236 +..@flag232 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag109 +..@flag105 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + jmp .loopx_end +..@flag171 +..@flag43 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag143 +..@flag15 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag124 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag203 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag62 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag211 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag118 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag217 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag110 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag155 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag188 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag185 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag61 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag157 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag103 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag227 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag230 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag199 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag220 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag158 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag234 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1R + jmp .loopx_end +..@flag242 + PIXEL00_1M + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag59 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag121 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag87 + PIXEL00_1L + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag79 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1R + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag122 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag94 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag218 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag91 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag229 + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag167 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag173 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag181 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag186 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag115 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag93 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag206 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag205 +..@flag201 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_1M,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag174 +..@flag46 + DiffOrNot w4,w2,PIXEL00_1M,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag179 +..@flag147 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_1M,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag117 +..@flag116 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_1M,PIXEL22_2 + jmp .loopx_end +..@flag189 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag231 + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag126 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_4,PIXEL12_3 + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag219 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_4,PIXEL01_3,PIXEL10_3 + PIXEL02_1M + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag125 + DiffOrNot w8,w4,PIXEL00_1U,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL00_2,PIXEL10_6,PIXEL20_5,PIXEL21_1 + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + PIXEL22_1M + jmp .loopx_end +..@flag221 + DiffOrNot w6,w8,PIXEL02_1U,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL02_2,PIXEL12_6,PIXEL21_1,PIXEL22_5 + PIXEL00_1U + PIXEL01_1 + PIXEL10_C + PIXEL11 + PIXEL20_1M + jmp .loopx_end +..@flag207 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL02_1R,PIXEL10_C,PIXEL00_5,PIXEL01_6,PIXEL02_2,PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag238 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL22_1R,PIXEL10_1,PIXEL20_5,PIXEL21_6,PIXEL22_2 + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + jmp .loopx_end +..@flag190 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL22_1D,PIXEL01_1,PIXEL02_5,PIXEL12_6,PIXEL22_2 + PIXEL00_1M + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + jmp .loopx_end +..@flag187 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL20_1D,PIXEL00_5,PIXEL01_1,PIXEL10_6,PIXEL20_2 + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag243 + DiffOrNot w6,w8,PIXEL12_C,PIXEL20_1L,PIXEL21_C,PIXEL22_C,PIXEL12_1,PIXEL20_2,PIXEL21_6,PIXEL22_5 + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + jmp .loopx_end +..@flag119 + DiffOrNot w2,w6,PIXEL00_1L,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL00_2,PIXEL01_6,PIXEL02_5,PIXEL12_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag237 +..@flag233 + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag175 +..@flag47 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + jmp .loopx_end +..@flag183 +..@flag151 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag245 +..@flag244 + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag250 + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag123 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag95 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + jmp .loopx_end +..@flag222 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag252 + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag249 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag235 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag111 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag63 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + jmp .loopx_end +..@flag159 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag215 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag246 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag254 + PIXEL00_1M + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL01_3,PIXEL02_4 + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL10_3,PIXEL20_4 + DiffOrNot w6,w8,PIXEL12_C,PIXEL21_C,PIXEL22_C,PIXEL12_3,PIXEL21_3,PIXEL22_2 + jmp .loopx_end +..@flag253 + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag251 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL00_4,PIXEL01_3 + PIXEL02_1M + PIXEL11 + DiffOrNot w8,w4,PIXEL10_C,PIXEL20_C,PIXEL21_C,PIXEL10_3,PIXEL20_2,PIXEL21_3 + DiffOrNot w6,w8,PIXEL12_C,PIXEL22_C,PIXEL12_3,PIXEL22_4 + jmp .loopx_end +..@flag239 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + PIXEL22_1R + jmp .loopx_end +..@flag127 + DiffOrNot w4,w2,PIXEL00_C,PIXEL01_C,PIXEL10_C,PIXEL00_2,PIXEL01_3,PIXEL10_3 + DiffOrNot w2,w6,PIXEL02_C,PIXEL12_C,PIXEL02_4,PIXEL12_3 + PIXEL11 + DiffOrNot w8,w4,PIXEL20_C,PIXEL21_C,PIXEL20_4,PIXEL21_3 + PIXEL22_1M + jmp .loopx_end +..@flag191 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + jmp .loopx_end +..@flag223 + DiffOrNot w4,w2,PIXEL00_C,PIXEL10_C,PIXEL00_4,PIXEL10_3 + DiffOrNot w2,w6,PIXEL01_C,PIXEL02_C,PIXEL12_C,PIXEL01_3,PIXEL02_2,PIXEL12_3 + PIXEL11 + PIXEL20_1M + DiffOrNot w6,w8,PIXEL21_C,PIXEL22_C,PIXEL21_3,PIXEL22_4 + jmp .loopx_end +..@flag247 + PIXEL00_1L + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end +..@flag255 + DiffOrNot w4,w2,PIXEL00_C,PIXEL00_2 + PIXEL01_C + DiffOrNot w2,w6,PIXEL02_C,PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_C + DiffOrNot w8,w4,PIXEL20_C,PIXEL20_2 + PIXEL21_C + DiffOrNot w6,w8,PIXEL22_C,PIXEL22_2 + jmp .loopx_end + +..@cross0 + mov ebx,[ebp+pitch] + mov [edi],eax + mov [edi+4],eax + mov [edi+8],eax + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [edi+ebx+8],eax + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],eax + mov [edi+ebx*2+8],eax + jmp .loopx_end +..@cross1 + mov ecx,[w2] + mov edx,eax + shl edx,2 + add edx,[ebx+ecx*4] + sub edx,eax + shr edx,2 + mov ebx,[ebp+pitch] + mov [edi],edx + mov [edi+4],edx + mov [edi+8],edx + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [edi+ebx+8],eax + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],eax + mov [edi+ebx*2+8],eax + jmp .loopx_end +..@cross2 + mov ecx,[w4] + mov edx,eax + shl edx,2 + add edx,[ebx+ecx*4] + sub edx,eax + shr edx,2 + mov ebx,[ebp+pitch] + mov [edi],edx + mov [edi+4],eax + mov [edi+8],eax + mov [edi+ebx],edx + mov [edi+ebx+4],eax + mov [edi+ebx+8],eax + mov [edi+ebx*2],edx + mov [edi+ebx*2+4],eax + mov [edi+ebx*2+8],eax + jmp .loopx_end +..@cross4 + mov ecx,[w6] + mov edx,eax + shl edx,2 + add edx,[ebx+ecx*4] + sub edx,eax + shr edx,2 + mov ebx,[ebp+pitch] + mov [edi],eax + mov [edi+4],eax + mov [edi+8],edx + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [edi+ebx+8],edx + mov [edi+ebx*2],eax + mov [edi+ebx*2+4],eax + mov [edi+ebx*2+8],edx + jmp .loopx_end +..@cross8 + mov ecx,[w8] + mov edx,eax + shl edx,2 + add edx,[ebx+ecx*4] + sub edx,eax + shr edx,2 + mov ebx,[ebp+pitch] + mov [edi],eax + mov [edi+4],eax + mov [edi+8],eax + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [edi+ebx+8],eax + mov [edi+ebx*2],edx + mov [edi+ebx*2+4],edx + mov [edi+ebx*2+8],edx + jmp .loopx_end +..@crossN + mov edx,[w2] + mov ecx,[ebx+edx*4] + mov [c2],ecx + mov edx,[w4] + mov ecx,[ebx+edx*4] + mov [c4],ecx + mov edx,[w6] + mov ecx,[ebx+edx*4] + mov [c6],ecx + mov edx,[w8] + mov ecx,[ebx+edx*4] + mov [c8],ecx + mov ebx,[ebp+pitch] + jmp ..@flag0 + +.loopx_end + add esi,2 + add edi,12 + dec dword[xcounter] + jle .xres_2 + jmp .loopx +.xres_2 + ; x=Xres-2 - special case + jl .xres_1 + mov ebx,[prevline] + movq mm5,[esi+ebx-4] + movq mm6,[esi-4] + mov ebx,[nextline] + movq mm7,[esi+ebx-4] + psrlq mm5,16 + psrlq mm6,16 + psrlq mm7,16 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + mov [w9],eax + jmp .flags +.xres_1 + cmp dword[xcounter],-1 + jl .nexty + ; x=Xres-1 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx-6] + movq mm6,[esi-6] + mov ebx,[nextline] + movq mm7,[esi+ebx-6] + psrlq mm5,32 + psrlq mm6,32 + psrlq mm7,32 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + mov [w9],eax + jmp .flags +.nexty + add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks + add edi,ebx + add edi,ebx + add edi,ebx + mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset + shl ebx, 2 + sub edi, ebx + sub edi, ebx + sub edi, ebx + shr ebx, 1 + dec dword[linesleft] + jz .fin + add ebx, [ebp+offset]; + cmp dword[linesleft],1 + je .lastline + mov dword[nextline],ebx + neg ebx + mov dword[prevline],ebx + jmp .loopy +.lastline + mov dword[nextline],0 + neg ebx + mov dword[prevline],ebx + jmp .loopy +.fin + emms + popad + mov esp,ebp + pop ebp + ret + +SECTION .data +FuncTable + dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 + dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 + dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 + dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 + dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 + dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 + dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 + dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 + dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 + dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 + dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 + dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 + dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 + dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 + dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 + dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 + dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 + dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 + dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 + dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 + dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 + dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 + dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 + dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 + dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 + dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 + dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 + dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 + dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 + dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 + dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 + dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 + +FuncTable2 + dd ..@cross0, ..@cross1, ..@cross2, ..@crossN, + dd ..@cross4, ..@crossN, ..@crossN, ..@crossN, + dd ..@cross8, ..@crossN, ..@crossN, ..@crossN, + dd ..@crossN, ..@crossN, ..@crossN, ..@crossN + diff --git a/src/hq4x_16.asm b/src/hq4x_16.asm index 35cfb2c8..14f49049 100644 --- a/src/hq4x_16.asm +++ b/src/hq4x_16.asm @@ -1,3957 +1,3957 @@ -;hq4x filter -;16bpp output -;---------------------------------------------------------- -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -; -;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. - -%include "macros.mac" - -EXTSYM LUT16to32,RGBtoYUV - -SECTION .bss -linesleft resd 1 -xcounter resd 1 -cross resd 1 -nextline resd 1 -prevline resd 1 -w1 resd 1 -w2 resd 1 -w3 resd 1 -w4 resd 1 -w5 resd 1 -w6 resd 1 -w7 resd 1 -w8 resd 1 -w9 resd 1 - -SECTION .data - -reg_blank dd 0,0 -const3 dd 0x00030003,0x00000003 -const5 dd 0x00050005,0x00000005 -const6 dd 0x00060006,0x00000006 -const7 dd 0x00070007,0x00000007 -threshold dd 0x00300706,0x00000000 -zerolowbits dd 0xF7DEF7DE - -SECTION .text - -%macro AUXADDRESS 0 - mov ecx, edi - add ecx, ebx - add ecx, ebx -%endmacro - -%macro TestDiff 2 - mov edx,[%1] - sub edx,[%2] - jz %%fin - mov edx,[%1] - shl edx,2 - add edx,RGBtoYUV - movd mm1,[edx] - movq mm5,mm1 - mov edx,[%2] - shl edx,2 - add edx,RGBtoYUV - movd mm2,[edx] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro DiffOrNot 14 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - %6 - %7 - %8 - jmp %%fin -%%same: - %9 - %10 - %11 - %12 - %13 - %14 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - mov eax,%3 - cmp edx,eax - je %%fin - and edx,[zerolowbits] - and eax,[zerolowbits] - add eax,edx - shr eax,1 - add eax,0x0821 - and eax,[zerolowbits] - add edx,eax - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp2 4 - mov edx,%3 - mov eax,%4 - cmp edx,eax - je %%fin1 - and edx,[zerolowbits] - and eax,[zerolowbits] - add eax,edx - shr eax,1 - add eax,0x0821 -%%fin1 - mov edx,%2 - cmp edx,eax - je %%fin2 - and eax,[zerolowbits] - and edx,[zerolowbits] - add edx,eax - shr edx,1 -%%fin2 - mov %1,dx -%endmacro - -%macro Interp3 3 - mov eax, LUT16to32 - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp5 3 - mov edx,%2 - mov eax,%3 - cmp edx,eax - je %%fin - and edx,[zerolowbits] - and eax,[zerolowbits] - add edx,eax - shr edx,1 -%%fin - mov %1,dx -%endmacro - -%macro Interp6 4 - mov eax, LUT16to32 - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - mov edx, %4 - movd mm3, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp7 4 - mov eax, LUT16to32 - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - mov edx, %4 - movd mm3, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro Interp8 3 - mov eax, LUT16to32 - mov edx, %2 - movd mm1, [eax+edx*4] - mov edx, %3 - movd mm2, [eax+edx*4] - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const5] - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 5 - packuswb mm1, [reg_blank] - movd edx, mm1 - shl dl, 2 - shr edx, 1 - shl dx, 3 - shr edx, 5 - mov %1, dx -%endmacro - -%macro PIXEL00_0 0 - mov eax,[w5] - mov [edi],ax -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],[w5],[w4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],[w5],[w2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],[w5],[w2],[w4] -%endmacro - -%macro PIXEL00_50 0 - Interp5 [edi],[w2],[w4] -%endmacro - -%macro PIXEL00_80 0 - Interp8 [edi],[w5],[w1] -%endmacro - -%macro PIXEL00_81 0 - Interp8 [edi],[w5],[w4] -%endmacro - -%macro PIXEL00_82 0 - Interp8 [edi],[w5],[w2] -%endmacro - -%macro PIXEL01_0 0 - mov eax,[w5] - mov [edi+2],ax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+2],[w5],[w1] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+2],[w5],[w2] -%endmacro - -%macro PIXEL01_14 0 - Interp1 [edi+2],[w2],[w5] -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+2],[w2],[w5],[w4] -%endmacro - -%macro PIXEL01_31 0 - Interp3 [edi+2],[w5],[w4] -%endmacro - -%macro PIXEL01_50 0 - Interp5 [edi+2],[w2],[w5] -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+2],[w5],[w2],[w4] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+2],[w5],[w2],[w1] -%endmacro - -%macro PIXEL01_82 0 - Interp8 [edi+2],[w5],[w2] -%endmacro - -%macro PIXEL01_83 0 - Interp8 [edi+2],[w2],[w4] -%endmacro - -%macro PIXEL02_0 0 - mov eax,[w5] - mov [edi+4],ax -%endmacro - -%macro PIXEL02_10 0 - Interp1 [edi+4],[w5],[w3] -%endmacro - -%macro PIXEL02_11 0 - Interp1 [edi+4],[w5],[w2] -%endmacro - -%macro PIXEL02_13 0 - Interp1 [edi+4],[w2],[w5] -%endmacro - -%macro PIXEL02_21 0 - Interp2 [edi+4],[w2],[w5],[w6] -%endmacro - -%macro PIXEL02_32 0 - Interp3 [edi+4],[w5],[w6] -%endmacro - -%macro PIXEL02_50 0 - Interp5 [edi+4],[w2],[w5] -%endmacro - -%macro PIXEL02_60 0 - Interp6 [edi+4],[w5],[w2],[w6] -%endmacro - -%macro PIXEL02_61 0 - Interp6 [edi+4],[w5],[w2],[w3] -%endmacro - -%macro PIXEL02_81 0 - Interp8 [edi+4],[w5],[w2] -%endmacro - -%macro PIXEL02_83 0 - Interp8 [edi+4],[w2],[w6] -%endmacro - -%macro PIXEL03_0 0 - mov eax,[w5] - mov [edi+6],ax -%endmacro - -%macro PIXEL03_11 0 - Interp1 [edi+6],[w5],[w2] -%endmacro - -%macro PIXEL03_12 0 - Interp1 [edi+6],[w5],[w6] -%endmacro - -%macro PIXEL03_20 0 - Interp2 [edi+6],[w5],[w2],[w6] -%endmacro - -%macro PIXEL03_50 0 - Interp5 [edi+6],[w2],[w6] -%endmacro - -%macro PIXEL03_80 0 - Interp8 [edi+6],[w5],[w3] -%endmacro - -%macro PIXEL03_81 0 - Interp8 [edi+6],[w5],[w2] -%endmacro - -%macro PIXEL03_82 0 - Interp8 [edi+6],[w5],[w6] -%endmacro - -%macro PIXEL10_0 0 - mov eax,[w5] - mov [edi+ebx],ax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],[w5],[w1] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],[w5],[w4] -%endmacro - -%macro PIXEL10_13 0 - Interp1 [edi+ebx],[w4],[w5] -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],[w4],[w5],[w2] -%endmacro - -%macro PIXEL10_32 0 - Interp3 [edi+ebx],[w5],[w2] -%endmacro - -%macro PIXEL10_50 0 - Interp5 [edi+ebx],[w4],[w5] -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[w5],[w4],[w2] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[w5],[w4],[w1] -%endmacro - -%macro PIXEL10_81 0 - Interp8 [edi+ebx],[w5],[w4] -%endmacro - -%macro PIXEL10_83 0 - Interp8 [edi+ebx],[w4],[w2] -%endmacro - -%macro PIXEL11_0 0 - mov eax,[w5] - mov [edi+ebx+2],ax -%endmacro - -%macro PIXEL11_30 0 - Interp3 [edi+ebx+2],[w5],[w1] -%endmacro - -%macro PIXEL11_31 0 - Interp3 [edi+ebx+2],[w5],[w4] -%endmacro - -%macro PIXEL11_32 0 - Interp3 [edi+ebx+2],[w5],[w2] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+2],[w5],[w4],[w2] -%endmacro - -%macro PIXEL12_0 0 - mov eax,[w5] - mov [edi+ebx+4],ax -%endmacro - -%macro PIXEL12_30 0 - Interp3 [edi+ebx+4],[w5],[w3] -%endmacro - -%macro PIXEL12_31 0 - Interp3 [edi+ebx+4],[w5],[w2] -%endmacro - -%macro PIXEL12_32 0 - Interp3 [edi+ebx+4],[w5],[w6] -%endmacro - -%macro PIXEL12_70 0 - Interp7 [edi+ebx+4],[w5],[w6],[w2] -%endmacro - -%macro PIXEL13_0 0 - mov eax,[w5] - mov [edi+ebx+6],ax -%endmacro - -%macro PIXEL13_10 0 - Interp1 [edi+ebx+6],[w5],[w3] -%endmacro - -%macro PIXEL13_12 0 - Interp1 [edi+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL13_14 0 - Interp1 [edi+ebx+6],[w6],[w5] -%endmacro - -%macro PIXEL13_21 0 - Interp2 [edi+ebx+6],[w6],[w5],[w2] -%endmacro - -%macro PIXEL13_31 0 - Interp3 [edi+ebx+6],[w5],[w2] -%endmacro - -%macro PIXEL13_50 0 - Interp5 [edi+ebx+6],[w6],[w5] -%endmacro - -%macro PIXEL13_60 0 - Interp6 [edi+ebx+6],[w5],[w6],[w2] -%endmacro - -%macro PIXEL13_61 0 - Interp6 [edi+ebx+6],[w5],[w6],[w3] -%endmacro - -%macro PIXEL13_82 0 - Interp8 [edi+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL13_83 0 - Interp8 [edi+ebx+6],[w6],[w2] -%endmacro - -%macro PIXEL20_0 0 - mov eax,[w5] - mov [ecx],ax -%endmacro - -%macro PIXEL20_10 0 - Interp1 [ecx],[w5],[w7] -%endmacro - -%macro PIXEL20_12 0 - Interp1 [ecx],[w5],[w4] -%endmacro - -%macro PIXEL20_14 0 - Interp1 [ecx],[w4],[w5] -%endmacro - -%macro PIXEL20_21 0 - Interp2 [ecx],[w4],[w5],[w8] -%endmacro - -%macro PIXEL20_31 0 - Interp3 [ecx],[w5],[w8] -%endmacro - -%macro PIXEL20_50 0 - Interp5 [ecx],[w4],[w5] -%endmacro - -%macro PIXEL20_60 0 - Interp6 [ecx],[w5],[w4],[w8] -%endmacro - -%macro PIXEL20_61 0 - Interp6 [ecx],[w5],[w4],[w7] -%endmacro - -%macro PIXEL20_82 0 - Interp8 [ecx],[w5],[w4] -%endmacro - -%macro PIXEL20_83 0 - Interp8 [ecx],[w4],[w8] -%endmacro - -%macro PIXEL21_0 0 - mov eax,[w5] - mov [ecx+2],ax -%endmacro - -%macro PIXEL21_30 0 - Interp3 [ecx+2],[w5],[w7] -%endmacro - -%macro PIXEL21_31 0 - Interp3 [ecx+2],[w5],[w8] -%endmacro - -%macro PIXEL21_32 0 - Interp3 [ecx+2],[w5],[w4] -%endmacro - -%macro PIXEL21_70 0 - Interp7 [ecx+2],[w5],[w4],[w8] -%endmacro - -%macro PIXEL22_0 0 - mov eax,[w5] - mov [ecx+4],ax -%endmacro - -%macro PIXEL22_30 0 - Interp3 [ecx+4],[w5],[w9] -%endmacro - -%macro PIXEL22_31 0 - Interp3 [ecx+4],[w5],[w6] -%endmacro - -%macro PIXEL22_32 0 - Interp3 [ecx+4],[w5],[w8] -%endmacro - -%macro PIXEL22_70 0 - Interp7 [ecx+4],[w5],[w6],[w8] -%endmacro - -%macro PIXEL23_0 0 - mov eax,[w5] - mov [ecx+6],ax -%endmacro - -%macro PIXEL23_10 0 - Interp1 [ecx+6],[w5],[w9] -%endmacro - -%macro PIXEL23_11 0 - Interp1 [ecx+6],[w5],[w6] -%endmacro - -%macro PIXEL23_13 0 - Interp1 [ecx+6],[w6],[w5] -%endmacro - -%macro PIXEL23_21 0 - Interp2 [ecx+6],[w6],[w5],[w8] -%endmacro - -%macro PIXEL23_32 0 - Interp3 [ecx+6],[w5],[w8] -%endmacro - -%macro PIXEL23_50 0 - Interp5 [ecx+6],[w6],[w5] -%endmacro - -%macro PIXEL23_60 0 - Interp6 [ecx+6],[w5],[w6],[w8] -%endmacro - -%macro PIXEL23_61 0 - Interp6 [ecx+6],[w5],[w6],[w9] -%endmacro - -%macro PIXEL23_81 0 - Interp8 [ecx+6],[w5],[w6] -%endmacro - -%macro PIXEL23_83 0 - Interp8 [ecx+6],[w6],[w8] -%endmacro - -%macro PIXEL30_0 0 - mov eax,[w5] - mov [ecx+ebx],ax -%endmacro - -%macro PIXEL30_11 0 - Interp1 [ecx+ebx],[w5],[w8] -%endmacro - -%macro PIXEL30_12 0 - Interp1 [ecx+ebx],[w5],[w4] -%endmacro - -%macro PIXEL30_20 0 - Interp2 [ecx+ebx],[w5],[w8],[w4] -%endmacro - -%macro PIXEL30_50 0 - Interp5 [ecx+ebx],[w8],[w4] -%endmacro - -%macro PIXEL30_80 0 - Interp8 [ecx+ebx],[w5],[w7] -%endmacro - -%macro PIXEL30_81 0 - Interp8 [ecx+ebx],[w5],[w8] -%endmacro - -%macro PIXEL30_82 0 - Interp8 [ecx+ebx],[w5],[w4] -%endmacro - -%macro PIXEL31_0 0 - mov eax,[w5] - mov [ecx+ebx+2],ax -%endmacro - -%macro PIXEL31_10 0 - Interp1 [ecx+ebx+2],[w5],[w7] -%endmacro - -%macro PIXEL31_11 0 - Interp1 [ecx+ebx+2],[w5],[w8] -%endmacro - -%macro PIXEL31_13 0 - Interp1 [ecx+ebx+2],[w8],[w5] -%endmacro - -%macro PIXEL31_21 0 - Interp2 [ecx+ebx+2],[w8],[w5],[w4] -%endmacro - -%macro PIXEL31_32 0 - Interp3 [ecx+ebx+2],[w5],[w4] -%endmacro - -%macro PIXEL31_50 0 - Interp5 [ecx+ebx+2],[w8],[w5] -%endmacro - -%macro PIXEL31_60 0 - Interp6 [ecx+ebx+2],[w5],[w8],[w4] -%endmacro - -%macro PIXEL31_61 0 - Interp6 [ecx+ebx+2],[w5],[w8],[w7] -%endmacro - -%macro PIXEL31_81 0 - Interp8 [ecx+ebx+2],[w5],[w8] -%endmacro - -%macro PIXEL31_83 0 - Interp8 [ecx+ebx+2],[w8],[w4] -%endmacro - -%macro PIXEL32_0 0 - mov eax,[w5] - mov [ecx+ebx+4],ax -%endmacro - -%macro PIXEL32_10 0 - Interp1 [ecx+ebx+4],[w5],[w9] -%endmacro - -%macro PIXEL32_12 0 - Interp1 [ecx+ebx+4],[w5],[w8] -%endmacro - -%macro PIXEL32_14 0 - Interp1 [ecx+ebx+4],[w8],[w5] -%endmacro - -%macro PIXEL32_21 0 - Interp2 [ecx+ebx+4],[w8],[w5],[w6] -%endmacro - -%macro PIXEL32_31 0 - Interp3 [ecx+ebx+4],[w5],[w6] -%endmacro - -%macro PIXEL32_50 0 - Interp5 [ecx+ebx+4],[w8],[w5] -%endmacro - -%macro PIXEL32_60 0 - Interp6 [ecx+ebx+4],[w5],[w8],[w6] -%endmacro - -%macro PIXEL32_61 0 - Interp6 [ecx+ebx+4],[w5],[w8],[w9] -%endmacro - -%macro PIXEL32_82 0 - Interp8 [ecx+ebx+4],[w5],[w8] -%endmacro - -%macro PIXEL32_83 0 - Interp8 [ecx+ebx+4],[w8],[w6] -%endmacro - -%macro PIXEL33_0 0 - mov eax,[w5] - mov [ecx+ebx+6],ax -%endmacro - -%macro PIXEL33_11 0 - Interp1 [ecx+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL33_12 0 - Interp1 [ecx+ebx+6],[w5],[w8] -%endmacro - -%macro PIXEL33_20 0 - Interp2 [ecx+ebx+6],[w5],[w8],[w6] -%endmacro - -%macro PIXEL33_50 0 - Interp5 [ecx+ebx+6],[w8],[w6] -%endmacro - -%macro PIXEL33_80 0 - Interp8 [ecx+ebx+6],[w5],[w9] -%endmacro - -%macro PIXEL33_81 0 - Interp8 [ecx+ebx+6],[w5],[w6] -%endmacro - -%macro PIXEL33_82 0 - Interp8 [ecx+ebx+6],[w5],[w8] -%endmacro - -inbuffer equ 8 -outbuffer equ 12 -Xres equ 16 -Yres equ 20 -pitch equ 24 -offset equ 28 - -NEWSYM hq4x_16 - push ebp - mov ebp,esp - pushad - - mov esi,[ebp+inbuffer] - mov edi,[ebp+outbuffer] - mov edx,[ebp+Yres] - mov [linesleft],edx - mov ebx,[ebp+Xres] - shl ebx,1 - mov dword[prevline],0 - mov dword[nextline],ebx -.loopy - mov ecx,[ebp+Xres] - sub ecx,2 ; x={Xres-2, Xres-1} are special cases. - mov dword[xcounter],ecx - ; x=0 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx] - movq mm6,[esi] - mov ebx,[nextline] - movq mm7,[esi+ebx] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov ebx,[prevline] - movq mm5,[esi+ebx-2] - movq mm6,[esi-2] - mov ebx,[nextline] - movq mm7,[esi+ebx-2] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,RGBtoYUV - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - cmp dword[cross],0 - jnz .testflag1 - mov ebx,[ebp+pitch] - mov edx,eax - shl eax,16 - or eax,edx - AUXADDRESS - mov [edi],eax - mov [edi+4],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [ecx],eax - mov [ecx+4],eax - mov [ecx+ebx],eax - mov [ecx+ebx+4],eax - jmp .loopx_end -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,[ebp+pitch] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag18 -..@flag50 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag80 -..@flag81 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag72 -..@flag76 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag10 -..@flag138 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag66 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag24 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag22 -..@flag54 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag208 -..@flag209 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag104 -..@flag108 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag11 -..@flag139 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag19 -..@flag51 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag146 -..@flag178 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag84 -..@flag85 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag112 -..@flag113 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag200 -..@flag204 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag73 -..@flag77 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag42 -..@flag170 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag14 -..@flag142 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag67 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag70 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag28 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag152 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag194 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag98 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag56 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag25 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag26 -..@flag31 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag82 -..@flag214 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag88 -..@flag248 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag74 -..@flag107 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag27 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag86 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag216 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag106 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag30 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag210 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag120 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag75 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag29 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag198 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag184 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag99 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag57 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag71 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag156 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag226 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag60 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag195 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag102 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag153 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag58 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag83 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag92 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag202 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag78 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag154 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag114 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag89 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag90 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag55 -..@flag23 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag182 -..@flag150 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag213 -..@flag212 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag241 -..@flag240 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag236 -..@flag232 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag109 -..@flag105 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag171 -..@flag43 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag143 -..@flag15 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag124 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag203 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag62 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag211 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag118 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag217 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag110 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag155 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag188 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag185 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag61 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag157 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag103 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag227 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag230 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag199 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag220 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag158 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag234 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag242 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag59 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag121 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag87 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag79 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_32 - PIXEL03_82 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag122 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag94 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag218 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag91 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag229 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag167 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag173 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag181 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag186 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag115 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag93 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag206 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag205 -..@flag201 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag174 -..@flag46 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag179 -..@flag147 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag117 -..@flag116 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag189 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag231 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag126 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag219 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag125 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag221 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag207 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag238 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag190 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - jmp .loopx_end -..@flag187 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag243 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag119 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag237 -..@flag233 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag175 -..@flag47 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag183 -..@flag151 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag245 -..@flag244 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag250 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag123 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag95 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag222 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag252 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag249 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag235 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag111 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag63 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag159 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag215 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag246 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag254 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag253 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag251 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag239 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag127 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag191 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag223 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag247 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag255 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end - -.loopx_end - add esi,2 - add edi,8 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl .xres_1 - mov ebx,[prevline] - movq mm5,[esi+ebx-4] - movq mm6,[esi-4] - mov ebx,[nextline] - movq mm7,[esi+ebx-4] - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl .nexty - ; x=Xres-1 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx-6] - movq mm6,[esi-6] - mov ebx,[nextline] - movq mm7,[esi+ebx-6] - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.nexty - add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks - add edi,ebx - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset - shl ebx, 3 - sub edi, ebx - shr ebx, 2 - dec dword[linesleft] - jz .fin - add ebx, [ebp+offset]; - cmp dword[linesleft],1 - je .lastline - mov dword[nextline],ebx - neg ebx - mov dword[prevline],ebx - jmp .loopy -.lastline - mov dword[nextline],0 - neg ebx - mov dword[prevline],ebx - jmp .loopy -.fin - emms - popad - mov esp,ebp - pop ebp - ret - -SECTION .data -FuncTable - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - - +;hq4x filter +;16bpp output +;---------------------------------------------------------- +;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) +; +;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. + +%include "macros.mac" + +EXTSYM LUT16to32,RGBtoYUV + +SECTION .bss +linesleft resd 1 +xcounter resd 1 +cross resd 1 +nextline resd 1 +prevline resd 1 +w1 resd 1 +w2 resd 1 +w3 resd 1 +w4 resd 1 +w5 resd 1 +w6 resd 1 +w7 resd 1 +w8 resd 1 +w9 resd 1 + +SECTION .data + +reg_blank dd 0,0 +const3 dd 0x00030003,0x00000003 +const5 dd 0x00050005,0x00000005 +const6 dd 0x00060006,0x00000006 +const7 dd 0x00070007,0x00000007 +threshold dd 0x00300706,0x00000000 +zerolowbits dd 0xF7DEF7DE + +SECTION .text + +%macro AUXADDRESS 0 + mov ecx, edi + add ecx, ebx + add ecx, ebx +%endmacro + +%macro TestDiff 2 + mov edx,[%1] + sub edx,[%2] + jz %%fin + mov edx,[%1] + shl edx,2 + add edx,RGBtoYUV + movd mm1,[edx] + movq mm5,mm1 + mov edx,[%2] + shl edx,2 + add edx,RGBtoYUV + movd mm2,[edx] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 +%%fin: +%endmacro + +%macro DiffOrNot 4 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + jmp %%fin +%%same: + %4 +%%fin +%endmacro + +%macro DiffOrNot 8 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + jmp %%fin +%%same: + %6 + %7 + %8 +%%fin +%endmacro + +%macro DiffOrNot 10 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + %6 + jmp %%fin +%%same: + %7 + %8 + %9 + %10 +%%fin +%endmacro + +%macro DiffOrNot 14 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + %6 + %7 + %8 + jmp %%fin +%%same: + %9 + %10 + %11 + %12 + %13 + %14 +%%fin +%endmacro + +%macro Interp1 3 + mov edx,%2 + mov eax,%3 + cmp edx,eax + je %%fin + and edx,[zerolowbits] + and eax,[zerolowbits] + add eax,edx + shr eax,1 + add eax,0x0821 + and eax,[zerolowbits] + add edx,eax + shr edx,1 +%%fin + mov %1,dx +%endmacro + +%macro Interp2 4 + mov edx,%3 + mov eax,%4 + cmp edx,eax + je %%fin1 + and edx,[zerolowbits] + and eax,[zerolowbits] + add eax,edx + shr eax,1 + add eax,0x0821 +%%fin1 + mov edx,%2 + cmp edx,eax + je %%fin2 + and eax,[zerolowbits] + and edx,[zerolowbits] + add edx,eax + shr edx,1 +%%fin2 + mov %1,dx +%endmacro + +%macro Interp3 3 + mov eax, LUT16to32 + mov edx, %2 + movd mm1, [eax+edx*4] + mov edx, %3 + movd mm2, [eax+edx*4] + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const7] + paddw mm1, mm2 + psrlw mm1, 5 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro Interp5 3 + mov edx,%2 + mov eax,%3 + cmp edx,eax + je %%fin + and edx,[zerolowbits] + and eax,[zerolowbits] + add edx,eax + shr edx,1 +%%fin + mov %1,dx +%endmacro + +%macro Interp6 4 + mov eax, LUT16to32 + mov edx, %2 + movd mm1, [eax+edx*4] + mov edx, %3 + movd mm2, [eax+edx*4] + mov edx, %4 + movd mm3, [eax+edx*4] + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + punpcklbw mm3, [reg_blank] + pmullw mm1, [const5] + psllw mm2, 1 + paddw mm1, mm3 + paddw mm1, mm2 + psrlw mm1, 5 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro Interp7 4 + mov eax, LUT16to32 + mov edx, %2 + movd mm1, [eax+edx*4] + mov edx, %3 + movd mm2, [eax+edx*4] + mov edx, %4 + movd mm3, [eax+edx*4] + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + punpcklbw mm3, [reg_blank] + pmullw mm1, [const6] + paddw mm2, mm3 + paddw mm1, mm2 + psrlw mm1, 5 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro Interp8 3 + mov eax, LUT16to32 + mov edx, %2 + movd mm1, [eax+edx*4] + mov edx, %3 + movd mm2, [eax+edx*4] + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const5] + pmullw mm2, [const3] + paddw mm1, mm2 + psrlw mm1, 5 + packuswb mm1, [reg_blank] + movd edx, mm1 + shl dl, 2 + shr edx, 1 + shl dx, 3 + shr edx, 5 + mov %1, dx +%endmacro + +%macro PIXEL00_0 0 + mov eax,[w5] + mov [edi],ax +%endmacro + +%macro PIXEL00_11 0 + Interp1 [edi],[w5],[w4] +%endmacro + +%macro PIXEL00_12 0 + Interp1 [edi],[w5],[w2] +%endmacro + +%macro PIXEL00_20 0 + Interp2 [edi],[w5],[w2],[w4] +%endmacro + +%macro PIXEL00_50 0 + Interp5 [edi],[w2],[w4] +%endmacro + +%macro PIXEL00_80 0 + Interp8 [edi],[w5],[w1] +%endmacro + +%macro PIXEL00_81 0 + Interp8 [edi],[w5],[w4] +%endmacro + +%macro PIXEL00_82 0 + Interp8 [edi],[w5],[w2] +%endmacro + +%macro PIXEL01_0 0 + mov eax,[w5] + mov [edi+2],ax +%endmacro + +%macro PIXEL01_10 0 + Interp1 [edi+2],[w5],[w1] +%endmacro + +%macro PIXEL01_12 0 + Interp1 [edi+2],[w5],[w2] +%endmacro + +%macro PIXEL01_14 0 + Interp1 [edi+2],[w2],[w5] +%endmacro + +%macro PIXEL01_21 0 + Interp2 [edi+2],[w2],[w5],[w4] +%endmacro + +%macro PIXEL01_31 0 + Interp3 [edi+2],[w5],[w4] +%endmacro + +%macro PIXEL01_50 0 + Interp5 [edi+2],[w2],[w5] +%endmacro + +%macro PIXEL01_60 0 + Interp6 [edi+2],[w5],[w2],[w4] +%endmacro + +%macro PIXEL01_61 0 + Interp6 [edi+2],[w5],[w2],[w1] +%endmacro + +%macro PIXEL01_82 0 + Interp8 [edi+2],[w5],[w2] +%endmacro + +%macro PIXEL01_83 0 + Interp8 [edi+2],[w2],[w4] +%endmacro + +%macro PIXEL02_0 0 + mov eax,[w5] + mov [edi+4],ax +%endmacro + +%macro PIXEL02_10 0 + Interp1 [edi+4],[w5],[w3] +%endmacro + +%macro PIXEL02_11 0 + Interp1 [edi+4],[w5],[w2] +%endmacro + +%macro PIXEL02_13 0 + Interp1 [edi+4],[w2],[w5] +%endmacro + +%macro PIXEL02_21 0 + Interp2 [edi+4],[w2],[w5],[w6] +%endmacro + +%macro PIXEL02_32 0 + Interp3 [edi+4],[w5],[w6] +%endmacro + +%macro PIXEL02_50 0 + Interp5 [edi+4],[w2],[w5] +%endmacro + +%macro PIXEL02_60 0 + Interp6 [edi+4],[w5],[w2],[w6] +%endmacro + +%macro PIXEL02_61 0 + Interp6 [edi+4],[w5],[w2],[w3] +%endmacro + +%macro PIXEL02_81 0 + Interp8 [edi+4],[w5],[w2] +%endmacro + +%macro PIXEL02_83 0 + Interp8 [edi+4],[w2],[w6] +%endmacro + +%macro PIXEL03_0 0 + mov eax,[w5] + mov [edi+6],ax +%endmacro + +%macro PIXEL03_11 0 + Interp1 [edi+6],[w5],[w2] +%endmacro + +%macro PIXEL03_12 0 + Interp1 [edi+6],[w5],[w6] +%endmacro + +%macro PIXEL03_20 0 + Interp2 [edi+6],[w5],[w2],[w6] +%endmacro + +%macro PIXEL03_50 0 + Interp5 [edi+6],[w2],[w6] +%endmacro + +%macro PIXEL03_80 0 + Interp8 [edi+6],[w5],[w3] +%endmacro + +%macro PIXEL03_81 0 + Interp8 [edi+6],[w5],[w2] +%endmacro + +%macro PIXEL03_82 0 + Interp8 [edi+6],[w5],[w6] +%endmacro + +%macro PIXEL10_0 0 + mov eax,[w5] + mov [edi+ebx],ax +%endmacro + +%macro PIXEL10_10 0 + Interp1 [edi+ebx],[w5],[w1] +%endmacro + +%macro PIXEL10_11 0 + Interp1 [edi+ebx],[w5],[w4] +%endmacro + +%macro PIXEL10_13 0 + Interp1 [edi+ebx],[w4],[w5] +%endmacro + +%macro PIXEL10_21 0 + Interp2 [edi+ebx],[w4],[w5],[w2] +%endmacro + +%macro PIXEL10_32 0 + Interp3 [edi+ebx],[w5],[w2] +%endmacro + +%macro PIXEL10_50 0 + Interp5 [edi+ebx],[w4],[w5] +%endmacro + +%macro PIXEL10_60 0 + Interp6 [edi+ebx],[w5],[w4],[w2] +%endmacro + +%macro PIXEL10_61 0 + Interp6 [edi+ebx],[w5],[w4],[w1] +%endmacro + +%macro PIXEL10_81 0 + Interp8 [edi+ebx],[w5],[w4] +%endmacro + +%macro PIXEL10_83 0 + Interp8 [edi+ebx],[w4],[w2] +%endmacro + +%macro PIXEL11_0 0 + mov eax,[w5] + mov [edi+ebx+2],ax +%endmacro + +%macro PIXEL11_30 0 + Interp3 [edi+ebx+2],[w5],[w1] +%endmacro + +%macro PIXEL11_31 0 + Interp3 [edi+ebx+2],[w5],[w4] +%endmacro + +%macro PIXEL11_32 0 + Interp3 [edi+ebx+2],[w5],[w2] +%endmacro + +%macro PIXEL11_70 0 + Interp7 [edi+ebx+2],[w5],[w4],[w2] +%endmacro + +%macro PIXEL12_0 0 + mov eax,[w5] + mov [edi+ebx+4],ax +%endmacro + +%macro PIXEL12_30 0 + Interp3 [edi+ebx+4],[w5],[w3] +%endmacro + +%macro PIXEL12_31 0 + Interp3 [edi+ebx+4],[w5],[w2] +%endmacro + +%macro PIXEL12_32 0 + Interp3 [edi+ebx+4],[w5],[w6] +%endmacro + +%macro PIXEL12_70 0 + Interp7 [edi+ebx+4],[w5],[w6],[w2] +%endmacro + +%macro PIXEL13_0 0 + mov eax,[w5] + mov [edi+ebx+6],ax +%endmacro + +%macro PIXEL13_10 0 + Interp1 [edi+ebx+6],[w5],[w3] +%endmacro + +%macro PIXEL13_12 0 + Interp1 [edi+ebx+6],[w5],[w6] +%endmacro + +%macro PIXEL13_14 0 + Interp1 [edi+ebx+6],[w6],[w5] +%endmacro + +%macro PIXEL13_21 0 + Interp2 [edi+ebx+6],[w6],[w5],[w2] +%endmacro + +%macro PIXEL13_31 0 + Interp3 [edi+ebx+6],[w5],[w2] +%endmacro + +%macro PIXEL13_50 0 + Interp5 [edi+ebx+6],[w6],[w5] +%endmacro + +%macro PIXEL13_60 0 + Interp6 [edi+ebx+6],[w5],[w6],[w2] +%endmacro + +%macro PIXEL13_61 0 + Interp6 [edi+ebx+6],[w5],[w6],[w3] +%endmacro + +%macro PIXEL13_82 0 + Interp8 [edi+ebx+6],[w5],[w6] +%endmacro + +%macro PIXEL13_83 0 + Interp8 [edi+ebx+6],[w6],[w2] +%endmacro + +%macro PIXEL20_0 0 + mov eax,[w5] + mov [ecx],ax +%endmacro + +%macro PIXEL20_10 0 + Interp1 [ecx],[w5],[w7] +%endmacro + +%macro PIXEL20_12 0 + Interp1 [ecx],[w5],[w4] +%endmacro + +%macro PIXEL20_14 0 + Interp1 [ecx],[w4],[w5] +%endmacro + +%macro PIXEL20_21 0 + Interp2 [ecx],[w4],[w5],[w8] +%endmacro + +%macro PIXEL20_31 0 + Interp3 [ecx],[w5],[w8] +%endmacro + +%macro PIXEL20_50 0 + Interp5 [ecx],[w4],[w5] +%endmacro + +%macro PIXEL20_60 0 + Interp6 [ecx],[w5],[w4],[w8] +%endmacro + +%macro PIXEL20_61 0 + Interp6 [ecx],[w5],[w4],[w7] +%endmacro + +%macro PIXEL20_82 0 + Interp8 [ecx],[w5],[w4] +%endmacro + +%macro PIXEL20_83 0 + Interp8 [ecx],[w4],[w8] +%endmacro + +%macro PIXEL21_0 0 + mov eax,[w5] + mov [ecx+2],ax +%endmacro + +%macro PIXEL21_30 0 + Interp3 [ecx+2],[w5],[w7] +%endmacro + +%macro PIXEL21_31 0 + Interp3 [ecx+2],[w5],[w8] +%endmacro + +%macro PIXEL21_32 0 + Interp3 [ecx+2],[w5],[w4] +%endmacro + +%macro PIXEL21_70 0 + Interp7 [ecx+2],[w5],[w4],[w8] +%endmacro + +%macro PIXEL22_0 0 + mov eax,[w5] + mov [ecx+4],ax +%endmacro + +%macro PIXEL22_30 0 + Interp3 [ecx+4],[w5],[w9] +%endmacro + +%macro PIXEL22_31 0 + Interp3 [ecx+4],[w5],[w6] +%endmacro + +%macro PIXEL22_32 0 + Interp3 [ecx+4],[w5],[w8] +%endmacro + +%macro PIXEL22_70 0 + Interp7 [ecx+4],[w5],[w6],[w8] +%endmacro + +%macro PIXEL23_0 0 + mov eax,[w5] + mov [ecx+6],ax +%endmacro + +%macro PIXEL23_10 0 + Interp1 [ecx+6],[w5],[w9] +%endmacro + +%macro PIXEL23_11 0 + Interp1 [ecx+6],[w5],[w6] +%endmacro + +%macro PIXEL23_13 0 + Interp1 [ecx+6],[w6],[w5] +%endmacro + +%macro PIXEL23_21 0 + Interp2 [ecx+6],[w6],[w5],[w8] +%endmacro + +%macro PIXEL23_32 0 + Interp3 [ecx+6],[w5],[w8] +%endmacro + +%macro PIXEL23_50 0 + Interp5 [ecx+6],[w6],[w5] +%endmacro + +%macro PIXEL23_60 0 + Interp6 [ecx+6],[w5],[w6],[w8] +%endmacro + +%macro PIXEL23_61 0 + Interp6 [ecx+6],[w5],[w6],[w9] +%endmacro + +%macro PIXEL23_81 0 + Interp8 [ecx+6],[w5],[w6] +%endmacro + +%macro PIXEL23_83 0 + Interp8 [ecx+6],[w6],[w8] +%endmacro + +%macro PIXEL30_0 0 + mov eax,[w5] + mov [ecx+ebx],ax +%endmacro + +%macro PIXEL30_11 0 + Interp1 [ecx+ebx],[w5],[w8] +%endmacro + +%macro PIXEL30_12 0 + Interp1 [ecx+ebx],[w5],[w4] +%endmacro + +%macro PIXEL30_20 0 + Interp2 [ecx+ebx],[w5],[w8],[w4] +%endmacro + +%macro PIXEL30_50 0 + Interp5 [ecx+ebx],[w8],[w4] +%endmacro + +%macro PIXEL30_80 0 + Interp8 [ecx+ebx],[w5],[w7] +%endmacro + +%macro PIXEL30_81 0 + Interp8 [ecx+ebx],[w5],[w8] +%endmacro + +%macro PIXEL30_82 0 + Interp8 [ecx+ebx],[w5],[w4] +%endmacro + +%macro PIXEL31_0 0 + mov eax,[w5] + mov [ecx+ebx+2],ax +%endmacro + +%macro PIXEL31_10 0 + Interp1 [ecx+ebx+2],[w5],[w7] +%endmacro + +%macro PIXEL31_11 0 + Interp1 [ecx+ebx+2],[w5],[w8] +%endmacro + +%macro PIXEL31_13 0 + Interp1 [ecx+ebx+2],[w8],[w5] +%endmacro + +%macro PIXEL31_21 0 + Interp2 [ecx+ebx+2],[w8],[w5],[w4] +%endmacro + +%macro PIXEL31_32 0 + Interp3 [ecx+ebx+2],[w5],[w4] +%endmacro + +%macro PIXEL31_50 0 + Interp5 [ecx+ebx+2],[w8],[w5] +%endmacro + +%macro PIXEL31_60 0 + Interp6 [ecx+ebx+2],[w5],[w8],[w4] +%endmacro + +%macro PIXEL31_61 0 + Interp6 [ecx+ebx+2],[w5],[w8],[w7] +%endmacro + +%macro PIXEL31_81 0 + Interp8 [ecx+ebx+2],[w5],[w8] +%endmacro + +%macro PIXEL31_83 0 + Interp8 [ecx+ebx+2],[w8],[w4] +%endmacro + +%macro PIXEL32_0 0 + mov eax,[w5] + mov [ecx+ebx+4],ax +%endmacro + +%macro PIXEL32_10 0 + Interp1 [ecx+ebx+4],[w5],[w9] +%endmacro + +%macro PIXEL32_12 0 + Interp1 [ecx+ebx+4],[w5],[w8] +%endmacro + +%macro PIXEL32_14 0 + Interp1 [ecx+ebx+4],[w8],[w5] +%endmacro + +%macro PIXEL32_21 0 + Interp2 [ecx+ebx+4],[w8],[w5],[w6] +%endmacro + +%macro PIXEL32_31 0 + Interp3 [ecx+ebx+4],[w5],[w6] +%endmacro + +%macro PIXEL32_50 0 + Interp5 [ecx+ebx+4],[w8],[w5] +%endmacro + +%macro PIXEL32_60 0 + Interp6 [ecx+ebx+4],[w5],[w8],[w6] +%endmacro + +%macro PIXEL32_61 0 + Interp6 [ecx+ebx+4],[w5],[w8],[w9] +%endmacro + +%macro PIXEL32_82 0 + Interp8 [ecx+ebx+4],[w5],[w8] +%endmacro + +%macro PIXEL32_83 0 + Interp8 [ecx+ebx+4],[w8],[w6] +%endmacro + +%macro PIXEL33_0 0 + mov eax,[w5] + mov [ecx+ebx+6],ax +%endmacro + +%macro PIXEL33_11 0 + Interp1 [ecx+ebx+6],[w5],[w6] +%endmacro + +%macro PIXEL33_12 0 + Interp1 [ecx+ebx+6],[w5],[w8] +%endmacro + +%macro PIXEL33_20 0 + Interp2 [ecx+ebx+6],[w5],[w8],[w6] +%endmacro + +%macro PIXEL33_50 0 + Interp5 [ecx+ebx+6],[w8],[w6] +%endmacro + +%macro PIXEL33_80 0 + Interp8 [ecx+ebx+6],[w5],[w9] +%endmacro + +%macro PIXEL33_81 0 + Interp8 [ecx+ebx+6],[w5],[w6] +%endmacro + +%macro PIXEL33_82 0 + Interp8 [ecx+ebx+6],[w5],[w8] +%endmacro + +inbuffer equ 8 +outbuffer equ 12 +Xres equ 16 +Yres equ 20 +pitch equ 24 +offset equ 28 + +NEWSYM hq4x_16 + push ebp + mov ebp,esp + pushad + + mov esi,[ebp+inbuffer] + mov edi,[ebp+outbuffer] + mov edx,[ebp+Yres] + mov [linesleft],edx + mov ebx,[ebp+Xres] + shl ebx,1 + mov dword[prevline],0 + mov dword[nextline],ebx +.loopy + mov ecx,[ebp+Xres] + sub ecx,2 ; x={Xres-2, Xres-1} are special cases. + mov dword[xcounter],ecx + ; x=0 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx] + movq mm6,[esi] + mov ebx,[nextline] + movq mm7,[esi+ebx] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + mov [w2],edx + shr eax,16 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + mov [w5],edx + shr eax,16 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + mov [w8],edx + shr eax,16 + mov [w9],eax + jmp .flags +.loopx + mov ebx,[prevline] + movq mm5,[esi+ebx-2] + movq mm6,[esi-2] + mov ebx,[nextline] + movq mm7,[esi+ebx-2] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + movzx edx,ax + mov [w3],edx + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + movzx edx,ax + mov [w6],edx + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + movzx edx,ax + mov [w9],edx +.flags + mov ebx,RGBtoYUV + mov eax,[w5] + xor ecx,ecx + movd mm5,[ebx+eax*4] + mov dword[cross],0 + + mov edx,[w2] + cmp eax,edx + je .noflag2 + or dword[cross],1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag2 + or ecx,2 +.noflag2 + mov edx,[w4] + cmp eax,edx + je .noflag4 + or dword[cross],2 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag4 + or ecx,8 +.noflag4 + mov edx,[w6] + cmp eax,edx + je .noflag6 + or dword[cross],4 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag6 + or ecx,16 +.noflag6 + mov edx,[w8] + cmp eax,edx + je .noflag8 + or dword[cross],8 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag8 + or ecx,64 +.noflag8 + cmp dword[cross],0 + jnz .testflag1 + mov ebx,[ebp+pitch] + mov edx,eax + shl eax,16 + or eax,edx + AUXADDRESS + mov [edi],eax + mov [edi+4],eax + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [ecx],eax + mov [ecx+4],eax + mov [ecx+ebx],eax + mov [ecx+ebx+4],eax + jmp .loopx_end +.testflag1 + mov edx,[w1] + cmp eax,edx + je .noflag1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag1 + or ecx,1 +.noflag1 + mov edx,[w3] + cmp eax,edx + je .noflag3 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag3 + or ecx,4 +.noflag3 + mov edx,[w7] + cmp eax,edx + je .noflag7 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag7 + or ecx,32 +.noflag7 + mov edx,[w9] + cmp eax,edx + je .noflag9 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag9 + or ecx,128 +.noflag9 + mov ebx,[ebp+pitch] + jmp [FuncTable+ecx*4] + +..@flag0 +..@flag1 +..@flag4 +..@flag32 +..@flag128 +..@flag5 +..@flag132 +..@flag160 +..@flag33 +..@flag129 +..@flag36 +..@flag133 +..@flag164 +..@flag161 +..@flag37 +..@flag165 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag2 +..@flag34 +..@flag130 +..@flag162 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag16 +..@flag17 +..@flag48 +..@flag49 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag64 +..@flag65 +..@flag68 +..@flag69 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag8 +..@flag12 +..@flag136 +..@flag140 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag3 +..@flag35 +..@flag131 +..@flag163 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag6 +..@flag38 +..@flag134 +..@flag166 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag20 +..@flag21 +..@flag52 +..@flag53 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag144 +..@flag145 +..@flag176 +..@flag177 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag192 +..@flag193 +..@flag196 +..@flag197 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag96 +..@flag97 +..@flag100 +..@flag101 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag40 +..@flag44 +..@flag168 +..@flag172 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag9 +..@flag13 +..@flag137 +..@flag141 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag18 +..@flag50 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag80 +..@flag81 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag72 +..@flag76 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag10 +..@flag138 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag66 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag24 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag7 +..@flag39 +..@flag135 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag148 +..@flag149 +..@flag180 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag224 +..@flag228 +..@flag225 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag41 +..@flag169 +..@flag45 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag22 +..@flag54 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag208 +..@flag209 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag104 +..@flag108 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag11 +..@flag139 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag19 +..@flag51 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag146 +..@flag178 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + jmp .loopx_end +..@flag84 +..@flag85 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag112 +..@flag113 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag200 +..@flag204 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag73 +..@flag77 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag42 +..@flag170 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag14 +..@flag142 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag67 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag70 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag28 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag152 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag194 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag98 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag56 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag25 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag26 +..@flag31 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag82 +..@flag214 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag88 +..@flag248 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag74 +..@flag107 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag27 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag86 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag216 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag106 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag30 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag210 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag120 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag75 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag29 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag198 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag184 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag99 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag57 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag71 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag156 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag226 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag60 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag195 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag102 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag153 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag58 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag83 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag92 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag202 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag78 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag154 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag114 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag89 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag90 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag55 +..@flag23 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag182 +..@flag150 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + jmp .loopx_end +..@flag213 +..@flag212 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag241 +..@flag240 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag236 +..@flag232 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag109 +..@flag105 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag171 +..@flag43 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag143 +..@flag15 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag124 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag203 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag62 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag211 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag118 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag217 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag110 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag155 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag188 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag185 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag61 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag157 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag103 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag227 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag230 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag199 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag220 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag158 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag234 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag242 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag59 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL11_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag121 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag87 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag79 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_32 + PIXEL03_82 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag122 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag94 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag218 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag91 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL11_0 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag229 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag167 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag173 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag181 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag186 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag115 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag93 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag206 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag205 +..@flag201 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag174 +..@flag46 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag179 +..@flag147 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag117 +..@flag116 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag189 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag231 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag126 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag219 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag125 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag221 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag207 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag238 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag190 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_10 + PIXEL11_30 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + jmp .loopx_end +..@flag187 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag243 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag119 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag237 +..@flag233 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag175 +..@flag47 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag183 +..@flag151 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag245 +..@flag244 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag250 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag123 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag95 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag222 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag252 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag249 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + jmp .loopx_end +..@flag235 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag111 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag63 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag159 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag215 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag246 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag254 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag253 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag251 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + jmp .loopx_end +..@flag239 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag127 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag191 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag223 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag247 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag255 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end + +.loopx_end + add esi,2 + add edi,8 + dec dword[xcounter] + jle .xres_2 + jmp .loopx +.xres_2 + ; x=Xres-2 - special case + jl .xres_1 + mov ebx,[prevline] + movq mm5,[esi+ebx-4] + movq mm6,[esi-4] + mov ebx,[nextline] + movq mm7,[esi+ebx-4] + psrlq mm5,16 + psrlq mm6,16 + psrlq mm7,16 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + mov [w9],eax + jmp .flags +.xres_1 + cmp dword[xcounter],-1 + jl .nexty + ; x=Xres-1 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx-6] + movq mm6,[esi-6] + mov ebx,[nextline] + movq mm7,[esi+ebx-6] + psrlq mm5,32 + psrlq mm6,32 + psrlq mm7,32 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + mov [w9],eax + jmp .flags +.nexty + add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks + add edi,ebx + add edi,ebx + add edi,ebx + add edi,ebx + mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset + shl ebx, 3 + sub edi, ebx + shr ebx, 2 + dec dword[linesleft] + jz .fin + add ebx, [ebp+offset]; + cmp dword[linesleft],1 + je .lastline + mov dword[nextline],ebx + neg ebx + mov dword[prevline],ebx + jmp .loopy +.lastline + mov dword[nextline],0 + neg ebx + mov dword[prevline],ebx + jmp .loopy +.fin + emms + popad + mov esp,ebp + pop ebp + ret + +SECTION .data +FuncTable + dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 + dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 + dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 + dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 + dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 + dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 + dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 + dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 + dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 + dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 + dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 + dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 + dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 + dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 + dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 + dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 + dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 + dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 + dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 + dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 + dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 + dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 + dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 + dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 + dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 + dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 + dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 + dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 + dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 + dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 + dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 + dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 + + diff --git a/src/hq4x_32.asm b/src/hq4x_32.asm index f6f48594..12dfa343 100644 --- a/src/hq4x_32.asm +++ b/src/hq4x_32.asm @@ -1,3928 +1,3928 @@ -;hq4x filter -;32bpp output -;---------------------------------------------------------- -;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) -; -;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. - -%include "macros.mac" - -EXTSYM LUT16to32,RGBtoYUV - -SECTION .bss -linesleft resd 1 -xcounter resd 1 -cross resd 1 -nextline resd 1 -prevline resd 1 -w1 resd 1 -w2 resd 1 -w3 resd 1 -w4 resd 1 -w5 resd 1 -w6 resd 1 -w7 resd 1 -w8 resd 1 -w9 resd 1 -c1 resd 1 -c2 resd 1 -c3 resd 1 -c4 resd 1 -c5 resd 1 -c6 resd 1 -c7 resd 1 -c8 resd 1 -c9 resd 1 - -SECTION .data - -reg_blank dd 0,0 -const3 dd 0x00030003,0x00000003 -const5 dd 0x00050005,0x00000005 -const6 dd 0x00060006,0x00000006 -const7 dd 0x00070007,0x00000007 -threshold dd 0x00300706,0x00000000 - -SECTION .text - -%macro AUXADDRESS 0 - mov ecx, edi - add ecx, ebx - add ecx, ebx -%endmacro - -%macro TestDiff 2 - mov edx,[%1] - sub edx,[%2] - jz %%fin - mov edx,[%1] - shl edx,2 - add edx,RGBtoYUV - movd mm1,[edx] - movq mm5,mm1 - mov edx,[%2] - shl edx,2 - add edx,RGBtoYUV - movd mm2,[edx] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 -%%fin: -%endmacro - -%macro DiffOrNot 4 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - jmp %%fin -%%same: - %4 -%%fin -%endmacro - -%macro DiffOrNot 8 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - jmp %%fin -%%same: - %6 - %7 - %8 -%%fin -%endmacro - -%macro DiffOrNot 10 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - %6 - jmp %%fin -%%same: - %7 - %8 - %9 - %10 -%%fin -%endmacro - -%macro DiffOrNot 14 - TestDiff %1,%2 - test edx,edx - jz %%same - %3 - %4 - %5 - %6 - %7 - %8 - jmp %%fin -%%same: - %9 - %10 - %11 - %12 - %13 - %14 -%%fin -%endmacro - -%macro Interp1 3 - mov edx,%2 - shl edx,2 - add edx,%3 - sub edx,%2 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp2 4 - mov edx,%2 - shl edx,1 - add edx,%3 - add edx,%4 - shr edx,2 - mov %1,edx -%endmacro - -%macro Interp3 2 - movd mm1, eax - movd mm2, %2 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const7] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp5 3 - mov edx,%2 - add edx,%3 - shr edx,1 - mov %1,edx -%endmacro - -%macro Interp6 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const5] - psllw mm2, 1 - paddw mm1, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp7 3 - movd mm1, eax - movd mm2, %2 - movd mm3, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - punpcklbw mm3, [reg_blank] - pmullw mm1, [const6] - paddw mm2, mm3 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro Interp8 3 - movd mm1, %2 - movd mm2, %3 - punpcklbw mm1, [reg_blank] - punpcklbw mm2, [reg_blank] - pmullw mm1, [const5] - pmullw mm2, [const3] - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, [reg_blank] - movd %1, mm1 -%endmacro - -%macro PIXEL00_0 0 - mov [edi],eax -%endmacro - -%macro PIXEL00_11 0 - Interp1 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_12 0 - Interp1 [edi],eax,[c2] -%endmacro - -%macro PIXEL00_20 0 - Interp2 [edi],eax,[c2],[c4] -%endmacro - -%macro PIXEL00_50 0 - Interp5 [edi],[c2],[c4] -%endmacro - -%macro PIXEL00_80 0 - Interp8 [edi],eax,[c1] -%endmacro - -%macro PIXEL00_81 0 - Interp8 [edi],eax,[c4] -%endmacro - -%macro PIXEL00_82 0 - Interp8 [edi],eax,[c2] -%endmacro - -%macro PIXEL01_0 0 - mov [edi+4],eax -%endmacro - -%macro PIXEL01_10 0 - Interp1 [edi+4],eax,[c1] -%endmacro - -%macro PIXEL01_12 0 - Interp1 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_14 0 - Interp1 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_21 0 - Interp2 [edi+4],[c2],eax,[c4] -%endmacro - -%macro PIXEL01_31 0 - Interp3 [edi+4],[c4] -%endmacro - -%macro PIXEL01_50 0 - Interp5 [edi+4],[c2],eax -%endmacro - -%macro PIXEL01_60 0 - Interp6 [edi+4],[c2],[c4] -%endmacro - -%macro PIXEL01_61 0 - Interp6 [edi+4],[c2],[c1] -%endmacro - -%macro PIXEL01_82 0 - Interp8 [edi+4],eax,[c2] -%endmacro - -%macro PIXEL01_83 0 - Interp8 [edi+4],[c2],[c4] -%endmacro - -%macro PIXEL02_0 0 - mov [edi+8],eax -%endmacro - -%macro PIXEL02_10 0 - Interp1 [edi+8],eax,[c3] -%endmacro - -%macro PIXEL02_11 0 - Interp1 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_13 0 - Interp1 [edi+8],[c2],eax -%endmacro - -%macro PIXEL02_21 0 - Interp2 [edi+8],[c2],eax,[c6] -%endmacro - -%macro PIXEL02_32 0 - Interp3 [edi+8],[c6] -%endmacro - -%macro PIXEL02_50 0 - Interp5 [edi+8],[c2],eax -%endmacro - -%macro PIXEL02_60 0 - Interp6 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL02_61 0 - Interp6 [edi+8],[c2],[c3] -%endmacro - -%macro PIXEL02_81 0 - Interp8 [edi+8],eax,[c2] -%endmacro - -%macro PIXEL02_83 0 - Interp8 [edi+8],[c2],[c6] -%endmacro - -%macro PIXEL03_0 0 - mov [edi+12],eax -%endmacro - -%macro PIXEL03_11 0 - Interp1 [edi+12],eax,[c2] -%endmacro - -%macro PIXEL03_12 0 - Interp1 [edi+12],eax,[c6] -%endmacro - -%macro PIXEL03_20 0 - Interp2 [edi+12],eax,[c2],[c6] -%endmacro - -%macro PIXEL03_50 0 - Interp5 [edi+12],[c2],[c6] -%endmacro - -%macro PIXEL03_80 0 - Interp8 [edi+12],eax,[c3] -%endmacro - -%macro PIXEL03_81 0 - Interp8 [edi+12],eax,[c2] -%endmacro - -%macro PIXEL03_82 0 - Interp8 [edi+12],eax,[c6] -%endmacro - -%macro PIXEL10_0 0 - mov [edi+ebx],eax -%endmacro - -%macro PIXEL10_10 0 - Interp1 [edi+ebx],eax,[c1] -%endmacro - -%macro PIXEL10_11 0 - Interp1 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_13 0 - Interp1 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_21 0 - Interp2 [edi+ebx],[c4],eax,[c2] -%endmacro - -%macro PIXEL10_32 0 - Interp3 [edi+ebx],[c2] -%endmacro - -%macro PIXEL10_50 0 - Interp5 [edi+ebx],[c4],eax -%endmacro - -%macro PIXEL10_60 0 - Interp6 [edi+ebx],[c4],[c2] -%endmacro - -%macro PIXEL10_61 0 - Interp6 [edi+ebx],[c4],[c1] -%endmacro - -%macro PIXEL10_81 0 - Interp8 [edi+ebx],eax,[c4] -%endmacro - -%macro PIXEL10_83 0 - Interp8 [edi+ebx],[c4],[c2] -%endmacro - -%macro PIXEL11_0 0 - mov [edi+ebx+4],eax -%endmacro - -%macro PIXEL11_30 0 - Interp3 [edi+ebx+4],[c1] -%endmacro - -%macro PIXEL11_31 0 - Interp3 [edi+ebx+4],[c4] -%endmacro - -%macro PIXEL11_32 0 - Interp3 [edi+ebx+4],[c2] -%endmacro - -%macro PIXEL11_70 0 - Interp7 [edi+ebx+4],[c4],[c2] -%endmacro - -%macro PIXEL12_0 0 - mov [edi+ebx+8],eax -%endmacro - -%macro PIXEL12_30 0 - Interp3 [edi+ebx+8],[c3] -%endmacro - -%macro PIXEL12_31 0 - Interp3 [edi+ebx+8],[c2] -%endmacro - -%macro PIXEL12_32 0 - Interp3 [edi+ebx+8],[c6] -%endmacro - -%macro PIXEL12_70 0 - Interp7 [edi+ebx+8],[c6],[c2] -%endmacro - -%macro PIXEL13_0 0 - mov [edi+ebx+12],eax -%endmacro - -%macro PIXEL13_10 0 - Interp1 [edi+ebx+12],eax,[c3] -%endmacro - -%macro PIXEL13_12 0 - Interp1 [edi+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL13_14 0 - Interp1 [edi+ebx+12],[c6],eax -%endmacro - -%macro PIXEL13_21 0 - Interp2 [edi+ebx+12],[c6],eax,[c2] -%endmacro - -%macro PIXEL13_31 0 - Interp3 [edi+ebx+12],[c2] -%endmacro - -%macro PIXEL13_50 0 - Interp5 [edi+ebx+12],[c6],eax -%endmacro - -%macro PIXEL13_60 0 - Interp6 [edi+ebx+12],[c6],[c2] -%endmacro - -%macro PIXEL13_61 0 - Interp6 [edi+ebx+12],[c6],[c3] -%endmacro - -%macro PIXEL13_82 0 - Interp8 [edi+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL13_83 0 - Interp8 [edi+ebx+12],[c6],[c2] -%endmacro - -%macro PIXEL20_0 0 - mov [ecx],eax -%endmacro - -%macro PIXEL20_10 0 - Interp1 [ecx],eax,[c7] -%endmacro - -%macro PIXEL20_12 0 - Interp1 [ecx],eax,[c4] -%endmacro - -%macro PIXEL20_14 0 - Interp1 [ecx],[c4],eax -%endmacro - -%macro PIXEL20_21 0 - Interp2 [ecx],[c4],eax,[c8] -%endmacro - -%macro PIXEL20_31 0 - Interp3 [ecx],[c8] -%endmacro - -%macro PIXEL20_50 0 - Interp5 [ecx],[c4],eax -%endmacro - -%macro PIXEL20_60 0 - Interp6 [ecx],[c4],[c8] -%endmacro - -%macro PIXEL20_61 0 - Interp6 [ecx],[c4],[c7] -%endmacro - -%macro PIXEL20_82 0 - Interp8 [ecx],eax,[c4] -%endmacro - -%macro PIXEL20_83 0 - Interp8 [ecx],[c4],[c8] -%endmacro - -%macro PIXEL21_0 0 - mov [ecx+4],eax -%endmacro - -%macro PIXEL21_30 0 - Interp3 [ecx+4],[c7] -%endmacro - -%macro PIXEL21_31 0 - Interp3 [ecx+4],[c8] -%endmacro - -%macro PIXEL21_32 0 - Interp3 [ecx+4],[c4] -%endmacro - -%macro PIXEL21_70 0 - Interp7 [ecx+4],[c4],[c8] -%endmacro - -%macro PIXEL22_0 0 - mov [ecx+8],eax -%endmacro - -%macro PIXEL22_30 0 - Interp3 [ecx+8],[c9] -%endmacro - -%macro PIXEL22_31 0 - Interp3 [ecx+8],[c6] -%endmacro - -%macro PIXEL22_32 0 - Interp3 [ecx+8],[c8] -%endmacro - -%macro PIXEL22_70 0 - Interp7 [ecx+8],[c6],[c8] -%endmacro - -%macro PIXEL23_0 0 - mov [ecx+12],eax -%endmacro - -%macro PIXEL23_10 0 - Interp1 [ecx+12],eax,[c9] -%endmacro - -%macro PIXEL23_11 0 - Interp1 [ecx+12],eax,[c6] -%endmacro - -%macro PIXEL23_13 0 - Interp1 [ecx+12],[c6],eax -%endmacro - -%macro PIXEL23_21 0 - Interp2 [ecx+12],[c6],eax,[c8] -%endmacro - -%macro PIXEL23_32 0 - Interp3 [ecx+12],[c8] -%endmacro - -%macro PIXEL23_50 0 - Interp5 [ecx+12],[c6],eax -%endmacro - -%macro PIXEL23_60 0 - Interp6 [ecx+12],[c6],[c8] -%endmacro - -%macro PIXEL23_61 0 - Interp6 [ecx+12],[c6],[c9] -%endmacro - -%macro PIXEL23_81 0 - Interp8 [ecx+12],eax,[c6] -%endmacro - -%macro PIXEL23_83 0 - Interp8 [ecx+12],[c6],[c8] -%endmacro - -%macro PIXEL30_0 0 - mov [ecx+ebx],eax -%endmacro - -%macro PIXEL30_11 0 - Interp1 [ecx+ebx],eax,[c8] -%endmacro - -%macro PIXEL30_12 0 - Interp1 [ecx+ebx],eax,[c4] -%endmacro - -%macro PIXEL30_20 0 - Interp2 [ecx+ebx],eax,[c8],[c4] -%endmacro - -%macro PIXEL30_50 0 - Interp5 [ecx+ebx],[c8],[c4] -%endmacro - -%macro PIXEL30_80 0 - Interp8 [ecx+ebx],eax,[c7] -%endmacro - -%macro PIXEL30_81 0 - Interp8 [ecx+ebx],eax,[c8] -%endmacro - -%macro PIXEL30_82 0 - Interp8 [ecx+ebx],eax,[c4] -%endmacro - -%macro PIXEL31_0 0 - mov [ecx+ebx+4],eax -%endmacro - -%macro PIXEL31_10 0 - Interp1 [ecx+ebx+4],eax,[c7] -%endmacro - -%macro PIXEL31_11 0 - Interp1 [ecx+ebx+4],eax,[c8] -%endmacro - -%macro PIXEL31_13 0 - Interp1 [ecx+ebx+4],[c8],eax -%endmacro - -%macro PIXEL31_21 0 - Interp2 [ecx+ebx+4],[c8],eax,[c4] -%endmacro - -%macro PIXEL31_32 0 - Interp3 [ecx+ebx+4],[c4] -%endmacro - -%macro PIXEL31_50 0 - Interp5 [ecx+ebx+4],[c8],eax -%endmacro - -%macro PIXEL31_60 0 - Interp6 [ecx+ebx+4],[c8],[c4] -%endmacro - -%macro PIXEL31_61 0 - Interp6 [ecx+ebx+4],[c8],[c7] -%endmacro - -%macro PIXEL31_81 0 - Interp8 [ecx+ebx+4],eax,[c8] -%endmacro - -%macro PIXEL31_83 0 - Interp8 [ecx+ebx+4],[c8],[c4] -%endmacro - -%macro PIXEL32_0 0 - mov [ecx+ebx+8],eax -%endmacro - -%macro PIXEL32_10 0 - Interp1 [ecx+ebx+8],eax,[c9] -%endmacro - -%macro PIXEL32_12 0 - Interp1 [ecx+ebx+8],eax,[c8] -%endmacro - -%macro PIXEL32_14 0 - Interp1 [ecx+ebx+8],[c8],eax -%endmacro - -%macro PIXEL32_21 0 - Interp2 [ecx+ebx+8],[c8],eax,[c6] -%endmacro - -%macro PIXEL32_31 0 - Interp3 [ecx+ebx+8],[c6] -%endmacro - -%macro PIXEL32_50 0 - Interp5 [ecx+ebx+8],[c8],eax -%endmacro - -%macro PIXEL32_60 0 - Interp6 [ecx+ebx+8],[c8],[c6] -%endmacro - -%macro PIXEL32_61 0 - Interp6 [ecx+ebx+8],[c8],[c9] -%endmacro - -%macro PIXEL32_82 0 - Interp8 [ecx+ebx+8],eax,[c8] -%endmacro - -%macro PIXEL32_83 0 - Interp8 [ecx+ebx+8],[c8],[c6] -%endmacro - -%macro PIXEL33_0 0 - mov [ecx+ebx+12],eax -%endmacro - -%macro PIXEL33_11 0 - Interp1 [ecx+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL33_12 0 - Interp1 [ecx+ebx+12],eax,[c8] -%endmacro - -%macro PIXEL33_20 0 - Interp2 [ecx+ebx+12],eax,[c8],[c6] -%endmacro - -%macro PIXEL33_50 0 - Interp5 [ecx+ebx+12],[c8],[c6] -%endmacro - -%macro PIXEL33_80 0 - Interp8 [ecx+ebx+12],eax,[c9] -%endmacro - -%macro PIXEL33_81 0 - Interp8 [ecx+ebx+12],eax,[c6] -%endmacro - -%macro PIXEL33_82 0 - Interp8 [ecx+ebx+12],eax,[c8] -%endmacro - -inbuffer equ 8 -outbuffer equ 12 -Xres equ 16 -Yres equ 20 -pitch equ 24 -offset equ 28 - -NEWSYM hq4x_32 - push ebp - mov ebp,esp - pushad - - mov esi,[ebp+inbuffer] - mov edi,[ebp+outbuffer] - mov edx,[ebp+Yres] - mov [linesleft],edx - mov ebx,[ebp+Xres] - shl ebx,1 - mov dword[prevline],0 - mov dword[nextline],ebx -.loopy - mov ecx,[ebp+Xres] - sub ecx,2 ; x={Xres-2, Xres-1} are special cases. - mov dword[xcounter],ecx - ; x=0 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx] - movq mm6,[esi] - mov ebx,[nextline] - movq mm7,[esi+ebx] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - mov [w2],edx - shr eax,16 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - mov [w5],edx - shr eax,16 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - mov [w8],edx - shr eax,16 - mov [w9],eax - jmp .flags -.loopx - mov ebx,[prevline] - movq mm5,[esi+ebx-2] - movq mm6,[esi-2] - mov ebx,[nextline] - movq mm7,[esi+ebx-2] - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - movzx edx,ax - mov [w3],edx - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - movzx edx,ax - mov [w6],edx - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - movzx edx,ax - mov [w9],edx -.flags - mov ebx,RGBtoYUV - mov eax,[w5] - xor ecx,ecx - movd mm5,[ebx+eax*4] - mov dword[cross],0 - - mov edx,[w2] - cmp eax,edx - je .noflag2 - or dword[cross],1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag2 - or ecx,2 -.noflag2 - mov edx,[w4] - cmp eax,edx - je .noflag4 - or dword[cross],2 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag4 - or ecx,8 -.noflag4 - mov edx,[w6] - cmp eax,edx - je .noflag6 - or dword[cross],4 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag6 - or ecx,16 -.noflag6 - mov edx,[w8] - cmp eax,edx - je .noflag8 - or dword[cross],8 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag8 - or ecx,64 -.noflag8 - cmp dword[cross],0 - jnz .testflag1 - mov ebx,LUT16to32 - mov eax,[ebx+eax*4] - mov ebx,[ebp+pitch] - AUXADDRESS - mov [edi],eax - mov [edi+4],eax - mov [edi+8],eax - mov [edi+12],eax - mov [edi+ebx],eax - mov [edi+ebx+4],eax - mov [edi+ebx+8],eax - mov [edi+ebx+12],eax - mov [ecx],eax - mov [ecx+4],eax - mov [ecx+8],eax - mov [ecx+12],eax - mov [ecx+ebx],eax - mov [ecx+ebx+4],eax - mov [ecx+ebx+8],eax - mov [ecx+ebx+12],eax - jmp .loopx_end -.testflag1 - mov edx,[w1] - cmp eax,edx - je .noflag1 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag1 - or ecx,1 -.noflag1 - mov edx,[w3] - cmp eax,edx - je .noflag3 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag3 - or ecx,4 -.noflag3 - mov edx,[w7] - cmp eax,edx - je .noflag7 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag7 - or ecx,32 -.noflag7 - mov edx,[w9] - cmp eax,edx - je .noflag9 - movq mm1,mm5 - movd mm2,[ebx+edx*4] - psubusb mm1,mm2 - psubusb mm2,mm5 - por mm1,mm2 - psubusb mm1,[threshold] - movd edx,mm1 - test edx,edx - jz .noflag9 - or ecx,128 -.noflag9 - mov ebx,LUT16to32 - mov eax,[ebx+eax*4] - mov edx,[w2] - mov edx,[ebx+edx*4] - mov [c2],edx - mov edx,[w4] - mov edx,[ebx+edx*4] - mov [c4],edx - mov edx,[w6] - mov edx,[ebx+edx*4] - mov [c6],edx - mov edx,[w8] - mov edx,[ebx+edx*4] - mov [c8],edx - test ecx,0x005A - jz .switch - mov edx,[w1] - mov edx,[ebx+edx*4] - mov [c1],edx - mov edx,[w3] - mov edx,[ebx+edx*4] - mov [c3],edx - mov edx,[w7] - mov edx,[ebx+edx*4] - mov [c7],edx - mov edx,[w9] - mov edx,[ebx+edx*4] - mov [c9],edx -.switch - mov ebx,[ebp+pitch] - jmp [FuncTable+ecx*4] - -..@flag0 -..@flag1 -..@flag4 -..@flag32 -..@flag128 -..@flag5 -..@flag132 -..@flag160 -..@flag33 -..@flag129 -..@flag36 -..@flag133 -..@flag164 -..@flag161 -..@flag37 -..@flag165 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag2 -..@flag34 -..@flag130 -..@flag162 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag16 -..@flag17 -..@flag48 -..@flag49 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag64 -..@flag65 -..@flag68 -..@flag69 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag8 -..@flag12 -..@flag136 -..@flag140 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag3 -..@flag35 -..@flag131 -..@flag163 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag6 -..@flag38 -..@flag134 -..@flag166 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag20 -..@flag21 -..@flag52 -..@flag53 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag144 -..@flag145 -..@flag176 -..@flag177 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag192 -..@flag193 -..@flag196 -..@flag197 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag96 -..@flag97 -..@flag100 -..@flag101 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag40 -..@flag44 -..@flag168 -..@flag172 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag9 -..@flag13 -..@flag137 -..@flag141 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag18 -..@flag50 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag80 -..@flag81 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag72 -..@flag76 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag10 -..@flag138 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag66 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag24 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag7 -..@flag39 -..@flag135 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag148 -..@flag149 -..@flag180 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag224 -..@flag228 -..@flag225 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag41 -..@flag169 -..@flag45 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag22 -..@flag54 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag208 -..@flag209 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag104 -..@flag108 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag11 -..@flag139 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag19 -..@flag51 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag146 -..@flag178 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag84 -..@flag85 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag112 -..@flag113 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag200 -..@flag204 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag73 -..@flag77 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag42 -..@flag170 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag14 -..@flag142 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag67 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag70 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag28 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag152 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag194 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag98 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag56 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag25 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag26 -..@flag31 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag82 -..@flag214 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag88 -..@flag248 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag74 -..@flag107 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag27 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag86 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag216 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag106 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag30 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag210 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag120 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag75 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag29 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_61 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag198 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag184 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_61 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag99 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag57 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag71 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_30 - PIXEL23_61 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag156 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag226 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_61 - PIXEL11_30 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag60 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag195 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag102 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag153 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag58 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag83 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag92 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag202 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag78 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag154 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag114 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag89 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag90 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag55 -..@flag23 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_30 - PIXEL23_10 - PIXEL30_20 - PIXEL31_60 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag182 -..@flag150 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_61 - PIXEL11_30 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - jmp .loopx_end -..@flag213 -..@flag212 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL20_61 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag241 -..@flag240 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_61 - PIXEL03_80 - PIXEL10_60 - PIXEL11_70 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag236 -..@flag232 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_60 - PIXEL03_20 - PIXEL10_10 - PIXEL11_30 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag109 -..@flag105 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag171 -..@flag43 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag143 -..@flag15 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_70 - PIXEL23_60 - PIXEL30_80 - PIXEL31_61 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag124 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag203 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag62 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag211 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag118 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag217 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag110 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag155 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag188 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag185 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag61 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag157 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag103 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_61 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag227 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_61 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag230 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_61 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag199 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_61 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag220 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag158 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag234 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_61 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag242 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_61 - PIXEL11_30 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag59 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag121 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag87 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL20_61 - PIXEL21_30 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag79 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_32 - PIXEL03_82 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag122 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag94 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag218 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag91 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL11_0 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag229 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_60 - PIXEL03_20 - PIXEL10_60 - PIXEL11_70 - PIXEL12_70 - PIXEL13_60 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag167 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_60 - PIXEL21_70 - PIXEL22_70 - PIXEL23_60 - PIXEL30_20 - PIXEL31_60 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag173 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag181 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag186 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag115 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag93 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - jmp .loopx_end -..@flag206 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag205 -..@flag201 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 - PIXEL22_31 - PIXEL23_81 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag174 -..@flag46 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 - PIXEL02_32 - PIXEL03_82 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag179 -..@flag147 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 - PIXEL10_81 - PIXEL11_31 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag117 -..@flag116 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 - PIXEL30_82 - PIXEL31_32 - jmp .loopx_end -..@flag189 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag231 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_32 - PIXEL03_82 - PIXEL10_81 - PIXEL11_31 - PIXEL12_32 - PIXEL13_82 - PIXEL20_82 - PIXEL21_32 - PIXEL22_31 - PIXEL23_81 - PIXEL30_82 - PIXEL31_32 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag126 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag219 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag125 - AUXADDRESS - DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag221 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL20_10 - PIXEL21_30 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag207 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 - PIXEL12_32 - PIXEL13_82 - PIXEL20_10 - PIXEL21_30 - PIXEL22_31 - PIXEL23_81 - PIXEL30_80 - PIXEL31_10 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag238 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_32 - PIXEL03_82 - PIXEL10_10 - PIXEL11_30 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 - PIXEL22_31 - PIXEL23_81 - jmp .loopx_end -..@flag190 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 - PIXEL10_10 - PIXEL11_30 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - jmp .loopx_end -..@flag187 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 - PIXEL02_10 - PIXEL03_80 - PIXEL12_30 - PIXEL13_10 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag243 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_10 - PIXEL03_80 - PIXEL10_81 - PIXEL11_31 - PIXEL12_30 - PIXEL13_10 - PIXEL20_82 - PIXEL21_32 - DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 - jmp .loopx_end -..@flag119 - AUXADDRESS - DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 - PIXEL10_81 - PIXEL11_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_30 - PIXEL23_10 - PIXEL30_82 - PIXEL31_32 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag237 -..@flag233 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_60 - PIXEL03_20 - PIXEL10_32 - PIXEL11_32 - PIXEL12_70 - PIXEL13_60 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag175 -..@flag47 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_31 - PIXEL21_31 - PIXEL22_70 - PIXEL23_60 - PIXEL30_81 - PIXEL31_81 - PIXEL32_60 - PIXEL33_20 - jmp .loopx_end -..@flag183 -..@flag151 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_60 - PIXEL21_70 - PIXEL22_32 - PIXEL23_32 - PIXEL30_20 - PIXEL31_60 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag245 -..@flag244 - AUXADDRESS - PIXEL00_20 - PIXEL01_60 - PIXEL02_81 - PIXEL03_81 - PIXEL10_60 - PIXEL11_70 - PIXEL12_31 - PIXEL13_31 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag250 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - PIXEL02_10 - PIXEL03_80 - PIXEL10_10 - PIXEL11_30 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - jmp .loopx_end -..@flag123 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag95 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL11_0 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_30 - PIXEL23_10 - PIXEL30_80 - PIXEL31_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag222 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag252 - AUXADDRESS - PIXEL00_80 - PIXEL01_61 - PIXEL02_81 - PIXEL03_81 - PIXEL10_10 - PIXEL11_30 - PIXEL12_31 - PIXEL13_31 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag249 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_61 - PIXEL03_80 - PIXEL10_32 - PIXEL11_32 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag235 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_61 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag111 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_61 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag63 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_30 - PIXEL23_10 - PIXEL30_81 - PIXEL31_81 - PIXEL32_61 - PIXEL33_80 - jmp .loopx_end -..@flag159 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_32 - PIXEL23_32 - PIXEL30_80 - PIXEL31_61 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag215 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_61 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag246 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_61 - PIXEL11_30 - PIXEL12_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag254 - AUXADDRESS - PIXEL00_80 - PIXEL01_10 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_10 - PIXEL11_30 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag253 - AUXADDRESS - PIXEL00_82 - PIXEL01_82 - PIXEL02_81 - PIXEL03_81 - PIXEL10_32 - PIXEL11_32 - PIXEL12_31 - PIXEL13_31 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag251 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_10 - PIXEL03_80 - PIXEL11_0 - PIXEL12_30 - PIXEL13_10 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - jmp .loopx_end -..@flag239 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_32 - PIXEL03_82 - PIXEL10_0 - PIXEL11_0 - PIXEL12_32 - PIXEL13_82 - PIXEL20_0 - PIXEL21_0 - PIXEL22_31 - PIXEL23_81 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_31 - PIXEL33_81 - jmp .loopx_end -..@flag127 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 - PIXEL21_0 - PIXEL22_30 - PIXEL23_10 - PIXEL32_10 - PIXEL33_80 - jmp .loopx_end -..@flag191 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_31 - PIXEL21_31 - PIXEL22_32 - PIXEL23_32 - PIXEL30_81 - PIXEL31_81 - PIXEL32_82 - PIXEL33_82 - jmp .loopx_end -..@flag223 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_10 - PIXEL21_30 - PIXEL22_0 - DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 - PIXEL30_80 - PIXEL31_10 - jmp .loopx_end -..@flag247 - AUXADDRESS - PIXEL00_81 - PIXEL01_31 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_81 - PIXEL11_31 - PIXEL12_0 - PIXEL13_0 - PIXEL20_82 - PIXEL21_32 - PIXEL22_0 - PIXEL23_0 - PIXEL30_82 - PIXEL31_32 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end -..@flag255 - AUXADDRESS - DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 - PIXEL01_0 - PIXEL02_0 - DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 - PIXEL10_0 - PIXEL11_0 - PIXEL12_0 - PIXEL13_0 - PIXEL20_0 - PIXEL21_0 - PIXEL22_0 - PIXEL23_0 - DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 - PIXEL31_0 - PIXEL32_0 - DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 - jmp .loopx_end - -.loopx_end - add esi,2 - add edi,16 - dec dword[xcounter] - jle .xres_2 - jmp .loopx -.xres_2 - ; x=Xres-2 - special case - jl .xres_1 - mov ebx,[prevline] - movq mm5,[esi+ebx-4] - movq mm6,[esi-4] - mov ebx,[nextline] - movq mm7,[esi+ebx-4] - psrlq mm5,16 - psrlq mm6,16 - psrlq mm7,16 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - psrlq mm5,32 - movd eax,mm5 - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - psrlq mm6,32 - movd eax,mm6 - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - psrlq mm7,32 - movd eax,mm7 - mov [w9],eax - jmp .flags -.xres_1 - cmp dword[xcounter],-1 - jl .nexty - ; x=Xres-1 - special case - mov ebx,[prevline] - movq mm5,[esi+ebx-6] - movq mm6,[esi-6] - mov ebx,[nextline] - movq mm7,[esi+ebx-6] - psrlq mm5,32 - psrlq mm6,32 - psrlq mm7,32 - movd eax,mm5 - movzx edx,ax - mov [w1],edx - shr eax,16 - mov [w2],eax - mov [w3],eax - movd eax,mm6 - movzx edx,ax - mov [w4],edx - shr eax,16 - mov [w5],eax - mov [w6],eax - movd eax,mm7 - movzx edx,ax - mov [w7],edx - shr eax,16 - mov [w8],eax - mov [w9],eax - jmp .flags -.nexty - add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks - add edi,ebx - add edi,ebx - add edi,ebx - add edi,ebx - mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset - shl ebx, 2 - ; can optimize this by increasing shl above - sub edi, ebx - sub edi, ebx - sub edi, ebx - sub edi, ebx - shr ebx, 1 - dec dword[linesleft] - jz .fin - add ebx, [ebp+offset]; - cmp dword[linesleft],1 - je .lastline - mov dword[nextline],ebx - neg ebx - mov dword[prevline],ebx - jmp .loopy -.lastline - mov dword[nextline],0 - neg ebx - mov dword[prevline],ebx - jmp .loopy -.fin - emms - popad - mov esp,ebp - pop ebp - ret - -SECTION .data -FuncTable - dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 - dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 - dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 - dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 - dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 - dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 - dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 - dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 - dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 - dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 - dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 - dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 - dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 - dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 - dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 - dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 - dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 - dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 - dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 - dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 - dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 - dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 - dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 - dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 - dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 - dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 - dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 - dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 - dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 - dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 - dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 - dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 - - +;hq4x filter +;32bpp output +;---------------------------------------------------------- +;Copyright (C) 2003 MaxSt ( maxst@hiend3d.com ) +; +;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. + +%include "macros.mac" + +EXTSYM LUT16to32,RGBtoYUV + +SECTION .bss +linesleft resd 1 +xcounter resd 1 +cross resd 1 +nextline resd 1 +prevline resd 1 +w1 resd 1 +w2 resd 1 +w3 resd 1 +w4 resd 1 +w5 resd 1 +w6 resd 1 +w7 resd 1 +w8 resd 1 +w9 resd 1 +c1 resd 1 +c2 resd 1 +c3 resd 1 +c4 resd 1 +c5 resd 1 +c6 resd 1 +c7 resd 1 +c8 resd 1 +c9 resd 1 + +SECTION .data + +reg_blank dd 0,0 +const3 dd 0x00030003,0x00000003 +const5 dd 0x00050005,0x00000005 +const6 dd 0x00060006,0x00000006 +const7 dd 0x00070007,0x00000007 +threshold dd 0x00300706,0x00000000 + +SECTION .text + +%macro AUXADDRESS 0 + mov ecx, edi + add ecx, ebx + add ecx, ebx +%endmacro + +%macro TestDiff 2 + mov edx,[%1] + sub edx,[%2] + jz %%fin + mov edx,[%1] + shl edx,2 + add edx,RGBtoYUV + movd mm1,[edx] + movq mm5,mm1 + mov edx,[%2] + shl edx,2 + add edx,RGBtoYUV + movd mm2,[edx] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 +%%fin: +%endmacro + +%macro DiffOrNot 4 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + jmp %%fin +%%same: + %4 +%%fin +%endmacro + +%macro DiffOrNot 8 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + jmp %%fin +%%same: + %6 + %7 + %8 +%%fin +%endmacro + +%macro DiffOrNot 10 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + %6 + jmp %%fin +%%same: + %7 + %8 + %9 + %10 +%%fin +%endmacro + +%macro DiffOrNot 14 + TestDiff %1,%2 + test edx,edx + jz %%same + %3 + %4 + %5 + %6 + %7 + %8 + jmp %%fin +%%same: + %9 + %10 + %11 + %12 + %13 + %14 +%%fin +%endmacro + +%macro Interp1 3 + mov edx,%2 + shl edx,2 + add edx,%3 + sub edx,%2 + shr edx,2 + mov %1,edx +%endmacro + +%macro Interp2 4 + mov edx,%2 + shl edx,1 + add edx,%3 + add edx,%4 + shr edx,2 + mov %1,edx +%endmacro + +%macro Interp3 2 + movd mm1, eax + movd mm2, %2 + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const7] + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, [reg_blank] + movd %1, mm1 +%endmacro + +%macro Interp5 3 + mov edx,%2 + add edx,%3 + shr edx,1 + mov %1,edx +%endmacro + +%macro Interp6 3 + movd mm1, eax + movd mm2, %2 + movd mm3, %3 + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + punpcklbw mm3, [reg_blank] + pmullw mm1, [const5] + psllw mm2, 1 + paddw mm1, mm3 + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, [reg_blank] + movd %1, mm1 +%endmacro + +%macro Interp7 3 + movd mm1, eax + movd mm2, %2 + movd mm3, %3 + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + punpcklbw mm3, [reg_blank] + pmullw mm1, [const6] + paddw mm2, mm3 + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, [reg_blank] + movd %1, mm1 +%endmacro + +%macro Interp8 3 + movd mm1, %2 + movd mm2, %3 + punpcklbw mm1, [reg_blank] + punpcklbw mm2, [reg_blank] + pmullw mm1, [const5] + pmullw mm2, [const3] + paddw mm1, mm2 + psrlw mm1, 3 + packuswb mm1, [reg_blank] + movd %1, mm1 +%endmacro + +%macro PIXEL00_0 0 + mov [edi],eax +%endmacro + +%macro PIXEL00_11 0 + Interp1 [edi],eax,[c4] +%endmacro + +%macro PIXEL00_12 0 + Interp1 [edi],eax,[c2] +%endmacro + +%macro PIXEL00_20 0 + Interp2 [edi],eax,[c2],[c4] +%endmacro + +%macro PIXEL00_50 0 + Interp5 [edi],[c2],[c4] +%endmacro + +%macro PIXEL00_80 0 + Interp8 [edi],eax,[c1] +%endmacro + +%macro PIXEL00_81 0 + Interp8 [edi],eax,[c4] +%endmacro + +%macro PIXEL00_82 0 + Interp8 [edi],eax,[c2] +%endmacro + +%macro PIXEL01_0 0 + mov [edi+4],eax +%endmacro + +%macro PIXEL01_10 0 + Interp1 [edi+4],eax,[c1] +%endmacro + +%macro PIXEL01_12 0 + Interp1 [edi+4],eax,[c2] +%endmacro + +%macro PIXEL01_14 0 + Interp1 [edi+4],[c2],eax +%endmacro + +%macro PIXEL01_21 0 + Interp2 [edi+4],[c2],eax,[c4] +%endmacro + +%macro PIXEL01_31 0 + Interp3 [edi+4],[c4] +%endmacro + +%macro PIXEL01_50 0 + Interp5 [edi+4],[c2],eax +%endmacro + +%macro PIXEL01_60 0 + Interp6 [edi+4],[c2],[c4] +%endmacro + +%macro PIXEL01_61 0 + Interp6 [edi+4],[c2],[c1] +%endmacro + +%macro PIXEL01_82 0 + Interp8 [edi+4],eax,[c2] +%endmacro + +%macro PIXEL01_83 0 + Interp8 [edi+4],[c2],[c4] +%endmacro + +%macro PIXEL02_0 0 + mov [edi+8],eax +%endmacro + +%macro PIXEL02_10 0 + Interp1 [edi+8],eax,[c3] +%endmacro + +%macro PIXEL02_11 0 + Interp1 [edi+8],eax,[c2] +%endmacro + +%macro PIXEL02_13 0 + Interp1 [edi+8],[c2],eax +%endmacro + +%macro PIXEL02_21 0 + Interp2 [edi+8],[c2],eax,[c6] +%endmacro + +%macro PIXEL02_32 0 + Interp3 [edi+8],[c6] +%endmacro + +%macro PIXEL02_50 0 + Interp5 [edi+8],[c2],eax +%endmacro + +%macro PIXEL02_60 0 + Interp6 [edi+8],[c2],[c6] +%endmacro + +%macro PIXEL02_61 0 + Interp6 [edi+8],[c2],[c3] +%endmacro + +%macro PIXEL02_81 0 + Interp8 [edi+8],eax,[c2] +%endmacro + +%macro PIXEL02_83 0 + Interp8 [edi+8],[c2],[c6] +%endmacro + +%macro PIXEL03_0 0 + mov [edi+12],eax +%endmacro + +%macro PIXEL03_11 0 + Interp1 [edi+12],eax,[c2] +%endmacro + +%macro PIXEL03_12 0 + Interp1 [edi+12],eax,[c6] +%endmacro + +%macro PIXEL03_20 0 + Interp2 [edi+12],eax,[c2],[c6] +%endmacro + +%macro PIXEL03_50 0 + Interp5 [edi+12],[c2],[c6] +%endmacro + +%macro PIXEL03_80 0 + Interp8 [edi+12],eax,[c3] +%endmacro + +%macro PIXEL03_81 0 + Interp8 [edi+12],eax,[c2] +%endmacro + +%macro PIXEL03_82 0 + Interp8 [edi+12],eax,[c6] +%endmacro + +%macro PIXEL10_0 0 + mov [edi+ebx],eax +%endmacro + +%macro PIXEL10_10 0 + Interp1 [edi+ebx],eax,[c1] +%endmacro + +%macro PIXEL10_11 0 + Interp1 [edi+ebx],eax,[c4] +%endmacro + +%macro PIXEL10_13 0 + Interp1 [edi+ebx],[c4],eax +%endmacro + +%macro PIXEL10_21 0 + Interp2 [edi+ebx],[c4],eax,[c2] +%endmacro + +%macro PIXEL10_32 0 + Interp3 [edi+ebx],[c2] +%endmacro + +%macro PIXEL10_50 0 + Interp5 [edi+ebx],[c4],eax +%endmacro + +%macro PIXEL10_60 0 + Interp6 [edi+ebx],[c4],[c2] +%endmacro + +%macro PIXEL10_61 0 + Interp6 [edi+ebx],[c4],[c1] +%endmacro + +%macro PIXEL10_81 0 + Interp8 [edi+ebx],eax,[c4] +%endmacro + +%macro PIXEL10_83 0 + Interp8 [edi+ebx],[c4],[c2] +%endmacro + +%macro PIXEL11_0 0 + mov [edi+ebx+4],eax +%endmacro + +%macro PIXEL11_30 0 + Interp3 [edi+ebx+4],[c1] +%endmacro + +%macro PIXEL11_31 0 + Interp3 [edi+ebx+4],[c4] +%endmacro + +%macro PIXEL11_32 0 + Interp3 [edi+ebx+4],[c2] +%endmacro + +%macro PIXEL11_70 0 + Interp7 [edi+ebx+4],[c4],[c2] +%endmacro + +%macro PIXEL12_0 0 + mov [edi+ebx+8],eax +%endmacro + +%macro PIXEL12_30 0 + Interp3 [edi+ebx+8],[c3] +%endmacro + +%macro PIXEL12_31 0 + Interp3 [edi+ebx+8],[c2] +%endmacro + +%macro PIXEL12_32 0 + Interp3 [edi+ebx+8],[c6] +%endmacro + +%macro PIXEL12_70 0 + Interp7 [edi+ebx+8],[c6],[c2] +%endmacro + +%macro PIXEL13_0 0 + mov [edi+ebx+12],eax +%endmacro + +%macro PIXEL13_10 0 + Interp1 [edi+ebx+12],eax,[c3] +%endmacro + +%macro PIXEL13_12 0 + Interp1 [edi+ebx+12],eax,[c6] +%endmacro + +%macro PIXEL13_14 0 + Interp1 [edi+ebx+12],[c6],eax +%endmacro + +%macro PIXEL13_21 0 + Interp2 [edi+ebx+12],[c6],eax,[c2] +%endmacro + +%macro PIXEL13_31 0 + Interp3 [edi+ebx+12],[c2] +%endmacro + +%macro PIXEL13_50 0 + Interp5 [edi+ebx+12],[c6],eax +%endmacro + +%macro PIXEL13_60 0 + Interp6 [edi+ebx+12],[c6],[c2] +%endmacro + +%macro PIXEL13_61 0 + Interp6 [edi+ebx+12],[c6],[c3] +%endmacro + +%macro PIXEL13_82 0 + Interp8 [edi+ebx+12],eax,[c6] +%endmacro + +%macro PIXEL13_83 0 + Interp8 [edi+ebx+12],[c6],[c2] +%endmacro + +%macro PIXEL20_0 0 + mov [ecx],eax +%endmacro + +%macro PIXEL20_10 0 + Interp1 [ecx],eax,[c7] +%endmacro + +%macro PIXEL20_12 0 + Interp1 [ecx],eax,[c4] +%endmacro + +%macro PIXEL20_14 0 + Interp1 [ecx],[c4],eax +%endmacro + +%macro PIXEL20_21 0 + Interp2 [ecx],[c4],eax,[c8] +%endmacro + +%macro PIXEL20_31 0 + Interp3 [ecx],[c8] +%endmacro + +%macro PIXEL20_50 0 + Interp5 [ecx],[c4],eax +%endmacro + +%macro PIXEL20_60 0 + Interp6 [ecx],[c4],[c8] +%endmacro + +%macro PIXEL20_61 0 + Interp6 [ecx],[c4],[c7] +%endmacro + +%macro PIXEL20_82 0 + Interp8 [ecx],eax,[c4] +%endmacro + +%macro PIXEL20_83 0 + Interp8 [ecx],[c4],[c8] +%endmacro + +%macro PIXEL21_0 0 + mov [ecx+4],eax +%endmacro + +%macro PIXEL21_30 0 + Interp3 [ecx+4],[c7] +%endmacro + +%macro PIXEL21_31 0 + Interp3 [ecx+4],[c8] +%endmacro + +%macro PIXEL21_32 0 + Interp3 [ecx+4],[c4] +%endmacro + +%macro PIXEL21_70 0 + Interp7 [ecx+4],[c4],[c8] +%endmacro + +%macro PIXEL22_0 0 + mov [ecx+8],eax +%endmacro + +%macro PIXEL22_30 0 + Interp3 [ecx+8],[c9] +%endmacro + +%macro PIXEL22_31 0 + Interp3 [ecx+8],[c6] +%endmacro + +%macro PIXEL22_32 0 + Interp3 [ecx+8],[c8] +%endmacro + +%macro PIXEL22_70 0 + Interp7 [ecx+8],[c6],[c8] +%endmacro + +%macro PIXEL23_0 0 + mov [ecx+12],eax +%endmacro + +%macro PIXEL23_10 0 + Interp1 [ecx+12],eax,[c9] +%endmacro + +%macro PIXEL23_11 0 + Interp1 [ecx+12],eax,[c6] +%endmacro + +%macro PIXEL23_13 0 + Interp1 [ecx+12],[c6],eax +%endmacro + +%macro PIXEL23_21 0 + Interp2 [ecx+12],[c6],eax,[c8] +%endmacro + +%macro PIXEL23_32 0 + Interp3 [ecx+12],[c8] +%endmacro + +%macro PIXEL23_50 0 + Interp5 [ecx+12],[c6],eax +%endmacro + +%macro PIXEL23_60 0 + Interp6 [ecx+12],[c6],[c8] +%endmacro + +%macro PIXEL23_61 0 + Interp6 [ecx+12],[c6],[c9] +%endmacro + +%macro PIXEL23_81 0 + Interp8 [ecx+12],eax,[c6] +%endmacro + +%macro PIXEL23_83 0 + Interp8 [ecx+12],[c6],[c8] +%endmacro + +%macro PIXEL30_0 0 + mov [ecx+ebx],eax +%endmacro + +%macro PIXEL30_11 0 + Interp1 [ecx+ebx],eax,[c8] +%endmacro + +%macro PIXEL30_12 0 + Interp1 [ecx+ebx],eax,[c4] +%endmacro + +%macro PIXEL30_20 0 + Interp2 [ecx+ebx],eax,[c8],[c4] +%endmacro + +%macro PIXEL30_50 0 + Interp5 [ecx+ebx],[c8],[c4] +%endmacro + +%macro PIXEL30_80 0 + Interp8 [ecx+ebx],eax,[c7] +%endmacro + +%macro PIXEL30_81 0 + Interp8 [ecx+ebx],eax,[c8] +%endmacro + +%macro PIXEL30_82 0 + Interp8 [ecx+ebx],eax,[c4] +%endmacro + +%macro PIXEL31_0 0 + mov [ecx+ebx+4],eax +%endmacro + +%macro PIXEL31_10 0 + Interp1 [ecx+ebx+4],eax,[c7] +%endmacro + +%macro PIXEL31_11 0 + Interp1 [ecx+ebx+4],eax,[c8] +%endmacro + +%macro PIXEL31_13 0 + Interp1 [ecx+ebx+4],[c8],eax +%endmacro + +%macro PIXEL31_21 0 + Interp2 [ecx+ebx+4],[c8],eax,[c4] +%endmacro + +%macro PIXEL31_32 0 + Interp3 [ecx+ebx+4],[c4] +%endmacro + +%macro PIXEL31_50 0 + Interp5 [ecx+ebx+4],[c8],eax +%endmacro + +%macro PIXEL31_60 0 + Interp6 [ecx+ebx+4],[c8],[c4] +%endmacro + +%macro PIXEL31_61 0 + Interp6 [ecx+ebx+4],[c8],[c7] +%endmacro + +%macro PIXEL31_81 0 + Interp8 [ecx+ebx+4],eax,[c8] +%endmacro + +%macro PIXEL31_83 0 + Interp8 [ecx+ebx+4],[c8],[c4] +%endmacro + +%macro PIXEL32_0 0 + mov [ecx+ebx+8],eax +%endmacro + +%macro PIXEL32_10 0 + Interp1 [ecx+ebx+8],eax,[c9] +%endmacro + +%macro PIXEL32_12 0 + Interp1 [ecx+ebx+8],eax,[c8] +%endmacro + +%macro PIXEL32_14 0 + Interp1 [ecx+ebx+8],[c8],eax +%endmacro + +%macro PIXEL32_21 0 + Interp2 [ecx+ebx+8],[c8],eax,[c6] +%endmacro + +%macro PIXEL32_31 0 + Interp3 [ecx+ebx+8],[c6] +%endmacro + +%macro PIXEL32_50 0 + Interp5 [ecx+ebx+8],[c8],eax +%endmacro + +%macro PIXEL32_60 0 + Interp6 [ecx+ebx+8],[c8],[c6] +%endmacro + +%macro PIXEL32_61 0 + Interp6 [ecx+ebx+8],[c8],[c9] +%endmacro + +%macro PIXEL32_82 0 + Interp8 [ecx+ebx+8],eax,[c8] +%endmacro + +%macro PIXEL32_83 0 + Interp8 [ecx+ebx+8],[c8],[c6] +%endmacro + +%macro PIXEL33_0 0 + mov [ecx+ebx+12],eax +%endmacro + +%macro PIXEL33_11 0 + Interp1 [ecx+ebx+12],eax,[c6] +%endmacro + +%macro PIXEL33_12 0 + Interp1 [ecx+ebx+12],eax,[c8] +%endmacro + +%macro PIXEL33_20 0 + Interp2 [ecx+ebx+12],eax,[c8],[c6] +%endmacro + +%macro PIXEL33_50 0 + Interp5 [ecx+ebx+12],[c8],[c6] +%endmacro + +%macro PIXEL33_80 0 + Interp8 [ecx+ebx+12],eax,[c9] +%endmacro + +%macro PIXEL33_81 0 + Interp8 [ecx+ebx+12],eax,[c6] +%endmacro + +%macro PIXEL33_82 0 + Interp8 [ecx+ebx+12],eax,[c8] +%endmacro + +inbuffer equ 8 +outbuffer equ 12 +Xres equ 16 +Yres equ 20 +pitch equ 24 +offset equ 28 + +NEWSYM hq4x_32 + push ebp + mov ebp,esp + pushad + + mov esi,[ebp+inbuffer] + mov edi,[ebp+outbuffer] + mov edx,[ebp+Yres] + mov [linesleft],edx + mov ebx,[ebp+Xres] + shl ebx,1 + mov dword[prevline],0 + mov dword[nextline],ebx +.loopy + mov ecx,[ebp+Xres] + sub ecx,2 ; x={Xres-2, Xres-1} are special cases. + mov dword[xcounter],ecx + ; x=0 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx] + movq mm6,[esi] + mov ebx,[nextline] + movq mm7,[esi+ebx] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + mov [w2],edx + shr eax,16 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + mov [w5],edx + shr eax,16 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + mov [w8],edx + shr eax,16 + mov [w9],eax + jmp .flags +.loopx + mov ebx,[prevline] + movq mm5,[esi+ebx-2] + movq mm6,[esi-2] + mov ebx,[nextline] + movq mm7,[esi+ebx-2] + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + movzx edx,ax + mov [w3],edx + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + movzx edx,ax + mov [w6],edx + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + movzx edx,ax + mov [w9],edx +.flags + mov ebx,RGBtoYUV + mov eax,[w5] + xor ecx,ecx + movd mm5,[ebx+eax*4] + mov dword[cross],0 + + mov edx,[w2] + cmp eax,edx + je .noflag2 + or dword[cross],1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag2 + or ecx,2 +.noflag2 + mov edx,[w4] + cmp eax,edx + je .noflag4 + or dword[cross],2 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag4 + or ecx,8 +.noflag4 + mov edx,[w6] + cmp eax,edx + je .noflag6 + or dword[cross],4 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag6 + or ecx,16 +.noflag6 + mov edx,[w8] + cmp eax,edx + je .noflag8 + or dword[cross],8 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag8 + or ecx,64 +.noflag8 + cmp dword[cross],0 + jnz .testflag1 + mov ebx,LUT16to32 + mov eax,[ebx+eax*4] + mov ebx,[ebp+pitch] + AUXADDRESS + mov [edi],eax + mov [edi+4],eax + mov [edi+8],eax + mov [edi+12],eax + mov [edi+ebx],eax + mov [edi+ebx+4],eax + mov [edi+ebx+8],eax + mov [edi+ebx+12],eax + mov [ecx],eax + mov [ecx+4],eax + mov [ecx+8],eax + mov [ecx+12],eax + mov [ecx+ebx],eax + mov [ecx+ebx+4],eax + mov [ecx+ebx+8],eax + mov [ecx+ebx+12],eax + jmp .loopx_end +.testflag1 + mov edx,[w1] + cmp eax,edx + je .noflag1 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag1 + or ecx,1 +.noflag1 + mov edx,[w3] + cmp eax,edx + je .noflag3 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag3 + or ecx,4 +.noflag3 + mov edx,[w7] + cmp eax,edx + je .noflag7 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag7 + or ecx,32 +.noflag7 + mov edx,[w9] + cmp eax,edx + je .noflag9 + movq mm1,mm5 + movd mm2,[ebx+edx*4] + psubusb mm1,mm2 + psubusb mm2,mm5 + por mm1,mm2 + psubusb mm1,[threshold] + movd edx,mm1 + test edx,edx + jz .noflag9 + or ecx,128 +.noflag9 + mov ebx,LUT16to32 + mov eax,[ebx+eax*4] + mov edx,[w2] + mov edx,[ebx+edx*4] + mov [c2],edx + mov edx,[w4] + mov edx,[ebx+edx*4] + mov [c4],edx + mov edx,[w6] + mov edx,[ebx+edx*4] + mov [c6],edx + mov edx,[w8] + mov edx,[ebx+edx*4] + mov [c8],edx + test ecx,0x005A + jz .switch + mov edx,[w1] + mov edx,[ebx+edx*4] + mov [c1],edx + mov edx,[w3] + mov edx,[ebx+edx*4] + mov [c3],edx + mov edx,[w7] + mov edx,[ebx+edx*4] + mov [c7],edx + mov edx,[w9] + mov edx,[ebx+edx*4] + mov [c9],edx +.switch + mov ebx,[ebp+pitch] + jmp [FuncTable+ecx*4] + +..@flag0 +..@flag1 +..@flag4 +..@flag32 +..@flag128 +..@flag5 +..@flag132 +..@flag160 +..@flag33 +..@flag129 +..@flag36 +..@flag133 +..@flag164 +..@flag161 +..@flag37 +..@flag165 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag2 +..@flag34 +..@flag130 +..@flag162 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag16 +..@flag17 +..@flag48 +..@flag49 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag64 +..@flag65 +..@flag68 +..@flag69 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag8 +..@flag12 +..@flag136 +..@flag140 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag3 +..@flag35 +..@flag131 +..@flag163 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag6 +..@flag38 +..@flag134 +..@flag166 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag20 +..@flag21 +..@flag52 +..@flag53 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag144 +..@flag145 +..@flag176 +..@flag177 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag192 +..@flag193 +..@flag196 +..@flag197 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag96 +..@flag97 +..@flag100 +..@flag101 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag40 +..@flag44 +..@flag168 +..@flag172 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag9 +..@flag13 +..@flag137 +..@flag141 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag18 +..@flag50 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_50,PIXEL03_50,PIXEL12_0,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag80 +..@flag81 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag72 +..@flag76 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_50,PIXEL21_0,PIXEL30_50,PIXEL31_50 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag10 +..@flag138 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_50,PIXEL10_50,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag66 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag24 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag7 +..@flag39 +..@flag135 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag148 +..@flag149 +..@flag180 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag224 +..@flag228 +..@flag225 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag41 +..@flag169 +..@flag45 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag22 +..@flag54 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag208 +..@flag209 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag104 +..@flag108 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag11 +..@flag139 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag19 +..@flag51 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag146 +..@flag178 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + jmp .loopx_end +..@flag84 +..@flag85 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag112 +..@flag113 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL30_82,PIXEL31_32,PIXEL32_10,PIXEL33_80,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag200 +..@flag204 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag73 +..@flag77 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag42 +..@flag170 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag14 +..@flag142 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL02_32,PIXEL03_82,PIXEL10_10,PIXEL11_30,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag67 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag70 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag28 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag152 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag194 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag98 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag56 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag25 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag26 +..@flag31 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag82 +..@flag214 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag88 +..@flag248 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag74 +..@flag107 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag27 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag86 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag216 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag106 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag30 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag210 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag120 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag75 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag29 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag198 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag184 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag99 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag57 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag71 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag156 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag226 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag60 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag195 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag102 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag153 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag58 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag83 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag92 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag202 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag78 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag154 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag114 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag89 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag90 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag55 +..@flag23 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag182 +..@flag150 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + jmp .loopx_end +..@flag213 +..@flag212 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag241 +..@flag240 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag236 +..@flag232 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag109 +..@flag105 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag171 +..@flag43 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag143 +..@flag15 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag124 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag203 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag62 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag211 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag118 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag217 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag110 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag155 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag188 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag185 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag61 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag157 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag103 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag227 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag230 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag199 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag220 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag158 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag234 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag242 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag59 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL11_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag121 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag87 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag79 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_32 + PIXEL03_82 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag122 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag94 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag218 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag91 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL11_0 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag229 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag167 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag173 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag181 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag186 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag115 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag93 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + jmp .loopx_end +..@flag206 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag205 +..@flag201 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + DiffOrNot w8,w4,PIXEL20_10,PIXEL21_30,PIXEL30_80,PIXEL31_10,PIXEL20_12,PIXEL21_0,PIXEL30_20,PIXEL31_11 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag174 +..@flag46 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_80,PIXEL01_10,PIXEL10_10,PIXEL11_30,PIXEL00_20,PIXEL01_12,PIXEL10_11,PIXEL11_0 + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag179 +..@flag147 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + DiffOrNot w2,w6,PIXEL02_10,PIXEL03_80,PIXEL12_30,PIXEL13_10,PIXEL02_11,PIXEL03_20,PIXEL12_0,PIXEL13_12 + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag117 +..@flag116 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_30,PIXEL23_10,PIXEL32_10,PIXEL33_80,PIXEL22_0,PIXEL23_11,PIXEL32_12,PIXEL33_20 + PIXEL30_82 + PIXEL31_32 + jmp .loopx_end +..@flag189 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag231 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag126 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag219 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag125 + AUXADDRESS + DiffOrNot w8,w4,PIXEL00_82,PIXEL10_32,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL00_11,PIXEL10_13,PIXEL20_83,PIXEL21_70,PIXEL30_50,PIXEL31_21 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag221 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + DiffOrNot w6,w8,PIXEL03_81,PIXEL13_31,PIXEL22_0,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL03_12,PIXEL13_14,PIXEL22_70,PIXEL23_83,PIXEL32_21,PIXEL33_50 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag207 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL02_32,PIXEL03_82,PIXEL10_0,PIXEL11_0,PIXEL00_50,PIXEL01_83,PIXEL02_13,PIXEL03_11,PIXEL10_21,PIXEL11_70 + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag238 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL21_0,PIXEL30_0,PIXEL31_0,PIXEL32_31,PIXEL33_81,PIXEL20_21,PIXEL21_70,PIXEL30_50,PIXEL31_83,PIXEL32_14,PIXEL33_12 + PIXEL22_31 + PIXEL23_81 + jmp .loopx_end +..@flag190 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL23_32,PIXEL33_82,PIXEL02_21,PIXEL03_50,PIXEL12_70,PIXEL13_83,PIXEL23_13,PIXEL33_11 + PIXEL10_10 + PIXEL11_30 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + jmp .loopx_end +..@flag187 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL11_0,PIXEL20_31,PIXEL30_81,PIXEL00_50,PIXEL01_21,PIXEL10_83,PIXEL11_70,PIXEL20_14,PIXEL30_12 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag243 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + DiffOrNot w6,w8,PIXEL22_0,PIXEL23_0,PIXEL30_82,PIXEL31_32,PIXEL32_0,PIXEL33_0,PIXEL22_70,PIXEL23_21,PIXEL30_11,PIXEL31_13,PIXEL32_83,PIXEL33_50 + jmp .loopx_end +..@flag119 + AUXADDRESS + DiffOrNot w2,w6,PIXEL00_81,PIXEL01_31,PIXEL02_0,PIXEL03_0,PIXEL12_0,PIXEL13_0,PIXEL00_12,PIXEL01_14,PIXEL02_83,PIXEL03_50,PIXEL12_70,PIXEL13_21 + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag237 +..@flag233 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag175 +..@flag47 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + jmp .loopx_end +..@flag183 +..@flag151 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag245 +..@flag244 + AUXADDRESS + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag250 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + jmp .loopx_end +..@flag123 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag95 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag222 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag252 + AUXADDRESS + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag249 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + jmp .loopx_end +..@flag235 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag111 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag63 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + jmp .loopx_end +..@flag159 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag215 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag246 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag254 + AUXADDRESS + PIXEL00_80 + PIXEL01_10 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag253 + AUXADDRESS + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag251 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + jmp .loopx_end +..@flag239 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + jmp .loopx_end +..@flag127 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + DiffOrNot w2,w6,PIXEL02_0,PIXEL03_0,PIXEL13_0,PIXEL02_50,PIXEL03_50,PIXEL13_50 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + DiffOrNot w8,w4,PIXEL20_0,PIXEL30_0,PIXEL31_0,PIXEL20_50,PIXEL30_50,PIXEL31_50 + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + jmp .loopx_end +..@flag191 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + jmp .loopx_end +..@flag223 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL01_0,PIXEL10_0,PIXEL00_50,PIXEL01_50,PIXEL10_50 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + DiffOrNot w6,w8,PIXEL23_0,PIXEL32_0,PIXEL33_0,PIXEL23_50,PIXEL32_50,PIXEL33_50 + PIXEL30_80 + PIXEL31_10 + jmp .loopx_end +..@flag247 + AUXADDRESS + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end +..@flag255 + AUXADDRESS + DiffOrNot w4,w2,PIXEL00_0,PIXEL00_20 + PIXEL01_0 + PIXEL02_0 + DiffOrNot w2,w6,PIXEL03_0,PIXEL03_20 + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + DiffOrNot w8,w4,PIXEL30_0,PIXEL30_20 + PIXEL31_0 + PIXEL32_0 + DiffOrNot w6,w8,PIXEL33_0,PIXEL33_20 + jmp .loopx_end + +.loopx_end + add esi,2 + add edi,16 + dec dword[xcounter] + jle .xres_2 + jmp .loopx +.xres_2 + ; x=Xres-2 - special case + jl .xres_1 + mov ebx,[prevline] + movq mm5,[esi+ebx-4] + movq mm6,[esi-4] + mov ebx,[nextline] + movq mm7,[esi+ebx-4] + psrlq mm5,16 + psrlq mm6,16 + psrlq mm7,16 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + psrlq mm5,32 + movd eax,mm5 + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + psrlq mm6,32 + movd eax,mm6 + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + psrlq mm7,32 + movd eax,mm7 + mov [w9],eax + jmp .flags +.xres_1 + cmp dword[xcounter],-1 + jl .nexty + ; x=Xres-1 - special case + mov ebx,[prevline] + movq mm5,[esi+ebx-6] + movq mm6,[esi-6] + mov ebx,[nextline] + movq mm7,[esi+ebx-6] + psrlq mm5,32 + psrlq mm6,32 + psrlq mm7,32 + movd eax,mm5 + movzx edx,ax + mov [w1],edx + shr eax,16 + mov [w2],eax + mov [w3],eax + movd eax,mm6 + movzx edx,ax + mov [w4],edx + shr eax,16 + mov [w5],eax + mov [w6],eax + movd eax,mm7 + movzx edx,ax + mov [w7],edx + shr eax,16 + mov [w8],eax + mov [w9],eax + jmp .flags +.nexty + add esi,[ebp+offset] ; added - move source pointer past end-of-line blanks + add edi,ebx + add edi,ebx + add edi,ebx + add edi,ebx + mov ebx, [ebp+Xres] ; added, bug - need to add to destination offset + shl ebx, 2 + ; can optimize this by increasing shl above + sub edi, ebx + sub edi, ebx + sub edi, ebx + sub edi, ebx + shr ebx, 1 + dec dword[linesleft] + jz .fin + add ebx, [ebp+offset]; + cmp dword[linesleft],1 + je .lastline + mov dword[nextline],ebx + neg ebx + mov dword[prevline],ebx + jmp .loopy +.lastline + mov dword[nextline],0 + neg ebx + mov dword[prevline],ebx + jmp .loopy +.fin + emms + popad + mov esp,ebp + pop ebp + ret + +SECTION .data +FuncTable + dd ..@flag0, ..@flag1, ..@flag2, ..@flag3, ..@flag4, ..@flag5, ..@flag6, ..@flag7 + dd ..@flag8, ..@flag9, ..@flag10, ..@flag11, ..@flag12, ..@flag13, ..@flag14, ..@flag15 + dd ..@flag16, ..@flag17, ..@flag18, ..@flag19, ..@flag20, ..@flag21, ..@flag22, ..@flag23 + dd ..@flag24, ..@flag25, ..@flag26, ..@flag27, ..@flag28, ..@flag29, ..@flag30, ..@flag31 + dd ..@flag32, ..@flag33, ..@flag34, ..@flag35, ..@flag36, ..@flag37, ..@flag38, ..@flag39 + dd ..@flag40, ..@flag41, ..@flag42, ..@flag43, ..@flag44, ..@flag45, ..@flag46, ..@flag47 + dd ..@flag48, ..@flag49, ..@flag50, ..@flag51, ..@flag52, ..@flag53, ..@flag54, ..@flag55 + dd ..@flag56, ..@flag57, ..@flag58, ..@flag59, ..@flag60, ..@flag61, ..@flag62, ..@flag63 + dd ..@flag64, ..@flag65, ..@flag66, ..@flag67, ..@flag68, ..@flag69, ..@flag70, ..@flag71 + dd ..@flag72, ..@flag73, ..@flag74, ..@flag75, ..@flag76, ..@flag77, ..@flag78, ..@flag79 + dd ..@flag80, ..@flag81, ..@flag82, ..@flag83, ..@flag84, ..@flag85, ..@flag86, ..@flag87 + dd ..@flag88, ..@flag89, ..@flag90, ..@flag91, ..@flag92, ..@flag93, ..@flag94, ..@flag95 + dd ..@flag96, ..@flag97, ..@flag98, ..@flag99, ..@flag100, ..@flag101, ..@flag102, ..@flag103 + dd ..@flag104, ..@flag105, ..@flag106, ..@flag107, ..@flag108, ..@flag109, ..@flag110, ..@flag111 + dd ..@flag112, ..@flag113, ..@flag114, ..@flag115, ..@flag116, ..@flag117, ..@flag118, ..@flag119 + dd ..@flag120, ..@flag121, ..@flag122, ..@flag123, ..@flag124, ..@flag125, ..@flag126, ..@flag127 + dd ..@flag128, ..@flag129, ..@flag130, ..@flag131, ..@flag132, ..@flag133, ..@flag134, ..@flag135 + dd ..@flag136, ..@flag137, ..@flag138, ..@flag139, ..@flag140, ..@flag141, ..@flag142, ..@flag143 + dd ..@flag144, ..@flag145, ..@flag146, ..@flag147, ..@flag148, ..@flag149, ..@flag150, ..@flag151 + dd ..@flag152, ..@flag153, ..@flag154, ..@flag155, ..@flag156, ..@flag157, ..@flag158, ..@flag159 + dd ..@flag160, ..@flag161, ..@flag162, ..@flag163, ..@flag164, ..@flag165, ..@flag166, ..@flag167 + dd ..@flag168, ..@flag169, ..@flag170, ..@flag171, ..@flag172, ..@flag173, ..@flag174, ..@flag175 + dd ..@flag176, ..@flag177, ..@flag178, ..@flag179, ..@flag180, ..@flag181, ..@flag182, ..@flag183 + dd ..@flag184, ..@flag185, ..@flag186, ..@flag187, ..@flag188, ..@flag189, ..@flag190, ..@flag191 + dd ..@flag192, ..@flag193, ..@flag194, ..@flag195, ..@flag196, ..@flag197, ..@flag198, ..@flag199 + dd ..@flag200, ..@flag201, ..@flag202, ..@flag203, ..@flag204, ..@flag205, ..@flag206, ..@flag207 + dd ..@flag208, ..@flag209, ..@flag210, ..@flag211, ..@flag212, ..@flag213, ..@flag214, ..@flag215 + dd ..@flag216, ..@flag217, ..@flag218, ..@flag219, ..@flag220, ..@flag221, ..@flag222, ..@flag223 + dd ..@flag224, ..@flag225, ..@flag226, ..@flag227, ..@flag228, ..@flag229, ..@flag230, ..@flag231 + dd ..@flag232, ..@flag233, ..@flag234, ..@flag235, ..@flag236, ..@flag237, ..@flag238, ..@flag239 + dd ..@flag240, ..@flag241, ..@flag242, ..@flag243, ..@flag244, ..@flag245, ..@flag246, ..@flag247 + dd ..@flag248, ..@flag249, ..@flag250, ..@flag251, ..@flag252, ..@flag253, ..@flag254, ..@flag255 + + diff --git a/src/hq_shared32.cpp b/src/hq_shared32.cpp index 4ec3b1f8..66a85936 100644 --- a/src/hq_shared32.cpp +++ b/src/hq_shared32.cpp @@ -134,7 +134,7 @@ 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) { #ifdef _MSC_VER -#ifdef MMX +#ifdef MMX __asm { mov eax, pc @@ -290,7 +290,7 @@ bool Diff(unsigned int c1, unsigned int c2) pcmpgtd mm4, trV por mm2, mm3 por mm2, mm4 - + movd retval, mm2 EMMS diff --git a/src/hq_shared32.h b/src/hq_shared32.h index 4aab0894..a90500fe 100644 --- a/src/hq_shared32.h +++ b/src/hq_shared32.h @@ -1,90 +1,90 @@ -// 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 SIZE_PIXEL 4 // 32bit = 4 bytes - -#define abs32(value) (value & 0x7FFFFFFF) - -#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 *((unsigned int*)(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 *((unsigned int*)(pOut+4)) = 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 *((unsigned int*)(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 *((unsigned int*)(pOut+dstPitch)) = c[5]; - -#define PIXEL11 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; - -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); -bool Diff(unsigned int c1, unsigned int c2); -unsigned int RGBtoYUV(unsigned int 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. + +#define SIZE_PIXEL 4 // 32bit = 4 bytes + +#define abs32(value) (value & 0x7FFFFFFF) + +#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 *((unsigned int*)(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 *((unsigned int*)(pOut+4)) = 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 *((unsigned int*)(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 *((unsigned int*)(pOut+dstPitch)) = c[5]; + +#define PIXEL11 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(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 *((unsigned int*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +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); +bool Diff(unsigned int c1, unsigned int c2); +unsigned int RGBtoYUV(unsigned int c); diff --git a/src/interframe.cpp b/src/interframe.cpp index e4a17227..47dadbec 100644 --- a/src/interframe.cpp +++ b/src/interframe.cpp @@ -65,9 +65,9 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) 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 ( @@ -97,15 +97,15 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) "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" @@ -126,7 +126,7 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) 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 qword ptr [edx], mm0; // src3 = src0 movq mm4, mm0; movq mm5, mm1; pcmpeqw mm5, mm2; // src1 == src2 (A) @@ -145,10 +145,10 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) 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; @@ -168,12 +168,12 @@ static void SmartIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) src2+=2; src3+=2; } - + /* Swap buffers around */ u8 *temp = frm1; frm1 = frm3; frm3 = frm2; - frm2 = temp; + frm2 = temp; } #endif @@ -190,7 +190,7 @@ void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int height) #endif u16 colorMask = ~RGB_LOW_BITS_MASK; - + u16 *src0 = (u16 *)srcPtr; u16 *src1 = (u16 *)frm1; u16 *src2 = (u16 *)frm2; @@ -211,7 +211,7 @@ void SmartIB(u8 *srcPtr, u32 srcPitch, int width, int height) src3[pos] = color; /* oldest buffer now holds newest frame */ pos++; } - + /* Swap buffers around */ u8 *temp = frm1; frm1 = frm3; @@ -228,9 +228,9 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) u32 *src3 = (u32 *)frm3; int count = width >> 1; - + for(int i = 0; i < height; i++) { -#ifdef __GNUC__ +#ifdef __GNUC__ asm volatile ( "push %4\n" "movq 0(%5), %%mm7\n" // colorMask @@ -258,15 +258,15 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) "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" @@ -287,7 +287,7 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) 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 qword ptr [edx], mm0; // src3 = src0 movq mm4, mm0; movq mm5, mm1; pcmpeqd mm5, mm2; // src1 == src2 (A) @@ -306,10 +306,10 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) 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; @@ -324,7 +324,7 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) emms; } #endif - + src0++; src1++; src2++; @@ -334,7 +334,7 @@ static void SmartIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) u8 *temp = frm1; frm1 = frm3; frm3 = frm2; - frm2 = temp; + frm2 = temp; } #endif @@ -349,7 +349,7 @@ void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int height) return; } #endif - + u32 *src0 = (u32 *)srcPtr; u32 *src1 = (u32 *)frm1; u32 *src2 = (u32 *)frm2; @@ -372,7 +372,7 @@ void SmartIB32(u8 *srcPtr, u32 srcPitch, int width, int height) src3[pos] = color; /* oldest buffer now holds newest frame */ pos++; } - + /* Swap buffers around */ u8 *temp = frm1; frm1 = frm3; @@ -387,9 +387,9 @@ static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) u16 *src1 = (u16 *)frm1; int count = width >> 2; - + for(int i = 0; i < height; i++) { -#ifdef __GNUC__ +#ifdef __GNUC__ asm volatile ( "push %2\n" "movq 0(%3), %%mm7\n" // colorMask @@ -404,10 +404,10 @@ static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) "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" @@ -432,7 +432,7 @@ static void MotionBlurIB_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) paddw mm0, mm1; // E+F movq qword ptr [eax], mm0; // src0 = res - + add eax, 8; add ebx, 8; @@ -461,9 +461,9 @@ void MotionBlurIB(u8 *srcPtr, u32 srcPitch, int width, int height) return; } #endif - + u16 colorMask = ~RGB_LOW_BITS_MASK; - + u16 *src0 = (u16 *)srcPtr; u16 *src1 = (u16 *)frm1; @@ -486,10 +486,10 @@ static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) u32 *src0 = (u32 *)srcPtr; u32 *src1 = (u32 *)frm1; - int count = width >> 1; + int count = width >> 1; for(int i = 0; i < height; i++) { -#ifdef __GNUC__ +#ifdef __GNUC__ asm volatile ( "push %2\n" "movq 0(%3), %%mm7\n" // colorMask @@ -504,10 +504,10 @@ static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) "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" @@ -532,7 +532,7 @@ static void MotionBlurIB32_MMX(u8 *srcPtr, u32 srcPitch, int width, int height) paddd mm0, mm1; // E+F movq qword ptr [eax], mm0; // src0 = res - + add eax, 8; add ebx, 8; @@ -561,7 +561,7 @@ void MotionBlurIB32(u8 *srcPtr, u32 srcPitch, int width, int height) return; } #endif - + u32 *src0 = (u32 *)srcPtr; u32 *src1 = (u32 *)frm1; diff --git a/src/libresample-0.1.3/src/filterkit.c b/src/libresample-0.1.3/src/filterkit.c index bc92285f..4038f312 100644 --- a/src/libresample-0.1.3/src/filterkit.c +++ b/src/libresample-0.1.3/src/filterkit.c @@ -93,11 +93,11 @@ void lrsLpFilter(double c[], int N, double frq, double Beta, int Num) c[i] = sin(2.0*temp*frq)/temp; /* Analog sinc function, cutoff = frq */ } - /* + /* * Calculate and Apply Kaiser window to ideal lowpass filter. * Note: last window value is IBeta which is NOT zero. * You're supposed to really truncate the window here, not ramp - * it to zero. This helps reduce the first sidelobe. + * it to zero. This helps reduce the first sidelobe. */ IBeta = 1.0/Izero(Beta); inm1 = 1.0/((double)(N-1)); @@ -125,7 +125,7 @@ float lrsFilterUp(float Imp[], /* impulse response */ float v, t; Ph *= Npc; /* Npc is number of values per 1/delta in impulse response */ - + v = 0.0; /* The output value */ Hp = &Imp[(int)Ph]; End = &Imp[Nwing]; @@ -153,8 +153,8 @@ float lrsFilterUp(float Imp[], /* impulse response */ v += t; /* The filter output */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ - } - else + } + else while (Hp < End) { t = *Hp; /* Get filter coeff */ t *= *Xp; /* Mult coeff by input sample */ @@ -162,7 +162,7 @@ float lrsFilterUp(float Imp[], /* impulse response */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } - + return v; } @@ -179,7 +179,7 @@ float lrsFilterUD(float Imp[], /* impulse response */ float *Hp, *Hdp, *End; float v, t; double Ho; - + v = 0.0; /* The output value */ Ho = Ph*dhb; End = &Imp[Nwing]; @@ -202,7 +202,7 @@ float lrsFilterUD(float Imp[], /* impulse response */ Ho += dhb; /* IR step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } - else + else while ((Hp = &Imp[(int)Ho]) < End) { t = *Hp; /* Get IR sample */ t *= *Xp; /* Mult coeff by input sample */ diff --git a/src/libresample-0.1.3/src/resample.c b/src/libresample-0.1.3/src/resample.c index 405bdd9d..bf586d42 100644 --- a/src/libresample-0.1.3/src/resample.c +++ b/src/libresample-0.1.3/src/resample.c @@ -73,7 +73,7 @@ void *resample_dup(const void * handle) memcpy(hp->Y, cpy->Y, hp->YSize * sizeof(float)); hp->Yp = cpy->Yp; hp->Time = cpy->Time; - + return (void *)hp; } @@ -100,7 +100,7 @@ void *resample_open(int highQuality, double minFactor, double maxFactor) hp->minFactor = minFactor; hp->maxFactor = maxFactor; - + if (highQuality) hp->Nmult = 35; else @@ -145,7 +145,7 @@ void *resample_open(int highQuality, double minFactor, double maxFactor) hp->X = (float *)malloc((hp->XSize + hp->Xoff) * sizeof(float)); hp->Xp = hp->Xoff; hp->Xread = hp->Xoff; - + /* Need Xoff zeros at begining of X buffer */ for(i=0; iXoff; i++) hp->X[i]=0; @@ -157,7 +157,7 @@ void *resample_open(int highQuality, double minFactor, double maxFactor) hp->Yp = 0; hp->Time = (double)hp->Xoff; /* Current-time pointer for converter */ - + return (void *)hp; } @@ -280,7 +280,7 @@ int resample_process(void *handle, #ifdef DEBUG printf("Nout: %d\n", Nout); #endif - + hp->Time -= Nx; /* Move converter Nx samples back in time */ hp->Xp += Nx; /* Advance by number of samples processed */ @@ -303,7 +303,7 @@ int resample_process(void *handle, hp->Xread = Nreuse; /* Pos in input buff to read new data into */ hp->Xp = hp->Xoff; - + /* Check to see if output buff overflowed (shouldn't happen!) */ if (Nout > hp->YSize) { #ifdef DEBUG diff --git a/src/libresample-0.1.3/src/resamplesubs.c b/src/libresample-0.1.3/src/resamplesubs.c index c3c095dc..24103eb0 100644 --- a/src/libresample-0.1.3/src/resamplesubs.c +++ b/src/libresample-0.1.3/src/resamplesubs.c @@ -40,13 +40,13 @@ int lrsSrcUp(float X[], { float *Xp, *Ystart; float v; - + double CurrentTime = *TimePtr; - double dt; /* Step through input signal */ + double dt; /* Step through input signal */ double endTime; /* When Time reaches EndTime, return to user */ - + dt = 1.0/factor; /* Output sampling period */ - + Ystart = Y; endTime = CurrentTime + Nx; while (CurrentTime < endTime) @@ -59,7 +59,7 @@ int lrsSrcUp(float X[], v = lrsFilterUp(Imp, ImpD, Nwing, Interp, Xp, LeftPhase, -1); /* Perform right-wing inner product */ - v += lrsFilterUp(Imp, ImpD, Nwing, Interp, Xp+1, + v += lrsFilterUp(Imp, ImpD, Nwing, Interp, Xp+1, RightPhase, 1); v *= LpScl; /* Normalize for unity filter gain */ @@ -92,11 +92,11 @@ int lrsSrcUD(float X[], double dh; /* Step through filter impulse response */ double dt; /* Step through input signal */ double endTime; /* When Time reaches EndTime, return to user */ - + dt = 1.0/factor; /* Output sampling period */ - + dh = MIN(Npc, factor*Npc); /* Filter sampling period */ - + Ystart = Y; endTime = CurrentTime + Nx; while (CurrentTime < endTime) @@ -109,12 +109,12 @@ int lrsSrcUD(float X[], v = lrsFilterUD(Imp, ImpD, Nwing, Interp, Xp, LeftPhase, -1, dh); /* Perform right-wing inner product */ - v += lrsFilterUD(Imp, ImpD, Nwing, Interp, Xp+1, + v += lrsFilterUD(Imp, ImpD, Nwing, Interp, Xp+1, RightPhase, 1, dh); v *= LpScl; /* Normalize for unity filter gain */ *Y++ = v; /* Deposit output */ - + CurrentTime += dt; /* Move to next sample by time increment */ } diff --git a/src/libresample-0.1.3/tests/resample-sndfile.c b/src/libresample-0.1.3/tests/resample-sndfile.c index e780228c..099fb993 100644 --- a/src/libresample-0.1.3/tests/resample-sndfile.c +++ b/src/libresample-0.1.3/tests/resample-sndfile.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) dstinfo.format = formatinfo.format | (srcinfo.format & SF_FORMAT_SUBMASK); break; - } + } } } diff --git a/src/libresample-0.1.3/tests/testresample.c b/src/libresample-0.1.3/tests/testresample.c index a59aa8bf..6beab547 100644 --- a/src/libresample-0.1.3/tests/testresample.c +++ b/src/libresample-0.1.3/tests/testresample.c @@ -79,7 +79,7 @@ void runtest(int srclen, double freq, double factor, printf(" Expected ~%d, got %d samples out\n", expectedlen, out); } - + sum = 0.0; sumsq = 0.0; errcount = 0.0; diff --git a/src/lq2x.h b/src/lq2x.h index b0053556..094c2b5a 100644 --- a/src/lq2x.h +++ b/src/lq2x.h @@ -1,141 +1,141 @@ -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 : +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 : +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 : +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 : +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 : +case 10 : +case 138 : { P1 = IC(0); P2 = IC(0); @@ -146,12 +146,12 @@ case 138 : P0 = I211(0, 1, 3); } } break; -case 11 : -case 27 : -case 75 : -case 139 : -case 155 : -case 203 : +case 11 : +case 27 : +case 75 : +case 139 : +case 155 : +case 203 : { P1 = IC(2); P2 = IC(2); @@ -162,8 +162,8 @@ case 203 : P0 = I211(2, 1, 3); } } break; -case 14 : -case 142 : +case 14 : +case 142 : { P2 = IC(0); P3 = IC(0); @@ -175,9 +175,9 @@ case 142 : P1 = I31(0, 1); } } break; -case 15 : -case 143 : -case 207 : +case 15 : +case 143 : +case 207 : { P2 = IC(4); P3 = IC(4); @@ -189,14 +189,14 @@ case 207 : P1 = I31(4, 1); } } break; -case 18 : -case 22 : -case 30 : -case 50 : -case 54 : -case 62 : -case 86 : -case 118 : +case 18 : +case 22 : +case 30 : +case 50 : +case 54 : +case 62 : +case 86 : +case 118 : { P0 = IC(0); P2 = IC(0); @@ -207,8 +207,8 @@ case 118 : P1 = I211(0, 1, 5); } } break; -case 19 : -case 51 : +case 19 : +case 51 : { P2 = IC(2); P3 = IC(2); @@ -220,9 +220,9 @@ case 51 : P1 = I332(1, 5, 2); } } break; -case 23 : -case 55 : -case 119 : +case 23 : +case 55 : +case 119 : { P2 = IC(3); P3 = IC(3); @@ -234,7 +234,7 @@ case 119 : P1 = I332(1, 5, 3); } } break; -case 26 : +case 26 : { P2 = IC(0); P3 = IC(0); @@ -249,8 +249,8 @@ case 26 : P1 = I211(0, 1, 5); } } break; -case 31 : -case 95 : +case 31 : +case 95 : { P2 = IC(4); P3 = IC(4); @@ -265,8 +265,8 @@ case 95 : P1 = I211(4, 1, 5); } } break; -case 42 : -case 170 : +case 42 : +case 170 : { P1 = IC(0); P3 = IC(0); @@ -278,9 +278,9 @@ case 170 : P2 = I31(0, 3); } } break; -case 43 : -case 171 : -case 187 : +case 43 : +case 171 : +case 187 : { P1 = IC(2); P3 = IC(2); @@ -292,8 +292,8 @@ case 187 : P2 = I31(2, 3); } } break; -case 46 : -case 174 : +case 46 : +case 174 : { P1 = IC(0); P2 = IC(0); @@ -304,8 +304,8 @@ case 174 : P0 = I611(0, 1, 3); } } break; -case 47 : -case 175 : +case 47 : +case 175 : { P1 = IC(4); P2 = IC(4); @@ -316,9 +316,9 @@ case 175 : P0 = I1411(4, 1, 3); } } break; -case 58 : -case 154 : -case 186 : +case 58 : +case 154 : +case 186 : { P2 = IC(0); P3 = IC(0); @@ -333,7 +333,7 @@ case 186 : P1 = I611(0, 1, 5); } } break; -case 59 : +case 59 : { P2 = IC(2); P3 = IC(2); @@ -348,7 +348,7 @@ case 59 : P1 = I611(2, 1, 5); } } break; -case 63 : +case 63 : { P2 = IC(4); P3 = IC(4); @@ -363,14 +363,14 @@ case 63 : P1 = I211(4, 1, 5); } } break; -case 72 : -case 76 : -case 104 : -case 106 : -case 108 : -case 110 : -case 120 : -case 124 : +case 72 : +case 76 : +case 104 : +case 106 : +case 108 : +case 110 : +case 120 : +case 124 : { P0 = IC(0); P1 = IC(0); @@ -381,11 +381,11 @@ case 124 : P2 = I211(0, 3, 7); } } break; -case 73 : -case 77 : -case 105 : -case 109 : -case 125 : +case 73 : +case 77 : +case 105 : +case 109 : +case 125 : { P1 = IC(1); P3 = IC(1); @@ -397,7 +397,7 @@ case 125 : P2 = I332(3, 7, 1); } } break; -case 74 : +case 74 : { P1 = IC(0); P3 = IC(0); @@ -412,9 +412,9 @@ case 74 : P0 = I211(0, 1, 3); } } break; -case 78 : -case 202 : -case 206 : +case 78 : +case 202 : +case 206 : { P1 = IC(0); P3 = IC(0); @@ -429,7 +429,7 @@ case 206 : P0 = I611(0, 1, 3); } } break; -case 79 : +case 79 : { P1 = IC(4); P3 = IC(4); @@ -444,10 +444,10 @@ case 79 : P0 = I211(4, 1, 3); } } break; -case 80 : -case 208 : -case 210 : -case 216 : +case 80 : +case 208 : +case 210 : +case 216 : { P0 = IC(0); P1 = IC(0); @@ -458,9 +458,9 @@ case 216 : P3 = I211(0, 5, 7); } } break; -case 81 : -case 209 : -case 217 : +case 81 : +case 209 : +case 217 : { P0 = IC(1); P1 = IC(1); @@ -471,9 +471,9 @@ case 217 : P3 = I211(1, 5, 7); } } break; -case 82 : -case 214 : -case 222 : +case 82 : +case 214 : +case 222 : { P0 = IC(0); P2 = IC(0); @@ -488,8 +488,8 @@ case 222 : P1 = I211(0, 1, 5); } } break; -case 83 : -case 115 : +case 83 : +case 115 : { P0 = IC(2); P2 = IC(2); @@ -504,8 +504,8 @@ case 115 : P1 = I611(2, 1, 5); } } break; -case 84 : -case 212 : +case 84 : +case 212 : { P0 = IC(0); P2 = IC(0); @@ -517,9 +517,9 @@ case 212 : P3 = I332(5, 7, 0); } } break; -case 85 : -case 213 : -case 221 : +case 85 : +case 213 : +case 221 : { P0 = IC(1); P2 = IC(1); @@ -531,7 +531,7 @@ case 221 : P3 = I332(5, 7, 1); } } break; -case 87 : +case 87 : { P0 = IC(3); P2 = IC(3); @@ -546,9 +546,9 @@ case 87 : P1 = I211(3, 1, 5); } } break; -case 88 : -case 248 : -case 250 : +case 88 : +case 248 : +case 250 : { P0 = IC(0); P1 = IC(0); @@ -563,8 +563,8 @@ case 250 : P3 = I211(0, 5, 7); } } break; -case 89 : -case 93 : +case 89 : +case 93 : { P0 = IC(1); P1 = IC(1); @@ -579,7 +579,7 @@ case 93 : P3 = I611(1, 5, 7); } } break; -case 90 : +case 90 : { if (MDL) { P2 = IC(0); @@ -602,7 +602,7 @@ case 90 : P1 = I611(0, 1, 5); } } break; -case 91 : +case 91 : { if (MDL) { P2 = IC(2); @@ -625,7 +625,7 @@ case 91 : P1 = I611(2, 1, 5); } } break; -case 92 : +case 92 : { P0 = IC(0); P1 = IC(0); @@ -640,7 +640,7 @@ case 92 : P3 = I611(0, 5, 7); } } break; -case 94 : +case 94 : { if (MDL) { P2 = IC(0); @@ -663,8 +663,8 @@ case 94 : P1 = I211(0, 1, 5); } } break; -case 107 : -case 123 : +case 107 : +case 123 : { P1 = IC(2); P3 = IC(2); @@ -679,7 +679,7 @@ case 123 : P0 = I211(2, 1, 3); } } break; -case 111 : +case 111 : { P1 = IC(4); P3 = IC(4); @@ -694,8 +694,8 @@ case 111 : P0 = I1411(4, 1, 3); } } break; -case 112 : -case 240 : +case 112 : +case 240 : { P0 = IC(0); P1 = IC(0); @@ -707,8 +707,8 @@ case 240 : P3 = I332(5, 7, 0); } } break; -case 113 : -case 241 : +case 113 : +case 241 : { P0 = IC(1); P1 = IC(1); @@ -720,7 +720,7 @@ case 241 : P3 = I332(5, 7, 1); } } break; -case 114 : +case 114 : { P0 = IC(0); P2 = IC(0); @@ -735,7 +735,7 @@ case 114 : P1 = I611(0, 1, 5); } } break; -case 116 : +case 116 : { P0 = IC(0); P1 = IC(0); @@ -746,7 +746,7 @@ case 116 : P3 = I611(0, 5, 7); } } break; -case 117 : +case 117 : { P0 = IC(1); P1 = IC(1); @@ -757,7 +757,7 @@ case 117 : P3 = I611(1, 5, 7); } } break; -case 121 : +case 121 : { P0 = IC(1); P1 = IC(1); @@ -772,7 +772,7 @@ case 121 : P3 = I611(1, 5, 7); } } break; -case 122 : +case 122 : { if (MDL) { P2 = IC(0); @@ -795,7 +795,7 @@ case 122 : P1 = I611(0, 1, 5); } } break; -case 126 : +case 126 : { P0 = IC(0); P3 = IC(0); @@ -810,7 +810,7 @@ case 126 : P1 = I211(0, 1, 5); } } break; -case 127 : +case 127 : { P3 = IC(4); if (MDL) { @@ -829,11 +829,11 @@ case 127 : P1 = I211(4, 1, 5); } } break; -case 146 : -case 150 : -case 178 : -case 182 : -case 190 : +case 146 : +case 150 : +case 178 : +case 182 : +case 190 : { P0 = IC(0); P2 = IC(0); @@ -845,8 +845,8 @@ case 190 : P3 = I31(0, 5); } } break; -case 147 : -case 179 : +case 147 : +case 179 : { P0 = IC(2); P2 = IC(2); @@ -857,8 +857,8 @@ case 179 : P1 = I611(2, 1, 5); } } break; -case 151 : -case 183 : +case 151 : +case 183 : { P0 = IC(3); P2 = IC(3); @@ -869,7 +869,7 @@ case 183 : P1 = I1411(3, 1, 5); } } break; -case 158 : +case 158 : { P2 = IC(0); P3 = IC(0); @@ -884,7 +884,7 @@ case 158 : P1 = I211(0, 1, 5); } } break; -case 159 : +case 159 : { P2 = IC(4); P3 = IC(4); @@ -899,7 +899,7 @@ case 159 : P1 = I1411(4, 1, 5); } } break; -case 191 : +case 191 : { P2 = IC(4); P3 = IC(4); @@ -914,11 +914,11 @@ case 191 : P1 = I1411(4, 1, 5); } } break; -case 200 : -case 204 : -case 232 : -case 236 : -case 238 : +case 200 : +case 204 : +case 232 : +case 236 : +case 238 : { P0 = IC(0); P1 = IC(0); @@ -930,8 +930,8 @@ case 238 : P3 = I31(0, 7); } } break; -case 201 : -case 205 : +case 201 : +case 205 : { P0 = IC(1); P1 = IC(1); @@ -942,7 +942,7 @@ case 205 : P2 = I611(1, 3, 7); } } break; -case 211 : +case 211 : { P0 = IC(2); P1 = IC(2); @@ -953,7 +953,7 @@ case 211 : P3 = I211(2, 5, 7); } } break; -case 215 : +case 215 : { P0 = IC(3); P2 = IC(3); @@ -968,7 +968,7 @@ case 215 : P1 = I1411(3, 1, 5); } } break; -case 218 : +case 218 : { if (MDL) { P2 = IC(0); @@ -991,7 +991,7 @@ case 218 : P1 = I611(0, 1, 5); } } break; -case 219 : +case 219 : { P1 = IC(2); P2 = IC(2); @@ -1006,7 +1006,7 @@ case 219 : P0 = I211(2, 1, 3); } } break; -case 220 : +case 220 : { P0 = IC(0); P1 = IC(0); @@ -1021,7 +1021,7 @@ case 220 : P3 = I211(0, 5, 7); } } break; -case 223 : +case 223 : { P2 = IC(4); if (MDR) { @@ -1040,8 +1040,8 @@ case 223 : P1 = I1411(4, 1, 5); } } break; -case 233 : -case 237 : +case 233 : +case 237 : { P0 = IC(1); P1 = IC(1); @@ -1052,7 +1052,7 @@ case 237 : P2 = I1411(1, 3, 7); } } break; -case 234 : +case 234 : { P1 = IC(0); P3 = IC(0); @@ -1067,7 +1067,7 @@ case 234 : P0 = I611(0, 1, 3); } } break; -case 235 : +case 235 : { P1 = IC(2); P3 = IC(2); @@ -1082,7 +1082,7 @@ case 235 : P0 = I211(2, 1, 3); } } break; -case 239 : +case 239 : { P1 = IC(4); P3 = IC(4); @@ -1097,7 +1097,7 @@ case 239 : P0 = I1411(4, 1, 3); } } break; -case 242 : +case 242 : { P0 = IC(0); P2 = IC(0); @@ -1112,7 +1112,7 @@ case 242 : P1 = I611(0, 1, 5); } } break; -case 243 : +case 243 : { P0 = IC(2); P1 = IC(2); @@ -1124,7 +1124,7 @@ case 243 : P3 = I332(5, 7, 2); } } break; -case 244 : +case 244 : { P0 = IC(0); P1 = IC(0); @@ -1135,7 +1135,7 @@ case 244 : P3 = I1411(0, 5, 7); } } break; -case 245 : +case 245 : { P0 = IC(1); P1 = IC(1); @@ -1146,7 +1146,7 @@ case 245 : P3 = I1411(1, 5, 7); } } break; -case 246 : +case 246 : { P0 = IC(0); P2 = IC(0); @@ -1161,7 +1161,7 @@ case 246 : P1 = I211(0, 1, 5); } } break; -case 247 : +case 247 : { P0 = IC(3); P2 = IC(3); @@ -1176,7 +1176,7 @@ case 247 : P1 = I1411(3, 1, 5); } } break; -case 249 : +case 249 : { P0 = IC(1); P1 = IC(1); @@ -1191,7 +1191,7 @@ case 249 : P3 = I211(1, 5, 7); } } break; -case 251 : +case 251 : { P1 = IC(2); if (MDL) { @@ -1210,7 +1210,7 @@ case 251 : P0 = I211(2, 1, 3); } } break; -case 252 : +case 252 : { P0 = IC(0); P1 = IC(0); @@ -1225,7 +1225,7 @@ case 252 : P3 = I1411(0, 5, 7); } } break; -case 253 : +case 253 : { P0 = IC(1); P1 = IC(1); @@ -1240,7 +1240,7 @@ case 253 : P3 = I1411(1, 5, 7); } } break; -case 254 : +case 254 : { P0 = IC(0); if (MDL) { @@ -1259,7 +1259,7 @@ case 254 : P1 = I211(0, 1, 5); } } break; -case 255 : +case 255 : { if (MDL) { P2 = IC(4); diff --git a/src/memgzio.c b/src/memgzio.c index 0ec4b2dc..cb38cb83 100644 --- a/src/memgzio.c +++ b/src/memgzio.c @@ -118,7 +118,7 @@ local MEMFILE *memOpen(char *memory, int available, char mode) memory[3] = ' '; *((int *)(memory+4)) = 0; } else { - if(memory[0] != 'V' || memory[1] != 'B' || memory[2] != 'A' || + if(memory[0] != 'V' || memory[1] != 'B' || memory[2] != 'A' || memory[3] != ' ') { free(f); return NULL; @@ -130,11 +130,11 @@ local MEMFILE *memOpen(char *memory, int available, char mode) return f; } -local size_t memWrite(const void *buffer, size_t size, size_t count, +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; @@ -149,11 +149,11 @@ local size_t memWrite(const void *buffer, size_t size, size_t count, return total; } -local size_t memRead(void *buffer, size_t size, size_t count, +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; @@ -211,7 +211,7 @@ 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); @@ -272,7 +272,7 @@ local gzFile gz_open (memory, available, 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; @@ -324,7 +324,7 @@ local gzFile gz_open (memory, available, mode) check_header(s); /* skip the .gz header */ s->startpos = (memTell(s->file) - s->stream.avail_in); } - + return (gzFile)s; } @@ -621,10 +621,10 @@ local int do_flush (file, flush) 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: + * 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; @@ -694,6 +694,6 @@ long ZEXPORT memtell(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 index 8b69a10e..2a6231e9 100644 --- a/src/memgzio.h +++ b/src/memgzio.h @@ -9,7 +9,7 @@ * Adapted from original gzio.c from zlib library by Forgotten */ -#if defined(HAVE_ZUTIL_H) || defined(_WIN32) +#if defined(HAVE_ZUTIL_H) || defined(_WIN32) # include #else #include diff --git a/src/motionblur.cpp b/src/motionblur.cpp index 35beb888..4248363c 100644 --- a/src/motionblur.cpp +++ b/src/motionblur.cpp @@ -26,9 +26,9 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -38,11 +38,11 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u32 nextPixel; u32 currentDelta; u32 nextDelta; - + finish = (u8 *) bP + ((width+2) << 1); nextPixel = *bP++; nextDelta = *xP++; - + do { currentPixel = nextPixel; currentDelta = nextDelta; @@ -51,7 +51,7 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, if(currentPixel != currentDelta) { u32 colorA, product, colorB; - + *(xP - 2) = currentPixel; #ifdef WORDS_BIGENDIAN colorA = currentPixel >> 16; @@ -64,7 +64,7 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, product = ((((colorA & colorMask) >> 1) + ((colorB & colorMask) >> 1) + (colorA & colorB & lowPixelMask))); - + *(dP) = product | product << 16; *(nL) = product | product << 16; @@ -78,21 +78,21 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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 @@ -101,15 +101,15 @@ void MotionBlur(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, colorA = currentPixel >> 16; #endif product = colorA; - + *(dP + 1) = product | product << 16; - *(nL + 1) = product | product << 16; + *(nL + 1) = product | product << 16; } - + dP += 2; nL += 2; } while ((u8 *) bP < finish); - + deltaPtr += srcPitch; srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -124,9 +124,9 @@ void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -136,11 +136,11 @@ void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u32 nextPixel; u32 currentDelta; u32 nextDelta; - + finish = (u8 *) bP + ((width+1) << 2); nextPixel = *bP++; nextDelta = *xP++; - + do { currentPixel = nextPixel; currentDelta = nextDelta; @@ -152,11 +152,11 @@ void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, *(xP - 2) = currentPixel; colorA = currentPixel; colorB = currentDelta; - + product = ((((colorA & colorMask) >> 1) + ((colorB & colorMask) >> 1) + (colorA & colorB & lowPixelMask))); - + *(dP) = product; *(dP+1) = product; *(nL) = product; @@ -166,11 +166,11 @@ void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, colorA = nextPixel; colorB = nextDelta; - + product = ((((colorA & colorMask) >> 1) + ((colorB & colorMask) >> 1) + (colorA & colorB & lowPixelMask))); - + *(dP + 2) = product; *(dP + 3) = product; *(nL + 2) = product; @@ -178,11 +178,11 @@ void MotionBlur32(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, nextPixel = *bP++; nextDelta = *xP++; - + dP += 4; nL += 4; } while ((u8 *) bP < finish); - + deltaPtr += srcPitch; srcPtr += srcPitch; dstPtr += dstPitch << 1; diff --git a/src/pixel.cpp b/src/pixel.cpp index 5673ed24..78130a20 100644 --- a/src/pixel.cpp +++ b/src/pixel.cpp @@ -25,9 +25,9 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, { 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; @@ -37,20 +37,20 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, 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; @@ -60,7 +60,7 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, colorB = currentPixel >> 16; #endif product = (((colorA & colorMask) >> 1) & colorMask) >> 1; - + #ifdef WORDS_BIGENDIAN *(nL) = (product << 16) | (product); *(dP) = (colorA << 16) | product; @@ -68,7 +68,7 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, *(nL) = product | (product << 16); *(dP) = colorA | (product << 16); #endif - + #ifdef WORDS_BIGENDIAN colorA = nextPixel >> 16; #else @@ -83,11 +83,11 @@ void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, *(dP + 1) = (colorB) | (product << 16); #endif } - + dP += 2; nL += 2; } while ((u8 *) bP < finish); - + deltaPtr += srcPitch; srcPtr += srcPitch; dstPtr += dstPitch << 1; @@ -101,9 +101,9 @@ void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { u8 *nextLine, *finish; u32 colorMask = ~RGB_LOW_BITS_MASK; - + nextLine = dstPtr + dstPitch; - + do { u32 *bP = (u32 *) srcPtr; // u32 *xP = (u32 *) deltaPtr; @@ -111,16 +111,16 @@ void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, 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; @@ -137,11 +137,11 @@ void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, *(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; diff --git a/src/portable.cpp b/src/portable.cpp index b9932353..9ec891cf 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -11,7 +11,7 @@ * 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. + * 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 diff --git a/src/portable.h b/src/portable.h index 94cdb749..22504a21 100644 --- a/src/portable.h +++ b/src/portable.h @@ -11,7 +11,7 @@ * 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. + * 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 diff --git a/src/remote.cpp b/src/remote.cpp index 85efd54c..93ec30ae 100644 --- a/src/remote.cpp +++ b/src/remote.cpp @@ -91,22 +91,22 @@ bool remoteTcpInit() int error = WSAStartup(MAKEWORD(1,1),&wsaData); #endif // _WIN32 SOCKET 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)); - + 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); @@ -122,10 +122,10 @@ bool remoteTcpInit() 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); @@ -133,7 +133,7 @@ bool remoteTcpInit() socklen_t len = sizeof(addr); #ifdef _WIN32 - int flag = 0; + int flag = 0; ioctlsocket(s, FIONBIO, (unsigned long *)&flag); #endif // _WIN32 SOCKET s2 = accept(s, (sockaddr *)&addr, &len); @@ -166,10 +166,10 @@ void remoteTcpCleanUp() remoteSocket = -1; } if(remoteListenSocket > 0) { - fprintf(stderr, "Closing listen socket\n"); + fprintf(stderr, "Closing listen socket\n"); close(remoteListenSocket); remoteListenSocket = -1; - } + } } int remotePipeSend(char *data, int len) @@ -192,7 +192,7 @@ bool remotePipeInit() fprintf(stderr, "ACK not received\n"); exit(-1); } - + return true; } @@ -216,7 +216,7 @@ void remoteSetProtocol(int p) remoteSendFnc = remotePipeSend; remoteRecvFnc = remotePipeRecv; remoteInitFnc = remotePipeInit; - remoteCleanUpFnc = remotePipeCleanUp; + remoteCleanUpFnc = remotePipeCleanUp; } } @@ -228,7 +228,7 @@ void remoteInit() void remotePutPacket(const char *packet) { - const char *hex = "0123456789abcdef"; + const char *hex = "0123456789abcdef"; char buffer[1024]; size_t count = strlen(packet); @@ -237,7 +237,7 @@ void remotePutPacket(const char *packet) char *p = buffer; *p++ = '$'; - + for(size_t i = 0 ;i < count; i++) { csum += packet[i]; *p++ = packet[i]; @@ -283,7 +283,7 @@ void remoteOutput(char *s, u32 addr) char *d = buffer; *d++ = 'O'; - + if(s) { char c = *s++; while(c) { @@ -339,10 +339,10 @@ void remoteSendStatus() (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255); - s += 12; + s += 12; *s = 0; // printf("Sending %s\n", buffer); - remotePutPacket(buffer); + remotePutPacket(buffer); } void remoteBinaryWrite(char *p) @@ -368,8 +368,8 @@ void remoteBinaryWrite(char *p) break; } } - // printf("ROM is %08x\n", debuggerReadMemory(0x8000254)); - remotePutPacket("OK"); + // printf("ROM is %08x\n", debuggerReadMemory(0x8000254)); + remotePutPacket("OK"); } void remoteMemoryWrite(char *p) @@ -397,7 +397,7 @@ void remoteMemoryWrite(char *p) address++; } // printf("ROM is %08x\n", debuggerReadMemory(0x8000254)); - remotePutPacket("OK"); + remotePutPacket("OK"); } void remoteMemoryRead(char *p) @@ -409,7 +409,7 @@ void remoteMemoryRead(char *p) char buffer[1024]; - char *s = buffer; + char *s = buffer; for(int i = 0; i < count; i++) { u8 b = debuggerReadByte(address); sprintf(s, "%02x", b); @@ -452,14 +452,14 @@ void remoteWriteWatch(char *p, bool active) remotePutPacket("E01"); return; } - + if(address > 0x203ffff && address < 0x3000000) { remotePutPacket("E01"); return; } - + u32 final = address + count; - + if(address < 0x2040000 && final > 0x2040000) { remotePutPacket("E01"); return; @@ -474,8 +474,8 @@ void remoteWriteWatch(char *p, bool active) else freezeInternalRAM[address & 0x7fff] = active; address++; - } - + } + remotePutPacket("OK"); } @@ -531,9 +531,9 @@ void remoteWriteRegister(char *p) u32 v = 0; u8 data[4] = {0,0,0,0}; - + int i = 0; - + while(c != '#') { u8 b = 0; if(c <= '9') @@ -574,11 +574,11 @@ void remoteStubMain() remoteSendStatus(); remoteResumed = false; } - + while(1) { char buffer[1024]; int res = remoteRecvFnc(buffer, 1024); - + if(res == -1) { fprintf(stderr, "GDB connection lost\n"); #ifdef SDL @@ -675,13 +675,13 @@ void remoteStubMain() break; default: { - *(strchr(p, '#') + 3) = 0; + *(strchr(p, '#') + 3) = 0; fprintf(stderr, "Unknown packet %s\n", --p); remotePutPacket(""); } break; } - } + } } void remoteStubSignal(int sig, int number) diff --git a/src/scanline.cpp b/src/scanline.cpp index 21610a8a..f779c293 100644 --- a/src/scanline.cpp +++ b/src/scanline.cpp @@ -24,24 +24,24 @@ 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; @@ -61,11 +61,11 @@ void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *, *(dP + 1) = colorB | (colorB << 16); *(nL + 1) = 0; - + dP += 2; nL += 2; } while ((u8 *) bP < finish); - + srcPtr += srcPitch; dstPtr += dstPitch << 1; nextLine += dstPitch << 1; @@ -77,25 +77,25 @@ 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; @@ -106,15 +106,15 @@ void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, *(dP + 2) = colorB; *(dP + 3) = colorB; - *(nL+2) = 0; + *(nL+2) = 0; *(nL+3) = 0; - + nextPixel = *bP++; dP += 4; nL += 4; } while ((u8 *) bP < finish); - + srcPtr += srcPitch; dstPtr += dstPitch << 1; nextLine += dstPitch << 1; @@ -127,23 +127,23 @@ void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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 @@ -153,7 +153,7 @@ void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, colorA = currentPixel & 0xFFFF; colorB = currentPixel >> 16; #endif - + *(dP) = colorA = colorA | ((((colorA & colorMask) >> 1) + ((colorB & colorMask) >> 1))) << 16; colorA = ((colorA & colorMask) >> 1); @@ -167,12 +167,12 @@ void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, colorB = ((colorB & colorMask) >> 1); colorB += ((colorB & colorMask) >> 1); - *(nL + 1) = colorB; - + *(nL + 1) = colorB; + dP += 2; nL += 2; } while ((u8 *) bP < finish); - + srcPtr += srcPitch; dstPtr += dstPitch << 1; nextLine += dstPitch << 1; @@ -185,28 +185,28 @@ void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, { 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); @@ -221,7 +221,7 @@ void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, dP += 2; nL += 2; } while ((u8 *) bP < finish); - + srcPtr += srcPitch; dstPtr += dstPitch << 1; nextLine += dstPitch << 1; diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index a4ed4d8b..2a14811b 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -64,11 +64,11 @@ 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 _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 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); @@ -192,7 +192,7 @@ static int rewindTimer = 0; #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 }, @@ -308,7 +308,7 @@ u16 defaultMotion[4] = { struct option sdlOptions[] = { { "agb-print", no_argument, &sdlAgbPrint, 1 }, - { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, + { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, { "bios", required_argument, 0, 'b' }, { "config", required_argument, 0, 'c' }, { "debug", no_argument, 0, 'd' }, @@ -360,7 +360,7 @@ struct option sdlOptions[] = { { "show-speed-normal", no_argument, &showSpeed, 1 }, { "show-speed-detailed", no_argument, &showSpeed, 2 }, { "throttle", required_argument, 0, 'T' }, - { "verbose", required_argument, 0, 'v' }, + { "verbose", required_argument, 0, 'v' }, { "video-1x", no_argument, &sizeOption, 0 }, { "video-2x", no_argument, &sizeOption, 1 }, { "video-3x", no_argument, &sizeOption, 2 }, @@ -400,21 +400,21 @@ extern bool gbIsGameboyRom(char *); sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ - sdlStretcher[sdlStretcherPos++] = 0x02; + sdlStretcher[sdlStretcherPos++] = 0x02; #define SDL_LOADL \ sdlStretcher[sdlStretcherPos++] = 0x8b;\ sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ - sdlStretcher[sdlStretcherPos++] = 0x04; + sdlStretcher[sdlStretcherPos++] = 0x04; #define SDL_LOADL2 \ sdlStretcher[sdlStretcherPos++] = 0x8b;\ sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ - sdlStretcher[sdlStretcherPos++] = 0x03; + sdlStretcher[sdlStretcherPos++] = 0x03; #define SDL_STOREW \ sdlStretcher[sdlStretcherPos++] = 0x66;\ @@ -422,21 +422,21 @@ extern bool gbIsGameboyRom(char *); sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ - sdlStretcher[sdlStretcherPos++] = 0x02; + sdlStretcher[sdlStretcherPos++] = 0x02; #define SDL_STOREL \ sdlStretcher[sdlStretcherPos++] = 0x89;\ sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ - sdlStretcher[sdlStretcherPos++] = 0x04; + sdlStretcher[sdlStretcherPos++] = 0x04; #define SDL_STOREL2 \ sdlStretcher[sdlStretcherPos++] = 0x89;\ sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ - sdlStretcher[sdlStretcherPos++] = 0x03; + sdlStretcher[sdlStretcherPos++] = 0x03; #define SDL_RET \ sdlStretcher[sdlStretcherPos++] = 0xc3; @@ -823,7 +823,7 @@ void sdlCheckDirectory(char *dir) 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); @@ -840,9 +840,9 @@ char *sdlGetFilename(char *name) static char filebuffer[2048]; int len = strlen(name); - + char *p = name + len - 1; - + while(true) { if(*p == '/' || *p == '\\') { @@ -854,7 +854,7 @@ char *sdlGetFilename(char *name) if(len == 0) break; } - + if(len == 0) strcpy(filebuffer, name); else @@ -878,11 +878,11 @@ FILE *sdlFindFile(const char *name) #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; @@ -924,7 +924,7 @@ FILE *sdlFindFile(const char *name) 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"); @@ -960,7 +960,7 @@ FILE *sdlFindFile(const char *name) void sdlReadPreferences(FILE *f) { char buffer[2048]; - + while(1) { char *s = fgets(buffer, 2048, f); @@ -968,10 +968,10 @@ void sdlReadPreferences(FILE *f) break; char *p = strchr(s, '#'); - + if(p) *p = 0; - + char *token = strtok(s, " \t\n\r="); if(!token) @@ -1099,7 +1099,7 @@ void sdlReadPreferences(FILE *f) } else if(!strcmp(key, "gbFrameSkip")) { gbFrameSkip = sdlFromHex(value); if(gbFrameSkip < 0 || gbFrameSkip > 9) - gbFrameSkip = 0; + gbFrameSkip = 0; } else if(!strcmp(key, "video")) { sizeOption = sdlFromHex(value); if(sizeOption < 0 || sizeOption > 3) @@ -1147,7 +1147,7 @@ void sdlReadPreferences(FILE *f) case 4: break; default: - fprintf(stderr, "Unknown sound quality %d. Defaulting to 22Khz\n", + fprintf(stderr, "Unknown sound quality %d. Defaulting to 22Khz\n", soundQuality); soundQuality = 2; break; @@ -1251,7 +1251,7 @@ static void sdlApplyPerImagePreferences() char readBuffer[2048]; bool found = false; - + while(1) { char *s = fgets(readBuffer, 2048, f); @@ -1259,10 +1259,10 @@ static void sdlApplyPerImagePreferences() break; char *p = strchr(s, ';'); - + if(p) *p = 0; - + char *token = strtok(s, " \t\n\r="); if(!token) @@ -1298,7 +1298,7 @@ static void sdlApplyPerImagePreferences() 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")) { @@ -1320,7 +1320,7 @@ static void sdlApplyPerImagePreferences() static int sdlCalculateShift(u32 mask) { int m = 0; - + while(mask) { m++; mask >>= 1; @@ -1358,7 +1358,7 @@ void sdlWriteState(int num) num+1); else sprintf(stateName,"%s%d.sgm", filename, num+1); - + if(emulator.emuWriteState) emulator.emuWriteState(stateName); @@ -1393,7 +1393,7 @@ void sdlWriteBattery() if(batteryDir[0]) sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); - else + else sprintf(buffer, "%s.sav", filename); emulator.emuWriteBattery(buffer); @@ -1404,12 +1404,12 @@ void sdlWriteBattery() void sdlReadBattery() { char buffer[1048]; - + if(batteryDir[0]) sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); - else + else sprintf(buffer, "%s.sav", filename); - + bool res = false; res = emulator.emuReadBattery(buffer); @@ -1453,7 +1453,7 @@ void sdlUpdateJoyButton(int which, int b = joypad[j][i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (b >= 128) && (b == (button+128))) { sdlButtons[j][i] = pressed; } @@ -1470,7 +1470,7 @@ void sdlUpdateJoyButton(int which, sdlMotionButtons[i] = pressed; } } - } + } } void sdlUpdateJoyHat(int which, @@ -1484,7 +1484,7 @@ void sdlUpdateJoyHat(int which, 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; @@ -1533,7 +1533,7 @@ void sdlUpdateJoyHat(int which, sdlMotionButtons[i] = (v ? true : false); } } - } + } } void sdlUpdateJoyAxis(int which, @@ -1547,7 +1547,7 @@ void sdlUpdateJoyAxis(int which, 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); } @@ -1564,7 +1564,7 @@ void sdlUpdateJoyAxis(int which, sdlMotionButtons[i] = (a & 1) ? (value > 16384) : (value < -16384); } } - } + } } bool sdlCheckJoyKey(int key) @@ -1579,7 +1579,7 @@ bool sdlCheckJoyKey(int key) if(button >= SDL_JoystickNumButtons(sdlDevices[dev])) return false; } else if (what < 0x20) { - // joystick axis + // joystick axis what >>= 1; if(what >= SDL_JoystickNumAxes(sdlDevices[dev])) return false; @@ -1612,18 +1612,18 @@ void sdlCheckKeys() 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 @@ -1637,18 +1637,18 @@ void sdlCheckKeys() 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 @@ -1682,7 +1682,7 @@ void sdlPollEvents() if(emulating) soundPause(); } - + memset(delta,255,sizeof(delta)); } } @@ -1729,10 +1729,10 @@ void sdlPollEvents() case SDLK_b: if(!(event.key.keysym.mod & MOD_NOCTRL) && (event.key.keysym.mod & KMOD_CTRL)) { - if(emulating && emulator.emuReadMemState && rewindMemory + if(emulating && emulator.emuReadMemState && rewindMemory && rewindCount) { rewindPos = (rewindPos - 1) & 7; - emulator.emuReadMemState(&rewindMemory[REWIND_SIZE*rewindPos], + emulator.emuReadMemState(&rewindMemory[REWIND_SIZE*rewindPos], REWIND_SIZE); rewindCount--; rewindCounter = 0; @@ -1799,12 +1799,12 @@ void sdlPollEvents() case SDLK_4: if(!(event.key.keysym.mod & MOD_NOALT) && (event.key.keysym.mod & KMOD_ALT)) { - const char *disableMessages[4] = + const char *disableMessages[4] = { "autofire A disabled", "autofire B disabled", "autofire R disabled", "autofire L disabled"}; - const char *enableMessages[4] = + const char *enableMessages[4] = { "autofire A", "autofire B", "autofire R", @@ -1950,12 +1950,12 @@ 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; @@ -1966,7 +1966,7 @@ int main(int argc, char **argv) sdlReadPreferences(); sdlPrintUsage = 0; - + while((op = getopt_long(argc, argv, "FNT:Y:G:D:b:c:df:hi:p::s:t:v:1234", @@ -2128,7 +2128,7 @@ int main(int argc, char **argv) case 'v': if(optarg) { systemVerbose = atoi(optarg); - } else + } else systemVerbose = 0; break; case '1': @@ -2169,7 +2169,7 @@ int main(int argc, char **argv) rtcEnable(sdlRtcEnable ? true : false); agbPrintEnable(sdlAgbPrint ? true : false); - + if(!debuggerStub) { if(optind >= argc) { systemMessage(0,"Missing image name"); @@ -2194,7 +2194,7 @@ int main(int argc, char **argv) if(optind < argc) { char *szFile = argv[optind]; u32 len = strlen(szFile); - if (len > SYSMSG_BUFFER_SIZE) + if (len > SYSMSG_BUFFER_SIZE) { fprintf(stderr,"%s :%s: File name too long\n",argv[0],szFile); exit(-1); @@ -2208,7 +2208,7 @@ int main(int argc, char **argv) if(ipsname[0] == 0) sprintf(ipsname, "%s.ips", filename); - + bool failed = false; IMAGE_TYPE type = utilFindType(szFile); @@ -2218,12 +2218,12 @@ int main(int argc, char **argv) exit(-1); } cartridgeType = (int)type; - + if(type == IMAGE_GB) { failed = !gbLoadRom(szFile); if(!failed) { gbGetHardwareType(); - + // used for the handling of the gb Boot Rom if (gbHardware & 5) { @@ -2236,7 +2236,7 @@ int main(int argc, char **argv) gbCPUInit(tempName, useBios); } else useBios = false; - + gbReset(); cartridgeType = IMAGE_GB; emulator = GBSystem; @@ -2257,7 +2257,7 @@ int main(int argc, char **argv) sdlApplyPerImagePreferences(); doMirroring(mirroringEnable); - + cartridgeType = 0; emulator = GBASystem; @@ -2266,7 +2266,7 @@ int main(int argc, char **argv) WRITE32LE(&rom[0], 0xea00002e); } */ - + CPUInit(biosFileName, useBios); CPUReset(); if(sdlAutoIPS) { @@ -2278,7 +2278,7 @@ int main(int argc, char **argv) } } } - + if(failed) { systemMessage(0, "Failed to load file %s", szFile); exit(-1); @@ -2297,22 +2297,22 @@ int main(int argc, char **argv) ioMem = (u8 *)calloc(1, 0x400); emulator = GBASystem; - + CPUInit(biosFileName, useBios); - CPUReset(); + CPUReset(); } - + sdlReadBattery(); - - if(debuggerStub) + + 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); @@ -2321,9 +2321,9 @@ int main(int argc, char **argv) if(SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { systemMessage(0, "Failed to init joystick support: %s", SDL_GetError()); } - + sdlCheckKeys(); - + if(cartridgeType == 0) { srcWidth = 240; srcHeight = 160; @@ -2335,7 +2335,7 @@ int main(int argc, char **argv) gbBorderLineSkip = 256; gbBorderColumnSkip = 48; gbBorderRowSkip = 40; - } else { + } else { srcWidth = 160; srcHeight = 144; gbBorderLineSkip = 160; @@ -2347,24 +2347,24 @@ int main(int argc, char **argv) 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; @@ -2376,7 +2376,7 @@ int main(int argc, char **argv) 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); @@ -2403,7 +2403,7 @@ int main(int argc, char **argv) #endif fprintf(stderr,"Color depth: %d\n", systemColorDepth); - + if(systemColorDepth == 16) { if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) { Init_2xSaI(565); @@ -2520,7 +2520,7 @@ int main(int argc, char **argv) break; } } - + if(systemColorDepth == 16) { switch(ifbType) { case 0: @@ -2554,7 +2554,7 @@ int main(int argc, char **argv) delta = (u8*)malloc(322*242*4); memset(delta, 255, 322*242*4); } - + emulating = 1; renderedFrames = 0; @@ -2562,7 +2562,7 @@ int main(int argc, char **argv) soundInit(); autoFrameSkipLastTime = throttleLastTime = systemGetClock(); - + SDL_WM_SetCaption("VisualBoyAdvance", NULL); while(emulating) { @@ -2576,7 +2576,7 @@ int main(int argc, char **argv) if(rewindCount > 8) rewindCount = 8; if(emulator.emuWriteMemState && - emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], + emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], REWIND_SIZE)) { rewindPos = (rewindPos + 1) & 7; if(rewindCount == 8) @@ -2596,7 +2596,7 @@ int main(int argc, char **argv) SDL_ShowCursor(SDL_DISABLE); } } - + emulating = 0; fprintf(stderr,"Shutting down\n"); remoteCleanUp(); @@ -2611,7 +2611,7 @@ int main(int argc, char **argv) free(delta); delta = NULL; } - + SDL_Quit(); return 0; } @@ -2620,10 +2620,10 @@ void systemMessage(int num, const char *msg, ...) { char buffer[SYSMSG_BUFFER_SIZE*2]; va_list valist; - + va_start(valist, msg); vsprintf(buffer, msg, valist); - + fprintf(stderr, "%s\n", buffer); va_end(valist); } @@ -2631,12 +2631,12 @@ void systemMessage(int num, const char *msg, ...) void systemDrawScreen() { renderedFrames++; - + if(yuv) { Draw_Overlay(surface, sizeOption+1); return; } - + SDL_LockSurface(surface); if(screenMessage) { @@ -2646,7 +2646,7 @@ void systemDrawScreen() if(((systemGetClock() - screenMessageTime) < 3000) && !disableStatusMessages) { drawText(pix, srcPitch, 10, srcHeight - 20, - screenMessageBuffer); + screenMessageBuffer); } else { screenMessage = false; } @@ -2658,7 +2658,7 @@ void systemDrawScreen() else ifbFunction(pix+destWidth*2+4, destWidth*2+4, srcWidth, srcHeight); } - + if(filterFunction) { if(systemColorDepth == 16) filterFunction(pix+destWidth+4,destWidth+4, delta, @@ -2694,7 +2694,7 @@ void systemDrawScreen() break; case 1: for(i = 0; i < srcHeight; i++) { - SDL_CALL_STRETCHER; + SDL_CALL_STRETCHER; dest += destPitch; SDL_CALL_STRETCHER; src += srcPitch; @@ -2747,8 +2747,8 @@ void systemDrawScreen() surface->pitch, 10, surface->h-20, - buffer); - } + buffer); + } SDL_UnlockSurface(surface); // SDL_UpdateRect(surface, 0, 0, destWidth, destHeight); @@ -2764,9 +2764,9 @@ u32 systemReadJoypad(int which) { if(which < 0 || which > 3) which = sdlDefaultJoypad; - + u32 res = 0; - + if(sdlButtons[which][KEY_BUTTON_A]) res |= 1; if(sdlButtons[which][KEY_BUTTON_B]) @@ -2805,7 +2805,7 @@ u32 systemReadJoypad(int which) res |= autoFire; autoFireToggle = !autoFireToggle; } - + return res; } @@ -2819,7 +2819,7 @@ void systemShowSpeed(int speed) systemSpeed = speed; showRenderedFrames = renderedFrames; - renderedFrames = 0; + renderedFrames = 0; if(!fullscreen && showSpeed) { char buffer[80]; @@ -2840,14 +2840,14 @@ void systemFrame() void system10Frames(int rate) { - u32 time = systemGetClock(); + u32 time = systemGetClock(); if(!wasPaused && autoFrameSkip && !throttle) { u32 diff = time - autoFrameSkipLastTime; int speed = 100; if(diff) speed = (1000000/rate)/diff; - + if(speed >= 98) { frameskipadjust++; @@ -2867,15 +2867,15 @@ void system10Frames(int rate) 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); } @@ -3102,7 +3102,7 @@ void systemUpdateMotionSensor() sensorY += 2; if(sensorY > 2047) sensorY = 2047; - } + } } int systemGetSensorX() @@ -3127,7 +3127,7 @@ void systemScreenMessage(const char *msg) strncpy(screenMessageBuffer, msg, 20); screenMessageBuffer[20] = 0; } else - strcpy(screenMessageBuffer, msg); + strcpy(screenMessageBuffer, msg); } bool systemCanChangeSoundQuality() @@ -3153,7 +3153,7 @@ bool systemPauseOnFrame() void Init_Overlay(SDL_Surface *gbascreen, int overlaytype) { - + overlay = SDL_CreateYUVOverlay( GBA_WIDTH, GBA_HEIGHT, overlaytype, gbascreen); @@ -3170,7 +3170,7 @@ void Init_Overlay(SDL_Surface *gbascreen, int overlaytype) void Quit_Overlay(void) { - + SDL_FreeYUVOverlay(overlay); } @@ -3189,16 +3189,16 @@ 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; @@ -3215,7 +3215,7 @@ inline void ConvertRGBtoYV12(SDL_Overlay *o) p+=4;//s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -3224,16 +3224,16 @@ 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; @@ -3250,7 +3250,7 @@ inline void ConvertRGBtoIYUV(SDL_Overlay *o) p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -3259,9 +3259,9 @@ 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; @@ -3273,11 +3273,11 @@ inline void ConvertRGBtoUYVY(SDL_Overlay *o) *(op++)=yuv[2]; } else *(op++)=yuv[0]; - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -3286,9 +3286,9 @@ 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; @@ -3302,11 +3302,11 @@ inline void ConvertRGBtoYVYU(SDL_Overlay *o) *op=yuv[0]; op+=2; } - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -3315,9 +3315,9 @@ 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; @@ -3331,11 +3331,11 @@ inline void ConvertRGBtoYUY2(SDL_Overlay *o) *op=yuv[0]; op+=2; } - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -3362,16 +3362,16 @@ inline void Convert32bit(SDL_Surface *display) 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; @@ -3391,10 +3391,10 @@ void systemGbBorderOn() destWidth = (sizeOption+1)*srcWidth; destHeight = (sizeOption+1)*srcHeight; - + surface = SDL_SetVideoMode(destWidth, destHeight, 16, SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF| - (fullscreen ? SDL_FULLSCREEN : 0)); + (fullscreen ? SDL_FULLSCREEN : 0)); #ifndef C_CORE sdlMakeStretcher(srcWidth); #else @@ -3420,19 +3420,19 @@ void systemGbBorderOn() RGB_LOW_BITS_MASK = 0x821; } else { Init_2xSaI(555); - RGB_LOW_BITS_MASK = 0x421; + 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); - } + (((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); + (((i & 0x7c00) >> 10) << systemBlueShift); } } srcPitch = srcWidth * 2+4; @@ -3446,7 +3446,7 @@ void systemGbBorderOn() for(int i = 0; i < 0x10000; i++) { systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); + (((i & 0x7c00) >> 10) << systemBlueShift); } if(systemColorDepth == 32) srcPitch = srcWidth*4 + 4; diff --git a/src/sdl/debugger.cpp b/src/sdl/debugger.cpp index 8d742449..e503df04 100644 --- a/src/sdl/debugger.cpp +++ b/src/sdl/debugger.cpp @@ -220,11 +220,11 @@ static void debuggerPrefetch() static void debuggerApplyBreakpoint(u32 address, int num, int size) { if(size) - debuggerWriteMemory(address, (u32)(0xe1200070 | - (num & 0xf) | + debuggerWriteMemory(address, (u32)(0xe1200070 | + (num & 0xf) | ((num<<4)&0xf0))); else - debuggerWriteHalfWord(address, + debuggerWriteHalfWord(address, (u16)(0xbe00 | num)); } @@ -236,7 +236,7 @@ static void debuggerDisableBreakpoints() debuggerBreakpointList[i].value); else debuggerWriteHalfWord(debuggerBreakpointList[i].address, - debuggerBreakpointList[i].value); + debuggerBreakpointList[i].value); } } @@ -249,7 +249,7 @@ static void debuggerEnableBreakpoints(bool skipPC) debuggerApplyBreakpoint(debuggerBreakpointList[i].address, i, debuggerBreakpointList[i].size); - } + } } static void debuggerUsage(const char *cmd) @@ -257,8 +257,8 @@ static void debuggerUsage(const char *cmd) for(int i = 0; ; i++) { if(debuggerCommands[i].name) { if(!strcmp(debuggerCommands[i].name, cmd)) { - printf("%s %s\n\n%s\n", - debuggerCommands[i].name, + printf("%s %s\n\n%s\n", + debuggerCommands[i].name, debuggerCommands[i].syntax ? debuggerCommands[i].syntax : "", debuggerCommands[i].help); break; @@ -267,7 +267,7 @@ static void debuggerUsage(const char *cmd) printf("Unrecognized command '%s'.", cmd); break; } - } + } } static void debuggerPrintBaseType(Type *t, u32 value, u32 location, @@ -325,7 +325,7 @@ static void debuggerPrintBaseType(Type *t, u32 value, u32 location, } return; } - + switch(t->encoding) { case DW_ATE_boolean: if(value) @@ -367,9 +367,9 @@ static void debuggerPrintBaseType(Type *t, u32 value, u32 location, static const char *debuggerPrintType(Type *t) { - char buffer[1024]; + char buffer[1024]; static char buffer2[1024]; - + if(t->type == TYPE_pointer) { if(t->pointer) strcpy(buffer, debuggerPrintType(t->pointer)); @@ -380,7 +380,7 @@ static const char *debuggerPrintType(Type *t) } else if(t->type == TYPE_reference) { strcpy(buffer, debuggerPrintType(t->pointer)); sprintf(buffer2, "%s &", buffer); - return buffer2; + return buffer2; } return t->name; } @@ -441,7 +441,7 @@ static void debuggerPrintMember(Function *f, v = debuggerReadHalfWord(location); else if(size == 4) v = debuggerReadMemory(location); - + while(bitSize) { int top = size*8 - off; int bot = top - bitSize; @@ -467,7 +467,7 @@ static void debuggerPrintMember(Function *f, } else { debuggerPrintValueInternal(f, m->type, m->location, m->bitSize, m->bitOffset, objLocation); - } + } } static void debuggerPrintStructure(Function *f, Type *t, u32 objLocation) @@ -555,14 +555,14 @@ static void debuggerPrintValueInternal(Function *f, Type *t, default: printf("%08x", value); break; - } + } } static void debuggerPrintValueInternal(Function *f, Type *t, ELFBlock *loc, - int bitSize, int bitOffset, + int bitSize, int bitOffset, u32 objLocation) { - LocationType type; + LocationType type; u32 location; if(loc) { if(objLocation) @@ -580,7 +580,7 @@ static void debuggerPrintValueInternal(Function *f, Type *t, ELFBlock *loc, static void debuggerPrintValue(Function *f, Object *o) { debuggerPrintValueInternal(f, o->type, o->location, 0, 0, 0); - + printf("\n"); } @@ -593,7 +593,7 @@ static void debuggerSymbols(int argc, char **argv) bool match = false; int matchSize = 0; const char *matchStr = NULL; - + if(argc == 2) { match = true; matchSize = strlen(argv[1]); @@ -665,7 +665,7 @@ static void debuggerPrint(int argc, char **argv) u32 pc = armNextPC; Function *f = NULL; CompileUnit *u = NULL; - + elfGetCurrentFunction(pc, &f, &u); @@ -686,8 +686,8 @@ static void debuggerPrint(int argc, char **argv) printf("Unknown option %s\n", argv[1]); return; } - } - + } + const char *s = argc == 2 ? argv[1] : argv[2]; extern const char *exprString; @@ -748,7 +748,7 @@ static void debuggerDebug(int n, char **args) systemDebug = v; printf("Debug level set to %d\n", systemDebug); } else - debuggerUsage("trace"); + debuggerUsage("trace"); } static void debuggerVerbose(int n, char **args) @@ -759,7 +759,7 @@ static void debuggerVerbose(int n, char **args) systemVerbose = v; printf("Verbose level set to %d\n", systemVerbose); } else - debuggerUsage("verbose"); + debuggerUsage("verbose"); } static void debuggerWhere(int n, char **args) @@ -791,11 +791,11 @@ static void debuggerLocals(int n, char **args) printf("%s=", o->name); debuggerPrintValue(f, o); } - o = o->next; + o = o->next; } } else { printf("No information for current address\n"); - } + } } static void debuggerNext(int n, char **args) @@ -820,7 +820,7 @@ static void debuggerNext(int n, char **args) if(elfGetCurrentFunction(a, &f, &u)) { const char *file; int line = elfFindLine(u, f, a, &file); - + printf("File %s, function %s, line %d\n", file, f->name, line); } @@ -864,7 +864,7 @@ static void debuggerContinue(int n, char **args) Function *f = NULL; CompileUnit *u = NULL; - + if(elfGetCurrentFunction(armNextPC, &f, &u)) { const char *file; int line = elfFindLine(u,f,armNextPC,&file); @@ -900,11 +900,11 @@ static void debuggerBreakDelete(int n, char **args) n++; if(n < debuggerNumOfBreakpoints) { for(int i = n; i < debuggerNumOfBreakpoints; i++) { - debuggerBreakpointList[i-1].address = + debuggerBreakpointList[i-1].address = debuggerBreakpointList[i].address; - debuggerBreakpointList[i-1].value = + debuggerBreakpointList[i-1].value = debuggerBreakpointList[i].value; - debuggerBreakpointList[i-1].size = + debuggerBreakpointList[i-1].size = debuggerBreakpointList[i].size; } } @@ -913,7 +913,7 @@ static void debuggerBreakDelete(int n, char **args) else printf("No breakpoints are set\n"); } else - debuggerUsage("bd"); + debuggerUsage("bd"); } static void debuggerBreak(int n, char **args) @@ -933,7 +933,7 @@ static void debuggerBreak(int n, char **args) u32 addr; Function *f; CompileUnit *u; - + if(elfFindLineInModule(&addr, name, line)) { if(elfGetCurrentFunction(addr, &f, &u)) { u32 addr2; @@ -956,7 +956,7 @@ static void debuggerBreak(int n, char **args) Function *f; CompileUnit *u; u32 addr; - + if(elfGetCurrentFunction(armNextPC, &f, &u)) { if(elfFindLineInUnit(&addr, u, line)) { if(elfGetCurrentFunction(addr, &f, &u)) { @@ -997,14 +997,14 @@ static void debuggerBreak(int n, char **args) // debuggerApplyBreakpoint(address, i, size); debuggerNumOfBreakpoints++; if(size) - printf("Added ARM breakpoint at %08x\n", address); + 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]); + printf("%s is not a function symbol\n", args[1]); } } else - debuggerUsage("break"); + debuggerUsage("break"); } static void debuggerBreakThumb(int n, char **args) @@ -1020,7 +1020,7 @@ static void debuggerBreakThumb(int n, char **args) debuggerNumOfBreakpoints++; printf("Added THUMB breakpoint at %08x\n", address); } else - debuggerUsage("bt"); + debuggerUsage("bt"); } static void debuggerBreakArm(int n, char **args) @@ -1039,7 +1039,7 @@ static void debuggerBreakArm(int n, char **args) debuggerUsage("ba"); } -/*extern*/ void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, +/*extern*/ void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t) { const char *type = "write"; @@ -1047,13 +1047,13 @@ static void debuggerBreakArm(int n, char **args) type = "change"; if(size == 2) - printf("Breakpoint (on %s) address %08x old:%08x new:%08x\n", + printf("Breakpoint (on %s) address %08x old:%08x new:%08x\n", type, address, oldvalue, value); else if(size == 1) - printf("Breakpoint (on %s) address %08x old:%04x new:%04x\n", + printf("Breakpoint (on %s) address %08x old:%04x new:%04x\n", type, address, (u16)oldvalue,(u16)value); else - printf("Breakpoint (on %s) address %08x old:%02x new:%02x\n", + printf("Breakpoint (on %s) address %08x old:%02x new:%02x\n", type, address, (u8)oldvalue, (u8)value); debugger = true; } @@ -1070,12 +1070,12 @@ static void debuggerBreakWriteClear(int n, char **args) (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || - (address >= 0x07000000 && address < 0x07000400))) { + (address >= 0x07000000 && address < 0x07000400))) { printf("Invalid address: %08x\n", address); return; } - - u32 final = address + n; + + u32 final = address + n; switch(address >> 24) { case 2: { @@ -1173,12 +1173,12 @@ static void debuggerBreakWrite(int n, char **args) sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); - + if (! ((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || - (address >= 0x07000000 && address < 0x07000400))) { + (address >= 0x07000000 && address < 0x07000400))) { printf("Invalid address: %08x\n", address); return; } @@ -1227,9 +1227,9 @@ static void debuggerBreakWrite(int n, char **args) freezeOAM[(address + i) & 0x3ff] = 1; break; } - + } else - debuggerUsage("bpw"); + debuggerUsage("bpw"); } static void debuggerBreakChangeClear(int n, char **args) @@ -1239,17 +1239,17 @@ static void debuggerBreakChangeClear(int n, char **args) sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); - + if (! ((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || - (address >= 0x07000000 && address < 0x07000400))) { + (address >= 0x07000000 && address < 0x07000400))) { printf("Invalid address: %08x\n", address); return; } - - u32 final = address + n; + + u32 final = address + n; switch(address >> 24) { case 2: { @@ -1329,7 +1329,7 @@ static void debuggerBreakChangeClear(int n, char **args) for(i = 0; i < 0x400; i++) if(freezeOAM[i] == 2) freezeOAM[i] = 0; - + printf("Cleared all break on change\n"); } else debuggerUsage("bpcc"); @@ -1346,12 +1346,12 @@ static void debuggerBreakChange(int n, char **args) sscanf(args[1], "%x", &address); int n = 0; sscanf(args[2], "%d", &n); - + if (! ((address >= 0x02000000 && address < 0x02040000) || (address >= 0x03000000 && address < 0x03008000) || (address >= 0x05000000 && address < 0x05000400) || (address >= 0x06000000 && address < 0x06018000) || - (address >= 0x07000000 && address < 0x07000400))) { + (address >= 0x07000000 && address < 0x07000400))) { printf("Invalid address: %08x\n", address); return; } @@ -1372,7 +1372,7 @@ static void debuggerBreakChange(int n, char **args) return; } printf("Added break on change at %08x for %d bytes\n", address, n); - + switch(address >> 24) { case 2: for (int i = 0; i < n; i++) @@ -1431,8 +1431,8 @@ static void debuggerDisassembleThumb(FILE *f, u32 pc, int count) if(l > len) len = l; } - sprintf(format, "%%08x %%-%ds %%s\n", len); - + sprintf(format, "%%08x %%-%ds %%s\n", len); + for(i = 0; i < count; i++) { u32 addr = pc; pc += disThumb(pc, buffer, 2); @@ -1455,7 +1455,7 @@ static void debuggerDisassembleArm(int n, char **args) if(n >= 3) { sscanf(args[2], "%d", &count); } - debuggerDisassembleArm(stdout, pc, count); + debuggerDisassembleArm(stdout, pc, count); } static void debuggerDisassembleThumb(int n, char **args) @@ -1508,7 +1508,7 @@ static void debuggerFileDisassembleArm(int n, char **args) if(n >= 4) { sscanf(args[3], "%d", &count); } - debuggerDisassembleArm(f, pc, count); + debuggerDisassembleArm(f, pc, count); fclose(f); } @@ -1526,7 +1526,7 @@ static void debuggerFileDisassembleThumb(int n, char **args) printf("Error: cannot open file %s\n", args[1]); return; } - + if(n >= 3) { sscanf(args[2], "%x", &pc); } @@ -1547,7 +1547,7 @@ void debuggerFindText(int n, char **args) { SearchResults = 0; sscanf(args[1], "%x", &SearchStart); - + if (n == 4) { sscanf(args[2], "%u", &SearchMaxMatches); @@ -1567,7 +1567,7 @@ void debuggerFindText(int n, char **args) }; debuggerDoSearch (); - + } else debuggerUsage("ft"); }; @@ -1578,7 +1578,7 @@ void debuggerFindHex(int n, char **args) { SearchResults = 0; sscanf(args[1], "%x", &SearchStart); - + char SearchHex [128]; if (n == 4) { @@ -1609,9 +1609,9 @@ void debuggerFindHex(int n, char **args) sscanf (&SearchHex [i << 1], "%02x", &cbuf); SearchData [i] = cbuf; }; - + debuggerDoSearch (); - + } else debuggerUsage("fh"); }; @@ -1626,10 +1626,10 @@ void debuggerFindResume(int n, char **args) debuggerUsage("fr"); return; }; - + if (n == 2) sscanf(args[1], "%u", &SearchMaxMatches); - + debuggerDoSearch(); } else @@ -1857,16 +1857,16 @@ static 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("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("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("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); + printf("DM3CNT = %08x\n", (DM3CNT_H<<16)|DM3CNT_L); } static void debuggerIoTimer() @@ -1883,7 +1883,7 @@ static void debuggerIoTimer() static void debuggerIoMisc() { - printf("P1 = %04x\n", P1); + printf("P1 = %04x\n", P1); printf("IE = %04x\n", IE); printf("IF = %04x\n", IF); printf("IME = %04x\n", IME); @@ -1917,7 +1917,7 @@ static void debuggerEditByte(int n, char **args) sscanf(args[2], "%x", &byte); debuggerWriteByte(address, (u8)byte); } else - debuggerUsage("eb"); + debuggerUsage("eb"); } static void debuggerEditHalfWord(int n, char **args) @@ -1933,7 +1933,7 @@ static void debuggerEditHalfWord(int n, char **args) sscanf(args[2], "%x", &HalfWord); debuggerWriteHalfWord(address, (u16)HalfWord); } else - debuggerUsage("eh"); + debuggerUsage("eh"); } static void debuggerEditRegister(int n, char **args) @@ -1951,7 +1951,7 @@ static void debuggerEditRegister(int n, char **args) reg[r].I=val; printf("Register changed.\n"); } else - debuggerUsage("er"); + debuggerUsage("er"); } static void debuggerEdit(int n, char **args) @@ -1967,7 +1967,7 @@ static void debuggerEdit(int n, char **args) sscanf(args[2], "%x", &byte); debuggerWriteMemory(address, (u32)byte); } else - debuggerUsage("ew"); + debuggerUsage("ew"); } @@ -1995,7 +1995,7 @@ static void debuggerMemoryByte(int n, char **args) 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), @@ -2005,7 +2005,7 @@ static void debuggerMemoryByte(int n, char **args) addr += 16; } } else - debuggerUsage("mb"); + debuggerUsage("mb"); } static void debuggerMemoryHalfWord(int n, char **args) @@ -2031,7 +2031,7 @@ static void debuggerMemoryHalfWord(int n, char **args) 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), @@ -2041,7 +2041,7 @@ static void debuggerMemoryHalfWord(int n, char **args) addr += 16; } } else - debuggerUsage("mh"); + debuggerUsage("mh"); } static void debuggerMemory(int n, char **args) @@ -2070,7 +2070,7 @@ static void debuggerMemory(int n, char **args) 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), @@ -2080,7 +2080,7 @@ static void debuggerMemory(int n, char **args) addr += 16; } } else - debuggerUsage("mw"); + debuggerUsage("mw"); } static void debuggerQuit(int, char **) @@ -2088,7 +2088,7 @@ static 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; @@ -2131,22 +2131,22 @@ static void debuggerDumpLoad(int n, char** args) const char *file; FILE *f; int c; - + if(n==3) { file=args[1]; - + sscanf(args[2],"%x",&address); - + f=fopen(file,"rb"); if(!f) { printf("Error opening file.\n"); return; } - + fseek(f,0,SEEK_END); int size=ftell(f); fseek(f,0,SEEK_SET); - + for(int i=0;i 4) { //conditional args handled separately int i = debuggerNumOfBreakpoints; - + u32 address = 0; sscanf(args[1],"%x", &address); - + debuggerBreakpointList[i].address = address; debuggerBreakpointList[i].value = debuggerReadHalfWord(address); debuggerBreakpointList[i].size = 0; - + debuggerCondValidate(n, args,2); } else debuggerUsage("cbt"); @@ -2209,10 +2209,10 @@ static void debuggerCondBreakThumb(int n, char **args) static void debuggerCondBreakArm(int n, char **args) { if(n > 4) { //conditional args handled separately - + int i = debuggerNumOfBreakpoints; u32 address = 0; - + sscanf(args[1],"%x", &address); debuggerBreakpointList[i].address = address; debuggerBreakpointList[i].value = debuggerReadMemory(address); @@ -2230,29 +2230,29 @@ static void debuggerCondValidate(int n, char **args,int start) 2: value 3: size */ - + int i=debuggerNumOfBreakpoints; - + char *address=args[start]; const char *op=args[start+1]; char *value=args[start+2]; const char *tsize,*taddress,*tvalue; int rel=0; - + u32 value1=0; u32 value2=0; - + char size=0; int j=1; - + if(n==6) { size = args[start+3][0]; if(size != 'b' && size != 'h' && size != 'w') { printf("Invalid size.\n"); return; } - + switch(size) { case 'b': debuggerBreakpointList[i].cond_size=1; @@ -2276,7 +2276,7 @@ static void debuggerCondValidate(int n, char **args,int start) j++; } address[j-1]=0; - + sscanf(address,"%x",&value1); switch(size) { case 'h': @@ -2307,7 +2307,7 @@ static void debuggerCondValidate(int n, char **args,int start) } address[j-1]=0; sscanf(address,"%d",&value1); - + if(value1 > 16) { printf("Invalid Register.\n"); return; @@ -2324,12 +2324,12 @@ static void debuggerCondValidate(int n, char **args,int start) debuggerBreakpointList[i].cond_address = value1; - // Check op + // Check op switch(op[0]) { case '=': // 1 if (op[1] == '=' && op[2]==0) rel=1; - else + else goto error; break; case '!': //2 @@ -2359,7 +2359,7 @@ static void debuggerCondValidate(int n, char **args,int start) printf("Invalid comparison operator.\n"); return; } - + if(op==0) { printf("Invalid comparison operator.\n"); return; @@ -2404,7 +2404,7 @@ static void debuggerCondValidate(int n, char **args,int start) } value[j-1]=0; sscanf(value,"%d",&value2); - + if(value2 > 16) { printf("Invalid Register.\n"); return; @@ -2416,7 +2416,7 @@ static void debuggerCondValidate(int n, char **args,int start) sscanf(value, "%x",&value2); debuggerBreakpointList[i].ia2=false; tvalue="0x"; - + switch(size) { case 'b': value2 &=0xFF; @@ -2431,10 +2431,10 @@ static void debuggerCondValidate(int n, char **args,int start) } break; } - + debuggerBreakpointList[i].cond_value = value2; debuggerNumOfBreakpoints++; - + // At here, everything's set. Display message. switch(size) { case 0: @@ -2477,13 +2477,13 @@ static bool debuggerCondEvaluate(int num) // check if there is a condition if(debuggerBreakpointList[num].cond_rel == 0) return true; - + u32 address=debuggerBreakpointList[num].cond_address; char size=debuggerBreakpointList[num].cond_size; u32 value=debuggerBreakpointList[num].cond_value; u32 value1=0; u32 value2=0; - + if(address<17) value1=reg[address].I; else { @@ -2499,7 +2499,7 @@ static bool debuggerCondEvaluate(int num) break; } } - + //value2 if(debuggerBreakpointList[num].ia2) { //is address or register if(value<17) @@ -2618,11 +2618,11 @@ char* strqtok (char* string, const char* ctrl) char buffer[1024]; char *commands[10]; int commandCount = 0; - + if(emulator.emuUpdateCPSR) emulator.emuUpdateCPSR(); debuggerRegisters(0, NULL); - + while(debugger) { systemSoundPause(); debuggerDisableBreakpoints(); @@ -2649,7 +2649,7 @@ char* strqtok (char* string, const char* ctrl) debuggerCommands[j].function(commandCount, commands); break; } - } + } } } diff --git a/src/simpleFilter.cpp b/src/simpleFilter.cpp index 7c8b68e2..9ad41e7f 100644 --- a/src/simpleFilter.cpp +++ b/src/simpleFilter.cpp @@ -1,303 +1,303 @@ -// 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 "System.h" - -void Simple2x16(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); -} - - -void Simple3x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ -#define magnification 3 -#define colorBytes 2 // 16 bit colors = 2 byte colors - - // Generic Simple magnification filter - int x, y; // Source Position Counter - unsigned int dx, dy; // Destination pixel's pixels - unsigned short col; // Source color - - srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image - dstPitch = dstPitch / colorBytes; - - unsigned short *src, *dst, *dst2; - src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times - dst = (unsigned short *)dstPtr; - - for (y = 0; y < height; y++) // Line - { - for (x = 0; x < width; x++) // Pixel in Line - { - col = *src; - - dst2 = dst; - *dst2 = col; - for (dy = 0; dy < magnification; dy++) - { - for (dx = 0; dx < magnification; dx++) - { - *dst2 = col; - dst2++; - } - dst2+=dstPitch; - dst2-=magnification; - } - - src++; - dst+=magnification; - } - src+=srcPitch; - dst+=dstPitch * magnification; - dst-=width * magnification; - } -#undef magnification -#undef colorBytes -} - - - -void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ -#define magnification 3 -#define colorBytes 4 // 32 bit colors = 4 byte colors - - // Generic Simple magnification filter - int x, y; // Source Position Counter - unsigned int dx, dy; // Destination pixel's pixels - unsigned int col; // Source color - - srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image - dstPitch = dstPitch / colorBytes; - - unsigned int *src, *dst, *dst2; - src = (unsigned int *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times - dst = (unsigned int *)dstPtr; - - for (y = 0; y < height; y++) // Line - { - for (x = 0; x < width; x++) // Pixel in Line - { - col = *src; - - dst2 = dst; - *dst2 = col; - for (dy = 0; dy < magnification; dy++) - { - for (dx = 0; dx < magnification; dx++) - { - *dst2 = col; - dst2++; - } - dst2+=dstPitch; - dst2-=magnification; - } - - src++; - dst+=magnification; - } - src+=srcPitch; - dst+=dstPitch * magnification; - dst-=width * magnification; - } -#undef magnification -#undef colorBytes -} - -void Simple4x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ -#define magnification 4 -#define colorBytes 2 // 16 bit colors = 2 byte colors - - // Generic Simple magnification filter - int x, y; // Source Position Counter - unsigned int dx, dy; // Destination pixel's pixels - unsigned short col; // Source color - - srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image - dstPitch = dstPitch / colorBytes; - - unsigned short *src, *dst, *dst2; - src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times - dst = (unsigned short *)dstPtr; - - for (y = 0; y < height; y++) // Line - { - for (x = 0; x < width; x++) // Pixel in Line - { - col = *src; - - dst2 = dst; - *dst2 = col; - for (dy = 0; dy < magnification; dy++) - { - for (dx = 0; dx < magnification; dx++) - { - *dst2 = col; - dst2++; - } - dst2+=dstPitch; - dst2-=magnification; - } - - src++; - dst+=magnification; - } - src+=srcPitch; - dst+=dstPitch * magnification; - dst-=width * magnification; - } -#undef magnification -#undef colorBytes -} - - - -void Simple4x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ -#define magnification 4 -#define colorBytes 4 // 32 bit colors = 4 byte colors - - // Generic Simple magnification filter - int x, y; // Source Position Counter - unsigned int dx, dy; // Destination pixel's pixels - unsigned int col; // Source color - - srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image - dstPitch = dstPitch / colorBytes; - - unsigned int *src, *dst, *dst2; - src = (unsigned int *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times - dst = (unsigned int *)dstPtr; - - for (y = 0; y < height; y++) // Line - { - for (x = 0; x < width; x++) // Pixel in Line - { - col = *src; - - dst2 = dst; - *dst2 = col; - for (dy = 0; dy < magnification; dy++) - { - for (dx = 0; dx < magnification; dx++) - { - *dst2 = col; - dst2++; - } - dst2+=dstPitch; - dst2-=magnification; - } - - src++; - dst+=magnification; - } - src+=srcPitch; - dst+=dstPitch * magnification; - dst-=width * magnification; - } -#undef magnification -#undef colorBytes -} +// 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 "System.h" + +void Simple2x16(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); +} + + +void Simple3x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ +#define magnification 3 +#define colorBytes 2 // 16 bit colors = 2 byte colors + + // Generic Simple magnification filter + int x, y; // Source Position Counter + unsigned int dx, dy; // Destination pixel's pixels + unsigned short col; // Source color + + srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image + dstPitch = dstPitch / colorBytes; + + unsigned short *src, *dst, *dst2; + src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times + dst = (unsigned short *)dstPtr; + + for (y = 0; y < height; y++) // Line + { + for (x = 0; x < width; x++) // Pixel in Line + { + col = *src; + + dst2 = dst; + *dst2 = col; + for (dy = 0; dy < magnification; dy++) + { + for (dx = 0; dx < magnification; dx++) + { + *dst2 = col; + dst2++; + } + dst2+=dstPitch; + dst2-=magnification; + } + + src++; + dst+=magnification; + } + src+=srcPitch; + dst+=dstPitch * magnification; + dst-=width * magnification; + } +#undef magnification +#undef colorBytes +} + + + +void Simple3x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ +#define magnification 3 +#define colorBytes 4 // 32 bit colors = 4 byte colors + + // Generic Simple magnification filter + int x, y; // Source Position Counter + unsigned int dx, dy; // Destination pixel's pixels + unsigned int col; // Source color + + srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image + dstPitch = dstPitch / colorBytes; + + unsigned int *src, *dst, *dst2; + src = (unsigned int *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times + dst = (unsigned int *)dstPtr; + + for (y = 0; y < height; y++) // Line + { + for (x = 0; x < width; x++) // Pixel in Line + { + col = *src; + + dst2 = dst; + *dst2 = col; + for (dy = 0; dy < magnification; dy++) + { + for (dx = 0; dx < magnification; dx++) + { + *dst2 = col; + dst2++; + } + dst2+=dstPitch; + dst2-=magnification; + } + + src++; + dst+=magnification; + } + src+=srcPitch; + dst+=dstPitch * magnification; + dst-=width * magnification; + } +#undef magnification +#undef colorBytes +} + +void Simple4x16(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ +#define magnification 4 +#define colorBytes 2 // 16 bit colors = 2 byte colors + + // Generic Simple magnification filter + int x, y; // Source Position Counter + unsigned int dx, dy; // Destination pixel's pixels + unsigned short col; // Source color + + srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image + dstPitch = dstPitch / colorBytes; + + unsigned short *src, *dst, *dst2; + src = (unsigned short *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times + dst = (unsigned short *)dstPtr; + + for (y = 0; y < height; y++) // Line + { + for (x = 0; x < width; x++) // Pixel in Line + { + col = *src; + + dst2 = dst; + *dst2 = col; + for (dy = 0; dy < magnification; dy++) + { + for (dx = 0; dx < magnification; dx++) + { + *dst2 = col; + dst2++; + } + dst2+=dstPitch; + dst2-=magnification; + } + + src++; + dst+=magnification; + } + src+=srcPitch; + dst+=dstPitch * magnification; + dst-=width * magnification; + } +#undef magnification +#undef colorBytes +} + + + +void Simple4x32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, + u8 *dstPtr, u32 dstPitch, int width, int height) +{ +#define magnification 4 +#define colorBytes 4 // 32 bit colors = 4 byte colors + + // Generic Simple magnification filter + int x, y; // Source Position Counter + unsigned int dx, dy; // Destination pixel's pixels + unsigned int col; // Source color + + srcPitch = (srcPitch / colorBytes) - width; // This is the part of the source pitch in pixels that is more than the source image + dstPitch = dstPitch / colorBytes; + + unsigned int *src, *dst, *dst2; + src = (unsigned int *)srcPtr; // Since everything is time-critical this should be better than converting the pointers x*y times + dst = (unsigned int *)dstPtr; + + for (y = 0; y < height; y++) // Line + { + for (x = 0; x < width; x++) // Pixel in Line + { + col = *src; + + dst2 = dst; + *dst2 = col; + for (dy = 0; dy < magnification; dy++) + { + for (dx = 0; dx < magnification; dx++) + { + *dst2 = col; + dst2++; + } + dst2+=dstPitch; + dst2-=magnification; + } + + src++; + dst+=magnification; + } + src+=srcPitch; + dst+=dstPitch * magnification; + dst-=width * magnification; + } +#undef magnification +#undef colorBytes +} diff --git a/src/snd_interp.cpp b/src/snd_interp.cpp index 8ee43e70..3dd6fd1c 100644 --- a/src/snd_interp.cpp +++ b/src/snd_interp.cpp @@ -1,481 +1,481 @@ -#include - -#include "libresample-0.1.3/include/libresample.h" -#include "snd_interp.h" - -// this was once borrowed from libmodplug, and was also used to generate the FIR coefficient -// tables that ZSNES uses for its "FIR" interpolation mode - -/* - ------------------------------------------------------------------------------------------------ - fir interpolation doc, - (derived from "an engineer's guide to fir digital filters", n.j. loy) - - calculate coefficients for ideal lowpass filter (with cutoff = fc in 0..1 (mapped to 0..nyquist)) - c[-N..N] = (i==0) ? fc : sin(fc*pi*i)/(pi*i) - - then apply selected window to coefficients - c[-N..N] *= w(0..N) - with n in 2*N and w(n) being a window function (see loy) - - then calculate gain and scale filter coefs to have unity gain. - ------------------------------------------------------------------------------------------------ -*/ -// quantizer scale of window coefs -#define WFIR_QUANTBITS 14 -#define WFIR_QUANTSCALE (1L<>1) -// cutoff (1.0 == pi/2) -#define WFIR_CUTOFF 0.95f -// wfir type -#define WFIR_HANN 0 -#define WFIR_HAMMING 1 -#define WFIR_BLACKMANEXACT 2 -#define WFIR_BLACKMAN3T61 3 -#define WFIR_BLACKMAN3T67 4 -#define WFIR_BLACKMAN4T92 5 -#define WFIR_BLACKMAN4T74 6 -#define WFIR_KAISER4T 7 -#define WFIR_LANCZOS 8 -#define WFIR_TYPE WFIR_LANCZOS -// wfir help -#ifndef M_zPI -#define M_zPI 3.1415926535897932384626433832795 -#endif -#define M_zEPS 1e-8 -#define M_zBESSELEPS 1e-21 - -class CzWINDOWEDFIR -{ public: - CzWINDOWEDFIR( ); - ~CzWINDOWEDFIR( ); - float coef( int _PCnr, float _POfs, float _PCut, int _PWidth, int _PType ) //float _PPos, float _PFc, int _PLen ) - { double _LWidthM1 = _PWidth-1; - double _LWidthM1Half = 0.5*_LWidthM1; - double _LPosU = ((double)_PCnr - _POfs); - double _LPos = _LPosU-_LWidthM1Half; - double _LPIdl = 2.0*M_zPI/_LWidthM1; - double _LWc,_LSi; - if( fabs(_LPos)_LScale)?_LScale:_LCoef) ); - } - } -} - -CzWINDOWEDFIR::~CzWINDOWEDFIR() -{ // nothing todo -} - -CzWINDOWEDFIR sfir; - -template -class sample_buffer -{ - int ptr, filled; - T * buffer; - -public: - sample_buffer() : ptr(0), filled(0) - { - buffer = new T[buffer_size]; - } - ~sample_buffer() - { - if (buffer) delete [] buffer; - } - - void clear() - { - ptr = filled = 0; - } - - inline int size() const - { - return filled; - } - - inline void push_back(T sample) - { - buffer[ptr] = sample; - if (++ptr >= buffer_size) ptr = 0; - if (filled < buffer_size) filled++; - } - - inline void erase(int count) - { - if (count > filled) filled = 0; - else filled -= count; - } - - inline T operator[] (int index) const - { - index += ptr - filled; - if (index < 0) index += buffer_size; - else if (index > buffer_size) index -= buffer_size; - return buffer[index]; - } -}; - -class foo_null : public foo_interpolate -{ - int sample; - -public: - foo_null() : sample(0) {} - ~foo_null() {} - - void reset() {} - - void push(int psample) - { - sample = psample; - } - - int pop() - { - return sample; - } -}; - -class foo_linear : public foo_interpolate -{ - sample_buffer samples; - - int position; - - inline int smp(int index) - { - return samples[index]; - } - -public: - foo_linear() - { - position = 0; - } - - ~foo_linear() {} - - void reset() - { - position = 0; - samples.clear(); - } - - - void push(int sample) - { - samples.push_back(sample); - } - - int pop() - { - int ret; - - if (position > 0x7fff) - { - int howmany = position >> 15; - position &= 0x7fff; - samples.erase(howmany); - } - - if (samples.size() < 2) return 0; - - ret = smp(0) * (0x8000 - position); - ret += smp(1) * position; - ret >>= 15; - - position+=lrate; - - return ret; - } -}; - -// and this integer cubic interpolation implementation was kind of borrowed from either TiMidity -// or the P.E.Op.S. SPU project, or is in use in both, or something... - -class foo_cubic : public foo_interpolate -{ - sample_buffer samples; - - int position; - - inline int smp(int index) - { - return samples[index]; - } - -public: - foo_cubic() - { - position = 0; - } - - ~foo_cubic() {} - - void reset() - { - position = 0; - samples.clear(); - } - - void push(int sample) - { - samples.push_back(sample); - } - - int pop() - { - int ret; - - if (position > 0x7fff) - { - int howmany = position >> 15; - position &= 0x7fff; - samples.erase(howmany); - } - - if (samples.size() < 4) return 0; - - ret = smp(3) - 3 * smp(2) + 3 * smp(1) - smp(0); - ret *= (position - (2 << 15)) / 6; - ret >>= 15; - ret += smp(2) - 2 * smp(1) + smp(0); - ret *= (position - (1 << 15)) >> 1; - ret >>= 15; - ret += smp(1) - smp(0); - ret *= position; - ret >>= 15; - ret += smp(0); - - if (ret > 32767) ret = 32767; - else if (ret < -32768) ret = -32768; - - position+=lrate; - - return ret; - } -}; - -class foo_fir : public foo_interpolate -{ - sample_buffer samples; - - int position; - - inline int smp(int index) - { - return samples[index]; - } - -public: - foo_fir() - { - position = 0; - } - - ~foo_fir() - { - position=666; - } - - void reset() - { - position = 0; - samples.clear(); - } - - void push(int sample) - { - samples.push_back(sample); - } - - int pop() - { - int ret; - - if (position > 0x7fff) - { - int howmany = position >> 15; - position &= 0x7fff; - samples.erase(howmany); - } - - if (samples.size() < 8) return 0; - - ret = smp(0) * CzWINDOWEDFIR::lut[(position & ~7) ]; - ret += smp(1) * CzWINDOWEDFIR::lut[(position & ~7) + 1]; - ret += smp(2) * CzWINDOWEDFIR::lut[(position & ~7) + 2]; - ret += smp(3) * CzWINDOWEDFIR::lut[(position & ~7) + 3]; - ret += smp(4) * CzWINDOWEDFIR::lut[(position & ~7) + 4]; - ret += smp(5) * CzWINDOWEDFIR::lut[(position & ~7) + 5]; - ret += smp(6) * CzWINDOWEDFIR::lut[(position & ~7) + 6]; - ret += smp(7) * CzWINDOWEDFIR::lut[(position & ~7) + 7]; - ret >>= WFIR_QUANTBITS; - - if (ret > 32767) ret = 32767; - else if (ret < -32768) ret = -32768; - - position+=lrate; - return ret; - } -}; - -class foo_libresample : public foo_interpolate -{ - sample_buffer samples; - - void * resampler; - -public: - foo_libresample() - { - resampler = 0; - } - - ~foo_libresample() - { - reset(); - } - - void reset() - { - samples.clear(); - if (resampler) - { - resample_close(resampler); - resampler = 0; - } - } - - void push(int sample) - { - samples.push_back(float(sample)); - } - - int pop() - { - int ret; - if (!resampler) - { - resampler = resample_open(0, .25, 44100. / 4000.); - } - - { - int count = samples.size(); - float * in = new float[count]; - float out; - int used, returned; - - for (used = 0; used < count; used++) - { - in[used] = samples[used]; - } - - returned = resample_process(resampler, 32767. / lrate, in, count, 0, &used, &out, 1); - if (used) - { - samples.erase(used); - } - - delete [] in; - - if (returned < 1) return 0; - - ret = (int)out; - } - - if (ret > 32767) ret = 32767; - else if (ret < -32768) ret = -32768; - - return ret; - } -}; - -foo_interpolate * get_filter(int which) -{ - switch (which) - { - default: - return new foo_null; - case 1: - return new foo_linear; - case 2: - return new foo_cubic; - case 3: - return new foo_fir; - case 4: - return new foo_libresample; - } -} +#include + +#include "libresample-0.1.3/include/libresample.h" +#include "snd_interp.h" + +// this was once borrowed from libmodplug, and was also used to generate the FIR coefficient +// tables that ZSNES uses for its "FIR" interpolation mode + +/* + ------------------------------------------------------------------------------------------------ + fir interpolation doc, + (derived from "an engineer's guide to fir digital filters", n.j. loy) + + calculate coefficients for ideal lowpass filter (with cutoff = fc in 0..1 (mapped to 0..nyquist)) + c[-N..N] = (i==0) ? fc : sin(fc*pi*i)/(pi*i) + + then apply selected window to coefficients + c[-N..N] *= w(0..N) + with n in 2*N and w(n) being a window function (see loy) + + then calculate gain and scale filter coefs to have unity gain. + ------------------------------------------------------------------------------------------------ +*/ +// quantizer scale of window coefs +#define WFIR_QUANTBITS 14 +#define WFIR_QUANTSCALE (1L<>1) +// cutoff (1.0 == pi/2) +#define WFIR_CUTOFF 0.95f +// wfir type +#define WFIR_HANN 0 +#define WFIR_HAMMING 1 +#define WFIR_BLACKMANEXACT 2 +#define WFIR_BLACKMAN3T61 3 +#define WFIR_BLACKMAN3T67 4 +#define WFIR_BLACKMAN4T92 5 +#define WFIR_BLACKMAN4T74 6 +#define WFIR_KAISER4T 7 +#define WFIR_LANCZOS 8 +#define WFIR_TYPE WFIR_LANCZOS +// wfir help +#ifndef M_zPI +#define M_zPI 3.1415926535897932384626433832795 +#endif +#define M_zEPS 1e-8 +#define M_zBESSELEPS 1e-21 + +class CzWINDOWEDFIR +{ public: + CzWINDOWEDFIR( ); + ~CzWINDOWEDFIR( ); + float coef( int _PCnr, float _POfs, float _PCut, int _PWidth, int _PType ) //float _PPos, float _PFc, int _PLen ) + { double _LWidthM1 = _PWidth-1; + double _LWidthM1Half = 0.5*_LWidthM1; + double _LPosU = ((double)_PCnr - _POfs); + double _LPos = _LPosU-_LWidthM1Half; + double _LPIdl = 2.0*M_zPI/_LWidthM1; + double _LWc,_LSi; + if( fabs(_LPos)_LScale)?_LScale:_LCoef) ); + } + } +} + +CzWINDOWEDFIR::~CzWINDOWEDFIR() +{ // nothing todo +} + +CzWINDOWEDFIR sfir; + +template +class sample_buffer +{ + int ptr, filled; + T * buffer; + +public: + sample_buffer() : ptr(0), filled(0) + { + buffer = new T[buffer_size]; + } + ~sample_buffer() + { + if (buffer) delete [] buffer; + } + + void clear() + { + ptr = filled = 0; + } + + inline int size() const + { + return filled; + } + + inline void push_back(T sample) + { + buffer[ptr] = sample; + if (++ptr >= buffer_size) ptr = 0; + if (filled < buffer_size) filled++; + } + + inline void erase(int count) + { + if (count > filled) filled = 0; + else filled -= count; + } + + inline T operator[] (int index) const + { + index += ptr - filled; + if (index < 0) index += buffer_size; + else if (index > buffer_size) index -= buffer_size; + return buffer[index]; + } +}; + +class foo_null : public foo_interpolate +{ + int sample; + +public: + foo_null() : sample(0) {} + ~foo_null() {} + + void reset() {} + + void push(int psample) + { + sample = psample; + } + + int pop() + { + return sample; + } +}; + +class foo_linear : public foo_interpolate +{ + sample_buffer samples; + + int position; + + inline int smp(int index) + { + return samples[index]; + } + +public: + foo_linear() + { + position = 0; + } + + ~foo_linear() {} + + void reset() + { + position = 0; + samples.clear(); + } + + + void push(int sample) + { + samples.push_back(sample); + } + + int pop() + { + int ret; + + if (position > 0x7fff) + { + int howmany = position >> 15; + position &= 0x7fff; + samples.erase(howmany); + } + + if (samples.size() < 2) return 0; + + ret = smp(0) * (0x8000 - position); + ret += smp(1) * position; + ret >>= 15; + + position+=lrate; + + return ret; + } +}; + +// and this integer cubic interpolation implementation was kind of borrowed from either TiMidity +// or the P.E.Op.S. SPU project, or is in use in both, or something... + +class foo_cubic : public foo_interpolate +{ + sample_buffer samples; + + int position; + + inline int smp(int index) + { + return samples[index]; + } + +public: + foo_cubic() + { + position = 0; + } + + ~foo_cubic() {} + + void reset() + { + position = 0; + samples.clear(); + } + + void push(int sample) + { + samples.push_back(sample); + } + + int pop() + { + int ret; + + if (position > 0x7fff) + { + int howmany = position >> 15; + position &= 0x7fff; + samples.erase(howmany); + } + + if (samples.size() < 4) return 0; + + ret = smp(3) - 3 * smp(2) + 3 * smp(1) - smp(0); + ret *= (position - (2 << 15)) / 6; + ret >>= 15; + ret += smp(2) - 2 * smp(1) + smp(0); + ret *= (position - (1 << 15)) >> 1; + ret >>= 15; + ret += smp(1) - smp(0); + ret *= position; + ret >>= 15; + ret += smp(0); + + if (ret > 32767) ret = 32767; + else if (ret < -32768) ret = -32768; + + position+=lrate; + + return ret; + } +}; + +class foo_fir : public foo_interpolate +{ + sample_buffer samples; + + int position; + + inline int smp(int index) + { + return samples[index]; + } + +public: + foo_fir() + { + position = 0; + } + + ~foo_fir() + { + position=666; + } + + void reset() + { + position = 0; + samples.clear(); + } + + void push(int sample) + { + samples.push_back(sample); + } + + int pop() + { + int ret; + + if (position > 0x7fff) + { + int howmany = position >> 15; + position &= 0x7fff; + samples.erase(howmany); + } + + if (samples.size() < 8) return 0; + + ret = smp(0) * CzWINDOWEDFIR::lut[(position & ~7) ]; + ret += smp(1) * CzWINDOWEDFIR::lut[(position & ~7) + 1]; + ret += smp(2) * CzWINDOWEDFIR::lut[(position & ~7) + 2]; + ret += smp(3) * CzWINDOWEDFIR::lut[(position & ~7) + 3]; + ret += smp(4) * CzWINDOWEDFIR::lut[(position & ~7) + 4]; + ret += smp(5) * CzWINDOWEDFIR::lut[(position & ~7) + 5]; + ret += smp(6) * CzWINDOWEDFIR::lut[(position & ~7) + 6]; + ret += smp(7) * CzWINDOWEDFIR::lut[(position & ~7) + 7]; + ret >>= WFIR_QUANTBITS; + + if (ret > 32767) ret = 32767; + else if (ret < -32768) ret = -32768; + + position+=lrate; + return ret; + } +}; + +class foo_libresample : public foo_interpolate +{ + sample_buffer samples; + + void * resampler; + +public: + foo_libresample() + { + resampler = 0; + } + + ~foo_libresample() + { + reset(); + } + + void reset() + { + samples.clear(); + if (resampler) + { + resample_close(resampler); + resampler = 0; + } + } + + void push(int sample) + { + samples.push_back(float(sample)); + } + + int pop() + { + int ret; + if (!resampler) + { + resampler = resample_open(0, .25, 44100. / 4000.); + } + + { + int count = samples.size(); + float * in = new float[count]; + float out; + int used, returned; + + for (used = 0; used < count; used++) + { + in[used] = samples[used]; + } + + returned = resample_process(resampler, 32767. / lrate, in, count, 0, &used, &out, 1); + if (used) + { + samples.erase(used); + } + + delete [] in; + + if (returned < 1) return 0; + + ret = (int)out; + } + + if (ret > 32767) ret = 32767; + else if (ret < -32768) ret = -32768; + + return ret; + } +}; + +foo_interpolate * get_filter(int which) +{ + switch (which) + { + default: + return new foo_null; + case 1: + return new foo_linear; + case 2: + return new foo_cubic; + case 3: + return new foo_fir; + case 4: + return new foo_libresample; + } +} diff --git a/src/snd_interp.h b/src/snd_interp.h index ca9cf348..c925ea67 100644 --- a/src/snd_interp.h +++ b/src/snd_interp.h @@ -1,35 +1,35 @@ -#ifndef __SND_INTERP_H__ -#define __SND_INTERP_H__ - -class foo_interpolate -{ -public: - foo_interpolate() {} - virtual ~foo_interpolate() {}; - - virtual void reset() = 0; - - long lrate; - - virtual void rate(double rate) - { - lrate = (int)(32768. * rate); - }; - - virtual void push(int sample) = 0; - virtual int pop() = 0; -}; - -extern foo_interpolate * get_filter(int which); - -/* - -// complicated, synced interface, specific to this implementation - -double calc_rate(int timer); -void interp_switch(int which); -void interp_reset(int ch); -inline void interp_push(int ch, int sample); -inline int interp_pop(int ch, double rate); */ - -#endif +#ifndef __SND_INTERP_H__ +#define __SND_INTERP_H__ + +class foo_interpolate +{ +public: + foo_interpolate() {} + virtual ~foo_interpolate() {}; + + virtual void reset() = 0; + + long lrate; + + virtual void rate(double rate) + { + lrate = (int)(32768. * rate); + }; + + virtual void push(int sample) = 0; + virtual int pop() = 0; +}; + +extern foo_interpolate * get_filter(int which); + +/* + +// complicated, synced interface, specific to this implementation + +double calc_rate(int timer); +void interp_switch(int which); +void interp_reset(int ch); +inline void interp_push(int ch, int sample); +inline int interp_pop(int ch, double rate); */ + +#endif diff --git a/src/thumb.h b/src/thumb.h index ebf036a6..577518bf 100644 --- a/src/thumb.h +++ b/src/thumb.h @@ -25,7 +25,7 @@ for (xxx=0; xxx<18; xxx++){ \ oldreg[xxx]=reg[xxx].I; \ } \ - } + } #ifdef C_CORE @@ -813,7 +813,7 @@ switch(opcode >> 8) { int source = (opcode >> 3) & 0x07; int shift = (opcode >> 6) & 0x1f; u32 value; - + if(shift) { LSL_RD_RM_I5; } else { @@ -839,7 +839,7 @@ switch(opcode >> 8) { int source = (opcode >> 3) & 0x07; int shift = (opcode >> 6) & 0x1f; u32 value; - + if(shift) { LSR_RD_RM_I5; } else { @@ -860,13 +860,13 @@ switch(opcode >> 8) { 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 { @@ -975,31 +975,31 @@ case 0x28: case 0x30: // ADD R0,#Offset8 ADD_RN_O8(0); - break; + break; case 0x31: // ADD R1,#Offset8 ADD_RN_O8(1); - break; + break; case 0x32: // ADD R2,#Offset8 ADD_RN_O8(2); - break; + break; case 0x33: // ADD R3,#Offset8 ADD_RN_O8(3); - break; + break; case 0x34: // ADD R4,#Offset8 ADD_RN_O8(4); - break; + break; case 0x35: // ADD R5,#Offset8 ADD_RN_O8(5); - break; + break; case 0x36: // ADD R6,#Offset8 ADD_RN_O8(6); - break; + break; case 0x37: // ADD R7,#Offset8 ADD_RN_O8(7); @@ -1046,7 +1046,7 @@ case 0x28: 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 +#ifdef BKPT_SUPPORT #define THUMB_CONSOLE_OUTPUT(a,b) \ if((opcode == 0x4000) && (reg[0].I == 0xC0DED00D)) {\ extern void (*dbgOutput)(char *, u32);\ @@ -1082,7 +1082,7 @@ case 0x28: value = 0; C_FLAG = false; } - reg[dest].I = value; + reg[dest].I = value; } N_FLAG = reg[dest].I & 0x80000000 ? true : false; Z_FLAG = reg[dest].I ? false : true; @@ -1104,7 +1104,7 @@ case 0x28: value = 0; C_FLAG = false; } - reg[dest].I = value; + reg[dest].I = value; } N_FLAG = reg[dest].I & 0x80000000 ? true : false; Z_FLAG = reg[dest].I ? false : true; @@ -1124,7 +1124,7 @@ case 0x28: if(value) { if(value < 32) { ASR_RD_RS; - reg[dest].I = value; + reg[dest].I = value; } else { if(reg[dest].I & 0x80000000){ reg[dest].I = 0xFFFFFFFF; @@ -1154,7 +1154,7 @@ case 0x28: // SBC Rd, Rs int dest = opcode & 0x07; u32 value = reg[(opcode >> 3)&7].I; - + // SBC SBC_RD_RS; } @@ -1164,7 +1164,7 @@ case 0x28: { int dest = opcode & 7; u32 value = reg[(opcode >> 3)&7].B.B0; - + if(value) { value = value & 0x1f; if(value == 0) { @@ -1222,7 +1222,7 @@ case 0x28: switch((opcode >> 6) & 3) { case 0x00: { - // ORR Rd, Rs + // ORR Rd, Rs int dest = opcode & 7; reg[dest].I |= reg[(opcode >> 3) & 7].I; Z_FLAG = reg[dest].I ? false : true; @@ -1293,7 +1293,7 @@ case 0x28: THUMB_PREFETCH; clockTicks = codeTicksAccessSeq16(armNextPC)+1; clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; - } + } break; case 3: // ADD Hd, Hs @@ -1304,7 +1304,7 @@ case 0x28: reg[15].I += 2; THUMB_PREFETCH; clockTicks = codeTicksAccessSeq16(armNextPC)+1; - clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; + clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; } break; } @@ -1368,7 +1368,7 @@ case 0x28: reg[15].I += 2; THUMB_PREFETCH; clockTicks = codeTicksAccessSeq16(armNextPC)+1; - clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; + clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; } break; case 3: @@ -1385,8 +1385,8 @@ case 0x28: reg[15].I += 2; THUMB_PREFETCH; clockTicks = codeTicksAccessSeq16(armNextPC)+1; - clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; - } + clockTicks += clockTicks+codeTicksAccess16(armNextPC)+1; + } break; } } @@ -1436,7 +1436,7 @@ case 0x28: codeTicksAccess16(armNextPC) + 3; } else { armState = true; - reg[15].I &= 0xFFFFFFFC; + reg[15].I &= 0xFFFFFFFC; armNextPC = reg[15].I; reg[15].I += 4; ARM_PREFETCH; @@ -1654,7 +1654,7 @@ case 0x28: reg[opcode&7].W.W0); clockTicks = dataTicksAccess16(address) + codeTicksAccess16(armNextPC) + 2; } - break; + break; case 0x88: case 0x89: case 0x8a: @@ -1690,7 +1690,7 @@ case 0x28: CPUWriteMemory(address, reg[regist].I); clockTicks = dataTicksAccess32(address) + codeTicksAccess16(armNextPC) + 2; } - break; + break; case 0x98: case 0x99: case 0x9a: @@ -1704,7 +1704,7 @@ case 0x28: u8 regist = (opcode >> 8) & 7; if (!busPrefetchCount) busPrefetch = busPrefetchEnable; - u32 address = reg[13].I + ((opcode&255)<<2); + u32 address = reg[13].I + ((opcode&255)<<2); reg[regist].I = CPUReadMemoryQuick(address); clockTicks = 3 + dataTicksAccess32(address) + codeTicksAccess16(armNextPC); @@ -1723,7 +1723,7 @@ case 0x28: u8 regist = (opcode >> 8) & 7; reg[regist].I = (reg[15].I & 0xFFFFFFFC) + ((opcode&255)<<2); } - break; + break; case 0xa8: case 0xa9: case 0xaa: @@ -1737,7 +1737,7 @@ case 0x28: u8 regist = (opcode >> 8) & 7; reg[regist].I = reg[13].I + ((opcode&255)<<2); } - break; + break; case 0xb0: { // ADD SP, Imm @@ -1828,7 +1828,7 @@ case 0x28: reg[13].I = temp; clockTicks += codeTicksAccess16(armNextPC)+2; } - break; + break; case 0xbd: // POP {Rlist, PC} { @@ -1858,7 +1858,7 @@ case 0x28: busPrefetchCount=0; clockTicks += codeTicksAccess16(armNextPC) + codeTicksAccess16(armNextPC) + 3; } - break; + break; #define THUMB_STM_REG(val,r,b) \ if(opcode & (val)) {\ CPUWriteMemory(address, reg[(r)].I);\ @@ -1897,7 +1897,7 @@ case 0x28: THUMB_STM_REG(128, 7, regist); clockTicks = codeTicksAccess16(armNextPC)+1; } - break; + break; #define THUMB_LDM_REG(val,r) \ if(opcode & (val)) {\ reg[(r)].I = CPUReadMemory(address);\ @@ -1953,14 +1953,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd1: // BNE offset if(!Z_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1968,14 +1968,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd2: // BCS offset if(C_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1983,14 +1983,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd3: // BCC offset if(!C_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -1998,14 +1998,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd4: // BMI offset if(N_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2013,14 +2013,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd5: // BPL offset if(!N_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2028,14 +2028,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd6: // BVS offset if(V_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2043,14 +2043,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd7: // BVC offset if(!V_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2058,14 +2058,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd8: // BHI offset if(C_FLAG && !Z_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2073,14 +2073,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xd9: // BLS offset if(!C_FLAG || Z_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2088,14 +2088,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xda: // BGE offset if(N_FLAG == V_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2103,14 +2103,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xdb: // BLT offset if(N_FLAG != V_FLAG) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2118,14 +2118,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xdc: // BGT offset if(!Z_FLAG && (N_FLAG == V_FLAG)) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2133,14 +2133,14 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xdd: // BLE offset if(Z_FLAG || (N_FLAG != V_FLAG)) { #ifdef BKPT_SUPPORT UPDATE_OLD_REG #endif - reg[15].I += ((s8)(opcode & 0xFF)) << 1; + reg[15].I += ((s8)(opcode & 0xFF)) << 1; armNextPC = reg[15].I; reg[15].I += 2; THUMB_PREFETCH; @@ -2148,7 +2148,7 @@ case 0x28: codeTicksAccess16(armNextPC)+3; busPrefetchCount=0; } - break; + break; case 0xdf: { // SWI #comment @@ -2191,7 +2191,7 @@ case 0x28: reg[14].I = reg[15].I + (offset << 12); clockTicks = codeTicksAccessSeq16(armNextPC) + 1; } - break; + break; case 0xf4: case 0xf5: case 0xf6: @@ -2202,7 +2202,7 @@ case 0x28: reg[14].I = reg[15].I + ((offset << 12) | 0xFF800000); clockTicks = codeTicksAccessSeq16(armNextPC) + 1; } - break; + break; case 0xf8: case 0xf9: case 0xfa: @@ -2230,7 +2230,7 @@ case 0x28: // BKPT #comment extern void (*dbgSignal)(int,int); reg[15].I -= 2; - armNextPC -= 2; + armNextPC -= 2; dbgSignal(5, opcode & 255); return; #endif diff --git a/src/unzip.cpp b/src/unzip.cpp index 876691a5..6688bd4f 100644 --- a/src/unzip.cpp +++ b/src/unzip.cpp @@ -16,7 +16,7 @@ // 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 +/* unzip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Read unzip.h for more info @@ -162,7 +162,7 @@ local int unzlocal_getByte(FILE *fin,int *pi) } else { - if (ferror(fin)) + if (ferror(fin)) return UNZ_ERRNO; else return UNZ_EOF; @@ -171,7 +171,7 @@ local int unzlocal_getByte(FILE *fin,int *pi) /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets */ local int unzlocal_getShort (FILE *fin,uLong *pX) { @@ -181,11 +181,11 @@ local int unzlocal_getShort (FILE *fin,uLong *pX) 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 @@ -201,7 +201,7 @@ local int unzlocal_getLong (FILE *fin,uLong *pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; @@ -213,7 +213,7 @@ local int unzlocal_getLong (FILE *fin,uLong *pX) if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<24; - + if (err==UNZ_OK) *pX = x; else @@ -256,7 +256,7 @@ local int strcmpcasenosensitive_internal (const char *fileName1, #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 @@ -276,7 +276,7 @@ extern int ZEXPORT unzStringFileNameCompare (const char *fileName1, return strcmp(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} +} #define BUFREADCOMMENT (0x400) @@ -291,13 +291,13 @@ local uLong unzlocal_SearchCentralDir(FILE *fin) 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; @@ -310,13 +310,13 @@ local uLong unzlocal_SearchCentralDir(FILE *fin) { uLong uReadSize,uReadPos ; int i; - if (uBackRead+BUFREADCOMMENT>uMaxBack) + if (uBackRead+BUFREADCOMMENT>uMaxBack) uBackRead = uMaxBack; else uBackRead+=BUFREADCOMMENT; uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); if (fseek(fin,uReadPos,SEEK_SET)!=0) break; @@ -325,7 +325,7 @@ local uLong unzlocal_SearchCentralDir(FILE *fin) break; for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { uPosFound = uReadPos+i; @@ -355,12 +355,12 @@ extern unzFile ZEXPORT unzOpen (const char *path) uLong central_pos,uL; FILE * fin ; - uLong number_disk; /* number of the current dist, used for + 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 + the central dir (same than number_entry on nospan) */ int err=UNZ_OK; @@ -408,7 +408,7 @@ extern unzFile ZEXPORT unzOpen (const char *path) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) err=UNZ_ERRNO; - /* offset of start of central directory with respect to the + /* 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; @@ -417,7 +417,7 @@ extern unzFile ZEXPORT unzOpen (const char *path) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) err=UNZ_ERRNO; - if ((central_posfile,&uData) != UNZ_OK) /* size uncompr */ err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; @@ -874,7 +874,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s *s, 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. @@ -919,7 +919,7 @@ extern int ZEXPORT unzOpenCurrentFile (unzFile file) } 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; @@ -938,29 +938,29 @@ extern int ZEXPORT unzOpenCurrentFile (unzFile file) { 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; - + 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 + * 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 = + pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = + 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 + + + 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; @@ -1002,9 +1002,9 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) 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 = + 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) @@ -1018,7 +1018,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) 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->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, @@ -1027,8 +1027,8 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) 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 = + + 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; } @@ -1036,16 +1036,16 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) if (pfile_in_zip_read_info->compression_method==0) { uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < + 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); @@ -1077,8 +1077,8 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); @@ -1086,10 +1086,10 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) uOutThis; iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - + if (err==Z_STREAM_END) return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) + if (err!=Z_OK) break; } } @@ -1120,7 +1120,7 @@ extern z_off_t ZEXPORT unztell (unzFile file) /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzeof (unzFile file) { @@ -1133,7 +1133,7 @@ extern int ZEXPORT unzeof (unzFile file) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) return 1; else @@ -1151,7 +1151,7 @@ extern int ZEXPORT unzeof (unzFile file) 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 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) @@ -1169,12 +1169,12 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file,voidp buf,unsigned len) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + 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 @@ -1182,9 +1182,9 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file,voidp buf,unsigned 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->offset_local_extrafield + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) return UNZ_ERRNO; diff --git a/src/unzip.h b/src/unzip.h index dadabd93..e82e2d48 100644 --- a/src/unzip.h +++ b/src/unzip.h @@ -17,7 +17,7 @@ // 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 +/* unzip.h -- IO for uncompress .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Copyright (C) 1998 Gilles Vollant @@ -52,7 +52,7 @@ */ -/* for more info about .ZIP format, see +/* 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 */ @@ -71,7 +71,7 @@ extern "C" { #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 struct TagunzFile__ { int unused; } unzFile__; typedef unzFile__ *unzFile; #else typedef voidp unzFile; @@ -88,7 +88,7 @@ typedef voidp unzFile; #define UNZ_CRCERROR (-105) /* tm_unz contain date/time info */ -typedef struct tm_unz_s +typedef struct tm_unz_s { uInt tm_sec; /* seconds after the minute - [0,59] */ uInt tm_min; /* minutes after the hour - [0,59] */ @@ -117,8 +117,8 @@ typedef struct unz_file_info_s 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 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 */ @@ -195,7 +195,7 @@ extern int ZEXPORT unzGoToNextFile OF((unzFile file)); return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. */ -extern int ZEXPORT unzLocateFile OF((unzFile file, +extern int ZEXPORT unzLocateFile OF((unzFile file, const char *szFileName, int iCaseSensitivity)); /* @@ -246,8 +246,8 @@ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); Return UNZ_CRCERROR if all the file was read but the CRC is not good */ - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, voidp buf, unsigned len)); /* @@ -268,7 +268,7 @@ extern z_off_t ZEXPORT unztell OF((unzFile file)); extern int ZEXPORT unzeof OF((unzFile file)); /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, @@ -283,7 +283,7 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 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 return value is the number of bytes copied in buf, or (if <0) the error code */ diff --git a/src/win32/AVIWrite.cpp b/src/win32/AVIWrite.cpp index 4943224e..79f3a4f6 100644 --- a/src/win32/AVIWrite.cpp +++ b/src/win32/AVIWrite.cpp @@ -27,7 +27,7 @@ AVIWrite::AVIWrite() m_streamCompressed = NULL; m_streamSound = NULL; m_samplesSound = 0; - + AVIFileInit(); } @@ -38,7 +38,7 @@ AVIWrite::~AVIWrite() if(m_streamCompressed) AVIStreamClose(m_streamCompressed); - + if(m_stream) AVIStreamClose(m_stream); @@ -65,13 +65,13 @@ void AVIWrite::SetSoundFormat(WAVEFORMATEX *format) 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)))) { @@ -104,7 +104,7 @@ bool AVIWrite::Open(const char *filename) m_failed = true; return false; } - + ZeroMemory(&m_options, sizeof(AVICOMPRESSOPTIONS)); m_arrayOptions[0] = &m_options; @@ -113,13 +113,13 @@ bool AVIWrite::Open(const char *filename) 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, @@ -160,7 +160,7 @@ 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, diff --git a/src/win32/AboutDialog.cpp b/src/win32/AboutDialog.cpp index 86a39891..d741f16b 100644 --- a/src/win32/AboutDialog.cpp +++ b/src/win32/AboutDialog.cpp @@ -60,10 +60,10 @@ BEGIN_MESSAGE_MAP(AboutDialog, CDialog) ///////////////////////////////////////////////////////////////////////////// // AboutDialog message handlers -BOOL AboutDialog::OnInitDialog() +BOOL AboutDialog::OnInitDialog() { CDialog::OnInitDialog(); - + CWnd *p = GetDlgItem(IDC_TRANSLATOR_URL); if(p) { m_translator.SubclassDlgItem(IDC_TRANSLATOR_URL, this); diff --git a/src/win32/AccelEditor.cpp b/src/win32/AccelEditor.cpp index b632914d..a44aa653 100644 --- a/src/win32/AccelEditor.cpp +++ b/src/win32/AccelEditor.cpp @@ -70,10 +70,10 @@ BEGIN_MESSAGE_MAP(AccelEditor, CDialog) ///////////////////////////////////////////////////////////////////////////// // AccelEditor message handlers -BOOL AccelEditor::OnInitDialog() +BOOL AccelEditor::OnInitDialog() { CDialog::OnInitDialog(); - + DIALOG_SIZER_START( sz ) DIALOG_SIZER_ENTRY( IDC_STATIC1, DS_MoveX) DIALOG_SIZER_ENTRY( IDC_STATIC2, DS_MoveY) @@ -97,7 +97,7 @@ BOOL AccelEditor::OnInitDialog() NULL); InitCommands(); - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -108,7 +108,7 @@ void AccelEditor::InitCommands() m_alreadyAffected.SetWindowText(""); POSITION pos = mgr.m_mapAccelString.GetStartPosition(); - + while(pos != NULL) { CString command; WORD wID; @@ -123,17 +123,17 @@ void AccelEditor::InitCommands() OnSelchangeCommands(); } -void AccelEditor::OnCancel() +void AccelEditor::OnCancel() { EndDialog(FALSE); } -void AccelEditor::OnOk() +void AccelEditor::OnOk() { EndDialog(TRUE); } -void AccelEditor::OnSelchangeCommands() +void AccelEditor::OnSelchangeCommands() { // Check if some commands exist. int index = m_commands.GetCurSel(); @@ -144,7 +144,7 @@ void AccelEditor::OnSelchangeCommands() m_currents.ResetContent(); CCmdAccelOb* pCmdAccel; - + if (mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel)) { CAccelsOb* pAccel; CString szBuffer; @@ -164,20 +164,20 @@ void AccelEditor::OnSelchangeCommands() } -void AccelEditor::OnReset() +void AccelEditor::OnReset() { mgr.Default(); InitCommands(); // update the listboxes. } -void AccelEditor::OnAssign() +void AccelEditor::OnAssign() { // Control if it's not already affected CCmdAccelOb* pCmdAccel; CAccelsOb* pAccel; WORD wIDCommand; POSITION pos; - + WORD wKey; bool bCtrl, bAlt, bShift; @@ -241,13 +241,13 @@ void AccelEditor::OnAssign() m_key.ResetKey(); } -void AccelEditor::OnRemove() +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) diff --git a/src/win32/AcceleratorManager.cpp b/src/win32/AcceleratorManager.cpp index ca3f8fc6..e83e339f 100644 --- a/src/win32/AcceleratorManager.cpp +++ b/src/win32/AcceleratorManager.cpp @@ -246,7 +246,7 @@ bool CAcceleratorManager::UpdateWndTable() arrayACCEL.Add(pACCEL); } } - + INT_PTR nAccel = arrayACCEL.GetSize(); LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL)); if (!lpAccel) { @@ -258,7 +258,7 @@ bool CAcceleratorManager::UpdateWndTable() } for (iLoop = 0; iLoop < nAccel; iLoop++) { - + pACCEL = arrayACCEL.GetAt(iLoop); lpAccel[iLoop].fVirt = pACCEL->fVirt; lpAccel[iLoop].key = pACCEL->key; @@ -419,7 +419,7 @@ bool CAcceleratorManager::CreateEntry(WORD wIDCommand, LPCTSTR szCommand) bool CAcceleratorManager::GetStringFromACCEL(ACCEL* pACCEL, CString& szAccel) { ASSERT(pACCEL != NULL); - + CAccelsOb accel(pACCEL); accel.GetString(szAccel); @@ -493,7 +493,7 @@ void CAcceleratorManager::UpdateMenu(HMENU menu) OSVERSIONINFO info; info.dwOSVersionInfoSize = sizeof(info); GetVersionEx(&info); - + if(info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { MENUITEMINFO info; char ss[128]; @@ -502,7 +502,7 @@ void CAcceleratorManager::UpdateMenu(HMENU menu) 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 { @@ -518,15 +518,15 @@ void CAcceleratorManager::UpdateMenu(HMENU menu) 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"; @@ -542,13 +542,13 @@ void CAcceleratorManager::UpdateMenu(HMENU menu) 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 { @@ -562,19 +562,19 @@ void CAcceleratorManager::UpdateMenu(HMENU menu) 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); @@ -618,7 +618,7 @@ bool CAcceleratorManager::Load(HKEY hRegKey, LPCTSTR szRegKey) CCmdAccelOb* pCmdAccel; CAccelsOb* pAccel; DWORD dwIDAccelData, dwAccelData; - BOOL bExistID; + BOOL bExistID; int iIndex = 0; if(count) { WORD wKey; @@ -628,10 +628,10 @@ bool CAcceleratorManager::Load(HKEY hRegKey, LPCTSTR szRegKey) m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel); pCmdAccel->DeleteUserAccels(); } - + while(iIndex < count) { dwIDAccelData = data[iIndex++]; - + WORD wIDCommand = LOWORD(dwIDAccelData); bExistID = m_mapAccelTable.Lookup(wIDCommand, pCmdAccel); @@ -679,12 +679,12 @@ 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) { @@ -702,13 +702,13 @@ bool CAcceleratorManager::Write() if (CmdDatasArray.GetSize() > 0) { CmdDatasArray.InsertAt(0, MAKELONG(pCmdAccel->m_wIDCommand, CmdDatasArray.GetSize())); - + AccelsDatasArray.Append(CmdDatasArray); iCount++; } } // AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount)); - + INT_PTR count = AccelsDatasArray.GetSize(); DWORD *data = (DWORD *)malloc(count * sizeof(DWORD)); ASSERT(data != NULL); @@ -736,7 +736,7 @@ bool CAcceleratorManager::CreateDefaultTable() { if (m_bDefaultTable) return false; - + CCmdAccelOb* pCmdAccel; CCmdAccelOb* pNewCmdAccel; @@ -749,14 +749,14 @@ bool CAcceleratorManager::CreateDefaultTable() 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); } @@ -764,9 +764,9 @@ bool CAcceleratorManager::CreateDefaultTable() if (pNewCmdAccel->m_Accels.GetCount() != 0) { pNewCmdAccel->m_wIDCommand = pCmdAccel->m_wIDCommand; pNewCmdAccel->m_szCommand = pCmdAccel->m_szCommand; - + m_mapAccelTableSaved.SetAt(wKey, pNewCmdAccel); - } else + } else delete pNewCmdAccel; } diff --git a/src/win32/AcceleratorManager.h b/src/win32/AcceleratorManager.h index 1999c57c..30703a65 100644 --- a/src/win32/AcceleratorManager.h +++ b/src/win32/AcceleratorManager.h @@ -68,7 +68,7 @@ class CAcceleratorManager : public CObject { bool Load(); bool Write(); // Get the initials accels, not the user's - bool Default(); + 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(); diff --git a/src/win32/Associate.cpp b/src/win32/Associate.cpp index 7eca0f84..1c921b31 100644 --- a/src/win32/Associate.cpp +++ b/src/win32/Associate.cpp @@ -74,22 +74,22 @@ BEGIN_MESSAGE_MAP(Associate, CDialog) ///////////////////////////////////////////////////////////////////////////// // Associate message handlers -BOOL Associate::OnInitDialog() +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() +void Associate::OnCancel() { EndDialog(FALSE); } -void Associate::OnOk() +void Associate::OnOk() { UpdateData(); @@ -117,7 +117,7 @@ void Associate::OnOk() regAssociateType("VisualBoyAdvance.Binary", "Binary", commandPath); - + for(int i = 0; i < 7; i++) { if(mask & (1<bmiHeader.biWidth = w; bmpInfo->bmiHeader.biHeight = -h; - + StretchDIBits(memDC.GetSafeHdc(), 0, 0, w1, - h1, + h1, 0, 0, w, @@ -111,7 +111,7 @@ void BitmapControl::OnDraw(CDC* dc) SRCCOPY); } else { FillOutsideRect(&memDC, CBrush::FromHandle(GetSysColorBrush(COLOR_BTNFACE))); - + bmpInfo->bmiHeader.biWidth = w; bmpInfo->bmiHeader.biHeight = -h; SetDIBitsToDevice(memDC.GetSafeHdc(), @@ -133,7 +133,7 @@ void BitmapControl::OnDraw(CDC* dc) memDC.SelectObject(pOldBitmap); bitmap.DeleteObject(); - memDC.DeleteDC(); + memDC.DeleteDC(); } ///////////////////////////////////////////////////////////////////////////// @@ -154,18 +154,18 @@ void BitmapControl::Dump(CDumpContext& dc) const ///////////////////////////////////////////////////////////////////////////// // BitmapControl message handlers -BOOL BitmapControl::OnEraseBkgnd(CDC* pDC) +BOOL BitmapControl::OnEraseBkgnd(CDC* pDC) { return TRUE; } -void BitmapControl::OnSize(UINT nType, int cx, int cy) +void BitmapControl::OnSize(UINT nType, int cx, int cy) { if(!stretch) CScrollView::OnSize(nType, cx, cy); } -void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) +void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) { if(!data) return; @@ -173,14 +173,14 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) 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; @@ -207,7 +207,7 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) return; point = p.x | (p.y<<16); - + int xxx = p.x / 8; int yyy = p.y / 8; @@ -217,7 +217,7 @@ void BitmapControl::OnLButtonDown(UINT nFlags, CPoint pt) i * w * 3], 8 * 3); } } - + GetParent()->SendMessage(WM_MAPINFO, point, (LPARAM)colors); @@ -282,6 +282,6 @@ bool BitmapControl::getStretch() return stretch; } -void BitmapControl::PostNcDestroy() +void BitmapControl::PostNcDestroy() { } diff --git a/src/win32/BugReport.cpp b/src/win32/BugReport.cpp index ce4dcd4d..391aac9e 100644 --- a/src/win32/BugReport.cpp +++ b/src/win32/BugReport.cpp @@ -71,7 +71,7 @@ BEGIN_MESSAGE_MAP(BugReport, CDialog) ///////////////////////////////////////////////////////////////////////////// // BugReport message handlers -void BugReport::OnCopy() +void BugReport::OnCopy() { OpenClipboard(); @@ -79,38 +79,38 @@ void BugReport::OnCopy() CString report; m_report.GetWindowText(report); - HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, - (report.GetLength() + 1) * sizeof(CHAR)); - if (hglbCopy == NULL) { - CloseClipboard(); + 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); + } + + // 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() +void BugReport::OnOk() { EndDialog(TRUE); } -BOOL BugReport::OnInitDialog() +BOOL BugReport::OnInitDialog() { CDialog::OnInitDialog(); - + CenterWindow(); CString report = createReport(); @@ -118,7 +118,7 @@ BOOL BugReport::OnInitDialog() 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 } @@ -167,7 +167,7 @@ CString BugReport::createReport() 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); @@ -177,7 +177,7 @@ CString BugReport::createReport() 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; @@ -212,7 +212,7 @@ CString BugReport::createReport() 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); @@ -227,9 +227,9 @@ CString BugReport::createReport() AppendFormat(report, "Blue shift : %08x\r\n", systemBlueShift); AppendFormat(report, "Layer setting: %04X\r\n", layerSettings); AppendFormat(report, "Mirroring : %d\r\n", mirroringEnable); - AppendFormat(report, "Save type : %d (%d)\r\n", + AppendFormat(report, "Save type : %d (%d)\r\n", theApp.winSaveType, cpuSaveType); - AppendFormat(report, "Flash size : %08X (%08x)\r\n", + AppendFormat(report, "Flash size : %08X (%08x)\r\n", theApp.winFlashSize, flashSize); AppendFormat(report, "RTC : %d (%d)\r\n", theApp.winRtcEnable, rtcIsEnabled()); diff --git a/src/win32/CmdAccelOb.cpp b/src/win32/CmdAccelOb.cpp index a911b9b3..805425a0 100644 --- a/src/win32/CmdAccelOb.cpp +++ b/src/win32/CmdAccelOb.cpp @@ -22,7 +22,7 @@ // Version : 1.0 * Author : T.Maurel // Date : 17.08.98 // -// Remarks : +// Remarks : // //////////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ CAccelsOb::CAccelsOb() CAccelsOb::CAccelsOb(CAccelsOb* pFrom) { ASSERT(pFrom != NULL); - + m_cVirt = pFrom->m_cVirt; m_wKey = pFrom->m_wKey; m_bLocked = pFrom->m_bLocked; @@ -231,7 +231,7 @@ CAccelsOb::CAccelsOb(BYTE cVirt, WORD wKey, bool bLocked) CAccelsOb::CAccelsOb(LPACCEL pACCEL) { ASSERT(pACCEL != NULL); - + m_cVirt = pACCEL->fVirt; m_wKey = pACCEL->key; m_bLocked = false; @@ -246,7 +246,7 @@ CAccelsOb& CAccelsOb::operator=(const CAccelsOb& from) m_cVirt = from.m_cVirt; m_wKey = from.m_wKey; m_bLocked = from.m_bLocked; - + return *this; } @@ -290,18 +290,18 @@ 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; } @@ -316,7 +316,7 @@ DWORD CAccelsOb::GetData() cLocalCodes = DEFAULT_ACCEL; else cLocalCodes = USER_ACCEL; - + WORD bCodes = MAKEWORD(m_cVirt, cLocalCodes); return MAKELONG(m_wKey, bCodes); } @@ -328,10 +328,10 @@ DWORD CAccelsOb::GetData() 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; @@ -388,10 +388,10 @@ CCmdAccelOb::CCmdAccelOb(WORD wIDCommand, LPCTSTR 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); @@ -439,10 +439,10 @@ void CCmdAccelOb::Add(CAccelsOb* 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) { @@ -480,7 +480,7 @@ void CCmdAccelOb::Reset() { m_wIDCommand = 0; m_szCommand = "Empty command"; - + CAccelsOb* pAccel; POSITION pos = m_Accels.GetHeadPosition(); while (pos != NULL) { diff --git a/src/win32/CmdAccelOb.h b/src/win32/CmdAccelOb.h index c8e47ac1..d473220c 100644 --- a/src/win32/CmdAccelOb.h +++ b/src/win32/CmdAccelOb.h @@ -22,7 +22,7 @@ // Version : 1.0 * Author : T.Maurel // Date : 17.08.98 // -// Remarks : +// Remarks : // //////////////////////////////////////////////////////////////////////////////// #ifndef __CMDACCEL_OB_INCLUDE diff --git a/src/win32/ColorButton.cpp b/src/win32/ColorButton.cpp index b6de51fa..db43c14e 100644 --- a/src/win32/ColorButton.cpp +++ b/src/win32/ColorButton.cpp @@ -63,7 +63,7 @@ void ColorButton::PreSubclassWindow() void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { ASSERT(lpDrawItemStruct); - + int r = (color & 0x1f) << 3; int g = (color & 0x3e0) >> 2; int b = (color & 0x7c00) >> 7; @@ -82,8 +82,8 @@ void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) DrawEdge(dc, &rect, EDGE_RAISED, BF_RECT); InflateRect(&rect, -margins.cx, -margins.cy); - - HBRUSH br = CreateSolidBrush((state & ODS_DISABLED) ? + + HBRUSH br = CreateSolidBrush((state & ODS_DISABLED) ? ::GetSysColor(COLOR_3DFACE) : RGB(r,g,b)); FillRect(dc, &rect, br); @@ -92,7 +92,7 @@ void ColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) InflateRect(&rect, -1, -1); DrawFocusRect(dc, &rect); } - + DeleteObject(br); } diff --git a/src/win32/ColorControl.cpp b/src/win32/ColorControl.cpp index b61d135e..24b4e799 100644 --- a/src/win32/ColorControl.cpp +++ b/src/win32/ColorControl.cpp @@ -56,12 +56,12 @@ BEGIN_MESSAGE_MAP(ColorControl, CWnd) ///////////////////////////////////////////////////////////////////////////// // ColorControl message handlers -void ColorControl::OnPaint() +void ColorControl::OnPaint() { CPaintDC dc(this); // device context for painting } -BOOL ColorControl::OnEraseBkgnd(CDC* pDC) +BOOL ColorControl::OnEraseBkgnd(CDC* pDC) { int r = (color & 0x1f) << 3; int g = (color & 0x3e0) >> 2; diff --git a/src/win32/Commands.cpp b/src/win32/Commands.cpp index 163b1acc..8f995e79 100644 --- a/src/win32/Commands.cpp +++ b/src/win32/Commands.cpp @@ -167,7 +167,7 @@ struct { { "OptionsSoundVolume1x", ID_OPTIONS_SOUND_VOLUME_1X }, { "OptionsSoundVolume2x", ID_OPTIONS_SOUND_VOLUME_2X }, { "OptionsSoundVolume3x", ID_OPTIONS_SOUND_VOLUME_3X }, - { "OptionsSoundVolume4x", ID_OPTIONS_SOUND_VOLUME_4X }, + { "OptionsSoundVolume4x", ID_OPTIONS_SOUND_VOLUME_4X }, { "OptionsGameboyBorder", ID_OPTIONS_GAMEBOY_BORDER }, { "OptionsGameboyBorderAutomatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC }, { "OptionsGameboyColors", ID_OPTIONS_GAMEBOY_COLORS }, @@ -236,13 +236,13 @@ 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); + winAccelStrings.SetAt(winAccelCommands[i].command, winAccelCommands[i].id); } initialized = true; } - + return winAccelStrings.Lookup(command, id) ? true : false; } diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp index 81062b72..82c3664b 100644 --- a/src/win32/Direct3D.cpp +++ b/src/win32/Direct3D.cpp @@ -1,668 +1,668 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team -// Copyright (C) 2005-2006 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 "Display.h" - -#include "MainWnd.h" - -#include "../System.h" -#include "../GBA.h" -#include "../Globals.h" -#include "../Text.h" -#include "../Util.h" -#include "../gb/gbGlobals.h" - -// Direct3D -#define DIRECT3D_VERSION 0x0900 -#include // main include file -#include // required for font rednering -#include // contains debug functions - -extern int Init_2xSaI(u32); // initializes all pixel filters -extern int systemSpeed; - -#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 winVideoModeSelect(CWnd *, GUID **); - -class Direct3DDisplay : public IDisplay { -private: - LPDIRECT3D9 pD3D; - LPDIRECT3DDEVICE9 pDevice; - D3DDISPLAYMODE mode; - D3DPRESENT_PARAMETERS dpp; - D3DFORMAT screenFormat; - LPDIRECT3DSURFACE9 emulatedImage; - D3DTEXTUREFILTERTYPE filter; - int width; - int height; - RECT destRect; - bool failed; - ID3DXFont *pFont; - - void createFont(); - void destroyFont(); - void createSurface(); - void destroySurface(); - void calculateDestRect(); - bool resetDevice(); - void setPresentationType(); - -public: - Direct3DDisplay(); - virtual ~Direct3DDisplay(); - virtual DISPLAY_TYPE getType() { return DIRECT_3D; }; - - virtual bool initialize(); - virtual void cleanup(); - virtual void clear(); - virtual void render(); - - virtual void renderMenu(); - virtual bool changeRenderSize( int w, int h ); - virtual void resize( int w, int h ); - virtual void setOption( const char *option, int value ); - virtual int selectFullScreenMode( GUID ** ); -}; - - -Direct3DDisplay::Direct3DDisplay() -{ - pD3D = NULL; - pDevice = NULL; - screenFormat = D3DFMT_X8R8G8B8; - width = 0; - height = 0; - failed = false; - pFont = NULL; - emulatedImage = NULL; - filter = D3DTEXF_POINT; -} - - -Direct3DDisplay::~Direct3DDisplay() -{ - cleanup(); -} - -void Direct3DDisplay::setPresentationType() -{ - // Change display mode - memset(&dpp, 0, sizeof(dpp)); - dpp.Windowed = !(theApp.videoOption>=VIDEO_320x240); - if (!dpp.Windowed) - dpp.BackBufferFormat = - (theApp.fsColorDepth == 32) ? D3DFMT_X8R8G8B8 : D3DFMT_R5G6B5; - else - dpp.BackBufferFormat = mode.Format; - dpp.BackBufferCount = 3; - dpp.MultiSampleType = D3DMULTISAMPLE_NONE; - dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - dpp.BackBufferWidth = !dpp.Windowed ? theApp.fsWidth : theApp.surfaceSizeX; - dpp.BackBufferHeight = !dpp.Windowed ? theApp.fsHeight : theApp.surfaceSizeY; - dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd(); - dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency; - dpp.Flags = theApp.menuToggle ? D3DPRESENTFLAG_LOCKABLE_BACKBUFFER : 0; - if (theApp.vsync) - dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // VSync - else - dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // No Sync -} - - -void Direct3DDisplay::cleanup() -{ - destroyFont(); - destroySurface(); - - if( pDevice ) { - pDevice->Release(); - pDevice = NULL; - } - - if( pD3D ) { - pD3D->Release(); - pD3D = NULL; - } -} - - -bool Direct3DDisplay::initialize() -{ - switch(theApp.cartridgeType) - { - case IMAGE_GBA: - theApp.sizeX = 240; - theApp.sizeY = 160; - break; - case IMAGE_GB: - if (gbBorderOn) - { - theApp.sizeX = 256; - theApp.sizeY = 224; - } - else - { - theApp.sizeX = 160; - theApp.sizeY = 144; - } - break; - } - - - 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_1024x768: - case VIDEO_1280x1024: - case VIDEO_OTHER: - float scaleX = ((float)theApp.fsWidth / theApp.sizeX); - float scaleY = ((float)theApp.fsHeight / theApp.sizeY); - float min = (scaleX < scaleY) ? scaleX : scaleY; - if(theApp.fullScreenStretch) { - theApp.surfaceSizeX = theApp.fsWidth; - theApp.surfaceSizeY = theApp.fsHeight; - } else { - theApp.surfaceSizeX = (int)(theApp.sizeX * min); - theApp.surfaceSizeY = (int)(theApp.sizeY * min); - } - 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, 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, - _T("VisualBoyAdvance"), - style, - x,y,winSizeX,winSizeY, - NULL, - 0); - - if (!(HWND)*pWnd) { - DXTRACE_ERR_MSGBOX( _T("Error creating window"), 0 ); - return FALSE; - } - pWnd->DragAcceptFiles(TRUE); - theApp.updateMenuBar(); - theApp.adjustDestRect(); - - - // load Direct3D v9 - pD3D = Direct3DCreate9( D3D_SDK_VERSION ); - - if(pD3D == NULL) { - DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 ); - return FALSE; - } - pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode); - - theApp.mode320Available = FALSE; - theApp.mode640Available = FALSE; - theApp.mode800Available = FALSE; - theApp.mode1024Available = FALSE; - theApp.mode1280Available = FALSE; - - unsigned int nModes, i; - D3DDISPLAYMODE dm; - - nModes = pD3D->GetAdapterModeCount(theApp.fsAdapter, mode.Format); - for (i = 0; iEnumAdapterModes(theApp.fsAdapter, mode.Format, i, &dm) ) - { - if ( (dm.Width == 320) && (dm.Height == 240) ) - theApp.mode320Available = true; - if ( (dm.Width == 640) && (dm.Height == 480) ) - theApp.mode640Available = true; - if ( (dm.Width == 800) && (dm.Height == 600) ) - theApp.mode800Available = true; - if ( (dm.Width == 1024) && (dm.Height == 768) ) - theApp.mode1024Available = true; - if ( (dm.Width == 1280) && (dm.Height == 1024) ) - theApp.mode1280Available = true; - } - } - - - screenFormat = mode.Format; - - 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: - DXTRACE_ERR_MSGBOX( _T("Unsupport D3D format"), 0 ); - return false; - } - theApp.fsColorDepth = systemColorDepth; - utilUpdateSystemColorMaps(); - - -#ifdef MMX - if(!theApp.disableMMX) { - cpu_mmx = theApp.detectMMX(); - } else { - cpu_mmx = 0; - } -#endif - - - theApp.updateFilter(); - theApp.updateIFB(); - - - // create device - setPresentationType(); - - HRESULT hret = pD3D->CreateDevice( - D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, - pWnd->GetSafeHwnd(), - D3DCREATE_SOFTWARE_VERTEXPROCESSING, - &dpp, - &pDevice); - if( FAILED( hret ) ) { - DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D device"), hret ); - return false; - } - - createFont(); - createSurface(); - calculateDestRect(); - - setOption( _T("d3dFilter"), theApp.d3dFilter ); - - if(failed) return false; - - return TRUE; -} - - -void Direct3DDisplay::renderMenu() -{ - checkFullScreen(); - if(theApp.m_pMainWnd) { - theApp.m_pMainWnd->DrawMenuBar(); - } -} - - -void Direct3DDisplay::clear() -{ - if( pDevice ) { - pDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0x00,0x00,0x00), 0.0f, 0 ); - } -} - - -void Direct3DDisplay::render() -{ - if( failed ) return; - if(!pDevice) return; - if( FAILED( pDevice->TestCooperativeLevel() ) ) return; - - clear(); - - pDevice->BeginScene(); - - // copy pix to emulatedImage and apply pixel filter if selected - HRESULT hr; - D3DLOCKED_RECT lr; - if( FAILED( hr = emulatedImage->LockRect( &lr, NULL, D3DLOCK_DISCARD ) ) ) { - DXTRACE_ERR_MSGBOX( _T("Can not lock back buffer"), hr ); - return; - } else { - if( !theApp.filterFunction ) { - copyImage( pix, lr.pBits, theApp.sizeX, theApp.sizeY, lr.Pitch, systemColorDepth ); - } else { - u32 pitch = theApp.filterWidth * (systemColorDepth>>3) + 4; - theApp.filterFunction( pix + pitch, - pitch, - (u8*)theApp.delta, - (u8*)lr.pBits, - lr.Pitch, - theApp.filterWidth, - theApp.filterHeight); - } - emulatedImage->UnlockRect(); - } - - // copy emulatedImage to pBackBuffer and scale with or without aspect ratio - LPDIRECT3DSURFACE9 pBackBuffer; - pDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer ); - if( theApp.fullScreenStretch ) { - pDevice->StretchRect( emulatedImage, NULL, pBackBuffer, NULL, filter ); - } else { - pDevice->StretchRect( emulatedImage, NULL, pBackBuffer, &destRect, filter ); - } - pBackBuffer->Release(); - pBackBuffer = NULL; - - D3DCOLOR color; - RECT r; - r.left = 4; - r.right = dpp.BackBufferWidth - 4; - - if( theApp.screenMessage ) { - color = theApp.showSpeedTransparent ? D3DCOLOR_ARGB(0x7F, 0xFF, 0x00, 0x00) : D3DCOLOR_ARGB(0xFF, 0xFF, 0x00, 0x00); - if( ( ( GetTickCount() - theApp.screenMessageTime ) < 3000 ) && !theApp.disableStatusMessage && pFont ) { - r.top = dpp.BackBufferHeight - 20; - r.bottom = dpp.BackBufferHeight - 4; - pFont->DrawText( NULL, theApp.screenMessageBuffer, -1, &r, 0, color ); - } else { - theApp.screenMessage = false; - } - } - - if( theApp.showSpeed && ( theApp.videoOption > VIDEO_4X ) ) { - color = theApp.showSpeedTransparent ? D3DCOLOR_ARGB(0x7F, 0x00, 0x00, 0xFF) : D3DCOLOR_ARGB(0xFF, 0x00, 0x00, 0xFF); - char buffer[30]; - if( theApp.showSpeed == 1 ) { - sprintf( buffer, "%3d%%", systemSpeed ); - } else { - sprintf( buffer, "%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, theApp.showRenderedFrames ); - } - - r.top = 4; - r.bottom = 20; - pFont->DrawText( NULL, buffer, -1, &r, 0, color ); - } - - pDevice->EndScene(); - - pDevice->Present( NULL, NULL, NULL, NULL ); - - return; -} - - -bool Direct3DDisplay::changeRenderSize( int w, int h ) -{ - if( (w != width) || (h != height) ) { - width = w; height = h; - if( pDevice ) { - destroySurface(); - createSurface(); - calculateDestRect(); - } - } - return true; -} - - -void Direct3DDisplay::resize( int w, int h ) -{ - if( (w != dpp.BackBufferWidth) || (h != dpp.BackBufferHeight) ) { - dpp.BackBufferWidth = (UINT)w; - dpp.BackBufferHeight = (UINT)h; - resetDevice(); - calculateDestRect(); - } - if(theApp.videoOption > VIDEO_4X) - resetDevice(); - -} - - -int Direct3DDisplay::selectFullScreenMode( GUID **pGUID ) -{ - return winVideoModeSelect(theApp.m_pMainWnd, pGUID); -} - - -void Direct3DDisplay::createFont() -{ - if( !pFont ) { - HRESULT hr = D3DXCreateFont( - pDevice, - 14, - 0, - FW_BOLD, - 1, - FALSE, - DEFAULT_CHARSET, - OUT_DEFAULT_PRECIS, - DEFAULT_QUALITY, - DEFAULT_PITCH || FF_DONTCARE, - _T("Arial"), - &pFont ); - if( FAILED( hr ) ) { - DXTRACE_ERR_MSGBOX( _T("createFont failed"), hr ); - } - } -} - - -void Direct3DDisplay::destroyFont() -{ - if( pFont ) { - pFont->Release(); - pFont = NULL; - } -} - - -void Direct3DDisplay::createSurface() -{ - if( !emulatedImage ) { - HRESULT hr = pDevice->CreateOffscreenPlainSurface( - width, height, - dpp.BackBufferFormat, - D3DPOOL_DEFAULT, - &emulatedImage, - NULL ); - if( FAILED( hr ) ) { - DXTRACE_ERR_MSGBOX( _T("createSurface failed"), hr ); - } - } -} - - -void Direct3DDisplay::destroySurface() -{ - if( emulatedImage ) { - emulatedImage->Release(); - emulatedImage = NULL; - } -} - - -void Direct3DDisplay::calculateDestRect() -{ - float scaleX = (float)dpp.BackBufferWidth / (float)width; - float scaleY = (float)dpp.BackBufferHeight / (float)height; - float min = (scaleX < scaleY) ? scaleX : scaleY; - if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) { - min = (float)theApp.fsMaxScale; - } - destRect.left = 0; - destRect.top = 0; - destRect.right = (LONG)(width * min); - destRect.bottom = (LONG)(height * min); - if( destRect.right != dpp.BackBufferWidth ) { - LONG diff = (dpp.BackBufferWidth - destRect.right) / 2; - destRect.left += diff; - destRect.right += diff; - } - if( destRect.bottom != dpp.BackBufferHeight ) { - LONG diff = (dpp.BackBufferHeight - destRect.bottom) / 2; - destRect.top += diff; - destRect.bottom += diff; - } -} - - -void Direct3DDisplay::setOption( const char *option, int value ) -{ - if( !_tcscmp( option, _T("vsync") ) ) { - theApp.vsync = true; - resetDevice(); - } - - if( !_tcscmp( option, _T("tripleBuffering") ) ) { - theApp.tripleBuffering = true; - resetDevice(); - } - - if( !_tcscmp( option, _T("d3dFilter") ) ) { - switch( value ) - { - case 0: //point - filter = D3DTEXF_POINT; - break; - case 1: //linear - filter = D3DTEXF_LINEAR; - break; - } - } - - if( !_tcscmp( option, _T("maxScale") ) ) { - calculateDestRect(); - } -} - - -bool Direct3DDisplay::resetDevice() -{ - if( !pDevice ) return false; - - HRESULT hr; - destroyFont(); - destroySurface(); - setPresentationType(); - if (!theApp.menuToggle) - pDevice->SetDialogBoxMode( FALSE ); - - if( FAILED( hr = pDevice->Reset( &dpp ) ) ) { - //DXTRACE_ERR_MSGBOX( _T("pDevice->Reset failed"), hr ); - failed = true; - return false; - } - if (theApp.menuToggle) - pDevice->SetDialogBoxMode( TRUE ); - - createFont(); - createSurface(); - failed = false; - return true; -} - - -IDisplay *newDirect3DDisplay() -{ - return new Direct3DDisplay(); -} +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team +// Copyright (C) 2005-2006 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 "Display.h" + +#include "MainWnd.h" + +#include "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" + +// Direct3D +#define DIRECT3D_VERSION 0x0900 +#include // main include file +#include // required for font rednering +#include // contains debug functions + +extern int Init_2xSaI(u32); // initializes all pixel filters +extern int systemSpeed; + +#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 winVideoModeSelect(CWnd *, GUID **); + +class Direct3DDisplay : public IDisplay { +private: + LPDIRECT3D9 pD3D; + LPDIRECT3DDEVICE9 pDevice; + D3DDISPLAYMODE mode; + D3DPRESENT_PARAMETERS dpp; + D3DFORMAT screenFormat; + LPDIRECT3DSURFACE9 emulatedImage; + D3DTEXTUREFILTERTYPE filter; + int width; + int height; + RECT destRect; + bool failed; + ID3DXFont *pFont; + + void createFont(); + void destroyFont(); + void createSurface(); + void destroySurface(); + void calculateDestRect(); + bool resetDevice(); + void setPresentationType(); + +public: + Direct3DDisplay(); + virtual ~Direct3DDisplay(); + virtual DISPLAY_TYPE getType() { return DIRECT_3D; }; + + virtual bool initialize(); + virtual void cleanup(); + virtual void clear(); + virtual void render(); + + virtual void renderMenu(); + virtual bool changeRenderSize( int w, int h ); + virtual void resize( int w, int h ); + virtual void setOption( const char *option, int value ); + virtual int selectFullScreenMode( GUID ** ); +}; + + +Direct3DDisplay::Direct3DDisplay() +{ + pD3D = NULL; + pDevice = NULL; + screenFormat = D3DFMT_X8R8G8B8; + width = 0; + height = 0; + failed = false; + pFont = NULL; + emulatedImage = NULL; + filter = D3DTEXF_POINT; +} + + +Direct3DDisplay::~Direct3DDisplay() +{ + cleanup(); +} + +void Direct3DDisplay::setPresentationType() +{ + // Change display mode + memset(&dpp, 0, sizeof(dpp)); + dpp.Windowed = !(theApp.videoOption>=VIDEO_320x240); + if (!dpp.Windowed) + dpp.BackBufferFormat = + (theApp.fsColorDepth == 32) ? D3DFMT_X8R8G8B8 : D3DFMT_R5G6B5; + else + dpp.BackBufferFormat = mode.Format; + dpp.BackBufferCount = 3; + dpp.MultiSampleType = D3DMULTISAMPLE_NONE; + dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + dpp.BackBufferWidth = !dpp.Windowed ? theApp.fsWidth : theApp.surfaceSizeX; + dpp.BackBufferHeight = !dpp.Windowed ? theApp.fsHeight : theApp.surfaceSizeY; + dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd(); + dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency; + dpp.Flags = theApp.menuToggle ? D3DPRESENTFLAG_LOCKABLE_BACKBUFFER : 0; + if (theApp.vsync) + dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // VSync + else + dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // No Sync +} + + +void Direct3DDisplay::cleanup() +{ + destroyFont(); + destroySurface(); + + if( pDevice ) { + pDevice->Release(); + pDevice = NULL; + } + + if( pD3D ) { + pD3D->Release(); + pD3D = NULL; + } +} + + +bool Direct3DDisplay::initialize() +{ + switch(theApp.cartridgeType) + { + case IMAGE_GBA: + theApp.sizeX = 240; + theApp.sizeY = 160; + break; + case IMAGE_GB: + if (gbBorderOn) + { + theApp.sizeX = 256; + theApp.sizeY = 224; + } + else + { + theApp.sizeX = 160; + theApp.sizeY = 144; + } + break; + } + + + 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_1024x768: + case VIDEO_1280x1024: + case VIDEO_OTHER: + float scaleX = ((float)theApp.fsWidth / theApp.sizeX); + float scaleY = ((float)theApp.fsHeight / theApp.sizeY); + float min = (scaleX < scaleY) ? scaleX : scaleY; + if(theApp.fullScreenStretch) { + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; + } else { + theApp.surfaceSizeX = (int)(theApp.sizeX * min); + theApp.surfaceSizeY = (int)(theApp.sizeY * min); + } + 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, 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, + _T("VisualBoyAdvance"), + style, + x,y,winSizeX,winSizeY, + NULL, + 0); + + if (!(HWND)*pWnd) { + DXTRACE_ERR_MSGBOX( _T("Error creating window"), 0 ); + return FALSE; + } + pWnd->DragAcceptFiles(TRUE); + theApp.updateMenuBar(); + theApp.adjustDestRect(); + + + // load Direct3D v9 + pD3D = Direct3DCreate9( D3D_SDK_VERSION ); + + if(pD3D == NULL) { + DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 ); + return FALSE; + } + pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode); + + theApp.mode320Available = FALSE; + theApp.mode640Available = FALSE; + theApp.mode800Available = FALSE; + theApp.mode1024Available = FALSE; + theApp.mode1280Available = FALSE; + + unsigned int nModes, i; + D3DDISPLAYMODE dm; + + nModes = pD3D->GetAdapterModeCount(theApp.fsAdapter, mode.Format); + for (i = 0; iEnumAdapterModes(theApp.fsAdapter, mode.Format, i, &dm) ) + { + if ( (dm.Width == 320) && (dm.Height == 240) ) + theApp.mode320Available = true; + if ( (dm.Width == 640) && (dm.Height == 480) ) + theApp.mode640Available = true; + if ( (dm.Width == 800) && (dm.Height == 600) ) + theApp.mode800Available = true; + if ( (dm.Width == 1024) && (dm.Height == 768) ) + theApp.mode1024Available = true; + if ( (dm.Width == 1280) && (dm.Height == 1024) ) + theApp.mode1280Available = true; + } + } + + + screenFormat = mode.Format; + + 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: + DXTRACE_ERR_MSGBOX( _T("Unsupport D3D format"), 0 ); + return false; + } + theApp.fsColorDepth = systemColorDepth; + utilUpdateSystemColorMaps(); + + +#ifdef MMX + if(!theApp.disableMMX) { + cpu_mmx = theApp.detectMMX(); + } else { + cpu_mmx = 0; + } +#endif + + + theApp.updateFilter(); + theApp.updateIFB(); + + + // create device + setPresentationType(); + + HRESULT hret = pD3D->CreateDevice( + D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, + pWnd->GetSafeHwnd(), + D3DCREATE_SOFTWARE_VERTEXPROCESSING, + &dpp, + &pDevice); + if( FAILED( hret ) ) { + DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D device"), hret ); + return false; + } + + createFont(); + createSurface(); + calculateDestRect(); + + setOption( _T("d3dFilter"), theApp.d3dFilter ); + + if(failed) return false; + + return TRUE; +} + + +void Direct3DDisplay::renderMenu() +{ + checkFullScreen(); + if(theApp.m_pMainWnd) { + theApp.m_pMainWnd->DrawMenuBar(); + } +} + + +void Direct3DDisplay::clear() +{ + if( pDevice ) { + pDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0x00,0x00,0x00), 0.0f, 0 ); + } +} + + +void Direct3DDisplay::render() +{ + if( failed ) return; + if(!pDevice) return; + if( FAILED( pDevice->TestCooperativeLevel() ) ) return; + + clear(); + + pDevice->BeginScene(); + + // copy pix to emulatedImage and apply pixel filter if selected + HRESULT hr; + D3DLOCKED_RECT lr; + if( FAILED( hr = emulatedImage->LockRect( &lr, NULL, D3DLOCK_DISCARD ) ) ) { + DXTRACE_ERR_MSGBOX( _T("Can not lock back buffer"), hr ); + return; + } else { + if( !theApp.filterFunction ) { + copyImage( pix, lr.pBits, theApp.sizeX, theApp.sizeY, lr.Pitch, systemColorDepth ); + } else { + u32 pitch = theApp.filterWidth * (systemColorDepth>>3) + 4; + theApp.filterFunction( pix + pitch, + pitch, + (u8*)theApp.delta, + (u8*)lr.pBits, + lr.Pitch, + theApp.filterWidth, + theApp.filterHeight); + } + emulatedImage->UnlockRect(); + } + + // copy emulatedImage to pBackBuffer and scale with or without aspect ratio + LPDIRECT3DSURFACE9 pBackBuffer; + pDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer ); + if( theApp.fullScreenStretch ) { + pDevice->StretchRect( emulatedImage, NULL, pBackBuffer, NULL, filter ); + } else { + pDevice->StretchRect( emulatedImage, NULL, pBackBuffer, &destRect, filter ); + } + pBackBuffer->Release(); + pBackBuffer = NULL; + + D3DCOLOR color; + RECT r; + r.left = 4; + r.right = dpp.BackBufferWidth - 4; + + if( theApp.screenMessage ) { + color = theApp.showSpeedTransparent ? D3DCOLOR_ARGB(0x7F, 0xFF, 0x00, 0x00) : D3DCOLOR_ARGB(0xFF, 0xFF, 0x00, 0x00); + if( ( ( GetTickCount() - theApp.screenMessageTime ) < 3000 ) && !theApp.disableStatusMessage && pFont ) { + r.top = dpp.BackBufferHeight - 20; + r.bottom = dpp.BackBufferHeight - 4; + pFont->DrawText( NULL, theApp.screenMessageBuffer, -1, &r, 0, color ); + } else { + theApp.screenMessage = false; + } + } + + if( theApp.showSpeed && ( theApp.videoOption > VIDEO_4X ) ) { + color = theApp.showSpeedTransparent ? D3DCOLOR_ARGB(0x7F, 0x00, 0x00, 0xFF) : D3DCOLOR_ARGB(0xFF, 0x00, 0x00, 0xFF); + char buffer[30]; + if( theApp.showSpeed == 1 ) { + sprintf( buffer, "%3d%%", systemSpeed ); + } else { + sprintf( buffer, "%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, theApp.showRenderedFrames ); + } + + r.top = 4; + r.bottom = 20; + pFont->DrawText( NULL, buffer, -1, &r, 0, color ); + } + + pDevice->EndScene(); + + pDevice->Present( NULL, NULL, NULL, NULL ); + + return; +} + + +bool Direct3DDisplay::changeRenderSize( int w, int h ) +{ + if( (w != width) || (h != height) ) { + width = w; height = h; + if( pDevice ) { + destroySurface(); + createSurface(); + calculateDestRect(); + } + } + return true; +} + + +void Direct3DDisplay::resize( int w, int h ) +{ + if( (w != dpp.BackBufferWidth) || (h != dpp.BackBufferHeight) ) { + dpp.BackBufferWidth = (UINT)w; + dpp.BackBufferHeight = (UINT)h; + resetDevice(); + calculateDestRect(); + } + if(theApp.videoOption > VIDEO_4X) + resetDevice(); + +} + + +int Direct3DDisplay::selectFullScreenMode( GUID **pGUID ) +{ + return winVideoModeSelect(theApp.m_pMainWnd, pGUID); +} + + +void Direct3DDisplay::createFont() +{ + if( !pFont ) { + HRESULT hr = D3DXCreateFont( + pDevice, + 14, + 0, + FW_BOLD, + 1, + FALSE, + DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH || FF_DONTCARE, + _T("Arial"), + &pFont ); + if( FAILED( hr ) ) { + DXTRACE_ERR_MSGBOX( _T("createFont failed"), hr ); + } + } +} + + +void Direct3DDisplay::destroyFont() +{ + if( pFont ) { + pFont->Release(); + pFont = NULL; + } +} + + +void Direct3DDisplay::createSurface() +{ + if( !emulatedImage ) { + HRESULT hr = pDevice->CreateOffscreenPlainSurface( + width, height, + dpp.BackBufferFormat, + D3DPOOL_DEFAULT, + &emulatedImage, + NULL ); + if( FAILED( hr ) ) { + DXTRACE_ERR_MSGBOX( _T("createSurface failed"), hr ); + } + } +} + + +void Direct3DDisplay::destroySurface() +{ + if( emulatedImage ) { + emulatedImage->Release(); + emulatedImage = NULL; + } +} + + +void Direct3DDisplay::calculateDestRect() +{ + float scaleX = (float)dpp.BackBufferWidth / (float)width; + float scaleY = (float)dpp.BackBufferHeight / (float)height; + float min = (scaleX < scaleY) ? scaleX : scaleY; + if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) { + min = (float)theApp.fsMaxScale; + } + destRect.left = 0; + destRect.top = 0; + destRect.right = (LONG)(width * min); + destRect.bottom = (LONG)(height * min); + if( destRect.right != dpp.BackBufferWidth ) { + LONG diff = (dpp.BackBufferWidth - destRect.right) / 2; + destRect.left += diff; + destRect.right += diff; + } + if( destRect.bottom != dpp.BackBufferHeight ) { + LONG diff = (dpp.BackBufferHeight - destRect.bottom) / 2; + destRect.top += diff; + destRect.bottom += diff; + } +} + + +void Direct3DDisplay::setOption( const char *option, int value ) +{ + if( !_tcscmp( option, _T("vsync") ) ) { + theApp.vsync = true; + resetDevice(); + } + + if( !_tcscmp( option, _T("tripleBuffering") ) ) { + theApp.tripleBuffering = true; + resetDevice(); + } + + if( !_tcscmp( option, _T("d3dFilter") ) ) { + switch( value ) + { + case 0: //point + filter = D3DTEXF_POINT; + break; + case 1: //linear + filter = D3DTEXF_LINEAR; + break; + } + } + + if( !_tcscmp( option, _T("maxScale") ) ) { + calculateDestRect(); + } +} + + +bool Direct3DDisplay::resetDevice() +{ + if( !pDevice ) return false; + + HRESULT hr; + destroyFont(); + destroySurface(); + setPresentationType(); + if (!theApp.menuToggle) + pDevice->SetDialogBoxMode( FALSE ); + + if( FAILED( hr = pDevice->Reset( &dpp ) ) ) { + //DXTRACE_ERR_MSGBOX( _T("pDevice->Reset failed"), hr ); + failed = true; + return false; + } + if (theApp.menuToggle) + pDevice->SetDialogBoxMode( TRUE ); + + createFont(); + createSurface(); + failed = false; + return true; +} + + +IDisplay *newDirect3DDisplay() +{ + return new Direct3DDisplay(); +} diff --git a/src/win32/DirectDraw.cpp b/src/win32/DirectDraw.cpp index 0a4797e5..b5c0a67f 100644 --- a/src/win32/DirectDraw.cpp +++ b/src/win32/DirectDraw.cpp @@ -1,815 +1,815 @@ -// 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 - -#include "../System.h" -#include "../gb/gbGlobals.h" -#include "../GBA.h" -#include "../Globals.h" -#include "../Text.h" -#include "../Util.h" - -#include "VBA.h" -#include "MainWnd.h" -#include "Reg.h" -#include "resource.h" - -#include "Display.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -extern int Init_2xSaI(u32); -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; - } - if(surf->dwWidth == 1024 && - surf->dwHeight == 768 && - surf->ddpfPixelFormat.dwRGBBitCount == 16) { - theApp.mode1024Available = TRUE; - } - if(surf->dwWidth == 1280 && - surf->dwHeight == 1024 && - surf->ddpfPixelFormat.dwRGBBitCount == 16) { - theApp.mode1280Available = 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) { -#ifdef _AFXDLL - AfxFreeLibrary( ddrawDLL ); -#else - FreeLibrary( ddrawDLL ); -#endif - 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_1024x768: - case VIDEO_1280x1024: - 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; - -#ifdef _AFXDLL - ddrawDLL = AfxLoadLibrary("ddraw.dll"); -#else - ddrawDLL = LoadLibrary( _T("ddraw.dll") ); -#endif - - 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; - theApp.mode1024Available = false; - theApp.mode1280Available = 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, - theApp.fsFrequency, - 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); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x7C00 && - px.dwGBitMask == 0x03E0 && - px.dwBBitMask == 0x001F) { - Init_2xSaI(555); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x001F && - px.dwGBitMask == 0x07E0 && - px.dwBBitMask == 0xF800) { - systemGreenShift++; - Init_2xSaI(565); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x001F && - px.dwGBitMask == 0x03E0 && - px.dwBBitMask == 0x7C00) { - Init_2xSaI(555); - } 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); - } - - utilUpdateSystemColorMaps(); - 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; - unsigned int nBytesPerPixel = systemColorDepth>>3; - - if(pDirectDraw == NULL || - ddsOffscreen == NULL || - ddsPrimary == NULL) - return; - - 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(theApp.filterFunction) { - if(systemColorDepth == 16) - (*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.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; - } - } - copyImage( pix, ddsDesc.lpSurface, copyX, copyY, ddsDesc.lPitch, systemColorDepth ); - } - 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); - } - } else if(theApp.ddrawDebug) - winlog("Error during lock: %08x\n", hret); - - hret = ddsOffscreen->Unlock(NULL); - - if(hret == DD_OK) { - if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it? - hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); - } - 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); - 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); - - if(theApp.screenMessage) { - if(((GetTickCount() - theApp.screenMessageTime) < 3000) && - !theApp.disableStatusMessage) { - ddsPrimary->SetClipper(ddsClipper); - HDC hdc; - ddsPrimary->GetDC(&hdc); - SetTextColor(hdc, RGB(255,0,0)); - SetBkMode(hdc,TRANSPARENT); - TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, - (int)_tcslen(theApp.screenMessageBuffer)); - ddsPrimary->ReleaseDC(hdc); - } else { - theApp.screenMessage = false; - } - } - - 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(); -} - +// 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 + +#include "../System.h" +#include "../gb/gbGlobals.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" +#include "../Util.h" + +#include "VBA.h" +#include "MainWnd.h" +#include "Reg.h" +#include "resource.h" + +#include "Display.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int Init_2xSaI(u32); +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; + } + if(surf->dwWidth == 1024 && + surf->dwHeight == 768 && + surf->ddpfPixelFormat.dwRGBBitCount == 16) { + theApp.mode1024Available = TRUE; + } + if(surf->dwWidth == 1280 && + surf->dwHeight == 1024 && + surf->ddpfPixelFormat.dwRGBBitCount == 16) { + theApp.mode1280Available = 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) { +#ifdef _AFXDLL + AfxFreeLibrary( ddrawDLL ); +#else + FreeLibrary( ddrawDLL ); +#endif + 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_1024x768: + case VIDEO_1280x1024: + 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; + +#ifdef _AFXDLL + ddrawDLL = AfxLoadLibrary("ddraw.dll"); +#else + ddrawDLL = LoadLibrary( _T("ddraw.dll") ); +#endif + + 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; + theApp.mode1024Available = false; + theApp.mode1280Available = 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, + theApp.fsFrequency, + 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); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x7C00 && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x001F) { + Init_2xSaI(555); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x07E0 && + px.dwBBitMask == 0xF800) { + systemGreenShift++; + Init_2xSaI(565); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x7C00) { + Init_2xSaI(555); + } 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); + } + + utilUpdateSystemColorMaps(); + 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; + unsigned int nBytesPerPixel = systemColorDepth>>3; + + if(pDirectDraw == NULL || + ddsOffscreen == NULL || + ddsPrimary == NULL) + return; + + 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(theApp.filterFunction) { + if(systemColorDepth == 16) + (*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.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; + } + } + copyImage( pix, ddsDesc.lpSurface, copyX, copyY, ddsDesc.lPitch, systemColorDepth ); + } + 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); + } + } else if(theApp.ddrawDebug) + winlog("Error during lock: %08x\n", hret); + + hret = ddsOffscreen->Unlock(NULL); + + if(hret == DD_OK) { + if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it? + hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); + } + 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); + 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); + + if(theApp.screenMessage) { + if(((GetTickCount() - theApp.screenMessageTime) < 3000) && + !theApp.disableStatusMessage) { + ddsPrimary->SetClipper(ddsClipper); + HDC hdc; + ddsPrimary->GetDC(&hdc); + SetTextColor(hdc, RGB(255,0,0)); + SetBkMode(hdc,TRANSPARENT); + TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, + (int)_tcslen(theApp.screenMessageBuffer)); + ddsPrimary->ReleaseDC(hdc); + } else { + theApp.screenMessage = false; + } + } + + 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(); +} + diff --git a/src/win32/DirectDraw.cpp.orig b/src/win32/DirectDraw.cpp.orig index 177dedf4..d359053b 100644 --- a/src/win32/DirectDraw.cpp.orig +++ b/src/win32/DirectDraw.cpp.orig @@ -1,845 +1,845 @@ -// 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 - -#include "../System.h" -#include "../gb/gbGlobals.h" -#include "../GBA.h" -#include "../Globals.h" -#include "../Text.h" -#include "../Util.h" - -#include "VBA.h" -#include "MainWnd.h" -#include "Reg.h" -#include "..\..\res\resource.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -extern int Init_2xSaI(u32); -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 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) { - FreeLibrary(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_1024x768: - case VIDEO_1280x1024: - case VIDEO_OTHER: - { - float scaleX = ((float)theApp.fsWidth / (float)theApp.sizeX); - float scaleY = ((float)theApp.fsHeight / (float)theApp.sizeY); - float min = scaleX < scaleY ? scaleX : scaleY; - if(theApp.fsMaxScale) - min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min; - theApp.surfaceSizeX = (int)(theApp.sizeX * min); - theApp.surfaceSizeY = (int)(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 = LoadLibrary("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, - 60, - 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); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x7C00 && - px.dwGBitMask == 0x03E0 && - px.dwBBitMask == 0x001F) { - Init_2xSaI(555); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x001F && - px.dwGBitMask == 0x07E0 && - px.dwBBitMask == 0xF800) { - systemGreenShift++; - Init_2xSaI(565); - } else if((px.dwFlags&DDPF_RGB) != 0 && - px.dwRBitMask == 0x001F && - px.dwGBitMask == 0x03E0 && - px.dwBBitMask == 0x7C00) { - Init_2xSaI(555); - } 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); - } - - utilUpdateSystemColorMaps(); - 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; - - 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(theApp.filterFunction) { - if(systemColorDepth == 16) - (*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.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) { - 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); - } - } else if(theApp.ddrawDebug) - winlog("Error during lock: %08x\n", hret); - - hret = ddsOffscreen->Unlock(NULL); - - if(hret == DD_OK) { - if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it? - hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); - } - 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); - - if(theApp.screenMessage) { - if(((GetTickCount() - theApp.screenMessageTime) < 3000) && - !theApp.disableStatusMessage) { - ddsPrimary->SetClipper(ddsClipper); - HDC hdc; - ddsPrimary->GetDC(&hdc); - SetTextColor(hdc, RGB(255,0,0)); - SetBkMode(hdc,TRANSPARENT); - TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, - strlen(theApp.screenMessageBuffer)); - ddsPrimary->ReleaseDC(hdc); - } else { - theApp.screenMessage = false; - } - } - - 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(); -} - +// 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 + +#include "../System.h" +#include "../gb/gbGlobals.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" +#include "../Util.h" + +#include "VBA.h" +#include "MainWnd.h" +#include "Reg.h" +#include "..\..\res\resource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +extern int Init_2xSaI(u32); +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 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) { + FreeLibrary(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_1024x768: + case VIDEO_1280x1024: + case VIDEO_OTHER: + { + float scaleX = ((float)theApp.fsWidth / (float)theApp.sizeX); + float scaleY = ((float)theApp.fsHeight / (float)theApp.sizeY); + float min = scaleX < scaleY ? scaleX : scaleY; + if(theApp.fsMaxScale) + min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min; + theApp.surfaceSizeX = (int)(theApp.sizeX * min); + theApp.surfaceSizeY = (int)(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 = LoadLibrary("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, + 60, + 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); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x7C00 && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x001F) { + Init_2xSaI(555); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x07E0 && + px.dwBBitMask == 0xF800) { + systemGreenShift++; + Init_2xSaI(565); + } else if((px.dwFlags&DDPF_RGB) != 0 && + px.dwRBitMask == 0x001F && + px.dwGBitMask == 0x03E0 && + px.dwBBitMask == 0x7C00) { + Init_2xSaI(555); + } 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); + } + + utilUpdateSystemColorMaps(); + 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; + + 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(theApp.filterFunction) { + if(systemColorDepth == 16) + (*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.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) { + 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); + } + } else if(theApp.ddrawDebug) + winlog("Error during lock: %08x\n", hret); + + hret = ddsOffscreen->Unlock(NULL); + + if(hret == DD_OK) { + if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it? + hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); + } + 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); + + if(theApp.screenMessage) { + if(((GetTickCount() - theApp.screenMessageTime) < 3000) && + !theApp.disableStatusMessage) { + ddsPrimary->SetClipper(ddsClipper); + HDC hdc; + ddsPrimary->GetDC(&hdc); + SetTextColor(hdc, RGB(255,0,0)); + SetBkMode(hdc,TRANSPARENT); + TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, + strlen(theApp.screenMessageBuffer)); + ddsPrimary->ReleaseDC(hdc); + } else { + theApp.screenMessage = false; + } + } + + 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(); +} + diff --git a/src/win32/DirectInput.cpp b/src/win32/DirectInput.cpp index d3b08096..3211f638 100644 --- a/src/win32/DirectInput.cpp +++ b/src/win32/DirectInput.cpp @@ -1,946 +1,946 @@ - -/* VisualBoyAdvance S - GB & GBA emulator - Copyright (C) 2006 Spacy - - Original VBA Credits: - Copyright (C) 1999-2003 Forgotten - Copyright (C) 2004-2006 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., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "stdafx.h" -#include "VBA.h" -#include "Input.h" -#include "Reg.h" -#include "WinResUtil.h" - -#define DIRECTINPUT_VERSION 0x0800 -#include -#pragma comment(lib, "Dinput8") - - -#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 { -public: - virtual void checkDevices(); - DirectInput(); - virtual ~DirectInput(); - - virtual bool initialize(); - virtual bool readDevices(); - virtual u32 readDevice(int which); - virtual CString getKeyName(LONG_PTR key); - virtual void checkKeys(); - virtual void checkMotionKeys(); - virtual void activate(); - virtual void loadSettings(); - virtual void saveSettings(); -}; - -struct deviceInfo { - LPDIRECTINPUTDEVICE8 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 LPDIRECTINPUT8 pDirectInput = NULL; -static int axisNumber = 0; - - - - -LONG_PTR defvalues[JOYPADS * KEYS_PER_PAD + MOTION_KEYS] = - { - 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, - DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2 -}; - - -void winReadKey(const char *name, KeyList& Keys) -{ - CString TxtKeyList = regQueryStringValue(name, ""); - int curPos= 0; - - CString resToken=TxtKeyList.Tokenize(",",curPos); - while (resToken != "") - { - Keys.AddTail(atoi(resToken)); - resToken= TxtKeyList.Tokenize(",",curPos); - }; -} - -void winReadKey(const char *name, int num, KeyList& Keys) -{ - char buffer[80]; - - sprintf(buffer, "Joy%d_%s", num, name); - winReadKey(buffer, Keys); -} - - -void winReadKeys() -{ - - for(int i = 0; i < JOYPADS; i++) { - winReadKey("Left", i, theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)]); - winReadKey("Right", i, theApp.input->joypaddata[JOYPAD(i, KEY_RIGHT)]); - winReadKey("Up", i, theApp.input->joypaddata[JOYPAD(i,KEY_UP)]); - winReadKey("Down", i, theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)]); - winReadKey("A", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)]); - winReadKey("B", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)]); - winReadKey("L", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)]); - winReadKey("R", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)]); - winReadKey("Start", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)]); - winReadKey("Select", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)]); - winReadKey("Speed", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]); - winReadKey("Capture", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)]); - winReadKey("GS", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)]); - } - winReadKey("Motion_Left", theApp.input->joypaddata[MOTION(KEY_LEFT)]); - winReadKey("Motion_Right", theApp.input->joypaddata[MOTION(KEY_RIGHT)]); - winReadKey("Motion_Up", theApp.input->joypaddata[MOTION(KEY_UP)]); - winReadKey("Motion_Down", theApp.input->joypaddata[MOTION(KEY_DOWN)]); -} - -void winSaveKey(char *name, KeyList& value) -{ - CString txtKeys; - - POSITION p = value.GetHeadPosition(); - while(p!=NULL) - { - CString tmp; - tmp.Format("%d", value.GetNext(p)); - txtKeys+=tmp; - if (p!=NULL) - txtKeys+=","; - } - regSetStringValue(name, txtKeys); -} - -static void winSaveKey(char *name, int num, KeyList& value) -{ - char buffer[80]; - - sprintf(buffer, "Joy%d_%s", num, name); - winSaveKey(buffer, value); -} - -void winSaveKeys() -{ - for(int i = 0; i < JOYPADS; i++) { - winSaveKey("Left", i, theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)]); - winSaveKey("Right", i, theApp.input->joypaddata[JOYPAD(i,KEY_RIGHT)]); - winSaveKey("Up", i, theApp.input->joypaddata[JOYPAD(i,KEY_UP)]); - winSaveKey("Speed", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]); - winSaveKey("Capture", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)]); - winSaveKey("GS", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)]); - winSaveKey("Down", i, theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)]); - winSaveKey("A", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)]); - winSaveKey("B", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)]); - winSaveKey("L", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)]); - winSaveKey("R", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)]); - winSaveKey("Start", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)]); - winSaveKey("Select", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)]); - } - regSetDwordValue("joyVersion", 1); - - winSaveKey("Motion_Left", - theApp.input->joypaddata[MOTION(KEY_LEFT)]); - winSaveKey("Motion_Right", - theApp.input->joypaddata[MOTION(KEY_RIGHT)]); - winSaveKey("Motion_Up", - theApp.input->joypaddata[MOTION(KEY_UP)]); - winSaveKey("Motion_Down", - theApp.input->joypaddata[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; - } - } - - - 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() -{ - LONG_PTR dev = 0; - int i; - - for(i = 0; i < (sizeof(theApp.input->joypaddata) / sizeof(theApp.input->joypaddata[0])); i++) - { - if (theApp.input->joypaddata[i].IsEmpty() && defvalues[i]) - theApp.input->joypaddata[i].AddTail(defvalues[i]); - POSITION p = theApp.input->joypaddata[i].GetHeadPosition(); - while(p!=NULL) - { - LONG_PTR k = theApp.input->joypaddata[i].GetNext(p); - if (k > 0 && DEVICEOF(k) < numDevices) - pDevices[DEVICEOF(k)].needed = true; - } - } -} - -#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() -{ - // mham fix. Patch #1378104 - UCHAR keystate[256]; - HRESULT hret = pDevices[0].device->Acquire(); - - if (pDevices[0].first) { - pDevices[0].device->GetDeviceState(256, (LPVOID)pDevices[0].data); - pDevices[0].first = FALSE; - return; - } - - hret = pDevices[0].device-> - GetDeviceState(256, (LPVOID)keystate); - - if (hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { - return; - } - - if (hret == DI_OK) { - for (int i = 0; i < 256; i++) { - if (keystate[i] == pDevices[0].data[i]) continue; - if (KEYDOWN(keystate, i)) { - SendMessage(GetFocus(), JOYCONFIG_MESSAGE,0,i); - break; - } - } - } - memcpy(pDevices[0].data, keystate, sizeof(UCHAR) * 256); -} - -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(LONG_PTR key) -{ - LONG_PTR dev = (key >> 8); - - LONG_PTR k = (key & 255); - - if (dev == 0) { - return KEYDOWN(pDevices[0].data,k); - } else if (dev >= numDevices) { - return FALSE; - } else { - if (k < 16) { - LONG_PTR 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) { - LONG_PTR 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; -} - -BOOL checkKey(KeyList &k) -{ - POSITION p = k.GetHeadPosition(); - while(p!=NULL) - { - if (checkKey(k.GetNext(p))) - return TRUE; - } - return FALSE; -} - -DirectInput::DirectInput() -{} - -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; - } -} - - -bool DirectInput::initialize() -{ - - HRESULT hr; - - hr = DirectInput8Create( - AfxGetInstanceHandle(), - DIRECTINPUT_VERSION, - IID_IDirectInput8, - (LPVOID*)&pDirectInput, - NULL ); - - if ( hr != DI_OK ) { - return false; - } - - - - - hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL, - DIEnumDevicesCallback2, - NULL, - DIEDFL_ATTACHEDONLY); - - - - pDevices = (deviceInfo *)calloc(numDevices, sizeof(deviceInfo)); - - hr = pDirectInput->CreateDevice(GUID_SysKeyboard,&pDevices[0].device,NULL); - pDevices[0].isPolled = false; - pDevices[0].needed = true; - pDevices[0].first = true; - - if (hr != DI_OK) { - return false; - } - - - numDevices = 1; - - hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL, - DIEnumDevicesCallback, - NULL, - DIEDFL_ATTACHEDONLY); - - - if (hr != DI_OK) { - return false; - } - - hr = pDevices[0].device->SetDataFormat(&c_dfDIKeyboard); - - if (hr != DI_OK) { - return false; - } - - int i; - for (i = 1; i < numDevices; i++) { - pDevices[i].device->SetDataFormat(&c_dfDIJoystick); - pDevices[i].needed = false; - pDevices[i].first = true; - currentDevice = &pDevices[i]; - axisNumber = 0; - currentDevice->device->EnumObjects(EnumAxesCallback, NULL, DIDFT_AXIS); - currentDevice->device->EnumObjects(EnumPovsCallback, NULL, DIDFT_POV); - - - currentDevice = NULL; - } - - for (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 DirectInput::readDevice(int which) -{ - u32 res = 0; - int i = theApp.joypadDefault; - if(which >= 0 && which <= 3) - i = which; - - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)])) - res |= 1; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)])) - res |= 2; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)])) - res |= 4; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)])) - res |= 8; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_RIGHT)])) - res |= 16; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)])) - res |= 32; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_UP)])) - res |= 64; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)])) - res |= 128; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)])) - res |= 256; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)])) - res |= 512; - - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)])) - res |= 4096; - - if(theApp.autoFire) { - res &= (~theApp.autoFire); - if(theApp.autoFireToggle) - res |= theApp.autoFire; - theApp.autoFireToggle = !theApp.autoFireToggle; - } - - // 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(theApp.movieRecording) { - if(i == theApp.joypadDefault) { - if(res != theApp.movieLastJoypad) { - fwrite(&theApp.movieFrame, 1, sizeof(theApp.movieFrame), theApp.movieFile); - fwrite(&res, 1, sizeof(res), theApp.movieFile); - theApp.movieLastJoypad = res; - } - } - } - if(theApp.moviePlaying) { - if(theApp.movieFrame == theApp.moviePlayFrame) { - theApp.movieLastJoypad = theApp.movieNextJoypad; - theApp.movieReadNext(); - } - res = theApp.movieLastJoypad; - } - // we don't record speed up or screen capture buttons - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]) || theApp.speedupToggle) - res |= 1024; - if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)])) - res |= 2048; - - return res; -} - -CString DirectInput::getKeyName(LONG_PTR key) -{ - LONG_PTR d = (key >> 8); - LONG_PTR 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, (DWORD)key, DIPH_BYOFFSET ); - winBuffer = di.tszName; - } else if (d < numDevices) { - 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) { - LONG_PTR hat = (k >> 2) & 3; - pDevices[d].device->GetObjectInfo(&di, - (DWORD)DIJOFS_POV(hat), - DIPH_BYOFFSET); - char *dir = "up"; - LONG_PTR 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, - (DWORD)DIJOFS_BUTTON(k-128), - DIPH_BYOFFSET); - winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName); - } - } - else - { - // Joystick isn't plugged in. We can't decipher k, so just show its value. - winBuffer.Format("Joy %d (%d)", d, k); - } - - return winBuffer; -} - -void DirectInput::checkKeys() -{ - ::checkKeys(); -} - -void DirectInput::checkMotionKeys() -{ - if(checkKey(theApp.input->joypaddata[MOTION(KEY_LEFT)])) { - theApp.sensorX += 3; - if(theApp.sensorX > 2197) - theApp.sensorX = 2197; - if(theApp.sensorX < 2047) - theApp.sensorX = 2057; - } else if(checkKey(theApp.input->joypaddata[MOTION(KEY_RIGHT)])) { - 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(checkKey(theApp.input->joypaddata[MOTION(KEY_UP)])) { - theApp.sensorY += 3; - if(theApp.sensorY > 2197) - theApp.sensorY = 2197; - if(theApp.sensorY < 2047) - theApp.sensorY = 2057; - } else if(checkKey(theApp.input->joypaddata[MOTION(KEY_DOWN)])) { - 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; - } -} - -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(); -} + +/* VisualBoyAdvance S - GB & GBA emulator + Copyright (C) 2006 Spacy + + Original VBA Credits: + Copyright (C) 1999-2003 Forgotten + Copyright (C) 2004-2006 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "stdafx.h" +#include "VBA.h" +#include "Input.h" +#include "Reg.h" +#include "WinResUtil.h" + +#define DIRECTINPUT_VERSION 0x0800 +#include +#pragma comment(lib, "Dinput8") + + +#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 { +public: + virtual void checkDevices(); + DirectInput(); + virtual ~DirectInput(); + + virtual bool initialize(); + virtual bool readDevices(); + virtual u32 readDevice(int which); + virtual CString getKeyName(LONG_PTR key); + virtual void checkKeys(); + virtual void checkMotionKeys(); + virtual void activate(); + virtual void loadSettings(); + virtual void saveSettings(); +}; + +struct deviceInfo { + LPDIRECTINPUTDEVICE8 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 LPDIRECTINPUT8 pDirectInput = NULL; +static int axisNumber = 0; + + + + +LONG_PTR defvalues[JOYPADS * KEYS_PER_PAD + MOTION_KEYS] = + { + 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, + DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2 +}; + + +void winReadKey(const char *name, KeyList& Keys) +{ + CString TxtKeyList = regQueryStringValue(name, ""); + int curPos= 0; + + CString resToken=TxtKeyList.Tokenize(",",curPos); + while (resToken != "") + { + Keys.AddTail(atoi(resToken)); + resToken= TxtKeyList.Tokenize(",",curPos); + }; +} + +void winReadKey(const char *name, int num, KeyList& Keys) +{ + char buffer[80]; + + sprintf(buffer, "Joy%d_%s", num, name); + winReadKey(buffer, Keys); +} + + +void winReadKeys() +{ + + for(int i = 0; i < JOYPADS; i++) { + winReadKey("Left", i, theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)]); + winReadKey("Right", i, theApp.input->joypaddata[JOYPAD(i, KEY_RIGHT)]); + winReadKey("Up", i, theApp.input->joypaddata[JOYPAD(i,KEY_UP)]); + winReadKey("Down", i, theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)]); + winReadKey("A", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)]); + winReadKey("B", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)]); + winReadKey("L", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)]); + winReadKey("R", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)]); + winReadKey("Start", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)]); + winReadKey("Select", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)]); + winReadKey("Speed", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]); + winReadKey("Capture", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)]); + winReadKey("GS", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)]); + } + winReadKey("Motion_Left", theApp.input->joypaddata[MOTION(KEY_LEFT)]); + winReadKey("Motion_Right", theApp.input->joypaddata[MOTION(KEY_RIGHT)]); + winReadKey("Motion_Up", theApp.input->joypaddata[MOTION(KEY_UP)]); + winReadKey("Motion_Down", theApp.input->joypaddata[MOTION(KEY_DOWN)]); +} + +void winSaveKey(char *name, KeyList& value) +{ + CString txtKeys; + + POSITION p = value.GetHeadPosition(); + while(p!=NULL) + { + CString tmp; + tmp.Format("%d", value.GetNext(p)); + txtKeys+=tmp; + if (p!=NULL) + txtKeys+=","; + } + regSetStringValue(name, txtKeys); +} + +static void winSaveKey(char *name, int num, KeyList& value) +{ + char buffer[80]; + + sprintf(buffer, "Joy%d_%s", num, name); + winSaveKey(buffer, value); +} + +void winSaveKeys() +{ + for(int i = 0; i < JOYPADS; i++) { + winSaveKey("Left", i, theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)]); + winSaveKey("Right", i, theApp.input->joypaddata[JOYPAD(i,KEY_RIGHT)]); + winSaveKey("Up", i, theApp.input->joypaddata[JOYPAD(i,KEY_UP)]); + winSaveKey("Speed", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]); + winSaveKey("Capture", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)]); + winSaveKey("GS", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)]); + winSaveKey("Down", i, theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)]); + winSaveKey("A", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)]); + winSaveKey("B", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)]); + winSaveKey("L", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)]); + winSaveKey("R", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)]); + winSaveKey("Start", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)]); + winSaveKey("Select", i, theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)]); + } + regSetDwordValue("joyVersion", 1); + + winSaveKey("Motion_Left", + theApp.input->joypaddata[MOTION(KEY_LEFT)]); + winSaveKey("Motion_Right", + theApp.input->joypaddata[MOTION(KEY_RIGHT)]); + winSaveKey("Motion_Up", + theApp.input->joypaddata[MOTION(KEY_UP)]); + winSaveKey("Motion_Down", + theApp.input->joypaddata[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; + } + } + + + 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() +{ + LONG_PTR dev = 0; + int i; + + for(i = 0; i < (sizeof(theApp.input->joypaddata) / sizeof(theApp.input->joypaddata[0])); i++) + { + if (theApp.input->joypaddata[i].IsEmpty() && defvalues[i]) + theApp.input->joypaddata[i].AddTail(defvalues[i]); + POSITION p = theApp.input->joypaddata[i].GetHeadPosition(); + while(p!=NULL) + { + LONG_PTR k = theApp.input->joypaddata[i].GetNext(p); + if (k > 0 && DEVICEOF(k) < numDevices) + pDevices[DEVICEOF(k)].needed = true; + } + } +} + +#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() +{ + // mham fix. Patch #1378104 + UCHAR keystate[256]; + HRESULT hret = pDevices[0].device->Acquire(); + + if (pDevices[0].first) { + pDevices[0].device->GetDeviceState(256, (LPVOID)pDevices[0].data); + pDevices[0].first = FALSE; + return; + } + + hret = pDevices[0].device-> + GetDeviceState(256, (LPVOID)keystate); + + if (hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { + return; + } + + if (hret == DI_OK) { + for (int i = 0; i < 256; i++) { + if (keystate[i] == pDevices[0].data[i]) continue; + if (KEYDOWN(keystate, i)) { + SendMessage(GetFocus(), JOYCONFIG_MESSAGE,0,i); + break; + } + } + } + memcpy(pDevices[0].data, keystate, sizeof(UCHAR) * 256); +} + +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(LONG_PTR key) +{ + LONG_PTR dev = (key >> 8); + + LONG_PTR k = (key & 255); + + if (dev == 0) { + return KEYDOWN(pDevices[0].data,k); + } else if (dev >= numDevices) { + return FALSE; + } else { + if (k < 16) { + LONG_PTR 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) { + LONG_PTR 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; +} + +BOOL checkKey(KeyList &k) +{ + POSITION p = k.GetHeadPosition(); + while(p!=NULL) + { + if (checkKey(k.GetNext(p))) + return TRUE; + } + return FALSE; +} + +DirectInput::DirectInput() +{} + +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; + } +} + + +bool DirectInput::initialize() +{ + + HRESULT hr; + + hr = DirectInput8Create( + AfxGetInstanceHandle(), + DIRECTINPUT_VERSION, + IID_IDirectInput8, + (LPVOID*)&pDirectInput, + NULL ); + + if ( hr != DI_OK ) { + return false; + } + + + + + hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL, + DIEnumDevicesCallback2, + NULL, + DIEDFL_ATTACHEDONLY); + + + + pDevices = (deviceInfo *)calloc(numDevices, sizeof(deviceInfo)); + + hr = pDirectInput->CreateDevice(GUID_SysKeyboard,&pDevices[0].device,NULL); + pDevices[0].isPolled = false; + pDevices[0].needed = true; + pDevices[0].first = true; + + if (hr != DI_OK) { + return false; + } + + + numDevices = 1; + + hr = pDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL, + DIEnumDevicesCallback, + NULL, + DIEDFL_ATTACHEDONLY); + + + if (hr != DI_OK) { + return false; + } + + hr = pDevices[0].device->SetDataFormat(&c_dfDIKeyboard); + + if (hr != DI_OK) { + return false; + } + + int i; + for (i = 1; i < numDevices; i++) { + pDevices[i].device->SetDataFormat(&c_dfDIJoystick); + pDevices[i].needed = false; + pDevices[i].first = true; + currentDevice = &pDevices[i]; + axisNumber = 0; + currentDevice->device->EnumObjects(EnumAxesCallback, NULL, DIDFT_AXIS); + currentDevice->device->EnumObjects(EnumPovsCallback, NULL, DIDFT_POV); + + + currentDevice = NULL; + } + + for (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 DirectInput::readDevice(int which) +{ + u32 res = 0; + int i = theApp.joypadDefault; + if(which >= 0 && which <= 3) + i = which; + + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_A)])) + res |= 1; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_B)])) + res |= 2; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SELECT)])) + res |= 4; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_START)])) + res |= 8; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_RIGHT)])) + res |= 16; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_LEFT)])) + res |= 32; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_UP)])) + res |= 64; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_DOWN)])) + res |= 128; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_R)])) + res |= 256; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_L)])) + res |= 512; + + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_GS)])) + res |= 4096; + + if(theApp.autoFire) { + res &= (~theApp.autoFire); + if(theApp.autoFireToggle) + res |= theApp.autoFire; + theApp.autoFireToggle = !theApp.autoFireToggle; + } + + // 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(theApp.movieRecording) { + if(i == theApp.joypadDefault) { + if(res != theApp.movieLastJoypad) { + fwrite(&theApp.movieFrame, 1, sizeof(theApp.movieFrame), theApp.movieFile); + fwrite(&res, 1, sizeof(res), theApp.movieFile); + theApp.movieLastJoypad = res; + } + } + } + if(theApp.moviePlaying) { + if(theApp.movieFrame == theApp.moviePlayFrame) { + theApp.movieLastJoypad = theApp.movieNextJoypad; + theApp.movieReadNext(); + } + res = theApp.movieLastJoypad; + } + // we don't record speed up or screen capture buttons + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_SPEED)]) || theApp.speedupToggle) + res |= 1024; + if(checkKey(theApp.input->joypaddata[JOYPAD(i,KEY_BUTTON_CAPTURE)])) + res |= 2048; + + return res; +} + +CString DirectInput::getKeyName(LONG_PTR key) +{ + LONG_PTR d = (key >> 8); + LONG_PTR 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, (DWORD)key, DIPH_BYOFFSET ); + winBuffer = di.tszName; + } else if (d < numDevices) { + 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) { + LONG_PTR hat = (k >> 2) & 3; + pDevices[d].device->GetObjectInfo(&di, + (DWORD)DIJOFS_POV(hat), + DIPH_BYOFFSET); + char *dir = "up"; + LONG_PTR 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, + (DWORD)DIJOFS_BUTTON(k-128), + DIPH_BYOFFSET); + winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName); + } + } + else + { + // Joystick isn't plugged in. We can't decipher k, so just show its value. + winBuffer.Format("Joy %d (%d)", d, k); + } + + return winBuffer; +} + +void DirectInput::checkKeys() +{ + ::checkKeys(); +} + +void DirectInput::checkMotionKeys() +{ + if(checkKey(theApp.input->joypaddata[MOTION(KEY_LEFT)])) { + theApp.sensorX += 3; + if(theApp.sensorX > 2197) + theApp.sensorX = 2197; + if(theApp.sensorX < 2047) + theApp.sensorX = 2057; + } else if(checkKey(theApp.input->joypaddata[MOTION(KEY_RIGHT)])) { + 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(checkKey(theApp.input->joypaddata[MOTION(KEY_UP)])) { + theApp.sensorY += 3; + if(theApp.sensorY > 2197) + theApp.sensorY = 2197; + if(theApp.sensorY < 2047) + theApp.sensorY = 2057; + } else if(checkKey(theApp.input->joypaddata[MOTION(KEY_DOWN)])) { + 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; + } +} + +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 index 4c897be1..40a28f54 100644 --- a/src/win32/DirectSound.cpp +++ b/src/win32/DirectSound.cpp @@ -62,7 +62,7 @@ public: DirectSound::DirectSound() { CoInitialize( NULL ); - + pDirectSound = NULL; dsbPrimary = NULL; dsbSecondary = NULL; @@ -78,7 +78,7 @@ DirectSound::~DirectSound() theApp.aviRecorder = NULL; theApp.aviFrameNumber = 0; } - + if(theApp.soundRecording) { if(theApp.soundRecorder) { delete theApp.soundRecorder; @@ -86,17 +86,17 @@ DirectSound::~DirectSound() } theApp.soundRecording = false; } - + if(dsbNotify) { dsbNotify->Release(); dsbNotify = NULL; } - + if(dsbEvent) { CloseHandle(dsbEvent); dsbEvent = NULL; } - + if(pDirectSound) { if(dsbPrimary) { dsbPrimary->Release(); @@ -107,11 +107,11 @@ DirectSound::~DirectSound() dsbSecondary->Release(); dsbSecondary = NULL; } - + pDirectSound->Release(); pDirectSound = NULL; } - + CoUninitialize(); } @@ -206,7 +206,7 @@ bool DirectSound::init() if( !theApp.useOldSync ) { if( FAILED( hr = dsbSecondary->QueryInterface( IID_IDirectSoundNotify8, (LPVOID*)&dsbNotify ) ) ) { dsbEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); - DSBPOSITIONNOTIFY notify[10]; + DSBPOSITIONNOTIFY notify[10]; for( i = 0; i < 10; i++ ) { notify[i].dwOffset = i * soundBufferLen; notify[i].hEventNotify = dsbEvent; @@ -227,9 +227,9 @@ bool DirectSound::init() systemMessage( IDS_CANNOT_PLAY_PRIMARY, _T("Cannot Play primary %08x"), hr ); return false; } - + systemSoundOn = true; - + return true; } @@ -237,7 +237,7 @@ bool DirectSound::init() void DirectSound::pause() { if( dsbSecondary == NULL ) return; - + DWORD status; dsbSecondary->GetStatus( &status ); @@ -249,9 +249,9 @@ void DirectSound::pause() void DirectSound::reset() { if( dsbSecondary == NULL ) return; - + dsbSecondary->Stop(); - + dsbSecondary->SetCurrentPosition( 0 ); } @@ -259,7 +259,7 @@ void DirectSound::reset() void DirectSound::resume() { if( dsbSecondary == NULL ) return; - + dsbSecondary->Play( 0, 0, DSBPLAY_LOOPING ); } @@ -292,7 +292,7 @@ void DirectSound::write() } } } - + if( theApp.aviRecording ) { if( theApp.aviRecorder ) { @@ -305,18 +305,18 @@ void DirectSound::write() theApp.aviRecorder->AddSound( (const char *)soundFinalWave, soundBufferLen ); } } - - + + if( !speedup && synchronize && !theApp.throttle ) { hr = dsbSecondary->GetStatus(&status); if( status & DSBSTATUS_PLAYING ) { - if( !soundPaused ) { + if( !soundPaused ) { while( true ) { dsbSecondary->GetCurrentPosition(&play, NULL); int BufferLeft = ((soundNextPosition <= play) ? play - soundNextPosition : soundBufferTotalLen - soundNextPosition + play); - + if(BufferLeft > soundBufferLen) { if (BufferLeft > soundBufferTotalLen - (soundBufferLen * 3)) @@ -324,7 +324,7 @@ void DirectSound::write() break; } soundBufferLow = false; - + if(dsbEvent) { WaitForSingleObject(dsbEvent, 50); } @@ -334,7 +334,7 @@ void DirectSound::write() setsoundPaused(true); } } - + // Obtain memory address of write block. // This will be in two parts if the block wraps around. @@ -357,7 +357,7 @@ void DirectSound::write() &dwBytes2, 0 ); } - + soundNextPosition += soundBufferLen; soundNextPosition = soundNextPosition % soundBufferTotalLen; @@ -367,7 +367,7 @@ void DirectSound::write() if ( lpvPtr2 ) { CopyMemory( lpvPtr2, soundFinalWave + dwBytes1, dwBytes2 ); } - + // Release the data back to DirectSound. hr = dsbSecondary->Unlock( lpvPtr1, dwBytes1, lpvPtr2, dwBytes2 ); } else { diff --git a/src/win32/Directories.cpp b/src/win32/Directories.cpp index d4585228..4a1587c8 100644 --- a/src/win32/Directories.cpp +++ b/src/win32/Directories.cpp @@ -85,10 +85,10 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Directories message handlers -BOOL Directories::OnInitDialog() +BOOL Directories::OnInitDialog() { CDialog::OnInitDialog(); - + CString p = regQueryStringValue("romdir", NULL); if(!p.IsEmpty()) { int len = p.GetLength(); @@ -97,7 +97,7 @@ BOOL Directories::OnInitDialog() p = p.Left(len-1); GetDlgItem(IDC_ROM_PATH)->SetWindowText(p); } - + p = regQueryStringValue("gbromdir", NULL); if(!p.IsEmpty()) { int len = p.GetLength(); @@ -106,7 +106,7 @@ BOOL Directories::OnInitDialog() p = p.Left(len-1); GetDlgItem(IDC_GBROM_PATH)->SetWindowText(p); } - + p = regQueryStringValue("batteryDir", NULL); if(!p.IsEmpty()) GetDlgItem(IDC_BATTERY_PATH)->SetWindowText( p); @@ -116,14 +116,14 @@ BOOL Directories::OnInitDialog() 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() +void Directories::OnBatteryDir() { m_batteryPath.GetWindowText(initialFolderDir); CString p = browseForDir(winResLoadString(IDS_SELECT_BATTERY_DIR)); @@ -131,13 +131,13 @@ void Directories::OnBatteryDir() m_batteryPath.SetWindowText(p); } -void Directories::OnBatteryDirReset() +void Directories::OnBatteryDirReset() { regDeleteValue("batteryDir"); m_batteryPath.SetWindowText(""); } -void Directories::OnCaptureDir() +void Directories::OnCaptureDir() { m_capturePath.GetWindowText(initialFolderDir); CString p = browseForDir(winResLoadString(IDS_SELECT_CAPTURE_DIR)); @@ -145,13 +145,13 @@ void Directories::OnCaptureDir() m_capturePath.SetWindowText(p); } -void Directories::OnCaptureDirReset() +void Directories::OnCaptureDirReset() { regDeleteValue("captureDir"); - m_capturePath.SetWindowText(""); + m_capturePath.SetWindowText(""); } -void Directories::OnGbromDir() +void Directories::OnGbromDir() { m_gbromPath.GetWindowText(initialFolderDir); CString p = browseForDir(winResLoadString(IDS_SELECT_ROM_DIR)); @@ -159,13 +159,13 @@ void Directories::OnGbromDir() m_gbromPath.SetWindowText(p); } -void Directories::OnGbromDirReset() +void Directories::OnGbromDirReset() { regDeleteValue("gbromdir"); - m_gbromPath.SetWindowText(""); + m_gbromPath.SetWindowText(""); } -void Directories::OnRomDir() +void Directories::OnRomDir() { m_romPath.GetWindowText(initialFolderDir); CString p = browseForDir(winResLoadString(IDS_SELECT_ROM_DIR)); @@ -173,13 +173,13 @@ void Directories::OnRomDir() m_romPath.SetWindowText(p); } -void Directories::OnRomDirReset() +void Directories::OnRomDirReset() { regDeleteValue("romdir"); m_romPath.SetWindowText(""); } -void Directories::OnSaveDir() +void Directories::OnSaveDir() { m_savePath.GetWindowText(initialFolderDir); CString p = browseForDir(winResLoadString(IDS_SELECT_SAVE_DIR)); @@ -187,18 +187,18 @@ void Directories::OnSaveDir() m_savePath.SetWindowText(p); } -void Directories::OnSaveDirReset() +void Directories::OnSaveDirReset() { regDeleteValue("saveDir"); - m_savePath.SetWindowText(""); + m_savePath.SetWindowText(""); } -void Directories::OnCancel() +void Directories::OnCancel() { EndDialog(FALSE); } -void Directories::OnOK() +void Directories::OnOK() { char baseDir[MAX_PATH+1]; char temp[MAX_PATH+1]; @@ -223,7 +223,7 @@ void Directories::OnOK() m_gbromPath.GetWindowText(buffer); if( !buffer.IsEmpty() ) - regSetStringValue( "gbromdir", buffer ); + regSetStringValue( "gbromdir", buffer ); if( buffer[0] == '.' ) { strcpy( temp, baseDir ); strcat( temp, "\\" ); @@ -277,9 +277,9 @@ 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)); @@ -289,9 +289,9 @@ CString Directories::browseForDir(CString title) bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lpfn = browseCallbackProc; bi.lParam = (LPARAM)(LPCTSTR)initialFolderDir; - + pidl = SHBrowseForFolder(&bi); - + if(pidl) { if(SHGetPathFromIDList(pidl, buffer)) { res = buffer; diff --git a/src/win32/Disassemble.cpp b/src/win32/Disassemble.cpp index 3c4eaaa0..6023a1c7 100644 --- a/src/win32/Disassemble.cpp +++ b/src/win32/Disassemble.cpp @@ -99,37 +99,37 @@ BEGIN_MESSAGE_MAP(Disassemble, CDialog) ///////////////////////////////////////////////////////////////////////////// // Disassemble message handlers -void Disassemble::OnAutoUpdate() +void Disassemble::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void Disassemble::OnAutomatic() +void Disassemble::OnAutomatic() { mode = 0; refresh(); } -void Disassemble::OnArm() +void Disassemble::OnArm() { mode = 1; address&=0xfffffffC; refresh(); } -void Disassemble::OnClose() +void Disassemble::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void Disassemble::OnGo() +void Disassemble::OnGo() { CString buffer; m_address.GetWindowText(buffer); @@ -141,7 +141,7 @@ void Disassemble::OnGo() refresh(); } -void Disassemble::OnGopc() +void Disassemble::OnGopc() { if(rom != NULL) { @@ -154,7 +154,7 @@ void Disassemble::OnGopc() } } -void Disassemble::OnNext() +void Disassemble::OnNext() { if(rom != NULL) { @@ -176,22 +176,22 @@ void Disassemble::OnNext() } } -void Disassemble::OnRefresh() +void Disassemble::OnRefresh() { refresh(); } -void Disassemble::OnThumb() +void Disassemble::OnThumb() { mode = 2; address&=0xfffffffe; refresh(); } -BOOL Disassemble::OnInitDialog() +BOOL Disassemble::OnInitDialog() { CDialog::OnInitDialog(); - + DIALOG_SIZER_START( sz ) DIALOG_SIZER_ENTRY( IDC_DISASSEMBLE, DS_SizeY) DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) @@ -216,24 +216,24 @@ BOOL Disassemble::OnInitDialog() 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) +void Disassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch(nSBCode) { case SB_LINEDOWN: @@ -282,7 +282,7 @@ void Disassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) break; } refresh(); - + CDialog::OnVScroll(nSBCode, nPos, pScrollBar); } @@ -290,16 +290,16 @@ 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); @@ -308,7 +308,7 @@ void Disassemble::refresh() m_list.ResetContent(); if(!emulating && theApp.cartridgeType == 0) return; - + char buffer[80]; u32 addr = address; int i; @@ -328,7 +328,7 @@ void Disassemble::refresh() m_list.SetCurSel(sel); CPUUpdateCPSR(); - + for(i = 0; i < 17; i++) { sprintf(buffer, "%08x", reg[i].I); GetDlgItem(IDC_R0+i)->SetWindowText(buffer); @@ -355,7 +355,7 @@ void Disassemble::update() refresh(); } -void Disassemble::PostNcDestroy() +void Disassemble::PostNcDestroy() { delete this; } diff --git a/src/win32/ExportGSASnapshot.cpp b/src/win32/ExportGSASnapshot.cpp index c6143d40..fea7f00f 100644 --- a/src/win32/ExportGSASnapshot.cpp +++ b/src/win32/ExportGSASnapshot.cpp @@ -48,7 +48,7 @@ ExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pPar m_filename = filename; char date[100]; char time[100]; - + GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, @@ -89,21 +89,21 @@ BEGIN_MESSAGE_MAP(ExportGSASnapshot, CDialog) ///////////////////////////////////////////////////////////////////////////// // ExportGSASnapshot message handlers -BOOL ExportGSASnapshot::OnInitDialog() +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() +void ExportGSASnapshot::OnCancel() { EndDialog(FALSE); } -void ExportGSASnapshot::OnOk() +void ExportGSASnapshot::OnOk() { UpdateData(TRUE); @@ -112,6 +112,6 @@ void ExportGSASnapshot::OnOk() if(!result) systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", m_filename); - + EndDialog(TRUE); } diff --git a/src/win32/FileDlg.cpp b/src/win32/FileDlg.cpp index 14e30c9a..8091d93d 100644 --- a/src/win32/FileDlg.cpp +++ b/src/win32/FileDlg.cpp @@ -64,7 +64,7 @@ static UINT_PTR CALLBACK HookFuncOldStyle(HWND hwnd, if(msg == WM_COMMAND) { if(HIWORD(wParam) == CBN_SELCHANGE) { if(LOWORD(wParam) == cmb1) { - // call method with combobox handle to keep + // call method with combobox handle to keep // behaviour there instance->OnTypeChange((HWND)lParam); return 1; @@ -83,7 +83,7 @@ static UINT_PTR CALLBACK HookFuncOldStyle(HWND hwnd, ////////////////////////////////////////////////////////////////////// FileDlg::FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, - int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, + int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, LPCTSTR title, bool save) { OSVERSIONINFO info; @@ -91,7 +91,7 @@ FileDlg::FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, 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 @@ -114,9 +114,9 @@ FileDlg::FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, m_ofn.Flags = OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_ENABLEHOOK; m_ofn.Flags |= OFN_EXPLORER; m_filter = filter; - + char *p = m_filter.GetBuffer(0); - + while ((p = strchr(p, '|')) != NULL) *p++ = 0; m_ofn.lpstrFilter = m_filter; @@ -150,7 +150,7 @@ void FileDlg::OnTypeChange(HWND hwnd) if(fileNameControl == NULL) return; - + CString filename; GetWindowText(fileNameControl, filename.GetBuffer(MAX_PATH), MAX_PATH); filename.ReleaseBuffer(); @@ -162,9 +162,9 @@ void FileDlg::OnTypeChange(HWND hwnd) LRESULT sel = ::SendMessage(typeControl, CB_GETCURSEL, 0, 0); ASSERT(sel != -1); - + LPCTSTR typeName = extensions[sel]; - + if(filename.GetLength() == 0) { if(strlen(typeName) != 0) filename.Format("*%s", typeName); diff --git a/src/win32/FileDlg.h b/src/win32/FileDlg.h index 2712f666..38667e18 100644 --- a/src/win32/FileDlg.h +++ b/src/win32/FileDlg.h @@ -50,10 +50,10 @@ class FileDlg virtual int getFilterIndex(); virtual void OnTypeChange(HWND hwnd); FileDlg(CWnd *parent, LPCTSTR file, LPCTSTR filter, - int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, + int filterIndex, LPCTSTR ext, LPCTSTR *exts, LPCTSTR initialDir, LPCTSTR title, bool save); virtual ~FileDlg(); - + protected: bool isSave; LPCTSTR *extensions; diff --git a/src/win32/GBACheats.cpp b/src/win32/GBACheats.cpp index d7ee5866..ae9ce33b 100644 --- a/src/win32/GBACheats.cpp +++ b/src/win32/GBACheats.cpp @@ -95,12 +95,12 @@ BEGIN_MESSAGE_MAP(GBACheatSearch, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBACheatSearch message handlers -void GBACheatSearch::OnOk() +void GBACheatSearch::OnOk() { EndDialog(TRUE); } -void GBACheatSearch::OnStart() +void GBACheatSearch::OnStart() { if(cheatSearchData.count == 0) { CheatSearchBlock *block = &cheatSearchData.blocks[0]; @@ -109,14 +109,14 @@ void GBACheatSearch::OnStart() 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; } @@ -124,7 +124,7 @@ void GBACheatSearch::OnStart() GetDlgItem(IDC_SEARCH)->EnableWindow(TRUE); } -void GBACheatSearch::OnSearch() +void GBACheatSearch::OnSearch() { CString buffer; @@ -156,17 +156,17 @@ void GBACheatSearch::OnSearch() numberType == 0, value); } - + addChanges(true); if(updateValues) cheatSearchUpdateValues(&cheatSearchData); } -void GBACheatSearch::OnAddCheat() +void GBACheatSearch::OnAddCheat() { int mark = m_list.GetSelectionMark(); - + if(mark != -1) { LVITEM item; memset(&item,0, sizeof(item)); @@ -179,7 +179,7 @@ void GBACheatSearch::OnAddCheat() } } -void GBACheatSearch::OnUpdate() +void GBACheatSearch::OnUpdate() { if(GetDlgItem(IDC_UPDATE)->SendMessage(BM_GETCHECK, 0, @@ -190,13 +190,13 @@ void GBACheatSearch::OnUpdate() regSetDwordValue("cheatsUpdate", updateValues); } -void GBACheatSearch::OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult) +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); @@ -213,16 +213,16 @@ void GBACheatSearch::OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult) } -void GBACheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +void GBACheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) { GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(m_list.GetSelectionMark() != -1); *pResult = TRUE; } -BOOL GBACheatSearch::OnInitDialog() +BOOL GBACheatSearch::OnInitDialog() { CDialog::OnInitDialog(); - + CString temp = winResLoadString(IDS_ADDRESS); m_list.InsertColumn(0, temp, LVCFMT_CENTER, 125, 0); @@ -232,17 +232,17 @@ BOOL GBACheatSearch::OnInitDialog() 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; @@ -250,15 +250,15 @@ BOOL GBACheatSearch::OnInitDialog() 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; @@ -271,7 +271,7 @@ BOOL GBACheatSearch::OnInitDialog() if(cheatSearchData.count) { addChanges(false); } - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -279,7 +279,7 @@ BOOL GBACheatSearch::OnInitDialog() void GBACheatSearch::addChanges(bool showMsgs) { int count = cheatSearchGetCount(&cheatSearchData, sizeType); - + m_list.DeleteAllItems(); if(count > 1000) { @@ -296,13 +296,13 @@ void GBACheatSearch::addChanges(bool showMsgs) "Search produced no results."); return; } - - m_list.SetItemCount(count); + + m_list.SetItemCount(count); if(data) free(data); - + data = (WinCheatsData *)calloc(count,sizeof(WinCheatsData)); - + int inc = 1; switch(sizeType) { case 1: @@ -312,12 +312,12 @@ void GBACheatSearch::addChanges(bool showMsgs) 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++, @@ -334,7 +334,7 @@ void GBACheatSearch::addChanges(bool showMsgs) } 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++, @@ -364,7 +364,7 @@ void GBACheatSearch::addChanges(bool showMsgs) 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) @@ -375,24 +375,24 @@ void GBACheatSearch::addChange(int index, u32 address, u32 oldValue, u32 newValu case 0: sprintf(data[index].oldValue, "%d", oldValue); sprintf(data[index].newValue, "%d", newValue); - break; + break; case 1: sprintf(data[index].oldValue, "%u", oldValue); sprintf(data[index].newValue, "%u", newValue); - break; + break; case 2: switch(sizeType) { case 0: sprintf(data[index].oldValue, "%02x", oldValue); - sprintf(data[index].newValue, "%02x", newValue); + sprintf(data[index].newValue, "%02x", newValue); break; case 1: sprintf(data[index].oldValue, "%04x", oldValue); - sprintf(data[index].newValue, "%04x", newValue); + sprintf(data[index].newValue, "%04x", newValue); break; case 2: sprintf(data[index].oldValue, "%08x", oldValue); - sprintf(data[index].newValue, "%08x", newValue); + sprintf(data[index].newValue, "%08x", newValue); break; } } @@ -409,7 +409,7 @@ void GBACheatSearch::OnValueType(UINT id) case IDC_SPECIFIC_VALUE: valueType = 1; m_value.EnableWindow(TRUE); - regSetDwordValue("cheatsValueType", 1); + regSetDwordValue("cheatsValueType", 1); break; } } @@ -537,7 +537,7 @@ BEGIN_MESSAGE_MAP(AddCheat, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddCheat message handlers -void AddCheat::OnOk() +void AddCheat::OnOk() { // add cheat if(addCheat()) { @@ -545,32 +545,32 @@ void AddCheat::OnOk() } } -void AddCheat::OnCancel() +void AddCheat::OnCancel() { EndDialog(FALSE); } -BOOL AddCheat::OnInitDialog() +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); @@ -580,11 +580,11 @@ BOOL AddCheat::OnInitDialog() GetDlgItem(IDC_SIZE_32)->EnableWindow(FALSE); GetDlgItem(IDC_HEXADECIMAL)->EnableWindow(FALSE); GetDlgItem(IDC_UNSIGNED)->EnableWindow(FALSE); - GetDlgItem(IDC_SIGNED)->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 } @@ -649,16 +649,16 @@ bool AddCheat::addCheat() systemMessage(IDS_MISALIGNED_WORD, "Misaligned word address: %08x", address); return false; - } + } } u32 value; m_value.GetWindowText(buffer); - + if(buffer.IsEmpty()) { systemMessage(IDS_VALUE_CANNOT_BE_EMPTY, "Value cannot be empty"); return false; } - + switch(numberType) { case 0: sscanf(buffer, "%d", &value); @@ -683,7 +683,7 @@ bool AddCheat::addCheat() code.Format("%08x:%08x", address, value); break; } - + cheatsAdd(code, buffer, address ,address, value,-1, sizeType); return true; } @@ -729,39 +729,39 @@ BEGIN_MESSAGE_MAP(GBACheatList, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBACheatList message handlers -void GBACheatList::OnAddCheat() +void GBACheatList::OnAddCheat() { AddCheat dlg(0); dlg.DoModal(); refresh(); } -void GBACheatList::OnAddCode() +void GBACheatList::OnAddCode() { AddCheatCode dlg; dlg.DoModal(); refresh(); } -void GBACheatList::OnAddCodebreaker() +void GBACheatList::OnAddCodebreaker() { AddCBACode dlg; dlg.DoModal(); refresh(); } -void GBACheatList::OnAddGameshark() +void GBACheatList::OnAddGameshark() { AddGSACode dlg; dlg.DoModal(); refresh(); } -void GBACheatList::OnEnable() +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++) { @@ -782,11 +782,11 @@ void GBACheatList::OnEnable() } } -void GBACheatList::OnRemove() +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; @@ -801,28 +801,28 @@ void GBACheatList::OnRemove() } } refresh(); - } + } } -void GBACheatList::OnRemoveAll() +void GBACheatList::OnRemoveAll() { cheatsDeleteAll(restoreValues); refresh(); } -void GBACheatList::OnRestore() +void GBACheatList::OnRestore() { restoreValues = !restoreValues; regSetDwordValue("cheatsRestore", restoreValues); } -void GBACheatList::OnOk() +void GBACheatList::OnOk() { EndDialog(TRUE); } -void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) { if(m_list.GetSelectionMark() != -1) { GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); @@ -831,7 +831,7 @@ void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); } - + if(!duringRefresh) { LPNMLISTVIEW l = (LPNMLISTVIEW)pNMHDR; if(l->uChanged & LVIF_STATE) { @@ -845,36 +845,36 @@ void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) } } } - + *pResult = 0; } -BOOL GBACheatList::OnInitDialog() +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); - + 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 } @@ -883,9 +883,9 @@ void GBACheatList::refresh() { duringRefresh = true; m_list.DeleteAllItems(); - + CString buffer; - + for(int i = 0; i < cheatsNumber; i++) { LVITEM item; @@ -901,8 +901,8 @@ void GBACheatList::refresh() m_list.SetCheck(i, (cheatsList[i].enabled) ? TRUE : FALSE); m_list.SetItemText(i, 1, cheatsList[i].desc); - - buffer = (cheatsList[i].enabled) ? 'E' : 'D'; + + buffer = (cheatsList[i].enabled) ? 'E' : 'D'; m_list.SetItemText(i, 2, buffer); } duringRefresh = false; @@ -940,17 +940,17 @@ BEGIN_MESSAGE_MAP(AddGSACode, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddGSACode message handlers -void AddGSACode::OnOk() +void AddGSACode::OnOk() { CString desc; CString buffer; CString part1; CString code; - CString token; + CString token; m_code.GetWindowText(buffer); m_desc.GetWindowText(desc); - + StringTokenizer st(buffer, " \t\n\r"); part1.Empty(); const char *t = st.next(); @@ -984,21 +984,21 @@ void AddGSACode::OnOk() EndDialog(TRUE); } -void AddGSACode::OnCancel() +void AddGSACode::OnCancel() { EndDialog(FALSE); } -BOOL AddGSACode::OnInitDialog() +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 } @@ -1036,7 +1036,7 @@ BEGIN_MESSAGE_MAP(AddCBACode, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddCBACode message handlers -void AddCBACode::OnOk() +void AddCBACode::OnOk() { CString desc; CString buffer; @@ -1046,7 +1046,7 @@ void AddCBACode::OnOk() m_code.GetWindowText(buffer); m_desc.GetWindowText(desc); - + StringTokenizer st(buffer, " \t\n\r"); part1.Empty(); const char *t = st.next(); @@ -1080,21 +1080,21 @@ void AddCBACode::OnOk() EndDialog(TRUE); } -void AddCBACode::OnCancel() +void AddCBACode::OnCancel() { EndDialog(FALSE); } -BOOL AddCBACode::OnInitDialog() +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 } @@ -1132,7 +1132,7 @@ BEGIN_MESSAGE_MAP(AddCheatCode, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddCheatCode message handlers -void AddCheatCode::OnOk() +void AddCheatCode::OnOk() { CString desc; CString buffer; @@ -1140,7 +1140,7 @@ void AddCheatCode::OnOk() m_code.GetWindowText(buffer); m_desc.GetWindowText(desc); - + StringTokenizer st(buffer, " \t\n\r"); const char *t = st.next(); while(t) { @@ -1152,21 +1152,21 @@ void AddCheatCode::OnOk() EndDialog(TRUE); } -void AddCheatCode::OnCancel() +void AddCheatCode::OnCancel() { EndDialog(FALSE); } -BOOL AddCheatCode::OnInitDialog() +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 } diff --git a/src/win32/GBCheatsDlg.cpp b/src/win32/GBCheatsDlg.cpp index 6362eeaa..621594cd 100644 --- a/src/win32/GBCheatsDlg.cpp +++ b/src/win32/GBCheatsDlg.cpp @@ -105,7 +105,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // GBCheatSearch message handlers -void GBCheatSearch::OnOk() +void GBCheatSearch::OnOk() { if(data) free(data); @@ -113,10 +113,10 @@ void GBCheatSearch::OnOk() EndDialog(TRUE); } -void GBCheatSearch::OnAddCheat() +void GBCheatSearch::OnAddCheat() { int mark = m_list.GetSelectionMark(); - + if(mark != -1) { LVITEM item; memset(&item,0, sizeof(item)); @@ -129,7 +129,7 @@ void GBCheatSearch::OnAddCheat() } } -void GBCheatSearch::OnSearch() +void GBCheatSearch::OnSearch() { CString buffer; if(valueType == 0) @@ -160,14 +160,14 @@ void GBCheatSearch::OnSearch() numberType == 0, value); } - + addChanges(true); if(updateValues) cheatSearchUpdateValues(&cheatSearchData); } -void GBCheatSearch::OnStart() +void GBCheatSearch::OnStart() { if(cheatSearchData.count == 0) { int i = 0; @@ -199,14 +199,14 @@ void GBCheatSearch::OnStart() block->saved = (u8*)malloc(0x8000); block->size = 0x8000; block->bits = (u8 *)malloc(0x8000 >> 3); - i++; + i++; } else { block->offset = 0xc000; block->data = &gbMemory[0xc000]; block->saved = (u8*)malloc(0x2000); block->size = 0x2000; block->bits = (u8 *)malloc(0x2000 >> 3); - i++; + i++; } cheatSearchData.count = i; } @@ -215,7 +215,7 @@ void GBCheatSearch::OnStart() GetDlgItem(IDC_SEARCH)->EnableWindow(TRUE); } -void GBCheatSearch::OnUpdate() +void GBCheatSearch::OnUpdate() { if(GetDlgItem(IDC_UPDATE)->SendMessage(BM_GETCHECK, 0, @@ -226,7 +226,7 @@ void GBCheatSearch::OnUpdate() regSetDwordValue("gbCheatsUpdate", updateValues); } -BOOL GBCheatSearch::OnInitDialog() +BOOL GBCheatSearch::OnInitDialog() { CDialog::OnInitDialog(); @@ -239,12 +239,12 @@ BOOL GBCheatSearch::OnInitDialog() 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); @@ -253,46 +253,46 @@ BOOL GBCheatSearch::OnInitDialog() 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(cheatSearchData.count) { addChanges(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) +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); @@ -308,7 +308,7 @@ void GBCheatSearch::OnGetdispinfoCheatList(NMHDR* pNMHDR, LRESULT* pResult) *pResult = TRUE; } -void GBCheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +void GBCheatSearch::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) { GetDlgItem(IDC_ADD_CHEAT)->EnableWindow(m_list.GetSelectionMark() != -1); } @@ -340,24 +340,24 @@ void GBCheatSearch::addChange(int index, int bank, u16 address, int offset, u32 case 0: sprintf(data[index].oldValue, "%d", oldValue); sprintf(data[index].newValue, "%d", newValue); - break; + break; case 1: sprintf(data[index].oldValue, "%u", oldValue); sprintf(data[index].newValue, "%u", newValue); - break; + break; case 2: switch(sizeType) { case 0: sprintf(data[index].oldValue, "%02x", oldValue); - sprintf(data[index].newValue, "%02x", newValue); + sprintf(data[index].newValue, "%02x", newValue); break; case 1: sprintf(data[index].oldValue, "%04x", oldValue); - sprintf(data[index].newValue, "%04x", newValue); + sprintf(data[index].newValue, "%04x", newValue); break; case 2: sprintf(data[index].oldValue, "%08x", oldValue); - sprintf(data[index].newValue, "%08x", newValue); + sprintf(data[index].newValue, "%08x", newValue); break; } } @@ -366,7 +366,7 @@ void GBCheatSearch::addChange(int index, int bank, u16 address, int offset, u32 void GBCheatSearch::addChanges(bool showMsg) { int count = cheatSearchGetCount(&cheatSearchData, sizeType); - + m_list.DeleteAllItems(); if(count > 1000) { @@ -375,7 +375,7 @@ void GBCheatSearch::addChanges(bool showMsg) "Search produced %d results. Please refine better", count); return; - } + } if(count == 0) { if(showMsg) @@ -383,13 +383,13 @@ void GBCheatSearch::addChanges(bool showMsg) "Search produced no results"); return; } - - m_list.SetItemCount(count); + + m_list.SetItemCount(count); if(data) free(data); data = (WinGbCheatsData *)calloc(count, sizeof(WinGbCheatsData)); - + int inc = 1; switch(sizeType) { case 1: @@ -399,12 +399,12 @@ void GBCheatSearch::addChanges(bool showMsg) 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++, @@ -423,7 +423,7 @@ void GBCheatSearch::addChanges(bool showMsg) } 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++, @@ -456,7 +456,7 @@ void GBCheatSearch::addChanges(bool showMsg) m_list.SetItemText(i, 1, LPSTR_TEXTCALLBACK); m_list.SetItemText(i, 2, LPSTR_TEXTCALLBACK); - } + } } void GBCheatSearch::OnValueType(UINT id) @@ -470,7 +470,7 @@ void GBCheatSearch::OnValueType(UINT id) case IDC_SPECIFIC_VALUE: valueType = 1; m_value.EnableWindow(TRUE); - regSetDwordValue("gbCheatsValueType", 1); + regSetDwordValue("gbCheatsValueType", 1); break; } } @@ -598,12 +598,12 @@ BEGIN_MESSAGE_MAP(AddGBCheat, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddGBCheat message handlers -void AddGBCheat::OnCancel() +void AddGBCheat::OnCancel() { EndDialog(FALSE); } -void AddGBCheat::OnOk() +void AddGBCheat::OnOk() { // add cheat if(addCheat()) { @@ -618,12 +618,12 @@ bool AddGBCheat::addCheat() u32 value; m_value.GetWindowText(buffer); - + if(buffer.IsEmpty()) { systemMessage(IDS_VALUE_CANNOT_BE_EMPTY, "Value cannot be empty"); return false; } - + switch(numberType) { case 0: sscanf(buffer, "%d", &value); @@ -644,7 +644,7 @@ bool AddGBCheat::addCheat() bank += 0x90; else bank = 0x01; - + switch(sizeType) { case 0: code.Format("%02X%02X%02X%02X", bank, value, address&0xFF, address>>8); @@ -657,7 +657,7 @@ bool AddGBCheat::addCheat() address++; code.Format("%02X%02X%02X%02X", bank, value>>8, address&0xFF, address>>8); - gbAddGsCheat(code, buffer); + gbAddGsCheat(code, buffer); break; case 2: code.Format("%02X%02X%02X%02X", bank, value&0xFF, address&0xFF, @@ -674,45 +674,45 @@ bool AddGBCheat::addCheat() address++; code.Format("%02X%02X%02X%02X", bank, value>>24, address&0xFF, address>>8); - gbAddGsCheat(code, buffer); + gbAddGsCheat(code, buffer); break; } - + return true; } -BOOL AddGBCheat::OnInitDialog() +BOOL AddGBCheat::OnInitDialog() { CDialog::OnInitDialog(); - + CString buffer; buffer.Format("%02x:%08x", (address>>16), address&0xFFFF); m_address.SetWindowText(buffer); m_address.EnableWindow(FALSE); ::SetWindowLongPtr( m_address.GetSafeHwnd(), GWLP_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); + 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 } @@ -791,12 +791,12 @@ BEGIN_MESSAGE_MAP(GBCheatList, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBCheatList message handlers -void GBCheatList::OnOk() +void GBCheatList::OnOk() { EndDialog(TRUE); } -void GBCheatList::OnAddGgCheat() +void GBCheatList::OnAddGgCheat() { CString temp = winResLoadString(IDS_ADD_GG_CODE); AddGBCode dlg(winGbCheatAddVerifyGg, 11, temp); @@ -804,7 +804,7 @@ void GBCheatList::OnAddGgCheat() refresh(); } -void GBCheatList::OnAddGsCheat() +void GBCheatList::OnAddGsCheat() { CString temp = winResLoadString(IDS_ADD_GS_CODE); @@ -813,10 +813,10 @@ void GBCheatList::OnAddGsCheat() refresh(); } -void GBCheatList::OnEnable() +void GBCheatList::OnEnable() { int mark = m_list.GetSelectionMark(); - + if(mark != -1) { LVITEM item; memset(&item,0, sizeof(item)); @@ -828,14 +828,14 @@ void GBCheatList::OnEnable() else gbCheatEnable((int)item.lParam); refresh(); - } + } } } -void GBCheatList::OnRemove() +void GBCheatList::OnRemove() { int mark = m_list.GetSelectionMark(); - + if(mark != -1) { LVITEM item; memset(&item,0, sizeof(item)); @@ -844,17 +844,17 @@ void GBCheatList::OnRemove() if(m_list.GetItem(&item)) { gbCheatRemove((int)item.lParam); refresh(); - } + } } } -void GBCheatList::OnRemoveAll() +void GBCheatList::OnRemoveAll() { gbCheatRemoveAll(); refresh(); } -void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) +void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) { if(m_list.GetSelectionMark() != -1) { GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); @@ -863,7 +863,7 @@ void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) GetDlgItem(IDC_REMOVE)->EnableWindow(FALSE); GetDlgItem(IDC_ENABLE)->EnableWindow(FALSE); } - + if(!duringRefresh) { LPNMLISTVIEW l = (LPNMLISTVIEW)pNMHDR; if(l->uChanged & LVIF_STATE) { @@ -876,10 +876,10 @@ void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult) refresh(); } } - } + } } -BOOL GBCheatList::OnInitDialog() +BOOL GBCheatList::OnInitDialog() { CDialog::OnInitDialog(); @@ -889,18 +889,18 @@ BOOL GBCheatList::OnInitDialog() 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 } @@ -908,14 +908,14 @@ BOOL GBCheatList::OnInitDialog() 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; @@ -926,10 +926,10 @@ void GBCheatList::refresh() 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[0] = (gbCheatList[i].enabled) ? 'E' : 'D'; buffer[1] = 0; m_list.SetItemText(i, 2, buffer); } @@ -972,13 +972,13 @@ BEGIN_MESSAGE_MAP(AddGBCode, CDialog) ///////////////////////////////////////////////////////////////////////////// // AddGBCode message handlers -void AddGBCode::OnOk() +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) { @@ -988,20 +988,20 @@ void AddGBCode::OnOk() EndDialog(TRUE); } -void AddGBCode::OnCancel() +void AddGBCode::OnCancel() { EndDialog(FALSE); } -BOOL AddGBCode::OnInitDialog() +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 index 68b9f71e..6e754d40 100644 --- a/src/win32/GBCheatsDlg.h +++ b/src/win32/GBCheatsDlg.h @@ -30,7 +30,7 @@ // GBCheatSearch dialog struct WinGbCheatsData { - int bank; + int bank; u16 addr; char address[9]; char oldValue[12]; diff --git a/src/win32/GBColorDlg.cpp b/src/win32/GBColorDlg.cpp index 6096e9d8..9d74ab5e 100644 --- a/src/win32/GBColorDlg.cpp +++ b/src/win32/GBColorDlg.cpp @@ -38,25 +38,25 @@ static u16 defaultPalettes[][24] = { 0x6200, 0x7E10, 0x7C10, 0x5000, 0x6200, 0x7E10, 0x7C10, 0x5000, }, { - 0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008, + 0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008, }, { - 0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200, + 0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200, }, { - 0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F, + 0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F, }, { - 0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010, + 0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010, }, { - 0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010, + 0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010, }, { - 0x1B8E, 0x02C0, 0x0DA0, 0x1140, 0x1B8E, 0x02C0, 0x0DA0, 0x1140, + 0x1B8E, 0x02C0, 0x0DA0, 0x1140, 0x1B8E, 0x02C0, 0x0DA0, 0x1140, }, { - 0x7BDE, /*0x23F0*/ 0x5778, /*0x5DC0*/ 0x5640, 0x0000, 0x7BDE, /*0x3678*/ 0x529C, /*0x0980*/ 0x2990, 0x0000, + 0x7BDE, /*0x23F0*/ 0x5778, /*0x5DC0*/ 0x5640, 0x0000, 0x7BDE, /*0x3678*/ 0x529C, /*0x0980*/ 0x2990, 0x0000, } }; @@ -101,19 +101,19 @@ BEGIN_MESSAGE_MAP(GBColorDlg, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBColorDlg message handlers -void GBColorDlg::OnDefault() +void GBColorDlg::OnDefault() { - setWhich(0); + setWhich(0); } -void GBColorDlg::OnReset() +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); @@ -121,30 +121,30 @@ void GBColorDlg::OnReset() setWhich(which); } -void GBColorDlg::OnUser1() +void GBColorDlg::OnUser1() { - setWhich(1); + setWhich(1); } -void GBColorDlg::OnUser2() +void GBColorDlg::OnUser2() { - setWhich(2); + setWhich(2); } -void GBColorDlg::OnCancel() +void GBColorDlg::OnCancel() { EndDialog(FALSE); } -void GBColorDlg::OnOk() +void GBColorDlg::OnOk() { EndDialog(TRUE); } -BOOL GBColorDlg::OnInitDialog() +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); @@ -177,18 +177,18 @@ BOOL GBColorDlg::OnInitDialog() 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, @@ -199,7 +199,7 @@ BOOL GBColorDlg::OnInitDialog() setWhich(which); CenterWindow(); - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -221,7 +221,7 @@ u16 * GBColorDlg::getColors() void GBColorDlg::OnColorClicked(UINT id) { id -= IDC_COLOR_BG0; - + u16 color = colors[which*8+id]; COLORREF colorInit = @@ -233,11 +233,11 @@ void GBColorDlg::OnColorClicked(UINT id) 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() @@ -246,7 +246,7 @@ int GBColorDlg::getWhich() } -void GBColorDlg::OnSelchangePredefined() +void GBColorDlg::OnSelchangePredefined() { int sel = m_predefined.GetCurSel(); diff --git a/src/win32/GBDisassemble.cpp b/src/win32/GBDisassemble.cpp index 4a00d827..b32a0ae7 100644 --- a/src/win32/GBDisassemble.cpp +++ b/src/win32/GBDisassemble.cpp @@ -92,19 +92,19 @@ BEGIN_MESSAGE_MAP(GBDisassemble, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBDisassemble message handlers -void GBDisassemble::OnClose() +void GBDisassemble::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void GBDisassemble::OnRefresh() +void GBDisassemble::OnRefresh() { refresh(); } -void GBDisassemble::OnNext() +void GBDisassemble::OnNext() { gbEmulate(1); if(PC.W < address || PC.W >= lastAddress) @@ -112,7 +112,7 @@ void GBDisassemble::OnNext() refresh(); } -void GBDisassemble::OnGo() +void GBDisassemble::OnGo() { CString buffer; @@ -121,27 +121,27 @@ void GBDisassemble::OnGo() refresh(); } -void GBDisassemble::OnGopc() +void GBDisassemble::OnGopc() { address = PC.W; refresh(); } -void GBDisassemble::OnAutoUpdate() +void GBDisassemble::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -BOOL GBDisassemble::OnInitDialog() +BOOL GBDisassemble::OnInitDialog() { CDialog::OnInitDialog(); - + DIALOG_SIZER_START( sz ) DIALOG_SIZER_ENTRY( IDC_DISASSEMBLE, DS_SizeY) DIALOG_SIZER_ENTRY( IDC_REFRESH, DS_MoveY) @@ -168,21 +168,21 @@ BOOL GBDisassemble::OnInitDialog() 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) +void GBDisassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { char buffer[80]; - + switch(nSBCode) { case SB_LINEDOWN: address += gbDis(buffer, address); @@ -198,7 +198,7 @@ void GBDisassemble::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) break; } refresh(); - + CDialog::OnVScroll(nSBCode, nPos, pScrollBar); } @@ -206,7 +206,7 @@ void GBDisassemble::refresh() { if(gbRom == NULL) return; - + int h = m_list.GetItemHeight(0); RECT r; m_list.GetClientRect(&r); @@ -215,7 +215,7 @@ void GBDisassemble::refresh() m_list.ResetContent(); if(!emulating || theApp.cartridgeType != 1) return; - + char buffer[80]; u16 addr = address; int i; @@ -233,17 +233,17 @@ void GBDisassemble::refresh() sprintf(buffer, "%04x", AF.W); GetDlgItem(IDC_R0)->SetWindowText(buffer); sprintf(buffer, "%04x", BC.W); - GetDlgItem(IDC_R1)->SetWindowText(buffer); + GetDlgItem(IDC_R1)->SetWindowText(buffer); sprintf(buffer, "%04x", DE.W); - GetDlgItem(IDC_R2)->SetWindowText(buffer); + GetDlgItem(IDC_R2)->SetWindowText(buffer); sprintf(buffer, "%04x", HL.W); - GetDlgItem(IDC_R3)->SetWindowText(buffer); + GetDlgItem(IDC_R3)->SetWindowText(buffer); sprintf(buffer, "%04x", SP.W); - GetDlgItem(IDC_R4)->SetWindowText(buffer); + GetDlgItem(IDC_R4)->SetWindowText(buffer); sprintf(buffer, "%04x", PC.W); - GetDlgItem(IDC_R5)->SetWindowText(buffer); + GetDlgItem(IDC_R5)->SetWindowText(buffer); sprintf(buffer, "%04x", IFF); - GetDlgItem(IDC_R6)->SetWindowText(buffer); + GetDlgItem(IDC_R6)->SetWindowText(buffer); sprintf(buffer, "%04x", register_LY); GetDlgItem(IDC_LY)->SetWindowText(buffer); @@ -260,7 +260,7 @@ void GBDisassemble::update() refresh(); } -void GBDisassemble::PostNcDestroy() +void GBDisassemble::PostNcDestroy() { delete this; } diff --git a/src/win32/GBMapView.cpp b/src/win32/GBMapView.cpp index 47ee202e..59dcbbfc 100644 --- a/src/win32/GBMapView.cpp +++ b/src/win32/GBMapView.cpp @@ -54,9 +54,9 @@ GBMapView::GBMapView(CWnd* pParent /*=NULL*/) // 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; @@ -67,7 +67,7 @@ GBMapView::GBMapView(CWnd* pParent /*=NULL*/) mapView.setData(data); mapView.setBmpInfo(&bmpInfo); - + bg = 0; bank = 0; } @@ -113,7 +113,7 @@ GBMapView::~GBMapView() void GBMapView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -170,7 +170,7 @@ void GBMapView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -180,14 +180,14 @@ void GBMapView::saveBMP(const char *name) 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, @@ -236,16 +236,16 @@ void GBMapView::savePNG(const char *name) 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); @@ -253,7 +253,7 @@ void GBMapView::savePNG(const char *name) fclose(fp); } -void GBMapView::OnSave() +void GBMapView::OnSave() { CString filename; @@ -273,7 +273,7 @@ void GBMapView::OnSave() theApp.captureFormat ? "BMP" : "PNG", exts, "", - title, + title, true); if(dlg.DoModal() == IDCANCEL) { @@ -305,14 +305,14 @@ void GBMapView::render() 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 *bmp = &data[y * 8 * 32 * 24 + x*24]; u8 attrs = 0; if(bank1 != NULL) attrs = bank1[tile_map_address]; @@ -327,10 +327,10 @@ void GBMapView::render() 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]; @@ -338,27 +338,27 @@ void GBMapView::render() 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; @@ -372,7 +372,7 @@ void GBMapView::paint() if(gbRom == NULL) return; render(); - + SIZE s; if(mapView.getStretch()) { mapView.setSize(w, h); @@ -388,7 +388,7 @@ void GBMapView::paint() mapView.refresh(); } -void GBMapView::OnRefresh() +void GBMapView::OnRefresh() { paint(); } @@ -398,10 +398,10 @@ void GBMapView::update() paint(); } -BOOL GBMapView::OnInitDialog() +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) @@ -410,7 +410,7 @@ BOOL GBMapView::OnInitDialog() 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_B, DS_MoveY) DIALOG_SIZER_END() SetData(sz, TRUE, @@ -437,51 +437,51 @@ BOOL GBMapView::OnInitDialog() // EXCEPTION: OCX Property Pages should return FALSE } -void GBMapView::OnBg0() +void GBMapView::OnBg0() { bg = 0; paint(); } -void GBMapView::OnBg1() +void GBMapView::OnBg1() { bg = 1; paint(); } -void GBMapView::OnBank0() +void GBMapView::OnBank0() { bank = 0; paint(); } -void GBMapView::OnBank1() +void GBMapView::OnBank1() { bank = 1; paint(); } -void GBMapView::OnStretch() +void GBMapView::OnStretch() { mapView.setStretch(!mapView.getStretch()); paint(); - regSetDwordValue("mapViewStretch", mapView.getStretch()); + regSetDwordValue("mapViewStretch", mapView.getStretch()); } -void GBMapView::OnAutoUpdate() +void GBMapView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); + theApp.winRemoveUpdateListener(this); } } -void GBMapView::OnClose() +void GBMapView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -501,7 +501,7 @@ LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) int x = (int)(wParam & 0xffff); int y = (int)(wParam >> 16); - + CString buffer; buffer.Format("(%d,%d)", x, y); GetDlgItem(IDC_XY)->SetWindowText(buffer); @@ -522,21 +522,21 @@ LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam) 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' : '-'; @@ -551,7 +551,7 @@ LRESULT GBMapView::OnColInfo(WPARAM wParam, LPARAM) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -570,7 +570,7 @@ LRESULT GBMapView::OnColInfo(WPARAM wParam, LPARAM) return TRUE; } -void GBMapView::PostNcDestroy() +void GBMapView::PostNcDestroy() { delete this; CDialog::PostNcDestroy(); diff --git a/src/win32/GBMemoryViewerDlg.cpp b/src/win32/GBMemoryViewerDlg.cpp index a5d35697..0a0a1ec2 100644 --- a/src/win32/GBMemoryViewerDlg.cpp +++ b/src/win32/GBMemoryViewerDlg.cpp @@ -54,7 +54,7 @@ void GBMemoryViewer::readData(u32 address, int len, u8 *data) for(int i = 0; i < len; i++) { *data++ = 0; addr++; - } + } } } @@ -95,7 +95,7 @@ void GBMemoryViewer::editData(u32 address, int size, int mask, u32 value) GB_WRITEBYTE_QUICK(addr+2, (oldValue >> 16)); GB_WRITEBYTE_QUICK(addr+3, (oldValue >> 24)); break; - } + } } ///////////////////////////////////////////////////////////////////////////// @@ -143,10 +143,10 @@ BEGIN_MESSAGE_MAP(GBMemoryViewerDlg, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBMemoryViewerDlg message handlers -BOOL GBMemoryViewerDlg::OnInitDialog() +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) @@ -162,7 +162,7 @@ BOOL GBMemoryViewerDlg::OnInitDialog() 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); @@ -185,18 +185,18 @@ BOOL GBMemoryViewerDlg::OnInitDialog() 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, @@ -212,19 +212,19 @@ BOOL GBMemoryViewerDlg::OnInitDialog() 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() +void GBMemoryViewerDlg::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void GBMemoryViewerDlg::OnRefresh() +void GBMemoryViewerDlg::OnRefresh() { m_viewer.Invalidate(); } @@ -234,40 +234,40 @@ void GBMemoryViewerDlg::update() OnRefresh(); } -void GBMemoryViewerDlg::On8Bit() +void GBMemoryViewerDlg::On8Bit() { m_viewer.setSize(0); regSetDwordValue("memViewerDataSize", 0); } -void GBMemoryViewerDlg::On16Bit() +void GBMemoryViewerDlg::On16Bit() { m_viewer.setSize(1); regSetDwordValue("memViewerDataSize", 1); } -void GBMemoryViewerDlg::On32Bit() +void GBMemoryViewerDlg::On32Bit() { m_viewer.setSize(2); regSetDwordValue("memViewerDataSize", 2); } -void GBMemoryViewerDlg::OnAutoUpdate() +void GBMemoryViewerDlg::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void GBMemoryViewerDlg::OnGo() +void GBMemoryViewerDlg::OnGo() { CString buffer; - + m_address.GetWindowText(buffer); - + u32 address; sscanf(buffer, "%x", &address); if(m_viewer.getSize() == 1) @@ -277,10 +277,10 @@ void GBMemoryViewerDlg::OnGo() m_viewer.setAddress(address); } -void GBMemoryViewerDlg::OnSelchangeAddresses() +void GBMemoryViewerDlg::OnSelchangeAddresses() { int cur = m_addresses.GetCurSel(); - + switch(cur) { case 0: m_viewer.setAddress(0x0000); @@ -317,7 +317,7 @@ void GBMemoryViewerDlg::setCurrentAddress(u32 address) m_current.SetWindowText(buffer); } -void GBMemoryViewerDlg::OnSave() +void GBMemoryViewerDlg::OnSave() { MemoryViewerAddressSize dlg; CString buffer; @@ -328,11 +328,11 @@ void GBMemoryViewerDlg::OnSave() CString filter = theApp.winLoadFilter(IDS_FILTER_DUMP); CString title = winResLoadString(IDS_SELECT_DUMP_FILE); - + if(dlg.DoModal() == IDOK) { FileDlg file(this, buffer, - filter, + filter, 0, "DMP", exts, @@ -342,7 +342,7 @@ void GBMemoryViewerDlg::OnSave() if(file.DoModal() == IDOK) { buffer = file.GetPathName(); FILE *f = fopen(buffer, "wb"); - + if(f == NULL) { systemMessage(IDS_ERROR_CREATING_FILE, buffer); return; @@ -361,23 +361,23 @@ void GBMemoryViewerDlg::OnSave() } } -void GBMemoryViewerDlg::OnLoad() +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, + filter, 0, "DMP", exts, "", - title, + title, false); - + if(file.DoModal() == IDOK) { buffer = file.GetPathName(); FILE *f = fopen(buffer, "rb"); @@ -387,17 +387,17 @@ void GBMemoryViewerDlg::OnLoad() buffer); return; } - - MemoryViewerAddressSize dlg; + + 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; @@ -411,11 +411,11 @@ void GBMemoryViewerDlg::OnLoad() } OnRefresh(); } - fclose(f); - } + fclose(f); + } } -void GBMemoryViewerDlg::PostNcDestroy() +void GBMemoryViewerDlg::PostNcDestroy() { delete this; } diff --git a/src/win32/GBOamView.cpp b/src/win32/GBOamView.cpp index 7963f0b0..4d0b876d 100644 --- a/src/win32/GBOamView.cpp +++ b/src/win32/GBOamView.cpp @@ -52,9 +52,9 @@ GBOamView::GBOamView(CWnd* pParent /*=NULL*/) 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; @@ -109,7 +109,7 @@ void GBOamView::paint() { if(gbRom == NULL) return; - + render(); oamView.setSize(w,h); oamView.refresh(); @@ -124,7 +124,7 @@ void GBOamView::update() 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; @@ -146,7 +146,7 @@ void GBOamView::setAttributes(int y, int x, int tile, int flags) buffer.Format("%d", bank); GetDlgItem(IDC_BANK)->SetWindowText(buffer); - + buffer.Empty(); if(flipH) buffer += 'H'; @@ -171,16 +171,16 @@ void GBOamView::render() 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; @@ -200,19 +200,19 @@ void GBOamView::render() 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++]; @@ -220,7 +220,7 @@ void GBOamView::render() a = bank0[address++]; b = bank0[address++]; } - + for(int xx = 0; xx < 8; xx++) { u8 mask = 1 << (7-xx); u8 c = 0; @@ -228,14 +228,14 @@ void GBOamView::render() 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; @@ -247,7 +247,7 @@ void GBOamView::render() void GBOamView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -304,7 +304,7 @@ void GBOamView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -315,14 +315,14 @@ void GBOamView::saveBMP(const char *name) 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, @@ -371,16 +371,16 @@ void GBOamView::savePNG(const char *name) 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); @@ -410,7 +410,7 @@ void GBOamView::save() theApp.captureFormat ? "BMP" : "PNG", exts, "", - title, + title, true); if(dlg.DoModal() == IDCANCEL) { @@ -421,13 +421,13 @@ void GBOamView::save() if(dlg.getFilterIndex() == 2) saveBMP(captureBuffer); else - savePNG(captureBuffer); + savePNG(captureBuffer); } -BOOL GBOamView::OnInitDialog() +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) @@ -437,7 +437,7 @@ BOOL GBOamView::OnInitDialog() 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_B, DS_MoveY) DIALOG_SIZER_END() SetData(sz, TRUE, @@ -452,32 +452,32 @@ BOOL GBOamView::OnInitDialog() 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() +void GBOamView::OnStretch() { oamView.setStretch(!oamView.getStretch()); paint(); - regSetDwordValue("GBOamViewStretch", oamView.getStretch()); + regSetDwordValue("GBOamViewStretch", oamView.getStretch()); } -void GBOamView::OnAutoUpdate() +void GBOamView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void GBOamView::OnChangeSprite() +void GBOamView::OnChangeSprite() { CString buffer; m_sprite.GetWindowText(buffer); @@ -492,10 +492,10 @@ void GBOamView::OnChangeSprite() updateScrollInfo(); } -void GBOamView::OnClose() +void GBOamView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -503,7 +503,7 @@ LRESULT GBOamView::OnMapInfo(WPARAM, LPARAM lParam) { u8 *colors = (u8 *)lParam; oamZoom.setColors(colors); - + return TRUE; } @@ -511,7 +511,7 @@ LRESULT GBOamView::OnColInfo(WPARAM wParam, LPARAM lParam) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -543,11 +543,11 @@ void GBOamView::updateScrollInfo() si.nPos = number; GetDlgItem(IDC_SCROLLBAR)->SetScrollInfo(SB_CTL, &si, - TRUE); + TRUE); } -void GBOamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void GBOamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch(nSBCode) { case SB_BOTTOM: @@ -586,14 +586,14 @@ void GBOamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) } updateScrollInfo(); - + CString buffer; buffer.Format("%d", number); m_sprite.SetWindowText(buffer); paint(); } -void GBOamView::PostNcDestroy() +void GBOamView::PostNcDestroy() { delete this; } diff --git a/src/win32/GBPaletteView.cpp b/src/win32/GBPaletteView.cpp index 1c6a4719..80fec688 100644 --- a/src/win32/GBPaletteView.cpp +++ b/src/win32/GBPaletteView.cpp @@ -84,10 +84,10 @@ BEGIN_MESSAGE_MAP(GBPaletteView, CDialog) ///////////////////////////////////////////////////////////////////////////// // GBPaletteView message handlers -BOOL GBPaletteView::OnInitDialog() +BOOL GBPaletteView::OnInitDialog() { CDialog::OnInitDialog(); - + DIALOG_SIZER_START( sz ) DIALOG_SIZER_END() SetData(sz, @@ -98,13 +98,13 @@ BOOL GBPaletteView::OnInitDialog() paletteView.init(32, 64, 128); paletteViewOBJ.init(32, 64, 128); - + paletteView.setPaletteAddress(0); - paletteView.refresh(); - + paletteView.refresh(); + paletteViewOBJ.setPaletteAddress(32); - paletteViewOBJ.refresh(); - + paletteViewOBJ.refresh(); + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -119,7 +119,7 @@ void GBPaletteView::save(int which) 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, @@ -144,7 +144,7 @@ void GBPaletteView::save(int which) p = &paletteView; else p = &paletteViewOBJ; - + switch(dlg.getFilterIndex()) { case 0: case 1: @@ -160,20 +160,20 @@ void GBPaletteView::save(int which) } -void GBPaletteView::OnSaveBg() +void GBPaletteView::OnSaveBg() { save(0); } -void GBPaletteView::OnSaveObj() +void GBPaletteView::OnSaveObj() { save(1); } -void GBPaletteView::OnRefresh2() +void GBPaletteView::OnRefresh2() { paletteView.refresh(); - paletteViewOBJ.refresh(); + paletteViewOBJ.refresh(); } void GBPaletteView::update() @@ -182,21 +182,21 @@ void GBPaletteView::update() } -void GBPaletteView::OnAutoUpdate() +void GBPaletteView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void GBPaletteView::OnClose() +void GBPaletteView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -208,7 +208,7 @@ LRESULT GBPaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) bool isOBJ = address >= 32; address &= 31; - + buffer.Format("%d", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); @@ -235,11 +235,11 @@ LRESULT GBPaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) paletteView.setSelected(-1); else paletteViewOBJ.setSelected(-1); - + return TRUE; } -void GBPaletteView::PostNcDestroy() +void GBPaletteView::PostNcDestroy() { delete this; } diff --git a/src/win32/GBPrinterDlg.cpp b/src/win32/GBPrinterDlg.cpp index 9f28fdcc..0ae0c30d 100644 --- a/src/win32/GBPrinterDlg.cpp +++ b/src/win32/GBPrinterDlg.cpp @@ -51,7 +51,7 @@ GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) m_scale = -1; //}}AFX_DATA_INIT bitmap = (BITMAPINFO *)bitmapHeader; - + bitmap->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bitmap->bmiHeader.biWidth = 160; bitmap->bmiHeader.biHeight = -144; @@ -82,7 +82,7 @@ GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) bitmap->bmiColors[3].rgbGreen = bitmap->bmiColors[3].rgbRed = 0; - bitmap->bmiColors[3].rgbReserved = 0; + bitmap->bmiColors[3].rgbReserved = 0; } @@ -114,7 +114,7 @@ BEGIN_MESSAGE_MAP(GBPrinterDlg, CDialog) void GBPrinterDlg::saveAsBMP(const char *name) { u8 writeBuffer[512 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -163,17 +163,17 @@ void GBPrinterDlg::saveAsBMP(const char *name) 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); } @@ -181,7 +181,7 @@ void GBPrinterDlg::saveAsBMP(const char *name) void GBPrinterDlg::saveAsPNG(const char *name) { u8 writeBuffer[160 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -189,7 +189,7 @@ void GBPrinterDlg::saveAsPNG(const char *name) name); return; } - + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, @@ -200,13 +200,13 @@ void GBPrinterDlg::saveAsPNG(const char *name) } 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); @@ -241,19 +241,19 @@ void GBPrinterDlg::saveAsPNG(const char *name) *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); + fclose(fp); } -void GBPrinterDlg::OnSave() +void GBPrinterDlg::OnSave() { CString captureBuffer; @@ -289,7 +289,7 @@ void GBPrinterDlg::OnSave() saveAsPNG(captureBuffer); } -void GBPrinterDlg::OnPrint() +void GBPrinterDlg::OnPrint() { CPrintDialog dlg(FALSE); @@ -305,7 +305,7 @@ void GBPrinterDlg::OnPrint() float fLogPelsX2 = 0; float fLogPelsY1 = 0; float fLogPelsY2 = 0; - float fScaleX = 0, fScaleY = 0; + float fScaleX = 0, fScaleY = 0; CDC *winDC = NULL; memset(&di, 0, sizeof(di)); di.cbSize = sizeof(DOCINFO); @@ -332,7 +332,7 @@ void GBPrinterDlg::OnPrint() fLogPelsX2 = (float)dc.GetDeviceCaps(LOGPIXELSX); fLogPelsY2 = (float)dc.GetDeviceCaps(LOGPIXELSY); - + if(fLogPelsX1 > fLogPelsX2) fScaleX = fLogPelsX1 / fLogPelsX2; else @@ -345,7 +345,7 @@ void GBPrinterDlg::OnPrint() fScaleX *= (scale+1); fScaleY *= (scale+1); - + if(StretchDIBits(dc, 0, 0, @@ -397,59 +397,59 @@ void GBPrinterDlg::processData(u8 *data) } } } - } + } } -BOOL GBPrinterDlg::OnInitDialog() +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() +void GBPrinterDlg::OnOk() { EndDialog(TRUE); } -void GBPrinterDlg::On1x() +void GBPrinterDlg::On1x() { regSetDwordValue("printerScale", 0); scale = 0; } -void GBPrinterDlg::On2x() +void GBPrinterDlg::On2x() { regSetDwordValue("printerScale", 1); scale = 1; } -void GBPrinterDlg::On3x() +void GBPrinterDlg::On3x() { regSetDwordValue("printerScale", 2); scale = 2; } -void GBPrinterDlg::On4x() +void GBPrinterDlg::On4x() { regSetDwordValue("printerScale", 3); scale = 3; } -void GBPrinterDlg::OnPaint() +void GBPrinterDlg::OnPaint() { CPaintDC dc(this); // device context for painting - + RECT rect; CWnd *h = GetDlgItem(IDC_GB_PRINTER); h->GetWindowRect(&rect); @@ -464,7 +464,7 @@ void GBPrinterDlg::OnPaint() ScreenToClient((POINT *)&p); rect.right = p.x-1; rect.bottom = p.y-1; - + StretchDIBits(dc, rect.left, rect.top, diff --git a/src/win32/GBTileView.cpp b/src/win32/GBTileView.cpp index 23c44800..71ab1976 100644 --- a/src/win32/GBTileView.cpp +++ b/src/win32/GBTileView.cpp @@ -54,7 +54,7 @@ GBTileView::GBTileView(CWnd* pParent /*=NULL*/) m_stretch = FALSE; //}}AFX_DATA_INIT autoUpdate = false; - + memset(&bmpInfo, 0, sizeof(bmpInfo)); bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); @@ -117,7 +117,7 @@ BEGIN_MESSAGE_MAP(GBTileView, CDialog) void GBTileView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -174,7 +174,7 @@ void GBTileView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -185,14 +185,14 @@ void GBTileView::saveBMP(const char *name) 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, @@ -241,16 +241,16 @@ void GBTileView::savePNG(const char *name) 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); @@ -259,7 +259,7 @@ void GBTileView::savePNG(const char *name) } -void GBTileView::OnSave() +void GBTileView::OnSave() { CString captureBuffer; @@ -292,7 +292,7 @@ void GBTileView::OnSave() if(theApp.captureFormat) saveBMP(captureBuffer); else - savePNG(captureBuffer); + savePNG(captureBuffer); } void GBTileView::renderTile(int tile, int x, int y, u8 *charBase) @@ -303,11 +303,11 @@ void GBTileView::renderTile(int tile, int x, int y, u8 *charBase) 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 { @@ -335,7 +335,7 @@ void GBTileView::render() 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++) { @@ -360,10 +360,10 @@ void GBTileView::update() } -BOOL GBTileView::OnInitDialog() +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) @@ -392,27 +392,27 @@ BOOL GBTileView::OnInitDialog() 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() +void GBTileView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void GBTileView::OnAutoUpdate() +void GBTileView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } void GBTileView::paint() @@ -423,36 +423,36 @@ void GBTileView::paint() } } -void GBTileView::OnCharbase0() +void GBTileView::OnCharbase0() { charBase = 0; paint(); } -void GBTileView::OnCharbase1() +void GBTileView::OnCharbase1() { charBase = 1; paint(); } -void GBTileView::OnBank0() +void GBTileView::OnBank0() { bank = 0; paint(); } -void GBTileView::OnBank1() +void GBTileView::OnBank1() { bank = 1; paint(); } -void GBTileView::OnStretch() +void GBTileView::OnStretch() { tileView.setStretch(!tileView.getStretch()); paint(); - regSetDwordValue("tileViewStretch", tileView.getStretch()); + regSetDwordValue("tileViewStretch", tileView.getStretch()); } LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) @@ -477,7 +477,7 @@ LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam) buffer.Format("%04x", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); - + return TRUE; } @@ -485,7 +485,7 @@ LRESULT GBTileView::OnColInfo(WPARAM wParam, LPARAM) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -504,7 +504,7 @@ LRESULT GBTileView::OnColInfo(WPARAM wParam, LPARAM) return TRUE; } -void GBTileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void GBTileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch(nSBCode) { case TB_THUMBPOSITION: @@ -518,7 +518,7 @@ void GBTileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) } -void GBTileView::PostNcDestroy() +void GBTileView::PostNcDestroy() { delete this; } diff --git a/src/win32/GDBConnection.cpp b/src/win32/GDBConnection.cpp index af038695..92a68bf7 100644 --- a/src/win32/GDBConnection.cpp +++ b/src/win32/GDBConnection.cpp @@ -47,7 +47,7 @@ GDBPortDlg::GDBPortDlg(CWnd* pParent /*=NULL*/) //}}AFX_DATA_INIT port = 55555; sock = INVALID_SOCKET; - + if(!initialized) { WSADATA wsaData; @@ -90,10 +90,10 @@ SOCKET GDBPortDlg::getSocket() } -BOOL GDBPortDlg::OnInitDialog() +BOOL GDBPortDlg::OnInitDialog() { CDialog::OnInitDialog(); - + CString buffer; buffer.Format("%d", port); @@ -101,17 +101,17 @@ BOOL GDBPortDlg::OnInitDialog() 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() +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"); @@ -144,12 +144,12 @@ void GDBPortDlg::OnOk() } } -void GDBPortDlg::OnCancel() +void GDBPortDlg::OnCancel() { OnClose(); } -void GDBPortDlg::OnClose() +void GDBPortDlg::OnClose() { EndDialog(FALSE); } @@ -186,10 +186,10 @@ BEGIN_MESSAGE_MAP(GDBWaitingDlg, CDialog) ///////////////////////////////////////////////////////////////////////////// // GDBWaitingDlg message handlers -BOOL GDBWaitingDlg::OnInitDialog() +BOOL GDBWaitingDlg::OnInitDialog() { CDialog::OnInitDialog(); - + CString buffer; buffer.Format("%d", port); @@ -202,7 +202,7 @@ BOOL GDBWaitingDlg::OnInitDialog() (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 } @@ -211,10 +211,10 @@ LRESULT GDBWaitingDlg::OnSocketAccept(WPARAM wParam, LPARAM lParam) { if(LOWORD(lParam) == FD_ACCEPT) { WSAAsyncSelect(listenSocket, (HWND)*this, 0, 0); - - int flag = 0; + + int flag = 0; ioctlsocket(listenSocket, FIONBIO, (unsigned long *)&flag); - + SOCKET s = accept(listenSocket, NULL, NULL); if(s != INVALID_SOCKET) { char dummy; @@ -232,12 +232,12 @@ LRESULT GDBWaitingDlg::OnSocketAccept(WPARAM wParam, LPARAM lParam) return TRUE; } -void GDBWaitingDlg::OnCancel() +void GDBWaitingDlg::OnCancel() { OnClose(); } -void GDBWaitingDlg::OnClose() +void GDBWaitingDlg::OnClose() { if(sock != INVALID_SOCKET) { closesocket(sock); diff --git a/src/win32/GDIDisplay.cpp b/src/win32/GDIDisplay.cpp index 22431c33..743f6f5c 100644 --- a/src/win32/GDIDisplay.cpp +++ b/src/win32/GDIDisplay.cpp @@ -46,7 +46,7 @@ class GDIDisplay : public IDisplay { private: u8 *filterData; u8 info[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)]; - + public: GDIDisplay(); virtual ~GDIDisplay(); @@ -66,7 +66,7 @@ public: static int calculateShift(u32 mask) { int m = 0; - + while(mask) { m++; mask >>= 1; @@ -133,7 +133,7 @@ bool GDIDisplay::initialize() } break; } - + theApp.rect.left = 0; theApp.rect.top = 0; theApp.rect.right = theApp.sizeX; @@ -146,7 +146,7 @@ bool GDIDisplay::initialize() DWORD style = WS_POPUP | WS_VISIBLE; DWORD styleEx = 0; - + if(theApp.videoOption <= VIDEO_4X) style |= WS_OVERLAPPEDWINDOW; else @@ -155,7 +155,7 @@ bool GDIDisplay::initialize() if(theApp.videoOption <= VIDEO_4X) AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); else - AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); int winSizeX = theApp.dest.right-theApp.dest.left; int winSizeY = theApp.dest.bottom-theApp.dest.top; @@ -164,7 +164,7 @@ bool GDIDisplay::initialize() winSizeX = theApp.fsWidth; winSizeY = theApp.fsHeight; } - + int x = 0; int y = 0; @@ -172,7 +172,7 @@ bool GDIDisplay::initialize() x = theApp.windowPositionX; y = theApp.windowPositionY; } - + // Create a window MainWnd *pWnd = new MainWnd; theApp.m_pMainWnd = pWnd; @@ -184,26 +184,26 @@ bool GDIDisplay::initialize() 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); GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS); DeleteObject(hbm); ReleaseDC(NULL, dc); @@ -229,7 +229,7 @@ bool GDIDisplay::initialize() systemGreenShift = 11; systemBlueShift = 3; - Init_2xSaI(32); + Init_2xSaI(32); } theApp.fsColorDepth = systemColorDepth; if(systemColorDepth == 24) @@ -240,14 +240,14 @@ bool GDIDisplay::initialize() else cpu_mmx = 0; #endif - + utilUpdateSystemColorMaps(); theApp.updateFilter(); theApp.updateIFB(); - + pWnd->DragAcceptFiles(TRUE); - - return TRUE; + + return TRUE; } void GDIDisplay::clear() @@ -265,7 +265,7 @@ void GDIDisplay::checkFullScreen() } void GDIDisplay::render() -{ +{ BITMAPINFO *bi = (BITMAPINFO *)info; bi->bmiHeader.biWidth = theApp.filterWidth+1; bi->bmiHeader.biHeight = -theApp.filterHeight; @@ -275,11 +275,11 @@ void GDIDisplay::render() pitch = theApp.filterWidth * 3; else if(systemColorDepth == 32) pitch = theApp.filterWidth * 4 + 4; - + if(theApp.filterFunction) { bi->bmiHeader.biWidth = theApp.filterWidth * 2; bi->bmiHeader.biHeight = -theApp.filterHeight * 2; - + if(systemColorDepth == 16) (*theApp.filterFunction)(pix+pitch, pitch, @@ -324,7 +324,7 @@ void GDIDisplay::render() p, 10, theApp.filterHeight*2-10, - buffer); + buffer); } else { if(theApp.showSpeedTransparent) drawTextTransp((u8*)pix, @@ -350,7 +350,7 @@ void GDIDisplay::render() p2.x = theApp.dest.right; p2.y = theApp.dest.bottom; pWnd->ScreenToClient(&p2); - + CDC *dc = pWnd->GetDC(); StretchDIBits((HDC)*dc, @@ -377,7 +377,7 @@ void GDIDisplay::render() theApp.screenMessage = false; } } - + pWnd->ReleaseDC(dc); } diff --git a/src/win32/GSACodeSelect.cpp b/src/win32/GSACodeSelect.cpp index 78e3b60e..0753bd23 100644 --- a/src/win32/GSACodeSelect.cpp +++ b/src/win32/GSACodeSelect.cpp @@ -63,17 +63,17 @@ BEGIN_MESSAGE_MAP(GSACodeSelect, CDialog) ///////////////////////////////////////////////////////////////////////////// // GSACodeSelect message handlers -void GSACodeSelect::OnCancel() +void GSACodeSelect::OnCancel() { EndDialog(-1); } -void GSACodeSelect::OnOk() +void GSACodeSelect::OnOk() { EndDialog(m_games.GetCurSel()); } -void GSACodeSelect::OnSelchangeGameList() +void GSACodeSelect::OnSelchangeGameList() { int item = m_games.GetCurSel(); CWnd *ok = GetDlgItem(ID_OK); @@ -81,12 +81,12 @@ void GSACodeSelect::OnSelchangeGameList() ok->EnableWindow(item != -1); } -BOOL GSACodeSelect::OnInitDialog() +BOOL GSACodeSelect::OnInitDialog() { CDialog::OnInitDialog(); - + char buffer[1024]; - + FILE *f = m_file; int games = 0; int len = 0; @@ -99,7 +99,7 @@ BOOL GSACodeSelect::OnInitDialog() 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); @@ -114,7 +114,7 @@ BOOL GSACodeSelect::OnInitDialog() } 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/GameOverrides.cpp b/src/win32/GameOverrides.cpp index 3f2922ad..2ec84473 100644 --- a/src/win32/GameOverrides.cpp +++ b/src/win32/GameOverrides.cpp @@ -66,20 +66,20 @@ BEGIN_MESSAGE_MAP(GameOverrides, CDialog) ///////////////////////////////////////////////////////////////////////////// // GameOverrides message handlers -void GameOverrides::OnOK() +void GameOverrides::OnOK() { char tempName[2048]; - + 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"); char comment[0xFF]; @@ -149,7 +149,7 @@ void GameOverrides::OnOK() CDialog::OnOK(); } -void GameOverrides::OnDefaults() +void GameOverrides::OnDefaults() { m_rtc.SetCurSel(0); m_flashSize.SetCurSel(0); @@ -157,17 +157,17 @@ void GameOverrides::OnDefaults() m_mirroring.SetCurSel(0); } -void GameOverrides::OnCancel() +void GameOverrides::OnCancel() { CDialog::OnCancel(); } -BOOL GameOverrides::OnInitDialog() +BOOL GameOverrides::OnInitDialog() { CDialog::OnInitDialog(); char tempName[2048]; - + const char *rtcValues[] = { "Default", "Disabled", @@ -209,15 +209,15 @@ BOOL GameOverrides::OnInitDialog() } 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"); m_name.SetWindowText(buffer); @@ -259,7 +259,7 @@ BOOL GameOverrides::OnInitDialog() default: m_flashSize.SetCurSel(0); } - + v = GetPrivateProfileInt(buffer, "saveType", -1, @@ -270,7 +270,7 @@ BOOL GameOverrides::OnInitDialog() m_saveType.SetCurSel(v+1); else m_saveType.SetCurSel(0); - + v = GetPrivateProfileInt(buffer, "mirroringEnabled", -1, diff --git a/src/win32/Hyperlink.cpp b/src/win32/Hyperlink.cpp index 05770d66..79c289b5 100644 --- a/src/win32/Hyperlink.cpp +++ b/src/win32/Hyperlink.cpp @@ -55,7 +55,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Hyperlink message handlers -void Hyperlink::PreSubclassWindow() +void Hyperlink::PreSubclassWindow() { DWORD dwStyle = GetStyle(); ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY); @@ -69,10 +69,10 @@ void Hyperlink::PreSubclassWindow() font->GetLogFont(&lg); lg.lfUnderline = TRUE; - + m_underlineFont.CreateFontIndirect(&lg); SetFont(&m_underlineFont); - + CStatic::PreSubclassWindow(); } @@ -80,18 +80,18 @@ void Hyperlink::OnClicked() { CString url; GetWindowText(url); - ::ShellExecute(0, _T("open"), url, + ::ShellExecute(0, _T("open"), url, 0, 0, SW_SHOWNORMAL); } -HBRUSH Hyperlink::CtlColor(CDC* pDC, UINT nCtlColor) +HBRUSH Hyperlink::CtlColor(CDC* pDC, UINT nCtlColor) { pDC->SetTextColor(RGB(0,0,240)); - + return (HBRUSH)GetStockObject(NULL_BRUSH); } -BOOL Hyperlink::OnEraseBkgnd(CDC* pDC) +BOOL Hyperlink::OnEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(rect); @@ -100,7 +100,7 @@ BOOL Hyperlink::OnEraseBkgnd(CDC* pDC) return TRUE; } -void Hyperlink::OnMouseMove(UINT nFlags, CPoint point) +void Hyperlink::OnMouseMove(UINT nFlags, CPoint point) { if(!m_over) { m_over = true; diff --git a/src/win32/IOViewer.cpp b/src/win32/IOViewer.cpp index bcc5afb5..33770388 100644 --- a/src/win32/IOViewer.cpp +++ b/src/win32/IOViewer.cpp @@ -89,21 +89,21 @@ BEGIN_MESSAGE_MAP(IOViewer, CDialog) ///////////////////////////////////////////////////////////////////////////// // IOViewer message handlers -void IOViewer::OnClose() +void IOViewer::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void IOViewer::bitChange() +void IOViewer::bitChange() { CString buffer; u16 data = 0; for(int i = 0; i < 16; i++) { CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i); - + if(pWnd) { if(pWnd->GetCheck()) data |= (1 << i); @@ -114,39 +114,39 @@ void IOViewer::bitChange() m_value.SetWindowText(buffer); } -void IOViewer::OnRefresh() +void IOViewer::OnRefresh() { // TODO: Add your control notification handler code here - update(); + update(); } -void IOViewer::OnAutoUpdate() +void IOViewer::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void IOViewer::OnSelchangeAddresses() +void IOViewer::OnSelchangeAddresses() { selected = m_address.GetCurSel(); - + update(); } -void IOViewer::PostNcDestroy() +void IOViewer::PostNcDestroy() { delete this; } -BOOL IOViewer::OnInitDialog() +BOOL IOViewer::OnInitDialog() { CDialog::OnInitDialog(); - + // winCenterWindow(getHandle()); DIALOG_SIZER_START( sz ) DIALOG_SIZER_END() @@ -168,18 +168,18 @@ BOOL IOViewer::OnInitDialog() 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, @@ -188,7 +188,7 @@ BOOL IOViewer::OnInitDialog() m_address.SetCurSel(0); update(); - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -198,7 +198,7 @@ void IOViewer::update() CString buffer; const IOData *sel = &ioViewRegisters[selected]; - u16 data = sel->address ? *sel->address : + u16 data = sel->address ? *sel->address : (ioMem ? *((u16 *)&ioMem[sel->offset]) : 0); for(int i = 0; i < 16; i++) { @@ -219,7 +219,7 @@ void IOViewer::update() m_value.SetWindowText(buffer); } -void IOViewer::OnApply() +void IOViewer::OnApply() { if(rom != NULL) { @@ -227,7 +227,7 @@ void IOViewer::OnApply() 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); diff --git a/src/win32/IOViewerRegs.h b/src/win32/IOViewerRegs.h index 4491308e..d38ea526 100644 --- a/src/win32/IOViewerRegs.h +++ b/src/win32/IOViewerRegs.h @@ -26,7 +26,7 @@ struct IOData { }; const IOData ioViewRegisters[] = { - { + { &DISPCNT, 0, "0x4000000-DISPCNT", 0xFFF7, { "", diff --git a/src/win32/Input.h b/src/win32/Input.h index 93813252..5e1f5990 100644 --- a/src/win32/Input.h +++ b/src/win32/Input.h @@ -1,67 +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. - -#ifndef VBA_WIN32_INPUT_H -#define VBA_WIN32_INPUT_H -#include "../System.h" - -#define JOYCONFIG_MESSAGE (WM_USER + 1000) -#define JOYPADS 4 -#define MOTION_KEYS 4 -#define KEYS_PER_PAD 13 -#define MOTION(i) ((JOYPADS*KEYS_PER_PAD)+i) -#define JOYPAD(i,j) ((i*KEYS_PER_PAD)+j) - -#define DEVICEOF(key) (key >> 8) -#define KEYOF(key) (key & 255) - -typedef CList KeyList; - -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 -}; - -class Input { - - public: - KeyList joypaddata[JOYPADS * KEYS_PER_PAD + MOTION_KEYS]; - - Input() {}; - virtual ~Input() {}; - - virtual bool initialize() = 0; - - virtual bool readDevices() = 0; - virtual u32 readDevice(int which) = 0; - virtual CString getKeyName(LONG_PTR key) = 0; - virtual void checkKeys() = 0; - virtual void checkMotionKeys() = 0; - virtual void checkDevices() = 0; - virtual void activate() = 0; - virtual void loadSettings() = 0; - virtual void saveSettings() = 0; -}; - -#endif +// -*- 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) +#define JOYPADS 4 +#define MOTION_KEYS 4 +#define KEYS_PER_PAD 13 +#define MOTION(i) ((JOYPADS*KEYS_PER_PAD)+i) +#define JOYPAD(i,j) ((i*KEYS_PER_PAD)+j) + +#define DEVICEOF(key) (key >> 8) +#define KEYOF(key) (key & 255) + +typedef CList KeyList; + +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 +}; + +class Input { + + public: + KeyList joypaddata[JOYPADS * KEYS_PER_PAD + MOTION_KEYS]; + + Input() {}; + virtual ~Input() {}; + + virtual bool initialize() = 0; + + virtual bool readDevices() = 0; + virtual u32 readDevice(int which) = 0; + virtual CString getKeyName(LONG_PTR key) = 0; + virtual void checkKeys() = 0; + virtual void checkMotionKeys() = 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 index bd8594da..358bd917 100644 --- a/src/win32/Joypad.cpp +++ b/src/win32/Joypad.cpp @@ -44,7 +44,7 @@ void AssignKey(KeyList &Key, int Out) CString GetKeyListName(KeyList& Keys) { CString txtKeys; - + POSITION p = Keys.GetHeadPosition(); while(p!=NULL) { @@ -88,7 +88,7 @@ BEGIN_MESSAGE_MAP(JoypadEditControl, CEdit) // JoypadEditControl message handlers -void JoypadEditControl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void JoypadEditControl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { } @@ -158,12 +158,12 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // JoypadConfig message handlers -void JoypadConfig::OnCancel() +void JoypadConfig::OnCancel() { EndDialog(FALSE); } -void JoypadConfig::OnOk() +void JoypadConfig::OnOk() { AssignKeys(up.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_UP)]); AssignKeys(speed.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)]); @@ -183,34 +183,34 @@ void JoypadConfig::OnOk() EndDialog(TRUE); } -void JoypadConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void JoypadConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { } -void JoypadConfig::OnDestroy() +void JoypadConfig::OnDestroy() { CDialog::OnDestroy(); - + KillTimer(timerId); } -void JoypadConfig::OnTimer(UINT_PTR nIDEvent) +void JoypadConfig::OnTimer(UINT_PTR nIDEvent) { theApp.input->checkDevices(); - + CDialog::OnTimer(nIDEvent); } -void JoypadConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void JoypadConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { } -BOOL JoypadConfig::OnInitDialog() +BOOL JoypadConfig::OnInitDialog() { CDialog::OnInitDialog(); bAppendMode = FALSE; - + timerId = SetTimer(0,50,NULL); CopyKeys(up.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_UP)]); @@ -240,7 +240,7 @@ BOOL JoypadConfig::OnInitDialog() speed.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)])); capture.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)])); buttonGS.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_GS)])); - + CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control @@ -264,7 +264,7 @@ void JoypadConfig::assignKey(int id, LONG_PTR key) break; case IDC_EDIT_CAPTURE: AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)],key); - break; + break; case IDC_EDIT_DOWN: AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_DOWN)],key); break; @@ -332,34 +332,34 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MotionConfig message handlers -void MotionConfig::OnCancel() +void MotionConfig::OnCancel() { EndDialog(FALSE); } -void MotionConfig::OnOk() +void MotionConfig::OnOk() { assignKeys(); theApp.input->checkKeys(); EndDialog( TRUE); } -void MotionConfig::OnDestroy() +void MotionConfig::OnDestroy() { CDialog::OnDestroy(); - + KillTimer(timerId); } -BOOL MotionConfig::OnInitDialog() +BOOL MotionConfig::OnInitDialog() { CDialog::OnInitDialog(); - + timerId = SetTimer(0,50,NULL); - + CopyKeys(up.m_Keys, theApp.input->joypaddata[MOTION(KEY_UP)]); up.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_UP)])); - + CopyKeys(down.m_Keys, theApp.input->joypaddata[MOTION(KEY_DOWN)]); down.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_DOWN)])); @@ -375,14 +375,14 @@ BOOL MotionConfig::OnInitDialog() // EXCEPTION: OCX Property Pages should return FALSE } -void MotionConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void MotionConfig::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { } -void MotionConfig::OnTimer(UINT nIDEvent) +void MotionConfig::OnTimer(UINT nIDEvent) { theApp.input->checkDevices(); - + CDialog::OnTimer(nIDEvent); } diff --git a/src/win32/Joypad.h b/src/win32/Joypad.h index 30400956..4fc41adb 100644 --- a/src/win32/Joypad.h +++ b/src/win32/Joypad.h @@ -1,176 +1,176 @@ -// -*- 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 "afxwin.h" -#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(); - - KeyList m_Keys; - - // 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 assignKey(int id, LONG_PTR 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() -public: - afx_msg void OnBnClickedAppendmode(); -}; - ///////////////////////////////////////////////////////////////////////////// -// 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; -public: - afx_msg void OnBnClickedAppendmode(); -}; -//{{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_) +// -*- 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 "afxwin.h" +#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(); + + KeyList m_Keys; + + // 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 assignKey(int id, LONG_PTR 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() +public: + afx_msg void OnBnClickedAppendmode(); +}; + ///////////////////////////////////////////////////////////////////////////// +// 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; +public: + afx_msg void OnBnClickedAppendmode(); +}; +//{{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 index 65678091..6164baa3 100644 --- a/src/win32/KeyboardEdit.cpp +++ b/src/win32/KeyboardEdit.cpp @@ -59,7 +59,7 @@ BEGIN_MESSAGE_MAP(CKeyboardEdit, CEdit) #pragma warning( disable : 4706 ) ///////////////////////////////////////////////////////////////////////////// // CKeyboardEdit message handlers -BOOL CKeyboardEdit::PreTranslateMessage (MSG* pMsg) +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) { @@ -82,7 +82,7 @@ BOOL CKeyboardEdit::PreTranslateMessage (MSG* pMsg) DisplayKeyboardString (); return TRUE; } - + return CEdit::PreTranslateMessage(pMsg); } #pragma warning( default : 4706 ) @@ -125,7 +125,7 @@ void CKeyboardEdit::ResetKey () m_bCtrlPressed = false; m_bAltPressed = false; m_bShiftPressed = false; - + m_bKeyDefined = false; if(m_hWnd != NULL) SetWindowText(_T("")); @@ -138,7 +138,7 @@ bool CKeyboardEdit::GetAccelKey(WORD& wVirtKey, bool& bCtrl, bool& bAlt, bool& b { if (!m_bKeyDefined) return false; - + wVirtKey = m_wVirtKey; bAlt = m_bAltPressed; bCtrl = m_bCtrlPressed; diff --git a/src/win32/KeyboardEdit.h b/src/win32/KeyboardEdit.h index c72da1d3..10092d79 100644 --- a/src/win32/KeyboardEdit.h +++ b/src/win32/KeyboardEdit.h @@ -22,7 +22,7 @@ // Version : 1.0 * Authors : A.Lebatard + T.Maurel // Date : 17.08.98 // -// Remarks : +// Remarks : // //////////////////////////////////////////////////////////////////////////////// #if !defined(AFX_KEYBOARDEDIT_H__88E35AB0_2E23_11D2_BA24_0060B0B5E151__INCLUDED_) diff --git a/src/win32/LangSelect.cpp b/src/win32/LangSelect.cpp index 4dcabe6b..dbb89080 100644 --- a/src/win32/LangSelect.cpp +++ b/src/win32/LangSelect.cpp @@ -62,21 +62,21 @@ BEGIN_MESSAGE_MAP(LangSelect, CDialog) ///////////////////////////////////////////////////////////////////////////// // LangSelect message handlers -void LangSelect::OnCancel() +void LangSelect::OnCancel() { EndDialog(FALSE); } -void LangSelect::OnOk() +void LangSelect::OnOk() { m_langString.GetWindowText(theApp.languageName); EndDialog(TRUE); } -BOOL LangSelect::OnInitDialog() +BOOL LangSelect::OnInitDialog() { CDialog::OnInitDialog(); - + char lbuffer[10]; if(GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10)) { @@ -84,14 +84,14 @@ BOOL LangSelect::OnInitDialog() } 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/LinkOptions.cpp b/src/win32/LinkOptions.cpp index c337c0d5..c76ddf3d 100644 --- a/src/win32/LinkOptions.cpp +++ b/src/win32/LinkOptions.cpp @@ -1,643 +1,643 @@ -// LinkOptions.cpp : implementation file -// - -#include "stdafx.h" -#include "vba.h" -#include "LinkOptions.h" -#include "../Link.h" - -extern int lspeed; -extern lserver ls; - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// LinkOptions dialog - -CMyTabCtrl::CMyTabCtrl(){ - m_tabdialog[0] = new LinkGeneral; - m_tabdialog[1] = new LinkServer; - m_tabdialog[2] = new LinkClient; -} - -CMyTabCtrl::~CMyTabCtrl() -{ - m_tabdialog[0]->DestroyWindow(); - m_tabdialog[1]->DestroyWindow(); - m_tabdialog[2]->DestroyWindow(); - - delete m_tabdialog[0]; - delete m_tabdialog[1]; - delete m_tabdialog[2]; -} - -LinkOptions::LinkOptions(CWnd* pParent /*=NULL*/) - : CDialog(LinkOptions::IDD, pParent) -{ - //{{AFX_DATA_INIT(LinkOptions) - // NOTE: the ClassWizard will add member initialization here - //}}AFX_DATA_INIT -} - - -void LinkOptions::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(LinkOptions) - //}}AFX_DATA_MAP -} - -BOOL LinkOptions::OnInitDialog(){ - TCITEM tabitem; - char tabtext[3][8] = {"General", "Server", "Client"}; - int i; - - CDialog::OnInitDialog(); - - m_tabctrl.SubclassDlgItem(IDC_TAB1, this); - - tabitem.mask = TCIF_TEXT; - - for(i=0;i<3;i++){ - tabitem.pszText = tabtext[i]; - m_tabctrl.InsertItem(i, &tabitem); - } - m_tabctrl.m_tabdialog[0]->Create(IDD_LINKTAB1, this); - m_tabctrl.m_tabdialog[1]->Create(IDD_LINKTAB2, this); - m_tabctrl.m_tabdialog[2]->Create(IDD_LINKTAB3, this); - - m_tabctrl.m_tabdialog[0]->ShowWindow(SW_SHOW); - m_tabctrl.m_tabdialog[1]->ShowWindow(SW_HIDE); - m_tabctrl.m_tabdialog[2]->ShowWindow(SW_HIDE); - - m_tabctrl.SetCurSel(0); - m_tabctrl.OnSwitchTabs(); - - return TRUE; -} - - - BOOL LinkOptions::PreTranslateMessage(MSG* pMsg) - { - return m_tabctrl.TranslatePropSheetMsg(pMsg) ? TRUE : - CDialog::PreTranslateMessage(pMsg); - } - - - - -BEGIN_MESSAGE_MAP(LinkOptions, CDialog) - //{{AFX_MSG_MAP(LinkOptions) - ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1) - ON_BN_CLICKED(ID_OK, OnOk) - ON_BN_CLICKED(ID_CANCEL, OnCancel) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LinkOptions message handlers -///////////////////////////////////////////////////////////////////////////// -// LinkGeneral dialog - - -LinkGeneral::LinkGeneral(CWnd* pParent /*=NULL*/) - : CDialog(LinkGeneral::IDD, pParent) -{ - //{{AFX_DATA_INIT(LinkGeneral) - //}}AFX_DATA_INIT -} - -void LinkGeneral::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(LinkGeneral) - DDX_Radio(pDX, IDC_LINK_SINGLE, m_type); - DDX_Control(pDX, IDC_LINKTIMEOUT, m_timeout); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(LinkGeneral, CDialog) - //{{AFX_MSG_MAP(LinkGeneral) - ON_BN_CLICKED(IDC_LINK_SINGLE, OnRadio1) - ON_BN_CLICKED(IDC_LINK_LAN, OnRadio2) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LinkGeneral message handlers -///////////////////////////////////////////////////////////////////////////// -// LinkServer dialog - - -LinkServer::LinkServer(CWnd* pParent /*=NULL*/) - : CDialog(LinkServer::IDD, pParent) -{ - //{{AFX_DATA_INIT(LinkServer) - m_numplayers = -1; - m_prottype = -1; - m_speed = FALSE; - //}}AFX_DATA_INIT -} - - -void LinkServer::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(LinkServer) - DDX_Radio(pDX, IDC_LINK2P, m_numplayers); - DDX_Radio(pDX, IDC_LINKTCP, m_prottype); - DDX_Check(pDX, IDC_SSPEED, m_speed); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(LinkServer, CDialog) - //{{AFX_MSG_MAP(LinkServer) - ON_BN_CLICKED(IDC_SERVERSTART, OnServerStart) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LinkServer message handlers - -LinkClient::LinkClient(CWnd* pParent /*=NULL*/) - : CDialog(LinkClient::IDD, pParent) -{ - //{{AFX_DATA_INIT(LinkClient) - m_prottype = -1; - m_hacks = -1; - //}}AFX_DATA_INIT -} - - -void LinkClient::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(LinkClient) - DDX_Control(pDX, IDC_SERVERIP, m_serverip); - DDX_Radio(pDX, IDC_CLINKTCP, m_prottype); - DDX_Radio(pDX, IDC_SPEEDOFF, m_hacks); - //}}AFX_DATA_MAP -} - - -BEGIN_MESSAGE_MAP(LinkClient, CDialog) - //{{AFX_MSG_MAP(LinkClient) - ON_BN_CLICKED(IDC_LINKCONNECT, OnLinkConnect) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// LinkClient message handlers - -BOOL LinkServer::OnInitDialog() -{ - CDialog::OnInitDialog(); - - m_numplayers = lanlink.numgbas; - m_prottype = lanlink.type; - m_speed = lanlink.speed; - - UpdateData(FALSE); - - return TRUE; -} - -void LinkOptions::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) -{ - m_tabctrl.OnSwitchTabs(); - *pResult = 0; -} - -IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl) -BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl) - ON_NOTIFY_REFLECT(TCN_SELCHANGING, OnSelChanging) -END_MESSAGE_MAP() - -BOOL CMyTabCtrl::SubclassDlgItem(UINT nID, CWnd* pParent) -{ - if (!CTabCtrl::SubclassDlgItem(nID, pParent)) - return FALSE; - - ModifyStyle(0, TCS_OWNERDRAWFIXED); - - // If first tab is disabled, go to next enabled tab - if (!IsTabEnabled(0)) { - int iTab = NextEnabledTab(0, TRUE); - SetActiveTab(iTab); - } - return TRUE; -} - -BOOL CMyTabCtrl::IsTabEnabled(int iTab) -{ - if (!lanlink.active && iTab > 0) - return false; - return true; -} - -////////////////// -// Draw the tab: mimic SysTabControl32, except use gray if tab is disabled -// -void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) -{ - DRAWITEMSTRUCT& ds = *lpDrawItemStruct; - - int iItem = ds.itemID; - - // Get tab item info - char text[128]; - TCITEM tci; - tci.mask = TCIF_TEXT; - tci.pszText = text; - tci.cchTextMax = sizeof(text); - GetItem(iItem, &tci); - - // use draw item DC - CDC dc; - dc.Attach(ds.hDC); - - // calculate text rectangle and color - CRect rc = ds.rcItem; - rc += CPoint(1,4); // ?? by trial and error - - // draw the text - OnDrawText(dc, rc, text, !IsTabEnabled(iItem)); - - dc.Detach(); -} - -////////////////// -// Draw tab text. You can override to use different color/font. -// -void CMyTabCtrl::OnDrawText(CDC& dc, CRect rc, - CString sText, BOOL bDisabled) -{ - dc.SetTextColor(GetSysColor(bDisabled ? COLOR_3DHILIGHT : COLOR_BTNTEXT)); - dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER); - - if (bDisabled) { - // disabled: draw again shifted northwest for shadow effect - rc += CPoint(-1,-1); - dc.SetTextColor(GetSysColor(COLOR_GRAYTEXT)); - dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER); - } -} - -////////////////// -// Selection is changing: disallow if tab is disabled -// -void CMyTabCtrl::OnSelChanging(NMHDR* pnmh, LRESULT* pRes) -{ - TRACE("CMyTabCtrl::OnSelChanging\n"); - - // Figure out index of new tab we are about to go to, as opposed - // to the current one we're at. Believe it or not, Windows doesn't - // pass this info - // - TC_HITTESTINFO htinfo; - GetCursorPos(&htinfo.pt); - ScreenToClient(&htinfo.pt); - int iNewTab = HitTest(&htinfo); - - if (iNewTab >= 0 && !IsTabEnabled(iNewTab)) - *pRes = TRUE; // tab disabled: prevent selection -} - -////////////////// -// Trap arrow-left key to skip disabled tabs. -// This is the only way to know where we're coming from--ie from -// arrow-left (prev) or arrow-right (next). -// -BOOL CMyTabCtrl::PreTranslateMessage(MSG* pMsg) -{ - if (pMsg->message == WM_KEYDOWN && - (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { - - int iNewTab = (pMsg->wParam == VK_LEFT) ? - PrevEnabledTab(GetCurSel(), FALSE) : - NextEnabledTab(GetCurSel(), FALSE); - if (iNewTab >= 0) - SetActiveTab(iNewTab); - return TRUE; - } - return CTabCtrl::PreTranslateMessage(pMsg); -} - -//////////////// -// Translate parent property sheet message. Translates Control-Tab and -// Control-Shift-Tab keys. These are normally handled by the property -// sheet, so you must call this function from your prop sheet's -// PreTranslateMessage function. -// -BOOL CMyTabCtrl::TranslatePropSheetMsg(MSG* pMsg) -{ - WPARAM key = pMsg->wParam; - if (pMsg->message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 && - (key == VK_TAB || key == VK_PRIOR || key == VK_NEXT)) { - - int iNewTab = (key==VK_PRIOR || GetAsyncKeyState(VK_SHIFT) < 0) ? - PrevEnabledTab(GetCurSel(), TRUE) : - NextEnabledTab(GetCurSel(), TRUE); - if (iNewTab >= 0) - SetActiveTab(iNewTab); - return TRUE; - } - return FALSE; -} - -////////////////// -// Helper to set the active page, when moving backwards (left-arrow and -// Control-Shift-Tab). Must simulate Windows messages to tell parent I -// am changing the tab; SetCurSel does not do this!! -// -// In normal operation, this fn will always succeed, because I don't call it -// unless I already know IsTabEnabled() = TRUE; but if you call SetActiveTab -// with a random value, it could fail. -// -BOOL CMyTabCtrl::SetActiveTab(UINT iNewTab) -{ - TRACE("CMyTabCtrl::SetActiveTab\n"); - - // send the parent TCN_SELCHANGING - NMHDR nmh; - nmh.hwndFrom = m_hWnd; - nmh.idFrom = GetDlgCtrlID(); - nmh.code = TCN_SELCHANGING; - - if (GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh) >=0) { - // OK to change: set the new tab - SetCurSel(iNewTab); - - // send parent TCN_SELCHANGE - nmh.code = TCN_SELCHANGE; - GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh); - return TRUE; - } - return FALSE; -} - -///////////////// -// Return the index of the next enabled tab after a given index, or -1 if none -// (0 = first tab). -// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero. -// -int CMyTabCtrl::NextEnabledTab(int iCurrentTab, BOOL bWrap) -{ - int nTabs = GetItemCount(); - for (int iTab = iCurrentTab+1; iTab != iCurrentTab; iTab++) { - if (iTab >= nTabs) { - if (!bWrap) - return -1; - iTab = 0; - } - if (IsTabEnabled(iTab)) { - return iTab; - } - } - return -1; -} - -///////////////// -// Return the index of the previous enabled tab before a given index, or -1. -// (0 = first tab). -// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero. -// -int CMyTabCtrl::PrevEnabledTab(int iCurrentTab, BOOL bWrap) -{ - for (int iTab = iCurrentTab-1; iTab != iCurrentTab; iTab--) { - if (iTab < 0) { - if (!bWrap) - return -1; - iTab = GetItemCount() - 1; - } - if (IsTabEnabled(iTab)) { - return iTab; - } - } - return -1; -} - - -void CMyTabCtrl::OnSwitchTabs(void) -{ - CRect clientRect, wndRect; - int i; - - GetClientRect(clientRect); - AdjustRect(FALSE, clientRect); - GetWindowRect(wndRect); - GetParent()->ScreenToClient(wndRect); - clientRect.OffsetRect(wndRect.left, wndRect.top); - - if(lanlink.active==0) - SetCurSel(0); - - for(i=0;i<3;i++){ - if(i==GetCurSel()){ - m_tabdialog[i]->SetWindowPos(&wndTop, clientRect.left, clientRect.top, clientRect.Width(), clientRect.Height(), SWP_SHOWWINDOW); - } else { - m_tabdialog[i]->ShowWindow(SW_HIDE); - } - } - return; -} - - -void LinkOptions::OnOk() -{ - GetAllData((LinkGeneral*)m_tabctrl.m_tabdialog[0]); - CDialog::OnOK(); - return; -} - -void LinkGeneral::OnRadio1() -{ - m_type = 0; - lanlink.active = 0; - GetParent()->Invalidate(); -} - -void LinkGeneral::OnRadio2() -{ - m_type = 1; - lanlink.active = 1; - GetParent()->Invalidate(); -} - -BOOL LinkGeneral::OnInitDialog(){ - - char timeout[6]; - - CDialog::OnInitDialog(); - - m_timeout.LimitText(5); - sprintf(timeout, "%d", linktimeout); - m_timeout.SetWindowText(timeout); - - m_type = lanlink.active; - - UpdateData(FALSE); - - return TRUE; -} - - -void LinkOptions::OnCancel() -{ - CDialog::OnCancel(); - return; -} - -void LinkServer::OnServerStart() -{ - int errorcode; - ServerWait dlg; - - UpdateData(TRUE); - - lanlink.numgbas = m_numplayers+1; - lanlink.type = m_prottype; - lanlink.server = 1; - lanlink.speed = m_speed==1 ? true : false; - lspeed = lanlink.speed; - - if((errorcode=ls.Init(&dlg))!=0){ - char message[50]; - sprintf(message, "Error %d occured.\nPlease try again.", errorcode); - MessageBox(message, "Error", MB_OK); - return; - } - - dlg.DoModal(); - - return; -} - -BOOL LinkClient::OnInitDialog() -{ - CDialog::OnInitDialog(); - - m_prottype = lanlink.type; - m_hacks = lanlink.speed; - - UpdateData(FALSE); - - return TRUE; -} - -void LinkClient::OnLinkConnect() -{ - char ipaddress[31]; - int errorcode; - ServerWait dlg; - - UpdateData(TRUE); - - lanlink.type = m_prottype; - lanlink.server = 0; - lanlink.speed = m_hacks==1 ? true : false; - lspeed = lanlink.speed; - - m_serverip.GetWindowText(ipaddress, 30); - - if((errorcode=lc.Init(gethostbyname(ipaddress), &dlg))!=0){ - char message[50]; - sprintf(message, "Error %d occured.\nPlease try again.", errorcode); - MessageBox(message, "Error", MB_OK); - return; - } - dlg.DoModal(); - return; -} - -void LinkOptions::GetAllData(LinkGeneral *src) -{ - char timeout[6]; - - src->UpdateData(true); - - src->m_timeout.GetWindowText(timeout, 5); - sscanf(timeout, "%d", &linktimeout); - - if(src->m_type==0){ - lanlink.speed = 0; - lspeed = 0; - } - - return; -} -///////////////////////////////////////////////////////////////////////////// -// ServerWait dialog - - -ServerWait::ServerWait(CWnd* pParent /*=NULL*/) - : CDialog(ServerWait::IDD, pParent) -{ - //{{AFX_DATA_INIT(ServerWait) - m_serveraddress = _T(""); - m_plconn[0] = _T(""); - m_plconn[1] = _T(""); - m_plconn[2] = _T(""); - //}}AFX_DATA_INIT -} - - -void ServerWait::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(ServerWait) - DDX_Control(pDX, IDC_SERVERWAIT, m_prgctrl); - DDX_Text(pDX, IDC_STATIC1, m_serveraddress); - DDX_Text(pDX, IDC_STATIC2, m_plconn[0]); - DDX_Text(pDX, IDC_STATIC3, m_plconn[1]); - DDX_Text(pDX, IDC_STATIC4, m_plconn[2]); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(ServerWait, CDialog) - //{{AFX_MSG_MAP(ServerWait) - ON_BN_CLICKED(ID_CANCEL, OnCancel) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// ServerWait message handlers - -void ServerWait::OnCancel() -{ - lanlink.terminate = true; - CDialog::OnCancel(); -} - -BOOL LinkGeneral::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message==WM_KEYDOWN) - if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) - pMsg->wParam = NULL; - - return CDialog::PreTranslateMessage(pMsg); -} - -BOOL LinkClient::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message==WM_KEYDOWN) - if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) - pMsg->wParam = NULL; - - return CDialog::PreTranslateMessage(pMsg); -} - -BOOL LinkServer::PreTranslateMessage(MSG* pMsg) -{ - if(pMsg->message==WM_KEYDOWN) - if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) - pMsg->wParam = NULL; - - return CDialog::PreTranslateMessage(pMsg); -} +// LinkOptions.cpp : implementation file +// + +#include "stdafx.h" +#include "vba.h" +#include "LinkOptions.h" +#include "../Link.h" + +extern int lspeed; +extern lserver ls; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// LinkOptions dialog + +CMyTabCtrl::CMyTabCtrl(){ + m_tabdialog[0] = new LinkGeneral; + m_tabdialog[1] = new LinkServer; + m_tabdialog[2] = new LinkClient; +} + +CMyTabCtrl::~CMyTabCtrl() +{ + m_tabdialog[0]->DestroyWindow(); + m_tabdialog[1]->DestroyWindow(); + m_tabdialog[2]->DestroyWindow(); + + delete m_tabdialog[0]; + delete m_tabdialog[1]; + delete m_tabdialog[2]; +} + +LinkOptions::LinkOptions(CWnd* pParent /*=NULL*/) + : CDialog(LinkOptions::IDD, pParent) +{ + //{{AFX_DATA_INIT(LinkOptions) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +void LinkOptions::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(LinkOptions) + //}}AFX_DATA_MAP +} + +BOOL LinkOptions::OnInitDialog(){ + TCITEM tabitem; + char tabtext[3][8] = {"General", "Server", "Client"}; + int i; + + CDialog::OnInitDialog(); + + m_tabctrl.SubclassDlgItem(IDC_TAB1, this); + + tabitem.mask = TCIF_TEXT; + + for(i=0;i<3;i++){ + tabitem.pszText = tabtext[i]; + m_tabctrl.InsertItem(i, &tabitem); + } + m_tabctrl.m_tabdialog[0]->Create(IDD_LINKTAB1, this); + m_tabctrl.m_tabdialog[1]->Create(IDD_LINKTAB2, this); + m_tabctrl.m_tabdialog[2]->Create(IDD_LINKTAB3, this); + + m_tabctrl.m_tabdialog[0]->ShowWindow(SW_SHOW); + m_tabctrl.m_tabdialog[1]->ShowWindow(SW_HIDE); + m_tabctrl.m_tabdialog[2]->ShowWindow(SW_HIDE); + + m_tabctrl.SetCurSel(0); + m_tabctrl.OnSwitchTabs(); + + return TRUE; +} + + + BOOL LinkOptions::PreTranslateMessage(MSG* pMsg) + { + return m_tabctrl.TranslatePropSheetMsg(pMsg) ? TRUE : + CDialog::PreTranslateMessage(pMsg); + } + + + + +BEGIN_MESSAGE_MAP(LinkOptions, CDialog) + //{{AFX_MSG_MAP(LinkOptions) + ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1) + ON_BN_CLICKED(ID_OK, OnOk) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// LinkOptions message handlers +///////////////////////////////////////////////////////////////////////////// +// LinkGeneral dialog + + +LinkGeneral::LinkGeneral(CWnd* pParent /*=NULL*/) + : CDialog(LinkGeneral::IDD, pParent) +{ + //{{AFX_DATA_INIT(LinkGeneral) + //}}AFX_DATA_INIT +} + +void LinkGeneral::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(LinkGeneral) + DDX_Radio(pDX, IDC_LINK_SINGLE, m_type); + DDX_Control(pDX, IDC_LINKTIMEOUT, m_timeout); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(LinkGeneral, CDialog) + //{{AFX_MSG_MAP(LinkGeneral) + ON_BN_CLICKED(IDC_LINK_SINGLE, OnRadio1) + ON_BN_CLICKED(IDC_LINK_LAN, OnRadio2) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// LinkGeneral message handlers +///////////////////////////////////////////////////////////////////////////// +// LinkServer dialog + + +LinkServer::LinkServer(CWnd* pParent /*=NULL*/) + : CDialog(LinkServer::IDD, pParent) +{ + //{{AFX_DATA_INIT(LinkServer) + m_numplayers = -1; + m_prottype = -1; + m_speed = FALSE; + //}}AFX_DATA_INIT +} + + +void LinkServer::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(LinkServer) + DDX_Radio(pDX, IDC_LINK2P, m_numplayers); + DDX_Radio(pDX, IDC_LINKTCP, m_prottype); + DDX_Check(pDX, IDC_SSPEED, m_speed); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(LinkServer, CDialog) + //{{AFX_MSG_MAP(LinkServer) + ON_BN_CLICKED(IDC_SERVERSTART, OnServerStart) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// LinkServer message handlers + +LinkClient::LinkClient(CWnd* pParent /*=NULL*/) + : CDialog(LinkClient::IDD, pParent) +{ + //{{AFX_DATA_INIT(LinkClient) + m_prottype = -1; + m_hacks = -1; + //}}AFX_DATA_INIT +} + + +void LinkClient::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(LinkClient) + DDX_Control(pDX, IDC_SERVERIP, m_serverip); + DDX_Radio(pDX, IDC_CLINKTCP, m_prottype); + DDX_Radio(pDX, IDC_SPEEDOFF, m_hacks); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(LinkClient, CDialog) + //{{AFX_MSG_MAP(LinkClient) + ON_BN_CLICKED(IDC_LINKCONNECT, OnLinkConnect) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// LinkClient message handlers + +BOOL LinkServer::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_numplayers = lanlink.numgbas; + m_prottype = lanlink.type; + m_speed = lanlink.speed; + + UpdateData(FALSE); + + return TRUE; +} + +void LinkOptions::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) +{ + m_tabctrl.OnSwitchTabs(); + *pResult = 0; +} + +IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl) +BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl) + ON_NOTIFY_REFLECT(TCN_SELCHANGING, OnSelChanging) +END_MESSAGE_MAP() + +BOOL CMyTabCtrl::SubclassDlgItem(UINT nID, CWnd* pParent) +{ + if (!CTabCtrl::SubclassDlgItem(nID, pParent)) + return FALSE; + + ModifyStyle(0, TCS_OWNERDRAWFIXED); + + // If first tab is disabled, go to next enabled tab + if (!IsTabEnabled(0)) { + int iTab = NextEnabledTab(0, TRUE); + SetActiveTab(iTab); + } + return TRUE; +} + +BOOL CMyTabCtrl::IsTabEnabled(int iTab) +{ + if (!lanlink.active && iTab > 0) + return false; + return true; +} + +////////////////// +// Draw the tab: mimic SysTabControl32, except use gray if tab is disabled +// +void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ + DRAWITEMSTRUCT& ds = *lpDrawItemStruct; + + int iItem = ds.itemID; + + // Get tab item info + char text[128]; + TCITEM tci; + tci.mask = TCIF_TEXT; + tci.pszText = text; + tci.cchTextMax = sizeof(text); + GetItem(iItem, &tci); + + // use draw item DC + CDC dc; + dc.Attach(ds.hDC); + + // calculate text rectangle and color + CRect rc = ds.rcItem; + rc += CPoint(1,4); // ?? by trial and error + + // draw the text + OnDrawText(dc, rc, text, !IsTabEnabled(iItem)); + + dc.Detach(); +} + +////////////////// +// Draw tab text. You can override to use different color/font. +// +void CMyTabCtrl::OnDrawText(CDC& dc, CRect rc, + CString sText, BOOL bDisabled) +{ + dc.SetTextColor(GetSysColor(bDisabled ? COLOR_3DHILIGHT : COLOR_BTNTEXT)); + dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER); + + if (bDisabled) { + // disabled: draw again shifted northwest for shadow effect + rc += CPoint(-1,-1); + dc.SetTextColor(GetSysColor(COLOR_GRAYTEXT)); + dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER); + } +} + +////////////////// +// Selection is changing: disallow if tab is disabled +// +void CMyTabCtrl::OnSelChanging(NMHDR* pnmh, LRESULT* pRes) +{ + TRACE("CMyTabCtrl::OnSelChanging\n"); + + // Figure out index of new tab we are about to go to, as opposed + // to the current one we're at. Believe it or not, Windows doesn't + // pass this info + // + TC_HITTESTINFO htinfo; + GetCursorPos(&htinfo.pt); + ScreenToClient(&htinfo.pt); + int iNewTab = HitTest(&htinfo); + + if (iNewTab >= 0 && !IsTabEnabled(iNewTab)) + *pRes = TRUE; // tab disabled: prevent selection +} + +////////////////// +// Trap arrow-left key to skip disabled tabs. +// This is the only way to know where we're coming from--ie from +// arrow-left (prev) or arrow-right (next). +// +BOOL CMyTabCtrl::PreTranslateMessage(MSG* pMsg) +{ + if (pMsg->message == WM_KEYDOWN && + (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { + + int iNewTab = (pMsg->wParam == VK_LEFT) ? + PrevEnabledTab(GetCurSel(), FALSE) : + NextEnabledTab(GetCurSel(), FALSE); + if (iNewTab >= 0) + SetActiveTab(iNewTab); + return TRUE; + } + return CTabCtrl::PreTranslateMessage(pMsg); +} + +//////////////// +// Translate parent property sheet message. Translates Control-Tab and +// Control-Shift-Tab keys. These are normally handled by the property +// sheet, so you must call this function from your prop sheet's +// PreTranslateMessage function. +// +BOOL CMyTabCtrl::TranslatePropSheetMsg(MSG* pMsg) +{ + WPARAM key = pMsg->wParam; + if (pMsg->message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 && + (key == VK_TAB || key == VK_PRIOR || key == VK_NEXT)) { + + int iNewTab = (key==VK_PRIOR || GetAsyncKeyState(VK_SHIFT) < 0) ? + PrevEnabledTab(GetCurSel(), TRUE) : + NextEnabledTab(GetCurSel(), TRUE); + if (iNewTab >= 0) + SetActiveTab(iNewTab); + return TRUE; + } + return FALSE; +} + +////////////////// +// Helper to set the active page, when moving backwards (left-arrow and +// Control-Shift-Tab). Must simulate Windows messages to tell parent I +// am changing the tab; SetCurSel does not do this!! +// +// In normal operation, this fn will always succeed, because I don't call it +// unless I already know IsTabEnabled() = TRUE; but if you call SetActiveTab +// with a random value, it could fail. +// +BOOL CMyTabCtrl::SetActiveTab(UINT iNewTab) +{ + TRACE("CMyTabCtrl::SetActiveTab\n"); + + // send the parent TCN_SELCHANGING + NMHDR nmh; + nmh.hwndFrom = m_hWnd; + nmh.idFrom = GetDlgCtrlID(); + nmh.code = TCN_SELCHANGING; + + if (GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh) >=0) { + // OK to change: set the new tab + SetCurSel(iNewTab); + + // send parent TCN_SELCHANGE + nmh.code = TCN_SELCHANGE; + GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh); + return TRUE; + } + return FALSE; +} + +///////////////// +// Return the index of the next enabled tab after a given index, or -1 if none +// (0 = first tab). +// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero. +// +int CMyTabCtrl::NextEnabledTab(int iCurrentTab, BOOL bWrap) +{ + int nTabs = GetItemCount(); + for (int iTab = iCurrentTab+1; iTab != iCurrentTab; iTab++) { + if (iTab >= nTabs) { + if (!bWrap) + return -1; + iTab = 0; + } + if (IsTabEnabled(iTab)) { + return iTab; + } + } + return -1; +} + +///////////////// +// Return the index of the previous enabled tab before a given index, or -1. +// (0 = first tab). +// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero. +// +int CMyTabCtrl::PrevEnabledTab(int iCurrentTab, BOOL bWrap) +{ + for (int iTab = iCurrentTab-1; iTab != iCurrentTab; iTab--) { + if (iTab < 0) { + if (!bWrap) + return -1; + iTab = GetItemCount() - 1; + } + if (IsTabEnabled(iTab)) { + return iTab; + } + } + return -1; +} + + +void CMyTabCtrl::OnSwitchTabs(void) +{ + CRect clientRect, wndRect; + int i; + + GetClientRect(clientRect); + AdjustRect(FALSE, clientRect); + GetWindowRect(wndRect); + GetParent()->ScreenToClient(wndRect); + clientRect.OffsetRect(wndRect.left, wndRect.top); + + if(lanlink.active==0) + SetCurSel(0); + + for(i=0;i<3;i++){ + if(i==GetCurSel()){ + m_tabdialog[i]->SetWindowPos(&wndTop, clientRect.left, clientRect.top, clientRect.Width(), clientRect.Height(), SWP_SHOWWINDOW); + } else { + m_tabdialog[i]->ShowWindow(SW_HIDE); + } + } + return; +} + + +void LinkOptions::OnOk() +{ + GetAllData((LinkGeneral*)m_tabctrl.m_tabdialog[0]); + CDialog::OnOK(); + return; +} + +void LinkGeneral::OnRadio1() +{ + m_type = 0; + lanlink.active = 0; + GetParent()->Invalidate(); +} + +void LinkGeneral::OnRadio2() +{ + m_type = 1; + lanlink.active = 1; + GetParent()->Invalidate(); +} + +BOOL LinkGeneral::OnInitDialog(){ + + char timeout[6]; + + CDialog::OnInitDialog(); + + m_timeout.LimitText(5); + sprintf(timeout, "%d", linktimeout); + m_timeout.SetWindowText(timeout); + + m_type = lanlink.active; + + UpdateData(FALSE); + + return TRUE; +} + + +void LinkOptions::OnCancel() +{ + CDialog::OnCancel(); + return; +} + +void LinkServer::OnServerStart() +{ + int errorcode; + ServerWait dlg; + + UpdateData(TRUE); + + lanlink.numgbas = m_numplayers+1; + lanlink.type = m_prottype; + lanlink.server = 1; + lanlink.speed = m_speed==1 ? true : false; + lspeed = lanlink.speed; + + if((errorcode=ls.Init(&dlg))!=0){ + char message[50]; + sprintf(message, "Error %d occured.\nPlease try again.", errorcode); + MessageBox(message, "Error", MB_OK); + return; + } + + dlg.DoModal(); + + return; +} + +BOOL LinkClient::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_prottype = lanlink.type; + m_hacks = lanlink.speed; + + UpdateData(FALSE); + + return TRUE; +} + +void LinkClient::OnLinkConnect() +{ + char ipaddress[31]; + int errorcode; + ServerWait dlg; + + UpdateData(TRUE); + + lanlink.type = m_prottype; + lanlink.server = 0; + lanlink.speed = m_hacks==1 ? true : false; + lspeed = lanlink.speed; + + m_serverip.GetWindowText(ipaddress, 30); + + if((errorcode=lc.Init(gethostbyname(ipaddress), &dlg))!=0){ + char message[50]; + sprintf(message, "Error %d occured.\nPlease try again.", errorcode); + MessageBox(message, "Error", MB_OK); + return; + } + dlg.DoModal(); + return; +} + +void LinkOptions::GetAllData(LinkGeneral *src) +{ + char timeout[6]; + + src->UpdateData(true); + + src->m_timeout.GetWindowText(timeout, 5); + sscanf(timeout, "%d", &linktimeout); + + if(src->m_type==0){ + lanlink.speed = 0; + lspeed = 0; + } + + return; +} +///////////////////////////////////////////////////////////////////////////// +// ServerWait dialog + + +ServerWait::ServerWait(CWnd* pParent /*=NULL*/) + : CDialog(ServerWait::IDD, pParent) +{ + //{{AFX_DATA_INIT(ServerWait) + m_serveraddress = _T(""); + m_plconn[0] = _T(""); + m_plconn[1] = _T(""); + m_plconn[2] = _T(""); + //}}AFX_DATA_INIT +} + + +void ServerWait::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(ServerWait) + DDX_Control(pDX, IDC_SERVERWAIT, m_prgctrl); + DDX_Text(pDX, IDC_STATIC1, m_serveraddress); + DDX_Text(pDX, IDC_STATIC2, m_plconn[0]); + DDX_Text(pDX, IDC_STATIC3, m_plconn[1]); + DDX_Text(pDX, IDC_STATIC4, m_plconn[2]); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(ServerWait, CDialog) + //{{AFX_MSG_MAP(ServerWait) + ON_BN_CLICKED(ID_CANCEL, OnCancel) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// ServerWait message handlers + +void ServerWait::OnCancel() +{ + lanlink.terminate = true; + CDialog::OnCancel(); +} + +BOOL LinkGeneral::PreTranslateMessage(MSG* pMsg) +{ + if(pMsg->message==WM_KEYDOWN) + if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) + pMsg->wParam = NULL; + + return CDialog::PreTranslateMessage(pMsg); +} + +BOOL LinkClient::PreTranslateMessage(MSG* pMsg) +{ + if(pMsg->message==WM_KEYDOWN) + if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) + pMsg->wParam = NULL; + + return CDialog::PreTranslateMessage(pMsg); +} + +BOOL LinkServer::PreTranslateMessage(MSG* pMsg) +{ + if(pMsg->message==WM_KEYDOWN) + if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) + pMsg->wParam = NULL; + + return CDialog::PreTranslateMessage(pMsg); +} diff --git a/src/win32/LinkOptions.h b/src/win32/LinkOptions.h index f1ca0e8c..62f0263d 100644 --- a/src/win32/LinkOptions.h +++ b/src/win32/LinkOptions.h @@ -1,231 +1,231 @@ -#if !defined(AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_) -#define AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -// LinkOptions.h : header file -// - -class CMyTabCtrl : public CTabCtrl { - DECLARE_DYNAMIC(CMyTabCtrl) -public: - CMyTabCtrl(void); - ~CMyTabCtrl(void); - - BOOL IsTabEnabled(int iTab); // you must override - BOOL TranslatePropSheetMsg(MSG* pMsg); // call from prop sheet - BOOL SubclassDlgItem(UINT nID, CWnd* pParent); // non-virtual override - - // helpers - int NextEnabledTab(int iTab, BOOL bWrap); // get next enabled tab - int PrevEnabledTab(int iTab, BOOL bWrap); // get prev enabled tab - BOOL SetActiveTab(UINT iNewTab); // set tab (fail if disabled) - - CDialog *m_tabdialog[3]; - - void OnSwitchTabs(void); -protected: - DECLARE_MESSAGE_MAP() - afx_msg void OnSelChanging(NMHDR* pNmh, LRESULT* pRes); - - // MFC overrides - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - - // override to draw text only; eg, colored text or different font - virtual void OnDrawText(CDC& dc, CRect rc, CString sText, BOOL bDisabled); - -}; - -///////////////////////////////////////////////////////////////////////////// -// LinkGeneral dialog - -class LinkGeneral : public CDialog -{ -// Construction -public: - LinkGeneral(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(LinkGeneral) - enum { IDD = IDD_LINKTAB1 }; - int m_type; - CEdit m_timeout; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LinkGeneral) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(LinkGeneral) - virtual BOOL OnInitDialog(); - afx_msg void OnRadio1(); - afx_msg void OnRadio2(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// -// LinkOptions dialog - -class LinkOptions : public CDialog -{ -// Construction -public: - LinkOptions(CWnd* pParent = NULL); // standard constructor - void GetAllData(LinkGeneral*); -// Dialog Data - //{{AFX_DATA(LinkOptions) - enum { IDD = IDD_LINKTAB }; - CMyTabCtrl m_tabctrl; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LinkOptions) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(LinkOptions) - afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult); - virtual BOOL OnInitDialog(); - afx_msg void OnOk(); - afx_msg void OnCancel(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// -// LinkServer dialog - -class LinkServer : public CDialog -{ -// Construction -public: - LinkServer(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(LinkServer) - enum { IDD = IDD_LINKTAB2 }; - int m_numplayers; - int m_prottype; - BOOL m_speed; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LinkServer) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(LinkServer) - virtual BOOL OnInitDialog(); - afx_msg void OnServerStart(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -class LinkClient : public CDialog -{ -// Construction -public: - LinkClient(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(LinkClient) - enum { IDD = IDD_LINKTAB3 }; - CEdit m_serverip; - int m_prottype; - int m_hacks; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(LinkClient) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(LinkClient) - virtual BOOL OnInitDialog(); - afx_msg void OnLinkConnect(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// ServerWait dialog - -class ServerWait : public CDialog -{ -// Construction -public: - ServerWait(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(ServerWait) - enum { IDD = IDD_SERVERWAIT }; - CProgressCtrl m_prgctrl; - CString m_serveraddress; - CString m_plconn[3]; - //CString m_p2conn; - //CString m_p3conn; - //}}AFX_DATA - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(ServerWait) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - afx_msg void OnCancel(); - //}}AFX_VIRTUAL - -// Implementation -protected: - - // Generated message map functions - //{{AFX_MSG(ServerWait) - // NOTE: the ClassWizard will add 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_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_) +#if !defined(AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_) +#define AFX_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// LinkOptions.h : header file +// + +class CMyTabCtrl : public CTabCtrl { + DECLARE_DYNAMIC(CMyTabCtrl) +public: + CMyTabCtrl(void); + ~CMyTabCtrl(void); + + BOOL IsTabEnabled(int iTab); // you must override + BOOL TranslatePropSheetMsg(MSG* pMsg); // call from prop sheet + BOOL SubclassDlgItem(UINT nID, CWnd* pParent); // non-virtual override + + // helpers + int NextEnabledTab(int iTab, BOOL bWrap); // get next enabled tab + int PrevEnabledTab(int iTab, BOOL bWrap); // get prev enabled tab + BOOL SetActiveTab(UINT iNewTab); // set tab (fail if disabled) + + CDialog *m_tabdialog[3]; + + void OnSwitchTabs(void); +protected: + DECLARE_MESSAGE_MAP() + afx_msg void OnSelChanging(NMHDR* pNmh, LRESULT* pRes); + + // MFC overrides + virtual BOOL PreTranslateMessage(MSG* pMsg); + virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + + // override to draw text only; eg, colored text or different font + virtual void OnDrawText(CDC& dc, CRect rc, CString sText, BOOL bDisabled); + +}; + +///////////////////////////////////////////////////////////////////////////// +// LinkGeneral dialog + +class LinkGeneral : public CDialog +{ +// Construction +public: + LinkGeneral(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(LinkGeneral) + enum { IDD = IDD_LINKTAB1 }; + int m_type; + CEdit m_timeout; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(LinkGeneral) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(LinkGeneral) + virtual BOOL OnInitDialog(); + afx_msg void OnRadio1(); + afx_msg void OnRadio2(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +// LinkOptions dialog + +class LinkOptions : public CDialog +{ +// Construction +public: + LinkOptions(CWnd* pParent = NULL); // standard constructor + void GetAllData(LinkGeneral*); +// Dialog Data + //{{AFX_DATA(LinkOptions) + enum { IDD = IDD_LINKTAB }; + CMyTabCtrl m_tabctrl; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(LinkOptions) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(LinkOptions) + afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult); + virtual BOOL OnInitDialog(); + afx_msg void OnOk(); + afx_msg void OnCancel(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +// LinkServer dialog + +class LinkServer : public CDialog +{ +// Construction +public: + LinkServer(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(LinkServer) + enum { IDD = IDD_LINKTAB2 }; + int m_numplayers; + int m_prottype; + BOOL m_speed; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(LinkServer) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(LinkServer) + virtual BOOL OnInitDialog(); + afx_msg void OnServerStart(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +class LinkClient : public CDialog +{ +// Construction +public: + LinkClient(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(LinkClient) + enum { IDD = IDD_LINKTAB3 }; + CEdit m_serverip; + int m_prottype; + int m_hacks; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(LinkClient) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(LinkClient) + virtual BOOL OnInitDialog(); + afx_msg void OnLinkConnect(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +// ServerWait dialog + +class ServerWait : public CDialog +{ +// Construction +public: + ServerWait(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(ServerWait) + enum { IDD = IDD_SERVERWAIT }; + CProgressCtrl m_prgctrl; + CString m_serveraddress; + CString m_plconn[3]; + //CString m_p2conn; + //CString m_p3conn; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(ServerWait) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + afx_msg void OnCancel(); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(ServerWait) + // NOTE: the ClassWizard will add 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_LINKOPTIONS_H__55E28DAC_10CC_4AB4_9FAC_B036AA8017D3__INCLUDED_) diff --git a/src/win32/Logging.cpp b/src/win32/Logging.cpp index 2739d573..bc243b50 100644 --- a/src/win32/Logging.cpp +++ b/src/win32/Logging.cpp @@ -98,70 +98,70 @@ BEGIN_MESSAGE_MAP(Logging, CDialog) ///////////////////////////////////////////////////////////////////////////// // Logging message handlers -void Logging::OnOk() +void Logging::OnOk() { EndDialog(TRUE); instance = NULL; } -void Logging::OnClear() +void Logging::OnClear() { text = ""; m_log.SetWindowText(""); } -void Logging::OnVerboseAgbprint() +void Logging::OnVerboseAgbprint() { systemVerbose ^= 512; } -void Logging::OnVerboseDma0() +void Logging::OnVerboseDma0() { systemVerbose ^= 16; } -void Logging::OnVerboseDma1() +void Logging::OnVerboseDma1() { systemVerbose ^= 32; } -void Logging::OnVerboseDma2() +void Logging::OnVerboseDma2() { systemVerbose ^= 64; } -void Logging::OnVerboseDma3() +void Logging::OnVerboseDma3() { systemVerbose ^= 128; } -void Logging::OnVerboseIllegalRead() +void Logging::OnVerboseIllegalRead() { systemVerbose ^= 8; } -void Logging::OnVerboseIllegalWrite() +void Logging::OnVerboseIllegalWrite() { systemVerbose ^= 4; } -void Logging::OnVerboseSwi() +void Logging::OnVerboseSwi() { systemVerbose ^= 1; } -void Logging::OnVerboseUnalignedAccess() +void Logging::OnVerboseUnalignedAccess() { systemVerbose ^= 2; } -void Logging::OnVerboseUndefined() +void Logging::OnVerboseUndefined() { systemVerbose ^= 256; } -void Logging::OnSave() +void Logging::OnSave() { int len = m_log.GetWindowTextLength(); @@ -186,25 +186,25 @@ void Logging::OnSave() free(mem); } -void Logging::OnErrspaceLog() +void Logging::OnErrspaceLog() { systemMessage(0, "Error allocating space"); } -void Logging::OnMaxtextLog() +void Logging::OnMaxtextLog() { systemMessage(0, "Max text length reached %d", m_log.GetLimitText()); } -void Logging::PostNcDestroy() +void Logging::PostNcDestroy() { delete this; } -BOOL Logging::OnInitDialog() +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) @@ -230,7 +230,7 @@ BOOL Logging::OnInitDialog() 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 } @@ -242,12 +242,12 @@ void Logging::log(const char *s) m_log.ReplaceSel(s); } -void Logging::OnClose() +void Logging::OnClose() { EndDialog(FALSE); instance = NULL; - + CDialog::OnClose(); } diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 27bc1051..6467b823 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -456,7 +456,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ///////////////////////////////////////////////////////////////////////////// // MainWnd message handlers -void MainWnd::OnClose() +void MainWnd::OnClose() { emulating = false; CWnd::OnClose(); @@ -473,17 +473,17 @@ bool MainWnd::FileRun() writeBatteryFile(); cheatSearchCleanup(&cheatSearchData); theApp.emulator.emuCleanUp(); - remoteCleanUp(); - emulating = false; + remoteCleanUp(); + emulating = false; #ifdef APU_LOGGER_H end_apu_log(); #endif } char tempName[2048]; char file[2048]; - + utilGetBaseName(theApp.szFile, tempName); - + _fullpath(file, tempName, 1024); theApp.filename = file; @@ -492,7 +492,7 @@ bool MainWnd::FileRun() theApp.filename = theApp.filename.Left(index); CString ipsname; - ipsname.Format("%s.ips", theApp.filename); + ipsname.Format("%s.ips", theApp.filename); if(!theApp.dir.GetLength()) { int index = theApp.filename.ReverseFind('\\'); @@ -528,15 +528,15 @@ bool MainWnd::FileRun() char *p = strrchr(tempName, '\\'); if(p) *p = 0; - + strcat(tempName, "\\DMG_ROM.bin"); skipBios = theApp.skipBiosFile ? true : false; gbCPUInit(tempName, theApp.useBiosFile ? true : false); } - - + + gbReset(); theApp.emulator = GBSystem; gbBorderOn = theApp.winGbBorderOn; @@ -559,7 +559,7 @@ bool MainWnd::FileRun() return false; theApp.romSize = size; - + flashSetSize(theApp.winFlashSize); rtcEnable(theApp.winRtcEnable); cpuSaveType = theApp.winSaveType; @@ -569,13 +569,13 @@ bool MainWnd::FileRun() 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, @@ -602,14 +602,14 @@ bool MainWnd::FileRun() tempName); if(i != (UINT)-1) doMirroring (i == 0 ? false : true); - + 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); @@ -618,7 +618,7 @@ bool MainWnd::FileRun() } } } - + if(theApp.soundInitialized) { if(theApp.cartridgeType == 1) gbSoundReset(); @@ -644,7 +644,7 @@ bool MainWnd::FileRun() if(theApp.autoSaveLoadCheatList) winLoadCheatListDefault(); - + theApp.addRecentFile(theApp.szFile); theApp.updateWindowSize(theApp.videoOption); @@ -653,7 +653,7 @@ bool MainWnd::FileRun() if(theApp.autoHideMenu && theApp.videoOption > VIDEO_4X && theApp.menuToggle) OnFileTogglemenu(); - + emulating = true; if(theApp.autoLoadMostRecent) @@ -666,19 +666,19 @@ bool MainWnd::FileRun() theApp.rewindCount = 0; theApp.rewindCounter = 0; theApp.rewindSaveNeeded = false; - + return true; } -void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) +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; @@ -699,14 +699,14 @@ void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) } } } - + 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) { @@ -725,7 +725,7 @@ void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) 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) { @@ -739,15 +739,15 @@ void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) } } -void MainWnd::OnMove(int x, int y) +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; @@ -759,10 +759,10 @@ void MainWnd::OnMove(int x, int y) } } -void MainWnd::OnSize(UINT nType, int cx, int cy) +void MainWnd::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); - + if(!theApp.changingVideoSize) { if(this) { if(!IsIconic()) { @@ -786,7 +786,7 @@ void MainWnd::OnSize(UINT nType, int cx, int cy) soundPause(); } } - theApp.iconic = true; + theApp.iconic = true; } } } @@ -987,7 +987,7 @@ CString MainWnd::winLoadFilter(UINT id) { CString res = winResLoadString(id); res.Replace('_','|'); - + return res; } @@ -1005,7 +1005,7 @@ bool MainWnd::writeSaveGame(const char *name) return false; } -void MainWnd::OnContextMenu(CWnd* pWnd, CPoint point) +void MainWnd::OnContextMenu(CWnd* pWnd, CPoint point) { winMouseOn(); if(theApp.skin) { @@ -1075,7 +1075,7 @@ bool MainWnd::fileOpenSelect( bool gb ) } else { initialDir = regQueryStringValue( _T("romdir"), _T(".") ); } - + if( initialDir[0] == '.' ) { // handle as relative path char baseDir[MAX_PATH+1]; @@ -1098,9 +1098,9 @@ bool MainWnd::fileOpenSelect( bool gb ) selectedFilter = 0; } } - + theApp.szFile = _T(""); - + LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") }; CString filter; CString title; @@ -1130,10 +1130,10 @@ bool MainWnd::fileOpenSelect( bool gb ) } -void MainWnd::OnPaint() +void MainWnd::OnPaint() { CPaintDC dc(this); // device context for painting - + if(emulating) { theApp.painting = true; systemDrawScreen(); @@ -1142,7 +1142,7 @@ void MainWnd::OnPaint() } } -BOOL MainWnd::PreTranslateMessage(MSG* pMsg) +BOOL MainWnd::PreTranslateMessage(MSG* pMsg) { if (CWnd::PreTranslateMessage(pMsg)) return TRUE; @@ -1150,14 +1150,14 @@ BOOL MainWnd::PreTranslateMessage(MSG* pMsg) if(pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) { return theApp.hAccel != NULL && ::TranslateAccelerator(m_hWnd, theApp.hAccel, pMsg); } - + return FALSE; } void MainWnd::screenCapture(int captureNumber) { CString buffer; - + CString captureDir = regQueryStringValue("captureDir", ""); if( captureDir[0] == '.' ) { // handle as relative path @@ -1170,20 +1170,20 @@ void MainWnd::screenCapture(int captureNumber) captureDir = baseDir; } 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, @@ -1224,24 +1224,24 @@ void MainWnd::winMouseOn() theApp.mouseCounter = 0; } -void MainWnd::OnMouseMove(UINT nFlags, CPoint point) +void MainWnd::OnMouseMove(UINT nFlags, CPoint point) { winMouseOn(); - + CWnd::OnMouseMove(nFlags, point); } -void MainWnd::OnInitMenu(CMenu* pMenu) +void MainWnd::OnInitMenu(CMenu* pMenu) { CWnd::OnInitMenu(pMenu); - - soundPause(); + + soundPause(); } -void MainWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) +void MainWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) { CWnd::OnActivate(nState, pWndOther, bMinimized); - + bool a = (nState == WA_ACTIVE) || (nState == WA_CLICKACTIVE); if(a && theApp.input) { @@ -1261,7 +1261,7 @@ void MainWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) theApp.active = a; } - memset(theApp.delta,255,sizeof(theApp.delta)); + memset(theApp.delta,255,sizeof(theApp.delta)); } if(theApp.paused && emulating) @@ -1280,7 +1280,7 @@ void MainWnd::OnActivateApp(BOOL bActive, DWORD hTask) #endif { CWnd::OnActivateApp(bActive, hTask); - + if(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) { if(bActive) { if(theApp.display) @@ -1289,7 +1289,7 @@ void MainWnd::OnActivateApp(BOOL bActive, DWORD hTask) } } -void MainWnd::OnDropFiles(HDROP hDropInfo) +void MainWnd::OnDropFiles(HDROP hDropInfo) { char szFile[1024]; diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index 9931357c..23fb1c8c 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -204,7 +204,7 @@ class MainWnd : public CWnd afx_msg void OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoRenderoptionsGlanisotropic(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGlanisotropic(); - + afx_msg void OnOptionsVideoRenderoptionsGltriangle(); afx_msg void OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGlquads(); @@ -419,13 +419,13 @@ class MainWnd : public CWnd afx_msg void OnHelpGnupubliclicense(); //}}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 void OnOptionsFilterLcdcolors(); afx_msg void OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI); - + afx_msg BOOL OnOptionsSoundPcminterpolation(UINT nID); afx_msg void OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI); public: diff --git a/src/win32/MainWndCheats.cpp b/src/win32/MainWndCheats.cpp index 90df14bf..2c343ce0 100644 --- a/src/win32/MainWndCheats.cpp +++ b/src/win32/MainWndCheats.cpp @@ -31,7 +31,7 @@ extern int emulating; -void MainWnd::OnCheatsSearchforcheats() +void MainWnd::OnCheatsSearchforcheats() { theApp.winCheckFullscreen(); if(theApp.cartridgeType == 0) { @@ -43,12 +43,12 @@ void MainWnd::OnCheatsSearchforcheats() } } -void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnCheatsCheatlist() +void MainWnd::OnCheatsCheatlist() { theApp.winCheckFullscreen(); if(theApp.cartridgeType == 0) { @@ -60,22 +60,22 @@ void MainWnd::OnCheatsCheatlist() } } -void MainWnd::OnUpdateCheatsCheatlist(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsCheatlist(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnCheatsAutomaticsaveloadcheats() +void MainWnd::OnCheatsAutomaticsaveloadcheats() { theApp.autoSaveLoadCheatList = !theApp.autoSaveLoadCheatList; } -void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.autoSaveLoadCheatList); } -void MainWnd::OnCheatsLoadcheatlist() +void MainWnd::OnCheatsLoadcheatlist() { theApp.winCheckFullscreen(); CString buffer; @@ -109,12 +109,12 @@ void MainWnd::OnCheatsLoadcheatlist() } } -void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnCheatsSavecheatlist() +void MainWnd::OnCheatsSavecheatlist() { theApp.winCheckFullscreen(); CString buffer; @@ -148,17 +148,17 @@ void MainWnd::OnCheatsSavecheatlist() } } -void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnCheatsDisablecheats() +void MainWnd::OnCheatsDisablecheats() { cheatsEnabled = !cheatsEnabled; } -void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI) +void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI) { pCmdUI->SetCheck(!cheatsEnabled); } diff --git a/src/win32/MainWndFile.cpp b/src/win32/MainWndFile.cpp index a5c0e6e4..133c119d 100644 --- a/src/win32/MainWndFile.cpp +++ b/src/win32/MainWndFile.cpp @@ -42,7 +42,7 @@ extern void remoteCleanUp(); extern void InterframeCleanup(); -void MainWnd::OnFileOpen() +void MainWnd::OnFileOpen() { theApp.winCheckFullscreen(); if( fileOpenSelect( false ) ) { @@ -51,7 +51,7 @@ void MainWnd::OnFileOpen() } -void MainWnd::OnFilePause() +void MainWnd::OnFilePause() { theApp.paused = !theApp.paused; if(emulating) { @@ -64,12 +64,12 @@ void MainWnd::OnFilePause() } } -void MainWnd::OnUpdateFilePause(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFilePause(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.paused); + pCmdUI->SetCheck(theApp.paused); } -void MainWnd::OnFileReset() +void MainWnd::OnFileReset() { if(emulating) { theApp.emulator.emuReset(); @@ -77,18 +77,18 @@ void MainWnd::OnFileReset() } } -void MainWnd::OnUpdateFileReset(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileReset(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnUpdateFileRecentFreeze(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileRecentFreeze(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.recentFreeze); if(pCmdUI->m_pMenu == NULL) return; - + CMenu *pMenu = pCmdUI->m_pMenu; int i; @@ -125,24 +125,24 @@ BOOL MainWnd::OnFileRecentFile(UINT nID) return TRUE; } -void MainWnd::OnFileRecentReset() +void MainWnd::OnFileRecentReset() { int i = 0; for(i = 0; i < 10; i++) theApp.recentFiles[i] = ""; } -void MainWnd::OnFileRecentFreeze() +void MainWnd::OnFileRecentFreeze() { theApp.recentFreeze = !theApp.recentFreeze; } -void MainWnd::OnFileExit() +void MainWnd::OnFileExit() { SendMessage(WM_CLOSE); } -void MainWnd::OnFileClose() +void MainWnd::OnFileClose() { // save battery file before we change the filename... if(rom != NULL || gbRom != NULL) { @@ -158,13 +158,13 @@ void MainWnd::OnFileClose() systemSetTitle("VisualBoyAdvance"); } -void MainWnd::OnUpdateFileClose(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileClose(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } -void MainWnd::OnFileOpengameboy() +void MainWnd::OnFileOpengameboy() { theApp.winCheckFullscreen(); if( fileOpenSelect( true ) ) { @@ -173,7 +173,7 @@ void MainWnd::OnFileOpengameboy() } -void MainWnd::OnFileLoad() +void MainWnd::OnFileLoad() { theApp.winCheckFullscreen(); CString buffer; @@ -218,13 +218,13 @@ void MainWnd::OnFileLoad() theApp.rewindCount = 0; theApp.rewindCounter = 0; theApp.rewindSaveNeeded = false; - + if(res) - systemScreenMessage(winResLoadString(IDS_LOADED_STATE)); + systemScreenMessage(winResLoadString(IDS_LOADED_STATE)); } } -void MainWnd::OnUpdateFileLoad(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileLoad(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } @@ -265,7 +265,7 @@ BOOL MainWnd::OnFileLoadSlot(UINT nID) CString format = winResLoadString(IDS_LOADED_STATE_N); buffer.Format(format, nID); - + bool res = loadSaveGame(filename); if (theApp.paused) @@ -282,7 +282,7 @@ BOOL MainWnd::OnFileLoadSlot(UINT nID) return res; } -void MainWnd::OnFileSave() +void MainWnd::OnFileSave() { theApp.winCheckFullscreen(); CString buffer; @@ -324,11 +324,11 @@ void MainWnd::OnFileSave() if(dlg.DoModal() == IDOK) { bool res = writeSaveGame(dlg.GetPathName()); if(res) - systemScreenMessage(winResLoadString(IDS_WROTE_STATE)); + systemScreenMessage(winResLoadString(IDS_WROTE_STATE)); } } -void MainWnd::OnUpdateFileSave(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileSave(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); } @@ -371,15 +371,15 @@ BOOL MainWnd::OnFileSaveSlot(UINT nID) CString format = winResLoadString(IDS_WROTE_STATE_N); buffer.Format(format, nID); - + systemScreenMessage(buffer); systemDrawScreen(); - + return res; } -void MainWnd::OnFileImportBatteryfile() +void MainWnd::OnFileImportBatteryfile() { theApp.winCheckFullscreen(); LPCTSTR exts[] = { ".sav" }; @@ -402,10 +402,10 @@ void MainWnd::OnFileImportBatteryfile() saveDir = getDirFromFile(theApp.filename); FileDlg dlg(this, "", filter, 0, "", exts, saveDir, title, false); - + if(dlg.DoModal() == IDCANCEL) return; - + CString str1 = winResLoadString(IDS_SAVE_WILL_BE_LOST); CString str2 = winResLoadString(IDS_CONFIRM_ACTION); @@ -413,11 +413,11 @@ void MainWnd::OnFileImportBatteryfile() 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 { @@ -426,12 +426,12 @@ void MainWnd::OnFileImportBatteryfile() } } -void MainWnd::OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileImportGamesharkcodefile() +void MainWnd::OnFileImportGamesharkcodefile() { theApp.winCheckFullscreen(); LPCTSTR exts[] = { "" }; @@ -439,7 +439,7 @@ void MainWnd::OnFileImportGamesharkcodefile() CString title = winResLoadString(IDS_SELECT_CODE_FILE); FileDlg dlg(this, "", filter, 0, "", exts, "", title, false); - + if(dlg.DoModal() == IDCANCEL) return; @@ -450,7 +450,7 @@ void MainWnd::OnFileImportGamesharkcodefile() str2, MB_OKCANCEL) == IDCANCEL) return; - + bool res = false; CString file = dlg.GetPathName(); if(theApp.cartridgeType == 1) @@ -460,12 +460,12 @@ void MainWnd::OnFileImportGamesharkcodefile() } } -void MainWnd::OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileImportGamesharksnapshot() +void MainWnd::OnFileImportGamesharksnapshot() { theApp.winCheckFullscreen(); LPCTSTR exts[] = { ".gbs" }; @@ -473,7 +473,7 @@ void MainWnd::OnFileImportGamesharksnapshot() CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE); FileDlg dlg(this, "", filter, 0, "", exts, "", title, false); - + if(dlg.DoModal() == IDCANCEL) return; @@ -491,12 +491,12 @@ void MainWnd::OnFileImportGamesharksnapshot() CPUReadGSASnapshot(dlg.GetPathName()); } -void MainWnd::OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileExportBatteryfile() +void MainWnd::OnFileExportBatteryfile() { theApp.winCheckFullscreen(); CString name; @@ -554,19 +554,19 @@ void MainWnd::OnFileExportBatteryfile() dlg.GetPathName()); } -void MainWnd::OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileExportGamesharksnapshot() +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('\\'); @@ -577,7 +577,7 @@ void MainWnd::OnFileExportGamesharksnapshot() name = theApp.filename; LPCTSTR exts[] = {".sps" }; - + CString filter = winLoadFilter(IDS_FILTER_SPS); CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE); @@ -602,12 +602,12 @@ void MainWnd::OnFileExportGamesharksnapshot() dlg2.DoModal(); } -void MainWnd::OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating && theApp.cartridgeType == 0); + pCmdUI->Enable(emulating && theApp.cartridgeType == 0); } -void MainWnd::OnFileScreencapture() +void MainWnd::OnFileScreencapture() { theApp.winCheckFullscreen(); CString name; @@ -638,14 +638,14 @@ void MainWnd::OnFileScreencapture() 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); @@ -661,7 +661,7 @@ void MainWnd::OnFileScreencapture() if(dlg.DoModal() == IDCANCEL) return; - + if(dlg.getFilterIndex() == 2) theApp.emulator.emuWriteBMP(dlg.GetPathName()); else @@ -670,12 +670,12 @@ void MainWnd::OnFileScreencapture() systemScreenMessage(winResLoadString(IDS_SCREEN_CAPTURE)); } -void MainWnd::OnUpdateFileScreencapture(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileScreencapture(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileRominformation() +void MainWnd::OnFileRominformation() { theApp.winCheckFullscreen(); if(theApp.cartridgeType == 0) { @@ -687,16 +687,16 @@ void MainWnd::OnFileRominformation() } } -void MainWnd::OnUpdateFileRominformation(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileRominformation(CCmdUI* pCmdUI) { - pCmdUI->Enable(emulating); + pCmdUI->Enable(emulating); } -void MainWnd::OnFileTogglemenu() +void MainWnd::OnFileTogglemenu() { if(theApp.videoOption <= VIDEO_4X) return; - + theApp.menuToggle = !theApp.menuToggle; if(theApp.menuToggle) { @@ -705,7 +705,7 @@ void MainWnd::OnFileTogglemenu() if(theApp.display) theApp.display->checkFullScreen(); DrawMenuBar(); - } + } } else { SetMenu(NULL); DestroyMenu(theApp.menu); @@ -716,15 +716,15 @@ void MainWnd::OnFileTogglemenu() theApp.display->resize(theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top); } -void MainWnd::OnUpdateFileTogglemenu(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileTogglemenu(CCmdUI* pCmdUI) { - pCmdUI->Enable(theApp.videoOption > VIDEO_4X); + 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; @@ -746,7 +746,7 @@ bool MainWnd::fileImportGSACodeFile(CString& fileName) systemMessage(MSG_UNSUPPORTED_CODE_FILE, "Unsupported code file %s", fileName); return false; - } + } fseek(f, 0x1e, SEEK_SET); fread(&len, 1, 4, f); INT_PTR game = 0; @@ -757,7 +757,7 @@ bool MainWnd::fileImportGSACodeFile(CString& fileName) fclose(f); bool v3 = false; - + int index = fileName.ReverseFind('.'); if(index != -1) { @@ -768,11 +768,11 @@ bool MainWnd::fileImportGSACodeFile(CString& fileName) if(game != -1) { return cheatsImportGSACodeFile(fileName, (int)game, v3); } - + return true; } -void MainWnd::OnFileSavegameOldestslot() +void MainWnd::OnFileSavegameOldestslot() { if(!emulating) return; @@ -809,7 +809,7 @@ void MainWnd::OnFileSavegameOldestslot() CString str; time_t time = (time_t)-1; int found = 0; - + for(int i = 0; i < 10; i++) { name.Format("%s%s%d.sgm", saveDir, filename, i+1); @@ -826,7 +826,7 @@ void MainWnd::OnFileSavegameOldestslot() OnFileSaveSlot(ID_FILE_SAVEGAME_SLOT1+found); } -void MainWnd::OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); if(pCmdUI->m_pSubMenu != NULL) { @@ -873,12 +873,12 @@ void MainWnd::OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI) } pMenu->ModifyMenu(ID_FILE_SAVEGAME_SLOT1+i, MF_STRING|MF_BYCOMMAND, ID_FILE_SAVEGAME_SLOT1+i, str); } - + theApp.winAccelMgr.UpdateMenu(pMenu->GetSafeHmenu()); } } -void MainWnd::OnFileLoadgameMostrecent() +void MainWnd::OnFileLoadgameMostrecent() { if(!emulating) return; @@ -915,7 +915,7 @@ void MainWnd::OnFileLoadgameMostrecent() 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); @@ -924,14 +924,14 @@ 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) +void MainWnd::OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating); @@ -967,7 +967,7 @@ void MainWnd::OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI) CString name; CFileStatus status; CString str; - + for(int i = 0; i < 10; i++) { name.Format("%s%s%d.sgm", saveDir, filename, i+1); @@ -994,12 +994,12 @@ void MainWnd::OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI) pCmdUI->Enable(emulating); } -void MainWnd::OnFileLoadgameAutoloadmostrecent() +void MainWnd::OnFileLoadgameAutoloadmostrecent() { theApp.autoLoadMostRecent = !theApp.autoLoadMostRecent; } -void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI) +void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.autoLoadMostRecent); } diff --git a/src/win32/MainWndHelp.cpp b/src/win32/MainWndHelp.cpp index 5d04917a..1aea9e66 100644 --- a/src/win32/MainWndHelp.cpp +++ b/src/win32/MainWndHelp.cpp @@ -24,7 +24,7 @@ extern int emulating; -void MainWnd::OnHelpAbout() +void MainWnd::OnHelpAbout() { theApp.winCheckFullscreen(); AboutDialog dlg; @@ -32,21 +32,21 @@ void MainWnd::OnHelpAbout() dlg.DoModal(); } -void MainWnd::OnHelpFaq() +void MainWnd::OnHelpFaq() { - ::ShellExecute(0, _T("open"), "http://vba.ngemu.com/faq.shtml", + ::ShellExecute(0, _T("open"), "http://vba.ngemu.com/faq.shtml", 0, 0, SW_SHOWNORMAL); } -void MainWnd::OnHelpBugreport() +void MainWnd::OnHelpBugreport() { BugReport dlg(theApp.m_pMainWnd); dlg.DoModal(); } -void MainWnd::OnHelpGnupubliclicense() +void MainWnd::OnHelpGnupubliclicense() { - ::ShellExecute(0, _T("open"), "http://www.gnu.org/licenses/gpl.html", - 0, 0, SW_SHOWNORMAL); + ::ShellExecute(0, _T("open"), "http://www.gnu.org/licenses/gpl.html", + 0, 0, SW_SHOWNORMAL); } diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 44f7e731..abe281d3 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -51,78 +51,78 @@ extern int emulating; extern void CPUUpdateRenderBuffers(bool force); -void MainWnd::OnOptionsFrameskipThrottleNothrottle() +void MainWnd::OnOptionsFrameskipThrottleNothrottle() { - theApp.throttle = 0; + theApp.throttle = 0; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.throttle == 0); + pCmdUI->SetCheck(theApp.throttle == 0); } -void MainWnd::OnOptionsFrameskipThrottle25() +void MainWnd::OnOptionsFrameskipThrottle25() { - theApp.throttle = 25; + theApp.throttle = 25; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.throttle == 25); } -void MainWnd::OnOptionsFrameskipThrottle50() +void MainWnd::OnOptionsFrameskipThrottle50() { - theApp.throttle = 50; + theApp.throttle = 50; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.throttle == 50); } -void MainWnd::OnOptionsFrameskipThrottle100() +void MainWnd::OnOptionsFrameskipThrottle100() { - theApp.throttle = 100; + theApp.throttle = 100; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.throttle == 100); } -void MainWnd::OnOptionsFrameskipThrottle150() +void MainWnd::OnOptionsFrameskipThrottle150() { - theApp.throttle = 150; + theApp.throttle = 150; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.throttle == 150); } -void MainWnd::OnOptionsFrameskipThrottle200() +void MainWnd::OnOptionsFrameskipThrottle200() { - theApp.throttle = 200; + theApp.throttle = 200; theApp.autoFrameSkip = false; } -void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.throttle == 200); } -void MainWnd::OnOptionsFrameskipThrottleOther() +void MainWnd::OnOptionsFrameskipThrottleOther() { Throttle dlg; int v = (int)dlg.DoModal(); - + if( v ) { theApp.throttle = v; theApp.autoFrameSkip = false; @@ -130,7 +130,7 @@ void MainWnd::OnOptionsFrameskipThrottleOther() } -void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI) { int throttle = theApp.throttle; pCmdUI->SetCheck(throttle != 0 && throttle != 25 && @@ -138,7 +138,7 @@ void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI) throttle != 150 && throttle != 200); } -void MainWnd::OnOptionsFrameskipAutomatic() +void MainWnd::OnOptionsFrameskipAutomatic() { theApp.autoFrameSkip = !theApp.autoFrameSkip; if(!theApp.autoFrameSkip && emulating) @@ -151,9 +151,9 @@ void MainWnd::OnOptionsFrameskipAutomatic() } } -void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.autoFrameSkip); + pCmdUI->SetCheck(theApp.autoFrameSkip); } BOOL MainWnd::OnOptionsFrameskip(UINT nID) @@ -193,58 +193,58 @@ BOOL MainWnd::OnOptionsFrameskip(UINT nID) return FALSE; } -void MainWnd::OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 0 : gbFrameSkip == 0); + pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 0 : gbFrameSkip == 0); } -void MainWnd::OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 1 : gbFrameSkip == 1); } -void MainWnd::OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 2 : gbFrameSkip == 2); } -void MainWnd::OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 3 : gbFrameSkip == 3); } -void MainWnd::OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 4 : gbFrameSkip == 4); } -void MainWnd::OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 5 : gbFrameSkip == 5); } -void MainWnd::OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 6 : gbFrameSkip == 6); } -void MainWnd::OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 7 : gbFrameSkip == 7); } -void MainWnd::OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 8 : gbFrameSkip == 8); } -void MainWnd::OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.cartridgeType == IMAGE_GBA ? frameSkip == 9 : gbFrameSkip == 9); } -void MainWnd::OnOptionsVideoVsync() +void MainWnd::OnOptionsVideoVsync() { theApp.vsync = !theApp.vsync; if( theApp.display ) { @@ -253,44 +253,44 @@ void MainWnd::OnOptionsVideoVsync() } -void MainWnd::OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.vsync); } -void MainWnd::OnUpdateOptionsVideoX1(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoX1(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.videoOption == VIDEO_1X); } -void MainWnd::OnUpdateOptionsVideoX2(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoX2(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.videoOption == VIDEO_2X); } -void MainWnd::OnUpdateOptionsVideoX3(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoX3(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.videoOption == VIDEO_3X); } -void MainWnd::OnUpdateOptionsVideoX4(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoX4(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.videoOption == VIDEO_4X); } -void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.mode320Available); pCmdUI->SetCheck(theApp.videoOption == VIDEO_320x240); } -void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.mode640Available); pCmdUI->SetCheck(theApp.videoOption == VIDEO_640x480); } -void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.mode800Available); pCmdUI->SetCheck(theApp.videoOption == VIDEO_800x600); @@ -316,17 +316,17 @@ BOOL MainWnd::OnOptionVideoSize(UINT nID) } -void MainWnd::OnOptionsVideoFullscreen320x240() +void MainWnd::OnOptionsVideoFullscreen320x240() { OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN320X240); } -void MainWnd::OnOptionsVideoFullscreen640x480() +void MainWnd::OnOptionsVideoFullscreen640x480() { OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN640X480); } -void MainWnd::OnOptionsVideoFullscreen800x600() +void MainWnd::OnOptionsVideoFullscreen800x600() { OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN800X600); } @@ -341,9 +341,9 @@ void MainWnd::OnOptionsVideoFullscreen1280x1024() OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN1280X1024); } -void MainWnd::OnOptionsVideoFullscreen() +void MainWnd::OnOptionsVideoFullscreen() { - theApp.winCheckFullscreen(); + theApp.winCheckFullscreen(); GUID *pGUID = NULL; int size = theApp.display->selectFullScreenMode(&pGUID); if(size != -1) { @@ -376,25 +376,25 @@ void MainWnd::OnOptionsVideoFullscreen() theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.videoOption == VIDEO_OTHER); } -void MainWnd::OnOptionsVideoDisablesfx() +void MainWnd::OnOptionsVideoDisablesfx() { cpuDisableSfx = !cpuDisableSfx; if(emulating && theApp.cartridgeType == IMAGE_GBA) CPUUpdateRender(); } -void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI) { pCmdUI->SetCheck(cpuDisableSfx); } -void MainWnd::OnOptionsVideoFullscreenstretchtofit() +void MainWnd::OnOptionsVideoFullscreenstretchtofit() { theApp.fullScreenStretch = !theApp.fullScreenStretch; theApp.updateWindowSize( theApp.videoOption ); @@ -407,7 +407,7 @@ void MainWnd::OnOptionsVideoFullscreenstretchtofit() } -void MainWnd::OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.fullScreenStretch); } @@ -435,56 +435,56 @@ void MainWnd::OnUpdateVideoLayer(CCmdUI *pCmdUI) } } -void MainWnd::OnOptionsVideoRendermethodGdi() +void MainWnd::OnOptionsVideoRendermethodGdi() { theApp.renderMethod = GDI; theApp.updateRenderMethod(false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.renderMethod == GDI); } -void MainWnd::OnOptionsVideoRendermethodDirectdraw() +void MainWnd::OnOptionsVideoRendermethodDirectdraw() { theApp.renderMethod = DIRECT_DRAW; theApp.updateRenderMethod(false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.renderMethod == DIRECT_DRAW); } -void MainWnd::OnOptionsVideoRendermethodDirect3d() +void MainWnd::OnOptionsVideoRendermethodDirect3d() { theApp.renderMethod = DIRECT_3D; theApp.updateRenderMethod(false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D); } -void MainWnd::OnOptionsVideoRendermethodOpengl() +void MainWnd::OnOptionsVideoRendermethodOpengl() { theApp.renderMethod = OPENGL; theApp.updateRenderMethod(false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.renderMethod == OPENGL); } -void MainWnd::OnOptionsVideoTriplebuffering() +void MainWnd::OnOptionsVideoTriplebuffering() { theApp.tripleBuffering = !theApp.tripleBuffering; if( theApp.display ) { @@ -493,12 +493,12 @@ void MainWnd::OnOptionsVideoTriplebuffering() } -void MainWnd::OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.tripleBuffering); } -void MainWnd::OnOptionsVideoDdrawemulationonly() +void MainWnd::OnOptionsVideoDdrawemulationonly() { theApp.ddrawEmulationOnly = !theApp.ddrawEmulationOnly; if( theApp.display ) { @@ -507,13 +507,13 @@ void MainWnd::OnOptionsVideoDdrawemulationonly() } -void MainWnd::OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.ddrawEmulationOnly); } -void MainWnd::OnOptionsVideoDdrawusevideomemory() +void MainWnd::OnOptionsVideoDdrawusevideomemory() { theApp.ddrawUseVideoMemory = !theApp.ddrawUseVideoMemory; if( theApp.display ) { @@ -522,12 +522,12 @@ void MainWnd::OnOptionsVideoDdrawusevideomemory() } -void MainWnd::OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.ddrawUseVideoMemory); } -void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter() +void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter() { theApp.d3dFilter = 0; if( theApp.display ) { @@ -535,13 +535,13 @@ void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter() } } -void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.d3dFilter == 0); } -void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear() +void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear() { theApp.d3dFilter = 1; if( theApp.display ) { @@ -550,13 +550,13 @@ void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.d3dFilter == 1); } -void MainWnd::OnOptionsVideoRenderoptionsGlnearest() +void MainWnd::OnOptionsVideoRenderoptionsGlnearest() { theApp.glFilter = 0; if( theApp.display ) { @@ -565,13 +565,13 @@ void MainWnd::OnOptionsVideoRenderoptionsGlnearest() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.glFilter == 0); } -void MainWnd::OnOptionsVideoRenderoptionsGlbilinear() +void MainWnd::OnOptionsVideoRenderoptionsGlbilinear() { theApp.glFilter = 1; if( theApp.display ) { @@ -580,12 +580,12 @@ void MainWnd::OnOptionsVideoRenderoptionsGlbilinear() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.glFilter == 1); } -void MainWnd::OnOptionsVideoRenderoptionsGltriangle() +void MainWnd::OnOptionsVideoRenderoptionsGltriangle() { theApp.glType = 0; if( theApp.display ) { @@ -594,13 +594,13 @@ void MainWnd::OnOptionsVideoRenderoptionsGltriangle() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.glType == 0); } -void MainWnd::OnOptionsVideoRenderoptionsGlquads() +void MainWnd::OnOptionsVideoRenderoptionsGlquads() { theApp.glType = 1; if( theApp.display ) { @@ -609,7 +609,7 @@ void MainWnd::OnOptionsVideoRenderoptionsGlquads() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.glType == 1); } @@ -623,12 +623,12 @@ void MainWnd::OnOptionsVideoRenderoptionsGlpolygons() } -void MainWnd::OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.glType == 2); } -void MainWnd::OnOptionsVideoRenderoptionsSelectskin() +void MainWnd::OnOptionsVideoRenderoptionsSelectskin() { #ifndef NOSKINS LPCTSTR exts[] = {".ini" }; @@ -641,7 +641,7 @@ void MainWnd::OnOptionsVideoRenderoptionsSelectskin() 0, "INI", exts, - "", + "", title, false); @@ -651,7 +651,7 @@ void MainWnd::OnOptionsVideoRenderoptionsSelectskin() bool result = false; if(!theApp.skinEnabled) { - theApp.skinEnabled = !theApp.skinEnabled; + theApp.skinEnabled = !theApp.skinEnabled; regSetDwordValue("skinEnabled", theApp.skinEnabled); } @@ -669,13 +669,13 @@ void MainWnd::OnOptionsVideoRenderoptionsSelectskin() #endif } -void MainWnd::OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.display && theApp.display->isSkinSupported() && theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnOptionsVideoRenderoptionsSkin() +void MainWnd::OnOptionsVideoRenderoptionsSkin() { #ifndef NOSKINS theApp.skinEnabled = !theApp.skinEnabled; @@ -686,110 +686,110 @@ void MainWnd::OnOptionsVideoRenderoptionsSkin() #endif } -void MainWnd::OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.skinEnabled); pCmdUI->Enable(theApp.display && theApp.display->isSkinSupported() && theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnOptionsEmulatorAssociate() +void MainWnd::OnOptionsEmulatorAssociate() { theApp.winCheckFullscreen(); Associate dlg; dlg.DoModal(); } -void MainWnd::OnOptionsEmulatorDirectories() +void MainWnd::OnOptionsEmulatorDirectories() { theApp.winCheckFullscreen(); Directories dlg; dlg.DoModal(); } -void MainWnd::OnOptionsEmulatorDisablestatusmessages() +void MainWnd::OnOptionsEmulatorDisablestatusmessages() { theApp.disableStatusMessage = !theApp.disableStatusMessage; } -void MainWnd::OnUpdateOptionsEmulatorDisablestatusmessages(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorDisablestatusmessages(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.disableStatusMessage); } -void MainWnd::OnOptionsEmulatorSynchronize() +void MainWnd::OnOptionsEmulatorSynchronize() { synchronize = !synchronize; if (synchronize) theApp.throttle = false; } -void MainWnd::OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI) { pCmdUI->SetCheck(synchronize); } -void MainWnd::OnOptionsEmulatorPausewheninactive() +void MainWnd::OnOptionsEmulatorPausewheninactive() { theApp.pauseWhenInactive = !theApp.pauseWhenInactive; } -void MainWnd::OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.pauseWhenInactive); } -void MainWnd::OnOptionsEmulatorSpeeduptoggle() +void MainWnd::OnOptionsEmulatorSpeeduptoggle() { theApp.speedupToggle = !theApp.speedupToggle; } -void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.speedupToggle); } -void MainWnd::OnOptionsEmulatorAutomaticallyipspatch() +void MainWnd::OnOptionsEmulatorAutomaticallyipspatch() { theApp.autoIPS = !theApp.autoIPS; } -void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.autoIPS); } -void MainWnd::OnOptionsEmulatorAgbprint() +void MainWnd::OnOptionsEmulatorAgbprint() { agbPrintEnable(!agbPrintIsEnabled()); } -void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI) { pCmdUI->SetCheck(agbPrintIsEnabled()); } -void MainWnd::OnOptionsEmulatorRealtimeclock() +void MainWnd::OnOptionsEmulatorRealtimeclock() { theApp.winRtcEnable = !theApp.winRtcEnable; } -void MainWnd::OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winRtcEnable); } -void MainWnd::OnOptionsEmulatorAutohidemenu() +void MainWnd::OnOptionsEmulatorAutohidemenu() { theApp.autoHideMenu = !theApp.autoHideMenu; } -void MainWnd::OnOptionsEmulatorGenericflashcard() +void MainWnd::OnOptionsEmulatorGenericflashcard() { if(emulating && theApp.cartridgeType == IMAGE_GB) theApp.winGenericflashcardEnable = !theApp.winGenericflashcardEnable; } -void MainWnd::OnUpdateOptionsEmulatorGenericflashcard(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorGenericflashcard(CCmdUI* pCmdUI) { if(emulating && theApp.cartridgeType == IMAGE_GB) pCmdUI->SetCheck(theApp.winGenericflashcardEnable); @@ -799,17 +799,17 @@ void MainWnd::OnUpdateOptionsEmulatorGenericflashcard(CCmdUI* pCmdUI) pCmdUI->Enable(emulating && theApp.cartridgeType == IMAGE_GB); } -void MainWnd::OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.autoHideMenu); } -void MainWnd::OnOptionsEmulatorRewindinterval() +void MainWnd::OnOptionsEmulatorRewindinterval() { RewindInterval dlg(theApp.rewindTimer/6); int v = (int)dlg.DoModal(); - + if( v >= 0 ) { theApp.rewindTimer = v*6; // convert to a multiple of 10 frames regSetDwordValue("rewindTimer", v); @@ -870,115 +870,115 @@ void MainWnd::OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI) } } -void MainWnd::OnOptionsEmulatorSavetypeAutomatic() +void MainWnd::OnOptionsEmulatorSavetypeAutomatic() { theApp.winSaveType = 0; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 0); } -void MainWnd::OnOptionsEmulatorSavetypeEeprom() +void MainWnd::OnOptionsEmulatorSavetypeEeprom() { theApp.winSaveType = 1; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 1); } -void MainWnd::OnOptionsEmulatorSavetypeSram() +void MainWnd::OnOptionsEmulatorSavetypeSram() { theApp.winSaveType = 2; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 2); } -void MainWnd::OnOptionsEmulatorSavetypeFlash() +void MainWnd::OnOptionsEmulatorSavetypeFlash() { theApp.winSaveType = 3; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 3); } -void MainWnd::OnOptionsEmulatorSavetypeEepromsensor() +void MainWnd::OnOptionsEmulatorSavetypeEepromsensor() { theApp.winSaveType = 4; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 4); } -void MainWnd::OnOptionsEmulatorSavetypeNone() +void MainWnd::OnOptionsEmulatorSavetypeNone() { theApp.winSaveType = 5; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winSaveType == 5); } -void MainWnd::OnOptionsEmulatorSavetypeFlash512k() +void MainWnd::OnOptionsEmulatorSavetypeFlash512k() { flashSetSize(0x10000); theApp.winFlashSize = 0x10000; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI) { // changed theApp.winFlashSize to flashSize to reflect the actual // flashsize value used by the emu (it can change upon battery loading) pCmdUI->SetCheck(flashSize == 0x10000); } -void MainWnd::OnOptionsEmulatorSavetypeFlash1m() +void MainWnd::OnOptionsEmulatorSavetypeFlash1m() { flashSetSize(0x20000); theApp.winFlashSize = 0x20000; } -void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI) { // changed theApp.winFlashSize to flashSize to reflect the actual // flashsize value used by the emu (it can change upon battery loading) pCmdUI->SetCheck(flashSize == 0x20000); } -void MainWnd::OnOptionsEmulatorUsebiosfile() +void MainWnd::OnOptionsEmulatorUsebiosfile() { if(!theApp.biosFileName.IsEmpty()) theApp.useBiosFile = !theApp.useBiosFile; } -void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.useBiosFile); pCmdUI->Enable(!theApp.biosFileName.IsEmpty()); } -void MainWnd::OnOptionsEmulatorSkipbios() +void MainWnd::OnOptionsEmulatorSkipbios() { theApp.skipBiosFile = !theApp.skipBiosFile; } -void MainWnd::OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.skipBiosFile); } -void MainWnd::OnOptionsEmulatorSelectbiosfile() +void MainWnd::OnOptionsEmulatorSelectbiosfile() { theApp.winCheckFullscreen(); LPCTSTR exts[] = { "" }; @@ -991,59 +991,59 @@ void MainWnd::OnOptionsEmulatorSelectbiosfile() 0, "BIOS", exts, - "", + "", title, false); - + if(dlg.DoModal() == IDOK) { theApp.biosFileName = dlg.GetPathName(); } } -void MainWnd::OnOptionsEmulatorPngformat() +void MainWnd::OnOptionsEmulatorPngformat() { theApp.captureFormat = 0; } -void MainWnd::OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.captureFormat == 0); } -void MainWnd::OnOptionsEmulatorBmpformat() +void MainWnd::OnOptionsEmulatorBmpformat() { theApp.captureFormat = 1; } -void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.captureFormat == 1); } -void MainWnd::OnOptionsSoundOff() +void MainWnd::OnOptionsSoundOff() { soundOffFlag = true; soundShutdown(); theApp.soundInitialized = false; } -void MainWnd::OnUpdateOptionsSoundOff(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundOff(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundOffFlag); } -void MainWnd::OnOptionsSoundMute() +void MainWnd::OnOptionsSoundMute() { soundDisable(0x30f); } -void MainWnd::OnUpdateOptionsSoundMute(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundMute(CCmdUI* pCmdUI) { int active = soundGetEnable() & 0x30f; pCmdUI->SetCheck(active == 0); } -void MainWnd::OnOptionsSoundOn() +void MainWnd::OnOptionsSoundOn() { if(soundOffFlag) { soundOffFlag = false; @@ -1052,55 +1052,55 @@ void MainWnd::OnOptionsSoundOn() soundEnable(0x30f); } -void MainWnd::OnUpdateOptionsSoundOn(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundOn(CCmdUI* pCmdUI) { int active = soundGetEnable() & 0x30f; pCmdUI->SetCheck(active != 0 && !soundOffFlag); } -void MainWnd::OnOptionsSoundUseoldsynchronization() +void MainWnd::OnOptionsSoundUseoldsynchronization() { theApp.useOldSync = !theApp.useOldSync; systemMessage(IDS_SETTING_WILL_BE_EFFECTIVE, - "Setting will be effective the next time you start the emulator"); + "Setting will be effective the next time you start the emulator"); } -void MainWnd::OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.useOldSync); } -void MainWnd::OnOptionsSoundEcho() +void MainWnd::OnOptionsSoundEcho() { soundEcho = !soundEcho; } -void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundEcho); } -void MainWnd::OnOptionsSoundLowpassfilter() +void MainWnd::OnOptionsSoundLowpassfilter() { soundLowPass = !soundLowPass; } -void MainWnd::OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundLowPass); } -void MainWnd::OnOptionsSoundReversestereo() +void MainWnd::OnOptionsSoundReversestereo() { soundReverse = !soundReverse; } -void MainWnd::OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundReverse); } -void MainWnd::OnOptionsSound11khz() +void MainWnd::OnOptionsSound11khz() { if(theApp.cartridgeType == 0) soundSetQuality(4); @@ -1108,12 +1108,12 @@ void MainWnd::OnOptionsSound11khz() gbSoundSetQuality(4); } -void MainWnd::OnUpdateOptionsSound11khz(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSound11khz(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundQuality == 4); } -void MainWnd::OnOptionsSound22khz() +void MainWnd::OnOptionsSound22khz() { if(theApp.cartridgeType == 0) soundSetQuality(2); @@ -1121,12 +1121,12 @@ void MainWnd::OnOptionsSound22khz() gbSoundSetQuality(2); } -void MainWnd::OnUpdateOptionsSound22khz(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSound22khz(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundQuality == 2); } -void MainWnd::OnOptionsSound44khz() +void MainWnd::OnOptionsSound44khz() { if(theApp.cartridgeType == 0) soundSetQuality(1); @@ -1134,7 +1134,7 @@ void MainWnd::OnOptionsSound44khz() gbSoundSetQuality(1); } -void MainWnd::OnUpdateOptionsSound44khz(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSound44khz(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundQuality == 1); } @@ -1151,22 +1151,22 @@ void MainWnd::OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI) } -void MainWnd::OnOptionsSoundVolume25x() +void MainWnd::OnOptionsSoundVolume25x() { soundVolume = 4; } -void MainWnd::OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundVolume == 4); } -void MainWnd::OnOptionsSoundVolume5x() +void MainWnd::OnOptionsSoundVolume5x() { soundVolume = 5; } -void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundVolume == 5); } @@ -1174,7 +1174,7 @@ void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI) void MainWnd::updateSoundChannels(UINT id) { int flag = 0; - + if(id == ID_OPTIONS_SOUND_CHANNEL1) flag = 1; @@ -1199,68 +1199,68 @@ void MainWnd::updateSoundChannels(UINT id) active &= (~flag); else active |= flag; - + soundEnable(active); soundDisable((~active)&0x30f); } -void MainWnd::OnOptionsSoundChannel1() +void MainWnd::OnOptionsSoundChannel1() { updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL1); } -void MainWnd::OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 1); } -void MainWnd::OnOptionsSoundChannel2() +void MainWnd::OnOptionsSoundChannel2() { updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL2); } -void MainWnd::OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 2); } -void MainWnd::OnOptionsSoundChannel3() +void MainWnd::OnOptionsSoundChannel3() { updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL3); } -void MainWnd::OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 4); } -void MainWnd::OnOptionsSoundChannel4() +void MainWnd::OnOptionsSoundChannel4() { updateSoundChannels(ID_OPTIONS_SOUND_CHANNEL4); } -void MainWnd::OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 8); } -void MainWnd::OnOptionsSoundDirectsounda() +void MainWnd::OnOptionsSoundDirectsounda() { updateSoundChannels(ID_OPTIONS_SOUND_DIRECTSOUNDA); } -void MainWnd::OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 256); pCmdUI->Enable(theApp.cartridgeType == 0); } -void MainWnd::OnOptionsSoundDirectsoundb() +void MainWnd::OnOptionsSoundDirectsoundb() { updateSoundChannels(ID_OPTIONS_SOUND_DIRECTSOUNDB); } -void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI) { pCmdUI->SetCheck(soundGetEnable() & 512); pCmdUI->Enable(theApp.cartridgeType == 0); @@ -1319,7 +1319,7 @@ void MainWnd::OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI) pCmdUI->Enable(theApp.cartridgeType == 0); } -void MainWnd::OnOptionsGameboyBorder() +void MainWnd::OnOptionsGameboyBorder() { theApp.winGbBorderOn = !theApp.winGbBorderOn; gbBorderOn = theApp.winGbBorderOn; @@ -1329,12 +1329,12 @@ void MainWnd::OnOptionsGameboyBorder() theApp.updateWindowSize(theApp.videoOption); } -void MainWnd::OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.winGbBorderOn); } -void MainWnd::OnOptionsGameboyPrinter() +void MainWnd::OnOptionsGameboyPrinter() { theApp.winGbPrinterEnabled = !theApp.winGbPrinterEnabled; if(theApp.winGbPrinterEnabled) @@ -1343,12 +1343,12 @@ void MainWnd::OnOptionsGameboyPrinter() gbSerialFunction = NULL; } -void MainWnd::OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbSerialFunction == gbPrinterSend); } -void MainWnd::OnOptionsGameboyBorderAutomatic() +void MainWnd::OnOptionsGameboyBorderAutomatic() { gbBorderAutomatic = !gbBorderAutomatic; if(emulating && theApp.cartridgeType == 1 && gbBorderOn) { @@ -1357,93 +1357,93 @@ void MainWnd::OnOptionsGameboyBorderAutomatic() } } -void MainWnd::OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(gbBorderAutomatic); + pCmdUI->SetCheck(gbBorderAutomatic); } -void MainWnd::OnOptionsGameboyAutomatic() +void MainWnd::OnOptionsGameboyAutomatic() { gbEmulatorType = 0; } -void MainWnd::OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 0); } -void MainWnd::OnOptionsGameboyGba() +void MainWnd::OnOptionsGameboyGba() { gbEmulatorType = 4; } -void MainWnd::OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 4); } -void MainWnd::OnOptionsGameboyCgb() +void MainWnd::OnOptionsGameboyCgb() { gbEmulatorType = 1; } -void MainWnd::OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 1); } -void MainWnd::OnOptionsGameboySgb() +void MainWnd::OnOptionsGameboySgb() { - gbEmulatorType = 2; + gbEmulatorType = 2; } -void MainWnd::OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 2); } -void MainWnd::OnOptionsGameboySgb2() +void MainWnd::OnOptionsGameboySgb2() { - gbEmulatorType = 5; + gbEmulatorType = 5; } -void MainWnd::OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 5); } -void MainWnd::OnOptionsGameboyGb() +void MainWnd::OnOptionsGameboyGb() { - gbEmulatorType = 3; + gbEmulatorType = 3; } -void MainWnd::OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI) { pCmdUI->SetCheck(gbEmulatorType == 3); } -void MainWnd::OnOptionsGameboyRealcolors() +void MainWnd::OnOptionsGameboyRealcolors() { - gbColorOption = 0; + gbColorOption = 0; } -void MainWnd::OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(gbColorOption == 0); + pCmdUI->SetCheck(gbColorOption == 0); } -void MainWnd::OnOptionsGameboyGameboycolors() +void MainWnd::OnOptionsGameboyGameboycolors() { - gbColorOption = 1; + gbColorOption = 1; } -void MainWnd::OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(gbColorOption == 1); + pCmdUI->SetCheck(gbColorOption == 1); } -void MainWnd::OnOptionsGameboyColors() +void MainWnd::OnOptionsGameboyColors() { theApp.winCheckFullscreen(); GBColorDlg dlg; @@ -1652,7 +1652,7 @@ void MainWnd::OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI) } } -void MainWnd::OnOptionsFilterDisablemmx() +void MainWnd::OnOptionsFilterDisablemmx() { #ifdef MMX theApp.disableMMX = !theApp.disableMMX; @@ -1663,7 +1663,7 @@ void MainWnd::OnOptionsFilterDisablemmx() #endif } -void MainWnd::OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.disableMMX); } @@ -1680,85 +1680,85 @@ void MainWnd::OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI) pCmdUI->SetCheck(theApp.filterLCD); } -void MainWnd::OnOptionsLanguageSystem() +void MainWnd::OnOptionsLanguageSystem() { theApp.winSetLanguageOption(0, false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.languageOption == 0); } -void MainWnd::OnOptionsLanguageEnglish() +void MainWnd::OnOptionsLanguageEnglish() { theApp.winSetLanguageOption(1, false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.languageOption == 1); } -void MainWnd::OnOptionsLanguageOther() +void MainWnd::OnOptionsLanguageOther() { theApp.winCheckFullscreen(); theApp.winSetLanguageOption(2, false); theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI) { pCmdUI->SetCheck(theApp.languageOption == 2); } -void MainWnd::OnOptionsJoypadConfigure1() +void MainWnd::OnOptionsJoypadConfigure1() { theApp.winCheckFullscreen(); JoypadConfig dlg(0); dlg.DoModal(); } -void MainWnd::OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } -void MainWnd::OnOptionsJoypadConfigure2() +void MainWnd::OnOptionsJoypadConfigure2() { theApp.winCheckFullscreen(); JoypadConfig dlg(1); dlg.DoModal(); } -void MainWnd::OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } -void MainWnd::OnOptionsJoypadConfigure3() +void MainWnd::OnOptionsJoypadConfigure3() { theApp.winCheckFullscreen(); JoypadConfig dlg(2); dlg.DoModal(); } -void MainWnd::OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } -void MainWnd::OnOptionsJoypadConfigure4() +void MainWnd::OnOptionsJoypadConfigure4() { theApp.winCheckFullscreen(); JoypadConfig dlg(3); dlg.DoModal(); } -void MainWnd::OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } @@ -1774,14 +1774,14 @@ void MainWnd::OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI) pCmdUI->SetCheck(theApp.joypadDefault == (int)(pCmdUI->m_nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1)); } -void MainWnd::OnOptionsJoypadMotionconfigure() +void MainWnd::OnOptionsJoypadMotionconfigure() { theApp.winCheckFullscreen(); MotionConfig dlg; dlg.DoModal(); } -void MainWnd::OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } @@ -1864,7 +1864,7 @@ void MainWnd::winConfirmMode() if( theApp.videoOption > VIDEO_4X ) { theApp.winCheckFullscreen(); ModeConfirm dlg(theApp.m_pMainWnd); - + if(!dlg.DoModal()) { theApp.updateVideoSize(ID_OPTIONS_VIDEO_X2); } @@ -1872,7 +1872,7 @@ void MainWnd::winConfirmMode() theApp.winAccelMgr.UpdateMenu(theApp.menu); } -void MainWnd::OnOptionsVideoFullscreenmaxscale() +void MainWnd::OnOptionsVideoFullscreenmaxscale() { MaxScale dlg; @@ -1886,14 +1886,14 @@ void MainWnd::OnOptionsVideoFullscreenmaxscale() } -void MainWnd::OnLinkOptions() +void MainWnd::OnLinkOptions() { LinkOptions dlg; dlg.DoModal(); } -void MainWnd::OnOptionsLinkLog() +void MainWnd::OnOptionsLinkLog() { if(linklog){ if(linklogfile!=NULL) fclose(linklogfile); @@ -1905,12 +1905,12 @@ void MainWnd::OnOptionsLinkLog() } } -void MainWnd::OnUpdateOptionsLinkLog(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLinkLog(CCmdUI* pCmdUI) { pCmdUI->SetCheck(linklog); } -void MainWnd::OnOptionsLinkRFU() +void MainWnd::OnOptionsLinkRFU() { if(adapter) adapter = false; else { @@ -1919,23 +1919,23 @@ void MainWnd::OnOptionsLinkRFU() } } -void MainWnd::OnUpdateOptionsLinkEnable(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLinkEnable(CCmdUI* pCmdUI) { pCmdUI->SetCheck(linkenable); } -void MainWnd::OnOptionsLinkEnable() +void MainWnd::OnOptionsLinkEnable() { linkenable = !linkenable; } -void MainWnd::OnUpdateOptionsLinkRFU(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsLinkRFU(CCmdUI* pCmdUI) { pCmdUI->SetCheck(adapter); } -void MainWnd::OnOptionsEmulatorGameoverrides() +void MainWnd::OnOptionsEmulatorGameoverrides() { if(emulating && theApp.cartridgeType == 0) { GameOverrides dlg(this); @@ -1943,7 +1943,7 @@ void MainWnd::OnOptionsEmulatorGameoverrides() } } -void MainWnd::OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI) { pCmdUI->Enable(emulating && (theApp.cartridgeType == 0)); } diff --git a/src/win32/MainWndTools.cpp b/src/win32/MainWndTools.cpp index b75e0792..7a96ec11 100644 --- a/src/win32/MainWndTools.cpp +++ b/src/win32/MainWndTools.cpp @@ -57,7 +57,7 @@ extern void remoteCleanUp(); extern void remoteSetSockets(SOCKET, SOCKET); extern void toolsLogging(); -void MainWnd::OnToolsDisassemble() +void MainWnd::OnToolsDisassemble() { if(theApp.cartridgeType == 0) { Disassemble *dlg = new Disassemble(); @@ -70,34 +70,34 @@ void MainWnd::OnToolsDisassemble() } } -void MainWnd::OnUpdateToolsDisassemble(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsDisassemble(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsLogging() +void MainWnd::OnToolsLogging() { toolsLogging(); } -void MainWnd::OnUpdateToolsLogging(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsLogging(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsIoviewer() +void MainWnd::OnToolsIoviewer() { IOViewer *dlg = new IOViewer; dlg->Create(IDD_IO_VIEWER,this); dlg->ShowWindow(SW_SHOW); } -void MainWnd::OnUpdateToolsIoviewer(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsIoviewer(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && theApp.cartridgeType == 0); } -void MainWnd::OnToolsMapview() +void MainWnd::OnToolsMapview() { if(theApp.cartridgeType == 0) { MapView *dlg = new MapView; @@ -110,12 +110,12 @@ void MainWnd::OnToolsMapview() } } -void MainWnd::OnUpdateToolsMapview(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsMapview(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsMemoryviewer() +void MainWnd::OnToolsMemoryviewer() { if(theApp.cartridgeType == 0) { MemoryViewerDlg *dlg = new MemoryViewerDlg; @@ -128,12 +128,12 @@ void MainWnd::OnToolsMemoryviewer() } } -void MainWnd::OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsOamviewer() +void MainWnd::OnToolsOamviewer() { if(theApp.cartridgeType == 0) { OamView *dlg = new OamView; @@ -146,12 +146,12 @@ void MainWnd::OnToolsOamviewer() } } -void MainWnd::OnUpdateToolsOamviewer(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsOamviewer(CCmdUI* pCmdUI) { - pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsPaletteview() +void MainWnd::OnToolsPaletteview() { if(theApp.cartridgeType == 0) { PaletteView *dlg = new PaletteView; @@ -164,12 +164,12 @@ void MainWnd::OnToolsPaletteview() } } -void MainWnd::OnUpdateToolsPaletteview(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsPaletteview(CCmdUI* pCmdUI) { - pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnToolsTileviewer() +void MainWnd::OnToolsTileviewer() { if(theApp.cartridgeType == 0) { TileView *dlg = new TileView; @@ -182,19 +182,19 @@ void MainWnd::OnToolsTileviewer() } } -void MainWnd::OnUpdateToolsTileviewer(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsTileviewer(CCmdUI* pCmdUI) { - pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); + pCmdUI->Enable(theApp.videoOption <= VIDEO_4X); } -void MainWnd::OnDebugNextframe() +void MainWnd::OnDebugNextframe() { if(theApp.paused) theApp.paused = false; theApp.winPauseNextFrame = true; } -void MainWnd::OnToolsDebugGdb() +void MainWnd::OnToolsDebugGdb() { theApp.winCheckFullscreen(); GDBPortDlg dlg; @@ -216,21 +216,21 @@ void MainWnd::OnToolsDebugGdb() oam = (u8 *)calloc(1, 0x400); pix = (u8 *)calloc(1, 4 * 241 * 162); ioMem = (u8 *)calloc(1, 0x400); - + theApp.emulator = GBASystem; - + CPUInit(theApp.biosFileName, theApp.useBiosFile ? true : false); - CPUReset(); + CPUReset(); } } } -void MainWnd::OnUpdateToolsDebugGdb(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsDebugGdb(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1); } -void MainWnd::OnToolsDebugLoadandwait() +void MainWnd::OnToolsDebugLoadandwait() { theApp.winCheckFullscreen(); if(fileOpenSelect()) { @@ -254,12 +254,12 @@ void MainWnd::OnToolsDebugLoadandwait() } } -void MainWnd::OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1); } -void MainWnd::OnToolsDebugBreak() +void MainWnd::OnToolsDebugBreak() { if(armState) { armNextPC -= 4; @@ -271,29 +271,29 @@ void MainWnd::OnToolsDebugBreak() debugger = true; } -void MainWnd::OnUpdateToolsDebugBreak(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsDebugBreak(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1); } -void MainWnd::OnToolsDebugDisconnect() +void MainWnd::OnToolsDebugDisconnect() { remoteCleanUp(); debugger = false; } -void MainWnd::OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1); } -void MainWnd::OnOptionsSoundStartrecording() +void MainWnd::OnOptionsSoundStartrecording() { theApp.winCheckFullscreen(); CString captureBuffer; CString capdir = regQueryStringValue("soundRecordDir", NULL); - + if(capdir.IsEmpty()) capdir = getDirFromFile(theApp.filename); @@ -301,16 +301,16 @@ void MainWnd::OnOptionsSoundStartrecording() 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); } @@ -322,12 +322,12 @@ void MainWnd::OnOptionsSoundStartrecording() regSetStringValue("soundRecordDir", captureBuffer); } -void MainWnd::OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.soundRecording); } -void MainWnd::OnOptionsSoundStoprecording() +void MainWnd::OnOptionsSoundStoprecording() { if(theApp.soundRecorder) { delete theApp.soundRecorder; @@ -336,18 +336,18 @@ void MainWnd::OnOptionsSoundStoprecording() theApp.soundRecording = false; } -void MainWnd::OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.soundRecording); } -void MainWnd::OnToolsRecordStartavirecording() +void MainWnd::OnToolsRecordStartavirecording() { theApp.winCheckFullscreen(); CString captureBuffer; CString capdir = regQueryStringValue("aviRecordDir", NULL); - + if(capdir.IsEmpty()) capdir = getDirFromFile(theApp.filename); @@ -355,9 +355,9 @@ void MainWnd::OnToolsRecordStartavirecording() 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; } @@ -365,7 +365,7 @@ void MainWnd::OnToolsRecordStartavirecording() captureBuffer = theApp.soundRecordName = dlg.GetPathName(); theApp.aviRecordName = captureBuffer; theApp.aviRecording = true; - + if(dlg.m_ofn.nFileOffset > 0) { captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset); } @@ -378,12 +378,12 @@ void MainWnd::OnToolsRecordStartavirecording() regSetStringValue("aviRecordDir", captureBuffer); } -void MainWnd::OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.aviRecording); } -void MainWnd::OnToolsRecordStopavirecording() +void MainWnd::OnToolsRecordStopavirecording() { if(theApp.aviRecorder != NULL) { delete theApp.aviRecorder; @@ -393,34 +393,34 @@ void MainWnd::OnToolsRecordStopavirecording() theApp.aviRecording = false; } -void MainWnd::OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.aviRecording); } -void MainWnd::OnToolsRecordStartmovierecording() +void MainWnd::OnToolsRecordStartmovierecording() { theApp.winCheckFullscreen(); CString captureBuffer; CString capdir = regQueryStringValue("movieRecordDir", ""); - + if(capdir.IsEmpty()) capdir = getDirFromFile(theApp.filename); CString filter = theApp.winLoadFilter(IDS_FILTER_VMV); CString title = winResLoadString(IDS_SELECT_MOVIE_NAME); - + LPCTSTR exts[] = { ".VMV" }; FileDlg dlg(this, "", filter, 1, "VMV", exts, capdir, title, true); - + if(dlg.DoModal() == IDCANCEL) { return; } - + CString movieName = dlg.GetPathName(); captureBuffer = movieName; - + if(dlg.m_ofn.nFileOffset > 0) { captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset); } @@ -431,11 +431,11 @@ void MainWnd::OnToolsRecordStartmovierecording() captureBuffer = captureBuffer.Left(len-1); regSetStringValue("movieRecordDir", captureBuffer); - + theApp.movieFile = fopen(movieName, "wb"); if(!theApp.movieFile) { - systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", + systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", (const char *)movieName); return; } @@ -452,17 +452,17 @@ void MainWnd::OnToolsRecordStartmovierecording() theApp.movieRecording = true; theApp.moviePlaying = false; } else { - systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", - (const char *)movieName); + systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", + (const char *)movieName); } } -void MainWnd::OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.movieRecording); } -void MainWnd::OnToolsRecordStopmovierecording() +void MainWnd::OnToolsRecordStopmovierecording() { if(theApp.movieRecording) { if(theApp.movieFile != NULL) { @@ -479,12 +479,12 @@ void MainWnd::OnToolsRecordStopmovierecording() } } -void MainWnd::OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.movieRecording); } -void MainWnd::OnToolsPlayStartmovieplaying() +void MainWnd::OnToolsPlayStartmovieplaying() { static bool moviePlayMessage = false; @@ -500,7 +500,7 @@ void MainWnd::OnToolsPlayStartmovieplaying() CString captureBuffer; CString capdir = regQueryStringValue("movieRecordDir", ""); - + if(capdir.IsEmpty()) capdir = getDirFromFile(theApp.filename); @@ -510,25 +510,25 @@ void MainWnd::OnToolsPlayStartmovieplaying() LPCTSTR exts[] = { ".VMV" }; FileDlg dlg(this, "", filter, 1, "VMV", exts, capdir, title, false); - + if(dlg.DoModal() == IDCANCEL) { return; } CString movieName = dlg.GetPathName(); captureBuffer = movieName; - + theApp.movieFile = fopen(movieName, "rb"); if(!theApp.movieFile) { - systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", + systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", (const char *)movieName); return; } int version = 0; fread(&version, 1, sizeof(int), theApp.movieFile); if(version != 1) { - systemMessage(IDS_UNSUPPORTED_MOVIE_VERSION, + systemMessage(IDS_UNSUPPORTED_MOVIE_VERSION, "Unsupported movie version %d.", version); fclose(theApp.movieFile); @@ -543,17 +543,17 @@ void MainWnd::OnToolsPlayStartmovieplaying() theApp.movieLastJoypad = 0; theApp.movieReadNext(); } else { - systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", + systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", (const char *)movieName); } } -void MainWnd::OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.moviePlaying); } -void MainWnd::OnToolsPlayStopmovieplaying() +void MainWnd::OnToolsPlayStopmovieplaying() { if(theApp.moviePlaying) { if(theApp.movieFile != NULL) { @@ -565,12 +565,12 @@ void MainWnd::OnToolsPlayStopmovieplaying() } } -void MainWnd::OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.moviePlaying); } -void MainWnd::OnToolsRewind() +void MainWnd::OnToolsRewind() { if(emulating && theApp.emulator.emuReadMemState && theApp.rewindMemory && theApp.rewindCount) { theApp.rewindPos = --theApp.rewindPos & 7; @@ -580,12 +580,12 @@ void MainWnd::OnToolsRewind() } } -void MainWnd::OnUpdateToolsRewind(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsRewind(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.rewindMemory != NULL && emulating && theApp.rewindCount); } -void MainWnd::OnToolsCustomize() +void MainWnd::OnToolsCustomize() { AccelEditor dlg; @@ -597,7 +597,7 @@ void MainWnd::OnToolsCustomize() } } -void MainWnd::OnUpdateToolsCustomize(CCmdUI* pCmdUI) +void MainWnd::OnUpdateToolsCustomize(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.videoOption != VIDEO_320x240); } diff --git a/src/win32/MapView.cpp b/src/win32/MapView.cpp index a93bcfda..f93e755b 100644 --- a/src/win32/MapView.cpp +++ b/src/win32/MapView.cpp @@ -52,9 +52,9 @@ MapView::MapView(CWnd* pParent /*=NULL*/) //{{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; @@ -65,7 +65,7 @@ MapView::MapView(CWnd* pParent /*=NULL*/) mapView.setData(data); mapView.setBmpInfo(&bmpInfo); - + control = BG0CNT; bg = 0; @@ -144,7 +144,7 @@ void MapView::renderTextScreen(u16 control) w = sizeX; h = sizeY; - + if(control & 0x80) { for(int y = 0; y < sizeY; y++) { int yy = y & 255; @@ -158,24 +158,24 @@ void MapView::renderTextScreen(u16 control) 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; - + *bmp++ = (color & 0x1f) << 3; + if(data & 0x0400) { if(tileX == 0) screenSource++; @@ -199,7 +199,7 @@ void MapView::renderTextScreen(u16 control) for(int x = 0; x < sizeX; x++) { u16 data = *screenSource; - + int tile = data & 0x3FF; int tileX = (x & 7); int tileY = y & 7; @@ -208,9 +208,9 @@ void MapView::renderTextScreen(u16 control) 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 { @@ -223,7 +223,7 @@ void MapView::renderTextScreen(u16 control) *bmp++ = ((color2 >> 10) & 0x1f) << 3; *bmp++ = ((color2 >> 5) & 0x1f) << 3; *bmp++ = (color2 & 0x1f) << 3; - + if(data & 0x0400) { if(tileX == 0) screenSource++; @@ -232,7 +232,7 @@ void MapView::renderTextScreen(u16 control) if(x == 255 && sizeX > 256) { screenSource = screenBase + 0x400 + ((yy>>3)*32); - } + } } } } @@ -299,15 +299,15 @@ void MapView::renderRotScreen(u16 control) 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]; @@ -320,30 +320,30 @@ void MapView::renderRotScreen(u16 control) 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; + *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, + /* + renderView(xx, yy, BG2PA, BG2PC, BG2PB, BG2PD, (sizeX -1) <<8, @@ -354,8 +354,8 @@ void MapView::renderRotScreen(u16 control) case 3: xx = BG3X_L | BG3X_H << 16; yy = BG3Y_L | BG3Y_H << 16; - /* - renderView(xx, yy, + /* + renderView(xx, yy, BG3PA, BG3PC, BG3PB, BG3PD, (sizeX -1) <<8, @@ -401,7 +401,7 @@ void MapView::renderMode2() control = BG2CNT; renderRotScreen(control); break; - } + } } void MapView::renderMode3() @@ -411,13 +411,13 @@ void MapView::renderMode3() 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; + *bmp++ = (data & 0x1f) << 3; } } bg = 2; @@ -429,17 +429,17 @@ 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; + *bmp++ = (data & 0x1f) << 3; } } bg = 2; @@ -453,22 +453,22 @@ void MapView::renderMode5() 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; + *bmp++ = (data & 0x1f) << 3; } } bg = 2; } -void MapView::OnRefresh() +void MapView::OnRefresh() { - paint(); + paint(); } void MapView::paint() @@ -492,7 +492,7 @@ void MapView::paint() control = BG3CNT; break; } - + switch(mode) { case 0: renderMode0(); @@ -521,7 +521,7 @@ void MapView::paint() } enableButtons(mode); SIZE s; - + if(mapView.getStretch()) { mapView.setSize(w, h); s.cx = s.cy = 1; @@ -536,9 +536,9 @@ void MapView::paint() mapView.refresh(); CString buffer; - + u32 charBase = ((control >> 2) & 0x03) * 0x4000 + 0x6000000; - u32 screenBase = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; + u32 screenBase = ((control >> 8) & 0x1f) * 0x800 + 0x6000000; buffer.Format("%d", mode); m_mode.SetWindowText(buffer); @@ -549,7 +549,7 @@ void MapView::paint() } else { buffer.Format("0x%08X", screenBase); m_mapbase.SetWindowText(buffer); - + buffer.Format("0x%08X", charBase); m_charbase.SetWindowText(buffer); } @@ -568,10 +568,10 @@ void MapView::paint() control & 0x2000 ? "1" : "0"); } -BOOL MapView::OnInitDialog() +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) @@ -580,7 +580,7 @@ BOOL MapView::OnInitDialog() 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_B, DS_MoveY) DIALOG_SIZER_END() SetData(sz, TRUE, @@ -596,12 +596,12 @@ BOOL MapView::OnInitDialog() 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() +void MapView::PostNcDestroy() { delete this; } @@ -639,13 +639,13 @@ void MapView::enableButtons(int mode) enable[1] = false; enable[2] = false; enable[3] = false; - break; + break; case 5: enable[0] = false; enable[1] = false; enable[2] = false; enable[3] = false; - break; + break; } GetDlgItem(IDC_BG0)->EnableWindow(enable[0]); GetDlgItem(IDC_BG1)->EnableWindow(enable[1]); @@ -672,60 +672,60 @@ void MapView::enableButtons(int mode) CheckRadioButton(IDC_FRAME_0, IDC_FRAME_1, id); } -void MapView::OnFrame0() +void MapView::OnFrame0() { frame = 0; - paint(); + paint(); } -void MapView::OnFrame1() +void MapView::OnFrame1() { frame = 1; paint(); } -void MapView::OnBg0() +void MapView::OnBg0() { bg = 0; control = BG0CNT; paint(); } -void MapView::OnBg1() +void MapView::OnBg1() { bg = 1; control = BG1CNT; paint(); } -void MapView::OnBg2() +void MapView::OnBg2() { bg = 2; control = BG2CNT; paint(); } -void MapView::OnBg3() +void MapView::OnBg3() { bg = 3; control = BG3CNT; paint(); } -void MapView::OnStretch() +void MapView::OnStretch() { mapView.setStretch(!mapView.getStretch()); paint(); - regSetDwordValue("mapViewStretch", mapView.getStretch()); + regSetDwordValue("mapViewStretch", mapView.getStretch()); } -void MapView::OnAutoUpdate() +void MapView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); + theApp.winRemoveUpdateListener(this); } } @@ -734,10 +734,10 @@ void MapView::update() paint(); } -void MapView::OnClose() +void MapView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -764,7 +764,7 @@ 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) || mode == 6 || mode == 7) { return GetTextClickAddress(base, x, y); @@ -788,7 +788,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) int x = (int)(wParam & 0xffff); int y = (int)(wParam >> 16); - + CString buffer; buffer.Format("(%d,%d)", x, y); GetDlgItem(IDC_XY)->SetWindowText(buffer); @@ -797,7 +797,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) buffer.Format("0x%08X", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); - int mode = DISPCNT & 7; + int mode = DISPCNT & 7; if(mode >= 3 && mode <=5) { // bitmap modes GetDlgItem(IDC_TILE_NUM)->SetWindowText("---"); @@ -826,7 +826,7 @@ LRESULT MapView::OnMapInfo(WPARAM wParam, LPARAM lParam) GetDlgItem(IDC_FLIP)->SetWindowText("--"); GetDlgItem(IDC_PALETTE_NUM)->SetWindowText("---"); } - + return TRUE; } @@ -834,7 +834,7 @@ LRESULT MapView::OnColInfo(WPARAM wParam, LPARAM lParam) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -856,7 +856,7 @@ LRESULT MapView::OnColInfo(WPARAM wParam, LPARAM lParam) void MapView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -913,7 +913,7 @@ void MapView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -925,14 +925,14 @@ void MapView::saveBMP(const char *name) 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, @@ -981,16 +981,16 @@ void MapView::savePNG(const char *name) 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); diff --git a/src/win32/MaxScale.cpp b/src/win32/MaxScale.cpp index 2daf5d7f..4b9d77b6 100644 --- a/src/win32/MaxScale.cpp +++ b/src/win32/MaxScale.cpp @@ -61,12 +61,12 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MaxScale message handlers -void MaxScale::OnCancel() +void MaxScale::OnCancel() { EndDialog(FALSE); } -void MaxScale::OnOk() +void MaxScale::OnOk() { CString tmp; m_value.GetWindowText(tmp); @@ -74,16 +74,16 @@ void MaxScale::OnOk() EndDialog(TRUE); } -BOOL MaxScale::OnInitDialog() +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/MemoryViewer.cpp b/src/win32/MemoryViewer.cpp index 27443ae2..746df4c4 100644 --- a/src/win32/MemoryViewer.cpp +++ b/src/win32/MemoryViewer.cpp @@ -92,7 +92,7 @@ void MemoryViewer::setAddress(u32 a) 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; @@ -115,11 +115,11 @@ void MemoryViewer::setSize(int s) maxNibble = 3; else maxNibble = 7; - + InvalidateRect(NULL, TRUE); } -BOOL MemoryViewer::OnEraseBkgnd(CDC* pDC) +BOOL MemoryViewer::OnEraseBkgnd(CDC* pDC) { return TRUE; } @@ -146,48 +146,48 @@ void MemoryViewer::updateScrollInfo(int lines) TRUE); } -void MemoryViewer::OnPaint() +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) @@ -198,9 +198,9 @@ void MemoryViewer::OnPaint() r.left += 10*fontSize.cx; beginHex = r.left; readData(addr, 16, data); - + int j; - + if(dataSize == 0) { for(j = 0; j < 16; j++) { buffer.Format("%02X", data[j]); @@ -213,7 +213,7 @@ void MemoryViewer::OnPaint() buffer.Format("%04X", data[j] | data[j+1]<<8); memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); r.left += 5*fontSize.cx; - } + } } if(dataSize == 2) { for(j = 0; j < 16; j += 4) { @@ -221,11 +221,11 @@ void MemoryViewer::OnPaint() data[j+2] << 16 | data[j+3] << 24); 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(); @@ -236,7 +236,7 @@ void MemoryViewer::OnPaint() } else buffer += '.'; } - + memDC.DrawText(buffer, &r, DT_TOP | DT_LEFT | DT_NOPREFIX); addr += 16; if(addressSize) @@ -248,26 +248,26 @@ void MemoryViewer::OnPaint() 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) +void MemoryViewer::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { int address = this->address; switch(nSBCode) { @@ -291,7 +291,7 @@ void MemoryViewer::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) break; case SB_THUMBTRACK: { - int page = displayedLines * 16; + int page = displayedLines * 16; SCROLLINFO si; ZeroMemory(&si, sizeof(si)); si.cbSize = sizeof(si); @@ -304,7 +304,7 @@ void MemoryViewer::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) setAddress(address); } -UINT MemoryViewer::OnGetDlgCode() +UINT MemoryViewer::OnGetDlgCode() { return DLGC_WANTALLKEYS; } @@ -335,7 +335,7 @@ void MemoryViewer::setCaretPos() if(dlg) dlg->setCurrentAddress(editAddress); - + if(editAddress < address || editAddress > (address -1 + (displayedLines<<4))) { destroyEditCaret(); return; @@ -377,7 +377,7 @@ void MemoryViewer::setCaretPos() ShowCaret(); } -void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) +void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) { int x = point.x; int y = point.y; @@ -400,7 +400,7 @@ void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) sub = 9*fontSize.cx; break; } - + editAddress = address + (line<<4); if(x >= beginHex && x < beforeAscii) { x -= beginHex; @@ -416,7 +416,7 @@ void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) editAscii = false; } else if(x >= beginAscii) { int afterAscii = beginAscii+16*fontSize.cx; - if(x >= afterAscii) + if(x >= afterAscii) x = afterAscii-1; editAddress += (x-beginAscii)/fontSize.cx; editNibble = 0; @@ -431,19 +431,19 @@ void MemoryViewer::OnLButtonDown(UINT nFlags, CPoint point) setCaretPos(); } -void MemoryViewer::OnSetFocus(CWnd* pOldWnd) +void MemoryViewer::OnSetFocus(CWnd* pOldWnd) { setCaretPos(); InvalidateRect(NULL, TRUE); } -void MemoryViewer::OnKillFocus(CWnd* pNewWnd) +void MemoryViewer::OnKillFocus(CWnd* pNewWnd) { destroyEditCaret(); InvalidateRect(NULL, TRUE); } -void MemoryViewer::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void MemoryViewer::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { bool isShift = (GetKeyState(VK_SHIFT) & 0x80000000) == 0x80000000; @@ -463,7 +463,7 @@ void MemoryViewer::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) moveAddress(-((maxNibble+1)>>1),0); else moveAddress(0, -1); - break; + break; case VK_DOWN: moveAddress(16, 0); break; diff --git a/src/win32/MemoryViewerAddressSize.cpp b/src/win32/MemoryViewerAddressSize.cpp index 78b00560..e103f9b7 100644 --- a/src/win32/MemoryViewerAddressSize.cpp +++ b/src/win32/MemoryViewerAddressSize.cpp @@ -64,10 +64,10 @@ BEGIN_MESSAGE_MAP(MemoryViewerAddressSize, CDialog) ///////////////////////////////////////////////////////////////////////////// // MemoryViewerAddressSize message handlers -BOOL MemoryViewerAddressSize::OnInitDialog() +BOOL MemoryViewerAddressSize::OnInitDialog() { CDialog::OnInitDialog(); - + CString buffer; if(address != 0xFFFFFFFF) { buffer.Format("%08X", address); @@ -81,15 +81,15 @@ BOOL MemoryViewerAddressSize::OnInitDialog() 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() +void MemoryViewerAddressSize::OnOk() { CString buffer; @@ -99,7 +99,7 @@ void MemoryViewerAddressSize::OnOk() return; } sscanf(buffer, "%x", &address); - + m_size.GetWindowText(buffer); if(buffer.IsEmpty()) { m_size.SetFocus(); @@ -109,7 +109,7 @@ void MemoryViewerAddressSize::OnOk() EndDialog(TRUE); } -void MemoryViewerAddressSize::OnCancel() +void MemoryViewerAddressSize::OnCancel() { EndDialog(FALSE); } diff --git a/src/win32/MemoryViewerDlg.cpp b/src/win32/MemoryViewerDlg.cpp index 3078102f..35e86a5f 100644 --- a/src/win32/MemoryViewerDlg.cpp +++ b/src/win32/MemoryViewerDlg.cpp @@ -73,14 +73,14 @@ void GBAMemoryViewer::readData(u32 address, int len, u8 *data) 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; @@ -143,10 +143,10 @@ BEGIN_MESSAGE_MAP(MemoryViewerDlg, CDialog) ///////////////////////////////////////////////////////////////////////////// // MemoryViewerDlg message handlers -BOOL MemoryViewerDlg::OnInitDialog() +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) @@ -162,7 +162,7 @@ BOOL MemoryViewerDlg::OnInitDialog() 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); @@ -185,18 +185,18 @@ BOOL MemoryViewerDlg::OnInitDialog() 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, @@ -212,19 +212,19 @@ BOOL MemoryViewerDlg::OnInitDialog() 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() +void MemoryViewerDlg::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void MemoryViewerDlg::OnRefresh() +void MemoryViewerDlg::OnRefresh() { m_viewer.Invalidate(); } @@ -235,40 +235,40 @@ void MemoryViewerDlg::update() } -void MemoryViewerDlg::On8Bit() +void MemoryViewerDlg::On8Bit() { m_viewer.setSize(0); regSetDwordValue("memViewerDataSize", 0); } -void MemoryViewerDlg::On16Bit() +void MemoryViewerDlg::On16Bit() { m_viewer.setSize(1); regSetDwordValue("memViewerDataSize", 1); } -void MemoryViewerDlg::On32Bit() +void MemoryViewerDlg::On32Bit() { m_viewer.setSize(2); regSetDwordValue("memViewerDataSize", 2); } -void MemoryViewerDlg::OnAutoUpdate() +void MemoryViewerDlg::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void MemoryViewerDlg::OnGo() +void MemoryViewerDlg::OnGo() { CString buffer; - + m_address.GetWindowText(buffer); - + u32 address; sscanf(buffer, "%x", &address); if(m_viewer.getSize() == 1) @@ -278,10 +278,10 @@ void MemoryViewerDlg::OnGo() m_viewer.setAddress(address); } -void MemoryViewerDlg::OnSelchangeAddresses() +void MemoryViewerDlg::OnSelchangeAddresses() { int cur = m_addresses.GetCurSel(); - + switch(cur) { case 0: m_viewer.setAddress(0); @@ -318,7 +318,7 @@ void MemoryViewerDlg::setCurrentAddress(u32 address) m_current.SetWindowText(buffer); } -void MemoryViewerDlg::OnSave() +void MemoryViewerDlg::OnSave() { if(rom != NULL) { @@ -328,7 +328,7 @@ void MemoryViewerDlg::OnSave() 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); @@ -340,13 +340,13 @@ void MemoryViewerDlg::OnSave() "DMP", exts, "", - title, + title, true); if(file.DoModal() == IDOK) { buffer = file.GetPathName(); FILE *f = fopen(buffer, "wb"); - + if(f == NULL) { systemMessage(IDS_ERROR_CREATING_FILE, buffer); return; @@ -366,7 +366,7 @@ void MemoryViewerDlg::OnSave() } } -void MemoryViewerDlg::OnLoad() +void MemoryViewerDlg::OnLoad() { if(rom != NULL) { @@ -385,7 +385,7 @@ void MemoryViewerDlg::OnLoad() "", title, false); - + if(file.DoModal() == IDOK) { buffer = file.GetPathName(); FILE *f = fopen(buffer, "rb"); @@ -395,17 +395,17 @@ void MemoryViewerDlg::OnLoad() buffer); return; } - - MemoryViewerAddressSize dlg; + + 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(); @@ -419,12 +419,12 @@ void MemoryViewerDlg::OnLoad() } OnRefresh(); } - fclose(f); + fclose(f); } } } -void MemoryViewerDlg::PostNcDestroy() +void MemoryViewerDlg::PostNcDestroy() { delete this; } diff --git a/src/win32/ModeConfirm.cpp b/src/win32/ModeConfirm.cpp index 6ac68bf9..dec8bac3 100644 --- a/src/win32/ModeConfirm.cpp +++ b/src/win32/ModeConfirm.cpp @@ -63,28 +63,28 @@ BEGIN_MESSAGE_MAP(ModeConfirm, CDialog) ///////////////////////////////////////////////////////////////////////////// // ModeConfirm message handlers -void ModeConfirm::OnCancel() +void ModeConfirm::OnCancel() { EndDialog(FALSE); } -void ModeConfirm::OnOk() +void ModeConfirm::OnOk() { EndDialog(TRUE); } -void ModeConfirm::OnDestroy() +void ModeConfirm::OnDestroy() { CDialog::OnDestroy(); - + KillTimer(timer); timer = 0; } -BOOL ModeConfirm::OnInitDialog() +BOOL ModeConfirm::OnInitDialog() { CDialog::OnInitDialog(); - + timer = SetTimer(0, 1000, NULL); count = 10; @@ -95,19 +95,19 @@ BOOL ModeConfirm::OnInitDialog() 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_PTR nIDEvent) +void ModeConfirm::OnTimer(UINT_PTR nIDEvent) { - CString buffer; + 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/OamView.cpp b/src/win32/OamView.cpp index c389c4d4..2f1a417c 100644 --- a/src/win32/OamView.cpp +++ b/src/win32/OamView.cpp @@ -53,9 +53,9 @@ OamView::OamView(CWnd* pParent /*=NULL*/) 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; @@ -110,7 +110,7 @@ void OamView::paint() { if(oam == NULL || paletteRAM == NULL || vram == NULL) return; - + render(); oamView.setSize(w,h); oamView.refresh(); @@ -126,7 +126,7 @@ void OamView::update() void OamView::setAttributes(u16 a0, u16 a1, u16 a2) { CString buffer; - + int y = a0 & 255; int rot = a0 & 512; int mode = (a0 >> 10) & 3; @@ -195,7 +195,7 @@ void OamView::setAttributes(u16 a0, u16 a1, u16 a2) buffer += 'D'; else buffer += ' '; - + GetDlgItem(IDC_FLAGS)->SetWindowText(buffer); } @@ -204,18 +204,18 @@ 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; @@ -264,9 +264,9 @@ void OamView::render() h = sizeY; setAttributes(a0,a1,a2); - + int sy = (a0 & 255); - + if(a0 & 0x2000) { int c = (a2 & 0x3FF); // if((DISPCNT & 7) > 2 && (c < 512)) @@ -276,7 +276,7 @@ void OamView::render() 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)* @@ -292,7 +292,7 @@ void OamView::render() int c = (a2 & 0x3FF); // if((DISPCNT & 7) > 2 && (c < 512)) // continue; - + int inc = 32; if(DISPCNT & 0x40) inc = sizeX >> 3; @@ -306,11 +306,11 @@ void OamView::render() color >>= 4; else color &= 0x0F; - + color = spritePalette[palette+color]; *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; - *bmp++ = (color & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; } } } @@ -319,7 +319,7 @@ void OamView::render() void OamView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -376,7 +376,7 @@ void OamView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -388,14 +388,14 @@ void OamView::saveBMP(const char *name) 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, @@ -444,16 +444,16 @@ void OamView::savePNG(const char *name) 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); @@ -461,7 +461,7 @@ void OamView::savePNG(const char *name) fclose(fp); } -void OamView::OnSave() +void OamView::OnSave() { if(rom != NULL) { @@ -495,14 +495,14 @@ void OamView::OnSave() if(dlg.getFilterIndex() == 2) saveBMP(captureBuffer); else - savePNG(captureBuffer); + savePNG(captureBuffer); } } -BOOL OamView::OnInitDialog() +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) @@ -512,7 +512,7 @@ BOOL OamView::OnInitDialog() 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_B, DS_MoveY) DIALOG_SIZER_END() SetData(sz, TRUE, @@ -527,32 +527,32 @@ BOOL OamView::OnInitDialog() 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() +void OamView::OnStretch() { oamView.setStretch(!oamView.getStretch()); paint(); - regSetDwordValue("oamViewStretch", oamView.getStretch()); + regSetDwordValue("oamViewStretch", oamView.getStretch()); } -void OamView::OnAutoUpdate() +void OamView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void OamView::OnChangeSprite() +void OamView::OnChangeSprite() { CString buffer; m_sprite.GetWindowText(buffer); @@ -567,10 +567,10 @@ void OamView::OnChangeSprite() updateScrollInfo(); } -void OamView::OnClose() +void OamView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -578,7 +578,7 @@ LRESULT OamView::OnMapInfo(WPARAM wParam, LPARAM lParam) { u8 *colors = (u8 *)lParam; oamZoom.setColors(colors); - + return TRUE; } @@ -586,7 +586,7 @@ LRESULT OamView::OnColInfo(WPARAM wParam, LPARAM lParam) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -617,10 +617,10 @@ void OamView::updateScrollInfo() si.nPos = number; GetDlgItem(IDC_SCROLLBAR)->SetScrollInfo(SB_CTL, &si, - TRUE); + TRUE); } -void OamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void OamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch(nSBCode) { case SB_BOTTOM: @@ -659,14 +659,14 @@ void OamView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) } updateScrollInfo(); - + CString buffer; buffer.Format("%d", number); m_sprite.SetWindowText(buffer); paint(); } -void OamView::PostNcDestroy() +void OamView::PostNcDestroy() { delete this; } diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp index ed61c5ca..4f2590f4 100644 --- a/src/win32/OpenGL.cpp +++ b/src/win32/OpenGL.cpp @@ -1,719 +1,719 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team -// Copyright (C) 2005-2006 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 "../System.h" -#include "../GBA.h" -#include "../Globals.h" -#include "../Text.h" -#include "../Util.h" -#include "../gb/gbGlobals.h" -#include "..\memgzio.h" - -#include -#include "glFont.h" - -// OpenGL -#include // main include file -#ifdef HAS_GLEXT -#include -#endif - -typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); - -extern int Init_2xSaI(u32); -extern void winlog(const char *,...); -extern int systemSpeed; - -#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 - - -class OpenGLDisplay : public IDisplay { -private: - HDC hDC; - HGLRC hRC; - GLuint texture; - int width; - int height; - float size; - u8 *filterData; - RECT destRect; - bool failed; - GLFONT font; - - void initializeMatrices( int w, int h ); - bool initializeTexture( int w, int h ); - void updateFiltering( int value ); - void setVSync( int interval = 1 ); - void calculateDestRect( int w, int h ); - void initializeFont(); - -public: - OpenGLDisplay(); - virtual ~OpenGLDisplay(); - virtual DISPLAY_TYPE getType() { return OPENGL; }; - - virtual void EnableOpenGL(); - virtual void DisableOpenGL(); - virtual bool initialize(); - virtual void cleanup(); - virtual void render(); - virtual void renderMenu(); - virtual void clear(); - virtual bool changeRenderSize( int w, int h ); - virtual void resize( int w, int h ); - virtual void setOption( const char *, int ); - virtual int selectFullScreenMode( GUID ** ); -}; - -#include "gzglfont.h" - -void OpenGLDisplay::initializeFont() -{ - int ret; - z_stream strm; - char *buf = (char *)malloc(GZGLFONT_SIZE); - - /* allocate inflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, 16+MAX_WBITS); - if (ret != Z_OK) - return; - - strm.avail_in = sizeof(gzglfont); - strm.next_in = gzglfont; - strm.avail_out = GZGLFONT_SIZE; - strm.next_out = (Bytef *)buf; - ret = inflate(&strm, Z_NO_FLUSH); - if (ret==Z_STREAM_END) - { - glGenTextures( 1, &texture ); - glFontCreate(&font, (char *)buf, texture); - texture=0; - } - free(buf); - (void)inflateEnd(&strm); -} - - - -OpenGLDisplay::OpenGLDisplay() -{ - hDC = NULL; - hRC = NULL; - texture = 0; - width = 0; - height = 0; - size = 0.0f; - failed = false; - filterData = NULL; -} - - -OpenGLDisplay::~OpenGLDisplay() -{ - cleanup(); -} - - -void OpenGLDisplay::EnableOpenGL() -{ - PIXELFORMATDESCRIPTOR pfd; - int format; - - // get the device context (DC) - hDC = GetDC( theApp.m_pMainWnd->GetSafeHwnd() ); - - // set the pixel format for the DC - ZeroMemory( &pfd, sizeof( pfd ) ); - pfd.nSize = sizeof( pfd ); - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 24; - pfd.cDepthBits = 16; - pfd.iLayerType = PFD_MAIN_PLANE; - format = ChoosePixelFormat( hDC, &pfd ); - SetPixelFormat( hDC, format, &pfd ); - - // create and enable the render context (RC) - hRC = wglCreateContext( hDC ); - wglMakeCurrent( hDC, hRC ); -} - -void OpenGLDisplay::DisableOpenGL() -{ - wglMakeCurrent( NULL, NULL ); - wglDeleteContext( hRC ); - ReleaseDC( theApp.m_pMainWnd->GetSafeHwnd(), hDC ); -} - -void OpenGLDisplay::cleanup() -{ - if(texture != 0) { - glDeleteTextures(1, &texture); - texture = 0; - } - DisableOpenGL(); - if(filterData) { - free(filterData); - filterData = NULL; - } - width = 0; - height = 0; - size = 0.0f; -} - - -bool OpenGLDisplay::initialize() -{ - switch( theApp.cartridgeType ) - { - case IMAGE_GBA: - theApp.sizeX = 240; - theApp.sizeY = 160; - break; - case IMAGE_GB: - if ( gbBorderOn ) - { - theApp.sizeX = 256; - theApp.sizeY = 224; - } - else - { - theApp.sizeX = 160; - theApp.sizeY = 144; - } - break; - } - - - 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: - { - if( theApp.fullScreenStretch ) { - theApp.surfaceSizeX = theApp.fsWidth; - theApp.surfaceSizeY = theApp.fsHeight; - } else { - float scaleX = (float)theApp.fsWidth / (float)theApp.sizeX; - float scaleY = (float)theApp.fsHeight / (float)theApp.sizeY; - float min = ( scaleX < scaleY ) ? scaleX : scaleY; - if( theApp.fsMaxScale ) - min = ( min > (float)theApp.fsMaxScale ) ? (float)theApp.fsMaxScale : min; - theApp.surfaceSizeX = (int)((float)theApp.sizeX * min); - theApp.surfaceSizeY = (int)((float)theApp.sizeY * min); - } - } - 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_POPUPWINDOW | 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; - int x = 0, y = 0; - - if( theApp.videoOption <= VIDEO_4X ) { - x = theApp.windowPositionX; - y = theApp.windowPositionY; - } else { - winSizeX = theApp.fsWidth; - winSizeY = theApp.fsHeight; - } - - // 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; - theApp.mode1024Available = FALSE; - theApp.mode1280Available = FALSE; - - EnableOpenGL(); - initializeFont(); - glPushAttrib( GL_ENABLE_BIT ); - glDisable( GL_DEPTH_TEST ); - glDisable( GL_CULL_FACE ); - glEnable( GL_TEXTURE_2D ); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - - initializeMatrices( theApp.surfaceSizeX, theApp.surfaceSizeY ); - - setVSync( theApp.vsync ); - -#ifdef MMX - if(!theApp.disableMMX) - cpu_mmx = theApp.detectMMX(); - else - cpu_mmx = 0; -#endif - - systemRedShift = 3; - systemGreenShift = 11; - systemBlueShift = 19; - systemColorDepth = 32; - theApp.fsColorDepth = 32; - - Init_2xSaI(32); - - utilUpdateSystemColorMaps(); - theApp.updateFilter(); - theApp.updateIFB(); - - if(failed) - return false; - - pWnd->DragAcceptFiles(TRUE); - - return TRUE; -} - - -void OpenGLDisplay::clear() -{ - glClearColor(0.0,0.0,0.0,1.0); - glClear( GL_COLOR_BUFFER_BIT ); -} - - -void OpenGLDisplay::renderMenu() -{ - checkFullScreen(); - if( theApp.m_pMainWnd ) - theApp.m_pMainWnd->DrawMenuBar(); -} - - -void OpenGLDisplay::render() -{ - clear(); - - - int pitch = theApp.filterWidth * (systemColorDepth>>3) + 4; - u8 *data = pix + ( theApp.sizeX + 1 ) * 4; - - // apply pixel filter - if(theApp.filterFunction) { - data = filterData; - theApp.filterFunction( - pix + pitch, - pitch, - (u8*)theApp.delta, - (u8*)filterData, - width * 4 , - theApp.filterWidth, - theApp.filterHeight); - } - - // Texturemap complete texture to surface - // so we have free scaling and antialiasing - - if( theApp.filterFunction ) { - glPixelStorei( GL_UNPACK_ROW_LENGTH, width); - } else { - glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 ); - } - - glTexSubImage2D( - GL_TEXTURE_2D, - 0, - 0, - 0, - width, - height, - GL_RGBA, - GL_UNSIGNED_BYTE, - data ); - - if( theApp.glType == 0 ) { - glBegin( GL_TRIANGLE_STRIP ); - - glTexCoord2f( 0.0f, 0.0f ); - glVertex3i( 0, 0, 0 ); - - glTexCoord2f( (float)(width) / size, 0.0f ); - glVertex3i( theApp.surfaceSizeX, 0, 0 ); - - glTexCoord2f( 0.0f, (float)(height) / size ); - glVertex3i( 0, theApp.surfaceSizeY, 0 ); - - glTexCoord2f( (float)(width) / size, (float)(height) / size ); - glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); - - glEnd(); - } - if(theApp.glType == 1) - { - glBegin( GL_QUADS ); - - glTexCoord2f( 0.0f, 0.0f ); - glVertex3i( 0, 0, 0 ); - - glTexCoord2f( (float)(width) / size, 0.0f ); - glVertex3i( theApp.surfaceSizeX, 0, 0 ); - - glTexCoord2f( (float)(width) / size, (float)(height) / size ); - glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); - - glTexCoord2f( 0.0f, (float)(height) / size ); - glVertex3i( 0, theApp.surfaceSizeY, 0 ); - - glEnd(); - - } - if(theApp.glType == 2) - { - glBegin( GL_POLYGON ); - - glTexCoord2f( 0.0f, 0.0f ); - glVertex3i( 0, 0, 0 ); - - glTexCoord2f( (float)(width) / size, 0.0f ); - glVertex3i( theApp.surfaceSizeX, 0, 0 ); - - glTexCoord2f( (float)(width) / size, (float)(height) / size ); - glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); - - glTexCoord2f( 0.0f, (float)(height) / size ); - glVertex3i( 0, theApp.surfaceSizeY, 0 ); - - glEnd(); - } - - - if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_4X ) ) { - char buffer[30]; - if( theApp.showSpeed == 1 ) { - sprintf( buffer, "%3d%%", systemSpeed ); - } else { - sprintf( buffer, "%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, theApp.showRenderedFrames ); - } - glFontBegin(&font); - glPushMatrix(); - float fontscale = (float)theApp.surfaceSizeX / 100.0; - glScalef(fontscale, fontscale, fontscale); - glColor4f(1.0f, 0.25f, 0.25f, 1.0f); - glFontTextOut(buffer, (theApp.surfaceSizeX-(strlen(buffer)*11))/(fontscale*2), (theApp.surfaceSizeY-20)/fontscale, 0); - glPopMatrix(); - glFontEnd(); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glBindTexture( GL_TEXTURE_2D, texture ); - } - if( theApp.screenMessage ) { - if( ( ( GetTickCount() - theApp.screenMessageTime ) < 3000 ) && !theApp.disableStatusMessage ) { - glFontBegin(&font); - glPushMatrix(); - - float fontscale = (float)theApp.surfaceSizeX / 100.0; - glScalef(fontscale, fontscale, fontscale); - glColor4f(1.0f, 0.25f, 0.25f, 1.0f); - glFontTextOut((char *)((const char *)theApp.screenMessageBuffer), (theApp.surfaceSizeX-(theApp.screenMessageBuffer.GetLength()*11))/(fontscale*2), (theApp.surfaceSizeY-40)/fontscale, 0); - glPopMatrix(); - glFontEnd(); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glBindTexture( GL_TEXTURE_2D, texture ); - } else { - theApp.screenMessage = false; - } - } - - - glFlush(); - SwapBuffers( hDC ); - // since OpenGL draws on the back buffer, - // we have to swap it to the front buffer to see it - - // draw informations with GDI on the front buffer -} - - -void OpenGLDisplay::resize( int w, int h ) -{ - initializeMatrices( w, h ); -} - - -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; - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); -} - - -void OpenGLDisplay::initializeMatrices( int w, int h ) -{ - if( theApp.fullScreenStretch ) { - glViewport( 0, 0, w, h ); - } else { - calculateDestRect( w, h ); - glViewport( - destRect.left, - destRect.top, - destRect.right - destRect.left, - destRect.bottom - destRect.top ); - } - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( - /* left */ 1.0f, - /* right */ (GLdouble)(w - 1), - /* bottom */ (GLdouble)(h - 1), - /* top */ 1.0f, - 0.0f, - 1.0f ); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -bool OpenGLDisplay::initializeTexture( int w, int h ) -{ - // size = 2^n - // w = 24 > size = 256 = 2^8 - // w = 255 > size = 256 = 2^8 - // w = 256 > size = 512 = 2^9 - // w = 300 > size = 512 = 2^9 - // OpenGL textures have to be square and a power of 2 - - float n1 = log10( (float)w ) / log10( 2.0f ); - float n2 = log10( (float)h ) / log10( 2.0f ); - float n = ( n1 > n2 ) ? n1 : n2; - - if( ((float)((int)n)) != n ) { - // round up - n = ((float)((int)n)) + 1.0f; - } - - size = pow( 2.0f, n ); - - glGenTextures( 1, &texture ); - glBindTexture( GL_TEXTURE_2D, texture ); - updateFiltering( theApp.glFilter ); - - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGBA, - (GLsizei)size, - (GLsizei)size, - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - NULL ); - - width = w; - height = h; - - return ( glGetError() == GL_NO_ERROR) ? true : false; -} - - -void OpenGLDisplay::setVSync( int interval ) -{ - const char *extensions = (const char *)glGetString( GL_EXTENSIONS ); - - if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) { - winlog( "Error: WGL_EXT_swap_control extension not supported on your computer.\n" ); - return; - } else { - PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = NULL; - wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" ); - if( wglSwapIntervalEXT ) { - wglSwapIntervalEXT( interval ); - } - } -} - - -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; - } - if (filterData) - free(filterData); - filterData = (u8 *)malloc(4*w*h); - - } - - return true; -} - - -void OpenGLDisplay::calculateDestRect( int w, int h ) -{ - float scaleX = (float)w / (float)width; - float scaleY = (float)h / (float)height; - float min = (scaleX < scaleY) ? scaleX : scaleY; - if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) { - min = (float)theApp.fsMaxScale; - } - destRect.left = 0; - destRect.top = 0; - destRect.right = (LONG)(width * min); - destRect.bottom = (LONG)(height * min); - if( destRect.right != w ) { - LONG diff = (w - destRect.right) / 2; - destRect.left += diff; - destRect.right += diff; - } - if( destRect.bottom != h ) { - LONG diff = (h - destRect.bottom) / 2; - destRect.top += diff; - destRect.bottom += diff; - } -} - - -void OpenGLDisplay::setOption( const char *option, int value ) -{ - if( !_tcscmp( option, _T("vsync") ) ) { - setVSync( value ); - } - - if( !_tcscmp( option, _T("glFilter") ) ) { - updateFiltering( value ); - } - - if( !_tcscmp( option, _T("maxScale") ) ) { - initializeMatrices( theApp.dest.right, theApp.dest.bottom ); - } - - if( !_tcscmp( option, _T("fullScreenStretch") ) ) { - initializeMatrices( theApp.dest.right, theApp.dest.bottom ); - } -} - - -int OpenGLDisplay::selectFullScreenMode( GUID ** ) -{ - HWND wnd = GetDesktopWindow(); - RECT r; - GetWindowRect( wnd, &r ); - int w = ( r.right - r.left ) & 0xFFF; - int h = ( r.bottom - r.top ) & 0xFFF; - HDC dc = GetDC( wnd ); - int c = GetDeviceCaps( dc, BITSPIXEL ); - ReleaseDC( wnd, dc ); - return (c << 24) | (w << 12) | h; -} - - -IDisplay *newOpenGLDisplay() -{ - return new OpenGLDisplay(); -} +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team +// Copyright (C) 2005-2006 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 "../System.h" +#include "../GBA.h" +#include "../Globals.h" +#include "../Text.h" +#include "../Util.h" +#include "../gb/gbGlobals.h" +#include "..\memgzio.h" + +#include +#include "glFont.h" + +// OpenGL +#include // main include file +#ifdef HAS_GLEXT +#include +#endif + +typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); + +extern int Init_2xSaI(u32); +extern void winlog(const char *,...); +extern int systemSpeed; + +#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 + + +class OpenGLDisplay : public IDisplay { +private: + HDC hDC; + HGLRC hRC; + GLuint texture; + int width; + int height; + float size; + u8 *filterData; + RECT destRect; + bool failed; + GLFONT font; + + void initializeMatrices( int w, int h ); + bool initializeTexture( int w, int h ); + void updateFiltering( int value ); + void setVSync( int interval = 1 ); + void calculateDestRect( int w, int h ); + void initializeFont(); + +public: + OpenGLDisplay(); + virtual ~OpenGLDisplay(); + virtual DISPLAY_TYPE getType() { return OPENGL; }; + + virtual void EnableOpenGL(); + virtual void DisableOpenGL(); + virtual bool initialize(); + virtual void cleanup(); + virtual void render(); + virtual void renderMenu(); + virtual void clear(); + virtual bool changeRenderSize( int w, int h ); + virtual void resize( int w, int h ); + virtual void setOption( const char *, int ); + virtual int selectFullScreenMode( GUID ** ); +}; + +#include "gzglfont.h" + +void OpenGLDisplay::initializeFont() +{ + int ret; + z_stream strm; + char *buf = (char *)malloc(GZGLFONT_SIZE); + + /* allocate inflate state */ + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit2(&strm, 16+MAX_WBITS); + if (ret != Z_OK) + return; + + strm.avail_in = sizeof(gzglfont); + strm.next_in = gzglfont; + strm.avail_out = GZGLFONT_SIZE; + strm.next_out = (Bytef *)buf; + ret = inflate(&strm, Z_NO_FLUSH); + if (ret==Z_STREAM_END) + { + glGenTextures( 1, &texture ); + glFontCreate(&font, (char *)buf, texture); + texture=0; + } + free(buf); + (void)inflateEnd(&strm); +} + + + +OpenGLDisplay::OpenGLDisplay() +{ + hDC = NULL; + hRC = NULL; + texture = 0; + width = 0; + height = 0; + size = 0.0f; + failed = false; + filterData = NULL; +} + + +OpenGLDisplay::~OpenGLDisplay() +{ + cleanup(); +} + + +void OpenGLDisplay::EnableOpenGL() +{ + PIXELFORMATDESCRIPTOR pfd; + int format; + + // get the device context (DC) + hDC = GetDC( theApp.m_pMainWnd->GetSafeHwnd() ); + + // set the pixel format for the DC + ZeroMemory( &pfd, sizeof( pfd ) ); + pfd.nSize = sizeof( pfd ); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 24; + pfd.cDepthBits = 16; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat( hDC, &pfd ); + SetPixelFormat( hDC, format, &pfd ); + + // create and enable the render context (RC) + hRC = wglCreateContext( hDC ); + wglMakeCurrent( hDC, hRC ); +} + +void OpenGLDisplay::DisableOpenGL() +{ + wglMakeCurrent( NULL, NULL ); + wglDeleteContext( hRC ); + ReleaseDC( theApp.m_pMainWnd->GetSafeHwnd(), hDC ); +} + +void OpenGLDisplay::cleanup() +{ + if(texture != 0) { + glDeleteTextures(1, &texture); + texture = 0; + } + DisableOpenGL(); + if(filterData) { + free(filterData); + filterData = NULL; + } + width = 0; + height = 0; + size = 0.0f; +} + + +bool OpenGLDisplay::initialize() +{ + switch( theApp.cartridgeType ) + { + case IMAGE_GBA: + theApp.sizeX = 240; + theApp.sizeY = 160; + break; + case IMAGE_GB: + if ( gbBorderOn ) + { + theApp.sizeX = 256; + theApp.sizeY = 224; + } + else + { + theApp.sizeX = 160; + theApp.sizeY = 144; + } + break; + } + + + 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: + { + if( theApp.fullScreenStretch ) { + theApp.surfaceSizeX = theApp.fsWidth; + theApp.surfaceSizeY = theApp.fsHeight; + } else { + float scaleX = (float)theApp.fsWidth / (float)theApp.sizeX; + float scaleY = (float)theApp.fsHeight / (float)theApp.sizeY; + float min = ( scaleX < scaleY ) ? scaleX : scaleY; + if( theApp.fsMaxScale ) + min = ( min > (float)theApp.fsMaxScale ) ? (float)theApp.fsMaxScale : min; + theApp.surfaceSizeX = (int)((float)theApp.sizeX * min); + theApp.surfaceSizeY = (int)((float)theApp.sizeY * min); + } + } + 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_POPUPWINDOW | 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; + int x = 0, y = 0; + + if( theApp.videoOption <= VIDEO_4X ) { + x = theApp.windowPositionX; + y = theApp.windowPositionY; + } else { + winSizeX = theApp.fsWidth; + winSizeY = theApp.fsHeight; + } + + // 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; + theApp.mode1024Available = FALSE; + theApp.mode1280Available = FALSE; + + EnableOpenGL(); + initializeFont(); + glPushAttrib( GL_ENABLE_BIT ); + glDisable( GL_DEPTH_TEST ); + glDisable( GL_CULL_FACE ); + glEnable( GL_TEXTURE_2D ); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + + initializeMatrices( theApp.surfaceSizeX, theApp.surfaceSizeY ); + + setVSync( theApp.vsync ); + +#ifdef MMX + if(!theApp.disableMMX) + cpu_mmx = theApp.detectMMX(); + else + cpu_mmx = 0; +#endif + + systemRedShift = 3; + systemGreenShift = 11; + systemBlueShift = 19; + systemColorDepth = 32; + theApp.fsColorDepth = 32; + + Init_2xSaI(32); + + utilUpdateSystemColorMaps(); + theApp.updateFilter(); + theApp.updateIFB(); + + if(failed) + return false; + + pWnd->DragAcceptFiles(TRUE); + + return TRUE; +} + + +void OpenGLDisplay::clear() +{ + glClearColor(0.0,0.0,0.0,1.0); + glClear( GL_COLOR_BUFFER_BIT ); +} + + +void OpenGLDisplay::renderMenu() +{ + checkFullScreen(); + if( theApp.m_pMainWnd ) + theApp.m_pMainWnd->DrawMenuBar(); +} + + +void OpenGLDisplay::render() +{ + clear(); + + + int pitch = theApp.filterWidth * (systemColorDepth>>3) + 4; + u8 *data = pix + ( theApp.sizeX + 1 ) * 4; + + // apply pixel filter + if(theApp.filterFunction) { + data = filterData; + theApp.filterFunction( + pix + pitch, + pitch, + (u8*)theApp.delta, + (u8*)filterData, + width * 4 , + theApp.filterWidth, + theApp.filterHeight); + } + + // Texturemap complete texture to surface + // so we have free scaling and antialiasing + + if( theApp.filterFunction ) { + glPixelStorei( GL_UNPACK_ROW_LENGTH, width); + } else { + glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 ); + } + + glTexSubImage2D( + GL_TEXTURE_2D, + 0, + 0, + 0, + width, + height, + GL_RGBA, + GL_UNSIGNED_BYTE, + data ); + + if( theApp.glType == 0 ) { + glBegin( GL_TRIANGLE_STRIP ); + + glTexCoord2f( 0.0f, 0.0f ); + glVertex3i( 0, 0, 0 ); + + glTexCoord2f( (float)(width) / size, 0.0f ); + glVertex3i( theApp.surfaceSizeX, 0, 0 ); + + glTexCoord2f( 0.0f, (float)(height) / size ); + glVertex3i( 0, theApp.surfaceSizeY, 0 ); + + glTexCoord2f( (float)(width) / size, (float)(height) / size ); + glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); + + glEnd(); + } + if(theApp.glType == 1) + { + glBegin( GL_QUADS ); + + glTexCoord2f( 0.0f, 0.0f ); + glVertex3i( 0, 0, 0 ); + + glTexCoord2f( (float)(width) / size, 0.0f ); + glVertex3i( theApp.surfaceSizeX, 0, 0 ); + + glTexCoord2f( (float)(width) / size, (float)(height) / size ); + glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); + + glTexCoord2f( 0.0f, (float)(height) / size ); + glVertex3i( 0, theApp.surfaceSizeY, 0 ); + + glEnd(); + + } + if(theApp.glType == 2) + { + glBegin( GL_POLYGON ); + + glTexCoord2f( 0.0f, 0.0f ); + glVertex3i( 0, 0, 0 ); + + glTexCoord2f( (float)(width) / size, 0.0f ); + glVertex3i( theApp.surfaceSizeX, 0, 0 ); + + glTexCoord2f( (float)(width) / size, (float)(height) / size ); + glVertex3i( theApp.surfaceSizeX, theApp.surfaceSizeY, 0 ); + + glTexCoord2f( 0.0f, (float)(height) / size ); + glVertex3i( 0, theApp.surfaceSizeY, 0 ); + + glEnd(); + } + + + if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_4X ) ) { + char buffer[30]; + if( theApp.showSpeed == 1 ) { + sprintf( buffer, "%3d%%", systemSpeed ); + } else { + sprintf( buffer, "%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, theApp.showRenderedFrames ); + } + glFontBegin(&font); + glPushMatrix(); + float fontscale = (float)theApp.surfaceSizeX / 100.0; + glScalef(fontscale, fontscale, fontscale); + glColor4f(1.0f, 0.25f, 0.25f, 1.0f); + glFontTextOut(buffer, (theApp.surfaceSizeX-(strlen(buffer)*11))/(fontscale*2), (theApp.surfaceSizeY-20)/fontscale, 0); + glPopMatrix(); + glFontEnd(); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glBindTexture( GL_TEXTURE_2D, texture ); + } + if( theApp.screenMessage ) { + if( ( ( GetTickCount() - theApp.screenMessageTime ) < 3000 ) && !theApp.disableStatusMessage ) { + glFontBegin(&font); + glPushMatrix(); + + float fontscale = (float)theApp.surfaceSizeX / 100.0; + glScalef(fontscale, fontscale, fontscale); + glColor4f(1.0f, 0.25f, 0.25f, 1.0f); + glFontTextOut((char *)((const char *)theApp.screenMessageBuffer), (theApp.surfaceSizeX-(theApp.screenMessageBuffer.GetLength()*11))/(fontscale*2), (theApp.surfaceSizeY-40)/fontscale, 0); + glPopMatrix(); + glFontEnd(); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + glBindTexture( GL_TEXTURE_2D, texture ); + } else { + theApp.screenMessage = false; + } + } + + + glFlush(); + SwapBuffers( hDC ); + // since OpenGL draws on the back buffer, + // we have to swap it to the front buffer to see it + + // draw informations with GDI on the front buffer +} + + +void OpenGLDisplay::resize( int w, int h ) +{ + initializeMatrices( w, h ); +} + + +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; + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); +} + + +void OpenGLDisplay::initializeMatrices( int w, int h ) +{ + if( theApp.fullScreenStretch ) { + glViewport( 0, 0, w, h ); + } else { + calculateDestRect( w, h ); + glViewport( + destRect.left, + destRect.top, + destRect.right - destRect.left, + destRect.bottom - destRect.top ); + } + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( + /* left */ 1.0f, + /* right */ (GLdouble)(w - 1), + /* bottom */ (GLdouble)(h - 1), + /* top */ 1.0f, + 0.0f, + 1.0f ); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +bool OpenGLDisplay::initializeTexture( int w, int h ) +{ + // size = 2^n + // w = 24 > size = 256 = 2^8 + // w = 255 > size = 256 = 2^8 + // w = 256 > size = 512 = 2^9 + // w = 300 > size = 512 = 2^9 + // OpenGL textures have to be square and a power of 2 + + float n1 = log10( (float)w ) / log10( 2.0f ); + float n2 = log10( (float)h ) / log10( 2.0f ); + float n = ( n1 > n2 ) ? n1 : n2; + + if( ((float)((int)n)) != n ) { + // round up + n = ((float)((int)n)) + 1.0f; + } + + size = pow( 2.0f, n ); + + glGenTextures( 1, &texture ); + glBindTexture( GL_TEXTURE_2D, texture ); + updateFiltering( theApp.glFilter ); + + glTexImage2D( + GL_TEXTURE_2D, + 0, + GL_RGBA, + (GLsizei)size, + (GLsizei)size, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + NULL ); + + width = w; + height = h; + + return ( glGetError() == GL_NO_ERROR) ? true : false; +} + + +void OpenGLDisplay::setVSync( int interval ) +{ + const char *extensions = (const char *)glGetString( GL_EXTENSIONS ); + + if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) { + winlog( "Error: WGL_EXT_swap_control extension not supported on your computer.\n" ); + return; + } else { + PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = NULL; + wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" ); + if( wglSwapIntervalEXT ) { + wglSwapIntervalEXT( interval ); + } + } +} + + +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; + } + if (filterData) + free(filterData); + filterData = (u8 *)malloc(4*w*h); + + } + + return true; +} + + +void OpenGLDisplay::calculateDestRect( int w, int h ) +{ + float scaleX = (float)w / (float)width; + float scaleY = (float)h / (float)height; + float min = (scaleX < scaleY) ? scaleX : scaleY; + if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) { + min = (float)theApp.fsMaxScale; + } + destRect.left = 0; + destRect.top = 0; + destRect.right = (LONG)(width * min); + destRect.bottom = (LONG)(height * min); + if( destRect.right != w ) { + LONG diff = (w - destRect.right) / 2; + destRect.left += diff; + destRect.right += diff; + } + if( destRect.bottom != h ) { + LONG diff = (h - destRect.bottom) / 2; + destRect.top += diff; + destRect.bottom += diff; + } +} + + +void OpenGLDisplay::setOption( const char *option, int value ) +{ + if( !_tcscmp( option, _T("vsync") ) ) { + setVSync( value ); + } + + if( !_tcscmp( option, _T("glFilter") ) ) { + updateFiltering( value ); + } + + if( !_tcscmp( option, _T("maxScale") ) ) { + initializeMatrices( theApp.dest.right, theApp.dest.bottom ); + } + + if( !_tcscmp( option, _T("fullScreenStretch") ) ) { + initializeMatrices( theApp.dest.right, theApp.dest.bottom ); + } +} + + +int OpenGLDisplay::selectFullScreenMode( GUID ** ) +{ + HWND wnd = GetDesktopWindow(); + RECT r; + GetWindowRect( wnd, &r ); + int w = ( r.right - r.left ) & 0xFFF; + int h = ( r.bottom - r.top ) & 0xFFF; + 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 index 5f164fe8..f9bd7b45 100644 --- a/src/win32/PaletteView.cpp +++ b/src/win32/PaletteView.cpp @@ -85,10 +85,10 @@ BEGIN_MESSAGE_MAP(PaletteView, CDialog) ///////////////////////////////////////////////////////////////////////////// // PaletteView message handlers -BOOL PaletteView::OnInitDialog() +BOOL PaletteView::OnInitDialog() { CDialog::OnInitDialog(); - + DIALOG_SIZER_START( sz ) DIALOG_SIZER_END() SetData(sz, @@ -96,13 +96,13 @@ BOOL PaletteView::OnInitDialog() HKEY_CURRENT_USER, "Software\\Emulators\\VisualBoyAdvance\\Viewer\\PaletteView", NULL); - + paletteView.setPaletteAddress(0); - paletteView.refresh(); - + paletteView.refresh(); + paletteViewOBJ.setPaletteAddress(0x200); - paletteViewOBJ.refresh(); - + paletteViewOBJ.refresh(); + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -119,7 +119,7 @@ void PaletteView::save(int which) 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, @@ -144,7 +144,7 @@ void PaletteView::save(int which) p = &paletteView; else p = &paletteViewOBJ; - + switch(dlg.getFilterIndex()) { case 0: case 1: @@ -160,20 +160,20 @@ void PaletteView::save(int which) } } -void PaletteView::OnSaveBg() +void PaletteView::OnSaveBg() { save(0); } -void PaletteView::OnSaveObj() +void PaletteView::OnSaveObj() { save(1); } -void PaletteView::OnRefresh2() +void PaletteView::OnRefresh2() { paletteView.refresh(); - paletteViewOBJ.refresh(); + paletteViewOBJ.refresh(); } void PaletteView::update() @@ -182,20 +182,20 @@ void PaletteView::update() } -void PaletteView::OnAutoUpdate() +void PaletteView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } -void PaletteView::OnClose() +void PaletteView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } @@ -208,8 +208,8 @@ LRESULT PaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) if(address >= 0x200) address = 0x5000200 + 2*(address & 255); else - address = 0x5000000 + 2*(address & 255); - + address = 0x5000000 + 2*(address & 255); + buffer.Format("0x%08X", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); @@ -235,11 +235,11 @@ LRESULT PaletteView::OnPalInfo(WPARAM wParam, LPARAM lParam) paletteView.setSelected(-1); } else paletteViewOBJ.setSelected(-1); - + return TRUE; } -void PaletteView::PostNcDestroy() +void PaletteView::PostNcDestroy() { delete this; } diff --git a/src/win32/PaletteViewControl.cpp b/src/win32/PaletteViewControl.cpp index a769d565..c2023e56 100644 --- a/src/win32/PaletteViewControl.cpp +++ b/src/win32/PaletteViewControl.cpp @@ -39,7 +39,7 @@ bool PaletteViewControl::isRegistered = false; PaletteViewControl::PaletteViewControl() { memset(&bmpInfo.bmiHeader, 0, sizeof(bmpInfo.bmiHeader)); - + bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); bmpInfo.bmiHeader.biWidth = 256; bmpInfo.bmiHeader.biHeight = -256; @@ -54,7 +54,7 @@ PaletteViewControl::PaletteViewControl() colors = 256; paletteAddress = 0; - + ZeroMemory(palette, 512); selected = -1; @@ -87,7 +87,7 @@ void PaletteViewControl::init(int c, int w, int h) this->colors = c; bmpInfo.bmiHeader.biWidth = w; - bmpInfo.bmiHeader.biHeight = -h; + bmpInfo.bmiHeader.biHeight = -h; } @@ -140,7 +140,7 @@ bool PaletteViewControl::saveMSPAL(const char *name) 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; @@ -170,7 +170,7 @@ bool PaletteViewControl::saveJASCPAL(const char *name) 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; @@ -185,7 +185,7 @@ bool PaletteViewControl::saveJASCPAL(const char *name) } fclose(f); - return true; + return true; } void PaletteViewControl::setPaletteAddress(int address) @@ -274,7 +274,7 @@ void PaletteViewControl::render(u16 color, int x, int y) *start++ = b; *start++ = g; *start++ = r; - + start += skip; } } @@ -290,7 +290,7 @@ void PaletteViewControl::refresh() InvalidateRect(NULL, FALSE); } -void PaletteViewControl::OnLButtonDown(UINT nFlags, CPoint point) +void PaletteViewControl::OnLButtonDown(UINT nFlags, CPoint point) { int x = point.x; int y = point.y; @@ -304,33 +304,33 @@ void PaletteViewControl::OnLButtonDown(UINT nFlags, CPoint point) 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) +BOOL PaletteViewControl::OnEraseBkgnd(CDC* pDC) { return TRUE; } -void PaletteViewControl::OnPaint() +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, @@ -372,7 +372,7 @@ void PaletteViewControl::OnPaint() 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); @@ -382,7 +382,7 @@ void PaletteViewControl::OnPaint() memDC.SelectObject(old); pen.DeleteObject(); } - + dc.BitBlt(0,0,w,h, &memDC,0,0,SRCCOPY); diff --git a/src/win32/PaletteViewControl.h b/src/win32/PaletteViewControl.h index a7c89228..8c5741e6 100644 --- a/src/win32/PaletteViewControl.h +++ b/src/win32/PaletteViewControl.h @@ -41,7 +41,7 @@ class PaletteViewControl : public CWnd int selected; protected: u16 palette[256]; - int paletteAddress; + int paletteAddress; // Construction public: PaletteViewControl(); diff --git a/src/win32/Reg.cpp b/src/win32/Reg.cpp index 589e8fb8..750e4ac1 100644 --- a/src/win32/Reg.cpp +++ b/src/win32/Reg.cpp @@ -62,14 +62,14 @@ 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; @@ -95,14 +95,14 @@ DWORD regQueryDwordValue(const char * key, DWORD def, bool 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; @@ -121,15 +121,15 @@ BOOL regQueryBinaryValue(const char * key, char *value, int count) 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; @@ -198,12 +198,12 @@ void regSetBinaryValue(const char *key, char *value, int count) CString k = key; k += "Count"; wsprintf(buffer, "%u", count); - + WritePrivateProfileString(VBA_PREF, k, buffer, *regVbaPath); - + WritePrivateProfileStruct(VBA_PREF, key, value, @@ -292,7 +292,7 @@ bool regAssociateType(const char *type, const char *desc, const char *applicatio RegCloseKey(key); return true; } - + RegCloseKey(key); } return false; @@ -314,7 +314,7 @@ static void regExportSettingsToINI(HKEY key, const char *section) &type, (LPBYTE)buffer, &size); - + if(res == ERROR_SUCCESS) { switch(type) { case REG_DWORD: @@ -336,7 +336,7 @@ static void regExportSettingsToINI(HKEY key, const char *section) case REG_BINARY: { char temp[256]; - + wsprintf(temp, "%u", size); CString k = valueName; k += "Count"; @@ -359,14 +359,14 @@ static void regExportSettingsToINI(HKEY key, const char *section) } void regExportSettingsToINI() -{ +{ if(vbKey != NULL) { regExportSettingsToINI(vbKey, VBA_PREF); } HKEY key; - if(RegOpenKey(HKEY_CURRENT_USER, + if(RegOpenKey(HKEY_CURRENT_USER, "Software\\Emulators\\VisualBoyAdvance\\Viewer", &key) == ERROR_SUCCESS) { regExportSettingsToINI(key, "Viewer"); diff --git a/src/win32/ResizeDlg.cpp b/src/win32/ResizeDlg.cpp index 93fb4735..70279967 100644 --- a/src/win32/ResizeDlg.cpp +++ b/src/win32/ResizeDlg.cpp @@ -10,11 +10,11 @@ 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: + 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. + 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 @@ -104,13 +104,13 @@ void ApiFailure(char *pcszFilename, int nLine, char *pcszExpression ) 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!" @@ -131,7 +131,7 @@ void ApiFailure(char *pcszFilename, int nLine, char *pcszExpression ) , dwLastError , lpMsgBuf ); - + (void)LocalFree( (LPVOID)lpMsgBuf ); HWND hwndParent = ::GetActiveWindow(); hwndParent = ::GetLastActivePopup( hwndParent ); @@ -151,7 +151,7 @@ long FASTCALL RegQueryValueExRecursive( HKEY hKey, LPCTSTR lpValueName, LPDWORD TCHAR szBuffer[ 256 ]; R_ASSERT( lstrlen( lpValueName ) < countof( szBuffer ) ); (void)lstrcpy( szBuffer, lpValueName ); - + LPTSTR pszBuffer = szBuffer; LPTSTR pszLast = szBuffer; while( *pszBuffer ) @@ -175,7 +175,7 @@ long FASTCALL RegQueryValueExRecursive( HKEY hKey, LPCTSTR lpValueName, LPDWORD } return -1; } - + bool m_bNeedToCloseKey = false; if( pszLast != szBuffer ) { @@ -189,7 +189,7 @@ long FASTCALL RegQueryValueExRecursive( HKEY hKey, LPCTSTR lpValueName, LPDWORD hKey = hkeyTemp; m_bNeedToCloseKey = true; } - + long lRet = RegQueryValueEx( hKey, lpValueName, lpReserved, lpType, lpData, lpcbData ); if( m_bNeedToCloseKey ) { @@ -203,7 +203,7 @@ long FASTCALL RegSetValueExRecursive( HKEY hKey, LPCTSTR lpValueName, DWORD Rese TCHAR szBuffer[ 256 ]; R_ASSERT( lstrlen( lpValueName ) < countof( szBuffer ) ); (void)lstrcpy( szBuffer, lpValueName ); - + LPTSTR pszBuffer = szBuffer; LPTSTR pszLast = szBuffer; while( *pszBuffer ) @@ -226,7 +226,7 @@ long FASTCALL RegSetValueExRecursive( HKEY hKey, LPCTSTR lpValueName, DWORD Rese } return -1; } - + bool m_bNeedToCloseKey = false; if( pszLast != szBuffer ) { @@ -242,7 +242,7 @@ long FASTCALL RegSetValueExRecursive( HKEY hKey, LPCTSTR lpValueName, DWORD Rese hKey = hkeyTemp; m_bNeedToCloseKey = true; } - + long lRet = RegSetValueEx( hKey, lpValueName, Reserved, dwType, lpData, cbData ); if( m_bNeedToCloseKey ) { @@ -279,9 +279,9 @@ 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 @@ -323,7 +323,7 @@ void *ResizeDlg::AddDialogData() if( !pdd ) { pdd = (DialogData *)calloc(1, sizeof(DialogData)); } - + if( pdd ) { // // Store some sizes etc. for later. @@ -331,8 +331,8 @@ void *ResizeDlg::AddDialogData() GetWindowRect( rc ); pdd->m_ptSmallest.x = rc.Width(); pdd->m_ptSmallest.y = rc.Height(); - - + + GetClientRect( rc ); pdd->m_sizeClient = rc.Size(); dd = pdd; @@ -349,7 +349,7 @@ BOOL ResizeDlg::SetData(const DialogSizerSizingItem *psd, // // 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 + // 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 @@ -385,10 +385,10 @@ BOOL ResizeDlg::SetData(const DialogSizerSizingItem *psd, 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 + // by attempting to load the RegistryData structure if( hkRootSave && pcszName ) { RegistryData rd; DWORD dwSize = sizeof( RegistryData ); @@ -396,7 +396,7 @@ BOOL ResizeDlg::SetData(const DialogSizerSizingItem *psd, 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 ) ); } } @@ -424,42 +424,42 @@ void ResizeDlg::UpdateWindowSize(const int cx, const int cy, HWND hwnd) 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 ); @@ -532,7 +532,7 @@ BOOL ResizeDlg::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *res ) { // // Our opportunty for cleanup. - // Simply acquire all of our objects, free the appropriate memory and remove the + // 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; @@ -540,20 +540,20 @@ BOOL ResizeDlg::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *res ) 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; } diff --git a/src/win32/ResizeDlg.h b/src/win32/ResizeDlg.h index e09d5893..09c28e44 100644 --- a/src/win32/ResizeDlg.h +++ b/src/win32/ResizeDlg.h @@ -42,7 +42,7 @@ typedef struct DialogSizerSizingItem // sdi #define DIALOG_SIZER_END() { 0xFFFFFFFF, 0xFFFFFFFF } }; class ResizeDlg : public CDialog { - void *dd; + void *dd; public: ResizeDlg(UINT id, CWnd *parent = NULL); diff --git a/src/win32/RewindInterval.cpp b/src/win32/RewindInterval.cpp index 6b7c1bd2..1928b912 100644 --- a/src/win32/RewindInterval.cpp +++ b/src/win32/RewindInterval.cpp @@ -62,12 +62,12 @@ BEGIN_MESSAGE_MAP(RewindInterval, CDialog) ///////////////////////////////////////////////////////////////////////////// // RewindInterval message handlers -void RewindInterval::OnCancel() +void RewindInterval::OnCancel() { EndDialog(-1); } -void RewindInterval::OnOk() +void RewindInterval::OnOk() { CString buffer; @@ -78,15 +78,15 @@ void RewindInterval::OnOk() if(v >= 0 && v <= 600) { EndDialog(v); } else - systemMessage(IDS_INVALID_INTERVAL_VALUE, + systemMessage(IDS_INVALID_INTERVAL_VALUE, "Invalid rewind interval value. Please enter a number " "between 0 and 600 seconds"); } -BOOL RewindInterval::OnInitDialog() +BOOL RewindInterval::OnInitDialog() { CDialog::OnInitDialog(); - + m_interval.LimitText(3); CString buffer; @@ -94,7 +94,7 @@ BOOL RewindInterval::OnInitDialog() m_interval.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.cpp b/src/win32/RomInfo.cpp index 1569d72f..4ff04b58 100644 --- a/src/win32/RomInfo.cpp +++ b/src/win32/RomInfo.cpp @@ -305,34 +305,34 @@ BEGIN_MESSAGE_MAP(RomInfoGB, CDialog) ///////////////////////////////////////////////////////////////////////////// // RomInfoGB message handlers -void RomInfoGB::OnOk() +void RomInfoGB::OnOk() { EndDialog(TRUE); } -BOOL RomInfoGB::OnInitDialog() +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_CODE)->SetWindowText(buffer); } GetDlgItem(IDC_ROM_MAKER_NAME2)->SetWindowText(winGBARomInfoFindMakerCode(buffer)); - + sprintf(buffer, "%02x", rom[0x146]); GetDlgItem(IDC_ROM_UNIT_CODE)->SetWindowText(buffer); @@ -484,7 +484,7 @@ BOOL RomInfoGB::OnInitDialog() sprintf(buffer, "%02x", rom[0x14b]); GetDlgItem(IDC_ROM_LIC_CODE)->SetWindowText(buffer); - + sprintf(buffer, "%02x", rom[0x14c]); GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer); @@ -495,7 +495,7 @@ BOOL RomInfoGB::OnInitDialog() } crc = 256 - crc; - + sprintf(buffer, "%02x (%02x)", crc, rom[0x14d]); GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer); @@ -510,7 +510,7 @@ BOOL RomInfoGB::OnInitDialog() 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 } @@ -546,12 +546,12 @@ BEGIN_MESSAGE_MAP(RomInfoGBA, CDialog) ///////////////////////////////////////////////////////////////////////////// // RomInfoGBA message handlers -void RomInfoGBA::OnOk() +void RomInfoGBA::OnOk() { EndDialog(TRUE); } -BOOL RomInfoGBA::OnInitDialog() +BOOL RomInfoGBA::OnInitDialog() { CDialog::OnInitDialog(); @@ -570,7 +570,7 @@ BOOL RomInfoGBA::OnInitDialog() 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); @@ -593,7 +593,7 @@ BOOL RomInfoGBA::OnInitDialog() 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/Sound.h b/src/win32/Sound.h index 3f4cc2ad..06fb7b09 100644 --- a/src/win32/Sound.h +++ b/src/win32/Sound.h @@ -20,7 +20,7 @@ #ifndef VBA_WIN32_SOUND_H #define VBA_WIN32_SOUND_H -class ISound +class ISound { public: virtual ~ISound() {}; diff --git a/src/win32/StringTokenizer.cpp b/src/win32/StringTokenizer.cpp index b7ea3136..3c611ec6 100644 --- a/src/win32/StringTokenizer.cpp +++ b/src/win32/StringTokenizer.cpp @@ -49,7 +49,7 @@ 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); diff --git a/src/win32/StringTokenizer.h b/src/win32/StringTokenizer.h index 7deae2da..2e2383bf 100644 --- a/src/win32/StringTokenizer.h +++ b/src/win32/StringTokenizer.h @@ -28,7 +28,7 @@ #pragma once #endif // _MSC_VER > 1000 -class StringTokenizer +class StringTokenizer { public: const char * next(); diff --git a/src/win32/Throttle.cpp b/src/win32/Throttle.cpp index b143d0cc..6ce824ad 100644 --- a/src/win32/Throttle.cpp +++ b/src/win32/Throttle.cpp @@ -61,22 +61,22 @@ BEGIN_MESSAGE_MAP(Throttle, CDialog) ///////////////////////////////////////////////////////////////////////////// // Throttle message handlers -BOOL Throttle::OnInitDialog() +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() +void Throttle::OnCancel() { EndDialog(false); } -void Throttle::OnOk() +void Throttle::OnOk() { UpdateData(); diff --git a/src/win32/TileView.cpp b/src/win32/TileView.cpp index 40cd0f64..71b12fdb 100644 --- a/src/win32/TileView.cpp +++ b/src/win32/TileView.cpp @@ -55,7 +55,7 @@ TileView::TileView(CWnd* pParent /*=NULL*/) m_stretch = FALSE; //}}AFX_DATA_INIT autoUpdate = false; - + memset(&bmpInfo, 0, sizeof(bmpInfo)); bmpInfo.bmiHeader.biSize = sizeof(bmpInfo.bmiHeader); @@ -121,7 +121,7 @@ BEGIN_MESSAGE_MAP(TileView, CDialog) void TileView::saveBMP(const char *name) { u8 writeBuffer[1024 * 3]; - + FILE *fp = fopen(name,"wb"); if(!fp) { @@ -178,7 +178,7 @@ void TileView::saveBMP(const char *name) } pixU8 -= 2*3*w; fwrite(writeBuffer, 1, 3*w, fp); - + b = writeBuffer; } @@ -189,14 +189,14 @@ void TileView::saveBMP(const char *name) 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, @@ -245,16 +245,16 @@ void TileView::savePNG(const char *name) 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); @@ -263,7 +263,7 @@ void TileView::savePNG(const char *name) } -void TileView::OnSave() +void TileView::OnSave() { if(rom != NULL) { @@ -314,7 +314,7 @@ void TileView::renderTile256(int tile, int x, int y, u8 *charBase, u16 *palette) *bmp++ = ((color >> 10) & 0x1f) << 3; *bmp++ = ((color >> 5) & 0x1f) << 3; - *bmp++ = (color & 0x1f) << 3; + *bmp++ = (color & 0x1f) << 3; } bmp += 31*24; // advance line @@ -354,7 +354,7 @@ void TileView::render() { u16 *palette = (u16 *)paletteRAM; u8 *charBase = &vram[this->charBase * 0x4000]; - + int maxY; if(is256Colors) { @@ -386,7 +386,7 @@ void TileView::render() maxY = 16; for(int y = 0; y < maxY; y++) { for(int x = 0; x < 32; x++) { - renderTile16(tile, x, y, charBase, palette); + renderTile16(tile, x, y, charBase, palette); tile++; } } @@ -409,10 +409,10 @@ void TileView::update() } -BOOL TileView::OnInitDialog() +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) @@ -442,27 +442,27 @@ BOOL TileView::OnInitDialog() 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() +void TileView::OnClose() { theApp.winRemoveUpdateListener(this); - + DestroyWindow(); } -void TileView::OnAutoUpdate() +void TileView::OnAutoUpdate() { autoUpdate = !autoUpdate; if(autoUpdate) { theApp.winAddUpdateListener(this); } else { - theApp.winRemoveUpdateListener(this); - } + theApp.winRemoveUpdateListener(this); + } } @@ -475,53 +475,53 @@ void TileView::paint() } -void TileView::On16Colors() +void TileView::On16Colors() { is256Colors = 0; paint(); } -void TileView::On256Colors() +void TileView::On256Colors() { is256Colors = 1; paint(); } -void TileView::OnCharbase0() +void TileView::OnCharbase0() { charBase = 0; paint(); } -void TileView::OnCharbase1() +void TileView::OnCharbase1() { charBase = 1; paint(); } -void TileView::OnCharbase2() +void TileView::OnCharbase2() { charBase = 2; paint(); } -void TileView::OnCharbase3() +void TileView::OnCharbase3() { charBase = 3; paint(); } -void TileView::OnCharbase4() +void TileView::OnCharbase4() { charBase = 4; paint(); } -void TileView::OnStretch() +void TileView::OnStretch() { tileView.setStretch(!tileView.getStretch()); paint(); - regSetDwordValue("tileViewStretch", tileView.getStretch()); + regSetDwordValue("tileViewStretch", tileView.getStretch()); } LRESULT TileView::OnMapInfo(WPARAM wParam, LPARAM lParam) @@ -544,7 +544,7 @@ LRESULT TileView::OnMapInfo(WPARAM wParam, LPARAM lParam) buffer.Format("%08x", address); GetDlgItem(IDC_ADDRESS)->SetWindowText(buffer); - + return TRUE; } @@ -552,7 +552,7 @@ LRESULT TileView::OnColInfo(WPARAM wParam, LPARAM) { u16 c = (u16)wParam; - color.setColor(c); + color.setColor(c); int r = (c & 0x1f); int g = (c & 0x3e0) >> 5; @@ -571,7 +571,7 @@ LRESULT TileView::OnColInfo(WPARAM wParam, LPARAM) return TRUE; } -void TileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void TileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch(nSBCode) { case TB_THUMBPOSITION: @@ -584,7 +584,7 @@ void TileView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) paint(); } -void TileView::PostNcDestroy() +void TileView::PostNcDestroy() { delete this; } diff --git a/src/win32/UniVideoModeDlg.cpp b/src/win32/UniVideoModeDlg.cpp index 9dc521d0..4025aad6 100644 --- a/src/win32/UniVideoModeDlg.cpp +++ b/src/win32/UniVideoModeDlg.cpp @@ -1,279 +1,279 @@ -// source\win32\UniVideoModeDlg.cpp : Implementierungsdatei -// - -#include ".\univideomodedlg.h" - -// UniVideoModeDlg-Dialogfeld - -IMPLEMENT_DYNAMIC(UniVideoModeDlg, CDialog) -UniVideoModeDlg::UniVideoModeDlg(CWnd* pParent /*=NULL*/, int *width, int *height, int *BPP, int *freq, int *adapt) - : CDialog(UniVideoModeDlg::IDD, pParent) -{ - WidthList = 0; - HeightList = 0; - BPPList = 0; - FreqList = 0; - iDisplayDevice = 0; - SelectedWidth = width; - SelectedHeight = height; - SelectedBPP = BPP; - SelectedFreq = freq; - SelectedAdapter = adapt; - pD3D = NULL; - d3dDLL = NULL; - nAdapters = 1; -} - -UniVideoModeDlg::~UniVideoModeDlg() -{ - if (WidthList) delete [] WidthList; - if (HeightList) delete [] HeightList; - if (BPPList) delete [] BPPList; - if (FreqList) delete [] FreqList; -} - -void UniVideoModeDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(UniVideoModeDlg, CDialog) - ON_WM_CREATE() - ON_BN_CLICKED(IDOK, OnBnClickedOk) - ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel) -// ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) -//ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) -ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) -ON_BN_CLICKED(IDC_BUTTON_MAXSCALE, OnBnClickedButtonMaxscale) -ON_BN_CLICKED(IDC_CHECK_STRETCHTOFIT, OnBnClickedCheckStretchtofit) -END_MESSAGE_MAP() - - -// UniVideoModeDlg-Meldungshandler - -int UniVideoModeDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CDialog::OnCreate(lpCreateStruct) == -1) - return -1; - - // TODO: Fügen Sie Ihren spezialisierten Erstellcode hier ein. - - return 0; -} - - -BOOL UniVideoModeDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - CButton* check_stretchtofit = (CButton*)GetDlgItem(IDC_CHECK_STRETCHTOFIT); - check_stretchtofit->SetCheck(theApp.fullScreenStretch ? BST_CHECKED : BST_UNCHECKED); - - CStatic* apiname = (CStatic*)GetDlgItem(IDC_APINAME); - CStatic* devicename = (CStatic*)GetDlgItem(IDC_DISPLAYDEVICE); - CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES); - CString temp; - DWORD w, h, b, f; - UINT nModes16, nModes32; - - switch (theApp.display->getType()) - { - case GDI: - apiname->SetWindowText("Windows GDI"); - DISPLAY_DEVICE dd; - dd.cb = sizeof(dd); - EnumDisplayDevices(NULL, iDisplayDevice, &dd, 0); - devicename->SetWindowText(dd.DeviceString); - DEVMODE dm; - dm.dmSize = sizeof(DEVMODE); - dm.dmDriverExtra = 0; - DWORD maxMode; - DWORD i; - for (i=0; 0 != EnumDisplaySettings(dd.DeviceName, i, &dm); i++) {} - maxMode = i-1; - listmodes->InitStorage(i, 25); - if (WidthList!=0) delete [] WidthList; - if (HeightList!=0) delete [] HeightList; - if (BPPList!=0) delete [] BPPList; - if (FreqList!=0) delete [] FreqList; - WidthList = new DWORD[i]; - HeightList = new DWORD[i]; - BPPList = new DWORD[i]; - FreqList = new DWORD[i]; - listmodes->ResetContent(); - for (i=0; iAddString(temp); - WidthList[i] = w; - HeightList[i] = h; - BPPList[i] = b; - FreqList[i] = f; - } - break; - - - case DIRECT_DRAW: - apiname->SetWindowText("DirectDraw 7"); - break; - - - case DIRECT_3D: - apiname->SetWindowText("Direct3D 9"); - // Load DirectX DLL - d3dDLL = LoadLibrary("D3D9.DLL"); - LPDIRECT3D9 (WINAPI *D3DCreate)(UINT); - D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT)) - GetProcAddress(d3dDLL, "Direct3DCreate9"); - pD3D = D3DCreate(D3D_SDK_VERSION); - nAdapters = pD3D->GetAdapterCount(); - D3DADAPTER_IDENTIFIER9 id; - pD3D->GetAdapterIdentifier(iDisplayDevice, 0, &id); - devicename->SetWindowText(id.Description); - - D3DDISPLAYMODE d3ddm; - - nModes16 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_R5G6B5); - nModes32 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_X8R8G8B8); - - listmodes->InitStorage(nModes16+nModes32, 25); - listmodes->ResetContent(); - - if (WidthList!=0) delete [] WidthList; - if (HeightList!=0) delete [] HeightList; - if (BPPList!=0) delete [] BPPList; - if (FreqList!=0) delete [] FreqList; - WidthList = new DWORD[nModes16+nModes32]; - HeightList = new DWORD[nModes16+nModes32]; - BPPList = new DWORD[nModes16+nModes32]; - FreqList = new DWORD[nModes16+nModes32]; - - b = 16; - for (UINT i = 0; i < nModes16; i++) - { - pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_R5G6B5, i, &d3ddm); - w = d3ddm.Width; - h = d3ddm.Height; - f = d3ddm.RefreshRate; - - temp.Format("%dx%dx%d @%dHz", w, h, b, f); - listmodes->AddString(temp); - - WidthList[i] = w; - HeightList[i] = h; - BPPList[i] = b; - FreqList[i] = f; - } - b = 32; - for (UINT i = 0; i < nModes32; i++) - { - pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_X8R8G8B8, i, &d3ddm); - w = d3ddm.Width; - h = d3ddm.Height; - f = d3ddm.RefreshRate; - - temp.Format("%dx%dx%d @%dHz", w, h, b, f); - listmodes->AddString(temp); - - WidthList[i+nModes16] = w; - HeightList[i+nModes16] = h; - BPPList[i+nModes16] = b; - FreqList[i+nModes16] = f; - } - - // Clean up - pD3D->Release(); - pD3D = NULL; - if(d3dDLL != NULL) - { - FreeLibrary(d3dDLL); - d3dDLL = NULL; - } - break; - - - case OPENGL: - apiname->SetWindowText("OpenGL"); - break; - } - - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - - -void UniVideoModeDlg::OnBnClickedOk() -{ - CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES); - int selection = listmodes->GetCurSel(); - if (selection == LB_ERR) - { - MessageBox("No mode selected!", "Error", MB_OK | MB_ICONWARNING); - return; - } - *SelectedWidth = WidthList[selection]; - *SelectedHeight = HeightList[selection]; - *SelectedBPP = BPPList[selection]; - *SelectedFreq = FreqList[selection]; - *SelectedAdapter = iDisplayDevice; - - EndDialog(0); -} - -void UniVideoModeDlg::OnBnClickedCancel() -{ - EndDialog(-1); -} -void UniVideoModeDlg::OnStnClickedDisplaydevice() -{ - DWORD old = iDisplayDevice; - switch (theApp.display->getType()) - { - case GDI: - DISPLAY_DEVICE dd; - dd.cb = sizeof(dd); - if (0 == EnumDisplayDevices(NULL, ++iDisplayDevice, &dd, 0)) - iDisplayDevice = 0; - break; - - - case DIRECT_DRAW: - break; - - - case DIRECT_3D: - iDisplayDevice++; - if (iDisplayDevice == nAdapters) iDisplayDevice = 0; - break; - - - case OPENGL: - break; - } - - if (iDisplayDevice != old) - OnInitDialog(); -} - -void UniVideoModeDlg::OnBnClickedButtonMaxscale() -{ - MaxScale dlg; - theApp.winCheckFullscreen(); - dlg.DoModal(); -} - -void UniVideoModeDlg::OnBnClickedCheckStretchtofit() -{ - theApp.fullScreenStretch = !theApp.fullScreenStretch; - theApp.updateWindowSize(theApp.videoOption); - if(theApp.display) - theApp.display->clear(); - this->SetFocus(); -} +// source\win32\UniVideoModeDlg.cpp : Implementierungsdatei +// + +#include ".\univideomodedlg.h" + +// UniVideoModeDlg-Dialogfeld + +IMPLEMENT_DYNAMIC(UniVideoModeDlg, CDialog) +UniVideoModeDlg::UniVideoModeDlg(CWnd* pParent /*=NULL*/, int *width, int *height, int *BPP, int *freq, int *adapt) + : CDialog(UniVideoModeDlg::IDD, pParent) +{ + WidthList = 0; + HeightList = 0; + BPPList = 0; + FreqList = 0; + iDisplayDevice = 0; + SelectedWidth = width; + SelectedHeight = height; + SelectedBPP = BPP; + SelectedFreq = freq; + SelectedAdapter = adapt; + pD3D = NULL; + d3dDLL = NULL; + nAdapters = 1; +} + +UniVideoModeDlg::~UniVideoModeDlg() +{ + if (WidthList) delete [] WidthList; + if (HeightList) delete [] HeightList; + if (BPPList) delete [] BPPList; + if (FreqList) delete [] FreqList; +} + +void UniVideoModeDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(UniVideoModeDlg, CDialog) + ON_WM_CREATE() + ON_BN_CLICKED(IDOK, OnBnClickedOk) + ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel) +// ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) +//ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) +ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice) +ON_BN_CLICKED(IDC_BUTTON_MAXSCALE, OnBnClickedButtonMaxscale) +ON_BN_CLICKED(IDC_CHECK_STRETCHTOFIT, OnBnClickedCheckStretchtofit) +END_MESSAGE_MAP() + + +// UniVideoModeDlg-Meldungshandler + +int UniVideoModeDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDialog::OnCreate(lpCreateStruct) == -1) + return -1; + + // TODO: Fügen Sie Ihren spezialisierten Erstellcode hier ein. + + return 0; +} + + +BOOL UniVideoModeDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CButton* check_stretchtofit = (CButton*)GetDlgItem(IDC_CHECK_STRETCHTOFIT); + check_stretchtofit->SetCheck(theApp.fullScreenStretch ? BST_CHECKED : BST_UNCHECKED); + + CStatic* apiname = (CStatic*)GetDlgItem(IDC_APINAME); + CStatic* devicename = (CStatic*)GetDlgItem(IDC_DISPLAYDEVICE); + CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES); + CString temp; + DWORD w, h, b, f; + UINT nModes16, nModes32; + + switch (theApp.display->getType()) + { + case GDI: + apiname->SetWindowText("Windows GDI"); + DISPLAY_DEVICE dd; + dd.cb = sizeof(dd); + EnumDisplayDevices(NULL, iDisplayDevice, &dd, 0); + devicename->SetWindowText(dd.DeviceString); + DEVMODE dm; + dm.dmSize = sizeof(DEVMODE); + dm.dmDriverExtra = 0; + DWORD maxMode; + DWORD i; + for (i=0; 0 != EnumDisplaySettings(dd.DeviceName, i, &dm); i++) {} + maxMode = i-1; + listmodes->InitStorage(i, 25); + if (WidthList!=0) delete [] WidthList; + if (HeightList!=0) delete [] HeightList; + if (BPPList!=0) delete [] BPPList; + if (FreqList!=0) delete [] FreqList; + WidthList = new DWORD[i]; + HeightList = new DWORD[i]; + BPPList = new DWORD[i]; + FreqList = new DWORD[i]; + listmodes->ResetContent(); + for (i=0; iAddString(temp); + WidthList[i] = w; + HeightList[i] = h; + BPPList[i] = b; + FreqList[i] = f; + } + break; + + + case DIRECT_DRAW: + apiname->SetWindowText("DirectDraw 7"); + break; + + + case DIRECT_3D: + apiname->SetWindowText("Direct3D 9"); + // Load DirectX DLL + d3dDLL = LoadLibrary("D3D9.DLL"); + LPDIRECT3D9 (WINAPI *D3DCreate)(UINT); + D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT)) + GetProcAddress(d3dDLL, "Direct3DCreate9"); + pD3D = D3DCreate(D3D_SDK_VERSION); + nAdapters = pD3D->GetAdapterCount(); + D3DADAPTER_IDENTIFIER9 id; + pD3D->GetAdapterIdentifier(iDisplayDevice, 0, &id); + devicename->SetWindowText(id.Description); + + D3DDISPLAYMODE d3ddm; + + nModes16 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_R5G6B5); + nModes32 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_X8R8G8B8); + + listmodes->InitStorage(nModes16+nModes32, 25); + listmodes->ResetContent(); + + if (WidthList!=0) delete [] WidthList; + if (HeightList!=0) delete [] HeightList; + if (BPPList!=0) delete [] BPPList; + if (FreqList!=0) delete [] FreqList; + WidthList = new DWORD[nModes16+nModes32]; + HeightList = new DWORD[nModes16+nModes32]; + BPPList = new DWORD[nModes16+nModes32]; + FreqList = new DWORD[nModes16+nModes32]; + + b = 16; + for (UINT i = 0; i < nModes16; i++) + { + pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_R5G6B5, i, &d3ddm); + w = d3ddm.Width; + h = d3ddm.Height; + f = d3ddm.RefreshRate; + + temp.Format("%dx%dx%d @%dHz", w, h, b, f); + listmodes->AddString(temp); + + WidthList[i] = w; + HeightList[i] = h; + BPPList[i] = b; + FreqList[i] = f; + } + b = 32; + for (UINT i = 0; i < nModes32; i++) + { + pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_X8R8G8B8, i, &d3ddm); + w = d3ddm.Width; + h = d3ddm.Height; + f = d3ddm.RefreshRate; + + temp.Format("%dx%dx%d @%dHz", w, h, b, f); + listmodes->AddString(temp); + + WidthList[i+nModes16] = w; + HeightList[i+nModes16] = h; + BPPList[i+nModes16] = b; + FreqList[i+nModes16] = f; + } + + // Clean up + pD3D->Release(); + pD3D = NULL; + if(d3dDLL != NULL) + { + FreeLibrary(d3dDLL); + d3dDLL = NULL; + } + break; + + + case OPENGL: + apiname->SetWindowText("OpenGL"); + break; + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + + +void UniVideoModeDlg::OnBnClickedOk() +{ + CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES); + int selection = listmodes->GetCurSel(); + if (selection == LB_ERR) + { + MessageBox("No mode selected!", "Error", MB_OK | MB_ICONWARNING); + return; + } + *SelectedWidth = WidthList[selection]; + *SelectedHeight = HeightList[selection]; + *SelectedBPP = BPPList[selection]; + *SelectedFreq = FreqList[selection]; + *SelectedAdapter = iDisplayDevice; + + EndDialog(0); +} + +void UniVideoModeDlg::OnBnClickedCancel() +{ + EndDialog(-1); +} +void UniVideoModeDlg::OnStnClickedDisplaydevice() +{ + DWORD old = iDisplayDevice; + switch (theApp.display->getType()) + { + case GDI: + DISPLAY_DEVICE dd; + dd.cb = sizeof(dd); + if (0 == EnumDisplayDevices(NULL, ++iDisplayDevice, &dd, 0)) + iDisplayDevice = 0; + break; + + + case DIRECT_DRAW: + break; + + + case DIRECT_3D: + iDisplayDevice++; + if (iDisplayDevice == nAdapters) iDisplayDevice = 0; + break; + + + case OPENGL: + break; + } + + if (iDisplayDevice != old) + OnInitDialog(); +} + +void UniVideoModeDlg::OnBnClickedButtonMaxscale() +{ + MaxScale dlg; + theApp.winCheckFullscreen(); + dlg.DoModal(); +} + +void UniVideoModeDlg::OnBnClickedCheckStretchtofit() +{ + theApp.fullScreenStretch = !theApp.fullScreenStretch; + theApp.updateWindowSize(theApp.videoOption); + if(theApp.display) + theApp.display->clear(); + this->SetFocus(); +} diff --git a/src/win32/UniVideoModeDlg.h b/src/win32/UniVideoModeDlg.h index f19b675e..1d2bc8de 100644 --- a/src/win32/UniVideoModeDlg.h +++ b/src/win32/UniVideoModeDlg.h @@ -1,47 +1,47 @@ -#pragma once - -#include "stdafx.h" +#pragma once + +#include "stdafx.h" #include -#include "VBA.h" -#include "MaxScale.h" - -// UniVideoModeDlg-Dialogfeld - -class UniVideoModeDlg : public CDialog -{ - DECLARE_DYNAMIC(UniVideoModeDlg) - -public: - UniVideoModeDlg(CWnd* pParent = NULL, int *width=0, int *height=0, int *BPP=0, int *freq=0, int *adapt=0); // Standardkonstruktor - virtual ~UniVideoModeDlg(); - -// Dialogfelddaten - enum { IDD = IDD_UNIVIDMODE }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung - - DECLARE_MESSAGE_MAP() -public: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnBnClickedOk(); - BOOL OnInitDialog(); - afx_msg void OnBnClickedCancel(); - -private: - DWORD *WidthList, *HeightList, *BPPList, *FreqList; - DWORD iDisplayDevice; +#include "VBA.h" +#include "MaxScale.h" + +// UniVideoModeDlg-Dialogfeld + +class UniVideoModeDlg : public CDialog +{ + DECLARE_DYNAMIC(UniVideoModeDlg) + +public: + UniVideoModeDlg(CWnd* pParent = NULL, int *width=0, int *height=0, int *BPP=0, int *freq=0, int *adapt=0); // Standardkonstruktor + virtual ~UniVideoModeDlg(); + +// Dialogfelddaten + enum { IDD = IDD_UNIVIDMODE }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + + DECLARE_MESSAGE_MAP() +public: + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnBnClickedOk(); + BOOL OnInitDialog(); + afx_msg void OnBnClickedCancel(); + +private: + DWORD *WidthList, *HeightList, *BPPList, *FreqList; + DWORD iDisplayDevice; HINSTANCE d3dDLL; - LPDIRECT3D9 pD3D; - UINT nAdapters; -public: - int - *SelectedWidth, - *SelectedHeight, - *SelectedBPP, - *SelectedFreq, - *SelectedAdapter; - afx_msg void OnStnClickedDisplaydevice(); - afx_msg void OnBnClickedButtonMaxscale(); - afx_msg void OnBnClickedCheckStretchtofit(); -}; + LPDIRECT3D9 pD3D; + UINT nAdapters; +public: + int + *SelectedWidth, + *SelectedHeight, + *SelectedBPP, + *SelectedFreq, + *SelectedAdapter; + afx_msg void OnStnClickedDisplaydevice(); + afx_msg void OnBnClickedButtonMaxscale(); + afx_msg void OnBnClickedCheckStretchtofit(); +}; diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 66bfbf7e..d09548ef 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -41,7 +41,7 @@ #include "../gb/gbGlobals.h" #include "../gb/gbPrinter.h" -/* Link +/* Link ---------------------*/ #include "../Link.h" /* ---------------- */ @@ -117,7 +117,7 @@ extern void InterframeCleanup(); void winlog(const char *msg, ...); -/* Link +/* Link ---------------------*/ extern int InitLink(void); extern void CloseLink(void); @@ -265,7 +265,7 @@ VBA::VBA() autoHideMenu = false; throttle = 0; throttleLastTime = 0; - autoFrameSkipLastTime = 0; + autoFrameSkipLastTime = 0; autoFrameSkip = false; vsync = false; changingVideoSize = false; @@ -322,7 +322,7 @@ VBA::VBA() autoLoadMostRecent = false; fsMaxScale = 0; romSize = 0; - + updateCount = 0; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; @@ -349,7 +349,7 @@ VBA::~VBA() char *p = strrchr(winBuffer, '\\'); if(p) *p = 0; - + regInit(winBuffer); saveSettings(); @@ -424,7 +424,7 @@ static int parseCommandLine(char *cmdline, char **argv) { char *bufp; int argc; - + argc = 0; for ( bufp = cmdline; *bufp; ) { /* Skip leading whitespace */ @@ -487,7 +487,7 @@ BOOL VBA::InitInstance() "verbose", 0, MakeInstanceFilename("VBA.ini")); - + systemDebug = GetPrivateProfileInt("config", "debug", 0, @@ -498,14 +498,14 @@ BOOL VBA::InitInstance() MakeInstanceFilename("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; - + if(!InitLink()) return FALSE;; @@ -543,7 +543,7 @@ BOOL VBA::InitInstance() winAccelMgr.Load(); winAccelMgr.UpdateWndTable(); - + winAccelMgr.UpdateMenu(menu); if (m_lpCmdLine[0]) @@ -559,14 +559,14 @@ BOOL VBA::InitInstance() if(index != -1) filename = filename.Left(index); - + if(((MainWnd*)m_pMainWnd)->FileRun()) emulating = true; else emulating = false; free(argv); } - + return TRUE; } @@ -576,7 +576,7 @@ void VBA::adjustDestRect() RECT skinRect; if(skin) skinRect = skin->GetBlitRect(); - + point.x = 0; point.y = 0; @@ -611,9 +611,9 @@ void VBA::adjustDestRect() if(skin) return; - + int menuSkip = 0; - + if(videoOption >= VIDEO_320x240 && menuToggle) { int m = GetSystemMetrics(SM_CYMENU); menuSkip = m; @@ -632,7 +632,7 @@ void VBA::adjustDestRect() dest.left = 0; dest.right = fsWidth; dest.bottom = fsHeight; - } + } } } @@ -799,7 +799,7 @@ void VBA::updateFilter() case FILTER_SUPEREAGLE: filterFunction = SuperEagle32; filterMagnification = 2; - break; + break; case FILTER_PIXELATE: filterFunction = Pixelate32; filterMagnification = 2; @@ -869,10 +869,10 @@ void VBA::updateFilter() systemColorDepth = 16; realsystemRedShift = systemRedShift; systemRedShift = 11; - realsystemGreenShift = systemGreenShift; + realsystemGreenShift = systemGreenShift; systemGreenShift = 6; - realsystemBlueShift = systemBlueShift; - systemBlueShift = 0; + realsystemBlueShift = systemBlueShift; + systemBlueShift = 0; utilUpdateSystemColorMaps(); } } @@ -909,13 +909,13 @@ void winlog(const char *msg, ...) 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); } @@ -926,9 +926,9 @@ void log(const char *msg, ...) va_start(valist, msg); buffer.FormatV(msg, valist); - + toolsLog(buffer); - + va_end(valist); } @@ -982,16 +982,16 @@ void systemDrawScreen() } break; } - + if(theApp.aviRecorder == NULL) { theApp.aviRecorder = new AVIWrite(); theApp.aviFrameNumber = 0; - + theApp.aviRecorder->SetFPS(60); - + BITMAPINFOHEADER bi; - memset(&bi, 0, sizeof(bi)); - bi.biSize = 0x28; + memset(&bi, 0, sizeof(bi)); + bi.biSize = 0x28; bi.biPlanes = 1; bi.biBitCount = 24; bi.biWidth = width; @@ -1000,12 +1000,12 @@ void systemDrawScreen() theApp.aviRecorder->SetVideoFormat(&bi); theApp.aviRecorder->Open(theApp.aviRecordName); } - + char *bmp = new char[width*height*3]; - + utilWriteBMP(bmp, width, height, pix); theApp.aviRecorder->AddFrame(theApp.aviFrameNumber, bmp); - + delete bmp; } @@ -1014,7 +1014,7 @@ void systemDrawScreen() (theApp.filterWidth * (systemColorDepth>>3)) + 4, theApp.filterWidth, theApp.filterHeight ); } - + if(!soundBufferLow) { theApp.display->render(); @@ -1043,7 +1043,7 @@ void systemMessage(int number, const char *defaultMsg, ...) CString msg = defaultMsg; if(number) msg = winResLoadString(number); - + va_start(valist, defaultMsg); buffer.FormatV(msg, valist); @@ -1089,7 +1089,7 @@ void systemFrame() void system10Frames(int rate) { - u32 time = systemGetClock(); + u32 time = systemGetClock(); if (theApp.autoFrameSkip) { @@ -1105,10 +1105,10 @@ void system10Frames(int rate) if(!theApp.wasPaused && theApp.throttle) { if(!speedup) { u32 diff = time - theApp.throttleLastTime; - + int target = (1000000/(rate*theApp.throttle)); int d = (target - diff); - + if(d > 0) { Sleep(d); } @@ -1221,10 +1221,10 @@ void systemGbBorderOn() } } -BOOL VBA::OnIdle(LONG lCount) +BOOL VBA::OnIdle(LONG lCount) { if(emulating && debugger) { - MSG msg; + MSG msg; remoteStubMain(); if(debugger) return TRUE; // continue loop @@ -1238,26 +1238,26 @@ BOOL VBA::OnIdle(LONG lCount) rewindCount++; if(rewindCount > 8) rewindCount = 8; - if(emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], + if(emulator.emuWriteMemState(&rewindMemory[rewindPos*REWIND_SIZE], REWIND_SIZE)) { rewindPos = ++rewindPos & 7; if(rewindCount == 8) rewindTopPos = ++rewindTopPos & 7; } } - + rewindSaveNeeded = false; } - + if(mouseCounter) { if(--mouseCounter == 0) { SetCursor(NULL); } - } + } return TRUE; } return FALSE; - + // return CWinApp::OnIdle(lCount); } @@ -1270,7 +1270,7 @@ void VBA::addRecentFile(CString file) for(i = 0; i < 10; i++) { if(recentFiles[i].GetLength() == 0) break; - + if(recentFiles[i].Compare(file) == 0) { if(i == 0) return; @@ -1310,9 +1310,9 @@ void VBA::loadSettings() languageName = buffer.Left(3); } else languageName = ""; - + winSetLanguageOption(languageOption, true); - + frameSkip = regQueryDwordValue("frameSkip", 0); if(frameSkip < 0 || frameSkip > 9) frameSkip = 0; @@ -1322,7 +1322,7 @@ void VBA::loadSettings() gbFrameSkip = 0; autoFrameSkip = regQueryDwordValue("autoFrameSkip", FALSE) ? TRUE : FALSE; - + vsync = regQueryDwordValue("vsync", false) ? true : false ; synchronize = regQueryDwordValue("synchronize", 1) ? true : false; fullScreenStretch = regQueryDwordValue("stretch", 0) ? true : false; @@ -1362,7 +1362,7 @@ void VBA::loadSettings() renderMethod = (DISPLAY_TYPE)regQueryDwordValue("renderMethod", DIRECT_DRAW); if(renderMethod < GDI || renderMethod > OPENGL) renderMethod = DIRECT_DRAW; - + windowPositionX = regQueryDwordValue("windowX", 0); if(windowPositionX < 0) windowPositionX = 0; @@ -1379,9 +1379,9 @@ void VBA::loadSettings() if(!buffer.IsEmpty()) { biosFileName = buffer; } - + int res = regQueryDwordValue("soundEnable", 0x30f); - + soundEnable(res); soundDisable(~res); @@ -1439,7 +1439,7 @@ void VBA::loadSettings() if(winGbPrinterEnabled) gbSerialFunction = gbPrinterSend; else - gbSerialFunction = NULL; + gbSerialFunction = NULL; pauseWhenInactive = regQueryDwordValue("pauseWhenInactive", 1) ? true : false; @@ -1456,11 +1456,11 @@ void VBA::loadSettings() autoIPS = regQueryDwordValue("autoIPS", true) ? true : false; cpuDisableSfx = regQueryDwordValue("disableSfx", 0) ? true : false; - + winSaveType = regQueryDwordValue("saveType", 0); if(winSaveType < 0 || winSaveType > 5) winSaveType = 0; - + ifbType = regQueryDwordValue("ifbType", 0); if(ifbType < 0 || ifbType > 2) ifbType = 0; @@ -1545,7 +1545,7 @@ void VBA::loadSettings() rewindTimer = 0; rewindTimer *= 6; // convert to 10 frames multiple - + if(rewindTimer != 0) rewindMemory = (char *)malloc(8*REWIND_SIZE); @@ -1563,7 +1563,7 @@ void VBA::loadSettings() autoLoadMostRecent = regQueryDwordValue("autoLoadMostRecent", false) ? true : false; - + cheatsEnabled = regQueryDwordValue("cheatsEnabled", true) ? true : false; fsMaxScale = regQueryDwordValue("fsMaxScale", 0); @@ -1571,16 +1571,16 @@ void VBA::loadSettings() throttle = regQueryDwordValue("throttle", 0); if(throttle < 5 || throttle > 1000) throttle = 0; - + linktimeout = regQueryDwordValue("LinkTimeout", 1000); linklog = regQueryDwordValue("Linklog", false) ? true : false; if(linklog) openLinkLog(); - + adapter = regQueryDwordValue("RFU", false) ? true : false; linkenable = regQueryDwordValue("linkEnabled", false) ? true : false; - + lanlink.active = regQueryDwordValue("LAN", 0) ? true : false; if (autoFrameSkip) { @@ -1665,24 +1665,24 @@ static void winCheckMenuBarInfo(int& winSizeX, int& winSizeY) { HINSTANCE hinstDll; DWORD dwVersion = 0; - + #ifdef _AFXDLL hinstDll = AfxLoadLibrary("user32.dll"); #else hinstDll = LoadLibrary( _T("user32.dll") ); #endif - + if(hinstDll) { GETMENUBARINFO func = (GETMENUBARINFO)GetProcAddress(hinstDll, "GetMenuBarInfo"); if(func) { MENUBARINFO info; info.cbSize = sizeof(MENUBARINFO); - + 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( @@ -1711,7 +1711,7 @@ void VBA::updateWindowSize(int value) regSetDwordValue("fsHeight", fsHeight); regSetDwordValue("fsColorDepth", fsColorDepth); } - + if(((value >= VIDEO_320x240) && (videoOption != value)) || (videoOption >= VIDEO_320x240 && @@ -1756,12 +1756,12 @@ void VBA::updateWindowSize(int value) updateWindowSize(videoOption); return; } - + sizeX = 240; sizeY = 160; videoOption = value; - + if(cartridgeType == IMAGE_GB) { if(gbBorderOn) { sizeX = 256; @@ -1777,7 +1777,7 @@ void VBA::updateWindowSize(int value) gbBorderRowSkip = 0; } } - + surfaceSizeX = sizeX; surfaceSizeY = sizeY; @@ -1814,7 +1814,7 @@ void VBA::updateWindowSize(int value) min = min > fsMaxScale ? fsMaxScale : min; surfaceSizeX = min * sizeX; surfaceSizeY = min * sizeY; - if((fullScreenStretch && (display != NULL && + if((fullScreenStretch && (display != NULL && (display->getType() != DIRECT_3D))) || (display != NULL && display->getType() >= DIRECT_3D)) { surfaceSizeX = fsWidth; @@ -1829,20 +1829,20 @@ void VBA::updateWindowSize(int value) int winSizeX = sizeX; int winSizeY = sizeY; - + if(videoOption <= VIDEO_4X) { dest.left = 0; dest.top = 0; dest.right = surfaceSizeX; - dest.bottom = surfaceSizeY; - + dest.bottom = surfaceSizeY; + DWORD style = WS_POPUP | WS_VISIBLE; - + style |= WS_OVERLAPPEDWINDOW; - + menuToggle = TRUE; AdjustWindowRectEx(&dest, style, TRUE, 0); //WS_EX_TOPMOST); - + winSizeX = dest.right-dest.left; winSizeY = dest.bottom-dest.top; @@ -1860,13 +1860,13 @@ void VBA::updateWindowSize(int value) adjustDestRect(); - updateIFB(); + updateIFB(); updateFilter(); - + if(display) display->resize(theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top); - - m_pMainWnd->RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); + + m_pMainWnd->RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); } bool VBA::initDisplay() @@ -1911,7 +1911,7 @@ bool VBA::updateRenderMethod0(bool force) { bool initInput = false; b16to32Video = false; - + if(display) { if(display->getType() != renderMethod || force) { if(skin) { @@ -1931,9 +1931,9 @@ bool VBA::updateRenderMethod0(bool force) pWnd->DragAcceptFiles(FALSE); pWnd->DestroyWindow(); delete pWnd; - + display = NULL; - regSetDwordValue("renderMethod", renderMethod); + regSetDwordValue("renderMethod", renderMethod); } } if(display == NULL) { @@ -1953,7 +1953,7 @@ bool VBA::updateRenderMethod0(bool force) display = newOpenGLDisplay(); break; } - + if(display->initialize()) { winUpdateSkin(); if(initInput) { @@ -1970,7 +1970,7 @@ bool VBA::updateRenderMethod0(bool force) m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); m_pMainWnd->SetFocus(); - + return true; } else { changingVideoSize = false; @@ -2017,7 +2017,7 @@ void VBA::winUpdateSkin() delete skin; skin = NULL; } - + if(!skinName.IsEmpty() && skinEnabled && display->isSkinSupported()) { skin = new CSkin(); if(skin->Initialize(skinName)) { @@ -2043,10 +2043,10 @@ void VBA::updatePriority() SetThreadPriority(THREAD_PRIORITY_HIGHEST); break; case 1: - SetThreadPriority(THREAD_PRIORITY_ABOVE_NORMAL); + SetThreadPriority(THREAD_PRIORITY_ABOVE_NORMAL); break; case 3: - SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); + SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); break; default: SetThreadPriority(THREAD_PRIORITY_NORMAL); @@ -2192,7 +2192,7 @@ void VBA::winSetLanguageOption(int option, bool force) HINSTANCE VBA::winLoadLanguage(const char *name) { CString buffer; - + buffer.Format( _T("vba_%s.dll"), name); #ifdef _AFXDLL @@ -2200,7 +2200,7 @@ HINSTANCE VBA::winLoadLanguage(const char *name) #else HMODULE l = LoadLibrary( buffer ); #endif - + if(l == NULL) { if(strlen(name) == 3) { char buffer2[3]; @@ -2255,7 +2255,7 @@ CString VBA::winLoadFilter(UINT id) { CString res = winResLoadString(id); res.Replace('_','|'); - + return res; } @@ -2282,7 +2282,7 @@ void VBA::movieReadNext() movieFile = NULL; return; } - } else + } else moviePlaying = false; } @@ -2291,13 +2291,13 @@ void VBA::saveSettings() regSetDwordValue("language", languageOption); regSetStringValue("languageName", languageName); - + regSetDwordValue("frameSkip", frameSkip); regSetDwordValue("gbFrameSkip", gbFrameSkip); regSetDwordValue("autoFrameSkip", autoFrameSkip); - + regSetDwordValue("vsync", vsync); regSetDwordValue("synchronize", synchronize); regSetDwordValue("stretch", fullScreenStretch); @@ -2329,7 +2329,7 @@ void VBA::saveSettings() if(!biosFileName.IsEmpty()) regSetStringValue("biosFile", biosFileName); - + regSetDwordValue("soundEnable", soundGetEnable() & 0x30f); regSetDwordValue("soundOff", soundOffFlag); @@ -2381,9 +2381,9 @@ void VBA::saveSettings() regSetDwordValue("autoIPS", autoIPS); regSetDwordValue("disableSfx", cpuDisableSfx); - + regSetDwordValue("saveType", winSaveType); - + regSetDwordValue("ifbType", ifbType); regSetDwordValue("flashSize", winFlashSize); @@ -2425,7 +2425,7 @@ void VBA::saveSettings() regSetDwordValue("cheatsEnabled", cheatsEnabled); regSetDwordValue("fsMaxScale", fsMaxScale); regSetDwordValue("throttle", throttle); - + regSetDwordValue("saveMoreCPU", Sm60FPS::bSaveMoreCPU); regSetDwordValue("LinkTimeout", linktimeout); regSetDwordValue("Linklog", linklog); @@ -2456,7 +2456,7 @@ void winOutput(char *s, u32 addr) addr++; } toolsLog(str); - } + } } @@ -2513,7 +2513,7 @@ bool Sm60FPS_CanSkipFrame() } Sm60FPS::bLastSkip = false; Sm60FPS::nFrameCnt++; - } + } return false; } diff --git a/src/win32/VBA.h b/src/win32/VBA.h index 1a7ba1fd..02319b40 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -201,13 +201,13 @@ class VBA : public CWinApp bool autoLoadMostRecent; int fsMaxScale; int romSize; - + CList updateList; int updateCount; CAcceleratorManager winAccelMgr; HACCEL hAccel; - + RECT rect; RECT dest; @@ -276,4 +276,4 @@ class VBA : public CWinApp #ifdef MMX extern "C" bool cpu_mmx; -#endif \ No newline at end of file +#endif diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index d1d52be1..10f81b1b 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1,2156 +1,2156 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -#include "resource2.h" -///////////////////////////////////////////////////////////////////////////// -#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 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "#include ""resource2.h""\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""vba.rc2""\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_LINKTAB DIALOGEX 0, 0, 254, 203 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Link Options" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,9,7,240,162 - PUSHBUTTON "OK",ID_OK,57,180,60,15 - PUSHBUTTON "Cancel",ID_CANCEL,140,180,57,15 -END - -IDD_LINKTAB1 DIALOGEX 0, 0, 184, 79 -STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - LTEXT "Link timeout (in milliseconds)",IDC_STATIC,17,12,92,16 - EDITTEXT IDC_LINKTIMEOUT,116,10,53,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Single Computer",IDC_LINK_SINGLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,27,71,16 - CONTROL "Network",IDC_LINK_LAN,"Button",BS_AUTORADIOBUTTON,17,43,70,16 -END - -IDD_LINKTAB2 DIALOG 0, 0, 210, 113 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "2",IDC_LINK2P,"Button",BS_AUTORADIOBUTTON | WS_GROUP,46,16,21,13 - CONTROL "3",IDC_LINK3P,"Button",BS_AUTORADIOBUTTON,94,16,21,13 - CONTROL "4",IDC_LINK4P,"Button",BS_AUTORADIOBUTTON,142,16,21,13 - CONTROL "TCP/IP",IDC_LINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,54,47,42,14 - CONTROL "UDP",IDC_LINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,121,47,33,14 - PUSHBUTTON "Start!",IDC_SERVERSTART,79,89,50,17 - LTEXT "Select number of players:",IDC_STATIC,60,7,89,10 - LTEXT "Select protocol:",IDC_STATIC,78,33,53,11 - CONTROL "Speed hacks",IDC_SSPEED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,70,57,12 -END - -IDD_LINKTAB3 DIALOGEX 0, 0, 188, 108 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - CONTROL "TCP/IP",IDC_CLINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,58,20,39,12 - CONTROL "UDP",IDC_CLINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,118,20,32,12 - EDITTEXT IDC_SERVERIP,84,39,79,12,ES_AUTOHSCROLL | WS_GROUP - PUSHBUTTON "Connect",IDC_LINKCONNECT,75,81,59,16 - LTEXT "Select protocol:",IDC_STATIC,78,7,53,9 - LTEXT "Server IP address or hostname:",IDC_STATIC,7,37,62,18 - LTEXT "Speed hacks:",IDC_STATIC,7,64,47,10 - CONTROL "Off (accurate)",IDC_SPEEDOFF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,60,63,57,12 - CONTROL "On (fast)",IDC_SPEEDON,"Button",BS_AUTORADIOBUTTON,128,63,48,12 -END - -IDD_SERVERWAIT DIALOG 0, 0, 186, 90 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Waiting for players" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Cancel",IDCANCEL,63,69,50,14 - CONTROL "Progress1",IDC_SERVERWAIT,"msctls_progress32",WS_BORDER,33,50,120,13 - LTEXT "",IDC_STATIC1,7,7,154,8 - LTEXT "",IDC_STATIC2,7,17,105,8 - LTEXT "",IDC_STATIC3,7,25,105,8 - LTEXT "",IDC_STATIC4,7,33,105,8 -END - -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, 157, 105 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "About" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - ICON 101,IDC_STATIC,6,6,21,20 - CTEXT "VisualBoyAdvance Emulator",IDC_STATIC,30,6,120,8 - CTEXT "Copyright © 2006 VBA development team",IDC_STATIC,6,36,144,8 - CTEXT "https://vbam.bountysource.com",IDC_URL,7,90,144,8 - CTEXT "Contributions by Costis",IDC_STATIC,6,48,144,8 - CTEXT "Version",IDC_STATIC,30,18,60,8 - CTEXT "",IDC_VERSION,90,18,60,8,SS_NOPREFIX - LTEXT "Modified by VBA-M development team, Spacy, kode54...",IDC_STATIC,7,62,143,21 -END - -IDD_DIRECTORIES DIALOGEX 0, 0, 220, 301 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOOLWINDOW -CAPTION "Directories" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - PUSHBUTTON "Browse...",IDC_ROM_DIR,12,66,90,12 - PUSHBUTTON "Browse...",IDC_GBROM_DIR,12,114,90,12 - PUSHBUTTON "Browse...",IDC_BATTERY_DIR,12,162,90,12 - PUSHBUTTON "Browse...",IDC_SAVE_DIR,12,210,90,12 - PUSHBUTTON "Browse...",IDC_CAPTURE_DIR,12,258,90,12 - DEFPUSHBUTTON "OK",IDOK,120,282,42,12 - PUSHBUTTON "Cancel",IDCANCEL,168,282,42,12 - EDITTEXT IDC_ROM_PATH,12,54,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_BATTERY_PATH,12,150,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_SAVE_PATH,12,198,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_CAPTURE_PATH,12,246,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_GBROM_PATH,12,102,198,12,ES_AUTOHSCROLL - PUSHBUTTON "Reset",IDC_ROM_DIR_RESET,120,66,90,12 - PUSHBUTTON "Reset",IDC_GBROM_DIR_RESET,120,114,84,12 - PUSHBUTTON "Reset",IDC_BATTERY_DIR_RESET,120,162,90,12 - PUSHBUTTON "Reset",IDC_SAVE_DIR_RESET,120,210,90,12 - PUSHBUTTON "Reset",IDC_CAPTURE_DIR_RESET,120,258,90,12 - CONTROL "You can either select or enter absolute paths to directories,\nor you can use relative paths by beginning with a . (point).\nExamples: c:\\emulation\\roms | .\\battery | ..\\snapshots\\gba",IDC_STATIC, - "Static",SS_LEFTNOWORDWRAP | WS_GROUP,6,6,210,30,WS_EX_STATICEDGE - GROUPBOX "Game Boy Advance ROM Images",IDC_STATIC,6,42,210,42 - GROUPBOX "Game Boy / Game Boy Color ROM Images",IDC_STATIC,6,90,210,42 - GROUPBOX "Game Boy Internal Battery Saves",IDC_STATIC,6,138,210,42 - GROUPBOX "Visual Boy Advance Save Games",IDC_STATIC,6,186,210,42 - GROUPBOX "Screenshots",IDC_STATIC,6,234,210,42 -END - -IDD_CONFIG DIALOGEX 0, 0, 221, 241 -STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Joypad configuration" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - EDITTEXT IDC_EDIT_UP,38,5,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_DOWN,38,19,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_LEFT,38,33,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_RIGHT,38,47,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_A,38,61,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_B,38,75,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_L,38,89,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_R,38,103,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_SELECT,38,117,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_START,38,131,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_SPEED,38,145,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_CAPTURE,38,159,176,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_BUTTON_GS,38,173,176,12,ES_AUTOHSCROLL - PUSHBUTTON "OK",ID_OK,61,220,40,14 - PUSHBUTTON "Cancel",ID_CANCEL,115,220,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 - CONTROL "Assign additional keys to functions",IDC_APPENDMODE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,197,135,10 -END - -IDD_CHEATS DIALOG 0, 0, 276, 253 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Search for cheats" -FONT 8, "MS Sans Serif" -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 "U&pdate values",IDC_UPDATE,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,192,192,62,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 -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 "Maker name:",IDC_STATIC,7,52,60,8 - LTEXT "",IDC_ROM_TITLE,80,10,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_GAME_CODE,80,24,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_UNIT_CODE,80,66,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_DEVICE_TYPE,80,80,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_VERSION,80,94,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_CRC,80,108,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_MAKER_NAME,80,52,133,8,SS_NOPREFIX -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,SS_NOPREFIX - LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_UNIT_CODE,80,68,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_DEVICE_TYPE,80,82,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_VERSION,80,152,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_CRC,80,166,133,8,SS_NOPREFIX - LTEXT "Color:",IDC_STATIC,7,24,60,8 - LTEXT "",IDC_ROM_COLOR,80,24,133,8,SS_NOPREFIX - LTEXT "ROM size:",IDC_STATIC,7,96,60,8 - LTEXT "",IDC_ROM_SIZE,80,96,133,8,SS_NOPREFIX - LTEXT "RAM size:",IDC_STATIC,7,110,60,8 - LTEXT "",IDC_ROM_RAM_SIZE,80,110,133,8,SS_NOPREFIX - LTEXT "Dest. code:",IDC_STATIC,7,124,60,8 - LTEXT "",IDC_ROM_DEST_CODE,80,124,133,8,SS_NOPREFIX - LTEXT "License code:",IDC_STATIC,7,138,60,8 - LTEXT "",IDC_ROM_LIC_CODE,80,138,133,8,SS_NOPREFIX - LTEXT "Checksum:",IDC_STATIC,7,180,60,8 - LTEXT "",IDC_ROM_CHECKSUM,80,180,133,8,SS_NOPREFIX - LTEXT "",IDC_ROM_MAKER_NAME2,80,52,133,8,SS_NOPREFIX - 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 DIALOGEX 0, 0, 234, 107 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Motion Sensor" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - EDITTEXT IDC_EDIT_UP,41,2,186,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_DOWN,41,16,186,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_LEFT,41,30,186,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_RIGHT,41,44,186,12,ES_AUTOHSCROLL - PUSHBUTTON "OK",ID_OK,64,86,40,14 - PUSHBUTTON "Cancel",ID_CANCEL,118,86,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 - CONTROL "Assign additional keys to functions",IDC_APPENDMODE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,66,135,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,SS_NOPREFIX -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,SS_NOPREFIX - LTEXT "",IDC_G,245,185,50,8,SS_NOPREFIX - LTEXT "",IDC_B,245,197,50,8,SS_NOPREFIX - GROUPBOX "Frame",IDC_STATIC,7,11,63,37 - GROUPBOX "Background",IDC_STATIC,7,52,63,67 - LTEXT "",IDC_XY,129,95,53,8,SS_NOPREFIX - LTEXT "Mode:",IDC_STATIC,80,15,34,8 - LTEXT "",IDC_MODE,130,15,53,8,SS_NOPREFIX - LTEXT "Map Base:",IDC_STATIC,80,25,35,8 - LTEXT "",IDC_MAPBASE,130,25,53,8,SS_NOPREFIX - LTEXT "Char Base:",IDC_STATIC,80,35,36,8 - LTEXT "",IDC_CHARBASE,130,35,53,8,SS_NOPREFIX - LTEXT "Size:",IDC_STATIC,80,45,37,8 - LTEXT "",IDC_DIM,130,45,53,8,SS_NOPREFIX - LTEXT "Colors:",IDC_STATIC,80,55,37,8 - LTEXT "",IDC_NUMCOLORS,130,55,53,8,SS_NOPREFIX - LTEXT "Priority:",IDC_STATIC,80,65,37,8 - LTEXT "",IDC_PRIORITY,130,65,53,8,SS_NOPREFIX - LTEXT "Mosaic:",IDC_STATIC,80,75,37,8 - LTEXT "",IDC_MOSAIC,130,75,53,8,SS_NOPREFIX - LTEXT "Overflow:",IDC_STATIC,80,85,37,8 - LTEXT "",IDC_OVERFLOW,130,85,53,8,SS_NOPREFIX - LTEXT "Address:",IDC_STATIC,80,105,37,8 - LTEXT "",IDC_ADDRESS,130,105,53,8,SS_NOPREFIX - LTEXT "Tile:",IDC_STATIC,80,115,37,8 - LTEXT "",IDC_TILE_NUM,130,115,53,8,SS_NOPREFIX - LTEXT "Flip:",IDC_STATIC,80,125,37,8 - LTEXT "",IDC_FLIP,130,125,53,8,SS_NOPREFIX - LTEXT "Palette:",IDC_STATIC,80,135,37,8 - LTEXT "",IDC_PALETTE_NUM,130,135,53,8,SS_NOPREFIX -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,SS_NOPREFIX - LTEXT "",IDC_R,53,180,50,8,SS_NOPREFIX - LTEXT "",IDC_G,53,192,50,8,SS_NOPREFIX - LTEXT "",IDC_B,53,204,50,8,SS_NOPREFIX - LTEXT "",IDC_VALUE,53,216,50,8,SS_NOPREFIX - 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 DIALOG 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" -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 -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,SS_NOPREFIX - LTEXT "",IDC_MODE,31,57,50,8,SS_NOPREFIX - LTEXT "",IDC_COLORS,31,67,50,8,SS_NOPREFIX - LTEXT "",IDC_PALETTE,31,77,50,8,SS_NOPREFIX - LTEXT "",IDC_TILE,31,87,50,8,SS_NOPREFIX - LTEXT "",IDC_PRIO,31,97,50,8,SS_NOPREFIX - LTEXT "",IDC_SIZE2,31,107,50,8,SS_NOPREFIX - LTEXT "",IDC_ROT,31,117,50,8,SS_NOPREFIX - LTEXT "",IDC_FLAGS,31,127,50,8,SS_NOPREFIX - LTEXT "",IDC_R,145,88,50,8,SS_NOPREFIX - LTEXT "",IDC_G,145,100,50,8,SS_NOPREFIX - LTEXT "",IDC_B,145,112,50,8,SS_NOPREFIX - 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 DIALOG 0, 0, 280, 121 -STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Accelerator editor" -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "&Commands:",IDC_STATIC,9,9,38,8 - LISTBOX IDC_COMMANDS,9,18,100,67,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Current &Keys:",IDC_STATIC1,113,9,43,8 - LISTBOX IDC_CURRENTS,113,18,100,67,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",ID_OK,223,9,50,14 - PUSHBUTTON "Cancel",ID_CANCEL,223,25,50,14 - LTEXT "Select &New Shortcut Key:",IDC_STATIC3,113,90,82,8 - EDITTEXT IDC_EDIT_KEY,113,102,100,12,ES_AUTOHSCROLL - PUSHBUTTON "&Assign",IDC_ASSIGN,223,70,50,14 - PUSHBUTTON "&Remove",IDC_REMOVE,223,86,50,14 - PUSHBUTTON "Re&set All",IDC_RESET,223,102,50,14 - LTEXT "Static",IDC_ALREADY_AFFECTED,9,102,100,12,SS_CENTERIMAGE - LTEXT "Currently assigned to :",IDC_STATIC2,9,90,73,10 -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,SS_NOPREFIX - LTEXT "",IDC_G,156,204,50,8,SS_NOPREFIX - LTEXT "",IDC_B,156,216,50,8,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "",IDC_ADDRESS,135,26,50,8,SS_NOPREFIX -END - -IDD_GB_COLORS DIALOG 0, 0, 169, 121 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Gameboy Mono Colors" -FONT 8, "MS Sans Serif" -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,SS_NOPREFIX - LTEXT "",IDC_R1,344,15,52,8,SS_NOPREFIX - LTEXT "",IDC_R2,344,23,52,8,SS_NOPREFIX - LTEXT "",IDC_R3,344,31,52,8,SS_NOPREFIX - LTEXT "",IDC_R4,344,39,52,8,SS_NOPREFIX - LTEXT "",IDC_R5,344,47,52,8,SS_NOPREFIX - LTEXT "",IDC_R6,344,55,52,8,SS_NOPREFIX - LTEXT "",IDC_R7,344,63,52,8,SS_NOPREFIX - LTEXT "",IDC_R8,344,71,52,8,SS_NOPREFIX - LTEXT "",IDC_R9,344,79,52,8,SS_NOPREFIX - LTEXT "",IDC_R10,344,87,52,8,SS_NOPREFIX - LTEXT "",IDC_R11,344,95,52,8,SS_NOPREFIX - LTEXT "",IDC_R12,344,103,52,8,SS_NOPREFIX - LTEXT "",IDC_R13,344,111,52,8,SS_NOPREFIX - LTEXT "",IDC_R14,344,119,52,8,SS_NOPREFIX - LTEXT "",IDC_R15,344,127,52,8,SS_NOPREFIX - 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,SS_NOPREFIX - 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,SS_NOPREFIX - 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,SS_NOPREFIX -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 "LY:",IDC_STATIC,272,95,18,8 - LTEXT "",IDC_R0,285,25,52,8,SS_NOPREFIX - LTEXT "",IDC_R1,285,35,52,8,SS_NOPREFIX - LTEXT "",IDC_R2,285,45,52,8,SS_NOPREFIX - LTEXT "",IDC_R3,285,55,52,8,SS_NOPREFIX - LTEXT "",IDC_R6,285,85,52,8,SS_NOPREFIX - LTEXT "",IDC_LY,285,95,52,8,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "PC:",IDC_STATIC,250,75,18,8 - LTEXT "",IDC_R5,285,75,52,8,SS_NOPREFIX -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,SS_NOPREFIX - LTEXT "",IDC_PALETTE,31,87,50,8,SS_NOPREFIX - LTEXT "",IDC_TILE,31,57,50,8,SS_NOPREFIX - LTEXT "",IDC_PRIO,31,67,50,8,SS_NOPREFIX - LTEXT "",IDC_OAP,31,77,50,8,SS_NOPREFIX - LTEXT "",IDC_FLAGS,31,97,50,8,SS_NOPREFIX - LTEXT "",IDC_R,145,88,50,8,SS_NOPREFIX - LTEXT "",IDC_G,145,100,50,8,SS_NOPREFIX - LTEXT "",IDC_B,145,112,50,8,SS_NOPREFIX - 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,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "",IDC_G,156,176,50,8,SS_NOPREFIX - LTEXT "",IDC_B,156,188,50,8,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "",IDC_ADDRESS,135,26,50,8,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "",IDC_G,245,185,50,8,SS_NOPREFIX - LTEXT "",IDC_B,245,197,50,8,SS_NOPREFIX - 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,SS_NOPREFIX - LTEXT "Priority:",IDC_STATIC,80,68,37,8 - LTEXT "",IDC_PRIORITY,130,68,53,8,SS_NOPREFIX - LTEXT "Address:",IDC_STATIC,80,28,37,8 - LTEXT "",IDC_ADDRESS,130,28,53,8,SS_NOPREFIX - LTEXT "Tile:",IDC_STATIC,80,38,37,8 - LTEXT "",IDC_TILE_NUM,130,38,53,8,SS_NOPREFIX - LTEXT "Flip:",IDC_STATIC,80,48,37,8 - LTEXT "",IDC_FLIP,130,48,53,8,SS_NOPREFIX - LTEXT "Palette:",IDC_STATIC,80,58,37,8 - LTEXT "",IDC_PALETTE_NUM,130,58,53,8,SS_NOPREFIX -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,SS_NOPREFIX - LTEXT "",IDC_R,53,129,50,8,SS_NOPREFIX - LTEXT "",IDC_G,53,141,50,8,SS_NOPREFIX - LTEXT "",IDC_B,53,153,50,8,SS_NOPREFIX - LTEXT "",IDC_VALUE,53,165,50,8,SS_NOPREFIX - 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,SS_NOPREFIX,WS_EX_TOOLWINDOW -END - -IDD_REWIND_INTERVAL DIALOG 0, 0, 186, 68 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Select rewind interval" -FONT 8, "MS Sans Serif" -BEGIN - EDITTEXT IDC_INTERVAL,7,28,172,14,ES_AUTOHSCROLL - DEFPUSHBUTTON "OK",ID_OK,37,47,50,14 - PUSHBUTTON "Cancel",ID_CANCEL,99,47,50,14 - LTEXT "Enter rewind interval (0...600) seconds:",IDC_STATIC,7,7,172,8 - LTEXT "Enter 0 to disable rewind.",IDC_STATIC,7,17,172,8 -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_GAME_OVERRIDES DIALOGEX 0, 0, 268, 132 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Game overrides" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - COMBOBOX IDC_RTC,84,42,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SAVE_TYPE,84,60,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FLASH_SIZE,84,78,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_MIRRORING,84,96,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,6,114,72,12 - PUSHBUTTON "Defaults",IDC_DEFAULTS,108,114,54,12 - PUSHBUTTON "Cancel",IDCANCEL,192,114,72,12 - LTEXT "Game Code",IDC_STATIC,6,6,72,12 - EDITTEXT IDC_NAME,84,6,180,12,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "Real Time Clock:",IDC_STATIC,6,42,72,12 - LTEXT "Save Type:",IDC_STATIC,6,60,72,12 - LTEXT "Flash Size:",IDC_STATIC,6,78,72,12 - LTEXT "Mirroring:",IDC_STATIC,6,96,72,12 - LTEXT "Comment",IDC_STATIC,6,24,72,12 - EDITTEXT IDC_COMMENT,84,24,180,12,ES_AUTOHSCROLL -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPENDLG, DIALOG - BEGIN - RIGHTMARGIN, 165 - END - - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 150 - TOPMARGIN, 7 - BOTTOMMARGIN, 98 - END - - IDD_DIRECTORIES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 213 - TOPMARGIN, 7 - BOTTOMMARGIN, 294 - END - - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 214 - TOPMARGIN, 7 - BOTTOMMARGIN, 234 - 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, 227 - TOPMARGIN, 7 - BOTTOMMARGIN, 100 - 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, 273 - TOPMARGIN, 7 - BOTTOMMARGIN, 114 - 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, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 61 - 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_GAME_OVERRIDES, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 261 - TOPMARGIN, 7 - BOTTOMMARGIN, 105 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MENU MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "Open...", ID_FILE_OPEN - MENUITEM "Open Gameboy...", ID_FILE_OPENGAMEBOY - MENUITEM SEPARATOR - MENUITEM "Load...", ID_FILE_LOAD - MENUITEM "Save...", ID_FILE_SAVE - POPUP "Load Game" - BEGIN - MENUITEM "Most recent", ID_FILE_LOADGAME_MOSTRECENT - MENUITEM "Auto load most recent", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT - 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 - END - POPUP "Save Game" - BEGIN - MENUITEM "Oldest slot", ID_FILE_SAVEGAME_OLDESTSLOT - 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 - END - MENUITEM SEPARATOR - MENUITEM "Pause", ID_FILE_PAUSE - MENUITEM "Reset", ID_FILE_RESET - MENUITEM SEPARATOR - POPUP "Recent" - BEGIN - MENUITEM "&Reset", ID_FILE_RECENT_RESET - MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE - MENUITEM SEPARATOR - END - 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 "Export" - BEGIN - MENUITEM "&Battery file...", ID_FILE_EXPORT_BATTERYFILE - MENUITEM "&Gameshark Snapshot...", ID_FILE_EXPORT_GAMESHARKSNAPSHOT - END - MENUITEM SEPARATOR - MENUITEM "Screen capture...", ID_FILE_SCREENCAPTURE - MENUITEM "Rom information...", ID_FILE_ROMINFORMATION - MENUITEM "Toggle menu", ID_FILE_TOGGLEMENU - MENUITEM SEPARATOR - MENUITEM "Close", ID_FILE_CLOSE - MENUITEM SEPARATOR - MENUITEM "Exit", ID_FILE_EXIT - END - POPUP "&Options" - BEGIN - POPUP "&Video" - BEGIN - POPUP "Render API" - BEGIN - MENUITEM "Windows &GDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI - MENUITEM SEPARATOR - MENUITEM "Direct&Draw", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW - MENUITEM " Emulation only", ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY - MENUITEM " Use &Video Memory", ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY - MENUITEM SEPARATOR - MENUITEM "Direct&3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D - MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER - MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR - MENUITEM SEPARATOR - MENUITEM "&OpenGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL - MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST - MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR - MENUITEM " Vertex: Triangle", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE - MENUITEM " Vertex: Quads", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS - MENUITEM " Vertex: Polygons", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS - MENUITEM SEPARATOR - MENUITEM "&VSync", ID_OPTIONS_VIDEO_VSYNC - MENUITEM "Triple Buffering", ID_OPTIONS_VIDEO_TRIPLEBUFFERING - END - MENUITEM SEPARATOR - POPUP "Windowed" - BEGIN - MENUITEM "&1x Size", ID_OPTIONS_VIDEO_X1 - MENUITEM "&2x Size", ID_OPTIONS_VIDEO_X2 - MENUITEM "&3x Size", ID_OPTIONS_VIDEO_X3 - MENUITEM "&4x Size", ID_OPTIONS_VIDEO_X4 - END - POPUP "Full-screen" - BEGIN - MENUITEM "&Select...", ID_OPTIONS_VIDEO_FULLSCREEN - MENUITEM SEPARATOR - MENUITEM "320x240x16", ID_OPTIONS_VIDEO_FULLSCREEN320X240 - MENUITEM "640x480x16", ID_OPTIONS_VIDEO_FULLSCREEN640X480 - MENUITEM "800x600x16", ID_OPTIONS_VIDEO_FULLSCREEN800X600 - MENUITEM "1024x768x16", ID_OPTIONS_VIDEO_FULLSCREEN1024X768 - MENUITEM "1280x1024x16", ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 - MENUITEM SEPARATOR - MENUITEM "&Max Scale...", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE - MENUITEM "Stretch to &fit", ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT - END - MENUITEM SEPARATOR - POPUP "&Frame skip" - BEGIN - MENUITEM "&Synchronize", ID_OPTIONS_EMULATOR_SYNCHRONIZE - MENUITEM "&Automatic", ID_OPTIONS_FRAMESKIP_AUTOMATIC - MENUITEM SEPARATOR - MENUITEM "&No frame skip", ID_OPTIONS_VIDEO_FRAMESKIP_0 - MENUITEM "&1 frame", ID_OPTIONS_VIDEO_FRAMESKIP_1 - MENUITEM "&2 frames", ID_OPTIONS_VIDEO_FRAMESKIP_2 - MENUITEM "&3 frames", ID_OPTIONS_VIDEO_FRAMESKIP_3 - MENUITEM "&4 frames", ID_OPTIONS_VIDEO_FRAMESKIP_4 - MENUITEM "&5 frames", ID_OPTIONS_VIDEO_FRAMESKIP_5 - MENUITEM "&6 frames", ID_OPTIONS_VIDEO_FRAMESKIP_6 - MENUITEM "&7 frames", ID_OPTIONS_VIDEO_FRAMESKIP_7 - MENUITEM "&8 frames", ID_OPTIONS_VIDEO_FRAMESKIP_8 - MENUITEM "&9 frames", ID_OPTIONS_VIDEO_FRAMESKIP_9 - MENUITEM SEPARATOR - MENUITEM "Turbo mode", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE - END - POPUP "Throttle" - BEGIN - MENUITEM "No throttle", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE - MENUITEM "25%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 - MENUITEM "50%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 - MENUITEM "100%", ID_OPTIONS_FRAMESKIP_THROTTLE_100 - MENUITEM "150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 - MENUITEM "200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 - MENUITEM "&Other...", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER - END - MENUITEM SEPARATOR - MENUITEM "D&isable status messages", ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES - END - POPUP "&Pixel Filter" - BEGIN - POPUP "Magnification" - BEGIN - MENUITEM "&None", ID_OPTIONS_FILTER_NORMAL - POPUP "&2X" - BEGIN - MENUITEM "&Simple 2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X - MENUITEM SEPARATOR - MENUITEM "&Pixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL - MENUITEM "&TV Mode", ID_OPTIONS_FILTER_TVMODE - MENUITEM "Scan&lines", ID_OPTIONS_FILTER_SCANLINES - MENUITEM SEPARATOR - MENUITEM "&Bilinear", ID_OPTIONS_FILTER_BILINEAR - MENUITEM "B&ilinear Plus", ID_OPTIONS_FILTER_BILINEARPLUS - MENUITEM SEPARATOR - MENUITEM "AdvanceMAME Scale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X - MENUITEM "&2xSaI", ID_OPTIONS_FILTER_2XSAI - MENUITEM "S&uper 2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI - MENUITEM "Super &Eagle", ID_OPTIONS_FILTER_SUPEREAGLE - MENUITEM "&LQ2x", ID_OPTIONS_FILTER_LQ2X - MENUITEM "&HQ2x", ID_OPTIONS_FILTER_HQ2X - END - POPUP "&3X" - BEGIN - MENUITEM "&Simple 3x", ID_OPTIONS_FILTER_SIMPLE3X - MENUITEM SEPARATOR - MENUITEM "&HQ3x", ID_OPTIONS_FILTER_HQ3X - END - POPUP "&4X" - BEGIN - MENUITEM "&Simple 4x", ID_OPTIONS_FILTER_SIMPLE4X - MENUITEM SEPARATOR - MENUITEM "&HQ4x", ID_OPTIONS_FILTER_HQ4X - END - END - 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 "&Disable MMX", ID_OPTIONS_FILTER_DISABLEMMX - END - POPUP "&Audio" - BEGIN - POPUP "&Volume" - BEGIN - MENUITEM "&0.25X", ID_OPTIONS_SOUND_VOLUME_25X - MENUITEM "0.&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 - MENUITEM SEPARATOR - POPUP "PCM interpolation" - BEGIN - MENUITEM "None", ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE - MENUITEM "Linear", ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR - MENUITEM "Cubic", ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC - MENUITEM "FIR (Kaiser 4T)", ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR - MENUITEM "libresample", ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE - END - MENUITEM SEPARATOR - MENUITEM "O&ff", ID_OPTIONS_SOUND_OFF - MENUITEM "&Mute", ID_OPTIONS_SOUND_MUTE - MENUITEM "&On", ID_OPTIONS_SOUND_ON - MENUITEM SEPARATOR - MENUITEM "&Echo", ID_OPTIONS_SOUND_ECHO - MENUITEM "&Low pass filter", ID_OPTIONS_SOUND_LOWPASSFILTER - MENUITEM "&Reverse Stereo", ID_OPTIONS_SOUND_REVERSESTEREO - 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 - MENUITEM SEPARATOR - 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 - MENUITEM SEPARATOR - MENUITEM "Use old &synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION - END - POPUP "&Input" - BEGIN - POPUP "&Set" - BEGIN - MENUITEM "Config &1...", ID_OPTIONS_JOYPAD_CONFIGURE_1 - MENUITEM "Config &2...", ID_OPTIONS_JOYPAD_CONFIGURE_2 - MENUITEM "Config &3...", ID_OPTIONS_JOYPAD_CONFIGURE_3 - MENUITEM "Config &4...", ID_OPTIONS_JOYPAD_CONFIGURE_4 - MENUITEM SEPARATOR - MENUITEM "&Motion...", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE - END - POPUP "&Use" - BEGIN - MENUITEM "Config &1", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1 - MENUITEM "Config &2", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_2 - MENUITEM "Config &3", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_3 - MENUITEM "Config &4", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4 - END - MENUITEM SEPARATOR - POPUP "&Autofire" - 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 - END - MENUITEM "Rewind interval...", ID_OPTIONS_EMULATOR_REWINDINTERVAL - END - MENUITEM SEPARATOR - POPUP "&Emulator" - BEGIN - MENUITEM "&Associate...", ID_OPTIONS_EMULATOR_ASSOCIATE - MENUITEM "&Directories...", ID_OPTIONS_EMULATOR_DIRECTORIES - POPUP "&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 - MENUITEM "Remove intros (GBA)", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA - MENUITEM "Automatic IPS patching", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH - MENUITEM "Pause when inactive", ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE - MENUITEM "AGB Print", ID_OPTIONS_EMULATOR_AGBPRINT - MENUITEM "Real Time Clock", ID_OPTIONS_EMULATOR_REALTIMECLOCK - MENUITEM "Auto hide menu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU - 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 - 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 64 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K - MENUITEM "Flash 128 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M - END - MENUITEM SEPARATOR - MENUITEM "&Use BIOS file", ID_OPTIONS_EMULATOR_USEBIOSFILE - MENUITEM "Skip BIOS", ID_OPTIONS_EMULATOR_SKIPBIOS - MENUITEM "S&elect BIOS file...", ID_OPTIONS_EMULATOR_SELECTBIOSFILE - MENUITEM SEPARATOR - MENUITEM "PNG Screenshots", ID_OPTIONS_EMULATOR_PNGFORMAT - MENUITEM "BMP Screenshots", ID_OPTIONS_EMULATOR_BMPFORMAT - END - POPUP "&Gameboy" - BEGIN - MENUITEM "&Border", ID_OPTIONS_GAMEBOY_BORDER - MENUITEM "&Printer", ID_OPTIONS_GAMEBOY_PRINTER - MENUITEM "Border Automatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC - MENUITEM SEPARATOR - MENUITEM "&Automatic", ID_OPTIONS_GAMEBOY_AUTOMATIC - MENUITEM "&GBA", ID_OPTIONS_GAMEBOY_GBA - MENUITEM "&CGB/GBC", ID_OPTIONS_GAMEBOY_CGB - MENUITEM "&SGB", ID_OPTIONS_GAMEBOY_SGB - MENUITEM "SGB&2", ID_OPTIONS_GAMEBOY_SGB2 - MENUITEM "G&B", ID_OPTIONS_GAMEBOY_GB - MENUITEM SEPARATOR - MENUITEM "&Real Colors", ID_OPTIONS_GAMEBOY_REALCOLORS - MENUITEM "G&ameboy Colors", ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS - MENUITEM "LCD colors", ID_OPTIONS_FILTER_LCDCOLORS - MENUITEM SEPARATOR - MENUITEM "&Colors...", ID_OPTIONS_GAMEBOY_COLORS - END - POPUP "&Language" - BEGIN - MENUITEM "&System", ID_OPTIONS_LANGUAGE_SYSTEM - MENUITEM "&English", ID_OPTIONS_LANGUAGE_ENGLISH - MENUITEM "&Other...", ID_OPTIONS_LANGUAGE_OTHER - END - POPUP "Li&nk" - BEGIN - MENUITEM "Enable GBA Linking", ID_OPTIONS_LINK_ENABLE - MENUITEM "&Wireless Adapter", ID_OPTIONS_LINK_WIRELESSADAPTER - MENUITEM "&Log", ID_OPTIONS_LINK_LOG - MENUITEM "&Options...", ID_OPTIONS_LINK_OPTIONS - END - END - POPUP "&Cheats" - BEGIN - MENUITEM "&Search for cheats...", ID_CHEATS_SEARCHFORCHEATS - 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 - MENUITEM "Disassemble...", ID_TOOLS_DISASSEMBLE - MENUITEM "Logging...", ID_TOOLS_LOGGING - MENUITEM "&IO Viewer...", ID_TOOLS_IOVIEWER - MENUITEM "&Map Viewer...", ID_TOOLS_MAPVIEW - MENUITEM "&Memory viewer...", ID_TOOLS_MEMORYVIEWER - MENUITEM "OAM Viewer...", ID_TOOLS_OAMVIEWER - MENUITEM "&Palette Viewer...", ID_TOOLS_PALETTEVIEW - MENUITEM "Tile Viewer...", ID_TOOLS_TILEVIEWER - MENUITEM SEPARATOR - MENUITEM "&Next frame", ID_DEBUG_NEXTFRAME - 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 - MENUITEM SEPARATOR - POPUP "Record" - BEGIN - MENUITEM "Start sound recording...", ID_OPTIONS_SOUND_STARTRECORDING - MENUITEM "Stop sound recording", ID_OPTIONS_SOUND_STOPRECORDING - MENUITEM "Start AVI recording...", ID_TOOLS_RECORD_STARTAVIRECORDING - MENUITEM "Stop AVI recording", ID_TOOLS_RECORD_STOPAVIRECORDING - MENUITEM "Start movie recording...", ID_TOOLS_RECORD_STARTMOVIERECORDING - MENUITEM "Stop movie recording", ID_TOOLS_RECORD_STOPMOVIERECORDING - END - POPUP "Play" - BEGIN - MENUITEM "Start playing movie...", ID_TOOLS_PLAY_STARTMOVIEPLAYING - MENUITEM "Stop playing movie", ID_TOOLS_PLAY_STOPMOVIEPLAYING - END - MENUITEM SEPARATOR - MENUITEM "Rewind", ID_TOOLS_REWIND - MENUITEM "Customize...", ID_TOOLS_CUSTOMIZE - END - POPUP "&Help" - BEGIN - MENUITEM "Bug Report", ID_HELP_BUGREPORT - MENUITEM "FAQ (website)", ID_HELP_FAQ - MENUITEM "License...", ID_HELP_GNUPUBLICLICENSE - MENUITEM SEPARATOR - MENUITEM "&About...", ID_HELP_ABOUT - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_ACCELERATOR ACCELERATORS -BEGIN - "C", ID_CHEATS_SEARCHFORCHEATS, VIRTKEY, CONTROL, NOINVERT - "N", ID_DEBUG_NEXTFRAME, VIRTKEY, CONTROL, NOINVERT - "X", ID_FILE_EXIT, VIRTKEY, CONTROL, NOINVERT - "L", ID_FILE_LOAD, VIRTKEY, 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, 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 - "1", ID_OPTIONS_JOYPAD_AUTOFIRE_A, VIRTKEY, ALT, NOINVERT - "2", ID_OPTIONS_JOYPAD_AUTOFIRE_B, VIRTKEY, ALT, NOINVERT - "3", ID_OPTIONS_JOYPAD_AUTOFIRE_L, VIRTKEY, ALT, NOINVERT - "4", ID_OPTIONS_JOYPAD_AUTOFIRE_R, 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 - "B", ID_TOOLS_REWIND, VIRTKEY, CONTROL, NOINVERT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// 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 "Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !" - 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 "Unsupported file type: %s" - 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. Please refine better" - 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 "autofire A disabled" - IDS_AUTOFIRE_A "autofire A" - IDS_AUTOFIRE_B_DISABLED "autofire B disabled" - IDS_AUTOFIRE_B "autofire B" - IDS_AUTOFIRE_L_DISABLED "autofire L disabled" - IDS_AUTOFIRE_L "autofire L" - IDS_AUTOFIRE_R_DISABLED "autofire R disabled" - IDS_AUTOFIRE_R "autofire R" - IDS_SELECT_ROM "Select ROM" - IDS_SELECT_SAVE_GAME_NAME "Select save game name" - IDS_LOADED_STATE "Loaded state" - IDS_LOADED_STATE_N "Loaded state %d" -END - -STRINGTABLE -BEGIN - IDS_WROTE_STATE "Wrote state" - IDS_WROTE_STATE_N "Wrote state %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;*.RAR;*.7Z;*.GZ__" - IDS_FILTER_ROM "All Gameboy Advance_*.BIN;*.AGB;*.GBA;*.MB;*.ELF;*.GB;*.SGB;*.CGB;*.GBC;*.ZIP;*.7Z;*.RAR;*.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. 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;*.7Z;*.RAR;*.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_VMV "VisualBoyAdvance Movie_*.VMV__" - 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." -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "vba.rc2" -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#include "resource2.h" +///////////////////////////////////////////////////////////////////////////// +#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 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "#include ""resource2.h""\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""vba.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_LINKTAB DIALOGEX 0, 0, 254, 203 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Link Options" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,9,7,240,162 + PUSHBUTTON "OK",ID_OK,57,180,60,15 + PUSHBUTTON "Cancel",ID_CANCEL,140,180,57,15 +END + +IDD_LINKTAB1 DIALOGEX 0, 0, 184, 79 +STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + LTEXT "Link timeout (in milliseconds)",IDC_STATIC,17,12,92,16 + EDITTEXT IDC_LINKTIMEOUT,116,10,53,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Single Computer",IDC_LINK_SINGLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,27,71,16 + CONTROL "Network",IDC_LINK_LAN,"Button",BS_AUTORADIOBUTTON,17,43,70,16 +END + +IDD_LINKTAB2 DIALOG 0, 0, 210, 113 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "2",IDC_LINK2P,"Button",BS_AUTORADIOBUTTON | WS_GROUP,46,16,21,13 + CONTROL "3",IDC_LINK3P,"Button",BS_AUTORADIOBUTTON,94,16,21,13 + CONTROL "4",IDC_LINK4P,"Button",BS_AUTORADIOBUTTON,142,16,21,13 + CONTROL "TCP/IP",IDC_LINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,54,47,42,14 + CONTROL "UDP",IDC_LINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,121,47,33,14 + PUSHBUTTON "Start!",IDC_SERVERSTART,79,89,50,17 + LTEXT "Select number of players:",IDC_STATIC,60,7,89,10 + LTEXT "Select protocol:",IDC_STATIC,78,33,53,11 + CONTROL "Speed hacks",IDC_SSPEED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,70,57,12 +END + +IDD_LINKTAB3 DIALOGEX 0, 0, 188, 108 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + CONTROL "TCP/IP",IDC_CLINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,58,20,39,12 + CONTROL "UDP",IDC_CLINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,118,20,32,12 + EDITTEXT IDC_SERVERIP,84,39,79,12,ES_AUTOHSCROLL | WS_GROUP + PUSHBUTTON "Connect",IDC_LINKCONNECT,75,81,59,16 + LTEXT "Select protocol:",IDC_STATIC,78,7,53,9 + LTEXT "Server IP address or hostname:",IDC_STATIC,7,37,62,18 + LTEXT "Speed hacks:",IDC_STATIC,7,64,47,10 + CONTROL "Off (accurate)",IDC_SPEEDOFF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,60,63,57,12 + CONTROL "On (fast)",IDC_SPEEDON,"Button",BS_AUTORADIOBUTTON,128,63,48,12 +END + +IDD_SERVERWAIT DIALOG 0, 0, 186, 90 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Waiting for players" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,63,69,50,14 + CONTROL "Progress1",IDC_SERVERWAIT,"msctls_progress32",WS_BORDER,33,50,120,13 + LTEXT "",IDC_STATIC1,7,7,154,8 + LTEXT "",IDC_STATIC2,7,17,105,8 + LTEXT "",IDC_STATIC3,7,25,105,8 + LTEXT "",IDC_STATIC4,7,33,105,8 +END + +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, 157, 105 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "About" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + ICON 101,IDC_STATIC,6,6,21,20 + CTEXT "VisualBoyAdvance Emulator",IDC_STATIC,30,6,120,8 + CTEXT "Copyright © 2006 VBA development team",IDC_STATIC,6,36,144,8 + CTEXT "https://vbam.bountysource.com",IDC_URL,7,90,144,8 + CTEXT "Contributions by Costis",IDC_STATIC,6,48,144,8 + CTEXT "Version",IDC_STATIC,30,18,60,8 + CTEXT "",IDC_VERSION,90,18,60,8,SS_NOPREFIX + LTEXT "Modified by VBA-M development team, Spacy, kode54...",IDC_STATIC,7,62,143,21 +END + +IDD_DIRECTORIES DIALOGEX 0, 0, 220, 301 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Directories" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + PUSHBUTTON "Browse...",IDC_ROM_DIR,12,66,90,12 + PUSHBUTTON "Browse...",IDC_GBROM_DIR,12,114,90,12 + PUSHBUTTON "Browse...",IDC_BATTERY_DIR,12,162,90,12 + PUSHBUTTON "Browse...",IDC_SAVE_DIR,12,210,90,12 + PUSHBUTTON "Browse...",IDC_CAPTURE_DIR,12,258,90,12 + DEFPUSHBUTTON "OK",IDOK,120,282,42,12 + PUSHBUTTON "Cancel",IDCANCEL,168,282,42,12 + EDITTEXT IDC_ROM_PATH,12,54,198,12,ES_AUTOHSCROLL + EDITTEXT IDC_BATTERY_PATH,12,150,198,12,ES_AUTOHSCROLL + EDITTEXT IDC_SAVE_PATH,12,198,198,12,ES_AUTOHSCROLL + EDITTEXT IDC_CAPTURE_PATH,12,246,198,12,ES_AUTOHSCROLL + EDITTEXT IDC_GBROM_PATH,12,102,198,12,ES_AUTOHSCROLL + PUSHBUTTON "Reset",IDC_ROM_DIR_RESET,120,66,90,12 + PUSHBUTTON "Reset",IDC_GBROM_DIR_RESET,120,114,84,12 + PUSHBUTTON "Reset",IDC_BATTERY_DIR_RESET,120,162,90,12 + PUSHBUTTON "Reset",IDC_SAVE_DIR_RESET,120,210,90,12 + PUSHBUTTON "Reset",IDC_CAPTURE_DIR_RESET,120,258,90,12 + CONTROL "You can either select or enter absolute paths to directories,\nor you can use relative paths by beginning with a . (point).\nExamples: c:\\emulation\\roms | .\\battery | ..\\snapshots\\gba",IDC_STATIC, + "Static",SS_LEFTNOWORDWRAP | WS_GROUP,6,6,210,30,WS_EX_STATICEDGE + GROUPBOX "Game Boy Advance ROM Images",IDC_STATIC,6,42,210,42 + GROUPBOX "Game Boy / Game Boy Color ROM Images",IDC_STATIC,6,90,210,42 + GROUPBOX "Game Boy Internal Battery Saves",IDC_STATIC,6,138,210,42 + GROUPBOX "Visual Boy Advance Save Games",IDC_STATIC,6,186,210,42 + GROUPBOX "Screenshots",IDC_STATIC,6,234,210,42 +END + +IDD_CONFIG DIALOGEX 0, 0, 221, 241 +STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Joypad configuration" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_EDIT_UP,38,5,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DOWN,38,19,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_LEFT,38,33,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RIGHT,38,47,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_A,38,61,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_B,38,75,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_L,38,89,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_R,38,103,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_SELECT,38,117,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_START,38,131,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SPEED,38,145,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_CAPTURE,38,159,176,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_BUTTON_GS,38,173,176,12,ES_AUTOHSCROLL + PUSHBUTTON "OK",ID_OK,61,220,40,14 + PUSHBUTTON "Cancel",ID_CANCEL,115,220,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 + CONTROL "Assign additional keys to functions",IDC_APPENDMODE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,197,135,10 +END + +IDD_CHEATS DIALOG 0, 0, 276, 253 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Search for cheats" +FONT 8, "MS Sans Serif" +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 "U&pdate values",IDC_UPDATE,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,192,192,62,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 +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 "Maker name:",IDC_STATIC,7,52,60,8 + LTEXT "",IDC_ROM_TITLE,80,10,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_GAME_CODE,80,24,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_UNIT_CODE,80,66,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_DEVICE_TYPE,80,80,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_VERSION,80,94,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_CRC,80,108,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_MAKER_NAME,80,52,133,8,SS_NOPREFIX +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,SS_NOPREFIX + LTEXT "",IDC_ROM_MAKER_CODE,80,38,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_UNIT_CODE,80,68,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_DEVICE_TYPE,80,82,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_VERSION,80,152,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_CRC,80,166,133,8,SS_NOPREFIX + LTEXT "Color:",IDC_STATIC,7,24,60,8 + LTEXT "",IDC_ROM_COLOR,80,24,133,8,SS_NOPREFIX + LTEXT "ROM size:",IDC_STATIC,7,96,60,8 + LTEXT "",IDC_ROM_SIZE,80,96,133,8,SS_NOPREFIX + LTEXT "RAM size:",IDC_STATIC,7,110,60,8 + LTEXT "",IDC_ROM_RAM_SIZE,80,110,133,8,SS_NOPREFIX + LTEXT "Dest. code:",IDC_STATIC,7,124,60,8 + LTEXT "",IDC_ROM_DEST_CODE,80,124,133,8,SS_NOPREFIX + LTEXT "License code:",IDC_STATIC,7,138,60,8 + LTEXT "",IDC_ROM_LIC_CODE,80,138,133,8,SS_NOPREFIX + LTEXT "Checksum:",IDC_STATIC,7,180,60,8 + LTEXT "",IDC_ROM_CHECKSUM,80,180,133,8,SS_NOPREFIX + LTEXT "",IDC_ROM_MAKER_NAME2,80,52,133,8,SS_NOPREFIX + 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 DIALOGEX 0, 0, 234, 107 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Motion Sensor" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_EDIT_UP,41,2,186,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DOWN,41,16,186,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_LEFT,41,30,186,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_RIGHT,41,44,186,12,ES_AUTOHSCROLL + PUSHBUTTON "OK",ID_OK,64,86,40,14 + PUSHBUTTON "Cancel",ID_CANCEL,118,86,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 + CONTROL "Assign additional keys to functions",IDC_APPENDMODE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,66,135,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,SS_NOPREFIX +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,SS_NOPREFIX + LTEXT "",IDC_G,245,185,50,8,SS_NOPREFIX + LTEXT "",IDC_B,245,197,50,8,SS_NOPREFIX + GROUPBOX "Frame",IDC_STATIC,7,11,63,37 + GROUPBOX "Background",IDC_STATIC,7,52,63,67 + LTEXT "",IDC_XY,129,95,53,8,SS_NOPREFIX + LTEXT "Mode:",IDC_STATIC,80,15,34,8 + LTEXT "",IDC_MODE,130,15,53,8,SS_NOPREFIX + LTEXT "Map Base:",IDC_STATIC,80,25,35,8 + LTEXT "",IDC_MAPBASE,130,25,53,8,SS_NOPREFIX + LTEXT "Char Base:",IDC_STATIC,80,35,36,8 + LTEXT "",IDC_CHARBASE,130,35,53,8,SS_NOPREFIX + LTEXT "Size:",IDC_STATIC,80,45,37,8 + LTEXT "",IDC_DIM,130,45,53,8,SS_NOPREFIX + LTEXT "Colors:",IDC_STATIC,80,55,37,8 + LTEXT "",IDC_NUMCOLORS,130,55,53,8,SS_NOPREFIX + LTEXT "Priority:",IDC_STATIC,80,65,37,8 + LTEXT "",IDC_PRIORITY,130,65,53,8,SS_NOPREFIX + LTEXT "Mosaic:",IDC_STATIC,80,75,37,8 + LTEXT "",IDC_MOSAIC,130,75,53,8,SS_NOPREFIX + LTEXT "Overflow:",IDC_STATIC,80,85,37,8 + LTEXT "",IDC_OVERFLOW,130,85,53,8,SS_NOPREFIX + LTEXT "Address:",IDC_STATIC,80,105,37,8 + LTEXT "",IDC_ADDRESS,130,105,53,8,SS_NOPREFIX + LTEXT "Tile:",IDC_STATIC,80,115,37,8 + LTEXT "",IDC_TILE_NUM,130,115,53,8,SS_NOPREFIX + LTEXT "Flip:",IDC_STATIC,80,125,37,8 + LTEXT "",IDC_FLIP,130,125,53,8,SS_NOPREFIX + LTEXT "Palette:",IDC_STATIC,80,135,37,8 + LTEXT "",IDC_PALETTE_NUM,130,135,53,8,SS_NOPREFIX +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,SS_NOPREFIX + LTEXT "",IDC_R,53,180,50,8,SS_NOPREFIX + LTEXT "",IDC_G,53,192,50,8,SS_NOPREFIX + LTEXT "",IDC_B,53,204,50,8,SS_NOPREFIX + LTEXT "",IDC_VALUE,53,216,50,8,SS_NOPREFIX + 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 DIALOG 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" +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 +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,SS_NOPREFIX + LTEXT "",IDC_MODE,31,57,50,8,SS_NOPREFIX + LTEXT "",IDC_COLORS,31,67,50,8,SS_NOPREFIX + LTEXT "",IDC_PALETTE,31,77,50,8,SS_NOPREFIX + LTEXT "",IDC_TILE,31,87,50,8,SS_NOPREFIX + LTEXT "",IDC_PRIO,31,97,50,8,SS_NOPREFIX + LTEXT "",IDC_SIZE2,31,107,50,8,SS_NOPREFIX + LTEXT "",IDC_ROT,31,117,50,8,SS_NOPREFIX + LTEXT "",IDC_FLAGS,31,127,50,8,SS_NOPREFIX + LTEXT "",IDC_R,145,88,50,8,SS_NOPREFIX + LTEXT "",IDC_G,145,100,50,8,SS_NOPREFIX + LTEXT "",IDC_B,145,112,50,8,SS_NOPREFIX + 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 DIALOG 0, 0, 280, 121 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "Accelerator editor" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "&Commands:",IDC_STATIC,9,9,38,8 + LISTBOX IDC_COMMANDS,9,18,100,67,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP + LTEXT "Current &Keys:",IDC_STATIC1,113,9,43,8 + LISTBOX IDC_CURRENTS,113,18,100,67,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",ID_OK,223,9,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,223,25,50,14 + LTEXT "Select &New Shortcut Key:",IDC_STATIC3,113,90,82,8 + EDITTEXT IDC_EDIT_KEY,113,102,100,12,ES_AUTOHSCROLL + PUSHBUTTON "&Assign",IDC_ASSIGN,223,70,50,14 + PUSHBUTTON "&Remove",IDC_REMOVE,223,86,50,14 + PUSHBUTTON "Re&set All",IDC_RESET,223,102,50,14 + LTEXT "Static",IDC_ALREADY_AFFECTED,9,102,100,12,SS_CENTERIMAGE + LTEXT "Currently assigned to :",IDC_STATIC2,9,90,73,10 +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,SS_NOPREFIX + LTEXT "",IDC_G,156,204,50,8,SS_NOPREFIX + LTEXT "",IDC_B,156,216,50,8,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "",IDC_ADDRESS,135,26,50,8,SS_NOPREFIX +END + +IDD_GB_COLORS DIALOG 0, 0, 169, 121 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Gameboy Mono Colors" +FONT 8, "MS Sans Serif" +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,SS_NOPREFIX + LTEXT "",IDC_R1,344,15,52,8,SS_NOPREFIX + LTEXT "",IDC_R2,344,23,52,8,SS_NOPREFIX + LTEXT "",IDC_R3,344,31,52,8,SS_NOPREFIX + LTEXT "",IDC_R4,344,39,52,8,SS_NOPREFIX + LTEXT "",IDC_R5,344,47,52,8,SS_NOPREFIX + LTEXT "",IDC_R6,344,55,52,8,SS_NOPREFIX + LTEXT "",IDC_R7,344,63,52,8,SS_NOPREFIX + LTEXT "",IDC_R8,344,71,52,8,SS_NOPREFIX + LTEXT "",IDC_R9,344,79,52,8,SS_NOPREFIX + LTEXT "",IDC_R10,344,87,52,8,SS_NOPREFIX + LTEXT "",IDC_R11,344,95,52,8,SS_NOPREFIX + LTEXT "",IDC_R12,344,103,52,8,SS_NOPREFIX + LTEXT "",IDC_R13,344,111,52,8,SS_NOPREFIX + LTEXT "",IDC_R14,344,119,52,8,SS_NOPREFIX + LTEXT "",IDC_R15,344,127,52,8,SS_NOPREFIX + 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,SS_NOPREFIX + 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,SS_NOPREFIX + 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,SS_NOPREFIX +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 "LY:",IDC_STATIC,272,95,18,8 + LTEXT "",IDC_R0,285,25,52,8,SS_NOPREFIX + LTEXT "",IDC_R1,285,35,52,8,SS_NOPREFIX + LTEXT "",IDC_R2,285,45,52,8,SS_NOPREFIX + LTEXT "",IDC_R3,285,55,52,8,SS_NOPREFIX + LTEXT "",IDC_R6,285,85,52,8,SS_NOPREFIX + LTEXT "",IDC_LY,285,95,52,8,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "PC:",IDC_STATIC,250,75,18,8 + LTEXT "",IDC_R5,285,75,52,8,SS_NOPREFIX +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,SS_NOPREFIX + LTEXT "",IDC_PALETTE,31,87,50,8,SS_NOPREFIX + LTEXT "",IDC_TILE,31,57,50,8,SS_NOPREFIX + LTEXT "",IDC_PRIO,31,67,50,8,SS_NOPREFIX + LTEXT "",IDC_OAP,31,77,50,8,SS_NOPREFIX + LTEXT "",IDC_FLAGS,31,97,50,8,SS_NOPREFIX + LTEXT "",IDC_R,145,88,50,8,SS_NOPREFIX + LTEXT "",IDC_G,145,100,50,8,SS_NOPREFIX + LTEXT "",IDC_B,145,112,50,8,SS_NOPREFIX + 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,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "",IDC_G,156,176,50,8,SS_NOPREFIX + LTEXT "",IDC_B,156,188,50,8,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "",IDC_ADDRESS,135,26,50,8,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "",IDC_G,245,185,50,8,SS_NOPREFIX + LTEXT "",IDC_B,245,197,50,8,SS_NOPREFIX + 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,SS_NOPREFIX + LTEXT "Priority:",IDC_STATIC,80,68,37,8 + LTEXT "",IDC_PRIORITY,130,68,53,8,SS_NOPREFIX + LTEXT "Address:",IDC_STATIC,80,28,37,8 + LTEXT "",IDC_ADDRESS,130,28,53,8,SS_NOPREFIX + LTEXT "Tile:",IDC_STATIC,80,38,37,8 + LTEXT "",IDC_TILE_NUM,130,38,53,8,SS_NOPREFIX + LTEXT "Flip:",IDC_STATIC,80,48,37,8 + LTEXT "",IDC_FLIP,130,48,53,8,SS_NOPREFIX + LTEXT "Palette:",IDC_STATIC,80,58,37,8 + LTEXT "",IDC_PALETTE_NUM,130,58,53,8,SS_NOPREFIX +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,SS_NOPREFIX + LTEXT "",IDC_R,53,129,50,8,SS_NOPREFIX + LTEXT "",IDC_G,53,141,50,8,SS_NOPREFIX + LTEXT "",IDC_B,53,153,50,8,SS_NOPREFIX + LTEXT "",IDC_VALUE,53,165,50,8,SS_NOPREFIX + 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,SS_NOPREFIX,WS_EX_TOOLWINDOW +END + +IDD_REWIND_INTERVAL DIALOG 0, 0, 186, 68 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select rewind interval" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_INTERVAL,7,28,172,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",ID_OK,37,47,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,99,47,50,14 + LTEXT "Enter rewind interval (0...600) seconds:",IDC_STATIC,7,7,172,8 + LTEXT "Enter 0 to disable rewind.",IDC_STATIC,7,17,172,8 +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_GAME_OVERRIDES DIALOGEX 0, 0, 268, 132 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Game overrides" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + COMBOBOX IDC_RTC,84,42,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SAVE_TYPE,84,60,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FLASH_SIZE,84,78,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_MIRRORING,84,96,180,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,6,114,72,12 + PUSHBUTTON "Defaults",IDC_DEFAULTS,108,114,54,12 + PUSHBUTTON "Cancel",IDCANCEL,192,114,72,12 + LTEXT "Game Code",IDC_STATIC,6,6,72,12 + EDITTEXT IDC_NAME,84,6,180,12,ES_AUTOHSCROLL | WS_DISABLED + LTEXT "Real Time Clock:",IDC_STATIC,6,42,72,12 + LTEXT "Save Type:",IDC_STATIC,6,60,72,12 + LTEXT "Flash Size:",IDC_STATIC,6,78,72,12 + LTEXT "Mirroring:",IDC_STATIC,6,96,72,12 + LTEXT "Comment",IDC_STATIC,6,24,72,12 + EDITTEXT IDC_COMMENT,84,24,180,12,ES_AUTOHSCROLL +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPENDLG, DIALOG + BEGIN + RIGHTMARGIN, 165 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 150 + TOPMARGIN, 7 + BOTTOMMARGIN, 98 + END + + IDD_DIRECTORIES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 213 + TOPMARGIN, 7 + BOTTOMMARGIN, 294 + END + + IDD_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 214 + TOPMARGIN, 7 + BOTTOMMARGIN, 234 + 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, 227 + TOPMARGIN, 7 + BOTTOMMARGIN, 100 + 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, 273 + TOPMARGIN, 7 + BOTTOMMARGIN, 114 + 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, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 61 + 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_GAME_OVERRIDES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 261 + TOPMARGIN, 7 + BOTTOMMARGIN, 105 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "Open...", ID_FILE_OPEN + MENUITEM "Open Gameboy...", ID_FILE_OPENGAMEBOY + MENUITEM SEPARATOR + MENUITEM "Load...", ID_FILE_LOAD + MENUITEM "Save...", ID_FILE_SAVE + POPUP "Load Game" + BEGIN + MENUITEM "Most recent", ID_FILE_LOADGAME_MOSTRECENT + MENUITEM "Auto load most recent", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT + 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 + END + POPUP "Save Game" + BEGIN + MENUITEM "Oldest slot", ID_FILE_SAVEGAME_OLDESTSLOT + 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 + END + MENUITEM SEPARATOR + MENUITEM "Pause", ID_FILE_PAUSE + MENUITEM "Reset", ID_FILE_RESET + MENUITEM SEPARATOR + POPUP "Recent" + BEGIN + MENUITEM "&Reset", ID_FILE_RECENT_RESET + MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE + MENUITEM SEPARATOR + END + 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 "Export" + BEGIN + MENUITEM "&Battery file...", ID_FILE_EXPORT_BATTERYFILE + MENUITEM "&Gameshark Snapshot...", ID_FILE_EXPORT_GAMESHARKSNAPSHOT + END + MENUITEM SEPARATOR + MENUITEM "Screen capture...", ID_FILE_SCREENCAPTURE + MENUITEM "Rom information...", ID_FILE_ROMINFORMATION + MENUITEM "Toggle menu", ID_FILE_TOGGLEMENU + MENUITEM SEPARATOR + MENUITEM "Close", ID_FILE_CLOSE + MENUITEM SEPARATOR + MENUITEM "Exit", ID_FILE_EXIT + END + POPUP "&Options" + BEGIN + POPUP "&Video" + BEGIN + POPUP "Render API" + BEGIN + MENUITEM "Windows &GDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI + MENUITEM SEPARATOR + MENUITEM "Direct&Draw", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW + MENUITEM " Emulation only", ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY + MENUITEM " Use &Video Memory", ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY + MENUITEM SEPARATOR + MENUITEM "Direct&3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D + MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER + MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR + MENUITEM SEPARATOR + MENUITEM "&OpenGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL + MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST + MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR + MENUITEM " Vertex: Triangle", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE + MENUITEM " Vertex: Quads", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS + MENUITEM " Vertex: Polygons", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS + MENUITEM SEPARATOR + MENUITEM "&VSync", ID_OPTIONS_VIDEO_VSYNC + MENUITEM "Triple Buffering", ID_OPTIONS_VIDEO_TRIPLEBUFFERING + END + MENUITEM SEPARATOR + POPUP "Windowed" + BEGIN + MENUITEM "&1x Size", ID_OPTIONS_VIDEO_X1 + MENUITEM "&2x Size", ID_OPTIONS_VIDEO_X2 + MENUITEM "&3x Size", ID_OPTIONS_VIDEO_X3 + MENUITEM "&4x Size", ID_OPTIONS_VIDEO_X4 + END + POPUP "Full-screen" + BEGIN + MENUITEM "&Select...", ID_OPTIONS_VIDEO_FULLSCREEN + MENUITEM SEPARATOR + MENUITEM "320x240x16", ID_OPTIONS_VIDEO_FULLSCREEN320X240 + MENUITEM "640x480x16", ID_OPTIONS_VIDEO_FULLSCREEN640X480 + MENUITEM "800x600x16", ID_OPTIONS_VIDEO_FULLSCREEN800X600 + MENUITEM "1024x768x16", ID_OPTIONS_VIDEO_FULLSCREEN1024X768 + MENUITEM "1280x1024x16", ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 + MENUITEM SEPARATOR + MENUITEM "&Max Scale...", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE + MENUITEM "Stretch to &fit", ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT + END + MENUITEM SEPARATOR + POPUP "&Frame skip" + BEGIN + MENUITEM "&Synchronize", ID_OPTIONS_EMULATOR_SYNCHRONIZE + MENUITEM "&Automatic", ID_OPTIONS_FRAMESKIP_AUTOMATIC + MENUITEM SEPARATOR + MENUITEM "&No frame skip", ID_OPTIONS_VIDEO_FRAMESKIP_0 + MENUITEM "&1 frame", ID_OPTIONS_VIDEO_FRAMESKIP_1 + MENUITEM "&2 frames", ID_OPTIONS_VIDEO_FRAMESKIP_2 + MENUITEM "&3 frames", ID_OPTIONS_VIDEO_FRAMESKIP_3 + MENUITEM "&4 frames", ID_OPTIONS_VIDEO_FRAMESKIP_4 + MENUITEM "&5 frames", ID_OPTIONS_VIDEO_FRAMESKIP_5 + MENUITEM "&6 frames", ID_OPTIONS_VIDEO_FRAMESKIP_6 + MENUITEM "&7 frames", ID_OPTIONS_VIDEO_FRAMESKIP_7 + MENUITEM "&8 frames", ID_OPTIONS_VIDEO_FRAMESKIP_8 + MENUITEM "&9 frames", ID_OPTIONS_VIDEO_FRAMESKIP_9 + MENUITEM SEPARATOR + MENUITEM "Turbo mode", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE + END + POPUP "Throttle" + BEGIN + MENUITEM "No throttle", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE + MENUITEM "25%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 + MENUITEM "50%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 + MENUITEM "100%", ID_OPTIONS_FRAMESKIP_THROTTLE_100 + MENUITEM "150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 + MENUITEM "200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 + MENUITEM "&Other...", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER + END + MENUITEM SEPARATOR + MENUITEM "D&isable status messages", ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES + END + POPUP "&Pixel Filter" + BEGIN + POPUP "Magnification" + BEGIN + MENUITEM "&None", ID_OPTIONS_FILTER_NORMAL + POPUP "&2X" + BEGIN + MENUITEM "&Simple 2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X + MENUITEM SEPARATOR + MENUITEM "&Pixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL + MENUITEM "&TV Mode", ID_OPTIONS_FILTER_TVMODE + MENUITEM "Scan&lines", ID_OPTIONS_FILTER_SCANLINES + MENUITEM SEPARATOR + MENUITEM "&Bilinear", ID_OPTIONS_FILTER_BILINEAR + MENUITEM "B&ilinear Plus", ID_OPTIONS_FILTER_BILINEARPLUS + MENUITEM SEPARATOR + MENUITEM "AdvanceMAME Scale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X + MENUITEM "&2xSaI", ID_OPTIONS_FILTER_2XSAI + MENUITEM "S&uper 2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI + MENUITEM "Super &Eagle", ID_OPTIONS_FILTER_SUPEREAGLE + MENUITEM "&LQ2x", ID_OPTIONS_FILTER_LQ2X + MENUITEM "&HQ2x", ID_OPTIONS_FILTER_HQ2X + END + POPUP "&3X" + BEGIN + MENUITEM "&Simple 3x", ID_OPTIONS_FILTER_SIMPLE3X + MENUITEM SEPARATOR + MENUITEM "&HQ3x", ID_OPTIONS_FILTER_HQ3X + END + POPUP "&4X" + BEGIN + MENUITEM "&Simple 4x", ID_OPTIONS_FILTER_SIMPLE4X + MENUITEM SEPARATOR + MENUITEM "&HQ4x", ID_OPTIONS_FILTER_HQ4X + END + END + 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 "&Disable MMX", ID_OPTIONS_FILTER_DISABLEMMX + END + POPUP "&Audio" + BEGIN + POPUP "&Volume" + BEGIN + MENUITEM "&0.25X", ID_OPTIONS_SOUND_VOLUME_25X + MENUITEM "0.&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 + MENUITEM SEPARATOR + POPUP "PCM interpolation" + BEGIN + MENUITEM "None", ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE + MENUITEM "Linear", ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR + MENUITEM "Cubic", ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC + MENUITEM "FIR (Kaiser 4T)", ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR + MENUITEM "libresample", ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE + END + MENUITEM SEPARATOR + MENUITEM "O&ff", ID_OPTIONS_SOUND_OFF + MENUITEM "&Mute", ID_OPTIONS_SOUND_MUTE + MENUITEM "&On", ID_OPTIONS_SOUND_ON + MENUITEM SEPARATOR + MENUITEM "&Echo", ID_OPTIONS_SOUND_ECHO + MENUITEM "&Low pass filter", ID_OPTIONS_SOUND_LOWPASSFILTER + MENUITEM "&Reverse Stereo", ID_OPTIONS_SOUND_REVERSESTEREO + 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 + MENUITEM SEPARATOR + 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 + MENUITEM SEPARATOR + MENUITEM "Use old &synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION + END + POPUP "&Input" + BEGIN + POPUP "&Set" + BEGIN + MENUITEM "Config &1...", ID_OPTIONS_JOYPAD_CONFIGURE_1 + MENUITEM "Config &2...", ID_OPTIONS_JOYPAD_CONFIGURE_2 + MENUITEM "Config &3...", ID_OPTIONS_JOYPAD_CONFIGURE_3 + MENUITEM "Config &4...", ID_OPTIONS_JOYPAD_CONFIGURE_4 + MENUITEM SEPARATOR + MENUITEM "&Motion...", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE + END + POPUP "&Use" + BEGIN + MENUITEM "Config &1", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1 + MENUITEM "Config &2", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_2 + MENUITEM "Config &3", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_3 + MENUITEM "Config &4", ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4 + END + MENUITEM SEPARATOR + POPUP "&Autofire" + 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 + END + MENUITEM "Rewind interval...", ID_OPTIONS_EMULATOR_REWINDINTERVAL + END + MENUITEM SEPARATOR + POPUP "&Emulator" + BEGIN + MENUITEM "&Associate...", ID_OPTIONS_EMULATOR_ASSOCIATE + MENUITEM "&Directories...", ID_OPTIONS_EMULATOR_DIRECTORIES + POPUP "&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 + MENUITEM "Remove intros (GBA)", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA + MENUITEM "Automatic IPS patching", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH + MENUITEM "Pause when inactive", ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE + MENUITEM "AGB Print", ID_OPTIONS_EMULATOR_AGBPRINT + MENUITEM "Real Time Clock", ID_OPTIONS_EMULATOR_REALTIMECLOCK + MENUITEM "Auto hide menu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU + 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 + 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 64 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K + MENUITEM "Flash 128 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M + END + MENUITEM SEPARATOR + MENUITEM "&Use BIOS file", ID_OPTIONS_EMULATOR_USEBIOSFILE + MENUITEM "Skip BIOS", ID_OPTIONS_EMULATOR_SKIPBIOS + MENUITEM "S&elect BIOS file...", ID_OPTIONS_EMULATOR_SELECTBIOSFILE + MENUITEM SEPARATOR + MENUITEM "PNG Screenshots", ID_OPTIONS_EMULATOR_PNGFORMAT + MENUITEM "BMP Screenshots", ID_OPTIONS_EMULATOR_BMPFORMAT + END + POPUP "&Gameboy" + BEGIN + MENUITEM "&Border", ID_OPTIONS_GAMEBOY_BORDER + MENUITEM "&Printer", ID_OPTIONS_GAMEBOY_PRINTER + MENUITEM "Border Automatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC + MENUITEM SEPARATOR + MENUITEM "&Automatic", ID_OPTIONS_GAMEBOY_AUTOMATIC + MENUITEM "&GBA", ID_OPTIONS_GAMEBOY_GBA + MENUITEM "&CGB/GBC", ID_OPTIONS_GAMEBOY_CGB + MENUITEM "&SGB", ID_OPTIONS_GAMEBOY_SGB + MENUITEM "SGB&2", ID_OPTIONS_GAMEBOY_SGB2 + MENUITEM "G&B", ID_OPTIONS_GAMEBOY_GB + MENUITEM SEPARATOR + MENUITEM "&Real Colors", ID_OPTIONS_GAMEBOY_REALCOLORS + MENUITEM "G&ameboy Colors", ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS + MENUITEM "LCD colors", ID_OPTIONS_FILTER_LCDCOLORS + MENUITEM SEPARATOR + MENUITEM "&Colors...", ID_OPTIONS_GAMEBOY_COLORS + END + POPUP "&Language" + BEGIN + MENUITEM "&System", ID_OPTIONS_LANGUAGE_SYSTEM + MENUITEM "&English", ID_OPTIONS_LANGUAGE_ENGLISH + MENUITEM "&Other...", ID_OPTIONS_LANGUAGE_OTHER + END + POPUP "Li&nk" + BEGIN + MENUITEM "Enable GBA Linking", ID_OPTIONS_LINK_ENABLE + MENUITEM "&Wireless Adapter", ID_OPTIONS_LINK_WIRELESSADAPTER + MENUITEM "&Log", ID_OPTIONS_LINK_LOG + MENUITEM "&Options...", ID_OPTIONS_LINK_OPTIONS + END + END + POPUP "&Cheats" + BEGIN + MENUITEM "&Search for cheats...", ID_CHEATS_SEARCHFORCHEATS + 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 + MENUITEM "Disassemble...", ID_TOOLS_DISASSEMBLE + MENUITEM "Logging...", ID_TOOLS_LOGGING + MENUITEM "&IO Viewer...", ID_TOOLS_IOVIEWER + MENUITEM "&Map Viewer...", ID_TOOLS_MAPVIEW + MENUITEM "&Memory viewer...", ID_TOOLS_MEMORYVIEWER + MENUITEM "OAM Viewer...", ID_TOOLS_OAMVIEWER + MENUITEM "&Palette Viewer...", ID_TOOLS_PALETTEVIEW + MENUITEM "Tile Viewer...", ID_TOOLS_TILEVIEWER + MENUITEM SEPARATOR + MENUITEM "&Next frame", ID_DEBUG_NEXTFRAME + 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 + MENUITEM SEPARATOR + POPUP "Record" + BEGIN + MENUITEM "Start sound recording...", ID_OPTIONS_SOUND_STARTRECORDING + MENUITEM "Stop sound recording", ID_OPTIONS_SOUND_STOPRECORDING + MENUITEM "Start AVI recording...", ID_TOOLS_RECORD_STARTAVIRECORDING + MENUITEM "Stop AVI recording", ID_TOOLS_RECORD_STOPAVIRECORDING + MENUITEM "Start movie recording...", ID_TOOLS_RECORD_STARTMOVIERECORDING + MENUITEM "Stop movie recording", ID_TOOLS_RECORD_STOPMOVIERECORDING + END + POPUP "Play" + BEGIN + MENUITEM "Start playing movie...", ID_TOOLS_PLAY_STARTMOVIEPLAYING + MENUITEM "Stop playing movie", ID_TOOLS_PLAY_STOPMOVIEPLAYING + END + MENUITEM SEPARATOR + MENUITEM "Rewind", ID_TOOLS_REWIND + MENUITEM "Customize...", ID_TOOLS_CUSTOMIZE + END + POPUP "&Help" + BEGIN + MENUITEM "Bug Report", ID_HELP_BUGREPORT + MENUITEM "FAQ (website)", ID_HELP_FAQ + MENUITEM "License...", ID_HELP_GNUPUBLICLICENSE + MENUITEM SEPARATOR + MENUITEM "&About...", ID_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_ACCELERATOR ACCELERATORS +BEGIN + "C", ID_CHEATS_SEARCHFORCHEATS, VIRTKEY, CONTROL, NOINVERT + "N", ID_DEBUG_NEXTFRAME, VIRTKEY, CONTROL, NOINVERT + "X", ID_FILE_EXIT, VIRTKEY, CONTROL, NOINVERT + "L", ID_FILE_LOAD, VIRTKEY, 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, 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 + "1", ID_OPTIONS_JOYPAD_AUTOFIRE_A, VIRTKEY, ALT, NOINVERT + "2", ID_OPTIONS_JOYPAD_AUTOFIRE_B, VIRTKEY, ALT, NOINVERT + "3", ID_OPTIONS_JOYPAD_AUTOFIRE_L, VIRTKEY, ALT, NOINVERT + "4", ID_OPTIONS_JOYPAD_AUTOFIRE_R, 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 + "B", ID_TOOLS_REWIND, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// 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 "Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !" + 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 "Unsupported file type: %s" + 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. Please refine better" + 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 "autofire A disabled" + IDS_AUTOFIRE_A "autofire A" + IDS_AUTOFIRE_B_DISABLED "autofire B disabled" + IDS_AUTOFIRE_B "autofire B" + IDS_AUTOFIRE_L_DISABLED "autofire L disabled" + IDS_AUTOFIRE_L "autofire L" + IDS_AUTOFIRE_R_DISABLED "autofire R disabled" + IDS_AUTOFIRE_R "autofire R" + IDS_SELECT_ROM "Select ROM" + IDS_SELECT_SAVE_GAME_NAME "Select save game name" + IDS_LOADED_STATE "Loaded state" + IDS_LOADED_STATE_N "Loaded state %d" +END + +STRINGTABLE +BEGIN + IDS_WROTE_STATE "Wrote state" + IDS_WROTE_STATE_N "Wrote state %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;*.RAR;*.7Z;*.GZ__" + IDS_FILTER_ROM "All Gameboy Advance_*.BIN;*.AGB;*.GBA;*.MB;*.ELF;*.GB;*.SGB;*.CGB;*.GBC;*.ZIP;*.7Z;*.RAR;*.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. 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;*.7Z;*.RAR;*.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_VMV "VisualBoyAdvance Movie_*.VMV__" + 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." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "vba.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/win32/VideoMode.cpp b/src/win32/VideoMode.cpp index 7fec0cdc..2d9b6837 100644 --- a/src/win32/VideoMode.cpp +++ b/src/win32/VideoMode.cpp @@ -63,7 +63,7 @@ static GUID *gpSelectedDriverGUID; // 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 +BOOL WINAPI DDEnumCallbackEx(GUID *pGUID, LPSTR pDescription, LPSTR pName, LPVOID pContext, HMONITOR hm) { if (pGUID) @@ -92,7 +92,7 @@ DDEnumCallbackEx(GUID *pGUID, LPSTR pDescription, LPSTR pName, LPVOID pContext, // Name: DDEnumCallback() // Desc: This callback is used only with old versions of DDraw. //----------------------------------------------------------------------------- -BOOL WINAPI +BOOL WINAPI DDEnumCallback(GUID *pGUID, LPSTR pDescription, LPSTR pName, LPVOID context) { return (DDEnumCallbackEx(pGUID, pDescription, pName, context, NULL)); @@ -102,7 +102,7 @@ static HRESULT WINAPI addVideoMode(LPDDSURFACEDESC2 surf, LPVOID lpContext) { HWND h = (HWND)lpContext; char buffer[50]; - + switch( surf->ddpfPixelFormat.dwRGBBitCount ) { case 16: @@ -137,46 +137,46 @@ int winVideoModeSelect(CWnd *pWnd, GUID **guid) #else HMODULE h = LoadLibrary( _T("ddraw.dll") ); #endif - + // 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 + + // 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, + lpDDEnumEx(DDEnumCallbackEx, NULL, DDENUM_ATTACHEDSECONDARYDEVICES | - DDENUM_NONDISPLAYDEVICES + 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 + * 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. - * + * be a wrapper for a DDEnumCallbackEx. + * * Such a function would look like: * BOOL FAR PASCAL OldCallback(GUID FAR *lpGUID, * LPSTR pDesc, @@ -201,12 +201,12 @@ int winVideoModeSelect(CWnd *pWnd, GUID **guid) #else FreeLibrary( h ); #endif - + return -1; } } - HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); + HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *)) GetProcAddress(h, "DirectDrawCreateEx"); @@ -234,8 +234,8 @@ int winVideoModeSelect(CWnd *pWnd, GUID **guid) FreeLibrary( h ); #endif return -1; - } - + } + VideoMode dlg(ddraw, pWnd); INT_PTR res = dlg.DoModal(); @@ -291,19 +291,19 @@ BEGIN_MESSAGE_MAP(VideoMode, CDialog) ///////////////////////////////////////////////////////////////////////////// // VideoMode message handlers -void VideoMode::OnSelchangeModes() +void VideoMode::OnSelchangeModes() { int item = m_modes.GetCurSel(); GetDlgItem(ID_OK)->EnableWindow(item != -1); } -void VideoMode::OnCancel() +void VideoMode::OnCancel() { EndDialog(-1); } -void VideoMode::OnOk() +void VideoMode::OnOk() { DWORD_PTR cur = m_modes.GetCurSel(); @@ -313,18 +313,18 @@ void VideoMode::OnOk() EndDialog((int)cur); } -BOOL VideoMode::OnInitDialog() +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); + + GetDlgItem(ID_OK)->EnableWindow(FALSE); CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control @@ -364,32 +364,32 @@ BEGIN_MESSAGE_MAP(VideoDriverSelect, CDialog) ///////////////////////////////////////////////////////////////////////////// // VideoDriverSelect message handlers -void VideoDriverSelect::OnCancel() +void VideoDriverSelect::OnCancel() { EndDialog(-1); } -void VideoDriverSelect::OnOk() +void VideoDriverSelect::OnOk() { EndDialog(m_drivers.GetCurSel()); } -BOOL VideoDriverSelect::OnInitDialog() +BOOL VideoDriverSelect::OnInitDialog() { CDialog::OnInitDialog(); - + for(int i = 0; i < gDriverCnt; i++) { m_drivers.AddString(Drivers[i].szDescription); } - - GetDlgItem(ID_OK)->EnableWindow(FALSE); + + 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() +void VideoDriverSelect::OnSelchangeDrivers() { GetDlgItem(ID_OK)->EnableWindow(m_drivers.GetCurSel() != -1); } diff --git a/src/win32/WavWriter.cpp b/src/win32/WavWriter.cpp index 3759bfd3..75820d9e 100644 --- a/src/win32/WavWriter.cpp +++ b/src/win32/WavWriter.cpp @@ -100,7 +100,7 @@ void WavWriter::SetFormat(const WAVEFORMATEX *format) // 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); diff --git a/src/win32/WavWriter.h b/src/win32/WavWriter.h index 8e3c31bc..d442cf10 100644 --- a/src/win32/WavWriter.h +++ b/src/win32/WavWriter.h @@ -30,7 +30,7 @@ #include -class WavWriter +class WavWriter { private: FILE *m_file; diff --git a/src/win32/WinHelper.h b/src/win32/WinHelper.h index 66fb6b70..a4ae88a5 100644 --- a/src/win32/WinHelper.h +++ b/src/win32/WinHelper.h @@ -5,7 +5,7 @@ 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 + These should all be zero impact classes etc. that is they should *not* have a cpp file associated with them. ----------------------------------------------------------------------*/ #ifndef WINHELPER_H @@ -78,9 +78,9 @@ namespace WinHelper // 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; } + 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; } + 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 diff --git a/src/win32/WinResUtil.cpp b/src/win32/WinResUtil.cpp index 968df8a3..1f9a923c 100644 --- a/src/win32/WinResUtil.cpp +++ b/src/win32/WinResUtil.cpp @@ -46,10 +46,10 @@ UCHAR *winResGetResource(LPCTSTR resType, LPCTSTR resName) HMENU winResLoadMenu(LPCTSTR menuName) { UCHAR * b = winResGetResource(RT_MENU, menuName); - + if(b != NULL) { HMENU menu = LoadMenuIndirect((CONST MENUTEMPLATE *)b); - + if(menu != NULL) return menu; } @@ -64,9 +64,9 @@ int winResDialogBox(LPCTSTR boxName, { /* UCHAR * b = winResGetResource(RT_DIALOG, boxName); - + if(b != NULL) { - + return DialogBoxIndirectParam(hInstance, (LPCDLGTEMPLATE)b, parent, @@ -97,7 +97,7 @@ CString winResLoadString(UINT id) { int stId = id / 16 + 1; HINSTANCE inst = winResGetInstance(RT_STRING, MAKEINTRESOURCE(stId)); - + CString res; if(res.LoadString(id)) return res; diff --git a/src/win32/ZoomControl.cpp b/src/win32/ZoomControl.cpp index 67509fc0..2804a2dd 100644 --- a/src/win32/ZoomControl.cpp +++ b/src/win32/ZoomControl.cpp @@ -72,27 +72,27 @@ void ZoomControl::registerClass() wc.lpszMenuName = NULL; wc.lpszClassName = "VbaZoomControl"; AfxRegisterClass(&wc); - isRegistered = true; + isRegistered = true; } } -void ZoomControl::OnPaint() +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; @@ -132,7 +132,7 @@ void ZoomControl::OnPaint() 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); @@ -152,11 +152,11 @@ void ZoomControl::OnPaint() memDC.DeleteDC(); } -void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) +void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) { RECT rect; GetClientRect(&rect); - + int height = rect.bottom - rect.top; int width = rect.right - rect.left; @@ -164,12 +164,12 @@ void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) 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); @@ -177,7 +177,7 @@ void ZoomControl::OnLButtonDown(UINT nFlags, CPoint point) Invalidate(); } -BOOL ZoomControl::OnEraseBkgnd(CDC* pDC) +BOOL ZoomControl::OnEraseBkgnd(CDC* pDC) { return TRUE; } diff --git a/src/win32/glfont.c b/src/win32/glfont.c index 3220ec41..f49a6789 100644 --- a/src/win32/glfont.c +++ b/src/win32/glfont.c @@ -1,154 +1,154 @@ -//********************************************************* -//GLFONT.CPP -- glFont routines -//Copyright (c) 1998 Brad Fish -//See glFont.txt for terms of use -//November 10, 1998 -//********************************************************* - -#include -#include -#include -#include -#include -#include "glfont.h" - -//********************************************************* -//Variables -//********************************************************* - -//Current font -GLFONT *glFont; - -//********************************************************* -//Functions -//********************************************************* -int glFontCreate (GLFONT *Font, char *Buffer, int Tex) -{ - char *TexBytes; - int Num; - - //Read glFont structure - memcpy(Font, Buffer, sizeof(GLFONT)); - Buffer+=sizeof(GLFONT); - - //Save texture number - Font->Tex = Tex; - - //Get number of characters - Num = Font->IntEnd - Font->IntStart + 1; - - //Allocate memory for characters - if ((Font->Char = (GLFONTCHAR *)malloc( - sizeof(GLFONTCHAR) * Num)) == NULL) - return FALSE; - - //Read glFont characters - memcpy(Font->Char, Buffer, sizeof(GLFONTCHAR)*Num); - Buffer+=sizeof(GLFONTCHAR)*Num; - - //Get texture size - Num = Font->TexWidth * Font->TexHeight * 2; - - //Allocate memory for texture data - if ((TexBytes = (char *)malloc(Num)) == NULL) - return FALSE; - - //Read texture data - memcpy(TexBytes, Buffer, sizeof(char)*Num); - Buffer+=sizeof(char)*Num; - - //Set texture attributes - glBindTexture(GL_TEXTURE_2D, Font->Tex); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_CLAMP); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_CLAMP); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, - GL_MODULATE); - - //Create texture - glTexImage2D(GL_TEXTURE_2D, 0, 2, Font->TexWidth, - Font->TexHeight, 0, GL_LUMINANCE_ALPHA, - GL_UNSIGNED_BYTE, (void *)TexBytes); - - //Clean up - free(TexBytes); - - //Return pointer to new font - return TRUE; -} -//********************************************************* -void glFontDestroy (GLFONT *Font) -{ - //Free character memory - free(Font->Char); -} -//********************************************************* -void glFontBegin (GLFONT *Font) -{ - //Save pointer to font structure - if (Font->Char != NULL) - glFont = Font; - else - glFont = NULL; - - //Bind to font texture - glBindTexture(GL_TEXTURE_2D, Font->Tex); -} -//********************************************************* -void glFontEnd (void) -{ - //Font no longer current - glFont = NULL; -} -//********************************************************* -void glFontTextOut (char *String, float x, float y, - float z) -{ - int Length, i; - GLFONTCHAR *Char; - - //Return if we don't have a valid glFont - if (glFont == NULL) - return; - - //Get length of string - Length = strlen(String); - - //Begin rendering quads - glBegin(GL_QUADS); - - //Loop through characters - for (i = 0; i < Length; i++) - { - //Get pointer to glFont character - Char = &glFont->Char[(int)String[i] - - glFont->IntStart]; - - //Specify vertices and texture coordinates - glTexCoord2f(Char->tx1, Char->ty1); - glVertex3f(x, y - Char->dy, z); - glTexCoord2f(Char->tx1, Char->ty2); - glVertex3f(x, y, z); - glTexCoord2f(Char->tx2, Char->ty2); - glVertex3f(x + Char->dx, y, z); - glTexCoord2f(Char->tx2, Char->ty1); - glVertex3f(x + Char->dx, y - Char->dy, z); - - //Move to next character - x += Char->dx; - } - - //Stop rendering quads - glEnd(); -} -//********************************************************* - -//End of file - - - +//********************************************************* +//GLFONT.CPP -- glFont routines +//Copyright (c) 1998 Brad Fish +//See glFont.txt for terms of use +//November 10, 1998 +//********************************************************* + +#include +#include +#include +#include +#include +#include "glfont.h" + +//********************************************************* +//Variables +//********************************************************* + +//Current font +GLFONT *glFont; + +//********************************************************* +//Functions +//********************************************************* +int glFontCreate (GLFONT *Font, char *Buffer, int Tex) +{ + char *TexBytes; + int Num; + + //Read glFont structure + memcpy(Font, Buffer, sizeof(GLFONT)); + Buffer+=sizeof(GLFONT); + + //Save texture number + Font->Tex = Tex; + + //Get number of characters + Num = Font->IntEnd - Font->IntStart + 1; + + //Allocate memory for characters + if ((Font->Char = (GLFONTCHAR *)malloc( + sizeof(GLFONTCHAR) * Num)) == NULL) + return FALSE; + + //Read glFont characters + memcpy(Font->Char, Buffer, sizeof(GLFONTCHAR)*Num); + Buffer+=sizeof(GLFONTCHAR)*Num; + + //Get texture size + Num = Font->TexWidth * Font->TexHeight * 2; + + //Allocate memory for texture data + if ((TexBytes = (char *)malloc(Num)) == NULL) + return FALSE; + + //Read texture data + memcpy(TexBytes, Buffer, sizeof(char)*Num); + Buffer+=sizeof(char)*Num; + + //Set texture attributes + glBindTexture(GL_TEXTURE_2D, Font->Tex); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, + GL_MODULATE); + + //Create texture + glTexImage2D(GL_TEXTURE_2D, 0, 2, Font->TexWidth, + Font->TexHeight, 0, GL_LUMINANCE_ALPHA, + GL_UNSIGNED_BYTE, (void *)TexBytes); + + //Clean up + free(TexBytes); + + //Return pointer to new font + return TRUE; +} +//********************************************************* +void glFontDestroy (GLFONT *Font) +{ + //Free character memory + free(Font->Char); +} +//********************************************************* +void glFontBegin (GLFONT *Font) +{ + //Save pointer to font structure + if (Font->Char != NULL) + glFont = Font; + else + glFont = NULL; + + //Bind to font texture + glBindTexture(GL_TEXTURE_2D, Font->Tex); +} +//********************************************************* +void glFontEnd (void) +{ + //Font no longer current + glFont = NULL; +} +//********************************************************* +void glFontTextOut (char *String, float x, float y, + float z) +{ + int Length, i; + GLFONTCHAR *Char; + + //Return if we don't have a valid glFont + if (glFont == NULL) + return; + + //Get length of string + Length = strlen(String); + + //Begin rendering quads + glBegin(GL_QUADS); + + //Loop through characters + for (i = 0; i < Length; i++) + { + //Get pointer to glFont character + Char = &glFont->Char[(int)String[i] - + glFont->IntStart]; + + //Specify vertices and texture coordinates + glTexCoord2f(Char->tx1, Char->ty1); + glVertex3f(x, y - Char->dy, z); + glTexCoord2f(Char->tx1, Char->ty2); + glVertex3f(x, y, z); + glTexCoord2f(Char->tx2, Char->ty2); + glVertex3f(x + Char->dx, y, z); + glTexCoord2f(Char->tx2, Char->ty1); + glVertex3f(x + Char->dx, y - Char->dy, z); + + //Move to next character + x += Char->dx; + } + + //Stop rendering quads + glEnd(); +} +//********************************************************* + +//End of file + + + diff --git a/src/win32/glfont.h b/src/win32/glfont.h index 21df1f30..7e062922 100644 --- a/src/win32/glfont.h +++ b/src/win32/glfont.h @@ -1,63 +1,63 @@ -//********************************************************* -//GLFONT.H -- Header for GLFONT.CPP -//Copyright (c) 1998 Brad Fish -//See glFont.txt for terms of use -//November 10, 1998 -//********************************************************* - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -//********************************************************* -//Structures -//********************************************************* - -//glFont character structure -typedef struct -{ - float dx, dy; - float tx1, ty1; - float tx2, ty2; -} GLFONTCHAR; - -//glFont structure -typedef struct -{ - int Tex; - int TexWidth, TexHeight; - int IntStart, IntEnd; - GLFONTCHAR *Char; -} GLFONT; - -//********************************************************* -//Function Declarations -//********************************************************* -#ifdef __cplusplus -extern "C" { -#endif -//Creates a glFont -int glFontCreate(GLFONT *Font, char *Buffer, int Tex); - -//Deletes a glFont -void glFontDestroy (GLFONT *Font); - -//Needs to be called before text output -void glFontBegin (GLFONT *Font); - -//Needs to be called after text output -void glFontEnd (void); - -//Draws text with a glFont -void glFontTextOut (char *String, float x, float y, - float z); -//********************************************************* -#ifdef __cplusplus -} -#endif -//End of file - +//********************************************************* +//GLFONT.H -- Header for GLFONT.CPP +//Copyright (c) 1998 Brad Fish +//See glFont.txt for terms of use +//November 10, 1998 +//********************************************************* + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +//********************************************************* +//Structures +//********************************************************* + +//glFont character structure +typedef struct +{ + float dx, dy; + float tx1, ty1; + float tx2, ty2; +} GLFONTCHAR; + +//glFont structure +typedef struct +{ + int Tex; + int TexWidth, TexHeight; + int IntStart, IntEnd; + GLFONTCHAR *Char; +} GLFONT; + +//********************************************************* +//Function Declarations +//********************************************************* +#ifdef __cplusplus +extern "C" { +#endif +//Creates a glFont +int glFontCreate(GLFONT *Font, char *Buffer, int Tex); + +//Deletes a glFont +void glFontDestroy (GLFONT *Font); + +//Needs to be called before text output +void glFontBegin (GLFONT *Font); + +//Needs to be called after text output +void glFontEnd (void); + +//Draws text with a glFont +void glFontTextOut (char *String, float x, float y, + float z); +//********************************************************* +#ifdef __cplusplus +} +#endif +//End of file + diff --git a/src/win32/gzglfont.h b/src/win32/gzglfont.h index 618065f6..65e19519 100644 --- a/src/win32/gzglfont.h +++ b/src/win32/gzglfont.h @@ -1,257 +1,257 @@ -#define GZGLFONT_SIZE 35096 - - -unsigned char gzglfont[]= - { - '\x1F', '\x8B', '\x08', '\x08', '\x72', '\x0F', '\x39', '\x47', - '\x00', '\x0B', '\x76', '\x65', '\x72', '\x64', '\x61', '\x6E', - '\x61', '\x00', '\xED', '\x97', '\xBF', '\x6B', '\x5C', '\x47', - '\x10', '\xC7', '\x2F', '\x21', '\x04', '\x27', '\x90', '\x20', - '\x82', '\x08', '\x21', '\x08', '\x21', '\x82', '\x62', '\x5C', - '\x19', '\x21', '\x8C', '\xAB', '\xDC', '\x7B', '\x42', '\x11', - '\x21', '\x0E', '\xC6', '\x1C', '\xAA', '\x0E', '\x05', '\x82', - '\x30', '\x42', '\xA8', '\x88', '\x85', '\x50', '\x11', '\x4C', - '\x9A', '\xB8', '\x70', '\x91', '\xC2', '\x85', '\x50', '\x95', - '\xC2', '\x85', '\x0A', '\x15', '\x29', '\x55', '\x08', '\xBB', - '\x49', '\xE1', '\x22', '\x4D', '\x7A', '\x17', '\x02', '\xBB', - '\x50', '\xE1', '\x22', '\x85', '\x0A', '\xFD', '\x01', '\x81', - '\xCB', '\xED', '\x7B', '\x73', '\x7E', '\xBB', '\xB3', '\x33', - '\xB3', '\xF3', '\x7E', '\xDC', '\xE9', '\x7C', '\xB7', '\x03', - '\xB2', '\xDF', '\x7D', '\x6E', '\xDE', '\xCE', '\x7C', '\x67', - '\x67', '\x7F', '\x5C', '\xAB', '\xD5', '\x6A', '\x3D', '\x82', - '\xBF', '\x85', '\xFE', '\xDF', '\x6F', '\xFD', '\xBF', '\x87', - '\x9F', '\x7C', '\xFB', '\xDE', '\xD7', '\x77', '\x3E', '\x4B', - '\xFB', '\x8F', '\x2B', '\xAD', '\xC2', '\xDA', '\xAD', '\xD6', - '\x79', '\x7B', '\xF7', '\xD5', '\x6D', '\xE0', '\x0B', '\xED', - '\x1C', '\x1F', '\x65', '\xBC', '\x3F', '\x02', '\xF0', '\x13', - '\xE0', '\x33', '\x49', '\xEE', '\xFF', '\x0C', '\xF8', '\x17', - '\x49', '\xCE', '\x77', '\x32', '\x7E', '\xE7', '\xF0', '\x18', - '\xF8', '\x1E', '\xF0', '\xA7', '\x19', '\x3F', '\x5C', '\xFC', - '\x68', '\xA5', '\xD7', '\xEB', '\xF5', '\xBF', '\x3B', '\x02', - '\xFE', '\x1A', '\x8D', '\x73', '\x0E', '\xFC', '\x83', '\xD4', - '\xF0', '\x22', '\xCF', '\x0F', '\xD3', '\x9C', '\x7F', '\x9A', - '\xBA', '\xF9', '\xCC', '\x00', '\x9F', '\x47', '\x7C', '\x01', - '\xF8', '\xCD', '\xD4', '\xCD', '\x67', '\x09', '\xF8', '\x6A', - '\xEA', '\xC6', '\x5D', '\x03', '\xDE', '\x45', '\x71', '\x37', - '\x80', '\xDF', '\xCF', '\xF8', '\xF3', '\x07', '\x3F', '\x02', - '\xDF', '\x02', '\xBE', '\x87', '\xFC', '\xF7', '\x81', '\xFF', - '\x0A', '\xFC', '\xD0', '\xAA', '\xF3', '\xA5', '\xC9', '\xAF', - '\x6D', '\x6A', '\x54', '\xE4', '\x73', '\xD0', '\xCE', '\xB9', - '\xA9', '\xA7', '\xCD', '\x4D', '\x3D', '\x0D', '\xDF', '\x44', - '\x7C', '\x07', '\xF8', '\x1F', '\x88', '\x3F', '\x05', '\xFE', - '\x02', '\xF1', '\xBF', '\x81', '\xFF', '\x8B', '\xF8', '\x05', - '\xF0', '\x6B', '\xA9', '\xCB', '\x3F', '\x4E', '\x73', '\x3E', - '\x87', '\xF8', '\x3C', '\xF0', '\x25', '\xC4', '\x97', '\x81', - '\xAF', '\x21', '\xFE', '\x1D', '\xF0', '\x6E', '\xC6', '\x8B', - '\xBE', '\xDA', '\x00', '\xBE', '\x85', '\xF8', '\x36', '\xF0', - '\x3D', '\xE0', '\xCF', '\xAC', '\xBA', '\x99', '\x1E', '\x32', - '\x7D', '\x78', '\x62', '\x71', '\xD3', '\x87', '\x86', '\xDF', - '\x48', '\x5C', '\xBE', '\x94', '\xE4', '\xFC', '\x51', '\xC6', - '\x8B', '\x7E', '\x78', '\x0C', '\xFC', '\x28', '\xE3', '\xCF', - '\x1F', '\xBC', '\x02', '\x7E', '\x0C', '\xFC', '\x65', '\xC6', - '\x8B', '\xFC', '\xCF', '\x80', '\xFF', '\x87', '\x78', '\x2B', - '\xCD', '\xB9', '\x99', '\x6F', '\x9B', '\xCF', '\x02', '\xBF', - '\x9E', '\xBA', '\xF9', '\xDC', '\x00', '\xFE', '\x4D', '\xC6', - '\x8B', '\x7E', '\x48', '\x80', '\xDF', '\x43', '\xBC', '\x03', - '\x7C', '\x13', '\x8D', '\x73', '\x1F', '\xF8', '\x2F', '\x88', - '\x1B', '\x3B', '\x85', '\xFA', '\x5C', '\x24', '\x45', '\x7F', - '\x9A', '\xFA', '\x18', '\x7E', '\x2D', '\xC9', '\xE7', '\xFA', - '\xED', '\x7A', '\x49', '\x72', '\xFE', '\x7D', '\xC6', '\x8B', - '\xFC', '\x3B', '\xC0', '\x9F', '\x64', '\xBC', '\xC8', '\xE7', - '\x00', '\xF8', '\x49', '\xC6', '\x0F', '\x17', '\xFF', '\x01', - '\x7E', '\x0A', '\xFC', '\x3C', '\xE3', '\x45', '\x3E', '\x6F', - '\x80', '\x9B', '\xF5', '\x6A', '\xFB', '\x9B', '\x3E', '\x33', - '\x7C', '\x3E', '\x75', '\xE3', '\x2E', '\x00', '\x5F', '\x46', - '\xFE', '\xB7', '\x80', '\xFF', '\x80', '\xFC', '\xEF', '\x02', - '\xFF', '\x09', '\xF1', '\x4D', '\xE0', '\xFB', '\xA9', '\x9B', - '\x7F', '\xB6', '\xEE', '\x92', '\x7C', '\xDD', '\xCD', '\xA6', - '\x45', '\x9E', '\xD9', '\xBA', '\x4B', '\xF2', '\x75', '\x36', - '\x9B', '\x5A', '\xF9', '\x24', '\x39', '\xDF', '\x49', '\xF2', - '\x39', '\xCD', '\xC6', '\x58', '\xC9', '\x6B', '\x7F', '\x09', - '\x75', '\xB0', '\xFD', '\x4F', '\x81', '\x9F', '\x25', '\xEE', - '\xF8', '\xAF', '\x81', '\xBF', '\x9F', '\x1A', '\x5E', '\xE4', - '\x63', '\xF6', '\xB5', '\x4B', '\x18', '\x7B', '\x36', '\x2D', - '\xE6', '\xEB', '\x73', '\xE0', '\x5F', '\x21', '\xFF', '\x45', - '\xE0', '\xB7', '\x90', '\xFF', '\x6D', '\xE0', '\xAB', '\xA9', - '\x1B', '\x77', '\x0D', '\x78', '\x37', '\x75', '\xF3', '\xDC', - '\x00', '\xFE', '\x33', '\xE2', '\xC6', '\x4C', '\x6C', '\x53', - '\x8F', '\x65', '\x2B', '\xAE', '\xE9', '\x27', '\xC3', '\x67', - '\x12', '\x97', '\x9B', '\x7A', '\x19', '\xDE', '\x85', '\x39', - '\x1B', '\xF4', '\xD5', '\x26', '\xF0', '\x27', '\xC8', '\xFF', - '\x00', '\xF8', '\x09', '\xE2', '\xA7', '\xC0', '\x5F', '\x66', - '\xBC', '\xD8', '\x07', '\xCE', '\x80', '\x5F', '\x20', '\xFF', - '\x4B', '\xE0', '\xA6', '\x8F', '\x6C', '\x6E', '\xF6', '\x2B', - '\xC3', '\xBF', '\x04', '\x3E', '\xD8', '\x87', '\xE7', '\x80', - '\x2F', '\xA6', '\xEE', '\xF8', '\xD7', '\x81', '\x2F', '\xA1', - '\x71', '\x96', '\x81', '\xAF', '\xA2', '\x71', '\xD6', '\x80', - '\xDF', '\xCD', '\x78', '\xB1', '\x6F', '\xDC', '\x03', '\xBE', - '\x8D', '\xC6', '\xD9', '\x01', '\xFE', '\x10', '\x71', '\x63', - '\x66', '\x0E', '\x4D', '\x1F', '\x76', '\xEC', '\xFA', '\xB4', - '\x73', '\x6E', '\xD6', '\xA9', '\xCD', '\x67', '\x60', '\xCE', - '\x3B', '\x19', '\x2F', '\xE6', '\xBD', '\x0B', '\xFC', '\x71', - '\x92', '\xEF', '\x15', '\x83', '\xFA', '\xFF', '\x0E', '\xFC', - '\x38', '\xE3', '\x85', '\xDE', '\x3F', '\x81', '\xFF', '\x85', - '\xC6', '\x7F', '\x01', '\xFC', '\x1C', '\xF1', '\x37', '\xC0', - '\x4D', '\xDF', '\x76', '\x2C', '\xBD', '\xA6', '\x6F', '\x0D', - '\x9F', '\x4B', '\x5D', '\xFF', '\x79', '\xE0', '\x37', '\x11', - '\x5F', '\x02', '\xBE', '\x92', '\xBA', '\x79', '\xAE', '\x02', - '\xEF', '\x64', '\x7F', '\x45', '\x1F', '\xAE', '\x03', '\xDF', - '\x4A', '\x5D', '\xBD', '\xDB', '\xC0', '\xF7', '\x91', '\xBF', - '\xB1', '\x75', '\xE8', '\xDB', '\x5D', '\xAB', '\xFF', '\x4D', - '\xDF', '\x1A', '\x6E', '\xD6', '\xF1', '\xAE', '\x95', '\xBF', - '\x39', '\x27', '\xD6', '\xA1', '\x6E', '\xBB', '\x69', '\x2B', - '\x5A', '\x34', '\xC2', '\xFA', '\x77', '\xD3', '\xDE', '\xE0', - '\xDF', '\xB0', '\x6F', '\x53', '\xF1', '\x34', '\x9F', '\x9A', - '\x8B', '\x29', '\xE5', '\x40', '\xEB', '\xCF', '\x3F', '\xE1', - '\xD8', '\xFE', '\x67', '\x77', '\x24', '\x2A', '\x0E', '\xF5', - '\x0E', '\xF5', '\x4C', '\x91', '\x3C', '\xB3', '\xE6', '\x6B', - '\x50', '\x45', '\x7F', '\xEF', '\xAD', '\x71', '\x6F', '\xD2', - '\x5A', '\xFC', '\x91', '\xF5', '\xFA', '\xE9', '\x0A', '\xD6', - '\xAF', '\x87', '\xDC', '\xED', '\x3D', '\xC7', '\xEC', '\x37', - '\xDC', '\xAA', '\xB8', '\xFA', '\xE8', '\xD9', '\x97', '\x62', - '\xD1', '\xDF', '\xF8', '\x2B', '\x62', '\xDC', '\xF4', '\xBB', - '\xA3', '\xD8', '\xFA', '\xE5', '\xFE', '\xD0', '\x65', '\x81', - '\x57', '\x14', '\xD5', '\xFF', '\xC3', '\xD5', '\x2F', '\x77', - '\x3F', '\xAD', '\xCF', '\x7E', '\x72', '\x3D', '\x06', '\x63', - '\x71', '\xFD', '\x11', '\xA2', '\xD4', '\x7A', '\xC0', '\x99', - '\xF8', '\xDF', '\x4B', '\xEA', '\x64', '\xFD', '\x5C', '\x04', - '\xAE', '\x02', '\xF6', '\xBA', '\xC0', '\xFB', '\x81', '\x5B', - '\x1F', '\x5D', '\x16', '\xE1', '\xEC', '\x87', '\x73', '\x26', - '\xD8', '\xF1', '\xB9', '\x0A', '\x73', '\xFD', '\x2C', '\xE9', - '\xE7', '\x15', '\x5D', '\x9D', '\x7E', '\x39', '\x06', '\xB5', - '\x9F', '\xB9', '\x6B', '\x9C', '\xCE', '\x86', '\xD3', '\x5F', - '\x4E', '\x69', '\x15', '\xFD', '\xE5', '\x2A', '\x5C', '\x45', - '\x3F', '\x75', '\xFE', '\xF9', '\xD9', '\x70', '\x6B', '\x46', - '\xAF', '\x55', '\xA3', '\x5E', '\x33', '\x4E', '\x9D', '\xD1', - '\xA4', '\x38', '\x4D', '\x8E', '\x36', '\x7C', '\xFD', '\x4D', - '\x5B', '\xF3', '\x51', '\xFC', '\x7E', '\xA9', '\x36', '\x4A', - '\x53', '\xF9', '\x44', '\x8B', '\x36', '\xE9', '\x36', '\xAA', - '\xDD', '\x62', '\x5C', '\xCD', '\xBF', '\xC1', '\x85', '\xF7', - '\x61', '\xCA', '\x4F', '\x3A', '\x11', '\x43', '\x37', '\x47', - '\xFF', '\xA6', '\xDA', '\xEB', '\x51', '\x7E', '\xE5', '\xE2', - '\x6A', '\x0C', '\x8F', '\x4E', '\x53', '\x6E', '\x5F', '\x96', - '\x9F', '\xEC', '\xF7', '\xE9', '\x88', '\x12', '\x2B', '\x1B', - '\xAD', '\xFE', '\x59', '\x29', '\x6B', '\x08', '\xBD', '\x4D', - '\x33', '\xFF', '\xB6', '\x13', '\xEE', '\xAE', '\x32', '\xF9', - '\x85', '\x2A', '\x11', '\xAA', '\xCA', '\xD5', '\xE8', '\xE7', - '\x7B', '\xBD', '\x6C', '\x7E', '\xF5', '\xF4', '\x87', '\xFB', - '\x5A', '\x1A', '\x85', '\xEE', '\x74', '\xAC', '\x3E', '\xFC', - '\xB6', '\x3E', '\x2E', '\x5D', '\x3B', '\x29', '\x47', '\xD9', - '\xEA', '\xE8', '\x0F', '\xF7', '\x84', '\xF6', '\xF7', '\x8E', - '\x36', '\x2E', '\x3F', '\xC3', '\x5C', '\xF7', '\xC8', '\xC6', - '\x47', '\x0B', '\xEB', '\xE7', '\xA3', '\xB9', '\xA3', '\x68', - '\x3A', '\x9B', '\x8B', '\xAB', '\xCF', '\x4F', '\xCE', '\x88', - '\xB3', '\xEA', '\xFA', '\xA5', '\x7A', '\xC8', '\xB5', '\x92', - '\x55', '\x57', '\xD7', '\x4F', '\xC7', '\xD0', '\xEF', '\xAD', - '\x05', '\xC1', '\xB3', '\xE5', '\xCF', '\x21', '\x3D', '\xAF', - '\x9A', '\x99', '\x0E', '\xC7', '\x90', '\xB2', '\x93', '\xDF', - '\xA5', '\xDF', '\xE4', '\xF5', '\x97', '\xEF', '\x97', '\x77', - '\xD1', '\xA2', '\xFE', '\xAB', '\xCE', '\x20', '\x5A', '\xB4', - '\x68', '\x93', '\x69', '\xD4', '\x79', '\x27', '\x9D', '\x82', - '\xA1', '\x33', '\x8F', '\x7A', '\x9F', '\x3A', '\x6B', '\x43', - '\xA7', '\x72', '\x38', '\x0A', '\x8E', '\x19', '\xD2', '\xC9', - '\x53', '\xEE', '\xB4', '\xC5', '\x31', '\xB9', '\x53', '\x9A', - '\x3B', '\xBB', '\xCB', '\xFE', '\xAE', '\xE1', '\x6A', '\x2E', - '\x6B', '\xD0', '\x9E', '\x83', '\xBA', '\x73', '\x74', '\xF0', - '\x6B', '\x2F', '\x67', '\xBE', '\x2E', '\x4A', '\x41', '\xE8', - '\xB6', '\x42', '\x7F', '\xAF', '\xD1', '\x1F', '\x56', '\xC6', - '\x77', '\x1F', '\xD7', '\x99', '\x72', '\x76', '\x58', '\x27', - '\xCE', '\x7C', '\x9C', '\xF4', '\xEB', '\xE6', '\x5D', '\x7E', - '\x0B', '\x7F', '\x2A', '\xAB', '\x1F', '\xD7', '\xB9', '\x9C', - '\x7E', '\xF7', '\x6D', '\x9A', '\x68', '\x95', '\x68', '\xAD', - '\x59', '\xFD', '\xFC', '\x13', '\x1D', '\xA3', '\xDA', '\xFC', - '\xD3', '\xDD', '\xCC', '\xBF', '\xE3', '\xCF', '\x0B', '\x9F', - '\x9D', '\xFB', '\x3D', '\xA7', '\x9F', '\x1A', '\x75', '\x74', - '\xFA', '\xE5', '\xDC', '\x75', '\x7D', '\xA0', '\xAB', '\x9F', - '\xBD', '\xFF', '\xE9', '\xE7', '\x9A', '\xF3', '\xD4', '\xF9', - '\x49', '\x19', '\xEA', '\xD7', '\x02', '\xFF', '\x9D', '\xF4', - '\xBD', '\xAF', '\x9F', '\x3B', '\x29', '\x69', '\x35', '\x54', - '\x9F', '\x51', '\xB5', '\xF3', '\xFD', '\xA4', '\x7E', '\xA2', - '\x46', '\xD3', '\xCD', '\x72', '\x13', '\x36', '\xDA', '\x68', - '\xD1', '\xA2', '\x45', '\x8B', '\x16', '\xAD', '\xAC', '\xF1', - '\xE7', '\x33', '\x75', '\x46', '\x51', '\x7E', '\xFE', '\x38', - '\x14', '\xE1', '\x3C', '\xE9', '\xD3', '\x8C', '\x62', '\xF4', - '\xF9', '\x18', '\xF6', '\x95', '\x4F', '\x3E', '\x5A', '\xBF', - '\xAC', '\x67', '\xF0', '\x14', '\xF6', '\x77', '\x2B', '\xE8', - '\x3F', '\xFB', '\x77', '\x63', '\x7E', '\xDC', '\x6A', '\x94', - '\x8E', '\xD5', '\x84', '\x7E', '\x6E', '\x7E', '\xC3', '\xFA', - '\xE5', '\xFB', '\x5D', '\x58', '\x49', '\x75', '\x5F', '\xDF', - '\xAA', '\xEA', '\xA7', '\xFA', '\x11', '\xFB', '\x17', '\x95', - '\xC2', '\x8A', '\x47', '\xAB', '\x5F', '\xBE', '\xF3', '\xBA', - '\xA6', '\xD7', '\xCF', '\x7D', '\xAB', '\xD1', '\x6F', '\xAF', - '\xA1', '\x66', '\xF5', '\xFB', '\x73', '\x43', '\x31', '\x3A', - '\xEF', '\xE6', '\xE7', '\x9F', '\xDA', '\x2B', '\xF0', '\x2A', - '\x2A', '\xAF', '\x49', '\xAE', '\x15', '\xAD', '\x94', '\xAB', - '\x40', '\x55', '\xFD', '\x9A', '\xF5', '\xDF', '\x94', '\x7E', - '\x29', '\xE7', '\xD0', '\xBE', '\x2C', '\x65', '\x88', '\x69', - '\x39', '\xFD', '\x61', '\x7F', '\xEE', '\x6D', '\x9B', '\xE9', - '\xF7', '\x74', '\x39', '\x17', '\x8E', '\xEA', '\x47', '\xE2', - '\x3A', '\x5C', '\xEA', '\x3F', '\xBA', '\x4F', '\xDD', '\x95', - '\xCD', '\x67', '\x44', '\xCD', '\x24', '\xEE', '\x53', '\x3A', - '\xEB', '\xB0', '\x2F', '\x95', '\x19', '\x35', '\xCE', '\xBB', - '\x6C', '\x93', '\xA8', '\xA9', '\x9C', '\x4D', '\xEA', '\xCC', - '\x46', '\x8B', '\x36', '\xCD', '\xE6', '\xAE', '\x6B', '\xFA', - '\x2C', '\x6E', '\x62', '\xDD', '\xF7', '\x90', '\xE1', '\x68', - '\xDC', '\x49', '\x57', '\xFF', '\x49', '\xBE', '\xE3', '\x69', - '\xCE', '\x40', '\x4C', '\xAB', '\xD7', '\x43', '\x7B', '\x8A', - '\x36', '\xF9', '\x24', '\xE7', '\xAF', '\xD1', '\xE6', '\x67', - '\x5D', '\xB5', '\x02', '\xC3', '\xD1', '\x2F', '\xDF', '\x93', - '\xE9', '\x9E', '\xA6', '\x33', '\x0A', '\xEB', '\xE7', '\x47', - '\xD5', '\x98', '\x46', '\xBF', '\x4E', '\x0D', '\x95', '\xB7', - '\x6E', '\xED', '\xCA', '\x1D', '\x2F', '\xEB', '\x97', '\x2A', - '\xA7', '\xB1', '\xBA', '\xFA', '\x0B', '\x45', '\x1A', '\xFD', - '\xE5', '\x7E', '\xD3', '\x94', '\x21', '\x55', '\xAD', '\xBE', - '\xFE', '\xFC', '\xB9', '\xBA', '\xFE', '\xF0', '\x7C', '\x5F', - '\xBD', '\x7E', '\xA9', '\x9B', '\xE9', '\x6F', '\xE9', '\x9E', - '\xA8', '\xA6', '\xBF', '\xC9', '\xFD', '\x5E', '\x1E', '\xB9', - '\xBC', '\xFE', '\xD0', '\x38', '\xA1', '\xCC', '\x75', '\x73', - '\x3B', '\x2A', '\xFD', '\xD4', '\x79', '\x6C', '\x73', '\xFE', - '\xDD', '\x3A', '\xFA', '\xDD', '\x78', '\xA3', '\xD5', '\x3F', - '\x7E', '\x46', '\x6B', '\xE3', '\xFB', '\x74', '\xD2', '\x8C', - '\xEA', '\x3E', '\xEA', '\xC6', '\x18', '\x1E', '\x81', '\xEE', - '\xE4', '\x68', '\xD1', '\xA2', '\xE5', '\xA6', '\x59', '\x1B', - '\xFA', '\xF5', '\xA3', '\x59', '\x95', '\xDA', '\x37', '\xE9', - '\xB3', '\x45', '\x77', '\x5A', '\x96', '\xB1', '\xF0', '\xFB', - '\xCD', '\xE8', '\x0F', '\xD7', '\x86', '\x27', '\xC3', '\xD4', - '\x1F', '\xB6', '\xAB', '\xD1', '\xAF', '\xF5', '\x6B', '\x5E', - '\x3F', '\x3E', '\x33', '\xA8', '\x53', '\x24', '\xEC', '\xE3', - '\xDF', '\x69', '\xCA', '\x7C', '\xF6', '\xCF', '\x3B', '\x97', - '\x52', '\x1D', '\x91', '\x3F', '\xF9', '\x1E', '\xB4', '\x02', - '\x4D', '\x15', '\x34', '\x31', '\x65', '\x0F', '\xBA', '\x73', - '\xAB', '\xFA', '\x53', '\xBF', '\x2A', '\xFC', '\x3A', '\xD9', - '\xFF', '\x73', '\xA3', '\x87', '\x94', '\x6B', '\x6B', '\x5E', - '\x4F', '\x4F', '\x35', '\xFD', '\x6E', '\x74', '\x7E', '\x8C', - '\x6A', '\xFA', '\xCB', '\xE6', '\xC6', '\x7B', '\xD0', '\x55', - '\x9C', '\x1E', '\xFD', '\xF4', '\xB8', '\xF5', '\xF5', '\x87', - '\xCE', '\x86', '\x51', '\xEA', '\x0F', '\x45', '\x1C', '\x78', - '\x34', '\xAB', '\x5F', '\xDA', '\xFF', '\xEA', '\xEA', '\xD7', - '\xEC', '\xCD', '\x7E', '\x1F', '\xFA', '\x3E', '\xD4', '\x67', - '\x39', '\x46', '\x19', '\xFD', '\x1A', '\x95', '\x55', '\xF5', - '\x8F', '\xCE', '\xB4', '\xF9', '\x8C', '\x5B', '\xDE', '\xF5', - '\xCD', '\xEF', '\x28', '\xD9', '\x73', '\xF8', '\x19', '\x45', - '\x8B', '\x16', '\x6D', '\x32', '\x8C', '\x3A', '\xAD', '\x46', - '\x19', '\x7B', '\x54', '\xB1', '\xB4', '\x19', '\x44', '\xFD', - '\x5C', '\x4E', '\xE1', '\x7B', '\x0C', '\x77', '\x57', '\xF1', - '\xEF', '\x47', '\xBE', '\xAF', '\xE6', '\x26', '\x52', '\xC7', - '\x97', '\xCF', '\x57', '\xA7', '\xBF', '\x89', '\x98', '\x78', - '\x6C', '\x5C', '\xCD', '\xE1', '\xEA', '\xA7', '\xF4', '\x8D', - '\x42', '\x3F', '\x3F', '\x76', '\x73', '\xFA', '\xF9', '\x3B', - '\x34', '\x9F', '\x01', '\xEE', '\x85', '\xE1', '\xEB', '\xC7', - '\x31', '\x43', '\xF9', '\xD2', '\x9A', '\x06', '\x7E', '\x9A', - '\xEA', '\xFA', '\x1E', '\x52', '\x37', '\x0C', '\x5F', '\x3F', - '\xFF', '\xAD', '\x46', '\xBF', '\xAD', '\x80', '\xFE', '\x26', - '\x4C', '\x42', '\x6A', '\xC7', '\x5F', '\xBF', '\xF4', '\x1C', - '\xEE', '\x9E', '\xAA', '\xFA', '\xEB', '\xEC', '\xFF', '\xB2', - '\x9E', '\x32', '\xFB', '\x73', '\x19', '\xFD', '\x5C', '\xF4', - '\x6A', '\xFB', '\x9F', '\x6F', '\x72', '\xA5', '\x74', '\x63', - '\x0C', '\xD7', '\xC2', '\x79', '\x4C', '\xB2', '\x7E', '\x5D', - '\x16', '\xE1', '\x8E', '\x88', '\x16', '\x2D', '\x1A', '\x77', - '\x5F', '\x9A', '\x2E', '\x9B', '\xF6', '\x0A', '\x44', '\xFD', - '\x51', '\x3F', '\xF7', '\x79', '\x3A', '\x2A', '\xE3', '\xDE', - '\x58', '\x8B', '\x7F', '\xA7', '\x43', '\x3F', '\xBE', '\x2B', - '\xD9', '\xFF', '\x4F', '\xAF', '\xFE', '\xE9', '\xD9', '\x17', - '\xA6', '\x45', '\x27', '\x67', '\x51', '\xFF', '\xF4', '\xEA', - '\x8F', '\xF7', '\xDF', '\x68', '\xD1', '\xA2', '\x45', '\x8B', - '\x16', '\x2D', '\x5A', '\xB4', '\xE9', '\xB1', '\xFF', '\x01', - '\xF1', '\xAA', '\xBA', '\x4E', '\x18', '\x89', '\x00', '\x00' - }; \ No newline at end of file +#define GZGLFONT_SIZE 35096 + + +unsigned char gzglfont[]= + { + '\x1F', '\x8B', '\x08', '\x08', '\x72', '\x0F', '\x39', '\x47', + '\x00', '\x0B', '\x76', '\x65', '\x72', '\x64', '\x61', '\x6E', + '\x61', '\x00', '\xED', '\x97', '\xBF', '\x6B', '\x5C', '\x47', + '\x10', '\xC7', '\x2F', '\x21', '\x04', '\x27', '\x90', '\x20', + '\x82', '\x08', '\x21', '\x08', '\x21', '\x82', '\x62', '\x5C', + '\x19', '\x21', '\x8C', '\xAB', '\xDC', '\x7B', '\x42', '\x11', + '\x21', '\x0E', '\xC6', '\x1C', '\xAA', '\x0E', '\x05', '\x82', + '\x30', '\x42', '\xA8', '\x88', '\x85', '\x50', '\x11', '\x4C', + '\x9A', '\xB8', '\x70', '\x91', '\xC2', '\x85', '\x50', '\x95', + '\xC2', '\x85', '\x0A', '\x15', '\x29', '\x55', '\x08', '\xBB', + '\x49', '\xE1', '\x22', '\x4D', '\x7A', '\x17', '\x02', '\xBB', + '\x50', '\xE1', '\x22', '\x85', '\x0A', '\xFD', '\x01', '\x81', + '\xCB', '\xED', '\x7B', '\x73', '\x7E', '\xBB', '\xB3', '\x33', + '\xB3', '\xF3', '\x7E', '\xDC', '\xE9', '\x7C', '\xB7', '\x03', + '\xB2', '\xDF', '\x7D', '\x6E', '\xDE', '\xCE', '\x7C', '\x67', + '\x67', '\x7F', '\x5C', '\xAB', '\xD5', '\x6A', '\x3D', '\x82', + '\xBF', '\x85', '\xFE', '\xDF', '\x6F', '\xFD', '\xBF', '\x87', + '\x9F', '\x7C', '\xFB', '\xDE', '\xD7', '\x77', '\x3E', '\x4B', + '\xFB', '\x8F', '\x2B', '\xAD', '\xC2', '\xDA', '\xAD', '\xD6', + '\x79', '\x7B', '\xF7', '\xD5', '\x6D', '\xE0', '\x0B', '\xED', + '\x1C', '\x1F', '\x65', '\xBC', '\x3F', '\x02', '\xF0', '\x13', + '\xE0', '\x33', '\x49', '\xEE', '\xFF', '\x0C', '\xF8', '\x17', + '\x49', '\xCE', '\x77', '\x32', '\x7E', '\xE7', '\xF0', '\x18', + '\xF8', '\x1E', '\xF0', '\xA7', '\x19', '\x3F', '\x5C', '\xFC', + '\x68', '\xA5', '\xD7', '\xEB', '\xF5', '\xBF', '\x3B', '\x02', + '\xFE', '\x1A', '\x8D', '\x73', '\x0E', '\xFC', '\x83', '\xD4', + '\xF0', '\x22', '\xCF', '\x0F', '\xD3', '\x9C', '\x7F', '\x9A', + '\xBA', '\xF9', '\xCC', '\x00', '\x9F', '\x47', '\x7C', '\x01', + '\xF8', '\xCD', '\xD4', '\xCD', '\x67', '\x09', '\xF8', '\x6A', + '\xEA', '\xC6', '\x5D', '\x03', '\xDE', '\x45', '\x71', '\x37', + '\x80', '\xDF', '\xCF', '\xF8', '\xF3', '\x07', '\x3F', '\x02', + '\xDF', '\x02', '\xBE', '\x87', '\xFC', '\xF7', '\x81', '\xFF', + '\x0A', '\xFC', '\xD0', '\xAA', '\xF3', '\xA5', '\xC9', '\xAF', + '\x6D', '\x6A', '\x54', '\xE4', '\x73', '\xD0', '\xCE', '\xB9', + '\xA9', '\xA7', '\xCD', '\x4D', '\x3D', '\x0D', '\xDF', '\x44', + '\x7C', '\x07', '\xF8', '\x1F', '\x88', '\x3F', '\x05', '\xFE', + '\x02', '\xF1', '\xBF', '\x81', '\xFF', '\x8B', '\xF8', '\x05', + '\xF0', '\x6B', '\xA9', '\xCB', '\x3F', '\x4E', '\x73', '\x3E', + '\x87', '\xF8', '\x3C', '\xF0', '\x25', '\xC4', '\x97', '\x81', + '\xAF', '\x21', '\xFE', '\x1D', '\xF0', '\x6E', '\xC6', '\x8B', + '\xBE', '\xDA', '\x00', '\xBE', '\x85', '\xF8', '\x36', '\xF0', + '\x3D', '\xE0', '\xCF', '\xAC', '\xBA', '\x99', '\x1E', '\x32', + '\x7D', '\x78', '\x62', '\x71', '\xD3', '\x87', '\x86', '\xDF', + '\x48', '\x5C', '\xBE', '\x94', '\xE4', '\xFC', '\x51', '\xC6', + '\x8B', '\x7E', '\x78', '\x0C', '\xFC', '\x28', '\xE3', '\xCF', + '\x1F', '\xBC', '\x02', '\x7E', '\x0C', '\xFC', '\x65', '\xC6', + '\x8B', '\xFC', '\xCF', '\x80', '\xFF', '\x87', '\x78', '\x2B', + '\xCD', '\xB9', '\x99', '\x6F', '\x9B', '\xCF', '\x02', '\xBF', + '\x9E', '\xBA', '\xF9', '\xDC', '\x00', '\xFE', '\x4D', '\xC6', + '\x8B', '\x7E', '\x48', '\x80', '\xDF', '\x43', '\xBC', '\x03', + '\x7C', '\x13', '\x8D', '\x73', '\x1F', '\xF8', '\x2F', '\x88', + '\x1B', '\x3B', '\x85', '\xFA', '\x5C', '\x24', '\x45', '\x7F', + '\x9A', '\xFA', '\x18', '\x7E', '\x2D', '\xC9', '\xE7', '\xFA', + '\xED', '\x7A', '\x49', '\x72', '\xFE', '\x7D', '\xC6', '\x8B', + '\xFC', '\x3B', '\xC0', '\x9F', '\x64', '\xBC', '\xC8', '\xE7', + '\x00', '\xF8', '\x49', '\xC6', '\x0F', '\x17', '\xFF', '\x01', + '\x7E', '\x0A', '\xFC', '\x3C', '\xE3', '\x45', '\x3E', '\x6F', + '\x80', '\x9B', '\xF5', '\x6A', '\xFB', '\x9B', '\x3E', '\x33', + '\x7C', '\x3E', '\x75', '\xE3', '\x2E', '\x00', '\x5F', '\x46', + '\xFE', '\xB7', '\x80', '\xFF', '\x80', '\xFC', '\xEF', '\x02', + '\xFF', '\x09', '\xF1', '\x4D', '\xE0', '\xFB', '\xA9', '\x9B', + '\x7F', '\xB6', '\xEE', '\x92', '\x7C', '\xDD', '\xCD', '\xA6', + '\x45', '\x9E', '\xD9', '\xBA', '\x4B', '\xF2', '\x75', '\x36', + '\x9B', '\x5A', '\xF9', '\x24', '\x39', '\xDF', '\x49', '\xF2', + '\x39', '\xCD', '\xC6', '\x58', '\xC9', '\x6B', '\x7F', '\x09', + '\x75', '\xB0', '\xFD', '\x4F', '\x81', '\x9F', '\x25', '\xEE', + '\xF8', '\xAF', '\x81', '\xBF', '\x9F', '\x1A', '\x5E', '\xE4', + '\x63', '\xF6', '\xB5', '\x4B', '\x18', '\x7B', '\x36', '\x2D', + '\xE6', '\xEB', '\x73', '\xE0', '\x5F', '\x21', '\xFF', '\x45', + '\xE0', '\xB7', '\x90', '\xFF', '\x6D', '\xE0', '\xAB', '\xA9', + '\x1B', '\x77', '\x0D', '\x78', '\x37', '\x75', '\xF3', '\xDC', + '\x00', '\xFE', '\x33', '\xE2', '\xC6', '\x4C', '\x6C', '\x53', + '\x8F', '\x65', '\x2B', '\xAE', '\xE9', '\x27', '\xC3', '\x67', + '\x12', '\x97', '\x9B', '\x7A', '\x19', '\xDE', '\x85', '\x39', + '\x1B', '\xF4', '\xD5', '\x26', '\xF0', '\x27', '\xC8', '\xFF', + '\x00', '\xF8', '\x09', '\xE2', '\xA7', '\xC0', '\x5F', '\x66', + '\xBC', '\xD8', '\x07', '\xCE', '\x80', '\x5F', '\x20', '\xFF', + '\x4B', '\xE0', '\xA6', '\x8F', '\x6C', '\x6E', '\xF6', '\x2B', + '\xC3', '\xBF', '\x04', '\x3E', '\xD8', '\x87', '\xE7', '\x80', + '\x2F', '\xA6', '\xEE', '\xF8', '\xD7', '\x81', '\x2F', '\xA1', + '\x71', '\x96', '\x81', '\xAF', '\xA2', '\x71', '\xD6', '\x80', + '\xDF', '\xCD', '\x78', '\xB1', '\x6F', '\xDC', '\x03', '\xBE', + '\x8D', '\xC6', '\xD9', '\x01', '\xFE', '\x10', '\x71', '\x63', + '\x66', '\x0E', '\x4D', '\x1F', '\x76', '\xEC', '\xFA', '\xB4', + '\x73', '\x6E', '\xD6', '\xA9', '\xCD', '\x67', '\x60', '\xCE', + '\x3B', '\x19', '\x2F', '\xE6', '\xBD', '\x0B', '\xFC', '\x71', + '\x92', '\xEF', '\x15', '\x83', '\xFA', '\xFF', '\x0E', '\xFC', + '\x38', '\xE3', '\x85', '\xDE', '\x3F', '\x81', '\xFF', '\x85', + '\xC6', '\x7F', '\x01', '\xFC', '\x1C', '\xF1', '\x37', '\xC0', + '\x4D', '\xDF', '\x76', '\x2C', '\xBD', '\xA6', '\x6F', '\x0D', + '\x9F', '\x4B', '\x5D', '\xFF', '\x79', '\xE0', '\x37', '\x11', + '\x5F', '\x02', '\xBE', '\x92', '\xBA', '\x79', '\xAE', '\x02', + '\xEF', '\x64', '\x7F', '\x45', '\x1F', '\xAE', '\x03', '\xDF', + '\x4A', '\x5D', '\xBD', '\xDB', '\xC0', '\xF7', '\x91', '\xBF', + '\xB1', '\x75', '\xE8', '\xDB', '\x5D', '\xAB', '\xFF', '\x4D', + '\xDF', '\x1A', '\x6E', '\xD6', '\xF1', '\xAE', '\x95', '\xBF', + '\x39', '\x27', '\xD6', '\xA1', '\x6E', '\xBB', '\x69', '\x2B', + '\x5A', '\x34', '\xC2', '\xFA', '\x77', '\xD3', '\xDE', '\xE0', + '\xDF', '\xB0', '\x6F', '\x53', '\xF1', '\x34', '\x9F', '\x9A', + '\x8B', '\x29', '\xE5', '\x40', '\xEB', '\xCF', '\x3F', '\xE1', + '\xD8', '\xFE', '\x67', '\x77', '\x24', '\x2A', '\x0E', '\xF5', + '\x0E', '\xF5', '\x4C', '\x91', '\x3C', '\xB3', '\xE6', '\x6B', + '\x50', '\x45', '\x7F', '\xEF', '\xAD', '\x71', '\x6F', '\xD2', + '\x5A', '\xFC', '\x91', '\xF5', '\xFA', '\xE9', '\x0A', '\xD6', + '\xAF', '\x87', '\xDC', '\xED', '\x3D', '\xC7', '\xEC', '\x37', + '\xDC', '\xAA', '\xB8', '\xFA', '\xE8', '\xD9', '\x97', '\x62', + '\xD1', '\xDF', '\xF8', '\x2B', '\x62', '\xDC', '\xF4', '\xBB', + '\xA3', '\xD8', '\xFA', '\xE5', '\xFE', '\xD0', '\x65', '\x81', + '\x57', '\x14', '\xD5', '\xFF', '\xC3', '\xD5', '\x2F', '\x77', + '\x3F', '\xAD', '\xCF', '\x7E', '\x72', '\x3D', '\x06', '\x63', + '\x71', '\xFD', '\x11', '\xA2', '\xD4', '\x7A', '\xC0', '\x99', + '\xF8', '\xDF', '\x4B', '\xEA', '\x64', '\xFD', '\x5C', '\x04', + '\xAE', '\x02', '\xF6', '\xBA', '\xC0', '\xFB', '\x81', '\x5B', + '\x1F', '\x5D', '\x16', '\xE1', '\xEC', '\x87', '\x73', '\x26', + '\xD8', '\xF1', '\xB9', '\x0A', '\x73', '\xFD', '\x2C', '\xE9', + '\xE7', '\x15', '\x5D', '\x9D', '\x7E', '\x39', '\x06', '\xB5', + '\x9F', '\xB9', '\x6B', '\x9C', '\xCE', '\x86', '\xD3', '\x5F', + '\x4E', '\x69', '\x15', '\xFD', '\xE5', '\x2A', '\x5C', '\x45', + '\x3F', '\x75', '\xFE', '\xF9', '\xD9', '\x70', '\x6B', '\x46', + '\xAF', '\x55', '\xA3', '\x5E', '\x33', '\x4E', '\x9D', '\xD1', + '\xA4', '\x38', '\x4D', '\x8E', '\x36', '\x7C', '\xFD', '\x4D', + '\x5B', '\xF3', '\x51', '\xFC', '\x7E', '\xA9', '\x36', '\x4A', + '\x53', '\xF9', '\x44', '\x8B', '\x36', '\xE9', '\x36', '\xAA', + '\xDD', '\x62', '\x5C', '\xCD', '\xBF', '\xC1', '\x85', '\xF7', + '\x61', '\xCA', '\x4F', '\x3A', '\x11', '\x43', '\x37', '\x47', + '\xFF', '\xA6', '\xDA', '\xEB', '\x51', '\x7E', '\xE5', '\xE2', + '\x6A', '\x0C', '\x8F', '\x4E', '\x53', '\x6E', '\x5F', '\x96', + '\x9F', '\xEC', '\xF7', '\xE9', '\x88', '\x12', '\x2B', '\x1B', + '\xAD', '\xFE', '\x59', '\x29', '\x6B', '\x08', '\xBD', '\x4D', + '\x33', '\xFF', '\xB6', '\x13', '\xEE', '\xAE', '\x32', '\xF9', + '\x85', '\x2A', '\x11', '\xAA', '\xCA', '\xD5', '\xE8', '\xE7', + '\x7B', '\xBD', '\x6C', '\x7E', '\xF5', '\xF4', '\x87', '\xFB', + '\x5A', '\x1A', '\x85', '\xEE', '\x74', '\xAC', '\x3E', '\xFC', + '\xB6', '\x3E', '\x2E', '\x5D', '\x3B', '\x29', '\x47', '\xD9', + '\xEA', '\xE8', '\x0F', '\xF7', '\x84', '\xF6', '\xF7', '\x8E', + '\x36', '\x2E', '\x3F', '\xC3', '\x5C', '\xF7', '\xC8', '\xC6', + '\x47', '\x0B', '\xEB', '\xE7', '\xA3', '\xB9', '\xA3', '\x68', + '\x3A', '\x9B', '\x8B', '\xAB', '\xCF', '\x4F', '\xCE', '\x88', + '\xB3', '\xEA', '\xFA', '\xA5', '\x7A', '\xC8', '\xB5', '\x92', + '\x55', '\x57', '\xD7', '\x4F', '\xC7', '\xD0', '\xEF', '\xAD', + '\x05', '\xC1', '\xB3', '\xE5', '\xCF', '\x21', '\x3D', '\xAF', + '\x9A', '\x99', '\x0E', '\xC7', '\x90', '\xB2', '\x93', '\xDF', + '\xA5', '\xDF', '\xE4', '\xF5', '\x97', '\xEF', '\x97', '\x77', + '\xD1', '\xA2', '\xFE', '\xAB', '\xCE', '\x20', '\x5A', '\xB4', + '\x68', '\x93', '\x69', '\xD4', '\x79', '\x27', '\x9D', '\x82', + '\xA1', '\x33', '\x8F', '\x7A', '\x9F', '\x3A', '\x6B', '\x43', + '\xA7', '\x72', '\x38', '\x0A', '\x8E', '\x19', '\xD2', '\xC9', + '\x53', '\xEE', '\xB4', '\xC5', '\x31', '\xB9', '\x53', '\x9A', + '\x3B', '\xBB', '\xCB', '\xFE', '\xAE', '\xE1', '\x6A', '\x2E', + '\x6B', '\xD0', '\x9E', '\x83', '\xBA', '\x73', '\x74', '\xF0', + '\x6B', '\x2F', '\x67', '\xBE', '\x2E', '\x4A', '\x41', '\xE8', + '\xB6', '\x42', '\x7F', '\xAF', '\xD1', '\x1F', '\x56', '\xC6', + '\x77', '\x1F', '\xD7', '\x99', '\x72', '\x76', '\x58', '\x27', + '\xCE', '\x7C', '\x9C', '\xF4', '\xEB', '\xE6', '\x5D', '\x7E', + '\x0B', '\x7F', '\x2A', '\xAB', '\x1F', '\xD7', '\xB9', '\x9C', + '\x7E', '\xF7', '\x6D', '\x9A', '\x68', '\x95', '\x68', '\xAD', + '\x59', '\xFD', '\xFC', '\x13', '\x1D', '\xA3', '\xDA', '\xFC', + '\xD3', '\xDD', '\xCC', '\xBF', '\xE3', '\xCF', '\x0B', '\x9F', + '\x9D', '\xFB', '\x3D', '\xA7', '\x9F', '\x1A', '\x75', '\x74', + '\xFA', '\xE5', '\xDC', '\x75', '\x7D', '\xA0', '\xAB', '\x9F', + '\xBD', '\xFF', '\xE9', '\xE7', '\x9A', '\xF3', '\xD4', '\xF9', + '\x49', '\x19', '\xEA', '\xD7', '\x02', '\xFF', '\x9D', '\xF4', + '\xBD', '\xAF', '\x9F', '\x3B', '\x29', '\x69', '\x35', '\x54', + '\x9F', '\x51', '\xB5', '\xF3', '\xFD', '\xA4', '\x7E', '\xA2', + '\x46', '\xD3', '\xCD', '\x72', '\x13', '\x36', '\xDA', '\x68', + '\xD1', '\xA2', '\x45', '\x8B', '\x16', '\xAD', '\xAC', '\xF1', + '\xE7', '\x33', '\x75', '\x46', '\x51', '\x7E', '\xFE', '\x38', + '\x14', '\xE1', '\x3C', '\xE9', '\xD3', '\x8C', '\x62', '\xF4', + '\xF9', '\x18', '\xF6', '\x95', '\x4F', '\x3E', '\x5A', '\xBF', + '\xAC', '\x67', '\xF0', '\x14', '\xF6', '\x77', '\x2B', '\xE8', + '\x3F', '\xFB', '\x77', '\x63', '\x7E', '\xDC', '\x6A', '\x94', + '\x8E', '\xD5', '\x84', '\x7E', '\x6E', '\x7E', '\xC3', '\xFA', + '\xE5', '\xFB', '\x5D', '\x58', '\x49', '\x75', '\x5F', '\xDF', + '\xAA', '\xEA', '\xA7', '\xFA', '\x11', '\xFB', '\x17', '\x95', + '\xC2', '\x8A', '\x47', '\xAB', '\x5F', '\xBE', '\xF3', '\xBA', + '\xA6', '\xD7', '\xCF', '\x7D', '\xAB', '\xD1', '\x6F', '\xAF', + '\xA1', '\x66', '\xF5', '\xFB', '\x73', '\x43', '\x31', '\x3A', + '\xEF', '\xE6', '\xE7', '\x9F', '\xDA', '\x2B', '\xF0', '\x2A', + '\x2A', '\xAF', '\x49', '\xAE', '\x15', '\xAD', '\x94', '\xAB', + '\x40', '\x55', '\xFD', '\x9A', '\xF5', '\xDF', '\x94', '\x7E', + '\x29', '\xE7', '\xD0', '\xBE', '\x2C', '\x65', '\x88', '\x69', + '\x39', '\xFD', '\x61', '\x7F', '\xEE', '\x6D', '\x9B', '\xE9', + '\xF7', '\x74', '\x39', '\x17', '\x8E', '\xEA', '\x47', '\xE2', + '\x3A', '\x5C', '\xEA', '\x3F', '\xBA', '\x4F', '\xDD', '\x95', + '\xCD', '\x67', '\x44', '\xCD', '\x24', '\xEE', '\x53', '\x3A', + '\xEB', '\xB0', '\x2F', '\x95', '\x19', '\x35', '\xCE', '\xBB', + '\x6C', '\x93', '\xA8', '\xA9', '\x9C', '\x4D', '\xEA', '\xCC', + '\x46', '\x8B', '\x36', '\xCD', '\xE6', '\xAE', '\x6B', '\xFA', + '\x2C', '\x6E', '\x62', '\xDD', '\xF7', '\x90', '\xE1', '\x68', + '\xDC', '\x49', '\x57', '\xFF', '\x49', '\xBE', '\xE3', '\x69', + '\xCE', '\x40', '\x4C', '\xAB', '\xD7', '\x43', '\x7B', '\x8A', + '\x36', '\xF9', '\x24', '\xE7', '\xAF', '\xD1', '\xE6', '\x67', + '\x5D', '\xB5', '\x02', '\xC3', '\xD1', '\x2F', '\xDF', '\x93', + '\xE9', '\x9E', '\xA6', '\x33', '\x0A', '\xEB', '\xE7', '\x47', + '\xD5', '\x98', '\x46', '\xBF', '\x4E', '\x0D', '\x95', '\xB7', + '\x6E', '\xED', '\xCA', '\x1D', '\x2F', '\xEB', '\x97', '\x2A', + '\xA7', '\xB1', '\xBA', '\xFA', '\x0B', '\x45', '\x1A', '\xFD', + '\xE5', '\x7E', '\xD3', '\x94', '\x21', '\x55', '\xAD', '\xBE', + '\xFE', '\xFC', '\xB9', '\xBA', '\xFE', '\xF0', '\x7C', '\x5F', + '\xBD', '\x7E', '\xA9', '\x9B', '\xE9', '\x6F', '\xE9', '\x9E', + '\xA8', '\xA6', '\xBF', '\xC9', '\xFD', '\x5E', '\x1E', '\xB9', + '\xBC', '\xFE', '\xD0', '\x38', '\xA1', '\xCC', '\x75', '\x73', + '\x3B', '\x2A', '\xFD', '\xD4', '\x79', '\x6C', '\x73', '\xFE', + '\xDD', '\x3A', '\xFA', '\xDD', '\x78', '\xA3', '\xD5', '\x3F', + '\x7E', '\x46', '\x6B', '\xE3', '\xFB', '\x74', '\xD2', '\x8C', + '\xEA', '\x3E', '\xEA', '\xC6', '\x18', '\x1E', '\x81', '\xEE', + '\xE4', '\x68', '\xD1', '\xA2', '\xE5', '\xA6', '\x59', '\x1B', + '\xFA', '\xF5', '\xA3', '\x59', '\x95', '\xDA', '\x37', '\xE9', + '\xB3', '\x45', '\x77', '\x5A', '\x96', '\xB1', '\xF0', '\xFB', + '\xCD', '\xE8', '\x0F', '\xD7', '\x86', '\x27', '\xC3', '\xD4', + '\x1F', '\xB6', '\xAB', '\xD1', '\xAF', '\xF5', '\x6B', '\x5E', + '\x3F', '\x3E', '\x33', '\xA8', '\x53', '\x24', '\xEC', '\xE3', + '\xDF', '\x69', '\xCA', '\x7C', '\xF6', '\xCF', '\x3B', '\x97', + '\x52', '\x1D', '\x91', '\x3F', '\xF9', '\x1E', '\xB4', '\x02', + '\x4D', '\x15', '\x34', '\x31', '\x65', '\x0F', '\xBA', '\x73', + '\xAB', '\xFA', '\x53', '\xBF', '\x2A', '\xFC', '\x3A', '\xD9', + '\xFF', '\x73', '\xA3', '\x87', '\x94', '\x6B', '\x6B', '\x5E', + '\x4F', '\x4F', '\x35', '\xFD', '\x6E', '\x74', '\x7E', '\x8C', + '\x6A', '\xFA', '\xCB', '\xE6', '\xC6', '\x7B', '\xD0', '\x55', + '\x9C', '\x1E', '\xFD', '\xF4', '\xB8', '\xF5', '\xF5', '\x87', + '\xCE', '\x86', '\x51', '\xEA', '\x0F', '\x45', '\x1C', '\x78', + '\x34', '\xAB', '\x5F', '\xDA', '\xFF', '\xEA', '\xEA', '\xD7', + '\xEC', '\xCD', '\x7E', '\x1F', '\xFA', '\x3E', '\xD4', '\x67', + '\x39', '\x46', '\x19', '\xFD', '\x1A', '\x95', '\x55', '\xF5', + '\x8F', '\xCE', '\xB4', '\xF9', '\x8C', '\x5B', '\xDE', '\xF5', + '\xCD', '\xEF', '\x28', '\xD9', '\x73', '\xF8', '\x19', '\x45', + '\x8B', '\x16', '\x6D', '\x32', '\x8C', '\x3A', '\xAD', '\x46', + '\x19', '\x7B', '\x54', '\xB1', '\xB4', '\x19', '\x44', '\xFD', + '\x5C', '\x4E', '\xE1', '\x7B', '\x0C', '\x77', '\x57', '\xF1', + '\xEF', '\x47', '\xBE', '\xAF', '\xE6', '\x26', '\x52', '\xC7', + '\x97', '\xCF', '\x57', '\xA7', '\xBF', '\x89', '\x98', '\x78', + '\x6C', '\x5C', '\xCD', '\xE1', '\xEA', '\xA7', '\xF4', '\x8D', + '\x42', '\x3F', '\x3F', '\x76', '\x73', '\xFA', '\xF9', '\x3B', + '\x34', '\x9F', '\x01', '\xEE', '\x85', '\xE1', '\xEB', '\xC7', + '\x31', '\x43', '\xF9', '\xD2', '\x9A', '\x06', '\x7E', '\x9A', + '\xEA', '\xFA', '\x1E', '\x52', '\x37', '\x0C', '\x5F', '\x3F', + '\xFF', '\xAD', '\x46', '\xBF', '\xAD', '\x80', '\xFE', '\x26', + '\x4C', '\x42', '\x6A', '\xC7', '\x5F', '\xBF', '\xF4', '\x1C', + '\xEE', '\x9E', '\xAA', '\xFA', '\xEB', '\xEC', '\xFF', '\xB2', + '\x9E', '\x32', '\xFB', '\x73', '\x19', '\xFD', '\x5C', '\xF4', + '\x6A', '\xFB', '\x9F', '\x6F', '\x72', '\xA5', '\x74', '\x63', + '\x0C', '\xD7', '\xC2', '\x79', '\x4C', '\xB2', '\x7E', '\x5D', + '\x16', '\xE1', '\x8E', '\x88', '\x16', '\x2D', '\x1A', '\x77', + '\x5F', '\x9A', '\x2E', '\x9B', '\xF6', '\x0A', '\x44', '\xFD', + '\x51', '\x3F', '\xF7', '\x79', '\x3A', '\x2A', '\xE3', '\xDE', + '\x58', '\x8B', '\x7F', '\xA7', '\x43', '\x3F', '\xBE', '\x2B', + '\xD9', '\xFF', '\x4F', '\xAF', '\xFE', '\xE9', '\xD9', '\x17', + '\xA6', '\x45', '\x27', '\x67', '\x51', '\xFF', '\xF4', '\xEA', + '\x8F', '\xF7', '\xDF', '\x68', '\xD1', '\xA2', '\x45', '\x8B', + '\x16', '\x2D', '\x5A', '\xB4', '\xE9', '\xB1', '\xFF', '\x01', + '\xF1', '\xAA', '\xBA', '\x4E', '\x18', '\x89', '\x00', '\x00' + }; diff --git a/src/win32/resource.h b/src/win32/resource.h index c272cf1c..50254a01 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -1,812 +1,812 @@ -//{{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 IDC_DEFAULTS 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 IDS_WRONG_GAMESHARK_CODE 42 -#define IDS_UNSUPPORTED_GAMESHARK_CODE 43 -#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_GAME_OVERRIDES 156 -#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_M2 1027 -#define IDS_DISABLING_EMULATION_ONLY 1027 -#define IDC_GBROM_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_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_ROM_CHECKSUM 1091 -#define IDC_2X 1091 -#define IDS_SELECT_CHEAT_LIST_NAME 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_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 IDC_VIEWER 1140 -#define IDC_ADDRESSES 1141 -#define IDC_GO 1143 -#define IDC_8_BIT 1144 -#define IDC_16_BIT 1145 -#define IDC_32_BIT 1146 -#define IDC_OAM_VIEW 1147 -#define IDC_OAM_VIEW_ZOOM 1148 -#define IDC_SPRITE 1150 -#define IDC_POS 1151 -#define IDC_MODE 1152 -#define IDC_COLORS 1153 -#define IDC_MAPBASE 1153 -#define IDC_PALETTE 1154 -#define IDC_CHARBASE 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_AUTO_UPDATE 1204 -#define IDC_N 1210 -#define IDC_Z 1211 -#define IDC_C 1212 -#define IDC_V 1213 -#define IDC_F 1214 -#define IDC_I 1215 -#define IDC_T 1216 -#define IDC_PORT 1217 -#define IDC_VSCROLL 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_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_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_NAME 1254 -#define IDC_BIT_5 1255 -#define IDC_RTC 1255 -#define IDC_BIT_6 1256 -#define IDC_SAVE_TYPE 1256 -#define IDC_BIT_7 1257 -#define IDC_FLASH_SIZE 1257 -#define IDC_BIT_8 1258 -#define IDC_COMMENT 1258 -#define IDC_BIT_9 1259 -#define IDC_BIT_10 1260 -#define IDC_BIT_11 1261 -#define IDC_BIT_12 1262 -#define IDC_BIT_13 1263 -#define IDC_BIT_14 1264 -#define IDC_BIT_15 1265 -#define IDC_MIRRORING 1266 -#define IDC_LY 1267 -#define IDC_APPENDMODE 1268 -#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 40085 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_B 40086 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_L 40087 -#define ID_OPTIONS_JOYPAD_AUTOFIRE_R 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_EMULATOR_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_MEMORYVIEWER 40143 -#define ID_TOOLS_OAMVIEWER 40144 -#define ID_TOOLS_CUSTOMIZE 40145 -#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_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_50 40217 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_150 40218 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_200 40219 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_25 40220 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER 40221 -#define ID_OPTIONS_FRAMESKIP_THROTTLE_100 40222 -#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_TOOLS_IOVIEWER 40266 -#define ID_FILE_LOADGAME_MOSTRECENT 40267 -#define ID_FILE_SAVEGAME_OLDESTSLOT 40268 -#define ID_FILE_LOADGAME_AUTOLOADMOSTRECENT 40269 -#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_HQ2X 40274 -#define ID_OPTIONS_FILTER_LQ2X 40275 -#define ID_OPTIONS_EMULATOR_GAMEOVERRIDES 40276 -#define ID_HELP_GNUPUBLICLICENSE 40277 -#define ID_OPTIONS_EMULATOR_GENERICFLASHCARD 40279 -#define ID_OPTIONS_SOUND_HARDWAREACCELERATION 40281 -#define ID_OPTIONS_VIDEO_FULLSCREEN1024X768 40282 -#define ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 40283 -#define ID_OPTIONS_FILTER_SIMPLE3X 40287 -#define ID_OPTIONS_FILTER_SIMPLE4X 40288 -#define ID_OPTIONS_FILTER_HQ3X 40290 -#define ID_OPTIONS_FILTER_HQ4X 40291 -#define ID_VIDEO_WINDOWED 40292 -#define ID_VIDEO_FULL 40293 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE 40294 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR 40295 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297 -#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298 -#define ID_OPTIONS_FILTER_LCDCOLORS 40299 -#define IDD_LINKTAB1 40300 -#define IDD_LINKTAB 40301 -#define IDD_LINKTAB2 40302 -#define IDD_LINKTAB3 40303 -#define IDD_SERVERWAIT 40304 -#define IDC_TAB1 40305 -#define IDC_LINK_SINGLE 40306 -#define IDC_LINK_TIMEOUT 40307 -#define IDC_LINK_LAN 40308 -#define IDC_LINK2P 40309 -#define IDC_LINKTCP 40310 -#define IDC_SSPEED 40311 -#define IDC_SERVERSTART 40312 -#define IDC_SERVERIP 40313 -#define IDC_CLINKIP 40314 -#define IDC_SPEEDOFF 40315 -#define IDC_LINKCONNECT 40316 -#define ID_OPTIONS_LINK_OPTIONS 40318 -#define ID_OPTIONS_LINK_LOG 40319 -#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320 -#define IDC_LINKTIMEOUT 40321 -#define IDC_CLINKTCP 40322 -#define IDC_SERVERWAIT 40323 -#define IDC_LINKUDP 40324 -#define IDC_LINK3P 40325 -#define IDC_LINK4P 40326 -#define IDC_CLINKUDP 40327 -#define IDC_SPEEDON 40328 -#define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40331 -#define ID_Menu 40332 -#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLANISOTROPIC 40333 -#define ID_OPTIONS_LINK_ENABLE 40335 -#define ID_RENDERAPI_VERTEX 40336 -#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS 40337 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 159 -#define _APS_NEXT_COMMAND_VALUE 40338 -#define _APS_NEXT_CONTROL_VALUE 1269 -#define _APS_NEXT_SYMED_VALUE 103 -#endif -#endif +//{{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 IDC_DEFAULTS 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 IDS_WRONG_GAMESHARK_CODE 42 +#define IDS_UNSUPPORTED_GAMESHARK_CODE 43 +#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_GAME_OVERRIDES 156 +#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_M2 1027 +#define IDS_DISABLING_EMULATION_ONLY 1027 +#define IDC_GBROM_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_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_ROM_CHECKSUM 1091 +#define IDC_2X 1091 +#define IDS_SELECT_CHEAT_LIST_NAME 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_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 IDC_VIEWER 1140 +#define IDC_ADDRESSES 1141 +#define IDC_GO 1143 +#define IDC_8_BIT 1144 +#define IDC_16_BIT 1145 +#define IDC_32_BIT 1146 +#define IDC_OAM_VIEW 1147 +#define IDC_OAM_VIEW_ZOOM 1148 +#define IDC_SPRITE 1150 +#define IDC_POS 1151 +#define IDC_MODE 1152 +#define IDC_COLORS 1153 +#define IDC_MAPBASE 1153 +#define IDC_PALETTE 1154 +#define IDC_CHARBASE 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_AUTO_UPDATE 1204 +#define IDC_N 1210 +#define IDC_Z 1211 +#define IDC_C 1212 +#define IDC_V 1213 +#define IDC_F 1214 +#define IDC_I 1215 +#define IDC_T 1216 +#define IDC_PORT 1217 +#define IDC_VSCROLL 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_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_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_NAME 1254 +#define IDC_BIT_5 1255 +#define IDC_RTC 1255 +#define IDC_BIT_6 1256 +#define IDC_SAVE_TYPE 1256 +#define IDC_BIT_7 1257 +#define IDC_FLASH_SIZE 1257 +#define IDC_BIT_8 1258 +#define IDC_COMMENT 1258 +#define IDC_BIT_9 1259 +#define IDC_BIT_10 1260 +#define IDC_BIT_11 1261 +#define IDC_BIT_12 1262 +#define IDC_BIT_13 1263 +#define IDC_BIT_14 1264 +#define IDC_BIT_15 1265 +#define IDC_MIRRORING 1266 +#define IDC_LY 1267 +#define IDC_APPENDMODE 1268 +#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 40085 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_B 40086 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_L 40087 +#define ID_OPTIONS_JOYPAD_AUTOFIRE_R 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_EMULATOR_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_MEMORYVIEWER 40143 +#define ID_TOOLS_OAMVIEWER 40144 +#define ID_TOOLS_CUSTOMIZE 40145 +#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_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_50 40217 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_150 40218 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_200 40219 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_25 40220 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER 40221 +#define ID_OPTIONS_FRAMESKIP_THROTTLE_100 40222 +#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_TOOLS_IOVIEWER 40266 +#define ID_FILE_LOADGAME_MOSTRECENT 40267 +#define ID_FILE_SAVEGAME_OLDESTSLOT 40268 +#define ID_FILE_LOADGAME_AUTOLOADMOSTRECENT 40269 +#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_HQ2X 40274 +#define ID_OPTIONS_FILTER_LQ2X 40275 +#define ID_OPTIONS_EMULATOR_GAMEOVERRIDES 40276 +#define ID_HELP_GNUPUBLICLICENSE 40277 +#define ID_OPTIONS_EMULATOR_GENERICFLASHCARD 40279 +#define ID_OPTIONS_SOUND_HARDWAREACCELERATION 40281 +#define ID_OPTIONS_VIDEO_FULLSCREEN1024X768 40282 +#define ID_OPTIONS_VIDEO_FULLSCREEN1280X1024 40283 +#define ID_OPTIONS_FILTER_SIMPLE3X 40287 +#define ID_OPTIONS_FILTER_SIMPLE4X 40288 +#define ID_OPTIONS_FILTER_HQ3X 40290 +#define ID_OPTIONS_FILTER_HQ4X 40291 +#define ID_VIDEO_WINDOWED 40292 +#define ID_VIDEO_FULL 40293 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_NONE 40294 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LINEAR 40295 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297 +#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298 +#define ID_OPTIONS_FILTER_LCDCOLORS 40299 +#define IDD_LINKTAB1 40300 +#define IDD_LINKTAB 40301 +#define IDD_LINKTAB2 40302 +#define IDD_LINKTAB3 40303 +#define IDD_SERVERWAIT 40304 +#define IDC_TAB1 40305 +#define IDC_LINK_SINGLE 40306 +#define IDC_LINK_TIMEOUT 40307 +#define IDC_LINK_LAN 40308 +#define IDC_LINK2P 40309 +#define IDC_LINKTCP 40310 +#define IDC_SSPEED 40311 +#define IDC_SERVERSTART 40312 +#define IDC_SERVERIP 40313 +#define IDC_CLINKIP 40314 +#define IDC_SPEEDOFF 40315 +#define IDC_LINKCONNECT 40316 +#define ID_OPTIONS_LINK_OPTIONS 40318 +#define ID_OPTIONS_LINK_LOG 40319 +#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320 +#define IDC_LINKTIMEOUT 40321 +#define IDC_CLINKTCP 40322 +#define IDC_SERVERWAIT 40323 +#define IDC_LINKUDP 40324 +#define IDC_LINK3P 40325 +#define IDC_LINK4P 40326 +#define IDC_CLINKUDP 40327 +#define IDC_SPEEDON 40328 +#define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40331 +#define ID_Menu 40332 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLANISOTROPIC 40333 +#define ID_OPTIONS_LINK_ENABLE 40335 +#define ID_RENDERAPI_VERTEX 40336 +#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS 40337 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 40338 +#define _APS_NEXT_CONTROL_VALUE 1269 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/src/win32/skin.cpp b/src/win32/skin.cpp index b123c1d3..b9bce233 100644 --- a/src/win32/skin.cpp +++ b/src/win32/skin.cpp @@ -64,7 +64,7 @@ HBITMAP CSkin::LoadImage(const char *filename) if(!image.IsValid()) { return NULL; } - + return image.MakeBitmap(NULL); } @@ -75,10 +75,10 @@ bool CSkin::Initialize(const char *skinFile) { // try to retrieve the skin data from resource. bool res = GetSkinData(skinFile); - if(!res) + if(!res) systemMessage(0, m_error); return res; -} +} // ---------------------------------------------------------------------------- // destroy skin resources and free allocated resources @@ -99,7 +99,7 @@ void CSkin::Destroy() // free skin region if (m_rgnSkin) { DeleteObject(m_rgnSkin); m_rgnSkin = NULL; } - + } @@ -160,12 +160,12 @@ bool CSkin::Hook(CWnd *pWnd) m_iWidth, m_iHeight, FALSE); - + pWnd->SetMenu(NULL); - + if(m_rgnSkin != NULL) // set the skin region to the window - pWnd->SetWindowRgn(m_rgnSkin, true); + pWnd->SetWindowRgn(m_rgnSkin, true); // subclass the window procedure m_OldWndProc = (WNDPROC)SetWindowLongPtr( m_hWnd, GWLP_WNDPROC, (LONG_PTR)SkinWndProc ); @@ -178,7 +178,7 @@ bool CSkin::Hook(CWnd *pWnd) return false; } - + // update flag m_bHooked = ( m_OldWndProc ? true : false ); @@ -187,9 +187,9 @@ bool CSkin::Hook(CWnd *pWnd) 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); + RedrawWindow(NULL,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); // successful return if we're hooked. return m_bHooked; @@ -208,7 +208,7 @@ bool CSkin::UnHook() // 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); @@ -228,16 +228,16 @@ bool CSkin::UnHook() 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); + RedrawWindow(NULL,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); // successful return if we're unhooked. return !m_bHooked; @@ -320,7 +320,7 @@ HRGN CSkin::LoadRegion(const char *rgn) // ------------------------------------------------- FILE *f = fopen(rgn, "rb"); if(!f) return NULL; - + fseek(f, 0, SEEK_END); int size = ftell(f); LPRGNDATA pSkinData = (LPRGNDATA)malloc(size); @@ -330,17 +330,17 @@ HRGN CSkin::LoadRegion(const char *rgn) } 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; } @@ -369,7 +369,7 @@ bool CSkin::GetSkinData(const char *skinFile) m_error = "Missing draw rectangle"; return false; } - + if(!ParseRect(buffer, m_rect)) { m_error = "Invalid draw rectangle"; return false; @@ -384,7 +384,7 @@ bool CSkin::GetSkinData(const char *skinFile) return false; } } - + CString path = skinFile; int index = path.ReverseFind('\\'); if(index != -1) { @@ -449,12 +449,12 @@ bool CSkin::ReadButton(const char *skinFile, int num) } 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); @@ -468,7 +468,7 @@ bool CSkin::ReadButton(const char *skinFile, int num) m_error = "Missing button down bitmap " + name; return false; } - + CString downBmp = path + buffer; bmp = LoadImage(downBmp); @@ -493,7 +493,7 @@ bool CSkin::ReadButton(const char *skinFile, int num) if(GetPrivateProfileString(name, "region", "", buffer, 2048, skinFile)) { CString region = path + buffer; - + HRGN rgn = LoadRegion(region); if(!rgn) { m_error = "Error loading button region " + region; @@ -512,7 +512,7 @@ bool CSkin::ReadButton(const char *skinFile, int num) m_error = "Missing button rectangle for " + name; return false; } - + RECT r; if(!ParseRect(buffer, r)) { m_error = "Invalid button rectangle for " + name; diff --git a/src/win32/skin.h b/src/win32/skin.h index f8301e5a..17dcd275 100644 --- a/src/win32/skin.h +++ b/src/win32/skin.h @@ -61,7 +61,7 @@ class CSkin // tell the class if it has a window subclassed. bool m_bHooked; - + // skin retrieval helper bool GetSkinData(const char *skin); @@ -94,7 +94,7 @@ class CSkin // ---------------------------------------------------------------------------- bool Initialize(const char *); - + // ---------------------------------------------------------------------------- // destroy skin resources and free allocated resources // ---------------------------------------------------------------------------- diff --git a/src/win32/skinButton.cpp b/src/win32/skinButton.cpp index f2525f5b..12ffe324 100644 --- a/src/win32/skinButton.cpp +++ b/src/win32/skinButton.cpp @@ -87,12 +87,12 @@ BEGIN_MESSAGE_MAP(SkinButton, CWnd) ///////////////////////////////////////////////////////////////////////////// // SkinButton message handlers -BOOL SkinButton::OnEraseBkgnd(CDC* pDC) +BOOL SkinButton::OnEraseBkgnd(CDC* pDC) { return TRUE; } -void SkinButton::OnPaint() +void SkinButton::OnPaint() { PAINTSTRUCT ps; HDC hDC = ::BeginPaint(m_hWnd, &ps); @@ -204,7 +204,7 @@ LRESULT SkinButton::OnMouseMoveMsg(WPARAM wParam, LPARAM lParam) return Default(); } -void SkinButton::OnKillFocus(CWnd* pNewWnd) +void SkinButton::OnKillFocus(CWnd* pNewWnd) { mouseOver = false; Invalidate(); @@ -212,13 +212,13 @@ void SkinButton::OnKillFocus(CWnd* pNewWnd) CWnd::OnKillFocus(pNewWnd); } -void SkinButton::OnCaptureChanged(CWnd *pWnd) +void SkinButton::OnCaptureChanged(CWnd *pWnd) { if(mouseOver) { ReleaseCapture(); Invalidate(); } - + CWnd::OnCaptureChanged(pWnd); } @@ -233,7 +233,7 @@ LRESULT SkinButton::OnMouseLeaveMsg(WPARAM wParam, LPARAM lParam) return Default(); } -void SkinButton::OnContextMenu(CWnd* pWnd, CPoint point) +void SkinButton::OnContextMenu(CWnd* pWnd, CPoint point) { } @@ -318,7 +318,7 @@ void SkinButton::GetRect(RECT& r) r = rect; } -BOOL SkinButton::CreateButton(const char *name, DWORD style, const RECT& r, +BOOL SkinButton::CreateButton(const char *name, DWORD style, const RECT& r, CWnd *parent, UINT id) { return CWnd::Create("BUTTON", diff --git a/src/win32/vba.rc2 b/src/win32/vba.rc2 index fb1f82a9..18c9e265 100644 --- a/src/win32/vba.rc2 +++ b/src/win32/vba.rc2 @@ -1,56 +1,56 @@ -#ifndef _MAC -#include "../AutoBuild.h" - -#if _MSC_VER >= 1400 -// use modern icon -IDI_ICON ICON DISCARDABLE "vbavista.ico" -#else -// use traditional icon -IDI_ICON ICON DISCARDABLE "gbadvance.ico" -#endif - - - -///////////////////////////////////////////////////////////////////////////// -// -// 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", "https://vbam.bountysource.com/\0" - VALUE "FileDescription", "VBA-M : VisualBoyAdvance emulator\0" - VALUE "FileVersion", STRFILEVER - VALUE "InternalName", "VisualBoyAdvance\0" - VALUE "LegalCopyright", "Copyright © 2006 VBA development team\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "VisualBoyAdvance.exe\0" - VALUE "PrivateBuild", "0\0" - VALUE "ProductName", "VBA-M - Modified VisualBoyAdvance\0" - VALUE "ProductVersion", STRPRODUCTVER - VALUE "SpecialBuild", "0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC +#ifndef _MAC +#include "../AutoBuild.h" + +#if _MSC_VER >= 1400 +// use modern icon +IDI_ICON ICON DISCARDABLE "vbavista.ico" +#else +// use traditional icon +IDI_ICON ICON DISCARDABLE "gbadvance.ico" +#endif + + + +///////////////////////////////////////////////////////////////////////////// +// +// 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", "https://vbam.bountysource.com/\0" + VALUE "FileDescription", "VBA-M : VisualBoyAdvance emulator\0" + VALUE "FileVersion", STRFILEVER + VALUE "InternalName", "VisualBoyAdvance\0" + VALUE "LegalCopyright", "Copyright © 2006 VBA development team\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "VisualBoyAdvance.exe\0" + VALUE "PrivateBuild", "0\0" + VALUE "ProductName", "VBA-M - Modified VisualBoyAdvance\0" + VALUE "ProductVersion", STRPRODUCTVER + VALUE "SpecialBuild", "0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC