r2572 <- r2574,r2578-r2579,r2581,r2592-r2595,r2601,r2603-r2604,r2619,r2624-r2625,r2628-r2631,r2633,r2635-r2639,r2641-r2643,r2646-r2647,r2651-r2652,r2665-r2666(r2668),r2674,r2676,r2679(-single_core things),r2681(GPU_osd.cpp only),r2685,r2692,r2703,r2711-r2712,r2725-r2726,r2730,r2745,r2756-r2759, some other sugars and salts a little (Win VS2008)

This commit is contained in:
gocha 2009-08-16 04:50:47 +00:00
parent eb2b400ea8
commit d566ea3fc7
1219 changed files with 116502 additions and 116472 deletions

View File

@ -15,7 +15,6 @@ adelikat
matusz
pa__
gocha
nitsuja
Contributors
------------
@ -41,3 +40,4 @@ Thanks to our super testers for this release
nash679
pokefan999
dottorleo
lbalbalba

View File

@ -1,457 +1,426 @@
0.9.4 -> ??? (r2437-r???)
??? introduces an entirely rewritten main emulation loop.
This totally changes the timing, and totally breaks old savestates.
Highlights:
* win32: lua engine, path configuration, 7z dearchiving support
* rewritten main emulation loop
General/Core:
bug: fix cflash directory support for non-windows
bug: fix freeze in cart irq
bug: correctly emulate dma to/from tcm
bug: fix in thumb LSR carryflag
enh: add guitar grip emulation
enh: add more powerful antigrain-based drawing library and rewrite OSD system
enh: ideas-style debugging prints
Graphics:
bug: fixing of obj blending, bmp obj rendering, and some obj window cases
bug: fix backdrop blending with garbage
bug: fix 256B granularity sprite addressing for sub gpu
bug: fix 128-wide captures
bug: fix color overflow in capture blending
bug: fix disp fifo capture
bug: fix simultaneous vram display and capture via same bank
bug: fix 3d overflow acknowledge registers
bug: change 3d cores to use 18bit color
bug: swrast: add clear image and scroll emulation
bug: swrast: add fog emulation
bug: swrast: fixes to shadow rendering
Windows:
bug: improve map view tool to support more modes
enh: added 2x resizing filters (hq2x, 2xsai, supereagle, scanlines)
enh: soundview can now mute channels
enh: multicore optimization for filters, rotation, OSD
Linux:
enh: alsa microphone support
enh: hud and osd notification for gtk and cli frontends
0.9.2 -> 0.9.4 (r1844->r2352->r2437)
0.9.3 was skipped due to emu news sites sneaking it out of our staging area and
releasing it prematurely while it still had bugs. I was going to curse them
individually, but then I decided that they would just like the publicity.
Highlights:
* New save autodetection and save file format
* Full rerecording support
General/Core:
bug: fix many 64 bit and endian issues
bug: fix mic input, which was nearly useless before
bug: fix failures of large dmas
bug: fix in ipc sync which broke devkitpro touch
bug: screenshots now exclude hud and rotation
bug: rewritten vram mapping (fixes corrupted or missing BG)
enh: add universal commandline system (same commandline options on every port)
enh: cheats: added Action Replay code parser
enh: more reliable and useful frameskipping
enh: SPU: speedup: add adpcm caching
enh: SPU: speedup: interpolation is now optional
enh: print svn build number so we can identify people's svn builds from screenshots
Graphics:
bug: add polygon y-sorting (fixes 3d guis)
bug: fix texcoordgen mode 3; fixes some ortho sprites and some entirely broken games
bug: display capture fixes
bug: fix a number of OBJ modes
bug: fixes to affine BG modes
bug: better emulate some translucent OBJ
bug: more correct handling of color effect windows and backdrop colors
bug: fix matrix stack overrun which crashed emulator
bug: swrast: add clear depth image emulation and other fixes to depth buffering
bug: swrast: fix some toon and highlight cases
bug: fix bug in matrix stack, fixes some broken models
enh: add alternate flush mode HACK 3d config toggle, fixes some entirely broken 3d games
Windows:
bug: more robust cheats engine and dialog
enh: more solid avi and wav recording
enh: improved tools: memory viewer
enh: added tools: spu viewer, ram watch, ram search
enh: change build configuration system
enh: speedup: add gpu core disabling to hide useless screens
enh: add background pause feature (for when emulator loses focus)
enh: add missing autohold for L and R
enh: add chinese translation
Gtk frontend:
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
enh: remove the gtglext 3d code
enh: improve/speedup screen resize and final presentation logic in gtk frontend
enh: minimal rerecording hookups
Cli frontend:
enh: hooked the frameskip (szigor)
enh: misc usability improvements: auto pause switch for pausing when focus is lost and exit on escape pressing (szigor)
enh: hook the fake noise mic; use m to toggle
0.9.1 -> 0.9.2
General/Core:
bug: fix error in SBCS/RSCS flags; fixes many odd behaviors and crashes [zeromus]
bug: add support for sleep mode and power registers [luigi__]
bug: important fixes to RTC so correct time is actually told [luigi__]
bug: fix card reads below 0x8000; fixes some game freezes [normatt]
bug: fix 4 mbit save type; fix non-autodetect savefile dumping [zeromus, matusz]
enh: add sram to GBA game addon emulation for importing savefiles [zeromus]
enh: many improvements and feature hookups in linux ports [matusz, luigi__]
Graphics:
bug: fix specular texture mapping mode [luigi__]
bug: repairs to some capture modes and vram mapping [zeromus, CrazyMax]
bug: viewports finally correctly handled [zeromus]
enh: add software rasterizer. quirky, but on par with opengl [zeromus]
Windows:
bug: mitigate bad frameskipper; default to old frameskipping mode [zeromus]
bug: fixes with recent roms and zipfile loading [zeromus]
bug: fix window position memory [zeromus]
enh: bios and firmware may now be used and booted [luigi__]
enh: many display, OSD, and input enhancements [luigi__]
enh: brand new hotkey and controls binding system [zeromus]
enh: configurable screen separation [luigi__]
enh: fast forward key [pa__]
enh: improvements to mic [luigi__]
enh: faster updates in debug tools, up to once per frame [pa__]
Mac OS X Port:
enh: added Italian translation thanks to Paolo Bernini [jeff]
enh: resurrection of GDB stub [sigmaris]
0.9 -> 0.9.1
General/Core:
enh: GBA slot emulation [CrazyMax]
- Rumble support (windows only)
- GBA game
enh: Mic support (windows only?) [luigi__]
enh: Preliminary cheats system [CrazyMax]
enh: Savestates invalidated, as more variables have been added.
bug: Added PSG white noise [luigi__]
bug: fix arm/thumb ROR [zeromus]
bug: [ 2550645 ] Super Princess Peach: crash when starting a puzzle [zeromus]
bug: win32: fix spu wav file writer (regression from 0.8) [zeromus,luigi__]
bug: Much work on FIFOs, still not finished [CrazyMax]
bug: Many fixes to dma [zeromus, CrazyMax]
bug: bios WaitForVblank and WaitForInterrupt fixed [luigi__]
Graphics:
bug: Added sprite blending [luigi__]
bug: more correct mosaic effects, still imperfect [zeromus]
bug: Many fixes to tile rendering; all graphics tests now pass [luigi__]
bug: fix crashes in some affine BG [zeromus]
bug: Implement some pos test function [luigi__]
bug: fix texture mapping across texture and palette banks and to unmapped banks [zeromus]
bug: fix texture handling for texels with MSB set (fixes some texture corruption) [zeromus]
bug: fix texture coordinate generation, including environment mapping [zeromus]
bug: texture cache invalidates when palettes change, prevents some texture corruption [zeromus]
bug: fix display capturing from 2d+3d source when display mode is display-vram [zeromus]
bug: [ 2488334 ].1 fixes to layer compositing [luigi__]
bug: [ 2488334 ].3 fix bug in support for hdma affine bg parameters [zeromus]
bug: Improvements to 3d h-scrolling [luigi__]
bug: Fix some errors in rendering 512 tall BG [zeromus,CrazyMax] (still not fully resolved)
bug: Add optional fragment shading pipeline (more precision) [luigi__]
bug: Fix bug where some sprites got cut of on x=255 [zeromus]
bug: Implement GXSTAT register [CrazyMax]
Windows:
bug: resizing and rotating work in vista [luigi__]
enh: 0 frameskip now lets emulator run at excess speed [zeromus]
Mac OS X Port:
bug: left key setting no longer gets confused with the right key [jeff]
enh: more keys can be mapped
0.8 -> 0.9
There have been so many changes that this list can hardly be considered complete.
For this release, we have formatted the list into a high level overview of big changes and bad bugs relative to the previous release. Hopefully what you're interested in.
This list does not include items which are solely performance boosts, for let us just say that virtually every system has been speeded up.
* The savestate system is totally changed and incompatible with old savestates.
* The 3d system should be considered rewritten.
General/Core:
enh: Convert to c++
enh: Add functions for a lid open/close. Holding key (default "Backspace" in Windows port) while game is freeze/non freeze. [CrazyMax]
enh: Add secure area decryption from ndstool [zeromus]
enh: Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
The savestate format is changed, but from now on it is in principle more resilient
(though it will continue to break as we tinker with the internals) [zeromus]
enh: Added SSE2 optimizations for matrices. Since we now make an SSE2 build, more optimizations can be made. [CrazyMax]
enh: Add a preliminary GUI hud system [CrazyMax,zeromus]
CPU/MMU:
bug: Many fixes in IPC and GE FIFOs. Fixes freezes in NSMB, dsracing, and others. [CrazyMax,luigi__,shash]
bug: Fix ARM instructions SBC and RSC (likewise SBC in thumb) [normatt]
bug: Fixed Thumb LDMIA (fixes ingame Dead'n'Furious) [shash]
bug: Fix repeating DMA (fixes NSMB parallax BG) [zeromus]
bug: Proper handling for unaligned CPU accesses [luigi__]
bug: Proper handling for undefined instruction exceptions [Salva Peiró]
bug: correctly return vram control register values (fixes homebrew 3d games) [zeromus]
enh: Remove 16MB of WRAM at 0x01****** from arm9. Mapped to unused instead. Nobody knows what this was. [zeromus]
enh: Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
Hardware:
bug: Newer and better sqrt and div emulation; makes SM64DS playable [luigi__,shash,zeromus]
bug: Add preliminary RTC implementations [CrazyMax]
enh: Add cosine interpolation in the SPU (conditionally compiled) [zeromus,luigi__]
enh: Experimental: always one silent non-mixing SPU core at 44.1khz synched with emu, for more precision.
The audible core runs with the host, causing music to slow down but not tear or pitch bend. [zeromus]
Graphics:
- Overhaul 3d:
. Move entire GE to core emu.
. Move OpenGL renderer to emu core for optional use by platforms, removing ogl_collector. Now every platform shares the same 3d code.
. Reorganize 3d code to defer rendering to after 3d vblank. Eliminates tearing, and texturing artifacts. [zeromus]
. Add optional fragment shading pipeline (more precision) [luigi__]
. Move lighting model to software instead of using opengl's fixed function model [zeromus]
. Render shadow volumes; toon shading and highlight table [zeromus, luigi__]
. Added texture caching! big speed up. [CrazyMax]
bug: Many assorted tweaks and improvements to 3d and 2d precision [zeromus,CrazyMax,luigi__]
bug: Fixes to GE: command unpacking, projection and pos-vector mode matrix handling, mult and load commands [zeromus]
bug: Fix a bug in texture transformation mode 1 [zeromus]
bug: Fixed GPU rendering bugs in sprites and BG [CrazyMax]
bug: Fixes to texture conversion [CrazyMax,zeromus]
bug: Fixes in capture display (no blinking in many games with dual 3D) [CrazyMax]
bug: Fixes in master brightness (this fixes some games with black screens) [CrazyMax]
bug: Fixes in screen, backdrop, and sprite blending [luigi__]
bug: Changed clear depths and how depth initial values are calculated (fixes SM64DS skybox, Castlevania) [shash,lugi__]
bug: Add 3d layer h-scrolling [zeromus]
bug: Added transparency and fixed material alpha support and alpha testing on the 3D core [shash]
bug: Rewrite VRAM mapping control and rendering (more accurate) [CrazyMax,luigi__]
bug: convert colors to opengl better to prevent alpha=31 polys from being ever so slightly transparent [zeromus]
enh: Add MMU->GPU signal for when vram mappings change to function as a texture cache invalidate signal [zeromus]
enh: Make matrix 4x4 multiply routines use W-coordinate; carry w coord through pipeline [zeromus]
Mac OS X port:
bug: Fixed: Filenames and paths with unicode characters now work. [Jeff]
bug: Fixed: Load state from file button works again. [Jeff]
enh: Save State panel now pauses emulation while the file selection box is open. [Jeff]
bug: Fixed: Frozen video output (and/or messed 3d emulation) after loading a state. [Jeff]
bug: Added option to load the most recent file upon launching the program. [Jeff]
enh: Added French translation (thanks to Pierre Rudloff). [Jeff]
enh: Added basic key mapping configuration to application preferences (thanks to Julio GorgŽ). [Jeff]
enh: Added keyboard shortcuts for Execute, Pause and Reset command (thanks to Julio GorgŽ). [Jeff]
enh: Default key mappings are no longer case sensitive. [Jeff]
enh: Added ability to limit speed. [Jeff]
enh: Fixed: Video output should work on software-only 3D renderers. [Jeff]
Windows port:
bug: Fix a race condition in NDS_3D_Reset and NDS_glInit [zeromus]
bug: Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
bug: Fix resizing, rotate & aspect ration of main window. [CrazyMax,_zeromus]
bug: Remove multithreading from user interface after finding several synchronization issues [zeromus]
enh: recent roms menu [luigi_]
enh: Changed graphics render core to DirectDraw (work faster) [CrazyMax]
enh: Add an arm9 cpu load average calculator similar to no$. but I dont think it works right. [zeromus]
enh: Rewrite all debug tools (autoupdate works now) [CrazyMax]
enh: Rewrite input core & replace config input dialog [CrazyMax]
enh: Add AVI output [zeromus]
enh: Add pause toggle and frame advance hotkeys [adelikat]
enh: Add frame counter display and hud messages framework [adelikat]
enh: Main window remembers position, size, and a few other emu preferences [adelikat]
enh: Removed directx sdk dependency for easier building. [zeromus]
enh: Savestate doesnt unpause emu if it is already paused [adelikat]
0.7.3 -> 0.8
Cocoa:
- Save State As function now works. [Jeff B]
- Recent Items menu now works. [Jeff B]
- Opening NDS files from Finder now works. [Jeff B]
- Added screenshot feature. [Jeff B]
- Added preferences. [Jeff B]
- Many more strings are translatable now. [Jeff B]
- Default screen color is black (better represents being "off" and easier on eyes at night). [Jeff B]
- Added sound. [Jeff B]
- Now is a universal binary. [Jeff B]
- Leopard resolution icon added. [Jeff B]
- Added a Japanese translation. [Jeff B]
- Added an optional status bar (resize handle no longer overlaps screen). [Jeff B]
- New ROM Info and About DeSmuME windows have been added. [Jeff B]
- Fixed several bugs in window resizing. [Jeff B]
- Added FAT image support for homebrew games (thanks to TypeError). [Jeff B]
- Key config can be changed on the command line. Save/load hotkeys changed (so expose doesn't override). [Jeff B]
- Key bindings may work better on non-US keyboards now (needs testing). [Jeff B]
general:
- Encapsulate GDB debug stub to avoid certain problems [shash]
- Fixed CPU LD*/ST* bugs [shash]
- Fixed New SMB mini-games freeze [shash]
- Fixed possible segfault in ROMReader on ia64 and amd64. [evilynux]
- Fixed a crash bug with 2D background corrupting memory [shash]
- Flag check optimization [carlo_bramini]
- Applied some endian fixes in GPU (thanks to Phazz) [Jeff B]
gtk-glade:
- Added DeSmuME version in about dialog. [evilynux]
- Updated website url in about dialog. [evilynux]
- Added Brazilian Portuguese translation by Dreampeppers99. [evilynux]
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
gtk:
- Updated website url in about dialog. [evilynux]
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
windows port:
- Added an "about" box [shash]
- DirectInput control interface with joystick support [CrazyMax]
- Matrix and Light viewer [Acid Burn]
0.7.2 -> 0.7.3
gtk-glade:
- Full localization using intltool/gettext. [evilynux]
general:
- Added a README.TRANSLATION documenting the localization process. [evilynux]
MacOS X:
- Initial version of the Mac interface added. [Jeff B]
0.7.1 -> 0.7.2
spu:
- big endian fixes. [cyberwarriorx]
gpu:
- big endian fixes. [marcus_c]
gtk-glade:
- opengl improvements. [masscat]
general:
- Added support for setting NDS firmware language value. [masscat]
- Function added for setting firmware language. [masscat]
- Mac/msys compilation fixes. [cyberwarriorx]
- Fix compilation when pkg-config macros are not available [evilynux]
0.7.0 -> 0.7.1
general:
- Added GDB debugger stub [masscat]
- Added new/different GBAMP CFlash image reader/writer [masscat]
gpu:
- Major speedup to the 2D core [shash]
gtk-glade:
- Added command line options. [masscat]
- Added FPS limiter [masscat]
cli:
- Added command line options. [masscat]
- Added FPS limiter [masscat]
- Added option to use OpenGl to render window (allows resizing). [masscat]
windows port:
- Added command line options. [masscat]
- Added multiple language support [cyberwarriorx]
- Added Danish language translation [thomas-2007]
0.6.0 -> 0.7.0
general:
- Added support for *.duc files [cyberwarriorx]
gpu:
- Added support for sprite rotation/scaling [shash]
- Added support for the 3D core (openGL and null plugins) [shash]
windows port:
- A bunch of fixes [Dmitry Krutskih]
- Fixed a bug in sound that was causing it to still not work for some
people [cyberwarriorx]
gtk:
- Added 3D emulation
- Added command line options.
- Added option to use OpenGL to render window (allows resizing).
gtk-glade:
- Added 3D emulation
0.5.0 -> 0.6.0
general:
- Added zipped (based on zziplib) and gzipped (based on zlib) rom support.
arm:
- Added relocation interrupt vector.
- Added region access right checks.
- Enabled LDC/STC instructions.
- Fixed powersave (cp15) IRQ wait.
- Fixed MOV instructions
gpu:
- Added special color effects.
- Added windowing feature.
- Fixed transparent direct color backgrounds.
- Fixed disabled sprites showing.
- Fixed 8/32 bit access to gpu registers.
- Fixed missing backgrounds
- Support for master brightness
wifi:
- Added RF chip interface.
- Added BB chip interface.
windows port:
- Fixed address calculation in disassembler.
- Added Force Maintain Ratio option for window stretching
linux port (cli, gtk and gtk-glade):
all:
- Added joystick support.
- Fixed X and Y buttons.
gtk-glade:
- Added joystick configuration.
- Improved I/O registers viewer tool.
- Added save and load states support.
0.3.3 -> 0.5.0
arm:
- Fixed MSR with immediate value opcode.
- Fixed LSR_0 thumb opcode (C flag is correctly set now).
- Fixed LDR*/STR* opcodes.
- Fixed unaligned memory access on THUMB Core.
- Added relocating SWI routines.
bios:
- Added decompression functions.
- Added GetPitchTable function.
- Added GetVolumeTable function.
- Added GetCRC16 function.
- Added experimental SoundBias function.
- Added GetSineTable function.
cart:
- Added CompactFlash/FAT emulation.
- Added Get ROM chip ID Cartridge command.
gpu:
- Added framebuffer emulation.
- Fixed a bug in GPU (xfin could be greater than LG causing a segfault).
- Added support for Display Mode 0(Display Off).
- Added the basic framework for Display Mode 3(Display from Main RAM).
spu:
- Added sound emulation.
- Added sound core system.
- Added WAV write core.
- Added dummy core.
- Added Direct Sound core.
linux port:
- Added GTK+ GUI.
- Added command line interface.
- Added stylus and arm9 keypad support in CLI version.
- Added FPS display.
- Added basic frameskip.
windows port:
- Fixed a bug when displaying a ROM's information.
- Added key configuration.
- Removed the debug key.
- Added new experimental auto frameskip/frame limit code.
- Added sound settings dialog.
- Added a few menu options for accessing the website, forums, and for
submitting bugs.
general:
- Rewrote code in C.
- Fixed warnings.
- Used defines and typedef's to make things more portable and easier to
read.
- Added autotools stuff.
- Changes to logging system.
- Added screenshot function.
- Translated most french to english.
- Added savestate support.
- Added firmware reading support(needs work).
- Added Backup Memory support with autodetection.
- Fixed some endianess issues.
- Fixed things so Visual C++ can compile code.
- Added bsd support.
- Reworked ROM loading so you can load a different rom without any problems.
- Finished NDS_Reset. Now the emulation can be reset even while running.
0.9.4+
- [2468] port r2466 from trunk (permit osd on bottom screen, fix stylus input display)
- [2645] port some of small fixes from trunk:
disable autohold while playing a movie (r2624)
fix movie length (r2629)
keyrepeat improvement (r2641-2643)
- [2665]
fix nitsuja's desynch bugreports (SF 2827543)
fix desynch caused by spu_core forgetting to save a variable
0.9.2 -> 0.9.4 (r1844->r2352->r2437)
0.9.3 was skipped due to emu news sites sneaking it out of our staging area and
releasing it prematurely while it still had bugs. I was going to curse them
individually, but then I decided that they would just like the publicity.
Highlights:
* New save autodetection and save file format
* Full rerecording support
General/Core:
bug: fix many 64 bit and endian issues
bug: fix mic input, which was nearly useless before
bug: fix failures of large dmas
bug: fix in ipc sync which broke devkitpro touch
bug: screenshots now exclude hud and rotation
bug: rewritten vram mapping (fixes corrupted or missing BG)
enh: add universal commandline system (same commandline options on every port)
enh: cheats: added Action Replay code parser
enh: more reliable and useful frameskipping
enh: SPU: speedup: add adpcm caching
enh: SPU: speedup: interpolation is now optional
enh: print svn build number so we can identify people's svn builds from screenshots
Graphics:
bug: add polygon y-sorting (fixes 3d guis)
bug: fix texcoordgen mode 3; fixes some ortho sprites and some entirely broken games
bug: display capture fixes
bug: fix a number of OBJ modes
bug: fixes to affine BG modes
bug: better emulate some translucent OBJ
bug: more correct handling of color effect windows and backdrop colors
bug: fix matrix stack overrun which crashed emulator
bug: swrast: add clear depth image emulation and other fixes to depth buffering
bug: swrast: fix some toon and highlight cases
bug: fix bug in matrix stack, fixes some broken models
enh: add alternate flush mode HACK 3d config toggle, fixes some entirely broken 3d games
Windows:
bug: more robust cheats engine and dialog
enh: more solid avi and wav recording
enh: improved tools: memory viewer
enh: added tools: spu viewer, ram watch, ram search
enh: change build configuration system
enh: speedup: add gpu core disabling to hide useless screens
enh: add background pause feature (for when emulator loses focus)
enh: add missing autohold for L and R
enh: add chinese translation
Gtk frontend:
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
enh: remove the gtglext 3d code
enh: improve/speedup screen resize and final presentation logic in gtk frontend
enh: minimal rerecording hookups
Cli frontend:
enh: hooked the frameskip (szigor)
enh: misc usability improvements: auto pause switch for pausing when focus is lost and exit on escape pressing (szigor)
enh: hook the fake noise mic; use m to toggle
0.9.1 -> 0.9.2
General/Core:
bug: fix error in SBCS/RSCS flags; fixes many odd behaviors and crashes [zeromus]
bug: add support for sleep mode and power registers [luigi__]
bug: important fixes to RTC so correct time is actually told [luigi__]
bug: fix card reads below 0x8000; fixes some game freezes [normatt]
bug: fix 4 mbit save type; fix non-autodetect savefile dumping [zeromus, matusz]
enh: add sram to GBA game addon emulation for importing savefiles [zeromus]
enh: many improvements and feature hookups in linux ports [matusz, luigi__]
Graphics:
bug: fix specular texture mapping mode [luigi__]
bug: repairs to some capture modes and vram mapping [zeromus, CrazyMax]
bug: viewports finally correctly handled [zeromus]
enh: add software rasterizer. quirky, but on par with opengl [zeromus]
Windows:
bug: mitigate bad frameskipper; default to old frameskipping mode [zeromus]
bug: fixes with recent roms and zipfile loading [zeromus]
bug: fix window position memory [zeromus]
enh: bios and firmware may now be used and booted [luigi__]
enh: many display, OSD, and input enhancements [luigi__]
enh: brand new hotkey and controls binding system [zeromus]
enh: configurable screen separation [luigi__]
enh: fast forward key [pa__]
enh: improvements to mic [luigi__]
enh: faster updates in debug tools, up to once per frame [pa__]
Mac OS X Port:
enh: added Italian translation thanks to Paolo Bernini [jeff]
enh: resurrection of GDB stub [sigmaris]
0.9 -> 0.9.1
General/Core:
enh: GBA slot emulation [CrazyMax]
- Rumble support (windows only)
- GBA game
enh: Mic support (windows only?) [luigi__]
enh: Preliminary cheats system [CrazyMax]
enh: Savestates invalidated, as more variables have been added.
bug: Added PSG white noise [luigi__]
bug: fix arm/thumb ROR [zeromus]
bug: [ 2550645 ] Super Princess Peach: crash when starting a puzzle [zeromus]
bug: win32: fix spu wav file writer (regression from 0.8) [zeromus,luigi__]
bug: Much work on FIFOs, still not finished [CrazyMax]
bug: Many fixes to dma [zeromus, CrazyMax]
bug: bios WaitForVblank and WaitForInterrupt fixed [luigi__]
Graphics:
bug: Added sprite blending [luigi__]
bug: more correct mosaic effects, still imperfect [zeromus]
bug: Many fixes to tile rendering; all graphics tests now pass [luigi__]
bug: fix crashes in some affine BG [zeromus]
bug: Implement some pos test function [luigi__]
bug: fix texture mapping across texture and palette banks and to unmapped banks [zeromus]
bug: fix texture handling for texels with MSB set (fixes some texture corruption) [zeromus]
bug: fix texture coordinate generation, including environment mapping [zeromus]
bug: texture cache invalidates when palettes change, prevents some texture corruption [zeromus]
bug: fix display capturing from 2d+3d source when display mode is display-vram [zeromus]
bug: [ 2488334 ].1 fixes to layer compositing [luigi__]
bug: [ 2488334 ].3 fix bug in support for hdma affine bg parameters [zeromus]
bug: Improvements to 3d h-scrolling [luigi__]
bug: Fix some errors in rendering 512 tall BG [zeromus,CrazyMax] (still not fully resolved)
bug: Add optional fragment shading pipeline (more precision) [luigi__]
bug: Fix bug where some sprites got cut of on x=255 [zeromus]
bug: Implement GXSTAT register [CrazyMax]
Windows:
bug: resizing and rotating work in vista [luigi__]
enh: 0 frameskip now lets emulator run at excess speed [zeromus]
Mac OS X Port:
bug: left key setting no longer gets confused with the right key [jeff]
enh: more keys can be mapped
0.8 -> 0.9
There have been so many changes that this list can hardly be considered complete.
For this release, we have formatted the list into a high level overview of big changes and bad bugs relative to the previous release. Hopefully what you're interested in.
This list does not include items which are solely performance boosts, for let us just say that virtually every system has been speeded up.
* The savestate system is totally changed and incompatible with old savestates.
* The 3d system should be considered rewritten.
General/Core:
enh: Convert to c++
enh: Add functions for a lid open/close. Holding key (default "Backspace" in Windows port) while game is freeze/non freeze. [CrazyMax]
enh: Add secure area decryption from ndstool [zeromus]
enh: Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
The savestate format is changed, but from now on it is in principle more resilient
(though it will continue to break as we tinker with the internals) [zeromus]
enh: Added SSE2 optimizations for matrices. Since we now make an SSE2 build, more optimizations can be made. [CrazyMax]
enh: Add a preliminary GUI hud system [CrazyMax,zeromus]
CPU/MMU:
bug: Many fixes in IPC and GE FIFOs. Fixes freezes in NSMB, dsracing, and others. [CrazyMax,luigi__,shash]
bug: Fix ARM instructions SBC and RSC (likewise SBC in thumb) [normatt]
bug: Fixed Thumb LDMIA (fixes ingame Dead'n'Furious) [shash]
bug: Fix repeating DMA (fixes NSMB parallax BG) [zeromus]
bug: Proper handling for unaligned CPU accesses [luigi__]
bug: Proper handling for undefined instruction exceptions [Salva Peiró]
bug: correctly return vram control register values (fixes homebrew 3d games) [zeromus]
enh: Remove 16MB of WRAM at 0x01****** from arm9. Mapped to unused instead. Nobody knows what this was. [zeromus]
enh: Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
Hardware:
bug: Newer and better sqrt and div emulation; makes SM64DS playable [luigi__,shash,zeromus]
bug: Add preliminary RTC implementations [CrazyMax]
enh: Add cosine interpolation in the SPU (conditionally compiled) [zeromus,luigi__]
enh: Experimental: always one silent non-mixing SPU core at 44.1khz synched with emu, for more precision.
The audible core runs with the host, causing music to slow down but not tear or pitch bend. [zeromus]
Graphics:
- Overhaul 3d:
. Move entire GE to core emu.
. Move OpenGL renderer to emu core for optional use by platforms, removing ogl_collector. Now every platform shares the same 3d code.
. Reorganize 3d code to defer rendering to after 3d vblank. Eliminates tearing, and texturing artifacts. [zeromus]
. Add optional fragment shading pipeline (more precision) [luigi__]
. Move lighting model to software instead of using opengl's fixed function model [zeromus]
. Render shadow volumes; toon shading and highlight table [zeromus, luigi__]
. Added texture caching! big speed up. [CrazyMax]
bug: Many assorted tweaks and improvements to 3d and 2d precision [zeromus,CrazyMax,luigi__]
bug: Fixes to GE: command unpacking, projection and pos-vector mode matrix handling, mult and load commands [zeromus]
bug: Fix a bug in texture transformation mode 1 [zeromus]
bug: Fixed GPU rendering bugs in sprites and BG [CrazyMax]
bug: Fixes to texture conversion [CrazyMax,zeromus]
bug: Fixes in capture display (no blinking in many games with dual 3D) [CrazyMax]
bug: Fixes in master brightness (this fixes some games with black screens) [CrazyMax]
bug: Fixes in screen, backdrop, and sprite blending [luigi__]
bug: Changed clear depths and how depth initial values are calculated (fixes SM64DS skybox, Castlevania) [shash,lugi__]
bug: Add 3d layer h-scrolling [zeromus]
bug: Added transparency and fixed material alpha support and alpha testing on the 3D core [shash]
bug: Rewrite VRAM mapping control and rendering (more accurate) [CrazyMax,luigi__]
bug: convert colors to opengl better to prevent alpha=31 polys from being ever so slightly transparent [zeromus]
enh: Add MMU->GPU signal for when vram mappings change to function as a texture cache invalidate signal [zeromus]
enh: Make matrix 4x4 multiply routines use W-coordinate; carry w coord through pipeline [zeromus]
Mac OS X port:
bug: Fixed: Filenames and paths with unicode characters now work. [Jeff]
bug: Fixed: Load state from file button works again. [Jeff]
enh: Save State panel now pauses emulation while the file selection box is open. [Jeff]
bug: Fixed: Frozen video output (and/or messed 3d emulation) after loading a state. [Jeff]
bug: Added option to load the most recent file upon launching the program. [Jeff]
enh: Added French translation (thanks to Pierre Rudloff). [Jeff]
enh: Added basic key mapping configuration to application preferences (thanks to Julio GorgŽ). [Jeff]
enh: Added keyboard shortcuts for Execute, Pause and Reset command (thanks to Julio GorgŽ). [Jeff]
enh: Default key mappings are no longer case sensitive. [Jeff]
enh: Added ability to limit speed. [Jeff]
enh: Fixed: Video output should work on software-only 3D renderers. [Jeff]
Windows port:
bug: Fix a race condition in NDS_3D_Reset and NDS_glInit [zeromus]
bug: Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
bug: Fix resizing, rotate & aspect ration of main window. [CrazyMax,_zeromus]
bug: Remove multithreading from user interface after finding several synchronization issues [zeromus]
enh: recent roms menu [luigi_]
enh: Changed graphics render core to DirectDraw (work faster) [CrazyMax]
enh: Add an arm9 cpu load average calculator similar to no$. but I dont think it works right. [zeromus]
enh: Rewrite all debug tools (autoupdate works now) [CrazyMax]
enh: Rewrite input core & replace config input dialog [CrazyMax]
enh: Add AVI output [zeromus]
enh: Add pause toggle and frame advance hotkeys [adelikat]
enh: Add frame counter display and hud messages framework [adelikat]
enh: Main window remembers position, size, and a few other emu preferences [adelikat]
enh: Removed directx sdk dependency for easier building. [zeromus]
enh: Savestate doesnt unpause emu if it is already paused [adelikat]
0.7.3 -> 0.8
Cocoa:
- Save State As function now works. [Jeff B]
- Recent Items menu now works. [Jeff B]
- Opening NDS files from Finder now works. [Jeff B]
- Added screenshot feature. [Jeff B]
- Added preferences. [Jeff B]
- Many more strings are translatable now. [Jeff B]
- Default screen color is black (better represents being "off" and easier on eyes at night). [Jeff B]
- Added sound. [Jeff B]
- Now is a universal binary. [Jeff B]
- Leopard resolution icon added. [Jeff B]
- Added a Japanese translation. [Jeff B]
- Added an optional status bar (resize handle no longer overlaps screen). [Jeff B]
- New ROM Info and About DeSmuME windows have been added. [Jeff B]
- Fixed several bugs in window resizing. [Jeff B]
- Added FAT image support for homebrew games (thanks to TypeError). [Jeff B]
- Key config can be changed on the command line. Save/load hotkeys changed (so expose doesn't override). [Jeff B]
- Key bindings may work better on non-US keyboards now (needs testing). [Jeff B]
general:
- Encapsulate GDB debug stub to avoid certain problems [shash]
- Fixed CPU LD*/ST* bugs [shash]
- Fixed New SMB mini-games freeze [shash]
- Fixed possible segfault in ROMReader on ia64 and amd64. [evilynux]
- Fixed a crash bug with 2D background corrupting memory [shash]
- Flag check optimization [carlo_bramini]
- Applied some endian fixes in GPU (thanks to Phazz) [Jeff B]
gtk-glade:
- Added DeSmuME version in about dialog. [evilynux]
- Updated website url in about dialog. [evilynux]
- Added Brazilian Portuguese translation by Dreampeppers99. [evilynux]
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
gtk:
- Updated website url in about dialog. [evilynux]
- Better desktop menu entry following FreeDesktop specifications. [evilynux]
windows port:
- Added an "about" box [shash]
- DirectInput control interface with joystick support [CrazyMax]
- Matrix and Light viewer [Acid Burn]
0.7.2 -> 0.7.3
gtk-glade:
- Full localization using intltool/gettext. [evilynux]
general:
- Added a README.TRANSLATION documenting the localization process. [evilynux]
MacOS X:
- Initial version of the Mac interface added. [Jeff B]
0.7.1 -> 0.7.2
spu:
- big endian fixes. [cyberwarriorx]
gpu:
- big endian fixes. [marcus_c]
gtk-glade:
- opengl improvements. [masscat]
general:
- Added support for setting NDS firmware language value. [masscat]
- Function added for setting firmware language. [masscat]
- Mac/msys compilation fixes. [cyberwarriorx]
- Fix compilation when pkg-config macros are not available [evilynux]
0.7.0 -> 0.7.1
general:
- Added GDB debugger stub [masscat]
- Added new/different GBAMP CFlash image reader/writer [masscat]
gpu:
- Major speedup to the 2D core [shash]
gtk-glade:
- Added command line options. [masscat]
- Added FPS limiter [masscat]
cli:
- Added command line options. [masscat]
- Added FPS limiter [masscat]
- Added option to use OpenGl to render window (allows resizing). [masscat]
windows port:
- Added command line options. [masscat]
- Added multiple language support [cyberwarriorx]
- Added Danish language translation [thomas-2007]
0.6.0 -> 0.7.0
general:
- Added support for *.duc files [cyberwarriorx]
gpu:
- Added support for sprite rotation/scaling [shash]
- Added support for the 3D core (openGL and null plugins) [shash]
windows port:
- A bunch of fixes [Dmitry Krutskih]
- Fixed a bug in sound that was causing it to still not work for some
people [cyberwarriorx]
gtk:
- Added 3D emulation
- Added command line options.
- Added option to use OpenGL to render window (allows resizing).
gtk-glade:
- Added 3D emulation
0.5.0 -> 0.6.0
general:
- Added zipped (based on zziplib) and gzipped (based on zlib) rom support.
arm:
- Added relocation interrupt vector.
- Added region access right checks.
- Enabled LDC/STC instructions.
- Fixed powersave (cp15) IRQ wait.
- Fixed MOV instructions
gpu:
- Added special color effects.
- Added windowing feature.
- Fixed transparent direct color backgrounds.
- Fixed disabled sprites showing.
- Fixed 8/32 bit access to gpu registers.
- Fixed missing backgrounds
- Support for master brightness
wifi:
- Added RF chip interface.
- Added BB chip interface.
windows port:
- Fixed address calculation in disassembler.
- Added Force Maintain Ratio option for window stretching
linux port (cli, gtk and gtk-glade):
all:
- Added joystick support.
- Fixed X and Y buttons.
gtk-glade:
- Added joystick configuration.
- Improved I/O registers viewer tool.
- Added save and load states support.
0.3.3 -> 0.5.0
arm:
- Fixed MSR with immediate value opcode.
- Fixed LSR_0 thumb opcode (C flag is correctly set now).
- Fixed LDR*/STR* opcodes.
- Fixed unaligned memory access on THUMB Core.
- Added relocating SWI routines.
bios:
- Added decompression functions.
- Added GetPitchTable function.
- Added GetVolumeTable function.
- Added GetCRC16 function.
- Added experimental SoundBias function.
- Added GetSineTable function.
cart:
- Added CompactFlash/FAT emulation.
- Added Get ROM chip ID Cartridge command.
gpu:
- Added framebuffer emulation.
- Fixed a bug in GPU (xfin could be greater than LG causing a segfault).
- Added support for Display Mode 0(Display Off).
- Added the basic framework for Display Mode 3(Display from Main RAM).
spu:
- Added sound emulation.
- Added sound core system.
- Added WAV write core.
- Added dummy core.
- Added Direct Sound core.
linux port:
- Added GTK+ GUI.
- Added command line interface.
- Added stylus and arm9 keypad support in CLI version.
- Added FPS display.
- Added basic frameskip.
windows port:
- Fixed a bug when displaying a ROM's information.
- Added key configuration.
- Removed the debug key.
- Added new experimental auto frameskip/frame limit code.
- Added sound settings dialog.
- Added a few menu options for accessing the website, forums, and for
submitting bugs.
general:
- Rewrote code in C.
- Fixed warnings.
- Used defines and typedef's to make things more portable and easier to
read.
- Added autotools stuff.
- Changes to logging system.
- Added screenshot function.
- Translated most french to english.
- Added savestate support.
- Added firmware reading support(needs work).
- Added Backup Memory support with autodetection.
- Fixed some endianess issues.
- Fixed things so Visual C++ can compile code.
- Added bsd support.
- Reworked ROM loading so you can load a different rom without any problems.
- Finished NDS_Reset. Now the emulation can be reset even while running.

View File

View File

0
desmume/autogen.sh → autogen.sh Executable file → Normal file
View File

0
desmume/compile → compile Executable file → Normal file
View File

View File

@ -169,14 +169,10 @@ fi
AM_CONDITIONAL([HAVE_LIBAGG], [test "${HAVE_LIBAGG}" = "yes"])
if test "x$HAVE_LIBAGG" = "xyes"; then
AC_DEFINE([HAVE_LIBAGG])
else
AC_MSG_ERROR([Antigrain library is required to build desmume])
fi
dnl - depends on glib, reference pkg-config since it is needed for checking glib
if test "x$FOUND_GLIB" = "xno"; then
AC_MSG_ERROR([Glib and pkg-config are required to build desmume])
fi
dnl - set conditional for glib, needed to avoid commandline.cpp compilation for cli frontend since it depends on glib
AM_CONDITIONAL([HAVE_GLIB], [test "${FOUND_GLIB}" = "yes"])
dnl - If the gtkGLext package is available define the corresponding C macro
if test "x$HAVE_GTKGLEXT" = "xyes"; then
@ -277,8 +273,7 @@ if test "x[$]ENABLE_HARDCORE" = "x1"; then
dnl - only valid for C with newer gcc's
CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
fi
dnl - -Wshadow
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wshadow -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
fi
dnl - Enable debug mode

View File

@ -1,87 +0,0 @@
/*
FAT.H
Mic, 2006
Structures taken from Michael Chisholm's FAT library
*/
#ifndef __FAT_H__
#define __FAT_H__
#include "types.h"
#include "PACKED.h"
#include "PACKED_END.h"
#define ATTRIB_DIR 0x10
#define ATTRIB_LFN 0x0F
#define FILE_FREE 0xE5
/* Name and extension maximum length */
#define NAME_LEN 8
#define EXT_LEN 3
// Boot Sector - must be packed
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define DIR_SEP "\\"
#else
#define DIR_SEP "/"
#endif
#include "PACKED.h"
struct boot_record
{
u8 jmpBoot[3];
u8 OEMName[8];
// BIOS Parameter Block
u16 bytesPerSector;
u8 sectorsPerCluster;
u16 reservedSectors;
u8 numFATs;
u16 rootEntries;
u16 numSectorsSmall;
u8 mediaDesc;
u16 sectorsPerFAT;
u16 sectorsPerTrk;
u16 numHeads;
u32 numHiddenSectors;
u32 numSectors;
struct
{
// Ext BIOS Parameter Block for FAT16
u8 driveNumber;
u8 reserved1;
u8 extBootSig;
u32 volumeID;
u8 volumeLabel[11];
u8 fileSysType[8];
// Bootcode
u8 bootCode[448];
u16 signature;
} __PACKED fat16;
} __PACKED;
typedef struct boot_record BOOT_RECORD;
#include "PACKED_END.h"
// Directory entry - must be packed
#include "PACKED.h"
struct dir_ent
{
u8 name[NAME_LEN];
u8 ext[EXT_LEN];
u8 attrib;
u8 reserved;
u8 cTime_ms;
u16 cTime;
u16 cDate;
u16 aDate;
u16 startClusterHigh;
u16 mTime;
u16 mDate;
u16 startCluster;
u32 fileSize;
} __PACKED;
typedef struct dir_ent DIR_ENT;
#include "PACKED_END.h"
#endif //

View File

@ -1,317 +0,0 @@
/* Copyright (C) 2006-2007 shash
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MATRIX_H
#define MATRIX_H
#include <math.h>
#include <string.h>
#include "types.h"
#include "mem.h"
#ifdef ENABLE_SSE
#include <xmmintrin.h>
#endif
#ifdef ENABLE_SSE2
#include <emmintrin.h>
#endif
struct MatrixStack
{
MatrixStack(int size);
float *matrix;
int position;
int size;
};
void MatrixInit (float *matrix);
//In order to conditionally use these asm optimized functions in visual studio
//without having to make new build types to exclude the assembly files.
//a bit sloppy, but there aint much to it
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
void MatrixSet (float *matrix, int x, int y, float value);
void MatrixCopy (float * matrixDST, const float * matrixSRC);
int MatrixCompare (const float * matrixDST, const float * matrixSRC);
void MatrixIdentity (float *matrix);
void MatrixTranspose (float *matrix);
void MatrixStackInit (MatrixStack *stack);
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
void MatrixStackSetStackPosition (MatrixStack *stack, int pos);
void MatrixStackPushMatrix (MatrixStack *stack, const float *ptr);
float* MatrixStackPopMatrix (MatrixStack *stack, int size);
float* MatrixStackGetPos (MatrixStack *stack, int pos);
float* MatrixStackGet (MatrixStack *stack);
void MatrixStackLoadMatrix (MatrixStack *stack, int pos, const float *ptr);
void Vector2Copy(float *dst, const float *src);
void Vector2Add(float *dst, const float *src);
void Vector2Subtract(float *dst, const float *src);
float Vector2Dot(const float *a, const float *b);
float Vector2Cross(const float *a, const float *b);
float Vector3Dot(const float *a, const float *b);
void Vector3Cross(float* dst, const float *a, const float *b);
float Vector3Length(const float *a);
void Vector3Add(float *dst, const float *src);
void Vector3Subtract(float *dst, const float *src);
void Vector3Scale(float *dst, const float scale);
void Vector3Copy(float *dst, const float *src);
void Vector3Normalize(float *dst);
void Vector4Copy(float *dst, const float *src);
//these functions are an unreliable, inaccurate floor.
//it should only be used for positive numbers
//this isnt as fast as it could be if we used a visual c++ intrinsic, but those appear not to be universally available
FORCEINLINE u32 u32floor(float f)
{
#ifdef ENABLE_SSE2
return (u32)_mm_cvtt_ss2si(_mm_set_ss(f));
#else
return (u32)f;
#endif
}
FORCEINLINE u32 u32floor(double d)
{
#ifdef ENABLE_SSE2
return (u32)_mm_cvttsd_si32(_mm_set_sd(d));
#else
return (u32)d;
#endif
}
//same as above but works for negative values too.
//be sure that the results are the same thing as floorf!
FORCEINLINE s32 s32floor(float f)
{
#ifdef ENABLE_SSE2
return _mm_cvtss_si32( _mm_add_ss(_mm_set_ss(-0.5f),_mm_add_ss(_mm_set_ss(f), _mm_set_ss(f))) ) >> 1;
#else
return (s32)floorf(f);
#endif
}
//switched SSE2 functions
//-------------
#ifdef ENABLE_SSE
template<int NUM>
FORCEINLINE void memset_u16_le(void* dst, u16 val)
{
u32 u32val;
//just for the endian safety
T1WriteWord((u8*)&u32val,0,val);
T1WriteWord((u8*)&u32val,2,val);
////const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
__m128 temp; temp.m128_i32[0] = u32val;
//MACRODO_N(NUM/8,_mm_store_si128((__m128i*)((u8*)dst+(X)*16), temp));
MACRODO_N(NUM/8,_mm_store_ps1((float*)((u8*)dst+(X)*16), temp));
}
#else //no sse2
template<int NUM>
static FORCEINLINE void memset_u16_le(void* dst, u16 val)
{
for(int i=0;i<NUM;i++)
T1WriteWord((u8*)dst,i<<1,val);
}
#endif
//---------------------------
//switched SSE functions
#ifdef ENABLE_SSE
struct SSE_MATRIX
{
SSE_MATRIX(const float *matrix)
: row0(_mm_load_ps(matrix))
, row1(_mm_load_ps(matrix+4))
, row2(_mm_load_ps(matrix+8))
, row3(_mm_load_ps(matrix+12))
{}
union {
__m128 rows[4];
struct { __m128 row0; __m128 row1; __m128 row2; __m128 row3; };
};
};
FORCEINLINE __m128 _util_MatrixMultVec4x4_(const SSE_MATRIX &mat, __m128 vec)
{
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
__m128 xmm7 = _mm_shuffle_ps(vec, vec, B8(11111111));
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
xmm4 = _mm_mul_ps(xmm4,mat.row0);
xmm5 = _mm_mul_ps(xmm5,mat.row1);
xmm6 = _mm_mul_ps(xmm6,mat.row2);
xmm7 = _mm_mul_ps(xmm7,mat.row3);
xmm4 = _mm_add_ps(xmm4,xmm5);
xmm4 = _mm_add_ps(xmm4,xmm6);
xmm4 = _mm_add_ps(xmm4,xmm7);
return xmm4;
}
FORCEINLINE void MatrixMultiply(float * matrix, const float * rightMatrix)
{
//this seems to generate larger code, including many movaps, but maybe it is less harsh on the registers than the
//more hand-tailored approach
__m128 row0 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix));
__m128 row1 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+4));
__m128 row2 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+8));
__m128 row3 = _util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(rightMatrix+12));
_mm_store_ps(matrix,row0);
_mm_store_ps(matrix+4,row1);
_mm_store_ps(matrix+8,row2);
_mm_store_ps(matrix+12,row3);
}
FORCEINLINE void MatrixMultVec4x4(const float *matrix, float *vecPtr)
{
_mm_store_ps(vecPtr,_util_MatrixMultVec4x4_((SSE_MATRIX)matrix,_mm_load_ps(vecPtr)));
}
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
{
//there are hardly any gains from merging these manually
MatrixMultVec4x4(matrix+16,vecPtr);
MatrixMultVec4x4(matrix,vecPtr);
}
FORCEINLINE void MatrixMultVec3x3(const float * matrix, float * vecPtr)
{
const __m128 vec = _mm_load_ps(vecPtr);
__m128 xmm5 = _mm_shuffle_ps(vec, vec, B8(01010101));
__m128 xmm6 = _mm_shuffle_ps(vec, vec, B8(10101010));
__m128 xmm4 = _mm_shuffle_ps(vec, vec, B8(00000000));
const SSE_MATRIX mat(matrix);
xmm4 = _mm_mul_ps(xmm4,mat.row0);
xmm5 = _mm_mul_ps(xmm5,mat.row1);
xmm6 = _mm_mul_ps(xmm6,mat.row2);
xmm4 = _mm_add_ps(xmm4,xmm5);
xmm4 = _mm_add_ps(xmm4,xmm6);
_mm_store_ps(vecPtr,xmm4);
}
FORCEINLINE void MatrixTranslate(float *matrix, const float *ptr)
{
__m128 xmm4 = _mm_load_ps(ptr);
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
xmm4 = _mm_add_ps(xmm4,xmm5);
xmm4 = _mm_add_ps(xmm4,xmm6);
xmm4 = _mm_add_ps(xmm4,_mm_load_ps(matrix+12));
_mm_store_ps(matrix+12,xmm4);
}
FORCEINLINE void MatrixScale(float *matrix, const float *ptr)
{
__m128 xmm4 = _mm_load_ps(ptr);
__m128 xmm5 = _mm_shuffle_ps(xmm4, xmm4, B8(01010101));
__m128 xmm6 = _mm_shuffle_ps(xmm4, xmm4, B8(10101010));
xmm4 = _mm_shuffle_ps(xmm4, xmm4, B8(00000000));
xmm4 = _mm_mul_ps(xmm4,_mm_load_ps(matrix));
xmm5 = _mm_mul_ps(xmm5,_mm_load_ps(matrix+4));
xmm6 = _mm_mul_ps(xmm6,_mm_load_ps(matrix+8));
_mm_store_ps(matrix,xmm4);
_mm_store_ps(matrix+4,xmm5);
_mm_store_ps(matrix+8,xmm6);
}
template<int NUM_ROWS>
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
{
CTASSERT(NUM_ROWS==3 || NUM_ROWS==4);
const __m128 val = _mm_set_ps1(divisor);
_mm_store_ps(matrix,_mm_div_ps(_mm_load_ps(matrix),val));
_mm_store_ps(matrix+4,_mm_div_ps(_mm_load_ps(matrix+4),val));
_mm_store_ps(matrix+8,_mm_div_ps(_mm_load_ps(matrix+8),val));
if(NUM_ROWS==4)
_mm_store_ps(matrix+12,_mm_div_ps(_mm_load_ps(matrix+12),val));
}
//WARNING: I do not think this is as fast as a memset, for some reason.
//at least in vc2005 with sse enabled. better figure out why before using it
template<int NUM>
static FORCEINLINE void memset_u8(void* _dst, u8 val)
{
memset(_dst,val,NUM);
//const u8* dst = (u8*)_dst;
//u32 u32val = (val<<24)|(val<<16)|(val<<8)|val;
//const __m128i temp = _mm_set_epi32(u32val,u32val,u32val,u32val);
//MACRODO_N(NUM/16,_mm_store_si128((__m128i*)(dst+(X)*16), temp));
}
#else //no sse
void MatrixMultVec4x4 (const float *matrix, float *vecPtr);
void MatrixMultVec3x3(const float * matrix, float * vecPtr);
void MatrixMultiply(float * matrix, const float * rightMatrix);
void MatrixTranslate(float *matrix, const float *ptr);
void MatrixScale(float * matrix, const float * ptr);
FORCEINLINE void MatrixMultVec4x4_M2(const float *matrix, float *vecPtr)
{
//there are hardly any gains from merging these manually
MatrixMultVec4x4(matrix+16,vecPtr);
MatrixMultVec4x4(matrix,vecPtr);
}
template<int NUM_ROWS>
FORCEINLINE void vector_fix2float(float* matrix, const float divisor)
{
for(int i=0;i<NUM_ROWS*4;i++)
matrix[i] /= divisor;
}
template<int NUM>
static FORCEINLINE void memset_u8(void* dst, u8 val)
{
memset(dst,val,NUM);
}
#endif //switched SSE functions
#endif

View File

@ -1,314 +0,0 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapView.h"
#include "resource.h"
#include <commctrl.h>
#include "../MMU.h"
#include "../NDSSystem.h"
#include "debug.h"
#include "windriver.h"
using namespace GPU_EXT;
struct mapview_struct
{
u32 autoup_secs;
bool autoup;
u8 map;
u16 lcd;
u16 bitmap[1024*1024];
bool clear;
void render()
{
//we're going to make a copy of the gpu so that we don't wreck affine scroll params
//hopefully we won't mess up anything else
GPU *realGpu;
if(lcd) realGpu = SubScreen.gpu;
else realGpu = MainScreen.gpu;
GPU &gpu = *realGpu;
//forgive the gyrations, some of this junk in here is to remind us of gyrations we might have to go
//through to avoid breaking the gpu struct
gpu.currBgNum = map;
gpu.debug = true;
for(u32 i = 0; i < gpu.BGSize[map][1]; ++i)
{
gpu.currDst = (u8 *)bitmap + i*gpu.BGSize[map][0]*2;
gpu.currLine = i;
gpu.modeRender<false>(map);
}
gpu.debug = false;
}
};
mapview_struct *MapView = NULL;
LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM lParam)
{
Lock lock;
HDC hdc;
PAINTSTRUCT ps;
char text[80];
u32 dispcnt = ((volatile u32 *)MMU.ARM9_REG)[(win->lcd*0x400)];
u32 bgcnt = ((volatile u16 *)MMU.ARM9_REG)[(8 + (win->map<<1) + (win->lcd*0x1000))>>1];
BITMAPV4HEADER bmi;
u16 lg;
u16 ht;
BGxPARMS * parms;
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
bmi.bV4BitCount = 16;
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
bmi.bV4RedMask = 0x001F;
bmi.bV4GreenMask = 0x03E0;
bmi.bV4BlueMask = 0x7C00;
if(win->lcd)
{
lg = SubScreen.gpu->BGSize[win->map][0];
ht = SubScreen.gpu->BGSize[win->map][1];
}
else
{
lg = MainScreen.gpu->BGSize[win->map][0];
ht = MainScreen.gpu->BGSize[win->map][1];
}
bmi.bV4Width = lg;
bmi.bV4Height = -ht;
hdc = BeginPaint(hwnd, &ps);
sprintf(text, "%d %08X, %08X", (int)(dispcnt&7), (int)dispcnt, (int)bgcnt);
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
if(!(bgcnt&(1<<7)))
sprintf(text, "normal 16");
else
{
if(!(dispcnt&(1<<30)))
sprintf(text, "normal 256");
else
{
switch(win->map)
{
case 0 :
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?2:0);
break;
case 1 :
sprintf(text, "extended slot %d", (bgcnt&(1<<13))?3:1);
break;
default :
sprintf(text, "extended slot %d", MainScreen.gpu->BGExtPalSlot[win->map]);
break;
}
}
}
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
sprintf(text, "%d", (int)(bgcnt&3));
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
if((dispcnt>>8>>win->map)&1)
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "true");
else
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "false");
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
sprintf(text, "0x%08X", (int)(0x6000000 + 0x800*((bgcnt>>8)&0x1F) + win->lcd*0x200000 + ((dispcnt>>27)&7)*0x10000));
SetWindowText(GetDlgItem(hwnd, IDC_SCR), text);
//sprintf(text, "%d x %d", MainScreen.gpu->BGPA[win->map], MainScreen.gpu->BGPB[win->map]);
sprintf(text, "%d x %d", (int)MainScreen.gpu->BGSize[win->map][0], (int)MainScreen.gpu->BGSize[win->map][1]);
SetWindowText(GetDlgItem(hwnd, IDC_MSIZE), text);
//if (win->map==2) {
// parms = &(MainScreen.gpu->dispx_st)->dispx_BG2PARMS;
//} else {
// parms = &(MainScreen.gpu->dispx_st)->dispx_BG3PARMS;
//}
//sprintf(text, "%d x %d", parms->BGxX, parms->BGxY);
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), "useless");
for(int i = 0; i < ARRAY_SIZE(win->bitmap); i++)
win->bitmap[i] = 0x7C1F;
win->render();
if(win->clear)
{
RECT r;
r.left = 200;
r.top = 4;
r.right = 200 + 1024;
r.bottom = 200 + 1024;
HBRUSH brush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
FillRect(hdc, &r, brush);
DeleteObject(brush);
win->clear = false;
}
SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
EndPaint(hwnd, &ps);
return 0;
}
BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
//bail out early if the dialog isnt initialized
if(!MapView && message != WM_INITDIALOG)
return false;
switch (message)
{
case WM_INITDIALOG :
{
MapView = new mapview_struct;
memset(MapView, 0, sizeof(MapView));
MapView->clear = true;
MapView->autoup_secs = 1;
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
UDM_SETRANGE, 0, MAKELONG(99, 1));
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
UDM_SETPOS32, 0, MapView->autoup_secs);
HWND combo = GetDlgItem(hwnd, IDC_BG_SELECT);
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 0");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 1");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 2");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main BackGround 3");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 0");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 1");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 2");
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub BackGround 3");
SendMessage(combo, CB_SETCURSEL, 0, 0);
}
return 1;
case WM_CLOSE :
{
if(MapView->autoup)
{
KillTimer(hwnd, IDT_VIEW_MAP);
MapView->autoup = false;
}
if (MapView!=NULL)
{
delete MapView;
MapView = NULL;
}
//INFO("Close Map view dialog\n");
PostQuitMessage(0);
return 0;
}
case WM_PAINT:
MapView_OnPaint(MapView, hwnd, wParam, lParam);
return 1;
case WM_TIMER:
SendMessage(hwnd, WM_COMMAND, IDC_REFRESH, 0);
return 1;
case WM_COMMAND :
switch (LOWORD (wParam))
{
case IDC_FERMER :
SendMessage(hwnd, WM_CLOSE, 0, 0);
return 1;
case IDC_AUTO_UPDATE :
if(MapView->autoup)
{
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), false);
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), false);
KillTimer(hwnd, IDT_VIEW_MAP);
MapView->autoup = FALSE;
return 1;
}
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SECS), true);
EnableWindow(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN), true);
MapView->autoup = TRUE;
SetTimer(hwnd, IDT_VIEW_MAP, MapView->autoup_secs*20, (TIMERPROC) NULL);
return 1;
case IDC_AUTO_UPDATE_SECS:
{
int t = GetDlgItemInt(hwnd, IDC_AUTO_UPDATE_SECS, FALSE, TRUE);
if (!MapView)
{
SendMessage(hwnd, WM_INITDIALOG, 0, 0);
}
if (t != MapView->autoup_secs)
{
MapView->autoup_secs = t;
if (MapView->autoup)
SetTimer(hwnd, IDT_VIEW_MAP,
MapView->autoup_secs*20, (TIMERPROC) NULL);
}
}
return 1;
case IDC_REFRESH:
InvalidateRect(hwnd, NULL, FALSE);
return 1;
case IDC_BG_SELECT :
switch(HIWORD(wParam))
{
case CBN_SELCHANGE :
case CBN_CLOSEUP :
{
u32 sel= SendMessage(GetDlgItem(hwnd, IDC_BG_SELECT), CB_GETCURSEL, 0, 0);
switch(sel)
{
case 0 :
case 1 :
case 2 :
case 3 :
MapView->map = sel;
MapView->lcd = 0;
break;
case 4 :
case 5 :
case 6 :
case 7 :
MapView->map = sel-4;
MapView->lcd = 1;
break;
}
}
MapView->clear = true;
InvalidateRect(hwnd, NULL, FALSE);
return 1;
}//switch et case
}//switch
return 1;
}
return false;
}

39
src/ARM9.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef ARM9_H
#define ARM9_H
#include "types.h"
struct ALIGN(16) ARM9_struct {
//ARM9 mem
u8 ARM9_ITCM[0x8000];
u8 ARM9_DTCM[0x4000];
u8 MAIN_MEM[0x800000]; //this has been expanded to 8MB to support debug consoles
u8 ARM9_REG[0x1000000];
u8 ARM9_BIOS[0x8000];
u8 ARM9_VMEM[0x800];
#include "PACKED.h"
struct {
u8 ARM9_LCD[0xA4000];
//an extra 128KB for blank memory, directly after arm9_lcd, so that
//we can easily map things to the end of arm9_lcd to represent
//an unmapped state
u8 blank_memory[0x20000];
};
#include "PACKED_END.h"
u8 ARM9_OAM[0x800];
u8* ExtPal[2][4];
u8* ObjExtPal[2][2];
struct TextureInfo {
u8* texPalSlot[6];
u8* textureSlotAddr[4];
} texInfo;
};
extern ARM9_struct ARM9Mem;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,32 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DISASSEMBLER_H
#define DISASSEMBLER_H
#include "types.h"
extern char * (* des_arm_instructions_set[4096])(u32 adr, u32 i, char * txt);
extern char * (* des_thumb_instructions_set[1024])(u32 adr, u32 i, char * txt);
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DISASSEMBLER_H
#define DISASSEMBLER_H
#include "types.h"
extern char * (* des_arm_instructions_set[4096])(u32 adr, u32 i, char * txt);
extern char * (* des_thumb_instructions_set[1024])(u32 adr, u32 i, char * txt);
#endif

View File

@ -1,375 +1,276 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2007 shash
Copyright 2007-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "FIFO.h"
#include <string.h>
#include "armcpu.h"
#include "debug.h"
#include "mem.h"
#include "MMU.h"
#include "NDSSystem.h"
// ========================================================= IPC FIFO
IPC_FIFO ipc_fifo[2]; // 0 - ARM9
// 1 - ARM7
u8 FORCEINLINE IPC_FIFOgetSize(u8 proc)
{
if (ipc_fifo[proc].head < ipc_fifo[proc].tail) return (ipc_fifo[proc].tail - ipc_fifo[proc].head);
if (ipc_fifo[proc].head > ipc_fifo[proc].tail) return (16 - (ipc_fifo[proc].head - ipc_fifo[proc].tail));
return 0;
}
void IPC_FIFOinit(u8 proc)
{
memset(&ipc_fifo[proc], 0, sizeof(IPC_FIFO));
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, 0x00000101);
}
void IPC_FIFOsend(u8 proc, u32 val)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
if (!(cnt_l & 0x8000)) return; // FIFO disabled
u8 proc_remote = proc ^ 1;
if (ipc_fifo[proc].size > 15)
{
cnt_l |= 0x4000;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
return;
}
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
//LOG("IPC%s send FIFO 0x%08X (l 0x%X, tail %02i) (r 0x%X, tail %02i)\n",
// proc?"7":"9", val, cnt_l, ipc_fifo[proc].tail, cnt_r, ipc_fifo[proc^1].tail);
cnt_l &= 0xBFFC; // clear send empty bit & full
cnt_r &= 0xBCFF; // set recv empty bit & full
ipc_fifo[proc].buf[ipc_fifo[proc].tail] = val;
ipc_fifo[proc].tail++;
ipc_fifo[proc].size = IPC_FIFOgetSize(proc);
if (ipc_fifo[proc].tail > 15) ipc_fifo[proc].tail = 0;
if (ipc_fifo[proc].size > 15)
{
cnt_l |= 0x0002; // set send full bit
cnt_r |= 0x0200; // set recv full bit
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
setIF(proc_remote, ((cnt_l & 0x0400)<<8)); // IRQ18: recv not empty
}
u32 IPC_FIFOrecv(u8 proc)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
if (!(cnt_l & 0x8000)) return (0); // FIFO disabled
u8 proc_remote = proc ^ 1;
u32 val = 0;
if ( ipc_fifo[proc_remote].size == 0 ) // remote FIFO error
{
cnt_l |= 0x4000;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
return (0);
}
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
cnt_l &= 0xBCFF; // clear send full bit & empty
cnt_r &= 0xBFFC; // set recv full bit & empty
val = ipc_fifo[proc_remote].buf[ipc_fifo[proc_remote].head];
ipc_fifo[proc_remote].head++;
ipc_fifo[proc_remote].size = IPC_FIFOgetSize(proc_remote);
if (ipc_fifo[proc_remote].head > 15) ipc_fifo[proc_remote].head = 0;
//LOG("IPC%s recv FIFO 0x%08X (l 0x%X, tail %02i) (r 0x%X, tail %02i)\n",
// proc?"7":"9", val, cnt_l, ipc_fifo[proc].tail, cnt_r, ipc_fifo[proc^1].tail);
if ( ipc_fifo[proc_remote].size == 0 ) // FIFO empty
{
cnt_l |= 0x0100;
cnt_r |= 0x0001;
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
setIF(proc_remote, ((cnt_l & 0x0004)<<15)); // IRQ17: send empty
return (val);
}
void IPC_FIFOcnt(u8 proc, u16 val)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);
//LOG("IPC%s FIFO context 0x%X (local 0x%04X, remote 0x%04X)\n", proc?"7":"9", val, cnt_l, cnt_r);
if (val & 0x4008)
{
ipc_fifo[proc].tail = 0;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);
T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0x8407) | 0x100);
//MMU.reg_IF[proc^1] |= ((val & 0x0004) << 15);
setIF(proc^1, ((val & 0x0004)<<15));
return;
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);
}
// ========================================================= GFX FIFO
GFX_PIPE gxPIPE;
GFX_FIFO gxFIFO;
void GFX_PIPEclear()
{
gxPIPE.head = 0;
gxPIPE.tail = 0;
gxPIPE.size = 0;
}
void GFX_FIFOclear()
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
gxstat &= 0x0000FFFF;
gxFIFO.head = 0;
gxFIFO.tail = 0;
gxFIFO.size = 0;
gxstat |= 0x06000000;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
}
void GFX_FIFOsend(u8 cmd, u32 param)
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
//INFO("gxFIFO: send 0x%02X = 0x%08X (size %03i/0x%02X) gxstat 0x%08X\n", cmd, param, gxFIFO.size, gxFIFO.size, gxstat);
gxstat &= 0xF000FFFF;
if (gxFIFO.size == 0) // FIFO empty
{
gxstat |= 0x06000000;
if (gxPIPE.size < 4) // pipe not full
{
gxPIPE.cmd[gxPIPE.tail] = cmd;
gxPIPE.param[gxPIPE.tail] = param;
gxPIPE.tail++;
gxPIPE.size++;
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
#ifdef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x08000000; // set busy flag
#endif
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
NDS_RescheduleGXFIFO();
return;
}
}
if (gxFIFO.size > 255)
{
#ifdef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x01000000; // full
gxstat |= 0x08000000; // busy
#else
gxstat |= 0x02000000; // this is hack (must be removed later)
#endif
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
NDS_RescheduleGXFIFO();
//INFO("ERROR: gxFIFO is full (cmd 0x%02X = 0x%08X) (prev cmd 0x%02X = 0x%08X)\n", cmd, param, gxFIFO.cmd[255], gxFIFO.param[255]);
return;
}
gxFIFO.cmd[gxFIFO.tail] = cmd;
gxFIFO.param[gxFIFO.tail] = param;
gxFIFO.tail++;
gxFIFO.size++;
if (gxFIFO.tail > 255) gxFIFO.tail = 0;
#ifdef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x08000000; // set busy flag
#endif
gxstat |= ((gxFIFO.size & 0x1FF) << 16);
if (gxFIFO.size < 128) // less half
{
gxstat |= 0x02000000;
}
#ifndef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x02000000; // this is hack (must be removed later)
#endif
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
NDS_RescheduleGXFIFO();
}
// this function used ONLY in gxFIFO
BOOL GFX_PIPErecv(u8 *cmd, u32 *param)
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
gxstat &= 0xF7FFFFFF; // clear busy flag
if (gxPIPE.size > 0)
{
*cmd = gxPIPE.cmd[gxPIPE.head];
*param = gxPIPE.param[gxPIPE.head];
gxPIPE.head++;
gxPIPE.size--;
if (gxPIPE.head > 3) gxPIPE.head = 0;
if (gxPIPE.size < 3)
{
if (gxFIFO.size > 0)
{
gxstat &= 0xF000FFFF;
gxPIPE.cmd[gxPIPE.tail] = gxFIFO.cmd[gxFIFO.head];
gxPIPE.param[gxPIPE.tail] = gxFIFO.param[gxFIFO.head];
gxPIPE.tail++;
gxPIPE.size++;
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
gxFIFO.head++;
gxFIFO.size--;
if (gxFIFO.head > 255) gxFIFO.head = 0;
if (gxFIFO.size > 0)
{
gxPIPE.cmd[gxPIPE.tail] = gxFIFO.cmd[gxFIFO.head];
gxPIPE.param[gxPIPE.tail] = gxFIFO.param[gxFIFO.head];
gxPIPE.tail++;
gxPIPE.size++;
if (gxPIPE.tail > 3) gxPIPE.tail = 0;
gxFIFO.head++;
gxFIFO.size--;
if (gxFIFO.head > 255) gxFIFO.head = 0;
}
gxstat |= ((gxFIFO.size & 0x1FF) << 16);
if (gxFIFO.size < 128)
{
gxstat |= 0x02000000;
if (gxstat & 0x40000000) // IRQ: less half
{
setIF(0, (1<<21));
}
execHardware_doAllDma(EDMAMode_GXFifo);
}
if (gxFIFO.size == 0) // empty
{
gxstat |= 0x04000000;
if (gxstat & 0x80000000) // IRQ: empty
setIF(0, (1<<21));
}
}
else // FIFO empty
{
gxstat &= 0xF000FFFF;
gxstat |= 0x06000000;
if (gxstat & 0x80000000) // IRQ: empty
setIF(0, (1<<21));
}
}
if (gxPIPE.size > 0)
gxstat |= 0x08000000; // set busy flag
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
return (TRUE);
}
if (gxstat & 0x80000000) // IRQ: empty
setIF(0, (1<<21));
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
return FALSE;
}
extern void gfx3d_ClearStack();
void GFX_FIFOcnt(u32 val)
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
//INFO("gxFIFO: write cnt 0x%08X (prev 0x%08X) FIFO size %03i PIPE size %03i\n", val, gxstat, gxFIFO.size, gxPIPE.size);
if (val & (1<<29)) // clear? (only in homebrew?)
{
GFX_PIPEclear();
GFX_FIFOclear();
return;
}
if (val & (1<<15)) // projection stack pointer reset
{
gfx3d_ClearStack();
val &= 0xFFFF5FFF; // clear reset (bit15) & stack level (bit13)
}
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, val);
if (gxFIFO.size == 0) // empty
{
if (val & 0x80000000) // IRQ: empty
setIF(0, (1<<21));
}
}
// ========================================================= DISP FIFO
DISP_FIFO disp_fifo;
void DISP_FIFOinit()
{
memset(&disp_fifo, 0, sizeof(DISP_FIFO));
}
void DISP_FIFOsend(u32 val)
{
//INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail);
disp_fifo.buf[disp_fifo.tail] = val;
disp_fifo.tail++;
if (disp_fifo.tail > 0x5FFF)
disp_fifo.tail = 0;
}
u32 DISP_FIFOrecv()
{
//if (disp_fifo.tail == disp_fifo.head) return (0); // FIFO is empty
u32 val = disp_fifo.buf[disp_fifo.head];
disp_fifo.head++;
if (disp_fifo.head > 0x5FFF)
disp_fifo.head = 0;
return (val);
}
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2007 shash
Copyright 2007-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "FIFO.h"
#include <string.h>
#include "armcpu.h"
#include "debug.h"
#include "mem.h"
#include "MMU.h"
// ========================================================= IPC FIFO
IPC_FIFO ipc_fifo[2]; // 0 - ARM9
// 1 - ARM7
void IPC_FIFOinit(u8 proc)
{
memset(&ipc_fifo[proc], 0, sizeof(IPC_FIFO));
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, 0x00000101);
}
void IPC_FIFOsend(u8 proc, u32 val)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
if (!(cnt_l & 0x8000)) return; // FIFO disabled
u8 proc_remote = proc ^ 1;
if (ipc_fifo[proc].tail > 15)
{
cnt_l |= 0x4000;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
return;
}
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
//LOG("IPC%s send FIFO 0x%08X (l 0x%X, tail %02i) (r 0x%X, tail %02i)\n",
// proc?"7":"9", val, cnt_l, ipc_fifo[proc].tail, cnt_r, ipc_fifo[proc^1].tail);
cnt_l &= 0xBFFC; // clear send empty bit & full
cnt_r &= 0xBCFF; // set recv empty bit & full
ipc_fifo[proc].buf[ipc_fifo[proc].tail++] = val;
if (ipc_fifo[proc].tail > 15)
{
cnt_l |= 0x0002; // set send full bit
cnt_r |= 0x0200; // set recv full bit
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
setIF(proc_remote, ((cnt_l & 0x0400)<<8));
}
u32 IPC_FIFOrecv(u8 proc)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
if (!(cnt_l & 0x8000)) return (0); // FIFO disabled
u8 proc_remote = proc ^ 1;
u32 val = 0;
if ( ipc_fifo[proc_remote].tail == 0 ) // remote FIFO error
{
cnt_l |= 0x4000;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
return (0);
}
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc_remote][0x40], 0x184);
cnt_l &= 0xBCFF; // clear send full bit & empty
cnt_r &= 0xBFFC; // set recv full bit & empty
val = ipc_fifo[proc_remote].buf[0];
//LOG("IPC%s recv FIFO 0x%08X (l 0x%X, tail %02i) (r 0x%X, tail %02i)\n",
// proc?"7":"9", val, cnt_l, ipc_fifo[proc].tail, cnt_r, ipc_fifo[proc^1].tail);
ipc_fifo[proc_remote].tail--;
for (int i = 0; i < ipc_fifo[proc_remote].tail; i++)
ipc_fifo[proc_remote].buf[i] = ipc_fifo[proc_remote].buf[i+1];;
if ( ipc_fifo[proc_remote].tail == 0 ) // FIFO empty
{
cnt_l |= 0x0100;
cnt_r |= 0x0001;
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, cnt_l);
T1WriteWord(MMU.MMU_MEM[proc_remote][0x40], 0x184, cnt_r);
setIF(proc_remote, ((cnt_l & 0x0004)<<15));
return (val);
}
void IPC_FIFOcnt(u8 proc, u16 val)
{
u16 cnt_l = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184);
u16 cnt_r = T1ReadWord(MMU.MMU_MEM[proc^1][0x40], 0x184);
//LOG("IPC%s FIFO context 0x%X (local 0x%04X, remote 0x%04X)\n", proc?"7":"9", val, cnt_l, cnt_r);
if (val & 0x4008)
{
ipc_fifo[proc].tail = 0;
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, (cnt_l & 0x0301) | (val & 0x8404) | 1);
T1WriteWord(MMU.MMU_MEM[proc^1][0x40], 0x184, (cnt_r & 0x8407) | 0x100);
//MMU.reg_IF[proc^1] |= ((val & 0x0004) << 15);
setIF(proc^1, ((val & 0x0004)<<15));
return;
}
T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x184, val);
}
// ========================================================= GFX FIFO
GFX_FIFO gxFIFO;
void GFX_FIFOclear()
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
gxstat &= 0x0000FFFF;
gxFIFO.tail = 0;
gxstat |= 0x06000000;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
}
void GFX_FIFOsend(u8 cmd, u32 param)
{
//INFO("GFX FIFO: Send GFX 3D cmd 0x%02X to FIFO - 0x%08X (%03i/%02X)\n", cmd, param, gxFIFO.tail, gxFIFO.tail);
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
if (gxstat & 0x01000000) return; // full
gxstat &= 0xF000FFFF;
gxFIFO.cmd[gxFIFO.tail] = cmd;
gxFIFO.param[gxFIFO.tail] = param;
gxFIFO.tail++;
#ifdef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x08000000; // set busy flag
#endif
gxstat |= (gxFIFO.tail << 16);
if (gxFIFO.tail < 128)
gxstat |= 0x02000000;
#ifndef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x02000000; // this is hack (must be removed later)
#endif
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
}
BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
#if 0
if (gxstat & 0xC0000000)
{
setIF(0, (1<<21));
}
#endif
if (gxFIFO.tail == 0) // empty
{
gxstat &= 0xF000FFFF;
gxstat |= 0x06000000;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
if ((gxstat & 0x80000000)) // empty
{
setIF(0, (1<<21));
}
return FALSE;
}
if (gxstat & 0x40000000) // IRQ: less half
{
if (gxstat & 0x02000000) setIF(0, (1<<21));
}
if ((gxstat & 0x80000000)) // IRQ: empty
{
if (gxstat & 0x04000000) setIF(0, (1<<21));
}
gxstat &= 0xF000FFFF;
*cmd = gxFIFO.cmd[0];
*param = gxFIFO.param[0];
gxFIFO.tail--;
for (int i=0; i < gxFIFO.tail; i++)
{
gxFIFO.cmd[i] = gxFIFO.cmd[i+1];
gxFIFO.param[i] = gxFIFO.param[i+1];
}
#ifdef USE_GEOMETRY_FIFO_EMULATION
gxstat |= 0x08000000; // set busy flag
#endif
gxstat |= (gxFIFO.tail << 16);
if (gxFIFO.tail < 128)
gxstat |= 0x02000000;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
return TRUE;
}
void GFX_FIFOcnt(u32 val)
{
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
//INFO("GFX FIFO: write context 0x%08X (prev 0x%08X) tail %i\n", val, gxstat, gxFIFO.tail);
if (val & (1<<29)) // clear? (homebrew)
{
GFX_FIFOclear();
return;
}
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
/*if (gxstat & 0xC0000000)
{
setIF(0, (1<<21));
}*/
}
// ========================================================= DISP FIFO
DISP_FIFO disp_fifo;
void DISP_FIFOinit()
{
memset(&disp_fifo, 0, sizeof(DISP_FIFO));
}
void DISP_FIFOsend(u32 val)
{
//INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail);
disp_fifo.buf[disp_fifo.tail] = val;
disp_fifo.tail++;
if (disp_fifo.tail > 0x5FFF)
disp_fifo.tail = 0;
}
u32 DISP_FIFOrecv()
{
//if (disp_fifo.tail == disp_fifo.head) return (0); // FIFO is empty
u32 val = disp_fifo.buf[disp_fifo.head];
disp_fifo.head++;
if (disp_fifo.head > 0x5FFF)
disp_fifo.head = 0;
return (val);
}

View File

@ -1,91 +1,75 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2007 shash
Copyright 2007-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FIFO_H
#define FIFO_H
//#define USE_GEOMETRY_FIFO_EMULATION //enable gxFIFO emulation
#include "types.h"
//=================================================== IPC FIFO
typedef struct
{
u32 buf[16];
u8 head;
u8 tail;
u8 size;
} IPC_FIFO;
extern IPC_FIFO ipc_fifo[2];
extern void IPC_FIFOinit(u8 proc);
extern void IPC_FIFOsend(u8 proc, u32 val);
extern u32 IPC_FIFOrecv(u8 proc);
extern void IPC_FIFOcnt(u8 proc, u16 val);
//=================================================== GFX FIFO
typedef struct
{
u8 cmd[256];
u32 param[256];
u16 head; // start position
u16 tail; // tail
u16 size; // size FIFO buffer
} GFX_FIFO;
typedef struct
{
u8 cmd[4];
u32 param[4];
u8 head;
u8 tail;
u8 size;
} GFX_PIPE;
extern GFX_PIPE gxPIPE;
extern GFX_FIFO gxFIFO;
extern void GFX_PIPEclear();
extern void GFX_FIFOclear();
extern void GFX_FIFOsend(u8 cmd, u32 param);
extern BOOL GFX_PIPErecv(u8 *cmd, u32 *param);
extern void GFX_FIFOcnt(u32 val);
//=================================================== Display memory FIFO
typedef struct
{
u32 buf[0x6000]; // 256x192 32K color
u32 head; // head
u32 tail; // tail
} DISP_FIFO;
extern DISP_FIFO disp_fifo;
extern void DISP_FIFOinit();
extern void DISP_FIFOsend(u32 val);
extern u32 DISP_FIFOrecv();
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2007 shash
Copyright 2007-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FIFO_H
#define FIFO_H
//#define USE_GEOMETRY_FIFO_EMULATION //enables new experimental gxFIFO
#include "types.h"
//=================================================== IPC FIFO
typedef struct
{
u32 buf[16];
u8 tail;
} IPC_FIFO;
extern IPC_FIFO ipc_fifo[2];
extern void IPC_FIFOinit(u8 proc);
extern void IPC_FIFOsend(u8 proc, u32 val);
extern u32 IPC_FIFOrecv(u8 proc);
extern void IPC_FIFOcnt(u8 proc, u16 val);
//=================================================== GFX FIFO
typedef struct
{
u8 cmd[261];
u32 param[261];
u16 tail; // tail
} GFX_FIFO;
extern GFX_FIFO gxFIFO;
extern void GFX_FIFOclear();
extern void GFX_FIFOsend(u8 cmd, u32 param);
extern BOOL GFX_FIFOrecv(u8 *cmd, u32 *param);
extern void GFX_FIFOcnt(u32 val);
//=================================================== Display memory FIFO
typedef struct
{
u32 buf[0x6000]; // 256x192 32K color
u32 head; // head
u32 tail; // tail
} DISP_FIFO;
extern DISP_FIFO disp_fifo;
extern void DISP_FIFOinit();
extern void DISP_FIFOsend(u32 val);
extern u32 DISP_FIFOrecv();
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,530 +1,450 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006-2008 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "GPU_osd.h"
#include "GPU.h"
#include "mem.h"
#include <string.h> //mem funcs
#include <stdarg.h> //va_start, etc
#include <sstream>
#include <stdio.h>
#include <time.h>
#include "debug.h"
#include "aggdraw.h"
#include "movie.h"
#include "NDSSystem.h"
#include "mic.h"
#include "saves.h"
#include "glib.h"
bool HudEditorMode = false;
OSDCLASS *osd = NULL;
HudStruct Hud;
//contains a timer to be used for well-timed hud components
static s64 hudTimer;
static void SetHudDummy (HudCoordinates *hud)
{
hud->x=666;
hud->y=666;
}
static bool IsHudDummy (HudCoordinates *hud)
{
return (hud->x == 666 && hud->y == 666);
}
void EditHud(s32 x, s32 y, HudStruct *hudstruct) {
u32 i = 0;
while (!IsHudDummy(&hudstruct->hud(i))) {
HudCoordinates &hud = hudstruct->hud(i);
//reset
if(!hud.clicked) {
hud.storedx=0;
hud.storedy=0;
}
if((x >= hud.x && x <= hud.x + hud.xsize) &&
(y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) {
hud.clicked=1;
hud.storedx = x - hud.x;
hud.storedy = y - hud.y;
}
if(hud.clicked) {
hud.x = x - hud.storedx;
hud.y = y - hud.storedy;
}
//sanity checks
if(hud.x < 0) hud.x = 0;
if(hud.y < 0) hud.y = 0;
if(hud.x > 245)hud.x = 245; //margins
if(hud.y > 384-16)hud.y = 384-16;
if(hud.clicked)
break;//prevent items from grouping together
i++;
}
}
void HudClickRelease(HudStruct *hudstruct) {
u32 i = 0;
while (!IsHudDummy(&hudstruct->hud(i))) {
HudCoordinates &hud = hudstruct->hud(i);
hud.clicked=0;
i++;
}
}
void HudStruct::reset()
{
FpsDisplay.x=0;
FpsDisplay.y=5;
FpsDisplay.xsize=120;
FpsDisplay.ysize=10;
FrameCounter.x=0;
FrameCounter.y=25;
FrameCounter.xsize=60;
FrameCounter.ysize=10;
InputDisplay.x=0;
InputDisplay.y=45;
InputDisplay.xsize=120;
InputDisplay.ysize=10;
GraphicalInputDisplay.x=8;
GraphicalInputDisplay.y=328;
GraphicalInputDisplay.xsize=100;
GraphicalInputDisplay.ysize=40;
LagFrameCounter.x=0;
LagFrameCounter.y=65;
LagFrameCounter.xsize=30;
LagFrameCounter.ysize=10;
Microphone.x=0;
Microphone.y=85;
Microphone.xsize=20;
Microphone.ysize=10;
SavestateSlots.x = 8;
SavestateSlots.y = 160;
SavestateSlots.xsize = 240;
SavestateSlots.ysize = 24;
SetHudDummy(&Dummy);
}
void joyFill(int n) {
if(nds.pad & (1 << n))
aggDraw.hud->fillColor(0,0,0,255);
else
aggDraw.hud->fillColor(255,255,255,255);
}
void joyEllipse(double ex, double ey, int xc, int yc, int x, int y, double ratio, double rad, int button) {
joyFill(button);
aggDraw.hud->ellipse(x+((xc*ex)*ratio), y+((yc*ey)*ratio), rad*ratio, rad*ratio);
}
void gradientFill(double x1,double y1,double x2,double y2,AggColor c1,AggColor c2, int n) {
if(nds.pad & (1 << n))
aggDraw.hud->fillLinearGradient(x1,y1,x2,y2,c1,c2);
else
aggDraw.hud->fillColor(255,255,255,255);
}
void drawPad(int x, int y, double ratio) {
int xc = 41;
int yc = 20;
aggDraw.hud->lineColor(128,128,128,255);
aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(222,222,222,128), agg::rgba8(255,255,255,255));
if(nds.pad & (1 << 2))
aggDraw.hud->fillLinearGradient(x, y, x+(xc*ratio), y+(yc*ratio), agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255));
if(nds.pad & (1 << 1))
aggDraw.hud->fillLinearGradient(x+(xc*ratio), y+(yc*ratio), x, y, agg::rgba8(0,0,0,128), agg::rgba8(255,255,255,255));
aggDraw.hud->roundedRect (x, y, x+(xc*ratio), y+(yc*ratio), 1);
aggDraw.hud->fillLinearGradient(x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio), y+(yc*.85*ratio), agg::rgba8(128,128,128,128), agg::rgba8(255,255,255,255));
aggDraw.hud->roundedRect (x+(xc*.25*ratio), y+(yc*.1*ratio), x+(xc*.75*ratio),y+(yc*.85*ratio), 1);
joyEllipse(.89,.45,xc,yc,x,y,ratio,1,6);//B
joyEllipse(.89,.22,xc,yc,x,y,ratio,1,3);//X
joyEllipse(.83,.34,xc,yc,x,y,ratio,1,4);//Y
joyEllipse(.95,.34,xc,yc,x,y,ratio,1,5);//A
joyEllipse(.82,.72,xc,yc,x,y,ratio,.5,7);//Start
joyEllipse(.82,.85,xc,yc,x,y,ratio,.5,8);//Select
aggDraw.hud->noLine();
aggDraw.hud->fillColor(255,255,255,200);
//left
gradientFill(x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),11);
//right
if(nds.pad & (1 << 12))
aggDraw.hud->fillLinearGradient(x+(xc*.17*ratio), y+(yc*.43*ratio), x+(xc*.04*ratio), y+(yc*.33*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255));
aggDraw.hud->roundedRect (x+(xc*.04*ratio), y+(yc*.33*ratio), x+(xc*.17*ratio), y+(yc*.43*ratio), 1);
//down
gradientFill(x+(xc*.13*ratio), y+(yc*.52*ratio), x+(xc*.08*ratio), y+(yc*.23*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255),10);
//up
if(nds.pad & (1<< 9))
aggDraw.hud->fillLinearGradient(x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), agg::rgba8(0,0,0,255), agg::rgba8(255,255,255,255));
aggDraw.hud->roundedRect (x+(xc*.08*ratio), y+(yc*.23*ratio), x+(xc*.13*ratio), y+(yc*.52*ratio), 1);
}
struct TouchInfo{
u16 X;
u16 Y;
};
static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255};
static TouchInfo temptouch;
bool touchshadow = true;
static std::vector<TouchInfo> touch (8);
static void TouchDisplay() {
aggDraw.hud->lineWidth(1.0);
temptouch.X = nds.touchX >> 4;
temptouch.Y = nds.touchY >> 4;
touch.push_back(temptouch);
if(touch.size() > 8) touch.erase(touch.begin());
if(touchshadow) {
for (int i = 0; i < 8; i++) {
temptouch = touch[i];
if(temptouch.X != 0 || temptouch.Y != 0) {
aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]);
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]);
aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192);
}
}
}
else
if(nds.isTouch) {
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
}
}
static int previousslot = 0;
static char number[10];
static s64 slotTimer=0;
static void DrawStateSlots(){
const int yloc = Hud.SavestateSlots.y; //160
const int xloc = Hud.SavestateSlots.x; //8
s64 fadecounter = 512 - (hudTimer-slotTimer)/4; //change constant to alter fade speed
if(fadecounter < 1) fadecounter = 0;
if(fadecounter>255) fadecounter = 255;
int alpha = (int)fadecounter;
if(HudEditorMode)
alpha = 255;
if(alpha!=0)
{
aggDraw.hud->lineWidth(1.0);
aggDraw.hud->lineColor(0, 0, 0, alpha);
aggDraw.hud->fillColor(255, 255, 255, alpha);
for ( int i = 0, xpos=0; i < 10; xpos=xpos+24) {
int yheight=0;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, xloc + 22 + xpos, yloc + 20 + yheight+20, agg::rgba8(100,200,255,alpha), agg::rgba8(255,255,255,0));
if(lastSaveState == i) {
yheight = 5;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, 22 + xloc + xpos, yloc + 20 + yheight+20, agg::rgba8(100,255,255,alpha), agg::rgba8(255,255,255,0));
}
aggDraw.hud->rectangle(xloc + xpos , yloc - yheight, xloc + 22 + xpos , yloc + 20 + yheight);
snprintf(number, 10, "%d", i);
aggDraw.hud->renderText(xloc + 1 + xpos + 4, yloc+4, std::string(number));
i++;
}
}
if(lastSaveState != previousslot)
slotTimer = hudTimer;
previousslot = lastSaveState;
}
void DrawHUD()
{
GTimeVal time;
g_get_current_time(&time);
hudTimer = ((s64)time.tv_sec * 1000) + ((s64)time.tv_usec/1000);
if (CommonSettings.hud.ShowInputDisplay)
{
std::stringstream ss;
if(nds.isTouch)
ss << (nds.touchX >> 4) << " " << (nds.touchY >> 4);
osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",(InputDisplayString + ss.str()).c_str());
TouchDisplay();
}
if (CommonSettings.hud.FpsDisplay)
{
osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", Hud.fps, Hud.fps3d);
}
if (CommonSettings.hud.FrameCounterDisplay)
{
if (movieMode == MOVIEMODE_PLAY)
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size());
else if(movieMode == MOVIEMODE_RECORD)
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter);
else
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter);
}
if (CommonSettings.hud.ShowLagFrameCounter)
{
osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
}
if (CommonSettings.hud.ShowGraphicalInputDisplay)
drawPad(Hud.GraphicalInputDisplay.x, Hud.GraphicalInputDisplay.y, 2.5);
#ifdef WIN32
if (CommonSettings.hud.ShowMicrophone)
{
osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
}
#endif
DrawStateSlots();
}
OSDCLASS::OSDCLASS(u8 core)
{
memset(name,0,7);
mode=core;
offset=0;
lastLineText=0;
lineText_x = 5;
lineText_y = 120;
lineText_color = AggColor(255, 255, 255);
for (int i=0; i < OSD_MAX_LINES+1; i++)
{
lineText[i] = new char[1024];
memset(lineText[i], 0, 1024);
lineTimer[i] = 0;
lineColor[i] = lineText_color;
}
rotAngle = 0;
needUpdate = false;
if (core==0)
strcpy(name,"Core A");
else
if (core==1)
strcpy(name,"Core B");
else
{
strcpy(name,"Main");
mode=255;
}
//border(false);
LOG("OSD_Init (%s)\n",name);
}
OSDCLASS::~OSDCLASS()
{
LOG("OSD_Deinit (%s)\n",name);
for (int i=0; i < OSD_MAX_LINES+1; i++)
{
if (lineText[i])
delete [] lineText[i];
lineText[i] = NULL;
}
}
void OSDCLASS::setOffset(u16 ofs)
{
offset=ofs;
}
void OSDCLASS::setRotate(u16 angle)
{
rotAngle = angle;
}
void OSDCLASS::clear()
{
needUpdate=false;
}
bool OSDCLASS::checkTimers()
{
if (lastLineText == 0) return false;
time_t tmp_time = time(NULL);
for (int i=0; i < lastLineText; i++)
{
if (tmp_time > (lineTimer[i] + OSD_TIMER_SECS) )
{
if (i < lastLineText)
{
for (int j=i; j < lastLineText; j++)
{
strcpy(lineText[j], lineText[j+1]);
lineTimer[j] = lineTimer[j+1];
lineColor[j] = lineColor[j+1];
}
}
lineTimer[lastLineText] = 0;
lastLineText--;
if (lastLineText == 0) return false;
}
}
return true;
}
void OSDCLASS::update()
{
if ( (!needUpdate) && (!lastLineText) ) return; // don't update if buffer empty (speed up)
if (lastLineText)
{
if (checkTimers())
{
for (int i=0; i < lastLineText; i++)
{
aggDraw.hud->lineColor(lineColor[i]);
aggDraw.hud->renderTextDropshadowed(lineText_x,lineText_y+(i*16),lineText[i]);
}
}
else
{
if (!needUpdate) return;
}
}
}
void OSDCLASS::setListCoord(u16 x, u16 y)
{
lineText_x = x;
lineText_y = y;
}
void OSDCLASS::setLineColor(u8 r=255, u8 b=255, u8 g=255)
{
lineText_color = AggColor(r,g,b);
}
void OSDCLASS::addLine(const char *fmt, ...)
{
va_list list;
if (lastLineText > OSD_MAX_LINES) lastLineText = OSD_MAX_LINES;
if (lastLineText == OSD_MAX_LINES) // full
{
lastLineText--;
for (int j=0; j < lastLineText; j++)
{
strcpy(lineText[j], lineText[j+1]);
lineTimer[j] = lineTimer[j+1];
lineColor[j] = lineColor[j+1];
}
}
va_start(list,fmt);
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
_vsnprintf(lineText[lastLineText],1023,fmt,list);
#else
vsnprintf(lineText[lastLineText],1023,fmt,list);
#endif
va_end(list);
lineColor[lastLineText] = lineText_color;
lineTimer[lastLineText] = time(NULL);
needUpdate = true;
lastLineText++;
}
void OSDCLASS::addFixed(u16 x, u16 y, const char *fmt, ...)
{
va_list list;
char msg[1024];
va_start(list,fmt);
vsnprintf(msg,1023,fmt,list);
va_end(list);
aggDraw.hud->lineColor(255,255,255);
aggDraw.hud->renderTextDropshadowed(x,y,msg);
needUpdate = true;
}
void OSDCLASS::border(bool enabled)
{
//render51.setTextBoxBorder(enabled);
}
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006-2008 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "GPU_osd.h"
#include "GPU.h"
#include "mem.h"
#include <string.h> //mem funcs
#include <stdarg.h> //va_start, etc
#include <sstream>
#include <stdio.h>
#include <time.h>
#include "debug.h"
#include "aggdraw.h"
#include "movie.h"
#include "NDSSystem.h"
#include "mic.h"
#include "saves.h"
#include "glib.h"
bool HudEditorMode = false;
OSDCLASS *osd = NULL;
HudStruct Hud;
//contains a timer to be used for well-timed hud components
static s64 hudTimer;
void SetHudDummy (HudCoordinates *hud)
{
hud->x=666;
hud->y=666;
}
bool IsHudDummy (HudCoordinates *hud)
{
return (hud->x == 666 && hud->y == 666);
}
void EditHud(s32 x, s32 y, HudStruct *hudstruct) {
u32 i = 0;
while (!IsHudDummy(&hudstruct->hud(i))) {
HudCoordinates &hud = hudstruct->hud(i);
//reset
if(!hud.clicked) {
hud.storedx=0;
hud.storedy=0;
}
if((x >= hud.x && x <= hud.x + hud.xsize) &&
(y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) {
hud.clicked=1;
hud.storedx = x - hud.x;
hud.storedy = y - hud.y;
}
if(hud.clicked) {
hud.x = x - hud.storedx;
hud.y = y - hud.storedy;
}
//sanity checks
if(hud.x < 0) hud.x = 0;
if(hud.y < 0) hud.y = 0;
if(hud.x > 245)hud.x = 245; //margins
if(hud.y > 384-16)hud.y = 384-16;
if(hud.clicked)
break;//prevent items from grouping together
i++;
}
}
void HudClickRelease(HudStruct *hudstruct) {
u32 i = 0;
while (!IsHudDummy(&hudstruct->hud(i))) {
HudCoordinates &hud = hudstruct->hud(i);
hud.clicked=0;
i++;
}
}
void HudStruct::reset()
{
FpsDisplay.x=0;
FpsDisplay.y=5;
FpsDisplay.xsize=120;
FpsDisplay.ysize=10;
FrameCounter.x=0;
FrameCounter.y=25;
FrameCounter.xsize=60;
FrameCounter.ysize=10;
InputDisplay.x=0;
InputDisplay.y=45;
InputDisplay.xsize=120;
InputDisplay.ysize=10;
LagFrameCounter.x=0;
LagFrameCounter.y=65;
LagFrameCounter.xsize=30;
LagFrameCounter.ysize=10;
Microphone.x=0;
Microphone.y=85;
Microphone.xsize=20;
Microphone.ysize=10;
SavestateSlots.x = 8;
SavestateSlots.y = 160;
SavestateSlots.xsize = 240;
SavestateSlots.ysize = 24;
SetHudDummy(&Dummy);
}
struct TouchInfo{
u16 X;
u16 Y;
};
static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255};
static TouchInfo temptouch;
bool touchshadow = true;
static std::vector<TouchInfo> touch (8);
static void TouchDisplay() {
aggDraw.hud->lineWidth(1.0);
temptouch.X = nds.touchX >> 4;
temptouch.Y = nds.touchY >> 4;
touch.push_back(temptouch);
if(touch.size() > 8) touch.erase(touch.begin());
if(touchshadow) {
for (int i = 0; i < 8; i++) {
temptouch = touch[i];
if(temptouch.X != 0 || temptouch.Y != 0) {
aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]);
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]);
aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192);
}
}
}
else
if(nds.isTouch) {
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
}
}
static int previousslot = 0;
static char number[10];
static s64 slotTimer=0;
static void DrawStateSlots(){
const int yloc = Hud.SavestateSlots.y; //160
const int xloc = Hud.SavestateSlots.x; //8
s64 fadecounter = 512 - (hudTimer-slotTimer)/4; //change constant to alter fade speed
if(fadecounter < 1) fadecounter = 0;
if(fadecounter>255) fadecounter = 255;
int alpha = (int)fadecounter;
if(HudEditorMode)
alpha = 255;
if(alpha!=0)
{
aggDraw.hud->lineWidth(1.0);
aggDraw.hud->lineColor(0, 0, 0, alpha);
aggDraw.hud->fillColor(255, 255, 255, alpha);
for ( int i = 0, xpos=0; i < 10; xpos=xpos+24) {
int yheight=0;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, xloc + 22 + xpos, yloc + 20 + yheight+20, agg::rgba8(100,200,255,alpha), agg::rgba8(255,255,255,0));
if(lastSaveState == i) {
yheight = 5;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, 22 + xloc + xpos, yloc + 20 + yheight+20, agg::rgba8(100,255,255,alpha), agg::rgba8(255,255,255,0));
}
aggDraw.hud->rectangle(xloc + xpos , yloc - yheight, xloc + 22 + xpos , yloc + 20 + yheight);
snprintf(number, 10, "%d", i);
aggDraw.hud->renderText(xloc + 1 + xpos + 4, yloc+4, std::string(number));
i++;
}
}
if(lastSaveState != previousslot)
slotTimer = hudTimer;
previousslot = lastSaveState;
}
void DrawHUD()
{
GTimeVal time;
g_get_current_time(&time);
hudTimer = ((s64)time.tv_sec * 1000) + ((s64)time.tv_usec/1000);
if (CommonSettings.hud.ShowInputDisplay)
{
std::stringstream ss;
if(nds.isTouch)
ss << (nds.touchX >> 4) << " " << (nds.touchY >> 4);
osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",(InputDisplayString + ss.str()).c_str());
TouchDisplay();
}
if (CommonSettings.hud.FpsDisplay)
{
osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", Hud.fps, Hud.fps3d);
}
if (CommonSettings.hud.FrameCounterDisplay)
{
if (movieMode == MOVIEMODE_PLAY)
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size());
else if(movieMode == MOVIEMODE_RECORD)
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter);
else
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter);
}
if (CommonSettings.hud.ShowLagFrameCounter)
{
osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
}
#ifdef WIN32
if (CommonSettings.hud.ShowMicrophone)
{
osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
}
#endif
DrawStateSlots();
}
OSDCLASS::OSDCLASS(u8 core)
{
memset(name,0,7);
mode=core;
offset=0;
lastLineText=0;
lineText_x = 5;
lineText_y = 120;
lineText_color = AggColor(255, 255, 255);
for (int i=0; i < OSD_MAX_LINES+1; i++)
{
lineText[i] = new char[1024];
memset(lineText[i], 0, 1024);
lineTimer[i] = 0;
lineColor[i] = lineText_color;
}
rotAngle = 0;
needUpdate = false;
if (core==0)
strcpy(name,"Core A");
else
if (core==1)
strcpy(name,"Core B");
else
{
strcpy(name,"Main");
mode=255;
}
//border(false);
LOG("OSD_Init (%s)\n",name);
}
OSDCLASS::~OSDCLASS()
{
LOG("OSD_Deinit (%s)\n",name);
for (int i=0; i < OSD_MAX_LINES+1; i++)
{
if (lineText[i])
delete [] lineText[i];
lineText[i] = NULL;
}
}
void OSDCLASS::setOffset(u16 ofs)
{
offset=ofs;
}
void OSDCLASS::setRotate(u16 angle)
{
rotAngle = angle;
}
void OSDCLASS::clear()
{
needUpdate=false;
}
bool OSDCLASS::checkTimers()
{
if (lastLineText == 0) return false;
time_t tmp_time = time(NULL);
for (int i=0; i < lastLineText; i++)
{
if (tmp_time > (lineTimer[i] + OSD_TIMER_SECS) )
{
if (i < lastLineText)
{
for (int j=i; j < lastLineText; j++)
{
strcpy(lineText[j], lineText[j+1]);
lineTimer[j] = lineTimer[j+1];
lineColor[j] = lineColor[j+1];
}
}
lineTimer[lastLineText] = 0;
lastLineText--;
if (lastLineText == 0) return false;
}
}
return true;
}
void OSDCLASS::update()
{
if ( (!needUpdate) && (!lastLineText) ) return; // don't update if buffer empty (speed up)
if (lastLineText)
{
if (checkTimers())
{
for (int i=0; i < lastLineText; i++)
{
aggDraw.hud->lineColor(lineColor[i]);
aggDraw.hud->renderTextDropshadowed(lineText_x,lineText_y+(i*16),lineText[i]);
}
}
else
{
if (!needUpdate) return;
}
}
}
void OSDCLASS::setListCoord(u16 x, u16 y)
{
lineText_x = x;
lineText_y = y;
}
void OSDCLASS::setLineColor(u8 r=255, u8 b=255, u8 g=255)
{
lineText_color = AggColor(r,g,b);
}
void OSDCLASS::addLine(const char *fmt, ...)
{
va_list list;
if (lastLineText > OSD_MAX_LINES) lastLineText = OSD_MAX_LINES;
if (lastLineText == OSD_MAX_LINES) // full
{
lastLineText--;
for (int j=0; j < lastLineText; j++)
{
strcpy(lineText[j], lineText[j+1]);
lineTimer[j] = lineTimer[j+1];
lineColor[j] = lineColor[j+1];
}
}
va_start(list,fmt);
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
_vsnprintf(lineText[lastLineText],1023,fmt,list);
#else
vsnprintf(lineText[lastLineText],1023,fmt,list);
#endif
va_end(list);
lineColor[lastLineText] = lineText_color;
lineTimer[lastLineText] = time(NULL);
needUpdate = true;
lastLineText++;
}
void OSDCLASS::addFixed(u16 x, u16 y, const char *fmt, ...)
{
va_list list;
char msg[1024];
va_start(list,fmt);
vsnprintf(msg,1023,fmt,list);
va_end(list);
aggDraw.hud->lineColor(255,255,255);
aggDraw.hud->renderTextDropshadowed(x,y,msg);
needUpdate = true;
}
void OSDCLASS::border(bool enabled)
{
//render51.setTextBoxBorder(enabled);
}

View File

@ -1,114 +1,114 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006-2008 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __GPU_OSD_
#define __GPU_OSD_
#include <stdlib.h>
#include <time.h>
#include "types.h"
#include "aggdraw.h"
#define OSD_MAX_LINES 4
#define OSD_TIMER_SECS 2
struct HudCoordinates{
int x;
int y;
int xsize;
int ysize;
int storedx;
int storedy;
int clicked;
};
struct HudStruct
{
public:
HudStruct()
: fps(0)
, fps3d(0)
{}
HudCoordinates SavestateSlots;
HudCoordinates FpsDisplay;
HudCoordinates FrameCounter;
HudCoordinates InputDisplay;
HudCoordinates GraphicalInputDisplay;
HudCoordinates LagFrameCounter;
HudCoordinates Microphone;
HudCoordinates Dummy;
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
void reset();
int fps, fps3d;
};
void EditHud(s32 x, s32 y, HudStruct *hudstruct);
void HudClickRelease(HudStruct *hudstruct);
void DrawHUD();
extern HudStruct Hud;
extern bool HudEditorMode;
class OSDCLASS
{
private:
u64 offset;
u8 mode;
u16 rotAngle;
u16 lineText_x;
u16 lineText_y;
AggColor lineText_color;
u8 lastLineText;
char *lineText[OSD_MAX_LINES+1];
time_t lineTimer[OSD_MAX_LINES+1];
AggColor lineColor[OSD_MAX_LINES+1];
bool needUpdate;
bool checkTimers();
public:
char name[7]; // for debuging
OSDCLASS(u8 core);
~OSDCLASS();
void setOffset(u16 ofs);
void setRotate(u16 angle);
void update();
void clear();
void setListCoord(u16 x, u16 y);
void setLineColor(u8 r, u8 b, u8 g);
void addLine(const char *fmt, ...);
void addFixed(u16 x, u16 y, const char *fmt, ...);
void border(bool enabled);
};
extern OSDCLASS *osd;
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2006-2008 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __GPU_OSD_
#define __GPU_OSD_
#include <stdlib.h>
#include <time.h>
#include "types.h"
#include "aggdraw.h"
#define OSD_MAX_LINES 4
#define OSD_TIMER_SECS 2
struct HudCoordinates{
int x;
int y;
int xsize;
int ysize;
int storedx;
int storedy;
int clicked;
};
struct HudStruct
{
public:
HudStruct()
: fps(0)
, fps3d(0)
{}
HudCoordinates SavestateSlots;
HudCoordinates FpsDisplay;
HudCoordinates FrameCounter;
HudCoordinates InputDisplay;
HudCoordinates LagFrameCounter;
HudCoordinates Microphone;
HudCoordinates Dummy;
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
void reset();
int fps, fps3d;
};
void ResetHud(HudStruct *hudstruct);
void EditHud(s32 x, s32 y, HudStruct *hudstruct);
void HudClickRelease(HudStruct *hudstruct);
void DrawHUD();
extern HudStruct Hud;
extern bool HudEditorMode;
class OSDCLASS
{
private:
u64 offset;
u8 mode;
u16 rotAngle;
u16 lineText_x;
u16 lineText_y;
AggColor lineText_color;
u8 lastLineText;
char *lineText[OSD_MAX_LINES+1];
time_t lineTimer[OSD_MAX_LINES+1];
AggColor lineColor[OSD_MAX_LINES+1];
bool needUpdate;
bool checkTimers();
public:
char name[7]; // for debuging
OSDCLASS(u8 core);
~OSDCLASS();
void setOffset(u16 ofs);
void setRotate(u16 angle);
void update();
void clear();
void setListCoord(u16 x, u16 y);
void setLineColor(u8 r, u8 b, u8 g);
void addLine(const char *fmt, ...);
void addFixed(u16 x, u16 y, const char *fmt, ...);
void border(bool enabled);
};
extern OSDCLASS *osd;
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +1,70 @@
include $(top_srcdir)/src/desmume.mk
AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(LUA_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS)
EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp
if HAVE_GDB_STUB
SUBDIRS = . gdbstub $(UI_DIR)
else
SUBDIRS = . $(UI_DIR)
endif
DIST_SUBDIRS = . gdbstub cli cocoa gtk gtk-glade windows
noinst_LIBRARIES = libdesmume.a
libdesmume_a_SOURCES = \
armcpu.cpp armcpu.h ARM9.h \
arm_instructions.cpp arm_instructions.h \
bios.cpp bios.h bits.h cp15.cpp cp15.h \
commandline.h commandline.cpp \
common.cpp common.h \
debug.cpp debug.h driver.h \
Disassembler.cpp Disassembler.h \
dscard.h fat.h FIFO.cpp FIFO.h \
GPU.cpp GPU.h \
GPU_osd.cpp GPU_osd.h \
mem.h mc.cpp mc.h \
memorystream.h \
path.h \
readwrite.cpp readwrite.h \
wifi.cpp wifi.h \
MMU.cpp MMU.h NDSSystem.cpp NDSSystem.h registers.h \
OGLRender.cpp OGLRender.h \
ROMReader.cpp ROMReader.h \
render3D.cpp render3D.h \
rtc.cpp rtc.h \
saves.cpp saves.h \
SPU.cpp SPU.h \
matrix.cpp matrix.h \
gfx3d.cpp gfx3d.h \
texcache.cpp texcache.h \
thumb_instructions.cpp thumb_instructions.h types.h \
shaders.h \
movie.cpp movie.h \
PACKED.h PACKED_END.h \
utils/ConvertUTF.c utils/ConvertUTF.h utils/guid.cpp utils/guid.h \
utils/md5.cpp utils/md5.h utils/valuearray.h utils/xstring.cpp utils/xstring.h \
utils/decrypt/crc.cpp utils/decrypt/crc.h utils/decrypt/decrypt.cpp \
utils/decrypt/decrypt.h utils/decrypt/header.cpp utils/decrypt/header.h \
addons.cpp addons.h \
addons/compactFlash.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp addons/guitarGrip.cpp fs.h \
cheatSystem.cpp cheatSystem.h \
texcache.cpp texcache.h rasterize.cpp rasterize.h \
version.h
if HAVE_ALSA
libdesmume_a_SOURCES += mic_alsa.cpp
else
libdesmume_a_SOURCES += mic.cpp
endif
if HAVE_LIBAGG
libdesmume_a_SOURCES += aggdraw.cpp
endif
if HAVE_LUA
libdesmume_a_SOURCES += lua-engine.cpp
endif
if HAVE_GDB_STUB
libdesmume_a_SOURCES += gdbstub.h
endif
libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT)
include $(top_srcdir)/src/desmume.mk
AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(LUA_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS)
EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp \
matrix_sse2-x64.asm matrix_sse2-x86.asm
if HAVE_GDB_STUB
SUBDIRS = . gdbstub $(UI_DIR)
else
SUBDIRS = . $(UI_DIR)
endif
DIST_SUBDIRS = . gdbstub cli cocoa gtk gtk-glade windows
noinst_LIBRARIES = libdesmume.a
libdesmume_a_SOURCES = \
armcpu.cpp armcpu.h ARM9.h \
arm_instructions.cpp arm_instructions.h \
bios.cpp bios.h bits.h cp15.cpp cp15.h \
common.cpp common.h \
debug.cpp debug.h driver.h \
Disassembler.cpp Disassembler.h \
dscard.h fat.h FIFO.cpp FIFO.h \
GPU.cpp GPU.h \
GPU_osd.cpp GPU_osd.h \
mem.h mc.cpp mc.h \
memorystream.h \
path.h \
readwrite.cpp readwrite.h \
wifi.cpp wifi.h \
MMU.cpp MMU.h NDSSystem.cpp NDSSystem.h registers.h \
OGLRender.cpp OGLRender.h \
ROMReader.cpp ROMReader.h \
render3D.cpp render3D.h \
rtc.cpp rtc.h \
saves.cpp saves.h \
SPU.cpp SPU.h \
matrix.cpp matrix.h \
gfx3d.cpp gfx3d.h \
texcache.cpp texcache.h \
thumb_instructions.cpp thumb_instructions.h types.h \
shaders.h \
movie.cpp movie.h \
PACKED.h PACKED_END.h \
utils/ConvertUTF.c utils/ConvertUTF.h utils/guid.cpp utils/guid.h \
utils/md5.cpp utils/md5.h utils/valuearray.h utils/xstring.cpp utils/xstring.h \
utils/decrypt/crc.cpp utils/decrypt/crc.h utils/decrypt/decrypt.cpp \
utils/decrypt/decrypt.h utils/decrypt/header.cpp utils/decrypt/header.h \
addons.cpp addons.h \
addons/compactFlash.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp addons/guitarGrip.cpp fs.h \
cheatSystem.cpp cheatSystem.h \
texcache.cpp texcache.h rasterize.cpp rasterize.h \
version.h
if HAVE_GLIB
libdesmume_a_SOURCES += commandline.h commandline.cpp
endif
if HAVE_ALSA
libdesmume_a_SOURCES += mic_alsa.cpp
else
libdesmume_a_SOURCES += mic.cpp
endif
if HAVE_LIBAGG
libdesmume_a_SOURCES += aggdraw.cpp
endif
if HAVE_LUA
libdesmume_a_SOURCES += lua-engine.cpp
endif
if HAVE_GDB_STUB
libdesmume_a_SOURCES += gdbstub.h
endif
libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT)

File diff suppressed because it is too large Load Diff

View File

@ -1,488 +1,451 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2008-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NDSSYSTEM_H
#define NDSSYSTEM_H
#include <string.h>
#include "armcpu.h"
#include "MMU.h"
#include "driver.h"
#include "GPU.h"
#include "SPU.h"
#include "mem.h"
#include "wifi.h"
#include <string>
#ifdef WIN32
#include "pathsettings.h"
#endif
struct turbo {
bool Right;
bool Left;
bool Down;
bool Up;
bool Start;
bool Select;
bool B;
bool A;
bool Y;
bool X;
bool L;
bool R;
bool &button(int i) { return ((bool*)this)[i]; }
};
extern turbo Turbo;
struct turbotime {
int Right;
int Left;
int Down;
int Up;
int Start;
int Select;
int B;
int A;
int Y;
int X;
int L;
int R;
int &time(int i) { return ((int*)this)[i]; }
};
extern turbotime TurboTime;
struct autohold {
bool Right;
bool Left;
bool Down;
bool Up;
bool Start;
bool Select;
bool B;
bool A;
bool Y;
bool X;
bool L;
bool R;
bool &hold(int i) { return ((bool*)this)[i]; }
};
extern autohold AutoHold;
int NDS_WritePNG(const char *fname);
extern volatile bool execute;
extern BOOL click;
/*
* The firmware language values
*/
#define NDS_FW_LANG_JAP 0
#define NDS_FW_LANG_ENG 1
#define NDS_FW_LANG_FRE 2
#define NDS_FW_LANG_GER 3
#define NDS_FW_LANG_ITA 4
#define NDS_FW_LANG_SPA 5
#define NDS_FW_LANG_CHI 6
#define NDS_FW_LANG_RES 7
//#define LOG_ARM9
//#define LOG_ARM7
struct NDS_header
{
char gameTile[12];
char gameCode[4];
u16 makerCode;
u8 unitCode;
u8 deviceCode;
u8 cardSize;
u8 cardInfo[8];
u8 flags;
u32 ARM9src;
u32 ARM9exe;
u32 ARM9cpy;
u32 ARM9binSize;
u32 ARM7src;
u32 ARM7exe;
u32 ARM7cpy;
u32 ARM7binSize;
u32 FNameTblOff;
u32 FNameTblSize;
u32 FATOff;
u32 FATSize;
u32 ARM9OverlayOff;
u32 ARM9OverlaySize;
u32 ARM7OverlayOff;
u32 ARM7OverlaySize;
u32 unknown2a;
u32 unknown2b;
u32 IconOff;
u16 CRC16;
u16 ROMtimeout;
u32 ARM9unk;
u32 ARM7unk;
u8 unknown3c[8];
u32 ROMSize;
u32 HeaderSize;
u8 unknown5[56];
u8 logo[156];
u16 logoCRC16;
u16 headerCRC16;
u8 reserved[160];
};
extern void debug();
void emu_halt();
extern u64 nds_timer;
void NDS_Reschedule();
void NDS_RescheduleGXFIFO();
void NDS_RescheduleDMA();
void NDS_RescheduleTimers();
typedef struct
{
s32 wifiCycle;
s32 cycles;
u64 timerCycle[2][4];
u32 VCount;
u32 old;
u16 touchX;
u16 touchY;
BOOL isTouch;
u16 pad;
u8 *FW_ARM9BootCode;
u8 *FW_ARM7BootCode;
u32 FW_ARM9BootCodeAddr;
u32 FW_ARM7BootCodeAddr;
u32 FW_ARM9BootCodeSize;
u32 FW_ARM7BootCodeSize;
BOOL sleeping;
//this is not essential NDS runtime state.
//it was perhaps a mistake to put it here.
//it is far less important than the above.
//maybe I should move it.
s32 idleCycles;
s32 runCycleCollector[16];
s32 idleFrameCounter;
//if the game was booted on a debug console, this is set
BOOL debugConsole;
bool isInVblank() const { return VCount >= 192; }
bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
} NDSSystem;
/** /brief A touchscreen calibration point.
*/
struct NDS_fw_touchscreen_cal {
u16 adc_x;
u16 adc_y;
u8 screen_x;
u8 screen_y;
};
/** /brief The type of DS
*/
enum nds_fw_ds_type {
NDS_FW_DS_TYPE_FAT,
NDS_FW_DS_TYPE_LITE,
NDS_FW_DS_TYPE_iQue
};
#define MAX_FW_NICKNAME_LENGTH 10
#define MAX_FW_MESSAGE_LENGTH 26
struct NDS_fw_config_data {
enum nds_fw_ds_type ds_type;
u8 fav_colour;
u8 birth_month;
u8 birth_day;
u16 nickname[MAX_FW_NICKNAME_LENGTH];
u8 nickname_len;
u16 message[MAX_FW_MESSAGE_LENGTH];
u8 message_len;
u8 language;
/* touchscreen calibration */
struct NDS_fw_touchscreen_cal touch_cal[2];
};
extern NDSSystem nds;
#ifdef GDB_STUB
int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
struct armcpu_ctrl_iface **arm9_ctrl_iface,
struct armcpu_memory_iface *arm7_mem_if,
struct armcpu_ctrl_iface **arm7_ctrl_iface);
#else
int NDS_Init ( void);
#endif
void Desmume_InitOnce();
void NDS_DeInit(void);
void
NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config);
BOOL NDS_SetROM(u8 * rom, u32 mask);
NDS_header * NDS_getROMHeader(void);
struct GameInfo
{
GameInfo()
: romdata(NULL)
{}
void resize(int size) {
if(romdata != NULL) delete[] romdata;
romdata = new char[size];
romsize = size;
}
u32 crc;
NDS_header header;
char ROMserial[20];
void populate();
char* romdata;
int romsize;
};
typedef struct TSCalInfo
{
struct adc
{
u16 x1, x2;
u16 y1, y2;
} adc;
struct scr
{
u8 x1, x2;
u8 y1, y2;
} scr;
} TSCalInfo;
extern GameInfo gameInfo;
void NDS_setTouchPos(u16 x, u16 y);
void NDS_releaseTouch(void);
void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,bool X,bool W,bool E,bool G, bool F);
void NDS_setPadFromMovie(u16 pad);
int NDS_LoadROM(const char *filename, const char* logicalFilename=0);
void NDS_FreeROM(void);
void NDS_Reset();
int NDS_ImportSave(const char *filename);
bool NDS_ExportSave(const char *filename);
void nds_savestate(std::ostream* os);
bool nds_loadstate(std::istream* is, int size);
int NDS_WriteBMP(const char *filename);
int NDS_LoadFirmware(const char *filename);
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
void NDS_Sleep();
void NDS_SkipNextFrame();
#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
void execHardware_doAllDma(EDMAMode modeNum);
template<bool FORCE> void NDS_exec(s32 nb = 560190<<1);
extern int lagframecounter;
static INLINE void NDS_ARM9HBlankInt(void)
{
if(T1ReadWord(MMU.ARM9_REG, 4) & 0x10)
{
//MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
setIF(0, 2);
NDS_ARM9.wIRQ = TRUE;
}
}
static INLINE void NDS_ARM7HBlankInt(void)
{
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
{
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
setIF(1, 2);
NDS_ARM7.wIRQ = TRUE;
}
}
static INLINE void NDS_ARM9VBlankInt(void)
{
if(T1ReadWord(MMU.ARM9_REG, 4) & 0x8)
{
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
setIF(0, 1);
NDS_ARM9.wIRQ = TRUE;
//emu_halt();
/*logcount++;*/
}
}
static INLINE void NDS_ARM7VBlankInt(void)
{
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
setIF(1, 1);
NDS_ARM7.wIRQ = TRUE;
//emu_halt();
}
static INLINE void NDS_swapScreen(void)
{
u16 tmp = MainScreen.offset;
MainScreen.offset = SubScreen.offset;
SubScreen.offset = tmp;
}
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
extern struct TCommonSettings {
TCommonSettings()
: HighResolutionInterpolateColor(true)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, UseExtFirmware(false)
, BootFromFirmware(false)
, DebugConsole(false)
, single_core(true)
, spuInterpolationMode(SPUInterpolation_Linear)
, spuAdpcmCache(false)
, gfx3d_flushMode(0)
, manualBackupType(0)
{
strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin");
strcpy(Firmware, "firmware.bin");
wifi.mode = 0;
wifi.adhocMode = 0;
strcpy(wifi.adhocServerName, "");
wifi.infraBridgeAdapter = 0;
for(int i=0;i<16;i++)
spu_muteChannels[i] = false;
}
bool HighResolutionInterpolateColor;
bool UseExtBIOS;
char ARM9BIOS[256];
char ARM7BIOS[256];
bool SWIFromBIOS;
bool UseExtFirmware;
char Firmware[256];
bool BootFromFirmware;
bool DebugConsole;
bool single_core;
struct _Wifi {
int mode;
int adhocMode;
char adhocServerName[64];
int infraBridgeAdapter;
} wifi;
SPUInterpolationMode spuInterpolationMode;
bool spuAdpcmCache;
//this is a temporary hack until we straighten out the flushing logic and/or gxfifo
int gfx3d_flushMode;
//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
int manualBackupType;
bool spu_muteChannels[16];
struct _ShowGpu {
_ShowGpu() : main(true), sub(true) {}
union {
struct { bool main,sub; };
bool screens[2];
};
} showGpu;
struct _Hud {
_Hud()
: ShowInputDisplay(false)
, ShowGraphicalInputDisplay(false)
, FpsDisplay(false)
, FrameCounterDisplay(false)
, ShowLagFrameCounter(false)
, ShowMicrophone(false)
{}
bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone;
} hud;
} CommonSettings;
extern std::string InputDisplayString;
extern int LagFrameFlag;
extern int lastLag, TotalLagFrames;
void MovieSRAM();
void ClearAutoHold(void);
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2008-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NDSSYSTEM_H
#define NDSSYSTEM_H
#include <string.h>
#include "armcpu.h"
#include "MMU.h"
#include "driver.h"
#include "GPU.h"
#include "SPU.h"
#include "mem.h"
#include "wifi.h"
#include <string>
#ifdef WIN32
#include "pathsettings.h"
#endif
struct turbo {
bool Right;
bool Left;
bool Down;
bool Up;
bool Start;
bool Select;
bool B;
bool A;
bool Y;
bool X;
bool L;
bool R;
bool &button(int i) { return ((bool*)this)[i]; }
};
extern turbo Turbo;
struct turbotime {
int Right;
int Left;
int Down;
int Up;
int Start;
int Select;
int B;
int A;
int Y;
int X;
int L;
int R;
int &time(int i) { return ((int*)this)[i]; }
};
extern turbotime TurboTime;
struct autohold {
bool Right;
bool Left;
bool Down;
bool Up;
bool Start;
bool Select;
bool B;
bool A;
bool Y;
bool X;
bool L;
bool R;
bool &hold(int i) { return ((bool*)this)[i]; }
};
extern autohold AutoHold;
int NDS_WritePNG(const char *fname);
extern volatile BOOL execute;
extern BOOL click;
/*
* The firmware language values
*/
#define NDS_FW_LANG_JAP 0
#define NDS_FW_LANG_ENG 1
#define NDS_FW_LANG_FRE 2
#define NDS_FW_LANG_GER 3
#define NDS_FW_LANG_ITA 4
#define NDS_FW_LANG_SPA 5
#define NDS_FW_LANG_CHI 6
#define NDS_FW_LANG_RES 7
//#define LOG_ARM9
//#define LOG_ARM7
struct NDS_header
{
char gameTile[12];
char gameCode[4];
u16 makerCode;
u8 unitCode;
u8 deviceCode;
u8 cardSize;
u8 cardInfo[8];
u8 flags;
u32 ARM9src;
u32 ARM9exe;
u32 ARM9cpy;
u32 ARM9binSize;
u32 ARM7src;
u32 ARM7exe;
u32 ARM7cpy;
u32 ARM7binSize;
u32 FNameTblOff;
u32 FNameTblSize;
u32 FATOff;
u32 FATSize;
u32 ARM9OverlayOff;
u32 ARM9OverlaySize;
u32 ARM7OverlayOff;
u32 ARM7OverlaySize;
u32 unknown2a;
u32 unknown2b;
u32 IconOff;
u16 CRC16;
u16 ROMtimeout;
u32 ARM9unk;
u32 ARM7unk;
u8 unknown3c[8];
u32 ROMSize;
u32 HeaderSize;
u8 unknown5[56];
u8 logo[156];
u16 logoCRC16;
u16 headerCRC16;
u8 reserved[160];
};
extern void debug();
void emu_halt();
typedef struct
{
s32 ARM9Cycle;
s32 ARM7Cycle;
s32 wifiCycle;
s32 cycles;
s32 timerCycle[2][4];
BOOL timerOver[2][4];
s32 nextHBlank;
u32 VCount;
u32 old;
s32 diff;
BOOL lignerendu;
u16 touchX;
u16 touchY;
BOOL isTouch;
u16 pad;
u8 *FW_ARM9BootCode;
u8 *FW_ARM7BootCode;
u32 FW_ARM9BootCodeAddr;
u32 FW_ARM7BootCodeAddr;
u32 FW_ARM9BootCodeSize;
u32 FW_ARM7BootCodeSize;
BOOL sleeping;
//this is not essential NDS runtime state.
//it was perhaps a mistake to put it here.
//it is far less important than the above.
//maybe I should move it.
s32 idleCycles;
s32 runCycleCollector[16];
s32 idleFrameCounter;
//if the game was booted on a debug console, this is set
BOOL debugConsole;
bool isInVblank() const { return VCount >= 192; }
bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
} NDSSystem;
/** /brief A touchscreen calibration point.
*/
struct NDS_fw_touchscreen_cal {
u16 adc_x;
u16 adc_y;
u8 screen_x;
u8 screen_y;
};
/** /brief The type of DS
*/
enum nds_fw_ds_type {
NDS_FW_DS_TYPE_FAT,
NDS_FW_DS_TYPE_LITE,
NDS_FW_DS_TYPE_iQue
};
#define MAX_FW_NICKNAME_LENGTH 10
#define MAX_FW_MESSAGE_LENGTH 26
struct NDS_fw_config_data {
enum nds_fw_ds_type ds_type;
u8 fav_colour;
u8 birth_month;
u8 birth_day;
u16 nickname[MAX_FW_NICKNAME_LENGTH];
u8 nickname_len;
u16 message[MAX_FW_MESSAGE_LENGTH];
u8 message_len;
u8 language;
/* touchscreen calibration */
struct NDS_fw_touchscreen_cal touch_cal[2];
};
extern NDSSystem nds;
#ifdef GDB_STUB
int NDS_Init( struct armcpu_memory_iface *arm9_mem_if,
struct armcpu_ctrl_iface **arm9_ctrl_iface,
struct armcpu_memory_iface *arm7_mem_if,
struct armcpu_ctrl_iface **arm7_ctrl_iface);
#else
int NDS_Init ( void);
#endif
void Desmume_InitOnce();
void NDS_DeInit(void);
void
NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config);
BOOL NDS_SetROM(u8 * rom, u32 mask);
NDS_header * NDS_getROMHeader(void);
struct GameInfo
{
GameInfo()
: romdata(NULL)
{}
void resize(int size) {
if(romdata != NULL) delete[] romdata;
romdata = new char[size];
romsize = size;
}
u32 crc;
NDS_header header;
char ROMserial[20];
void populate();
char* romdata;
int romsize;
};
extern GameInfo gameInfo;
void NDS_setTouchPos(u16 x, u16 y);
void NDS_releaseTouch(void);
void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,bool X,bool W,bool E,bool G, bool F);
void NDS_setPadFromMovie(u16 pad);
int NDS_LoadROM(const char *filename, const char* logicalFilename=0);
void NDS_FreeROM(void);
void NDS_Reset();
int NDS_ImportSave(const char *filename);
bool NDS_ExportSave(const char *filename);
int NDS_WriteBMP(const char *filename);
int NDS_LoadFirmware(const char *filename);
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
void NDS_Sleep();
void NDS_SkipNextFrame();
#define NDS_SkipFrame(s) if(s) NDS_SkipNext2DFrame();
template<bool FORCE> void NDS_exec(s32 nb = 560190<<1);
extern int lagframecounter;
static INLINE void NDS_ARM9HBlankInt(void)
{
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10)
{
//MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
setIF(0, 2);
NDS_ARM9.wIRQ = TRUE;
}
}
static INLINE void NDS_ARM7HBlankInt(void)
{
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
{
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
setIF(1, 2);
NDS_ARM7.wIRQ = TRUE;
}
}
static INLINE void NDS_ARM9VBlankInt(void)
{
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
{
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
setIF(0, 1);
NDS_ARM9.wIRQ = TRUE;
//emu_halt();
/*logcount++;*/
}
}
static INLINE void NDS_ARM7VBlankInt(void)
{
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
setIF(1, 1);
NDS_ARM7.wIRQ = TRUE;
//emu_halt();
}
static INLINE void NDS_swapScreen(void)
{
u16 tmp = MainScreen.offset;
MainScreen.offset = SubScreen.offset;
SubScreen.offset = tmp;
}
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
extern struct TCommonSettings {
TCommonSettings()
: HighResolutionInterpolateColor(true)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, UseExtFirmware(false)
, BootFromFirmware(false)
, DebugConsole(false)
, wifiBridgeAdapterNum(0)
, spuInterpolationMode(SPUInterpolation_Linear)
, spuAdpcmCache(false)
, gfx3d_flushMode(0)
, manualBackupType(0)
{
strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin");
strcpy(Firmware, "firmware.bin");
for(int i=0;i<16;i++)
spu_muteChannels[i] = false;
}
bool HighResolutionInterpolateColor;
bool UseExtBIOS;
char ARM9BIOS[256];
char ARM7BIOS[256];
bool SWIFromBIOS;
bool UseExtFirmware;
char Firmware[256];
bool BootFromFirmware;
bool DebugConsole;
int wifiBridgeAdapterNum;
SPUInterpolationMode spuInterpolationMode;
bool spuAdpcmCache;
//this is a temporary hack until we straighten out the flushing logic and/or gxfifo
int gfx3d_flushMode;
//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
int manualBackupType;
bool spu_muteChannels[16];
struct _ShowGpu {
_ShowGpu() : main(true), sub(true) {}
union {
struct { bool main,sub; };
bool screens[2];
};
} showGpu;
struct _Hud {
_Hud()
: ShowInputDisplay(false)
, FpsDisplay(false)
, FrameCounterDisplay(false)
, ShowLagFrameCounter(false)
, ShowMicrophone(false)
{}
bool ShowInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone;
} hud;
} CommonSettings;
extern std::string InputDisplayString;
extern int LagFrameFlag;
extern int lastLag, TotalLagFrames;
void MovieSRAM();
void ClearAutoHold(void);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +1,48 @@
/*
Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 shash
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OGLRENDER_H
#define OGLRENDER_H
#include "common.h"
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "debug.h"
#include "render3D.h"
extern GPU3DInterface gpu3Dgl;
//This is called by OGLRender whenever it initializes.
//Platforms, please be sure to set this up.
//return true if you successfully init.
extern bool (*oglrender_init)();
//This is called by OGLRender before it uses opengl.
//return true if youre OK with using opengl
extern bool (*oglrender_beginOpenGL)();
//This is called by OGLRender after it is done using opengl.
extern void (*oglrender_endOpenGL)();
#endif
/*
Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 shash
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OGLRENDER_H
#define OGLRENDER_H
#include "common.h"
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "debug.h"
#include "render3D.h"
extern GPU3DInterface gpu3Dgl;
//This is called by OGLRender whenever it initializes.
//Platforms, please be sure to set this up.
//return true if you successfully init.
extern bool (*oglrender_init)();
//This is called by OGLRender before it uses opengl.
//return true if youre OK with using opengl
extern bool (*oglrender_beginOpenGL)();
//This is called by OGLRender after it is done using opengl.
extern void (*oglrender_endOpenGL)();
#endif

View File

@ -1,12 +1,12 @@
#ifndef __GNUC__
#pragma pack(push, 1)
#pragma warning(disable : 4103)
#endif
#ifndef __PACKED
#ifdef __GNUC__
#define __PACKED __attribute__((__packed__))
#else
#define __PACKED
#endif
#endif
#ifndef __GNUC__
#pragma pack(push, 1)
#pragma warning(disable : 4103)
#endif
#ifndef __PACKED
#ifdef __GNUC__
#define __PACKED __attribute__((__packed__))
#else
#define __PACKED
#endif
#endif

View File

@ -1,3 +1,3 @@
#ifndef __GNUC__
#pragma pack(pop)
#endif
#ifndef __GNUC__
#pragma pack(pop)
#endif

View File

@ -1,236 +1,236 @@
/* Copyright 2007 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ROMReader.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#ifdef HAVE_LIBZZIP
#include <zzip/zzip.h>
#endif
#ifdef WIN32
#define stat(...) _stat(__VA_ARGS__)
#define S_IFMT _S_IFMT
#define S_IFREG _S_IFREG
#endif
ROMReader_struct * ROMReaderInit(char ** filename)
{
#ifdef HAVE_LIBZ
if(!strcasecmp(".gz", *filename + (strlen(*filename) - 3)))
{
(*filename)[strlen(*filename) - 3] = '\0';
return &GZIPROMReader;
}
#endif
#ifdef HAVE_LIBZZIP
if (!strcasecmp(".zip", *filename + (strlen(*filename) - 4)))
{
(*filename)[strlen(*filename) - 4] = '\0';
return &ZIPROMReader;
}
#endif
return &STDROMReader;
}
void * STDROMReaderInit(const char * filename);
void STDROMReaderDeInit(void *);
u32 STDROMReaderSize(void *);
int STDROMReaderSeek(void *, int, int);
int STDROMReaderRead(void *, void *, u32);
ROMReader_struct STDROMReader =
{
ROMREADER_STD,
"Standard ROM Reader",
STDROMReaderInit,
STDROMReaderDeInit,
STDROMReaderSize,
STDROMReaderSeek,
STDROMReaderRead
};
void * STDROMReaderInit(const char * filename)
{
#ifdef WIN32
struct _stat sb;
#else
struct stat sb;
#endif
if (stat(filename, &sb) == -1)
return 0;
if ((sb.st_mode & S_IFMT) != S_IFREG)
return 0;
return (void *) fopen(filename, "rb");
}
void STDROMReaderDeInit(void * file)
{
if (!file) return ;
fclose((FILE*)file);
}
u32 STDROMReaderSize(void * file)
{
u32 size;
if (!file) return 0 ;
fseek((FILE*)file, 0, SEEK_END);
size = ftell((FILE*)file);
fseek((FILE*)file, 0, SEEK_SET);
return size;
}
int STDROMReaderSeek(void * file, int offset, int whence)
{
if (!file) return 0 ;
return fseek((FILE*)file, offset, whence);
}
int STDROMReaderRead(void * file, void * buffer, u32 size)
{
if (!file) return 0 ;
return fread(buffer, 1, size, (FILE*)file);
}
#ifdef HAVE_LIBZ
void * GZIPROMReaderInit(const char * filename);
void GZIPROMReaderDeInit(void *);
u32 GZIPROMReaderSize(void *);
int GZIPROMReaderSeek(void *, int, int);
int GZIPROMReaderRead(void *, void *, u32);
ROMReader_struct GZIPROMReader =
{
ROMREADER_GZIP,
"Gzip ROM Reader",
GZIPROMReaderInit,
GZIPROMReaderDeInit,
GZIPROMReaderSize,
GZIPROMReaderSeek,
GZIPROMReaderRead
};
void * GZIPROMReaderInit(const char * filename)
{
return (void*)gzopen(filename, "rb");
}
void GZIPROMReaderDeInit(void * file)
{
gzclose(file);
}
u32 GZIPROMReaderSize(void * file)
{
char useless[1024];
u32 size = 0;
/* FIXME this function should first save the current
* position and restore it after size calculation */
gzrewind(file);
while (gzeof (file) == 0)
size += gzread(file, useless, 1024);
gzrewind(file);
return size;
}
int GZIPROMReaderSeek(void * file, int offset, int whence)
{
return gzseek(file, offset, whence);
}
int GZIPROMReaderRead(void * file, void * buffer, u32 size)
{
return gzread(file, buffer, size);
}
#endif
#ifdef HAVE_LIBZZIP
void * ZIPROMReaderInit(const char * filename);
void ZIPROMReaderDeInit(void *);
u32 ZIPROMReaderSize(void *);
int ZIPROMReaderSeek(void *, int, int);
int ZIPROMReaderRead(void *, void *, u32);
ROMReader_struct ZIPROMReader =
{
ROMREADER_ZIP,
"Zip ROM Reader",
ZIPROMReaderInit,
ZIPROMReaderDeInit,
ZIPROMReaderSize,
ZIPROMReaderSeek,
ZIPROMReaderRead
};
void * ZIPROMReaderInit(const char * filename)
{
ZZIP_DIR * dir = zzip_opendir(filename);
ZZIP_DIRENT * dirent = zzip_readdir(dir);
if (dir != NULL)
{
char tmp1[1024];
char tmp2[1024];
memset(tmp1,0,sizeof(tmp1));
memset(tmp2,0,sizeof(tmp2));
strncpy(tmp1, filename, strlen(filename) - 4);
sprintf(tmp2, "%s/%s", tmp1, dirent->d_name);
return zzip_fopen(tmp2, "rb");
}
return NULL;
}
void ZIPROMReaderDeInit(void * file)
{
zzip_close((ZZIP_FILE*)file);
}
u32 ZIPROMReaderSize(void * file)
{
u32 size;
zzip_seek((ZZIP_FILE*)file, 0, SEEK_END);
size = zzip_tell((ZZIP_FILE*)file);
zzip_seek((ZZIP_FILE*)file, 0, SEEK_SET);
return size;
}
int ZIPROMReaderSeek(void * file, int offset, int whence)
{
return zzip_seek((ZZIP_FILE*)file, offset, whence);
}
int ZIPROMReaderRead(void * file, void * buffer, u32 size)
{
#ifdef ZZIP_OLD_READ
return zzip_read((ZZIP_FILE*)file, (char *) buffer, size);
#else
return zzip_read((ZZIP_FILE*)file, buffer, size);
#endif
}
#endif
/* Copyright 2007 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ROMReader.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#ifdef HAVE_LIBZZIP
#include <zzip/zzip.h>
#endif
#ifdef WIN32
#define stat(...) _stat(__VA_ARGS__)
#define S_IFMT _S_IFMT
#define S_IFREG _S_IFREG
#endif
ROMReader_struct * ROMReaderInit(char ** filename)
{
#ifdef HAVE_LIBZ
if(!strcasecmp(".gz", *filename + (strlen(*filename) - 3)))
{
(*filename)[strlen(*filename) - 3] = '\0';
return &GZIPROMReader;
}
#endif
#ifdef HAVE_LIBZZIP
if (!strcasecmp(".zip", *filename + (strlen(*filename) - 4)))
{
(*filename)[strlen(*filename) - 4] = '\0';
return &ZIPROMReader;
}
#endif
return &STDROMReader;
}
void * STDROMReaderInit(const char * filename);
void STDROMReaderDeInit(void *);
u32 STDROMReaderSize(void *);
int STDROMReaderSeek(void *, int, int);
int STDROMReaderRead(void *, void *, u32);
ROMReader_struct STDROMReader =
{
ROMREADER_STD,
"Standard ROM Reader",
STDROMReaderInit,
STDROMReaderDeInit,
STDROMReaderSize,
STDROMReaderSeek,
STDROMReaderRead
};
void * STDROMReaderInit(const char * filename)
{
#ifdef WIN32
struct _stat sb;
#else
struct stat sb;
#endif
if (stat(filename, &sb) == -1)
return 0;
if ((sb.st_mode & S_IFMT) != S_IFREG)
return 0;
return (void *) fopen(filename, "rb");
}
void STDROMReaderDeInit(void * file)
{
if (!file) return ;
fclose((FILE*)file);
}
u32 STDROMReaderSize(void * file)
{
u32 size;
if (!file) return 0 ;
fseek((FILE*)file, 0, SEEK_END);
size = ftell((FILE*)file);
fseek((FILE*)file, 0, SEEK_SET);
return size;
}
int STDROMReaderSeek(void * file, int offset, int whence)
{
if (!file) return 0 ;
return fseek((FILE*)file, offset, whence);
}
int STDROMReaderRead(void * file, void * buffer, u32 size)
{
if (!file) return 0 ;
return fread(buffer, 1, size, (FILE*)file);
}
#ifdef HAVE_LIBZ
void * GZIPROMReaderInit(const char * filename);
void GZIPROMReaderDeInit(void *);
u32 GZIPROMReaderSize(void *);
int GZIPROMReaderSeek(void *, int, int);
int GZIPROMReaderRead(void *, void *, u32);
ROMReader_struct GZIPROMReader =
{
ROMREADER_GZIP,
"Gzip ROM Reader",
GZIPROMReaderInit,
GZIPROMReaderDeInit,
GZIPROMReaderSize,
GZIPROMReaderSeek,
GZIPROMReaderRead
};
void * GZIPROMReaderInit(const char * filename)
{
return (void*)gzopen(filename, "rb");
}
void GZIPROMReaderDeInit(void * file)
{
gzclose(file);
}
u32 GZIPROMReaderSize(void * file)
{
char useless[1024];
u32 size = 0;
/* FIXME this function should first save the current
* position and restore it after size calculation */
gzrewind(file);
while (gzeof (file) == 0)
size += gzread(file, useless, 1024);
gzrewind(file);
return size;
}
int GZIPROMReaderSeek(void * file, int offset, int whence)
{
return gzseek(file, offset, whence);
}
int GZIPROMReaderRead(void * file, void * buffer, u32 size)
{
return gzread(file, buffer, size);
}
#endif
#ifdef HAVE_LIBZZIP
void * ZIPROMReaderInit(const char * filename);
void ZIPROMReaderDeInit(void *);
u32 ZIPROMReaderSize(void *);
int ZIPROMReaderSeek(void *, int, int);
int ZIPROMReaderRead(void *, void *, u32);
ROMReader_struct ZIPROMReader =
{
ROMREADER_ZIP,
"Zip ROM Reader",
ZIPROMReaderInit,
ZIPROMReaderDeInit,
ZIPROMReaderSize,
ZIPROMReaderSeek,
ZIPROMReaderRead
};
void * ZIPROMReaderInit(const char * filename)
{
ZZIP_DIR * dir = zzip_opendir(filename);
ZZIP_DIRENT * dirent = zzip_readdir(dir);
if (dir != NULL)
{
char tmp1[1024];
char tmp2[1024];
memset(tmp1,0,sizeof(tmp1));
memset(tmp2,0,sizeof(tmp2));
strncpy(tmp1, filename, strlen(filename) - 4);
sprintf(tmp2, "%s/%s", tmp1, dirent->d_name);
return zzip_fopen(tmp2, "rb");
}
return NULL;
}
void ZIPROMReaderDeInit(void * file)
{
zzip_close((ZZIP_FILE*)file);
}
u32 ZIPROMReaderSize(void * file)
{
u32 size;
zzip_seek((ZZIP_FILE*)file, 0, SEEK_END);
size = zzip_tell((ZZIP_FILE*)file);
zzip_seek((ZZIP_FILE*)file, 0, SEEK_SET);
return size;
}
int ZIPROMReaderSeek(void * file, int offset, int whence)
{
return zzip_seek((ZZIP_FILE*)file, offset, whence);
}
int ZIPROMReaderRead(void * file, void * buffer, u32 size)
{
#ifdef ZZIP_OLD_READ
return zzip_read((ZZIP_FILE*)file, (char *) buffer, size);
#else
return zzip_read((ZZIP_FILE*)file, buffer, size);
#endif
}
#endif

View File

@ -1,51 +1,51 @@
/* Copyright 2007 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
#include <string.h>
#include "types.h"
#define ROMREADER_DEFAULT -1
#define ROMREADER_STD 0
#define ROMREADER_GZIP 1
#define ROMREADER_ZIP 2
typedef struct
{
int id;
const char * Name;
void * (*Init)(const char * filename);
void (*DeInit)(void * file);
u32 (*Size)(void * file);
int (*Seek)(void * file, int offset, int whence);
int (*Read)(void * file, void * buffer, u32 size);
} ROMReader_struct;
extern ROMReader_struct STDROMReader;
#ifdef HAVE_LIBZ
extern ROMReader_struct GZIPROMReader;
#endif
#ifdef HAVE_LIBZZIP
extern ROMReader_struct ZIPROMReader;
#endif
ROMReader_struct * ROMReaderInit(char ** filename);
/* Copyright 2007 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
#include <string.h>
#include "types.h"
#define ROMREADER_DEFAULT -1
#define ROMREADER_STD 0
#define ROMREADER_GZIP 1
#define ROMREADER_ZIP 2
typedef struct
{
int id;
const char * Name;
void * (*Init)(const char * filename);
void (*DeInit)(void * file);
u32 (*Size)(void * file);
int (*Seek)(void * file, int offset, int whence);
int (*Read)(void * file, void * buffer, u32 size);
} ROMReader_struct;
extern ROMReader_struct STDROMReader;
#ifdef HAVE_LIBZ
extern ROMReader_struct GZIPROMReader;
#endif
#ifdef HAVE_LIBZZIP
extern ROMReader_struct ZIPROMReader;
#endif
ROMReader_struct * ROMReaderInit(char ** filename);

File diff suppressed because it is too large Load Diff

View File

@ -1,168 +1,168 @@
/* SPU.h
Copyright 2006 Theo Berkau
Copyright (C) 2006-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SPU_H
#define SPU_H
#include "types.h"
#include "matrix.h"
#include <iosfwd>
#include <string>
#include <assert.h>
#define SNDCORE_DEFAULT -1
#define SNDCORE_DUMMY 0
#define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1
static FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
static FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
}
enum SPUInterpolationMode
{
SPUInterpolation_None = 0,
SPUInterpolation_Linear = 1,
SPUInterpolation_Cosine = 2
};
struct SoundInterface_struct
{
int id;
const char *Name;
int (*Init)(int buffersize);
void (*DeInit)();
void (*UpdateAudio)(s16 *buffer, u32 num_samples);
u32 (*GetAudioSpace)();
void (*MuteAudio)();
void (*UnMuteAudio)();
void (*SetVolume)(int volume);
};
extern SoundInterface_struct SNDDummy;
extern SoundInterface_struct SNDFile;
extern int SPU_currentCoreNum;
class ADPCMCacheItem;
struct channel_struct
{
channel_struct()
: cacheItem(NULL)
{}
int num;
u8 vol;
u8 datashift;
u8 hold;
u8 pan;
u8 waveduty;
u8 repeat;
u8 format;
u8 status;
u32 addr;
u16 timer;
u16 loopstart;
u32 length;
u32 totlength;
double double_totlength_shifted;
union {
s8 *buf8;
s16 *buf16;
};
double sampcnt;
double sampinc;
// ADPCM specific
u32 lastsampcnt;
s16 pcm16b, pcm16b_last;
int index;
u16 x;
s16 psgnoise_last;
ADPCMCacheItem *cacheItem;
} ;
class SPU_struct
{
public:
SPU_struct(int buffersize);
u32 bufpos;
u32 buflength;
s32 *sndbuf;
s16 *outbuf;
u32 bufsize;
channel_struct channels[16];
void reset();
~SPU_struct();
void KeyOn(int channel);
void WriteByte(u32 addr, u8 val);
void WriteWord(u32 addr, u16 val);
void WriteLong(u32 addr, u32 val);
//kills all channels but leaves SPU otherwise running normally
void ShutUp();
};
int SPU_ChangeSoundCore(int coreid, int buffersize);
SoundInterface_struct *SPU_SoundCore();
int SPU_Init(int coreid, int buffersize);
void SPU_Pause(int pause);
void SPU_SetVolume(int volume);
void SPU_Reset(void);
void SPU_DeInit(void);
void SPU_KeyOn(int channel);
void SPU_WriteByte(u32 addr, u8 val);
void SPU_WriteWord(u32 addr, u16 val);
void SPU_WriteLong(u32 addr, u32 val);
u32 SPU_ReadLong(u32 addr);
void SPU_Emulate_core(void);
void SPU_Emulate_user(void);
extern SPU_struct *SPU_core, *SPU_user;
extern int spu_core_samples;
void spu_savestate(std::ostream* os);
bool spu_loadstate(std::istream* is, int size);
class WavWriter
{
public:
WavWriter();
bool open(const std::string & fname);
void close();
void update(void* soundData, int numSamples);
bool isRecording() const;
private:
FILE *spufp;
};
void WAV_End();
bool WAV_Begin(const char* fname);
bool WAV_IsRecording();
void WAV_WavSoundUpdate(void* soundData, int numSamples);
#endif
/* SPU.h
Copyright 2006 Theo Berkau
Copyright (C) 2006-2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SPU_H
#define SPU_H
#include "types.h"
#include "matrix.h"
#include <iosfwd>
#include <string>
#include <assert.h>
#define SNDCORE_DEFAULT -1
#define SNDCORE_DUMMY 0
#define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1
static FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
static FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
}
enum SPUInterpolationMode
{
SPUInterpolation_None = 0,
SPUInterpolation_Linear = 1,
SPUInterpolation_Cosine = 2
};
struct SoundInterface_struct
{
int id;
const char *Name;
int (*Init)(int buffersize);
void (*DeInit)();
void (*UpdateAudio)(s16 *buffer, u32 num_samples);
u32 (*GetAudioSpace)();
void (*MuteAudio)();
void (*UnMuteAudio)();
void (*SetVolume)(int volume);
};
extern SoundInterface_struct SNDDummy;
extern SoundInterface_struct SNDFile;
extern int SPU_currentCoreNum;
class ADPCMCacheItem;
struct channel_struct
{
channel_struct()
: cacheItem(NULL)
{}
int num;
u8 vol;
u8 datashift;
u8 hold;
u8 pan;
u8 waveduty;
u8 repeat;
u8 format;
u8 status;
u32 addr;
u16 timer;
u16 loopstart;
u32 length;
u32 totlength;
double double_totlength_shifted;
union {
s8 *buf8;
s16 *buf16;
};
double sampcnt;
double sampinc;
// ADPCM specific
u32 lastsampcnt;
s16 pcm16b, pcm16b_last;
int index;
u16 x;
s16 psgnoise_last;
ADPCMCacheItem *cacheItem;
} ;
class SPU_struct
{
public:
SPU_struct(int buffersize);
u32 bufpos;
u32 buflength;
s32 *sndbuf;
s16 *outbuf;
u32 bufsize;
channel_struct channels[16];
void reset();
~SPU_struct();
void KeyOn(int channel);
void WriteByte(u32 addr, u8 val);
void WriteWord(u32 addr, u16 val);
void WriteLong(u32 addr, u32 val);
//kills all channels but leaves SPU otherwise running normally
void ShutUp();
};
int SPU_ChangeSoundCore(int coreid, int buffersize);
SoundInterface_struct *SPU_SoundCore();
int SPU_Init(int coreid, int buffersize);
void SPU_Pause(int pause);
void SPU_SetVolume(int volume);
void SPU_Reset(void);
void SPU_DeInit(void);
void SPU_KeyOn(int channel);
void SPU_WriteByte(u32 addr, u8 val);
void SPU_WriteWord(u32 addr, u16 val);
void SPU_WriteLong(u32 addr, u32 val);
u32 SPU_ReadLong(u32 addr);
void SPU_Emulate_core(void);
void SPU_Emulate_user(void);
extern SPU_struct *SPU_core, *SPU_user;
extern int spu_core_samples;
void spu_savestate(std::ostream* os);
bool spu_loadstate(std::istream* is, int size);
class WavWriter
{
public:
WavWriter();
bool open(const std::string & fname);
void close();
void update(void* soundData, int numSamples);
bool isRecording() const;
private:
FILE *spufp;
};
void WAV_End();
bool WAV_Begin(const char* fname);
bool WAV_IsRecording();
void WAV_WavSoundUpdate(void* soundData, int numSamples);
#endif

View File

@ -1,81 +1,81 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "addons.h"
#include <string>
std::string CFlash_Path;
ADDON_CFLASH_MODE CFlash_Mode;
//char CFlashName[MAX_PATH];
//char CFlashPath[MAX_PATH];
//u8 CFlashUseRomPath = TRUE;
//u8 CFlashUsePath = TRUE;
char GBAgameName[MAX_PATH];
extern ADDONINTERFACE addonNone;
extern ADDONINTERFACE addonCFlash;
extern ADDONINTERFACE addonRumblePak;
extern ADDONINTERFACE addonGBAgame;
extern ADDONINTERFACE addonGuitarGrip;
//extern ADDONINTERFACE addonExternalMic;
ADDONINTERFACE addonList[NDS_ADDON_COUNT] = {
addonNone,
addonCFlash,
addonRumblePak,
addonGBAgame,
addonGuitarGrip
};
ADDONINTERFACE addon = addonCFlash; // default none pak
u8 addon_type = NDS_ADDON_CFLASH;
BOOL addonsInit()
{
return addon.init();
}
void addonsClose()
{
addon.close();
}
void addonsReset()
{
addon.reset();
}
BOOL addonsChangePak(u8 type)
{
printf("addonsChangePak\n");
if (type > NDS_ADDON_COUNT) return FALSE;
addon.close();
addon = addonList[type];
addon_type = type;
return addon.init();
}
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "addons.h"
#include <string>
std::string CFlash_Path;
ADDON_CFLASH_MODE CFlash_Mode;
//char CFlashName[MAX_PATH];
//char CFlashPath[MAX_PATH];
//u8 CFlashUseRomPath = TRUE;
//u8 CFlashUsePath = TRUE;
char GBAgameName[MAX_PATH];
extern ADDONINTERFACE addonNone;
extern ADDONINTERFACE addonCFlash;
extern ADDONINTERFACE addonRumblePak;
extern ADDONINTERFACE addonGBAgame;
extern ADDONINTERFACE addonGuitarGrip;
//extern ADDONINTERFACE addonExternalMic;
ADDONINTERFACE addonList[NDS_ADDON_COUNT] = {
addonNone,
addonCFlash,
addonRumblePak,
addonGBAgame,
addonGuitarGrip
};
ADDONINTERFACE addon = addonCFlash; // default none pak
u8 addon_type = NDS_ADDON_CFLASH;
BOOL addonsInit()
{
return addon.init();
}
void addonsClose()
{
addon.close();
}
void addonsReset()
{
addon.reset();
}
BOOL addonsChangePak(u8 type)
{
printf("addonsChangePak\n");
if (type > NDS_ADDON_COUNT) return FALSE;
addon.close();
addon = addonList[type];
addon_type = type;
return addon.init();
}

View File

@ -1,96 +1,96 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __ADDONS_H__
#define __ADDONS_H__
#include "common.h"
#include "types.h"
#include "debug.h"
typedef struct
{
// The name of the plugin, this name will appear in the plugins list
const char * name;
//called once when the plugin starts up
BOOL (*init)(void);
//called when the emulator resets
void (*reset)(void);
//called when the plugin shuts down
void (*close)(void);
//called when the user configurating plugin
void (*config)(void);
//called when the emulator write to addon
void (*write08)(u32 adr, u8 val);
void (*write16)(u32 adr, u16 val);
void (*write32)(u32 adr, u32 val);
//called when the emulator read from addon
u8 (*read08)(u32 adr);
u16 (*read16)(u32 adr);
u32 (*read32)(u32 adr);
//called when the user get info about addon pak (description)
void (*info)(char *info);
} ADDONINTERFACE;
enum {
NDS_ADDON_NONE,
NDS_ADDON_CFLASH, // compact flash
NDS_ADDON_RUMBLEPAK, // rumble pack
NDS_ADDON_GBAGAME, // gba game in slot
NDS_ADDON_GUITARGRIP, // Guitar Grip
//NDS_ADDON_EXTERNALMIC,
NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!!
};
enum ADDON_CFLASH_MODE
{
ADDON_CFLASH_MODE_Path, ADDON_CFLASH_MODE_File, ADDON_CFLASH_MODE_RomPath
};
extern ADDON_CFLASH_MODE CFlash_Mode;
extern std::string CFlash_Path;
inline bool CFlash_IsUsingPath() { return CFlash_Mode==ADDON_CFLASH_MODE_Path || CFlash_Mode==ADDON_CFLASH_MODE_RomPath; }
extern ADDONINTERFACE addon; // current pak
extern ADDONINTERFACE addonList[NDS_ADDON_COUNT]; // lists pointer on paks
extern u8 addon_type; // current type pak
extern char GBAgameName[MAX_PATH]; // file name for GBA game (rom)
extern void (*FeedbackON)(BOOL enable); // feedback on/off
extern BOOL addonsInit(); // Init addons
extern void addonsClose(); // Shutdown addons
extern void addonsReset(); // Reset addon
extern BOOL addonsChangePak(u8 type); // change current adddon
extern void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue); // Guitar grip keys
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __ADDONS_H__
#define __ADDONS_H__
#include "common.h"
#include "types.h"
#include "debug.h"
typedef struct
{
// The name of the plugin, this name will appear in the plugins list
const char * name;
//called once when the plugin starts up
BOOL (*init)(void);
//called when the emulator resets
void (*reset)(void);
//called when the plugin shuts down
void (*close)(void);
//called when the user configurating plugin
void (*config)(void);
//called when the emulator write to addon
void (*write08)(u32 adr, u8 val);
void (*write16)(u32 adr, u16 val);
void (*write32)(u32 adr, u32 val);
//called when the emulator read from addon
u8 (*read08)(u32 adr);
u16 (*read16)(u32 adr);
u32 (*read32)(u32 adr);
//called when the user get info about addon pak (description)
void (*info)(char *info);
} ADDONINTERFACE;
enum {
NDS_ADDON_NONE,
NDS_ADDON_CFLASH, // compact flash
NDS_ADDON_RUMBLEPAK, // rumble pack
NDS_ADDON_GBAGAME, // gba game in slot
NDS_ADDON_GUITARGRIP, // Guitar Grip
//NDS_ADDON_EXTERNALMIC,
NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!!
};
enum ADDON_CFLASH_MODE
{
ADDON_CFLASH_MODE_Path, ADDON_CFLASH_MODE_File, ADDON_CFLASH_MODE_RomPath
};
extern ADDON_CFLASH_MODE CFlash_Mode;
extern std::string CFlash_Path;
inline bool CFlash_IsUsingPath() { return CFlash_Mode==ADDON_CFLASH_MODE_Path || CFlash_Mode==ADDON_CFLASH_MODE_RomPath; }
extern ADDONINTERFACE addon; // current pak
extern ADDONINTERFACE addonList[NDS_ADDON_COUNT]; // lists pointer on paks
extern u8 addon_type; // current type pak
extern char GBAgameName[MAX_PATH]; // file name for GBA game (rom)
extern void (*FeedbackON)(BOOL enable); // feedback on/off
extern BOOL addonsInit(); // Init addons
extern void addonsClose(); // Shutdown addons
extern void addonsReset(); // Reset addon
extern BOOL addonsChangePak(u8 type); // change current adddon
extern void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue); // Guitar grip keys
#endif

View File

@ -1,133 +1,133 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include "../mem.h"
#include <string.h>
#include "../MMU.h"
//SRAM is going to be stored just above the rom.
//that is convenient for us, since it mirrors the nds memory map
static u8 *GBArom = NULL;
#define GBA_ROMSIZE (32 * 1024 * 1024)
#define GBA_RAMSIZE (64 * 1024)
#define GBA_SIZE (GBA_ROMSIZE+GBA_RAMSIZE)
static BOOL GBAgame_init(void)
{
GBArom = new u8 [GBA_SIZE];
return (TRUE);
}
static void GBAgame_reset(void)
{
memset(GBArom, 0, GBA_SIZE);
if (!strlen(GBAgameName)) return;
FILE *fgame = 0;
fgame = fopen(GBAgameName,"rb");
if (!fgame) return;
INFO("Loaded \"%s\" in GBA slot\n", GBAgameName);
fseek(fgame, 0, SEEK_END);
u32 size = ftell(fgame);
rewind(fgame);
if (!fread(GBArom, 1, size, fgame))
{
fclose(fgame);
return;
}
fclose(fgame);
//try loading the sram
char * dot = strrchr(GBAgameName,'.');
if(!dot) return;
std::string sram_fname = GBAgameName;
sram_fname.resize(dot-GBAgameName);
sram_fname += ".sav";
fgame = fopen(sram_fname.c_str(),"rb");
if(fgame)
{
fread(GBArom+GBA_ROMSIZE,1,GBA_RAMSIZE,fgame);
fclose(fgame);
}
}
static void GBAgame_close(void)
{
delete[] GBArom;
GBArom = NULL;
}
static void GBAgame_config(void) {}
static void GBAgame_write08(u32 adr, u8 val){}
static void GBAgame_write16(u32 adr, u16 val) {}
static void GBAgame_write32(u32 adr, u32 val) {}
static u8 GBAgame_read08(u32 adr)
{
//INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]];
return (u8)T1ReadByte(GBArom, (adr - 0x08000000));
}
static u16 GBAgame_read16(u32 adr)
{
//INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u16)T1ReadWord(GBArom, (adr - 0x08000000));
}
static u32 GBAgame_read32(u32 adr)
{
//INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u32)T1ReadLong(GBArom, (adr - 0x08000000));
}
static void GBAgame_info(char *info)
{
strcpy(info, "GBA game in slot");
}
ADDONINTERFACE addonGBAgame = {
"GBA game",
GBAgame_init,
GBAgame_reset,
GBAgame_close,
GBAgame_config,
GBAgame_write08,
GBAgame_write16,
GBAgame_write32,
GBAgame_read08,
GBAgame_read16,
GBAgame_read32,
GBAgame_info};
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include "../mem.h"
#include <string.h>
#include "../MMU.h"
//SRAM is going to be stored just above the rom.
//that is convenient for us, since it mirrors the nds memory map
static u8 *GBArom = NULL;
#define GBA_ROMSIZE (32 * 1024 * 1024)
#define GBA_RAMSIZE (64 * 1024)
#define GBA_SIZE (GBA_ROMSIZE+GBA_RAMSIZE)
static BOOL GBAgame_init(void)
{
GBArom = new u8 [GBA_SIZE];
return (TRUE);
}
static void GBAgame_reset(void)
{
memset(GBArom, 0, GBA_SIZE);
if (!strlen(GBAgameName)) return;
FILE *fgame = 0;
fgame = fopen(GBAgameName,"rb");
if (!fgame) return;
INFO("Loaded \"%s\" in GBA slot\n", GBAgameName);
fseek(fgame, 0, SEEK_END);
u32 size = ftell(fgame);
rewind(fgame);
if (!fread(GBArom, 1, size, fgame))
{
fclose(fgame);
return;
}
fclose(fgame);
//try loading the sram
char * dot = strrchr(GBAgameName,'.');
if(!dot) return;
std::string sram_fname = GBAgameName;
sram_fname.resize(dot-GBAgameName);
sram_fname += ".sav";
fgame = fopen(sram_fname.c_str(),"rb");
if(fgame)
{
fread(GBArom+GBA_ROMSIZE,1,GBA_RAMSIZE,fgame);
fclose(fgame);
}
}
static void GBAgame_close(void)
{
delete[] GBArom;
GBArom = NULL;
}
static void GBAgame_config(void) {}
static void GBAgame_write08(u32 adr, u8 val){}
static void GBAgame_write16(u32 adr, u16 val) {}
static void GBAgame_write32(u32 adr, u32 val) {}
static u8 GBAgame_read08(u32 adr)
{
//INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]];
return (u8)T1ReadByte(GBArom, (adr - 0x08000000));
}
static u16 GBAgame_read16(u32 adr)
{
//INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u16)T1ReadWord(GBArom, (adr - 0x08000000));
}
static u32 GBAgame_read32(u32 adr)
{
//INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u32)T1ReadLong(GBArom, (adr - 0x08000000));
}
static void GBAgame_info(char *info)
{
strcpy(info, "GBA game in slot");
}
ADDONINTERFACE addonGBAgame = {
"GBA game",
GBAgame_init,
GBAgame_reset,
GBAgame_close,
GBAgame_config,
GBAgame_write08,
GBAgame_write16,
GBAgame_write32,
GBAgame_read08,
GBAgame_read16,
GBAgame_read32,
GBAgame_info};

View File

@ -1,52 +1,52 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include <string.h>
static BOOL None_init(void) { return (TRUE); }
static void None_reset(void) {}
static void None_close(void) {}
static void None_config(void) {}
static void None_write08(u32 adr, u8 val) {}
static void None_write16(u32 adr, u16 val) {}
static void None_write32(u32 adr, u32 val) {}
static u8 None_read08(u32 adr){ return (0); }
static u16 None_read16(u32 adr){ return (0); }
static u32 None_read32(u32 adr){ return (0); }
static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }
ADDONINTERFACE addonNone = {
"NONE",
None_init,
None_reset,
None_close,
None_config,
None_write08,
None_write16,
None_write32,
None_read08,
None_read16,
None_read32,
None_info};
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include <string.h>
static BOOL None_init(void) { return (TRUE); }
static void None_reset(void) {}
static void None_close(void) {}
static void None_config(void) {}
static void None_write08(u32 adr, u8 val) {}
static void None_write16(u32 adr, u16 val) {}
static void None_write32(u32 adr, u32 val) {}
static u8 None_read08(u32 adr){ return (0); }
static u16 None_read16(u32 adr){ return (0); }
static u32 None_read32(u32 adr){ return (0); }
static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }
ADDONINTERFACE addonNone = {
"NONE",
None_init,
None_reset,
None_close,
None_config,
None_write08,
None_write16,
None_write32,
None_read08,
None_read16,
None_read32,
None_info};

View File

@ -1,97 +1,97 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include "../mem.h"
#include "../MMU.h"
#include <string.h>
void (*FeedbackON)(BOOL enable) = NULL;
static BOOL RumblePak_init(void) { return (TRUE); }
static void RumblePak_reset(void)
{
}
static void RumblePak_close(void) {}
static void RumblePak_config(void) {}
static void RumblePak_write08(u32 adr, u8 val)
{
}
static void RumblePak_write16(u32 adr, u16 val)
{
if (!FeedbackON) return;
// CrazyMax 17/01/2009
// i don't know how send to feedback (PC) impulse with small latency.
if (adr == 0x08000000)
FeedbackON(val);
if (adr == 0x08001000)
FeedbackON(val);
}
static void RumblePak_write32(u32 adr, u32 val)
{
}
static u8 RumblePak_read08(u32 adr)
{
return (0);
}
static u16 RumblePak_read16(u32 adr)
{
u16 val = ( (adr & 0x1FFFF) >> 1 ) & 0xFFFD;
if (adr == 0x0801FFFE) val = 0x005D; // hack!!! anybody have docs for RumblePak?
return ((u16)val);
}
static u32 RumblePak_read32(u32 adr)
{
return (0);
}
static void RumblePak_info(char *info)
{
strcpy(info, "NDS Rumble Pak (need joystick with Feedback)");
}
ADDONINTERFACE addonRumblePak = {
"Rumble Pak",
RumblePak_init,
RumblePak_reset,
RumblePak_close,
RumblePak_config,
RumblePak_write08,
RumblePak_write16,
RumblePak_write32,
RumblePak_read08,
RumblePak_read16,
RumblePak_read32,
RumblePak_info};
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../addons.h"
#include "../mem.h"
#include "../MMU.h"
#include <string.h>
void (*FeedbackON)(BOOL enable) = NULL;
static BOOL RumblePak_init(void) { return (TRUE); }
static void RumblePak_reset(void)
{
}
static void RumblePak_close(void) {}
static void RumblePak_config(void) {}
static void RumblePak_write08(u32 adr, u8 val)
{
}
static void RumblePak_write16(u32 adr, u16 val)
{
if (!FeedbackON) return;
// CrazyMax 17/01/2009
// i don't know how send to feedback (PC) impulse with small latency.
if (adr == 0x08000000)
FeedbackON(val);
if (adr == 0x08001000)
FeedbackON(val);
}
static void RumblePak_write32(u32 adr, u32 val)
{
}
static u8 RumblePak_read08(u32 adr)
{
return (0);
}
static u16 RumblePak_read16(u32 adr)
{
u16 val = ( (adr & 0x1FFFF) >> 1 ) & 0xFFFD;
if (adr == 0x0801FFFE) val = 0x005D; // hack!!! anybody have docs for RumblePak?
return ((u16)val);
}
static u32 RumblePak_read32(u32 adr)
{
return (0);
}
static void RumblePak_info(char *info)
{
strcpy(info, "NDS Rumble Pak (need joystick with Feedback)");
}
ADDONINTERFACE addonRumblePak = {
"Rumble Pak",
RumblePak_init,
RumblePak_reset,
RumblePak_close,
RumblePak_config,
RumblePak_write08,
RumblePak_write16,
RumblePak_write32,
RumblePak_read08,
RumblePak_read16,
RumblePak_read32,
RumblePak_info};

View File

@ -144,7 +144,7 @@ void Agg_init()
aggDraw.target = targets[0];
//if we're single core, we don't want to waste time compositing
if(CommonSettings.single_core)
//if(CommonSettings.single_core)
aggDraw.hud = &agg_targetScreen;
//and the more clever compositing isnt supported in non-windows

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,32 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ARMINSTRUCTION_H
#define ARMINSTRUCTION_H
#include "types.h"
#include "armcpu.h"
extern u32 (FASTCALL* arm_instructions_set_0[4096])();
extern u32 (FASTCALL* arm_instructions_set_1[4096])();
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ARMINSTRUCTION_H
#define ARMINSTRUCTION_H
#include "types.h"
#include "armcpu.h"
extern u32 (FASTCALL* arm_instructions_set_0[4096])();
extern u32 (FASTCALL* arm_instructions_set_1[4096])();
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,278 +1,280 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ARM_CPU
#define ARM_CPU
#include "types.h"
#include "bits.h"
#include "MMU.h"
#define CODE(i) (((i)>>25)&0x7)
#define OPCODE(i) (((i)>>21)&0xF)
#define SIGNEBIT(i) BIT_N(i,20)
#define INSTRUCTION_INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
inline u32 ROR(u32 i, u32 j) { return ((((u32)(i))>>(j)) | (((u32)(i))<<(32-(j)))); }
template<typename T>
inline T UNSIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)) |
((BIT31(a)|BIT31(b))&BIT31(~c))); }
template<typename T>
inline T UNSIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(~a)&BIT31(b)) |
((BIT31(~a)|BIT31(b))&BIT31(c))); }
template<typename T>
inline T SIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)&BIT31(~c))|
(BIT31(~a)&BIT31(~(b))&BIT31(c))); }
template<typename T>
inline T SIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(~(b))&BIT31(~c))|
(BIT31(~a)&BIT31(b)&BIT31(c))); }
//zero 15-feb-2009 - these werent getting used and they were getting in my way
//#define EQ 0x0
//#define NE 0x1
//#define CS 0x2
//#define CC 0x3
//#define MI 0x4
//#define PL 0x5
//#define VS 0x6
//#define VC 0x7
//#define HI 0x8
//#define LS 0x9
//#define GE 0xA
//#define LT 0xB
//#define GT 0xC
//#define LE 0xD
//#define AL 0xE
extern const unsigned char arm_cond_table[16*16];
#define TEST_COND(cond, inst, CPSR) ((arm_cond_table[((CPSR.val >> 24) & 0xf0)+(cond)] >> (inst)) & 1)
enum Mode
{
USR = 0x10,
FIQ = 0x11,
IRQ = 0x12,
SVC = 0x13,
ABT = 0x17,
UND = 0x1B,
SYS = 0x1F
};
#ifdef WORDS_BIGENDIAN
typedef union
{
struct
{
u32 N : 1,
Z : 1,
C : 1,
V : 1,
Q : 1,
RAZ : 19,
I : 1,
F : 1,
T : 1,
mode : 5;
} bits;
u32 val;
} Status_Reg;
#else
typedef union
{
struct
{
u32 mode : 5,
T : 1,
F : 1,
I : 1,
RAZ : 19,
Q : 1,
V : 1,
C : 1,
Z : 1,
N : 1;
} bits;
u32 val;
} Status_Reg;
#endif
/**
* The control interface to a CPU
*/
struct armcpu_ctrl_iface {
/** stall the processor */
void (*stall)( void *instance);
/** unstall the processor */
void (*unstall)( void *instance);
/** read a register value */
u32 (*read_reg)( void *instance, u32 reg_num);
/** set a register value */
void (*set_reg)( void *instance, u32 reg_num, u32 value);
/** install the post execute function */
void (*install_post_ex_fn)( void *instance,
void (*fn)( void *, u32 adr, int thumb),
void *fn_data);
/** remove the post execute function */
void (*remove_post_ex_fn)( void *instance);
/** the private data passed to all interface functions */
void *data;
};
typedef void* armcp_t;
typedef struct armcpu_t
{
u32 proc_ID;
u32 instruction; //4
u32 instruct_adr; //8
u32 next_instruction; //12
u32 R[16]; //16
Status_Reg CPSR; //80
Status_Reg SPSR;
u32 R13_usr, R14_usr;
u32 R13_svc, R14_svc;
u32 R13_abt, R14_abt;
u32 R13_und, R14_und;
u32 R13_irq, R14_irq;
u32 R8_fiq, R9_fiq, R10_fiq, R11_fiq, R12_fiq, R13_fiq, R14_fiq;
Status_Reg SPSR_svc, SPSR_abt, SPSR_und, SPSR_irq, SPSR_fiq;
armcp_t *coproc[16];
u32 intVector;
u8 LDTBit; //1 : ARMv5 style 0 : non ARMv5
BOOL waitIRQ;
BOOL wIRQ;
BOOL wirq;
u32 newIrqFlags;
u32 (* *swi_tab)();
#ifdef GDB_STUB
/** there is a pending irq for the cpu */
int irq_flag;
/** the post executed function (if installed) */
void (*post_ex_fn)( void *, u32 adr, int thumb);
/** data for the post executed function */
void *post_ex_fn_data;
/** flag indicating if the processor is stalled */
int stalled;
/** the memory interface */
struct armcpu_memory_iface *mem_if;
/** the ctrl interface */
struct armcpu_ctrl_iface ctrl_iface;
#endif
} armcpu_t;
#ifdef GDB_STUB
int armcpu_new( armcpu_t *armcpu, u32 id, struct armcpu_memory_iface *mem_if,
struct armcpu_ctrl_iface **ctrl_iface_ret);
#else
int armcpu_new( armcpu_t *armcpu, u32 id);
#endif
void armcpu_init(armcpu_t *armcpu, u32 adr);
u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode);
template<int PROCNUM> u32 armcpu_exec();
BOOL armcpu_irqException(armcpu_t *armcpu);
BOOL armcpu_flagIrq( armcpu_t *armcpu);
extern armcpu_t NDS_ARM7;
extern armcpu_t NDS_ARM9;
static INLINE void setIF(int PROCNUM, u32 flag)
{
MMU.reg_IF[PROCNUM] |= flag;
if(ARMPROC.waitIRQ)
ARMPROC.newIrqFlags |= flag;
extern void NDS_Reschedule();
NDS_Reschedule();
}
static INLINE void NDS_makeARM9Int(u32 num)
{
/* flag the interrupt request source */
// MMU.reg_IF[0] |= (1<<num);
setIF(0, (1<<num));
/* generate the interrupt if enabled */
if ((MMU.reg_IE[0] & (1 << num)) && MMU.reg_IME[0])
{
NDS_ARM9.wIRQ = TRUE;
NDS_ARM9.waitIRQ = FALSE;
}
}
static INLINE void NDS_makeARM7Int(u32 num)
{
/* flag the interrupt request source */
//MMU.reg_IF[1] |= (1<<num);
setIF(1, (1<<num));
/* generate the interrupt if enabled */
if ((MMU.reg_IE[1] & (1 << num)) && MMU.reg_IME[1])
{
NDS_ARM7.wIRQ = TRUE;
NDS_ARM7.waitIRQ = FALSE;
}
}
static INLINE void NDS_makeInt(u8 proc_ID,u32 num)
{
switch (proc_ID)
{
case 0:
NDS_makeARM9Int(num) ;
break ;
case 1:
NDS_makeARM7Int(num) ;
break ;
}
}
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ARM_CPU
#define ARM_CPU
#define ARMCPU_ARM7 1
#define ARMCPU_ARM9 0
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
#include "types.h"
#include "bits.h"
#include "MMU.h"
#define CODE(i) (((i)>>25)&0x7)
#define OPCODE(i) (((i)>>21)&0xF)
#define SIGNEBIT(i) BIT_N(i,20)
#define INSTRUCTION_INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
inline u32 ROR(u32 i, u32 j) { return ((((u32)(i))>>(j)) | (((u32)(i))<<(32-(j)))); }
template<typename T>
inline T UNSIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)) |
((BIT31(a)|BIT31(b))&BIT31(~c))); }
template<typename T>
inline T UNSIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(~a)&BIT31(b)) |
((BIT31(~a)|BIT31(b))&BIT31(c))); }
template<typename T>
inline T SIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)&BIT31(~c))|
(BIT31(~a)&BIT31(~(b))&BIT31(c))); }
template<typename T>
inline T SIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(~(b))&BIT31(~c))|
(BIT31(~a)&BIT31(b)&BIT31(c))); }
//zero 15-feb-2009 - these werent getting used and they were getting in my way
//#define EQ 0x0
//#define NE 0x1
//#define CS 0x2
//#define CC 0x3
//#define MI 0x4
//#define PL 0x5
//#define VS 0x6
//#define VC 0x7
//#define HI 0x8
//#define LS 0x9
//#define GE 0xA
//#define LT 0xB
//#define GT 0xC
//#define LE 0xD
//#define AL 0xE
extern const unsigned char arm_cond_table[16*16];
#define TEST_COND(cond, inst, CPSR) ((arm_cond_table[((CPSR.val >> 24) & 0xf0)+(cond)] >> (inst)) & 1)
enum Mode
{
USR = 0x10,
FIQ = 0x11,
IRQ = 0x12,
SVC = 0x13,
ABT = 0x17,
UND = 0x1B,
SYS = 0x1F
};
#ifdef WORDS_BIGENDIAN
typedef union
{
struct
{
u32 N : 1,
Z : 1,
C : 1,
V : 1,
Q : 1,
RAZ : 19,
I : 1,
F : 1,
T : 1,
mode : 5;
} bits;
u32 val;
} Status_Reg;
#else
typedef union
{
struct
{
u32 mode : 5,
T : 1,
F : 1,
I : 1,
RAZ : 19,
Q : 1,
V : 1,
C : 1,
Z : 1,
N : 1;
} bits;
u32 val;
} Status_Reg;
#endif
/**
* The control interface to a CPU
*/
struct armcpu_ctrl_iface {
/** stall the processor */
void (*stall)( void *instance);
/** unstall the processor */
void (*unstall)( void *instance);
/** read a register value */
u32 (*read_reg)( void *instance, u32 reg_num);
/** set a register value */
void (*set_reg)( void *instance, u32 reg_num, u32 value);
/** install the post execute function */
void (*install_post_ex_fn)( void *instance,
void (*fn)( void *, u32 adr, int thumb),
void *fn_data);
/** remove the post execute function */
void (*remove_post_ex_fn)( void *instance);
/** the private data passed to all interface functions */
void *data;
};
typedef void* armcp_t;
typedef struct armcpu_t
{
u32 proc_ID;
u32 instruction; //4
u32 instruct_adr; //8
u32 next_instruction; //12
u32 R[16]; //16
Status_Reg CPSR; //80
Status_Reg SPSR;
u32 R13_usr, R14_usr;
u32 R13_svc, R14_svc;
u32 R13_abt, R14_abt;
u32 R13_und, R14_und;
u32 R13_irq, R14_irq;
u32 R8_fiq, R9_fiq, R10_fiq, R11_fiq, R12_fiq, R13_fiq, R14_fiq;
Status_Reg SPSR_svc, SPSR_abt, SPSR_und, SPSR_irq, SPSR_fiq;
armcp_t *coproc[16];
u32 intVector;
u8 LDTBit; //1 : ARMv5 style 0 : non ARMv5
BOOL waitIRQ;
BOOL wIRQ;
BOOL wirq;
u32 newIrqFlags;
u32 (* *swi_tab)();
#ifdef GDB_STUB
/** there is a pending irq for the cpu */
int irq_flag;
/** the post executed function (if installed) */
void (*post_ex_fn)( void *, u32 adr, int thumb);
/** data for the post executed function */
void *post_ex_fn_data;
/** flag indicating if the processor is stalled */
int stalled;
/** the memory interface */
struct armcpu_memory_iface *mem_if;
/** the ctrl interface */
struct armcpu_ctrl_iface ctrl_iface;
#endif
} armcpu_t;
#ifdef GDB_STUB
int armcpu_new( armcpu_t *armcpu, u32 id, struct armcpu_memory_iface *mem_if,
struct armcpu_ctrl_iface **ctrl_iface_ret);
#else
int armcpu_new( armcpu_t *armcpu, u32 id);
#endif
void armcpu_init(armcpu_t *armcpu, u32 adr);
u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode);
template<int PROCNUM> u32 armcpu_exec();
BOOL armcpu_irqException(armcpu_t *armcpu);
BOOL armcpu_flagIrq( armcpu_t *armcpu);
extern armcpu_t NDS_ARM7;
extern armcpu_t NDS_ARM9;
static INLINE void setIF(int PROCNUM, u32 flag)
{
MMU.reg_IF[PROCNUM] |= flag;
if(ARMPROC.waitIRQ)
ARMPROC.newIrqFlags |= flag;
}
static INLINE void NDS_makeARM9Int(u32 num)
{
/* flag the interrupt request source */
// MMU.reg_IF[0] |= (1<<num);
setIF(0, (1<<num));
/* generate the interrupt if enabled */
if ((MMU.reg_IE[0] & (1 << num)) && MMU.reg_IME[0])
{
NDS_ARM9.wIRQ = TRUE;
NDS_ARM9.waitIRQ = FALSE;
}
}
static INLINE void NDS_makeARM7Int(u32 num)
{
/* flag the interrupt request source */
//MMU.reg_IF[1] |= (1<<num);
setIF(1, (1<<num));
/* generate the interrupt if enabled */
if ((MMU.reg_IE[1] & (1 << num)) && MMU.reg_IME[1])
{
NDS_ARM7.wIRQ = TRUE;
NDS_ARM7.waitIRQ = FALSE;
}
}
static INLINE void NDS_makeInt(u8 proc_ID,u32 num)
{
switch (proc_ID)
{
case 0:
NDS_makeARM9Int(num) ;
break ;
case 1:
NDS_makeARM7Int(num) ;
break ;
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,31 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BIOS_H
#define BIOS_H
#include "armcpu.h"
extern u32 (* ARM9_swi_tab[32])();
extern u32 (* ARM7_swi_tab[32])();
#endif
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BIOS_H
#define BIOS_H
#include "armcpu.h"
extern u32 (* ARM9_swi_tab[32])();
extern u32 (* ARM7_swi_tab[32])();
#endif

View File

@ -1,44 +1,44 @@
#ifndef BITS_H
#define BITS_H
#define BIT(n) (1<<(n))
#define BIT_N(i,n) (((i)>>(n))&1)
#define BIT0(i) ((i)&1)
#define BIT1(i) BIT_N(i,1)
#define BIT2(i) BIT_N(i,2)
#define BIT3(i) BIT_N(i,3)
#define BIT4(i) BIT_N(i,4)
#define BIT5(i) BIT_N(i,5)
#define BIT6(i) BIT_N(i,6)
#define BIT7(i) BIT_N(i,7)
#define BIT8(i) BIT_N(i,8)
#define BIT9(i) BIT_N(i,9)
#define BIT10(i) BIT_N(i,10)
#define BIT11(i) BIT_N(i,11)
#define BIT12(i) BIT_N(i,12)
#define BIT13(i) BIT_N(i,13)
#define BIT14(i) BIT_N(i,14)
#define BIT15(i) BIT_N(i,15)
#define BIT16(i) BIT_N(i,16)
#define BIT17(i) BIT_N(i,17)
#define BIT18(i) BIT_N(i,18)
#define BIT19(i) BIT_N(i,19)
#define BIT20(i) BIT_N(i,20)
#define BIT21(i) BIT_N(i,21)
#define BIT22(i) BIT_N(i,22)
#define BIT23(i) BIT_N(i,23)
#define BIT24(i) BIT_N(i,24)
#define BIT25(i) BIT_N(i,25)
#define BIT26(i) BIT_N(i,26)
#define BIT27(i) BIT_N(i,27)
#define BIT28(i) BIT_N(i,28)
#define BIT29(i) BIT_N(i,29)
#define BIT30(i) BIT_N(i,30)
#define BIT31(i) ((i)>>31)
#define CONDITION(i) (i)>>28
#define REG_POS(i,n) (((i)>>n)&0xF)
#endif
#ifndef BITS_H
#define BITS_H
#define BIT(n) (1<<(n))
#define BIT_N(i,n) (((i)>>(n))&1)
#define BIT0(i) ((i)&1)
#define BIT1(i) BIT_N(i,1)
#define BIT2(i) BIT_N(i,2)
#define BIT3(i) BIT_N(i,3)
#define BIT4(i) BIT_N(i,4)
#define BIT5(i) BIT_N(i,5)
#define BIT6(i) BIT_N(i,6)
#define BIT7(i) BIT_N(i,7)
#define BIT8(i) BIT_N(i,8)
#define BIT9(i) BIT_N(i,9)
#define BIT10(i) BIT_N(i,10)
#define BIT11(i) BIT_N(i,11)
#define BIT12(i) BIT_N(i,12)
#define BIT13(i) BIT_N(i,13)
#define BIT14(i) BIT_N(i,14)
#define BIT15(i) BIT_N(i,15)
#define BIT16(i) BIT_N(i,16)
#define BIT17(i) BIT_N(i,17)
#define BIT18(i) BIT_N(i,18)
#define BIT19(i) BIT_N(i,19)
#define BIT20(i) BIT_N(i,20)
#define BIT21(i) BIT_N(i,21)
#define BIT22(i) BIT_N(i,22)
#define BIT23(i) BIT_N(i,23)
#define BIT24(i) BIT_N(i,24)
#define BIT25(i) BIT_N(i,25)
#define BIT26(i) BIT_N(i,26)
#define BIT27(i) BIT_N(i,27)
#define BIT28(i) BIT_N(i,28)
#define BIT29(i) BIT_N(i,29)
#define BIT30(i) BIT_N(i,30)
#define BIT31(i) ((i)>>31)
#define CONDITION(i) (i)>>28
#define REG_POS(i,n) (((i)>>n)&0xF)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +1,71 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "common.h"
#define CHEAT_VERSION_MAJOR 1
#define CHEAT_VERSION_MINOR 3
#define MAX_CHEAT_LIST 100
typedef struct
{
u8 type; // 0 - internal cheat system
// 1 - Action Replay
// 2 - Codebreakers
BOOL enabled;
u32 hi[255];
u32 lo[255];
char description[75];
int num;
u8 size;
} CHEATS_LIST;
extern void cheatsInit(char *path);
extern BOOL cheatsAdd(u8 size, u32 address, u32 val, char *description, BOOL enabled);
extern BOOL cheatsUpdate(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled);
extern BOOL cheatsUpdate_AR(char *code, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled);
extern BOOL cheatsUpdate_CB(char *code, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsRemove(u32 pos);
extern void cheatsGetListReset();
extern BOOL cheatsGetList(CHEATS_LIST *cheat);
extern BOOL cheatsGet(CHEATS_LIST *cheat, u32 pos);
extern u32 cheatsGetSize();
extern BOOL cheatsSave();
extern BOOL cheatsLoad();
extern BOOL cheatsPush();
extern BOOL cheatsPop();
extern void cheatsStackClear();
extern void cheatsProcess();
extern void cheatGetXXcodeString(CHEATS_LIST cheat, char *res_buf);
// ==================================================== cheat search
extern void cheatsSearchInit(u8 type, u8 size, u8 sign);
extern void cheatsSearchClose();
extern u32 cheatsSearchValue(u32 val);
extern u32 cheatsSearchComp(u8 comp);
extern u32 cheatSearchNumber();
extern BOOL cheatSearchGetList(u32 *address, u32 *curVal);
extern void cheatSearchGetListReset();
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "common.h"
#define CHEAT_VERSION_MAJOR 1
#define CHEAT_VERSION_MINOR 3
#define MAX_CHEAT_LIST 100
typedef struct
{
u8 type; // 0 - internal cheat system
// 1 - Action Replay
// 2 - Codebreakers
BOOL enabled;
u32 hi[255];
u32 lo[255];
char description[75];
u8 num;
u8 size;
} CHEATS_LIST;
extern void cheatsInit(char *path);
extern BOOL cheatsAdd(u8 size, u32 address, u32 val, char *description, BOOL enabled);
extern BOOL cheatsUpdate(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled);
extern BOOL cheatsUpdate_AR(char *code, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled);
extern BOOL cheatsUpdate_CB(char *code, char *description, BOOL enabled, u32 pos);
extern BOOL cheatsRemove(u32 pos);
extern void cheatsGetListReset();
extern BOOL cheatsGetList(CHEATS_LIST *cheat);
extern BOOL cheatsGet(CHEATS_LIST *cheat, u32 pos);
extern u32 cheatsGetSize();
extern BOOL cheatsSave();
extern BOOL cheatsLoad();
extern BOOL cheatsPush();
extern BOOL cheatsPop();
extern void cheatsStackClear();
extern void cheatsProcess();
extern void cheatGetXXcodeString(CHEATS_LIST cheat, char *res_buf);
// ==================================================== cheat search
extern void cheatsSearchInit(u8 type, u8 size, u8 sign);
extern void cheatsSearchClose();
extern u32 cheatsSearchValue(u32 val);
extern u32 cheatsSearchComp(u8 comp);
extern u32 cheatSearchNumber();
extern BOOL cheatSearchGetList(u32 *address, u32 *curVal);
extern void cheatSearchGetListReset();

View File

@ -1,11 +1,11 @@
SUBDIRS = doc
include $(top_srcdir)/src/desmume.mk
AM_CPPFLAGS += $(SDL_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) $(GLIB_CFLAGS)
AM_CFLAGS += $(SDL_CFLAGS) $(ALSA_CFLAGS)
bin_PROGRAMS = desmume-cli
desmume_cli_SOURCES = main.cpp ../sndsdl.cpp ../ctrlssdl.h ../ctrlssdl.cpp
desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(GLIB_LIBS)
desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS)
if HAVE_GDB_STUB
desmume_cli_LDADD += ../gdbstub/libgdbstub.a
endif

File diff suppressed because it is too large Load Diff

View File

View File

@ -1,32 +1,32 @@
/* Copyright (C) 2007 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
@class NintendoDS;
//there is only one ROM Info window, so we have only class functions here
@interface ROMInfo : NSObject
{
}
+ (void)showROMInfo:(NintendoDS*)DS;
+ (void)changeDS:(NintendoDS*)DS;
+ (void)closeROMInfo;
@end
/* Copyright (C) 2007 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
@class NintendoDS;
//there is only one ROM Info window, so we have only class functions here
@interface ROMInfo : NSObject
{
}
+ (void)showROMInfo:(NintendoDS*)DS;
+ (void)changeDS:(NintendoDS*)DS;
+ (void)closeROMInfo;
@end

View File

@ -1,33 +1,33 @@
/* Copyright (C) 2008 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#import "../nds_control.h"
@interface SpeedLimitSelectionWindow : NSWindow
{
BOOL modal;
NintendoDS *target;
NSTextField *value;
int initial_value;
}
- (id)initWithDS:(NintendoDS*)ds;
- (void)runModal;
- (void)dealloc;
@end
/* Copyright (C) 2008 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#import "../nds_control.h"
@interface SpeedLimitSelectionWindow : NSWindow
{
BOOL modal;
NintendoDS *target;
NSTextField *value;
int initial_value;
}
- (id)initWithDS:(NintendoDS*)ds;
- (void)runModal;
- (void)dealloc;
@end

View File

@ -1,41 +1,41 @@
/* Copyright (C) 2007 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#ifdef __cplusplus
extern "C"
{
#endif
void messageDialog(NSString *title, NSString *text);
BOOL messageDialogYN(NSString *title, NSString *text);
NSString* openDialog(NSArray *file_types);
//
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
typedef float CGFloat;
#ifdef __cplusplus
}
/* Copyright (C) 2007 Jeff Bland
This file is part of DeSmuME
DeSmuME is free software; you can redistribute 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.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#ifdef __cplusplus
extern "C"
{
#endif
void messageDialog(NSString *title, NSString *text);
BOOL messageDialogYN(NSString *title, NSString *text);
NSString* openDialog(NSArray *file_types);
//
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
typedef float CGFloat;
#ifdef __cplusplus
}
#endif

Some files were not shown because too many files have changed in this diff Show More