Cocoa Port: updated documentation, video output view moved into it's own file, input class added, fixed window resizing bugs, ROM Info interface updated and icon preview added, much improved about window, emulation moved to separate threadd, xcode project file added (compile from xcode or codeblocks)

This commit is contained in:
gecko_reverse 2008-04-01 04:59:52 +00:00
parent 2c1dc2c0e0
commit a50689764a
29 changed files with 4386 additions and 2625 deletions

View File

@ -4,13 +4,16 @@
- Recent Items menu now works. [Jeff B]
- Opening NDS files from Finder now works. [Jeff B]
- Added screenshot feature. [Jeff B]
- Added preferences window. [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]
general:
- Fixed possible segfault in ROMReader on ia64 and amd64. [evilynux]
- Fixed a crash bug with 2D background corrupting memory [shash]

View File

@ -5,15 +5,17 @@
1) Compiling instructions...................................13
2) How to use DeSmuME.......................................51
3) Contact information.....................................166
4) Disclaimer..............................................185
2) How to use DeSmuME.......................................31
3) Contact information......................................67
4) Disclaimer...............................................84
1 Compiling instructions______________________________________
DeSmuME is written in C, and the Cocoa interface was written
in Objective-C. It uses the Cocoa, OpenGL, and zlib libraries.
in Objective-C. It uses the Cocoa, OpenGL, and [optionally]
the zlib library.
So you need a working C and Objective-C compiler, such as
GCC for Mac OS X.
@ -22,27 +24,31 @@ GCC for Mac OS X.
* zlib can be found at http://www.zlib.net, and may
also come with Mac OS X.
DeSmuME for Mac OS X is being developed with the CodeBlocks
IDE, but one may also use Apple's Xcode Interface.
DeSmuME for Mac OS X can be compiled using the XCode IDE
or the CodeBlocks IDE. Project files are available in the
Cocoa source folder.
2 How to use DeSmuME__________________________________________
To install DeSmuME, copy DeSmuME.app into the folder of your
choice (Applications folder is recommended). You can also drag
it to your dock for quicker launching.
Double click the application to launch DeSmuME.
Most options can be found in the menu bar a the top of the
screen. On Leopard, you can use the search box under the help
menu to find things.
DeSmuME for Mac OS X does not support all the features of the
Linux and Windows versions.
To install DeSmuME, copy DeSmuME.app into the folder of your choice
(Applications folder is recommended).
Double click the application to launch DeSmuME.
Most options can be found in the menu's at the top of the screen.
Click the lower screen for DS touch-screen input.
Here are the default key mappings(they may be subject to change):
Up arrow - Up
Left arrow - Left
Down arrow - Down
up arrow - Up
left arrow - Left
down arrow - Down
right arrow - Right
v - A button
b - B button
@ -56,6 +62,8 @@ space - Select button
Shift + F1 (through F10) will save the state with the corresponding number.
F1 (through F10) will load the state with the corresponding number.
NOTE: These key bindings may not be correct on foreign keyboards.
3 Contact information_________________________________________
General inquiries should go to:
@ -73,7 +81,6 @@ If you want to submit a bug report, please run desmume, go into
the "Help" menu, and click on "Submit a bug report". If you're
having trouble with it, please feel free to email.
4 Disclaimer__________________________________________________
This program is free software; you can redistribute it and/or

View File

@ -15,7 +15,7 @@ Developpers:
1 Supported UIs ________________________________________________________________
Although there are 4 UIs, only 3 currently support localization:
windows and gtk-glade.
windows, gtk-glade, and Cocoa (Mac OS X).
To translate DeSmuME, see "Starting a new translation" below.
@ -37,9 +37,9 @@ send us your translation by getting in touch with us: see "Contact Us" below.
1.3 Mac OS X (Cocoa) UI _____________________________________________________
Localization is located within the application bundle (in Finder right click
on DeSmuME and select "Show Package Contents"). Within the Contents/Resources
folder there is a folder for each localization.
Localization files are located within the application bundle (in Finder right
click on DeSmuME and select "Show Package Contents"). Within the
Contents/Resources folder there is a folder for each localization.
2 Starting a new translation ___________________________________________________
@ -66,6 +66,10 @@ send us your translation by getting in touch with us: see "Contact Us" below.
Rename the part before ".lproj" to the language of the translation.
Within your newly created folder edit "Localizable.strings".
The MainMenu.nib opaque folder also contains localization of the Application
menu, however since this is a standard menu in Mac OS X, for most languages
standard strings can be generated by Apple's Interface Builder.
The strings file should stay in UTF-16 encoding (UTF-8 or others may work,
but UTF-16 is preferred).
@ -74,7 +78,7 @@ send us your translation by getting in touch with us: see "Contact Us" below.
Debugging the string file:
If you have Mac OS X developer tools installed, from the console you can type
"plutil FILE", replacing FILE with the name and path of the string file, and
it will tell you if there are any errors (and where).
it will tell you if there are any errors (and on what line).
3 Editors ______________________________________________________________________

View File

@ -11,6 +11,8 @@
<notes>
<![CDATA[DeSmuME
Note that when building DeSmuME with this Code::Blocks project, compatibility may be worse than when building with the XCode project.
Cocoa Port
DeSmuME is free software; you can redistribute it and/or modify
@ -39,7 +41,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Compiler>
<Add option="-march=pentium-m" />
<Add option="-msse2" />
<Add option="-DDESMUME_COCOA" />
</Compiler>
<ExtraCommands>
<Add after="cp DeSmuME.app/Contents/MacOS/DeSmuME DeSmuME.app/Contents/MacOS/DeSmuME_x86" />
@ -54,8 +55,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Option compiler="gcc" />
<Compiler>
<Add option="-arch ppc" />
<Add option="-DDESMUME_COCOA" />
<Add option="-DWORDS_BIGENDIAN" />
</Compiler>
<Linker>
<Add option="-arch ppc" />
@ -71,15 +70,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-O3" />
<Add option="-DDETECT_LEAKS" />
<Add option="-g" />
<Add option="-DDESMUME_COCOA" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-framework Cocoa" />
<Add option="-framework OpenGL" />
<Add option="-framework CoreAudio" />
<Add option="-framework AudioUnit" />
<Add option="-framework AudioToolbox" />
</Linker>
<ExtraCommands>
<Add after="./makeapp.sh" />
@ -133,11 +130,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Unit filename="../cflash.h" />
<Unit filename="English.strings" />
<Unit filename="Japanese.strings" />
<Unit filename="about.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="cocoa_util.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="globals.h" />
<Unit filename="input.h" />
<Unit filename="input.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="main.m">
<Option compile="1" />
<Option link="1" />
@ -152,10 +158,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="preferences.h" />
<Unit filename="preferences.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="rom_info.h" />
<Unit filename="rom_info.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="screenshot.h" />
<Unit filename="screenshot.m">
<Option compile="1" />
@ -166,6 +178,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA]]>
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="video_output_view.h" />
<Unit filename="video_output_view.m">
<Option compile="1" />
<Option link="1" />
</Unit>
<Unit filename="../config.h" />
<Unit filename="../cp15.c">
<Option compilerVar="CC" />

View File

@ -0,0 +1,514 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
7277B62F0D9D9AEA00D283BD /* DeSmuME.icns in Resources */ = {isa = PBXBuildFile; fileRef = 7277B62E0D9D9AEA00D283BD /* DeSmuME.icns */; };
7277B6E30D9E045700D283BD /* English.nib in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6DF0D9E045700D283BD /* English.nib */; };
7277B6E40D9E045700D283BD /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6E00D9E045700D283BD /* English.strings */; };
7277B6E50D9E045700D283BD /* Japanese.nib in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6E10D9E045700D283BD /* Japanese.nib */; };
7277B6E60D9E045700D283BD /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7277B6E20D9E045700D283BD /* Japanese.strings */; };
7277B8EB0D9F25F700D283BD /* about.m in Sources */ = {isa = PBXBuildFile; fileRef = 7277B8EA0D9F25F700D283BD /* about.m */; };
729BEC6F0D9D55DB00ED561B /* cocoa_util.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC5A0D9D55DB00ED561B /* cocoa_util.m */; };
729BEC710D9D55DB00ED561B /* input.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC5E0D9D55DB00ED561B /* input.m */; };
729BEC730D9D55DB00ED561B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC600D9D55DB00ED561B /* main.m */; };
729BEC740D9D55DB00ED561B /* main_window.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC620D9D55DB00ED561B /* main_window.m */; };
729BEC750D9D55DB00ED561B /* nds_control.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC640D9D55DB00ED561B /* nds_control.m */; };
729BEC760D9D55DB00ED561B /* preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC660D9D55DB00ED561B /* preferences.m */; };
729BEC770D9D55DB00ED561B /* rom_info.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC680D9D55DB00ED561B /* rom_info.m */; };
729BEC780D9D55DB00ED561B /* screenshot.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC6A0D9D55DB00ED561B /* screenshot.m */; };
729BEC790D9D55DB00ED561B /* sndOSX.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC6C0D9D55DB00ED561B /* sndOSX.m */; };
729BEC7A0D9D55DB00ED561B /* video_output_view.m in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC6E0D9D55DB00ED561B /* video_output_view.m */; };
729BECCC0D9D57AF00ED561B /* arm_instructions.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC9B0D9D57AF00ED561B /* arm_instructions.c */; };
729BECCD0D9D57AF00ED561B /* armcpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC9D0D9D57AF00ED561B /* armcpu.c */; };
729BECCE0D9D57AF00ED561B /* bios.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BEC9F0D9D57AF00ED561B /* bios.c */; };
729BECCF0D9D57AF00ED561B /* cflash.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECA20D9D57AF00ED561B /* cflash.c */; };
729BECD00D9D57AF00ED561B /* cp15.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECA50D9D57AF00ED561B /* cp15.c */; };
729BECD10D9D57AF00ED561B /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECA70D9D57AF00ED561B /* debug.c */; };
729BECD20D9D57AF00ED561B /* Disassembler.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECA90D9D57AF00ED561B /* Disassembler.c */; };
729BECD30D9D57AF00ED561B /* FIFO.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECAD0D9D57AF00ED561B /* FIFO.c */; };
729BECD40D9D57AF00ED561B /* fs-linux.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECAF0D9D57AF00ED561B /* fs-linux.c */; };
729BECD50D9D57AF00ED561B /* gl_vertex.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECB10D9D57AF00ED561B /* gl_vertex.c */; };
729BECD60D9D57AF00ED561B /* GPU.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECB30D9D57AF00ED561B /* GPU.c */; };
729BECD70D9D57AF00ED561B /* matrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECB50D9D57AF00ED561B /* matrix.c */; };
729BECD80D9D57AF00ED561B /* mc.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECB70D9D57AF00ED561B /* mc.c */; };
729BECD90D9D57AF00ED561B /* MMU.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECBA0D9D57AF00ED561B /* MMU.c */; };
729BECDA0D9D57AF00ED561B /* NDSSystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECBC0D9D57AF00ED561B /* NDSSystem.c */; };
729BECDB0D9D57AF00ED561B /* render3D.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECBF0D9D57AF00ED561B /* render3D.c */; };
729BECDC0D9D57AF00ED561B /* ROMReader.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECC10D9D57AF00ED561B /* ROMReader.c */; };
729BECDD0D9D57AF00ED561B /* saves.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECC30D9D57AF00ED561B /* saves.c */; };
729BECDE0D9D57AF00ED561B /* SPU.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECC50D9D57AF00ED561B /* SPU.c */; };
729BECDF0D9D57AF00ED561B /* thumb_instructions.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECC70D9D57AF00ED561B /* thumb_instructions.c */; };
729BECE00D9D57AF00ED561B /* wifi.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECCA0D9D57AF00ED561B /* wifi.c */; };
729BECE70D9D57F600ED561B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 729BECE60D9D57F600ED561B /* OpenGL.framework */; };
729BECF00D9D581900ED561B /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 729BECEF0D9D581900ED561B /* AudioUnit.framework */; };
729BECFA0D9D589E00ED561B /* OGLRender.c in Sources */ = {isa = PBXBuildFile; fileRef = 729BECF80D9D589E00ED561B /* OGLRender.c */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
7277B62E0D9D9AEA00D283BD /* DeSmuME.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = DeSmuME.icns; sourceTree = "<group>"; };
7277B6DF0D9E045700D283BD /* English.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = English.nib; sourceTree = "<group>"; };
7277B6E00D9E045700D283BD /* English.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; path = English.strings; sourceTree = "<group>"; };
7277B6E10D9E045700D283BD /* Japanese.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = Japanese.nib; sourceTree = "<group>"; };
7277B6E20D9E045700D283BD /* Japanese.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; path = Japanese.strings; sourceTree = "<group>"; };
7277B8EA0D9F25F700D283BD /* about.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = about.m; sourceTree = "<group>"; };
729BEC5A0D9D55DB00ED561B /* cocoa_util.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cocoa_util.m; sourceTree = SOURCE_ROOT; };
729BEC5C0D9D55DB00ED561B /* globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = globals.h; sourceTree = SOURCE_ROOT; };
729BEC5D0D9D55DB00ED561B /* input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = input.h; sourceTree = SOURCE_ROOT; };
729BEC5E0D9D55DB00ED561B /* input.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = input.m; sourceTree = SOURCE_ROOT; };
729BEC600D9D55DB00ED561B /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; };
729BEC610D9D55DB00ED561B /* main_window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_window.h; sourceTree = SOURCE_ROOT; };
729BEC620D9D55DB00ED561B /* main_window.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main_window.m; sourceTree = SOURCE_ROOT; };
729BEC630D9D55DB00ED561B /* nds_control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nds_control.h; sourceTree = SOURCE_ROOT; };
729BEC640D9D55DB00ED561B /* nds_control.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = nds_control.m; sourceTree = SOURCE_ROOT; };
729BEC650D9D55DB00ED561B /* preferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preferences.h; sourceTree = SOURCE_ROOT; };
729BEC660D9D55DB00ED561B /* preferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = preferences.m; sourceTree = SOURCE_ROOT; };
729BEC670D9D55DB00ED561B /* rom_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rom_info.h; sourceTree = SOURCE_ROOT; };
729BEC680D9D55DB00ED561B /* rom_info.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = rom_info.m; sourceTree = SOURCE_ROOT; };
729BEC690D9D55DB00ED561B /* screenshot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = screenshot.h; sourceTree = SOURCE_ROOT; };
729BEC6A0D9D55DB00ED561B /* screenshot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = screenshot.m; sourceTree = SOURCE_ROOT; };
729BEC6B0D9D55DB00ED561B /* sndOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sndOSX.h; sourceTree = SOURCE_ROOT; };
729BEC6C0D9D55DB00ED561B /* sndOSX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = sndOSX.m; sourceTree = SOURCE_ROOT; };
729BEC6D0D9D55DB00ED561B /* video_output_view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_output_view.h; sourceTree = SOURCE_ROOT; };
729BEC6E0D9D55DB00ED561B /* video_output_view.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = video_output_view.m; sourceTree = SOURCE_ROOT; };
729BEC9A0D9D57AF00ED561B /* ARM9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARM9.h; path = ../ARM9.h; sourceTree = SOURCE_ROOT; };
729BEC9B0D9D57AF00ED561B /* arm_instructions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arm_instructions.c; path = ../arm_instructions.c; sourceTree = SOURCE_ROOT; };
729BEC9C0D9D57AF00ED561B /* arm_instructions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = arm_instructions.h; path = ../arm_instructions.h; sourceTree = SOURCE_ROOT; };
729BEC9D0D9D57AF00ED561B /* armcpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = armcpu.c; path = ../armcpu.c; sourceTree = SOURCE_ROOT; };
729BEC9E0D9D57AF00ED561B /* armcpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = armcpu.h; path = ../armcpu.h; sourceTree = SOURCE_ROOT; };
729BEC9F0D9D57AF00ED561B /* bios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bios.c; path = ../bios.c; sourceTree = SOURCE_ROOT; };
729BECA00D9D57AF00ED561B /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bios.h; path = ../bios.h; sourceTree = SOURCE_ROOT; };
729BECA10D9D57AF00ED561B /* bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bits.h; path = ../bits.h; sourceTree = SOURCE_ROOT; };
729BECA20D9D57AF00ED561B /* cflash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cflash.c; path = ../cflash.c; sourceTree = SOURCE_ROOT; };
729BECA30D9D57AF00ED561B /* cflash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cflash.h; path = ../cflash.h; sourceTree = SOURCE_ROOT; };
729BECA40D9D57AF00ED561B /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../config.h; sourceTree = SOURCE_ROOT; };
729BECA50D9D57AF00ED561B /* cp15.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cp15.c; path = ../cp15.c; sourceTree = SOURCE_ROOT; };
729BECA60D9D57AF00ED561B /* cp15.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cp15.h; path = ../cp15.h; sourceTree = SOURCE_ROOT; };
729BECA70D9D57AF00ED561B /* debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = debug.c; path = ../debug.c; sourceTree = SOURCE_ROOT; };
729BECA80D9D57AF00ED561B /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../debug.h; sourceTree = SOURCE_ROOT; };
729BECA90D9D57AF00ED561B /* Disassembler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Disassembler.c; path = ../Disassembler.c; sourceTree = SOURCE_ROOT; };
729BECAA0D9D57AF00ED561B /* Disassembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Disassembler.h; path = ../Disassembler.h; sourceTree = SOURCE_ROOT; };
729BECAB0D9D57AF00ED561B /* dscard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dscard.h; path = ../dscard.h; sourceTree = SOURCE_ROOT; };
729BECAC0D9D57AF00ED561B /* fat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fat.h; path = ../fat.h; sourceTree = SOURCE_ROOT; };
729BECAD0D9D57AF00ED561B /* FIFO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = FIFO.c; path = ../FIFO.c; sourceTree = SOURCE_ROOT; };
729BECAE0D9D57AF00ED561B /* FIFO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIFO.h; path = ../FIFO.h; sourceTree = SOURCE_ROOT; };
729BECAF0D9D57AF00ED561B /* fs-linux.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "fs-linux.c"; path = "../fs-linux.c"; sourceTree = SOURCE_ROOT; };
729BECB00D9D57AF00ED561B /* fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fs.h; path = ../fs.h; sourceTree = SOURCE_ROOT; };
729BECB10D9D57AF00ED561B /* gl_vertex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gl_vertex.c; path = ../gl_vertex.c; sourceTree = SOURCE_ROOT; };
729BECB20D9D57AF00ED561B /* gl_vertex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl_vertex.h; path = ../gl_vertex.h; sourceTree = SOURCE_ROOT; };
729BECB30D9D57AF00ED561B /* GPU.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = GPU.c; path = ../GPU.c; sourceTree = SOURCE_ROOT; };
729BECB40D9D57AF00ED561B /* GPU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GPU.h; path = ../GPU.h; sourceTree = SOURCE_ROOT; };
729BECB50D9D57AF00ED561B /* matrix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = matrix.c; path = ../matrix.c; sourceTree = SOURCE_ROOT; };
729BECB60D9D57AF00ED561B /* matrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = matrix.h; path = ../matrix.h; sourceTree = SOURCE_ROOT; };
729BECB70D9D57AF00ED561B /* mc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mc.c; path = ../mc.c; sourceTree = SOURCE_ROOT; };
729BECB80D9D57AF00ED561B /* mc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mc.h; path = ../mc.h; sourceTree = SOURCE_ROOT; };
729BECB90D9D57AF00ED561B /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mem.h; path = ../mem.h; sourceTree = SOURCE_ROOT; };
729BECBA0D9D57AF00ED561B /* MMU.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = MMU.c; path = ../MMU.c; sourceTree = SOURCE_ROOT; };
729BECBB0D9D57AF00ED561B /* MMU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMU.h; path = ../MMU.h; sourceTree = SOURCE_ROOT; };
729BECBC0D9D57AF00ED561B /* NDSSystem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = NDSSystem.c; path = ../NDSSystem.c; sourceTree = SOURCE_ROOT; };
729BECBD0D9D57AF00ED561B /* NDSSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NDSSystem.h; path = ../NDSSystem.h; sourceTree = SOURCE_ROOT; };
729BECBE0D9D57AF00ED561B /* registers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = registers.h; path = ../registers.h; sourceTree = SOURCE_ROOT; };
729BECBF0D9D57AF00ED561B /* render3D.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = render3D.c; path = ../render3D.c; sourceTree = SOURCE_ROOT; };
729BECC00D9D57AF00ED561B /* render3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = render3D.h; path = ../render3D.h; sourceTree = SOURCE_ROOT; };
729BECC10D9D57AF00ED561B /* ROMReader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ROMReader.c; path = ../ROMReader.c; sourceTree = SOURCE_ROOT; };
729BECC20D9D57AF00ED561B /* ROMReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ROMReader.h; path = ../ROMReader.h; sourceTree = SOURCE_ROOT; };
729BECC30D9D57AF00ED561B /* saves.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = saves.c; path = ../saves.c; sourceTree = SOURCE_ROOT; };
729BECC40D9D57AF00ED561B /* saves.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = saves.h; path = ../saves.h; sourceTree = SOURCE_ROOT; };
729BECC50D9D57AF00ED561B /* SPU.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SPU.c; path = ../SPU.c; sourceTree = SOURCE_ROOT; };
729BECC60D9D57AF00ED561B /* SPU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPU.h; path = ../SPU.h; sourceTree = SOURCE_ROOT; };
729BECC70D9D57AF00ED561B /* thumb_instructions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thumb_instructions.c; path = ../thumb_instructions.c; sourceTree = SOURCE_ROOT; };
729BECC80D9D57AF00ED561B /* thumb_instructions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = thumb_instructions.h; path = ../thumb_instructions.h; sourceTree = SOURCE_ROOT; };
729BECC90D9D57AF00ED561B /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../types.h; sourceTree = SOURCE_ROOT; };
729BECCA0D9D57AF00ED561B /* wifi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wifi.c; path = ../wifi.c; sourceTree = SOURCE_ROOT; };
729BECCB0D9D57AF00ED561B /* wifi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wifi.h; path = ../wifi.h; sourceTree = SOURCE_ROOT; };
729BECE60D9D57F600ED561B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
729BECEF0D9D581900ED561B /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
729BECF80D9D589E00ED561B /* OGLRender.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = OGLRender.c; path = ../windows/OGLRender.c; sourceTree = SOURCE_ROOT; };
729BECF90D9D589E00ED561B /* OGLRender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OGLRender.h; path = ../windows/OGLRender.h; sourceTree = SOURCE_ROOT; };
72C000010D9D59E60046B7EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
72C000020D9D59E60046B7EA /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = InfoPlist.strings; sourceTree = SOURCE_ROOT; };
8D1107320486CEB800E47090 /* DeSmuME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeSmuME.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
729BECE70D9D57F600ED561B /* OpenGL.framework in Frameworks */,
729BECF00D9D581900ED561B /* AudioUnit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
7277B8EA0D9F25F700D283BD /* about.m */,
729BEC5C0D9D55DB00ED561B /* globals.h */,
729BEC600D9D55DB00ED561B /* main.m */,
729BEC5A0D9D55DB00ED561B /* cocoa_util.m */,
729BEC5D0D9D55DB00ED561B /* input.h */,
729BEC5E0D9D55DB00ED561B /* input.m */,
729BEC610D9D55DB00ED561B /* main_window.h */,
729BEC620D9D55DB00ED561B /* main_window.m */,
729BEC630D9D55DB00ED561B /* nds_control.h */,
729BEC640D9D55DB00ED561B /* nds_control.m */,
729BEC650D9D55DB00ED561B /* preferences.h */,
729BEC660D9D55DB00ED561B /* preferences.m */,
729BEC670D9D55DB00ED561B /* rom_info.h */,
729BEC680D9D55DB00ED561B /* rom_info.m */,
729BEC690D9D55DB00ED561B /* screenshot.h */,
729BEC6A0D9D55DB00ED561B /* screenshot.m */,
729BEC6B0D9D55DB00ED561B /* sndOSX.h */,
729BEC6C0D9D55DB00ED561B /* sndOSX.m */,
729BEC6E0D9D55DB00ED561B /* video_output_view.m */,
729BEC6D0D9D55DB00ED561B /* video_output_view.h */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* DeSmuME.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* DeSmuME */ = {
isa = PBXGroup;
children = (
72C000010D9D59E60046B7EA /* Info.plist */,
72C000020D9D59E60046B7EA /* InfoPlist.strings */,
729BECEF0D9D581900ED561B /* AudioUnit.framework */,
729BECE60D9D57F600ED561B /* OpenGL.framework */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = DeSmuME;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
729BECF80D9D589E00ED561B /* OGLRender.c */,
729BECF90D9D589E00ED561B /* OGLRender.h */,
729BEC9A0D9D57AF00ED561B /* ARM9.h */,
729BEC9B0D9D57AF00ED561B /* arm_instructions.c */,
729BEC9C0D9D57AF00ED561B /* arm_instructions.h */,
729BEC9D0D9D57AF00ED561B /* armcpu.c */,
729BEC9E0D9D57AF00ED561B /* armcpu.h */,
729BEC9F0D9D57AF00ED561B /* bios.c */,
729BECA00D9D57AF00ED561B /* bios.h */,
729BECA10D9D57AF00ED561B /* bits.h */,
729BECA20D9D57AF00ED561B /* cflash.c */,
729BECA30D9D57AF00ED561B /* cflash.h */,
729BECA40D9D57AF00ED561B /* config.h */,
729BECA50D9D57AF00ED561B /* cp15.c */,
729BECA60D9D57AF00ED561B /* cp15.h */,
729BECA70D9D57AF00ED561B /* debug.c */,
729BECA80D9D57AF00ED561B /* debug.h */,
729BECA90D9D57AF00ED561B /* Disassembler.c */,
729BECAA0D9D57AF00ED561B /* Disassembler.h */,
729BECAB0D9D57AF00ED561B /* dscard.h */,
729BECAC0D9D57AF00ED561B /* fat.h */,
729BECAD0D9D57AF00ED561B /* FIFO.c */,
729BECAE0D9D57AF00ED561B /* FIFO.h */,
729BECAF0D9D57AF00ED561B /* fs-linux.c */,
729BECB00D9D57AF00ED561B /* fs.h */,
729BECB10D9D57AF00ED561B /* gl_vertex.c */,
729BECB20D9D57AF00ED561B /* gl_vertex.h */,
729BECB30D9D57AF00ED561B /* GPU.c */,
729BECB40D9D57AF00ED561B /* GPU.h */,
729BECB50D9D57AF00ED561B /* matrix.c */,
729BECB60D9D57AF00ED561B /* matrix.h */,
729BECB70D9D57AF00ED561B /* mc.c */,
729BECB80D9D57AF00ED561B /* mc.h */,
729BECB90D9D57AF00ED561B /* mem.h */,
729BECBA0D9D57AF00ED561B /* MMU.c */,
729BECBB0D9D57AF00ED561B /* MMU.h */,
729BECBC0D9D57AF00ED561B /* NDSSystem.c */,
729BECBD0D9D57AF00ED561B /* NDSSystem.h */,
729BECBE0D9D57AF00ED561B /* registers.h */,
729BECBF0D9D57AF00ED561B /* render3D.c */,
729BECC00D9D57AF00ED561B /* render3D.h */,
729BECC10D9D57AF00ED561B /* ROMReader.c */,
729BECC20D9D57AF00ED561B /* ROMReader.h */,
729BECC30D9D57AF00ED561B /* saves.c */,
729BECC40D9D57AF00ED561B /* saves.h */,
729BECC50D9D57AF00ED561B /* SPU.c */,
729BECC60D9D57AF00ED561B /* SPU.h */,
729BECC70D9D57AF00ED561B /* thumb_instructions.c */,
729BECC80D9D57AF00ED561B /* thumb_instructions.h */,
729BECC90D9D57AF00ED561B /* types.h */,
729BECCA0D9D57AF00ED561B /* wifi.c */,
729BECCB0D9D57AF00ED561B /* wifi.h */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
7277B6DF0D9E045700D283BD /* English.nib */,
7277B6E00D9E045700D283BD /* English.strings */,
7277B6E10D9E045700D283BD /* Japanese.nib */,
7277B6E20D9E045700D283BD /* Japanese.strings */,
7277B62E0D9D9AEA00D283BD /* DeSmuME.icns */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* DeSmuME */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "DeSmuME" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
72C000600D9D61BF0046B7EA /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = DeSmuME;
productInstallPath = "$(HOME)/Applications";
productName = DeSmuME;
productReference = 8D1107320486CEB800E47090 /* DeSmuME.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
TestLocale,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* DeSmuME */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* DeSmuME */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7277B62F0D9D9AEA00D283BD /* DeSmuME.icns in Resources */,
7277B6E30D9E045700D283BD /* English.nib in Resources */,
7277B6E40D9E045700D283BD /* English.strings in Resources */,
7277B6E50D9E045700D283BD /* Japanese.nib in Resources */,
7277B6E60D9E045700D283BD /* Japanese.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
72C000600D9D61BF0046B7EA /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cp ../../README $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/README\ncp ../../README.MAC $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/README.MAC\ncp ../../AUTHORS $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/AUTHORS\ncp ../../README.TRANSLATION $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/README.TRANSLATION\ncp ../../ChangeLog $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/ChangeLog\ncp ../../COPYING $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/COPYING\ncd $BUILT_PRODUCTS_DIR/DeSmuME.app/Contents/Resources/\nmkdir English.lproj\nmv English.nib English.lproj/MainMenu.nib\nmv English.strings English.lproj/Localizable.strings\nmkdir Japanese.lproj\nmv Japanese.nib Japanese.lproj/MainMenu.nib\nmv Japanese.strings Japanese.lproj/Localizable.strings";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
729BEC6F0D9D55DB00ED561B /* cocoa_util.m in Sources */,
729BEC710D9D55DB00ED561B /* input.m in Sources */,
729BEC730D9D55DB00ED561B /* main.m in Sources */,
729BEC740D9D55DB00ED561B /* main_window.m in Sources */,
729BEC750D9D55DB00ED561B /* nds_control.m in Sources */,
729BEC760D9D55DB00ED561B /* preferences.m in Sources */,
729BEC770D9D55DB00ED561B /* rom_info.m in Sources */,
729BEC780D9D55DB00ED561B /* screenshot.m in Sources */,
729BEC790D9D55DB00ED561B /* sndOSX.m in Sources */,
729BEC7A0D9D55DB00ED561B /* video_output_view.m in Sources */,
729BECCC0D9D57AF00ED561B /* arm_instructions.c in Sources */,
729BECCD0D9D57AF00ED561B /* armcpu.c in Sources */,
729BECCE0D9D57AF00ED561B /* bios.c in Sources */,
729BECCF0D9D57AF00ED561B /* cflash.c in Sources */,
729BECD00D9D57AF00ED561B /* cp15.c in Sources */,
729BECD10D9D57AF00ED561B /* debug.c in Sources */,
729BECD20D9D57AF00ED561B /* Disassembler.c in Sources */,
729BECD30D9D57AF00ED561B /* FIFO.c in Sources */,
729BECD40D9D57AF00ED561B /* fs-linux.c in Sources */,
729BECD50D9D57AF00ED561B /* gl_vertex.c in Sources */,
729BECD60D9D57AF00ED561B /* GPU.c in Sources */,
729BECD70D9D57AF00ED561B /* matrix.c in Sources */,
729BECD80D9D57AF00ED561B /* mc.c in Sources */,
729BECD90D9D57AF00ED561B /* MMU.c in Sources */,
729BECDA0D9D57AF00ED561B /* NDSSystem.c in Sources */,
729BECDB0D9D57AF00ED561B /* render3D.c in Sources */,
729BECDC0D9D57AF00ED561B /* ROMReader.c in Sources */,
729BECDD0D9D57AF00ED561B /* saves.c in Sources */,
729BECDE0D9D57AF00ED561B /* SPU.c in Sources */,
729BECDF0D9D57AF00ED561B /* thumb_instructions.c in Sources */,
729BECE00D9D57AF00ED561B /* wifi.c in Sources */,
729BECFA0D9D589E00ED561B /* OGLRender.c in Sources */,
7277B8EB0D9F25F700D283BD /* about.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_AUTO_VECTORIZATION = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_STRICT_ALIASING = YES;
GCC_UNROLL_LOOPS = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = DeSmuME;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_AUTO_VECTORIZATION = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_STRICT_ALIASING = YES;
GCC_UNROLL_LOOPS = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = DeSmuME;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = DESMUME_COCOA;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.4;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_PREPROCESSOR_DEFINITIONS = DESMUME_COCOA;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.4;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "DeSmuME" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

Binary file not shown.

Binary file not shown.

373
desmume/src/cocoa/about.m Normal file
View File

@ -0,0 +1,373 @@
/* 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 "globals.h"
const CGFloat inner_padding = 3;
const CGFloat outer_padding = 3;
const CGFloat tab_view_height = 240;
const CGFloat icon_size = 130;
const CGFloat window_width = 465;
NSTextField *about_name;
NSTextField *about_description;
NSTextField *about_version;
NSTextField *about_date;
NSTextField *about_website;
@interface AboutDelegate : NSObject
{
}
- (void)windowDidResize:(NSNotification*)notification;
- (void)windowWillClose:(NSNotification*)notification;
@end
@implementation AboutDelegate
- (void)windowDidResize:(NSNotification*)notification
{
NSWindow *window = [notification object];
CGFloat new_width = [window frame].size.width;
NSRect temp = [about_name frame];
temp.origin.x = (new_width - outer_padding*2-temp.size.width) / 2 + outer_padding; //center
if(temp.origin.x < outer_padding + icon_size)temp.origin.x = outer_padding + icon_size; //move left if overlapping icon
[about_name setFrame:temp];
temp = [about_description frame];
temp.origin.x = (new_width - outer_padding*2-temp.size.width) / 2 + inner_padding;
if(temp.origin.x < outer_padding + icon_size)temp.origin.x = outer_padding + icon_size;
[about_description setFrame:temp];
temp = [about_version frame];
temp.origin.x = (new_width - outer_padding*2-temp.size.width) / 2 + inner_padding;
if(temp.origin.x < outer_padding + icon_size)temp.origin.x = outer_padding + icon_size;
[about_version setFrame:temp];
temp = [about_date frame];
temp.origin.x = (new_width - outer_padding*2-temp.size.width) / 2 + inner_padding;
if(temp.origin.x < outer_padding + icon_size)temp.origin.x = outer_padding + icon_size;
[about_date setFrame:temp];
temp = [about_website frame];
temp.origin.x = (new_width - outer_padding*2-temp.size.width) / 2 + inner_padding;
if(temp.origin.x < outer_padding + icon_size)temp.origin.x = outer_padding + icon_size;
[about_website setFrame:temp];
[[window contentView] setNeedsDisplay:YES];
}
- (void)windowWillClose:(NSNotification*)notification
{
//end our modal session if the about window closses
[NSApp stopModal];
}
@end
@implementation NSApplication (helpmenu)
- (void)launchWebsite
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://desmume.sourceforge.net"]];
}
- (void)launchForums
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://forums.desmume.org/index.php"]];
}
- (void)bugReport
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291"]];
}
@end
@implementation NSApplication (aboutdesmume)
- (void)orderFrontStandardAboutPanel:(id)sender
{
NSWindow *about_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(500, 285, window_width-1, outer_padding*2+tab_view_height+inner_padding+icon_size) styleMask:NSClosableWindowMask|NSTitledWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO];
if(about_window == nil)return;
[about_window setTitle:NSLocalizedString([sender title], nil)];
AboutDelegate *delegate = [[AboutDelegate alloc] init];
[about_window setDelegate:delegate];
NSBundle *main_bundle = [NSBundle mainBundle];
//desmume icon preview
NSImageView *image = [[NSImageView alloc] initWithFrame:NSMakeRect(outer_padding, outer_padding+tab_view_height+inner_padding, icon_size, icon_size)];
[image setImageFrameStyle:NSImageFrameNone];
[image setImageScaling:NSScaleToFit];
[image setEditable:NO];
[image setAllowsCutCopyPaste:NO];
[image setImage:[NSApp applicationIconImage]];
[image setAutoresizingMask:NSViewMinYMargin];
[[about_window contentView] addSubview:image];
[image release];
//
const CGFloat width = 296;
CGFloat content_min_width = window_width - outer_padding*2;
//
about_name = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 348 - 240 + tab_view_height + inner_padding, width, 17)];
[about_name setStringValue:NSLocalizedString(@"DeSmuME", nil)];
[about_name setEditable:NO];
[about_name setDrawsBackground:NO];
[about_name setBordered:NO];
[about_name setBezeled:NO];
[about_name setSelectable:YES];
[about_name sizeToFit];
[about_name setAutoresizingMask:NSViewMinYMargin];
NSRect temp = [about_name frame];
temp.origin.x += (width - temp.size.width) / 2;
[about_name setFrame:temp];
[[about_window contentView] addSubview:about_name];
if(content_min_width < icon_size + inner_padding + [about_name frame].size.width)
content_min_width = icon_size + inner_padding + [about_name frame].size.width;
//
about_description = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 83 + tab_view_height + inner_padding, width, 17)];
[about_description setStringValue:NSLocalizedString(@"Nintendo DS Emulator", nil)];
[about_description setEditable:NO];
[about_description setDrawsBackground:NO];
[about_description setBordered:NO];
[about_description setBezeled:NO];
[about_description setSelectable:YES];
[about_description sizeToFit];
[about_description setAutoresizingMask:NSViewMinYMargin];
temp = [about_description frame];
temp.origin.x += (width - temp.size.width) / 2;
[about_description setFrame:temp];
[[about_window contentView] addSubview:about_description];
if(content_min_width < icon_size + inner_padding + [about_description frame].size.width)
content_min_width = icon_size + inner_padding + [about_description frame].size.width;
//
about_version = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 58 + tab_view_height + inner_padding, width, 17)];
[about_version setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Version %@", nil), [[main_bundle infoDictionary] objectForKey:@"CFBundleVersion"]]];
[about_version setEditable:NO];
[about_version setDrawsBackground:NO];
[about_version setBordered:NO];
[about_version setBezeled:NO];
[about_version setSelectable:YES];
[about_version sizeToFit];
[about_version setAutoresizingMask:NSViewMinYMargin];
temp = [about_version frame];
temp.origin.x += (width - temp.size.width) / 2;
[about_version setFrame:temp];
[[about_window contentView] addSubview:about_version];
if(content_min_width < icon_size + inner_padding + [about_version frame].size.width)
content_min_width = icon_size + inner_padding + [about_version frame].size.width;
//
about_date = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 33 + tab_view_height + inner_padding, width, 17)];
[about_date setStringValue:@__DATE__];//fixme localize
[about_date setEditable:NO];
[about_date setDrawsBackground:NO];
[about_date setBordered:NO];
[about_date setBezeled:NO];
[about_date setSelectable:YES];
[about_date sizeToFit];
[about_date setAutoresizingMask:NSViewMinYMargin];
temp = [about_date frame];
temp.origin.x += (width - temp.size.width) / 2;
[about_date setFrame:temp];
[[about_window contentView] addSubview:about_date];
if(content_min_width < icon_size + inner_padding + [about_date frame].size.width)
content_min_width = icon_size + inner_padding + [about_date frame].size.width;
//
about_website = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 8 + tab_view_height + inner_padding, width, 17)];
[about_website setStringValue:@"http://www.desmume.org"];//fixme linkize
[about_website setEditable:NO];
[about_website setDrawsBackground:NO];
[about_website setBordered:NO];
[about_website setBezeled:NO];
[about_website setSelectable:YES];
[about_website sizeToFit];
[about_website setAutoresizingMask:NSViewMinYMargin];
temp = [about_website frame];
temp.origin.x += (width - temp.size.width) / 2;
[about_website setFrame:temp];
[[about_window contentView] addSubview:about_website];
if(content_min_width < icon_size + inner_padding + [about_website frame].size.width)
content_min_width = icon_size + inner_padding + [about_website frame].size.width;
//tab view
NSTabView *tab_view = [[NSTabView alloc] initWithFrame:NSMakeRect(outer_padding, outer_padding, window_width - outer_padding*2, tab_view_height)];
[tab_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[[about_window contentView] addSubview:tab_view];
NSRect rect;
rect.origin.x = rect.origin.y = 0;
//fixme if one of the files we read from is missing the entire panel doesn't show
NSTabViewItem *tab_view_item;
NSScrollView *scroll_view;
NSTextView *text_view;
//README
NSString *datapath = [main_bundle pathForResource:@"README" ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Readme", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
}
//LICENSE
datapath = [main_bundle pathForResource:@"COPYING" ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"License", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
}
//AUTHORS
datapath = [main_bundle pathForResource:@"AUTHORS" ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Authors", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
}
//CHANGE LOG
datapath = [main_bundle pathForResource:@"ChangeLog" ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Change Log", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
}
//
if(content_min_width < [tab_view minimumSize].width)
content_min_width = [tab_view minimumSize].width;
[tab_view release];
//show the window
rect = [about_window frame];
if(rect.size.width < content_min_width + outer_padding*2)
rect.size.width = content_min_width + outer_padding*2;
[about_window setFrame:rect display:NO];
[about_window setMinSize:rect.size];
NSWindowController *about_window_controller = [[NSWindowController alloc] initWithWindow:about_window];
[about_window_controller showWindow:nil];
//run the window
[NSApp runModalForWindow:about_window];
[about_window release];
[about_window_controller release];
[delegate release];
[about_name release];
[about_description release];
[about_version release];
[about_date release];
[about_website release];
}
@end

View File

@ -17,6 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
#import "globals.h"
////////////////////////////////////////////////////////////////

View File

@ -17,133 +17,23 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef GLOBALS_H_INCLUDED
#define GLOBALS_H_INCLUDED
#import <Cocoa/Cocoa.h>
#import <Cocoa/cocoa.h>
//fixme
#define desmume_TRUE TRUE
//Nintendo DS constants---------------------------------------------------------------------------
//This just improves legibility throughut the code
//by showing you names instead of numbers
#define DS_SCREEN_WIDTH 256
#define DS_SCREEN_HEIGHT 192
#define DS_SCREEN_HEIGHT_COMBINED (192*2) /*height of the two screens*/
#define DS_SCREEN_X_RATIO (256.0 / (192.0 * 2.0))
#define DS_SCREEN_Y_RATIO ((192.0 * 2.0) / 256.0)
//Port Specific constants ---------------------------------------------------------------------
#define ROTATION_0 0
#define ROTATION_90 1
#define ROTATION_180 2
#define ROTATION_270 3
//Cocoa Util------------------------------------------------------------------------------------
//These are just useful little functions to help with stuff
//defined in cocoa_util.m
//c string to NSString
#define NSSTRc(x) ([[NSString alloc] initWithCString:(x) encoding:NSASCIIStringEncoding])//dialogs
//cocoa utils
#define NSSTRc(x) ([[NSString alloc] initWithCString:(x) encoding:NSASCIIStringEncoding])
void messageDialogBlank();
void messageDialog(NSString *title, NSString *text);
BOOL messageDialogYN(NSString *title, NSString *text);
NSString* openDialog(NSArray *file_types);
//Menus -------------------------------------------------------------------------------------------
//These are all the menu items that need checkmarks
//or their enabled status managed
//global menu (defined in main.m)
extern NSMenu *menu;
//view (defined/managed in main_window.m)
extern NSMenuItem *resize1x;
extern NSMenuItem *resize2x;
extern NSMenuItem *resize3x;
extern NSMenuItem *resize4x;
extern NSMenuItem *allows_resize_item;
extern NSMenuItem *constrain_item;
extern NSMenuItem *min_size_item;
extern NSMenuItem *rotation0_item;
extern NSMenuItem *rotation90_item;
extern NSMenuItem *rotation180_item;
extern NSMenuItem *rotation270_item;
extern NSMenuItem *topBG0_item;
extern NSMenuItem *topBG1_item;
extern NSMenuItem *topBG2_item;
extern NSMenuItem *topBG3_item;
extern NSMenuItem *subBG0_item;
extern NSMenuItem *subBG1_item;
extern NSMenuItem *subBG2_item;
extern NSMenuItem *subBG3_item;
//execution control (defined/managed in nds_control.m)
extern NSMenuItem *close_rom_item;
extern NSMenuItem *execute_item;
extern NSMenuItem *pause_item;
extern NSMenuItem *reset_item;
extern NSMenuItem *save_state_as_item;
extern NSMenuItem *load_state_from_item;
//sound (defined/managed in nds_control.m)
extern NSMenuItem *volume_item[10];
extern NSMenuItem *mute_item;
#define SAVE_SLOTS 10 //this should never be more than NB_SAVES in saves.h
extern NSMenuItem *saveSlot_item[SAVE_SLOTS];
extern NSMenuItem *loadSlot_item[SAVE_SLOTS];
#define MAX_FRAME_SKIP 10 //this is actually 1 more than the highest frame skip
extern NSMenuItem *frame_skip_auto_item;
extern NSMenuItem *frame_skip_item[SAVE_SLOTS];
//extern NSMenuItem *clear_all_saves_item; waiting for more functionality from saves.h
extern NSMenuItem *rom_info_item;
//Cocoa Port Stuff ---------------------------------------------------------------------------------
//Enable this to multithread the program
//#define MULTITHREADED
//prototype for our NintendoDS class (defined in nds_control.h)
//
@class NintendoDS;
//Here's our global DS object
//which controls things like pausing and whatnot
extern NintendoDS *NDS;
@class VideoOutputWindow;
extern VideoOutputWindow *main_window;
void setAppDefaults(); //this is defined in preferences.m and should be called at app launch
void clearEvents(bool wait);
//--------------------------------------------------------------------------------------------------
extern volatile int /*desmume_BOOL*/ execute;
extern volatile BOOL finished;
extern volatile BOOL paused;
//--------------------------------------------------------------------------------------------------
#ifndef __OBJC2__
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned NSUInteger;
typedef unsigned int NSUInteger;
#endif
#endif // GLOBALS_H_INCLUDED
typedef float CGFloat;

46
desmume/src/cocoa/input.h Normal file
View File

@ -0,0 +1,46 @@
/* 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>
/* The main window class instanciates an input object,
and places it after the window in the responder chain, so
any events not handled by a the window get sent here.
*/
@class VideoOutputWindow;
@interface InputHandler : NSResponder
{
@private
VideoOutputWindow *my_ds;
}
//
- (id)initWithWindow:(VideoOutputWindow*)nds;
- (void)dealloc;
//keyboard input
- (void)keyDown:(NSEvent*)event;
- (void)keyUp:(NSEvent*)event;
//mouse input
- (void)mouseDown:(NSEvent*)event;
- (void)mouseDragged:(NSEvent*)event;
- (void)mouseUp:(NSEvent*)event;
@end

205
desmume/src/cocoa/input.m Normal file
View File

@ -0,0 +1,205 @@
/* 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 "input.h"
#import "main_window.h"
//Default key config (based on the windows version)
unsigned short ds_up = 126; //up arrow
unsigned short ds_down = 125; //down arrow
unsigned short ds_left = 123; //left arrow
unsigned short ds_right = 124; //right arrrow
unsigned short ds_a = 9 ; //v
unsigned short ds_b = 11 ; //b
unsigned short ds_x = 5 ; //g
unsigned short ds_y = 4 ; //h
unsigned short ds_l = 8 ; //c
unsigned short ds_r = 45 ; //n
unsigned short ds_select = 49 ; //space bar
unsigned short ds_start = 36 ; //enter
//
unsigned short save_slot_1 = 122; //F1
unsigned short save_slot_2 = 120; //F2
unsigned short save_slot_3 = 99; //F3
unsigned short save_slot_4 = 118; //F4
unsigned short save_slot_5 = 96; //F5
unsigned short save_slot_6 = 97; //F6
unsigned short save_slot_7 = 98; //F7
unsigned short save_slot_8 = 100; //F8
unsigned short save_slot_9 = 101; //F9
unsigned short save_slot_10 = 109; //F10
//unsigned short save_slot_11 = 103; //F11
//unsigned short save_slot_12 = 111; //F12
@implementation InputHandler
//
- (id)initWithWindow:(VideoOutputWindow*)nds
{
self = [super init];
my_ds = nds;
[my_ds retain];
return self;
}
- (void)dealloc
{
[my_ds release];
[super dealloc];
}
- (void)keyDown:(NSEvent*)event
{
if([event isARepeat])return;
unsigned short keycode = [event keyCode];
if(keycode == ds_a)[my_ds pressA];
else if(keycode == ds_b)[my_ds pressB];
else if(keycode == ds_select)[my_ds pressSelect];
else if(keycode == ds_start)[my_ds pressStart];
else if(keycode == ds_right)[my_ds pressRight];
else if(keycode == ds_left)[my_ds pressLeft];
else if(keycode == ds_up)[my_ds pressUp];
else if(keycode == ds_down)[my_ds pressDown];
else if(keycode == ds_r)[my_ds pressR];
else if(keycode == ds_l)[my_ds pressL];
else if(keycode == ds_x)[my_ds pressX];
else if(keycode == ds_y)[my_ds pressY];
}
- (void)keyUp:(NSEvent*)event
{
unsigned short keycode = [event keyCode];
if(keycode == ds_a)[my_ds liftA];
else if(keycode == ds_b)[my_ds liftB];
else if(keycode == ds_select)[my_ds liftSelect];
else if(keycode == ds_start)[my_ds liftStart];
else if(keycode == ds_right)[my_ds liftRight];
else if(keycode == ds_left)[my_ds liftLeft];
else if(keycode == ds_up)[my_ds liftUp];
else if(keycode == ds_down)[my_ds liftDown];
else if(keycode == ds_r)[my_ds liftR];
else if(keycode == ds_l)[my_ds liftL];
else if(keycode == ds_x)[my_ds liftX];
else if(keycode == ds_y)[my_ds liftY];
/*
else if(keycode == save_slot_1)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(1);
else
loadstate_slot(1);
}
else if(keycode == save_slot_2)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(2);
else
loadstate_slot(2);
}
else if(keycode == save_slot_3)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(3);
else
loadstate_slot(3);
}
else if(keycode == save_slot_4)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(4);
else
loadstate_slot(4);
}
else if(keycode == save_slot_5)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(5);
else
loadstate_slot(5);
}
else if(keycode == save_slot_6)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(6);
else
loadstate_slot(6);
}
else if(keycode == save_slot_7)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(7);
else
loadstate_slot(7);
}
else if(keycode == save_slot_8)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(8);
else
loadstate_slot(8);
}
else if(keycode == save_slot_9)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(9);
else
loadstate_slot(9);
}
else if(keycode == save_slot_10)
{
if([event modifierFlags] & NSShiftKeyMask)
savestate_slot(10);
else
loadstate_slot(10);
}
*/
}
- (void)mouseDown:(NSEvent*)event
{
[my_ds touch:[my_ds windowPointToDSCoords:[event locationInWindow]]];
}
- (void)mouseDragged:(NSEvent*)event
{
[self mouseDown:event];
}
- (void)mouseUp:(NSEvent*)event
{
[my_ds releaseTouch];
}
@end

View File

@ -23,39 +23,76 @@ By Jeff Bland (reversegecko@gmail.com)
Based on work by yopyop and the DeSmuME team!
*/
//DeSmuME Cocoa includes
#import "globals.h"
#import "main_window.h"
#import "nds_control.h"
//DeSmuME general includes
#define OBJ_C
#include "../render3D.h"
#include "../GPU.h"
#include "../Windows/OGLRender.h"
#include "../NDSSystem.h"
#undef BOOL
/*
FIXME: Apple+Q during open dialog = badness
FIXME: Live resize needs to work without pausing emulator
FIXME: Hardware acceleration for openglrender.c ??
FIXME: When cross-platform (core) components end emulation due to error - pause should be called (set the menu checkmark)
FIXME: Some bug where states get messed up and hitting execute does nothing......
FIXME: .nds.gba extensions don't work in open panels
FIXME: Traveling windows when constantly resizing
FIXME: .nds.gba support?
*/
//Globals----------------------------------------------------------------------------------------
NSMenu *menu;
NSAutoreleasePool *autorelease;
//view (defined/managed in main_window.m)
extern NSMenuItem *resize1x;
extern NSMenuItem *resize2x;
extern NSMenuItem *resize3x;
extern NSMenuItem *resize4x;
extern NSMenuItem *constrain_item;
extern NSMenuItem *min_size_item;
extern NSMenuItem *toggle_status_bar_item;
extern NSMenuItem *rotation0_item;
extern NSMenuItem *rotation90_item;
extern NSMenuItem *rotation180_item;
extern NSMenuItem *rotation270_item;
extern NSMenuItem *topBG0_item;
extern NSMenuItem *topBG1_item;
extern NSMenuItem *topBG2_item;
extern NSMenuItem *topBG3_item;
extern NSMenuItem *subBG0_item;
extern NSMenuItem *subBG1_item;
extern NSMenuItem *subBG2_item;
extern NSMenuItem *subBG3_item;
extern NSMenuItem *screenshot_to_file_item;
extern NSMenuItem *screenshot_to_window_item;
//execution control (defined/managed in nds_control.m)
extern NSMenuItem *close_rom_item;
extern NSMenuItem *execute_item;
extern NSMenuItem *pause_item;
extern NSMenuItem *reset_item;
extern NSMenuItem *save_state_as_item;
extern NSMenuItem *load_state_from_item;
//sound (defined/managed in nds_control.m)
extern NSMenuItem *volume_item[];
extern NSMenuItem *mute_item;
#define SAVE_SLOTS 10 //this should never be more than NB_SAVES in saves.h
extern NSMenuItem *saveSlot_item[];
extern NSMenuItem *loadSlot_item[];
extern NSMenuItem *frame_skip_auto_item;
extern NSMenuItem *frame_skip_item[];
//extern NSMenuItem *clear_all_saves_item; waiting for more functionality from saves.h
extern NSMenuItem *rom_info_item;
//Interfaces--------------------------------------------------------------------------------------
@interface AppDelegate : NSObject
{}
//our methods
- (void)pickROM;
//delegate methods
- (BOOL)application:(NSApplication*)sender openFile:(NSString*)filename;
@ -66,69 +103,18 @@ NSAutoreleasePool *autorelease;
- (void)applicationWillTerminate:(NSNotification*)aNotification;
@end
//Global access gui constructs
VideoOutputWindow *main_window;
//Desmume globals---------------------------------------------------------------------------------------
//accessed from other files
volatile desmume_BOOL execute = FALSE;
//
volatile BOOL finished = FALSE;
volatile BOOL paused = TRUE;
GPU3DInterface *core3DList[] = {
&gpu3DNull,
&gpu3Dgl
};
//NDS/Emulator control-----------------------------------------------------------------------------------------
//These functions should be called by GUI handling mechanisms to change the state of the emulator or emulation
NintendoDS *NDS;
bool AskForQuit()
{
BOOL was_paused = paused;
//pause while we prompt the user
[NDS pause];
//ask the user if quitting is acceptable
if(messageDialogYN(NSLocalizedString(@"DeSmuME Emulator", nil), NSLocalizedString(@"Are you sure you want to quit?", nil)))
return true;
else
{
if(!was_paused)[NDS execute]; //unpaused if we weren't paused before
return false;
}
}
NSEvent *current_event;
//if wait is true then it will sit around waiting for an
//event for a short period of time taking up very little CPU
//(use when game is not running)
void clearEvents(bool wait)
{
//wait for the next event
while((current_event = [NSApp nextEventMatchingMask:0 untilDate:wait?[NSDate dateWithTimeIntervalSinceNow:.2]:nil inMode:NSDefaultRunLoopMode dequeue:YES]))
[NSApp sendEvent: current_event];
}
VideoOutputWindow *main_window;
///////////////////////////////
//This generates and sets the entire menubar (and sets defaults)
//call after objects (ie NDS main_window) are inited
void CreateMenu()
void CreateMenu(AppDelegate *delegate)
{
int i;
NSMenuItem *temp;
NSMenu* application_menu;
NSMenu* services_menu;
NSMenu* file;
NSMenu* emulation;
NSMenu* view;
@ -138,7 +124,7 @@ void CreateMenu()
NSMenu* frame_skip_menu;
menu = [NSApp mainMenu];
NSMenu *menu = [NSApp mainMenu];
NSMenuItem *file_item = [menu addItemWithTitle:@"" action:nil keyEquivalent:@""];
NSMenuItem *emulation_item = [menu addItemWithTitle:@"" action:nil keyEquivalent:@""];
@ -149,11 +135,10 @@ void CreateMenu()
//Create the File Menu
file = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"File", nil)];
[file setAutoenablesItems:NO];
[menu setSubmenu:file forItem:file_item];
temp = [file addItemWithTitle:NSLocalizedString(@"Open ROM...", nil) action:@selector(pickROM) keyEquivalent:@"o"];
[temp setTarget:NDS];
[temp setTarget:delegate];
//recent items menu
/* Thanks to Jeff Johnson and the Lap Cat Software Blog for their information on the Open Recent menu in Cocoa*/
@ -175,8 +160,6 @@ void CreateMenu()
[file addItem:[NSMenuItem separatorItem]];
rom_info_item = [file addItemWithTitle:NSLocalizedString(@"ROM Info...", nil) action:@selector(showRomInfo) keyEquivalent:@""];
[rom_info_item setEnabled:NO];
[rom_info_item setTarget:NDS];
#ifdef HAVE_LIBZ //internally, save states only work when zlib is there
@ -184,62 +167,48 @@ void CreateMenu()
save_state_as_item = [file addItemWithTitle:NSLocalizedString(@"Save State As...", nil) action:@selector(saveStateAs) keyEquivalent:@""];
[save_state_as_item setEnabled:NO];
[save_state_as_item setTarget:NDS];
load_state_from_item = [file addItemWithTitle:NSLocalizedString(@"Load State From...", nil) action:@selector(loadStateFrom) keyEquivalent:@""];
[load_state_from_item setEnabled:NO];
[load_state_from_item setTarget:NDS];
[file addItem:[NSMenuItem separatorItem]];
temp = [file addItemWithTitle:NSLocalizedString(@"Save State", nil) action:@selector(saveTo:) keyEquivalent:@""];
NSMenu *save_state_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Save State", nil)];
[save_state_menu setAutoenablesItems:NO];
[temp setSubmenu:save_state_menu];
temp = [file addItemWithTitle:NSLocalizedString(@"Load State", nil) action:nil keyEquivalent:@""];
NSMenu *load_state_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Load State", nil)];
[load_state_menu setAutoenablesItems:NO];
[temp setSubmenu:load_state_menu];
for(i = 0; i < SAVE_SLOTS; i++)
{
saveSlot_item[i] = [save_state_menu addItemWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Slot %d", nil), i] action:@selector(saveToSlot:) keyEquivalent:@""];
[saveSlot_item[i] setEnabled:NO];
[saveSlot_item[i] setTarget:NDS];
loadSlot_item[i] = [load_state_menu addItemWithTitle:[saveSlot_item[i] title] action:@selector(loadFromSlot:) keyEquivalent:@""];
[loadSlot_item[i] setEnabled:NO];
[loadSlot_item[i] setTarget:NDS];
}
//fixme changed save state item function names
/* To be implemented when saves.h provides
a way to get the time of a save that's not string/human formatted...
[save_state_menu addItem:[NSMenuItem separatorItem]];
temp = [save_state_menu addItemWithTitle:@"Save Over Oldest" action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
temp = [save_state_menu addItemWithTitle:@"Save Over Latest" action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
*/
/* to be implemented after saves.h provides a way to delete saves...
[save_state_menu addItem:[NSMenuItem separatorItem]];
clear_all_saves_item = [save_state_menu addItemWithTitle:@"Clear Menu" action:@selector(askAndClearStates) keyEquivalent:@""];
[clear_all_saves_item setEnabled:NO];
[clear_all_saves_item setTarget:NDS];
*/
/*
[save_state_menu addItem:[NSMenuItem separatorItem]];
temp = [save_state_menu addItemWithTitle:NSLocalizedString(@"View States", nil) action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
*/
/* To be implemented when saves.h provides
a way to get the time of a save that's not a string / human formatted...
@ -247,46 +216,37 @@ a way to get the time of a save that's not a string / human formatted...
[load_state_menu addItem:[NSMenuItem separatorItem]];
temp = [load_state_menu addItemWithTitle:@"Load Oldest" action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
temp = [load_state_menu addItemWithTitle:@"Load Latest" action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
*/
/*
[load_state_menu addItem:[NSMenuItem separatorItem]];
temp = [load_state_menu addItemWithTitle:@"View States" action:nil keyEquivalent:@""];
[temp setEnabled:NO];
[temp setTarget:NDS];
*/
#else
for(i = 0; i < SAVE_SLOTS; i++)
{
saveSlot_item[i] = nil;
loadSlot_item[i] = nil;
}
#endif
[file addItem:[NSMenuItem separatorItem]];
close_rom_item = [file addItemWithTitle:NSLocalizedString(@"Close ROM", nil) action:@selector(askAndCloseROM) keyEquivalent:@"w"];
[close_rom_item setEnabled:NO];
[close_rom_item setTarget:NDS];
[file release];
//Create the Emulation Menu
emulation = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Emulation", nil)];
[emulation setAutoenablesItems:NO];
[menu setSubmenu:emulation forItem:emulation_item];
execute_item = [emulation addItemWithTitle:NSLocalizedString(@"Execute", nil) action:@selector(execute) keyEquivalent:@""];
[execute_item setTarget:NDS];
[execute_item setEnabled:NO];
pause_item = [emulation addItemWithTitle:NSLocalizedString(@"Pause", nil) action:@selector(pause) keyEquivalent:@""];
[pause_item setTarget:NDS];
[pause_item setEnabled:NO];
reset_item = [emulation addItemWithTitle:NSLocalizedString(@"Reset", nil) action:@selector(reset) keyEquivalent:@""];
[reset_item setTarget:NDS];
[reset_item setEnabled:NO];
[emulation addItem:[NSMenuItem separatorItem]];
@ -294,22 +254,15 @@ a way to get the time of a save that's not a string / human formatted...
frame_skip_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Frame Skip", nil)];
[temp setSubmenu:frame_skip_menu];
frame_skip_auto_item = [frame_skip_menu addItemWithTitle:NSLocalizedString(@"Auto", nil) action:@selector(setFrameSkip:) keyEquivalent:@""];
[frame_skip_auto_item setTarget:NDS];
[frame_skip_auto_item setState:NSOnState];
[frame_skip_auto_item setEnabled:YES];
frame_skip_auto_item = [frame_skip_menu addItemWithTitle:NSLocalizedString(@"Auto", nil) action:@selector(setFrameSkipFromMenuItem:) keyEquivalent:@""];
[frame_skip_menu addItem:[NSMenuItem separatorItem]];
frame_skip_item[0] = [frame_skip_menu addItemWithTitle:NSLocalizedString(@"Off", nil) action:@selector(setFrameSkip:) keyEquivalent:@""];
[frame_skip_item[0] setTarget:NDS];
[frame_skip_item[0] setEnabled:YES];
frame_skip_item[0] = [frame_skip_menu addItemWithTitle:NSLocalizedString(@"Off", nil) action:@selector(setFrameSkipFromMenuItem:) keyEquivalent:@""];
for(i = 1; i < MAX_FRAME_SKIP; i++)
{
frame_skip_item[i] = [frame_skip_menu addItemWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Skip %d", nil), i] action:@selector(setFrameSkip:) keyEquivalent:@""];
[frame_skip_item[i] setTarget:NDS];
[frame_skip_item[i] setEnabled:YES];
frame_skip_item[i] = [frame_skip_menu addItemWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Skip %d", nil), i] action:@selector(setFrameSkipFromMenuItem:) keyEquivalent:@""];
}
[frame_skip_menu release];
@ -321,17 +274,9 @@ a way to get the time of a save that's not a string / human formatted...
[menu setSubmenu:view forItem:view_item];
resize1x = [view addItemWithTitle:NSLocalizedString(@"Size 1x", nil) action:@selector(resizeScreen1x) keyEquivalent:@"1"];
[resize1x setState:NSOnState];
[resize1x setTarget:main_window];
resize2x = [view addItemWithTitle:NSLocalizedString(@"Size 2x", nil) action:@selector(resizeScreen2x) keyEquivalent:@"2"];
[resize2x setTarget:main_window];
resize3x = [view addItemWithTitle:NSLocalizedString(@"Size 3x", nil) action:@selector(resizeScreen3x) keyEquivalent:@"3"];
[resize3x setTarget:main_window];
resize4x = [view addItemWithTitle:NSLocalizedString(@"Size 4x", nil) action:@selector(resizeScreen4x) keyEquivalent:@"4"];
[resize4x setTarget:main_window];
[view addItem:[NSMenuItem separatorItem]];
/*
@ -339,17 +284,9 @@ a way to get the time of a save that's not a string / human formatted...
[view addItem:[NSMenuItem separatorItem]];
*/
allows_resize_item = [view addItemWithTitle:NSLocalizedString(@"Allow Resize", nil) action:@selector(toggleAllowsResize) keyEquivalent:@""];
[allows_resize_item setState:NSOnState];
[allows_resize_item setTarget:main_window];
constrain_item = [view addItemWithTitle:NSLocalizedString(@"Constrain Proportions", nil) action:@selector(toggleConstrainProportions) keyEquivalent:@""];
[constrain_item setState:NSOnState];
[constrain_item setTarget:main_window];
min_size_item = [view addItemWithTitle:NSLocalizedString(@"No Smaller Than DS", nil) action:@selector(toggleMinSize) keyEquivalent:@""];
[min_size_item setState:NSOnState];
[min_size_item setTarget:main_window];
toggle_status_bar_item = [view addItemWithTitle:NSLocalizedString(@"Show Status Bar", nil) action:@selector(toggleStatusBar) keyEquivalent:@"/"];
[view addItem:[NSMenuItem separatorItem]];
@ -358,20 +295,9 @@ a way to get the time of a save that's not a string / human formatted...
[temp setSubmenu: rotation_menu];
rotation0_item = [rotation_menu addItemWithTitle:NSLocalizedString(@"Rotation 0", nil) action:@selector(setRotation0) keyEquivalent:@""];
[rotation0_item setState:NSOnState];
[rotation0_item setTarget:main_window];
rotation90_item = [rotation_menu addItemWithTitle:NSLocalizedString(@"Rotation 90", nil) action:@selector(setRotation90) keyEquivalent:@""];
[rotation90_item setState:NSOffState];
[rotation90_item setTarget:main_window];
rotation180_item = [rotation_menu addItemWithTitle:NSLocalizedString(@"Rotation 180", nil) action:@selector(setRotation180) keyEquivalent:@""];
[rotation180_item setState:NSOffState];
[rotation180_item setTarget:main_window];
rotation270_item = [rotation_menu addItemWithTitle:NSLocalizedString(@"Rotation 270", nil) action:@selector(setRotation270) keyEquivalent:@""];
[rotation270_item setState:NSOffState];
[rotation270_item setTarget:main_window];
[rotation_menu release];
@ -382,48 +308,22 @@ a way to get the time of a save that's not a string / human formatted...
[temp setSubmenu: layer_menu];
topBG0_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG0", nil) action:@selector(toggleTopBackground0) keyEquivalent:@""];
[topBG0_item setState:NSOnState];
[topBG0_item setTarget:main_window];
topBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG1", nil) action:@selector(toggleTopBackground1) keyEquivalent:@""];
[topBG1_item setState:NSOnState];
[topBG1_item setTarget:main_window];
topBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG2", nil) action:@selector(toggleTopBackground2) keyEquivalent:@""];
[topBG2_item setState:NSOnState];
[topBG2_item setTarget:main_window];
topBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG3", nil) action:@selector(toggleTopBackground3) keyEquivalent:@""];
[topBG3_item setState:NSOnState];
[topBG3_item setTarget:main_window];
[layer_menu addItem:[NSMenuItem separatorItem]];
subBG0_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG0", nil) action:@selector(toggleSubBackground0) keyEquivalent:@""];
[subBG0_item setState:NSOnState];
[subBG0_item setTarget:main_window];
subBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG1", nil) action:@selector(toggleSubBackground1) keyEquivalent:@""];
[subBG1_item setState:NSOnState];
[subBG1_item setTarget:main_window];
subBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG2", nil) action:@selector(toggleSubBackground2) keyEquivalent:@""];
[subBG2_item setState:NSOnState];
[subBG2_item setTarget:main_window];
subBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG3", nil) action:@selector(toggleSubBackground3) keyEquivalent:@""];
[subBG3_item setState:NSOnState];
[subBG3_item setTarget:main_window];
[layer_menu release];
[view addItem:[NSMenuItem separatorItem]];
allows_resize_item = [view addItemWithTitle:NSLocalizedString(@"Screenshot to File", nil) action:@selector(screenShotToFile) keyEquivalent:@""];
[allows_resize_item setTarget:main_window];
allows_resize_item = [view addItemWithTitle:NSLocalizedString(@"Screenshot to Window", nil) action:@selector(screenShotToWindow) keyEquivalent:@""];
[allows_resize_item setTarget:main_window];
screenshot_to_file_item = [view addItemWithTitle:NSLocalizedString(@"Save Screenshot...", nil) action:@selector(saveScreenshot) keyEquivalent:@""];
[view release];
@ -439,29 +339,22 @@ a way to get the time of a save that's not a string / human formatted...
for(i = 0; i < 10; i++)
{
volume_item[i] = [volume_menu addItemWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Volume %d", nil), (i+1)*10] action:@selector(setVolume:) keyEquivalent:@""];
[volume_item[i] setTarget:NDS];
if(i == 9)
[volume_item[i] setState:NSOnState]; //check 100% volume since it's defaults
volume_item[i] = [volume_menu addItemWithTitle:[NSString stringWithFormat:NSLocalizedString(@"Volume %d", nil), (i+1)*10] action:@selector(setVolumeFromMenu:) keyEquivalent:@""];
}
[volume_menu release];
[sound_menu addItem:[NSMenuItem separatorItem]];
mute_item = [sound_menu addItemWithTitle:NSLocalizedString(@"Mute", nil) action:@selector(toggleMuting) keyEquivalent:@""];
[mute_item setTarget:NDS];
mute_item = [sound_menu addItemWithTitle:NSLocalizedString(@"Mute", nil) action:@selector(toggleMute) keyEquivalent:@""];
/*
[sound_menu addItem:[NSMenuItem separatorItem]];
temp = [sound_menu addItemWithTitle:@"Record to File..." action:@selector(chooseSoundOutputFile) keyEquivalent: @"r"];
[temp setTarget:NDS];
temp = [sound_menu addItemWithTitle:@"Pause Recording" action:@selector(startRecording) keyEquivalent: @""];
[temp setTarget:NDS];
temp = [sound_menu addItemWithTitle:@"Save Recording" action:@selector(pauseRecording) keyEquivalent: @""];
[temp setTarget:NDS];
*/
[sound_menu release];
@ -512,7 +405,7 @@ int main(int argc, char *argv[])
[NSApplication sharedApplication];
[NSApp setDelegate:[[AppDelegate alloc] init]];
return NSApplicationMain(argc, (const char **) argv);
return NSApplicationMain(argc, (const char**)argv);
}
//gdb stuff--------------------------------------------------------------------------------
@ -531,6 +424,22 @@ void joinThread_gdb(void *thread_handle)
@implementation AppDelegate
- (void)pickROM
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
if([panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"NDS", @"DS.GBA", nil]] == NSOKButton)
{
NSString* selected_file = [[panel filenames] lastObject]; //hopefully also the first object
[self application:NSApp openFile:selected_file];
}
}
- (BOOL)application:(NSApplication*)sender openFile:(NSString*)filename
{
//verify everything
@ -538,8 +447,11 @@ void joinThread_gdb(void *thread_handle)
if(!filename)return NO;
if([filename length] == 0)return NO;
if([NDS loadROM:filename])
if([main_window loadROM:filename])
{
//[main_window execute];
return YES;
}
return NO;
}
@ -554,8 +466,9 @@ void joinThread_gdb(void *thread_handle)
if(!filename)goto fail;
if([filename length] == 0)goto fail;
if([NDS loadROM:filename])
if([main_window loadROM:filename])
{
//[main_window execute];
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
@ -564,68 +477,39 @@ fail:
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
- (void)applicationWillFinishLaunching:(NSNotification*)notification
{
//Set default values for all preferences
//(this wont override saved preferences as
//they work in different preference domains)
setAppDefaults();
//create the menus
CreateMenu(self);
}
- (void)applicationDidFinishLaunching:(NSNotification*)notification
{
//Bring the application to the front
[NSApp activateIgnoringOtherApps:TRUE];
//create the global ds object
NDS = [[NintendoDS alloc] init];
//create the video output window (the only window that opens with the app)
main_window = [[VideoOutputWindow alloc] init];
//create the menus
CreateMenu();
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//init opengl 3d ness
NDS_3D_SetDriver (GPU3D_OPENGL);
if(!gpu3D->NDS_3D_Init())
messageDialog(NSLocalizedString(@"Error", nil), @"Unable to initialize OpenGL components");
#ifdef MULTITHREADED
//Breakoff a thread to run
[NSApplication detachDrawingThread:@selector(run) toTarget:NDS withObject:nil];
#else
[NDS run];
//it seems we need an event before it will quit
//(probably applicationWillTersminatehas something to do with calling run from applicationDidFinishLaunching?)
[NSEvent startPeriodicEventsAfterDelay:0 withPeriod:1];
#endif
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
{
//Ask user if he/she wants to quit
if(AskForQuit())
//ask the user if quitting is acceptable
if(messageDialogYN(NSLocalizedString(@"DeSmuME Emulator", nil), NSLocalizedString(@"Are you sure you want to quit?", nil)))
return NSTerminateNow;
else
return NSTerminateCancel;
}
- (void)applicationWillTerminate:(NSNotification*)aNotification
- (void)applicationWillTerminate:(NSNotification*)notification
{
//Quit
[NDS destroy];
finished = true;
//Free memory
[main_window release];
[NSApp setServicesMenu:nil];
[NSApp setMainMenu:nil];
[menu release];
}
@end

View File

@ -17,39 +17,52 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#import <Cocoa/Cocoa.h>
@class VideoOutputView;
//this is used internally by VideoOutputWindow
#import "nds_control.h"
@class VideoOutputView;
@class InputHandler;
//this is used internally by VideoOutputWindow
//This interface is to create and manaage the window
//that displays DS video output and takes keyboard/mouse input
//do not instanciate more than one of these
@interface VideoOutputWindow : NSWindow
@interface VideoOutputWindow : NintendoDS
{
@private
NSWindow *window;
NSWindowController *controller;
VideoOutputView *video_output_view;
NSTextField *status_view;
InputHandler *input;
float status_bar_height;
bool no_smaller_than_ds;
bool keep_proportions;
}
//initialization
- (id)init;
- (void)dealloc;
//call this function to read the screen from the emulator and update the window
//this is the only method involving cocoa that should be called from the run() function
- (void)updateScreen;
//overloaded from NintendoDS class
- (BOOL)loadROM:(NSString*)filename;
- (void)execute;
- (void)pause;
- (void)reset;
- (void)setFrameSkip:(int)frameskip;
- (void)closeROM;
//
- (void)clearScreenWhite; //for when a rom is loaded but stopped
- (void)clearScreenBlack; //for when the emulator is not loaded
//save features overloaded from nds class
- (BOOL)saveState:(NSString*)file;
- (BOOL)loadState:(NSString*)file;
- (BOOL)saveStateToSlot:(int)slot; //0 to MAX_SLOTS-1, anything else is ignored
- (BOOL)loadStateFromSlot:(int)slot;
//resets the min size internalls (when rotation changes), shouldn't be used from outside
- (void)resetMinSize:(bool)resize;
//save functions for the program menu to callback to
- (BOOL)saveStateAs;
- (BOOL)loadStateFrom;
//toggles between allowing tiny sizes and only being as small as DS
- (void)toggleMinSize;
@ -58,16 +71,18 @@
//this is screen size not window size
- (void)resizeScreen:(NSSize)size;
//like resizeScreen but does a size in relation to DS pixels
- (void)resizeScreen1x;
- (void)resizeScreen2x;
- (void)resizeScreen3x;
- (void)resizeScreen4x;
//converts window coords to DS coords
- (NSPoint)windowPointToDSCoords:(NSPoint)location;
//
- (void)toggleAllowsResize;
- (void)toggleConstrainProportions;
- (void)toggleStatusBar;
//rotation
- (void)setRotation0;
@ -86,19 +101,9 @@
- (void)toggleSubBackground3;
//screenshots
- (void)screenShotToFile;
- (void)screenShotToWindow;
- (const unsigned char *)getBuffer;//pause before calling
- (void)saveScreenshot;
//keyboard input
- (void)keyDown:(NSEvent*)event;
- (void)keyUp:(NSEvent*)event;
//mouse input
- (void)mouseDown:(NSEvent*)event;
- (void)mouseDragged:(NSEvent*)event;
- (void)mouseUp:(NSEvent*)event;
//delegate
- (void)windowDidBecomeMain:(NSNotification*)notification;
@end
#endif //MAIN_WINDOW_H

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#!/bin/bash
#This script builds the application bundle so that DeSmuME can run.
#This script builds the application bundle so that DeSmuME can run when compiled from Code::Blocks
#
lipo DeSmuME.app/Contents/MacOS/DeSmuME_x86 DeSmuME.app/Contents/MacOS/DeSmuME_ppc -create -output DeSmuME.app/Contents/MacOS/DeSmuME
@ -12,6 +12,12 @@ cp Info.plist DeSmuME.app/Contents/Info.plist
cp PkgInfo DeSmuME.app/Contents/PkgInfo
cp InfoPlist.strings DeSmuME.app/Contents/Resources/InfoPlist.strings
cp DeSmuME.icns DeSmuME.app/Contents/Resources/DeSmuME.icns
cp ../../COPYING DeSmuME.app/Contents/Resources/COPYING
cp ../../README DeSmuME.app/Contents/Resources/README
cp ../../README.MAC DeSmuME.app/Contents/Resources/README.MAC
cp ../../AUTHORS DeSmuME.app/Contents/Resources/AUTHORS
cp ../../README.TRANSLATION DeSmuME.app/Contents/Resources/README.TRANSLATION
cp ../../ChangeLog DeSmuME.app/Contents/Resources/ChangeLog
#English
mkdir -p DeSmuME.app/Contents/Resources/English.lproj

View File

@ -17,58 +17,184 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef NDS_CONTROL_H_INCLUDED
#define NDS_CONTROL_H_INCLUDED
#import "globals.h"
#include <Cocoa/Cocoa.h>
#define MAX_SLOTS 10
#define MAX_FRAME_SKIP 10
//This class manages emulation
//dont instanciate more than once!
#define DS_SCREEN_WIDTH 256
#define DS_SCREEN_HEIGHT 192
#define DS_BPP 2 //bytes per pixel
#define DS_SCREEN_X_RATIO (256.0 / (192.0 * 2.0))
#define DS_SCREEN_Y_RATIO ((192.0 * 2.0) / 256.0)
@class ScreenState;
//This class is a compelte objective-c wrapper for
//the core emulation features, other objective-c code inherit
//upon or instanciate this to add interfaces for these features
//Please only instanciate once.
@interface NintendoDS : NSObject
{
BOOL muted;
@private
NSOpenGLContext* context; //context where the 3d gets renderered to
NSOpenGLPixelFormat* pixel_format; //pixel format for opengl 3d renderer
NSThread *gui_thread;
SEL display_func; //the function id that gets called when the screen is ready to update
id display_object; //the object that the above function is called on
SEL error_func;
id error_object;
NSLock *sound_lock;
ScreenState * volatile current_screen;
NSLock *video_update_lock;
volatile bool finish; //set to true to make the other thread finish
volatile bool finished; //set to true by the other thread after it finishes
volatile bool run; //set to control execution in other thread
volatile bool paused; //sey by other thread to let us know if its executing
bool muted;
int volume;
volatile int frame_skip;
NSString *current_file;
unsigned char gpu_buff[256 * 256 * 5]; //this is where the 3D rendering of the NDS is stored
}
//
//Instanciating, setup, and deconstruction
- (id)init;
- (id)destroy;
- (void)setVideoUpdateCallback:(SEL)callback withObject:(id)object; //this callback should take one ScreenState(below) parameter
- (void)setErrorCallback:(SEL)callback withObject:(id)object;
- (void)dealloc;
//Firmware control
- (void)setPlayerName:(NSString*)player_name;
//ROM control
- (void)pickROM;
- (BOOL)loadROM:(NSString*)filename;
- (BOOL)ROMLoaded;
- (void)closeROM;
- (void)askAndCloseROM;
//ROM Info
- (NSImage*)ROMIcon;
- (NSString*)ROMFile;
- (NSString*)ROMTitle;
- (NSInteger)ROMMaker;
- (NSInteger)ROMSize;
- (NSInteger)ROMARM9Size;
- (NSInteger)ROMARM7Size;
- (NSInteger)ROMDataSize;
//execution control
- (BOOL)executing;
- (void)execute;
- (BOOL)paused;
- (void)pause;
- (void)reset;
- (void)setFrameSkip:(id)sender;
- (void)setFrameSkip:(int)frameskip; //negative is auto, 0 is off, more than 0 is the amount of frames to skip before showing a frame
- (int)frameSkip; //defaults to -1
//run function (should be called at the start of the program)
- (void)run;
//touch screen
- (void)touch:(NSPoint)point;
- (void)releaseTouch;
//button input
- (void)pressStart;
- (void)liftStart;
- (BOOL)start;
- (void)pressSelect;
- (void)liftSelect;
- (BOOL)select;
- (void)pressLeft;
- (void)liftLeft;
- (BOOL)left;
- (void)pressRight;
- (void)liftRight;
- (BOOL)right;
- (void)pressUp;
- (void)liftUp;
- (BOOL)up;
- (void)pressDown;
- (void)liftDown;
- (BOOL)down;
- (void)pressA;
- (void)liftA;
- (BOOL)A;
- (void)pressB;
- (void)liftB;
- (BOOL)B;
- (void)pressX;
- (void)liftX;
- (BOOL)X;
- (void)pressY;
- (void)liftY;
- (BOOL)Y;
- (void)pressL;
- (void)liftL;
- (BOOL)L;
- (void)pressR;
- (void)liftR;
- (BOOL)R;
//save states
- (void)saveStateAs;
- (void)loadStateFrom;
- (void)saveToSlot:(id)sender;
- (void)loadFromSlot:(id)sender;
//- (void)askAndClearStates;
- (BOOL)saveState:(NSString*)file;
- (BOOL)loadState:(NSString*)file;
- (BOOL)saveStateToSlot:(int)slot; //0 to MAX_SLOTS-1, anything else is ignored
- (BOOL)loadStateFromSlot:(int)slot;
- (BOOL)saveStateExists:(int)slot;
//
- (void)showRomInfo;
//layers
- (void)toggleTopBackground0;
- (BOOL)showingTopBackground0;
- (void)toggleTopBackground1;
- (BOOL)showingTopBackground1;
- (void)toggleTopBackground2;
- (BOOL)showingTopBackground2;
- (void)toggleTopBackground3;
- (BOOL)showingTopBackground3;
- (void)toggleSubBackground0;
- (BOOL)showingSubBackground0;
- (void)toggleSubBackground1;
- (BOOL)showingSubBackground1;
- (void)toggleSubBackground2;
- (BOOL)showingSubBackground2;
- (void)toggleSubBackground3;
- (BOOL)showingSubBackground3;
//sound
- (void)setVolume:(id)sender;
- (void)toggleMuting;
- (void)chooseSoundOutputFile;
- (void)startRecording;
- (void)pauseRecording;
//Sound
- (void)setVolume:(int)volume; //clamped: 0 to 100
- (int)volume;
- (void)enableMute;
- (void)disableMute;
- (void)toggleMute;
- (BOOL)muted;
@end
@end
#endif // NDS_CONTROL_H_INCLUDED
enum ScreenRotation { ROTATION_0, ROTATION_90, ROTATION_180, ROTATION_270 };
//This class is used to return screen data at the end of a frame
//we wrap it in a obj-c class so it can be passed to a selector
//and so we get retain/release niftyness
@interface ScreenState : NSObject
{
enum ScreenRotation rotation;
unsigned char color_data[DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT*2 * DS_BPP];
}
- (id)init;
- (id)initWithScreenState:(ScreenState*)state;
- (NSInteger)width;
- (NSInteger)height;
- (NSSize)size;
- (void)fillWithWhite;
- (void)fillWithBlack;
- (NSBitmapImageRep*)imageRep;
- (void)setRotation:(enum ScreenRotation)rotation;
- (enum ScreenRotation)rotation;
- (void)setColorData:(const unsigned char*)data;
- (const unsigned char*)colorData;
@end

File diff suppressed because it is too large Load Diff

View File

@ -17,18 +17,4 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PREFERENCES_H_INCLUDED
#define PREFERENCES_H_INCLUDED
//These string have to be used in various places,
//so having defines makes sure they are consistent
#define PREF_EXECUTE_UPON_LOAD @"Execute Upon Load"
#define PREF_FIRMWARE_LANGUAGE @"Firmware Language"
#define PREF_FIRMWARE_PLAYER_NAME @"Firmware Player Name"
#define PREF_3D_PLUGIN @"3D Graphics Plugin"
#define PREF_SOUND_PLUGIN @"Sound Plugin"
#endif
void setAppDefaults(); //this is defined in preferences.m and should be called at app launch

View File

@ -17,20 +17,22 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import "globals.h"
#import "preferences.h"
#import "nds_control.h"
#include "globals.h"
/* Preference settings are stored using NSUserDefaults
which should put them in a propert list in /Users/username/Library/Preferences
which should put them in a property list in /Users/username/Library/Preferences
For the keys we use the same strings you see in the preference menu
such as "Language" to keep things simple, of course the unlocalized version
such as "Execute Upon Load" to keep things simple, of course the unlocalized version
of the strings are used so that when you change language it will still
finds the settings from before. Also theres no guarantee that localized
strings will be unique.
*/
#define PREF_EXECUTE_UPON_LOAD @"Execute Upon Load"
///////////////////////////////
NSWindow *preferences_window = NULL;
@ -65,8 +67,8 @@ NSDictionary *desmume_defaults;
- (void)textDidChange:(NSNotification*)notification
{
NSText *text_field = [notification object];
NSString *text = [text_field string];
//NSText *text_field = [notification object];
//NSString *text = [text_field string];
}
@ -98,51 +100,6 @@ NSDictionary *desmume_defaults;
@implementation NSApplication(custom_extensions)
- (void)launchWebsite
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://desmume.sourceforge.net"]];
}
- (void)launchForums
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://forums.desmume.org/index.php"]];
}
- (void)bugReport
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291"]];
}
- (void)orderFrontStandardAboutPanel:(id)sender
{
bool was_paused = paused;
[NDS pause];
NSRunAlertPanel([sender title],
@"DeSmuME is an open source Nintendo DS emulator.\n\nBased off of YopYop's original work, and continued by the DeSmuME team.\n\
\nhttp://www.desmume.org\n\n\n\
This program is free software; you can redistribute 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. \
\n\n\
This program is distributed in the hope that it will be \
useful,but WITHOUT ANY WARRANTY; without even the implied \
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR \
PURPOSE. See the GNU General Public License for more details. \
\n\n\
You should have received a copy of the GNU General Public \
License along with this program; if not, write to the Free \
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \
MA 02111-1307 USA\
\n\n\
See the GNU General Public License details in COPYING.", nil/*OK*/, nil, nil);
if(!was_paused)[NDS execute];
}
///////////////////////////////////////////////////
NSView *createPreferencesView(NSTabViewItem *tab, NSDictionary *options, id delegate)
{
//create the view
@ -281,8 +238,8 @@ void setAppDefaults()
@"Yes", PREF_EXECUTE_UPON_LOAD,
//Firmware defaults
@"DeSmuME User", PREF_FIRMWARE_PLAYER_NAME,
@"English", PREF_FIRMWARE_LANGUAGE,
//@"DeSmuME User", PREF_FIRMWARE_PLAYER_NAME,
//@"English", PREF_FIRMWARE_LANGUAGE,
nil];
[desmume_defaults retain];
@ -306,8 +263,8 @@ void setAppDefaults()
- (void)orderFrontDataLinkPanel:(id)sender //<- Preferences Display Function
{
bool was_paused = paused;
[NDS pause];
//bool was_paused = paused;
//[NDS pause]; fixme
if(!preferences_window)
{
@ -317,9 +274,6 @@ void setAppDefaults()
//get the applications main bundle
NSBundle* app_bundle = [NSBundle mainBundle];
//grab the list of languages
NSArray *languages = [app_bundle localizations];
//get a font for displaying text
preferences_font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
@ -364,7 +318,7 @@ void setAppDefaults()
[NSArray arrayWithObjects:@"Bool", [NSData dataWithBytes:&@selector(executeUponLoad:) length:sizeof(SEL)], @"Yes", @"No",nil]
, PREF_EXECUTE_UPON_LOAD, nil];
NSView *interface_view = createPreferencesView(interface_pane_tab, interface_options, delegate);
/*NSView *interface_view = */createPreferencesView(interface_pane_tab, interface_options, delegate);
/*
//Create the firmware pane
firmware_pane_tab = [[NSTabViewItem alloc] initWithIdentifier:nil];
@ -395,6 +349,6 @@ void setAppDefaults()
[NSApp runModalForWindow:preferences_window];
if(!was_paused)[NDS execute];
//if(!was_paused)[NDS execute]; fixme
}
@end

View File

@ -0,0 +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

View File

@ -0,0 +1,301 @@
/* 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 "rom_info.h"
#import "nds_control.h"
bool leopard_or_later = false;
int HUDWindowMask = 1 << 13; //this is NSHUDWindowMask from Leopard, defined here so we can mantain tiger compile compatability
float sectionMaxWidth;
NSWindowController *my_window_controller = nil;
NSWindow *my_window;
NSImageView *rom_icon;
NSTextField *rom_file;
NSTextField *rom_title;
NSTextField *rom_maker;
NSTextField *rom_size;
NSTextField *rom_ARM9_size;
NSTextField *rom_ARM7_size;
NSTextField *rom_data_size;
inline void setUpTextField(NSTextField *text, bool data)
{
[text setEditable:NO];
[text setDrawsBackground:NO];
[text setBordered:NO];
[text setBezeled:NO];
if(!data)
{
[text setSelectable:NO];
if(leopard_or_later)
[text setTextColor:[NSColor whiteColor]];
else
[text setTextColor:[NSColor blackColor]];
} else
{
[text setSelectable:YES];
if(leopard_or_later)
[text setTextColor:[NSColor colorWithCalibratedRed:.85 green:.85 blue:.9 alpha:1]];
else
[text setTextColor:[NSColor colorWithCalibratedRed:.15 green:.15 blue:.1 alpha:1]];
}
[text sizeToFit];
}
@implementation ROMInfo
+ (void)showROMInfo:(NintendoDS*)DS;
{
if(my_window_controller != nil)
{
//window has already been created, just change the info
[ROMInfo changeDS:DS];
return;
}
//Check for MAC OS 10.5 or later (if so, we'll use a nice pretty HUD window)
//this is a bit hacky. check if nswindow will respond to a function thats new in 10.5
if([NSWindow instancesRespondToSelector:@selector(setPreferredBackingLocation:)] == YES)
leopard_or_later = true;
else
leopard_or_later = false;
//Window has not been created
my_window = [[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,360,210) styleMask:(leopard_or_later?HUDWindowMask:0)|NSClosableWindowMask|NSTitledWindowMask|NSUtilityWindowMask backing:NSBackingStoreBuffered defer:NO];
[my_window setTitle:NSLocalizedString(@"ROM Info...", nil)];
if(my_window == nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"ROM Info window couldn't be created");
return;
}
//Rom icon text
NSTextField *text = [[NSTextField alloc] initWithFrame:NSMakeRect(15,173,90,17)];
[text setStringValue:NSLocalizedString(@"ROM Icon", nil)];
setUpTextField(text, false);
[[my_window contentView] addSubview:text];
[text release];
//Rom icon picture
rom_icon = [[NSImageView alloc] initWithFrame:NSMakeRect(15, 70, 96, 96)];
[rom_icon setImageFrameStyle:NSImageFramePhoto];
[rom_icon setImageScaling:NSScaleToFit];
[rom_icon setEditable:NO];
[rom_icon setAllowsCutCopyPaste:NO];
[rom_icon setImage:[DS ROMIcon]];
[[my_window contentView] addSubview:rom_icon];
sectionMaxWidth = 0;
float valueMaxWidth = 0;
//Rom file
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,173,96,17)];
[text setStringValue:NSLocalizedString(@"ROM File", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//Rom title
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,148,96,17)];
[text setStringValue:NSLocalizedString(@"ROM Title", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//Rom maker
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,123,96,17)];
[text setStringValue:NSLocalizedString(@"ROM Maker", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//Rom size
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,98,96,17)];
[text setStringValue:NSLocalizedString(@"ROM Size", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//ARM 9 Size
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,73,96,17)];
[text setStringValue:NSLocalizedString(@"ARM9 Size", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//ARM 7 Size
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,48,96,17)];
[text setStringValue:NSLocalizedString(@"ARM7 Size", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
//Data Size
text = [[NSTextField alloc] initWithFrame:NSMakeRect(127,23,96,17)];
[text setStringValue:NSLocalizedString(@"Data Size", nil)];
setUpTextField(text, false);
if([text frame].size.width > sectionMaxWidth)sectionMaxWidth = [text frame].size.width;
[[my_window contentView] addSubview:text];
[text release];
sectionMaxWidth += 5; //padding between the keys and their values
#define text sjdkasdladsjkalsd
//Rom file value
rom_file = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,173,120,17)];
[rom_file setStringValue:[[DS ROMFile] lastPathComponent]];
setUpTextField(rom_file, true);
if([rom_file frame].size.width > valueMaxWidth)valueMaxWidth = [rom_file frame].size.width;
[[my_window contentView] addSubview:rom_file];
//Rom title value
rom_title = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,148,120,17)];
[rom_title setStringValue:[DS ROMTitle]];
setUpTextField(rom_title, true);
if([rom_title frame].size.width > valueMaxWidth)valueMaxWidth = [rom_title frame].size.width;
[[my_window contentView] addSubview:rom_title];
//Rom maker value
rom_maker = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,123,120,17)];
[rom_maker setStringValue:[NSString stringWithFormat:@"%d", [DS ROMMaker]]];
setUpTextField(rom_maker, true);
if([rom_maker frame].size.width > valueMaxWidth)valueMaxWidth = [rom_maker frame].size.width;
[[my_window contentView] addSubview:rom_maker];
//Rom size value
rom_size = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,98,120,17)];
[rom_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMSize]]];
setUpTextField(rom_size, true);
if([rom_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_size frame].size.width;
[[my_window contentView] addSubview:rom_size];
//ARM 9 Size value
rom_ARM9_size = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,73,120,17)];
[rom_ARM9_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMARM9Size]]];
setUpTextField(rom_ARM9_size, true);
if([rom_ARM9_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_ARM9_size frame].size.width;
[[my_window contentView] addSubview:rom_ARM9_size];
//ARM 7 Size value
rom_ARM7_size = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,48,120,17)];
[rom_ARM7_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMARM7Size]]];
setUpTextField(rom_ARM7_size, true);
if([rom_ARM7_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_ARM7_size frame].size.width;
[[my_window contentView] addSubview:rom_ARM7_size];
//Data Size value
rom_data_size = [[NSTextField alloc] initWithFrame:NSMakeRect(127+sectionMaxWidth,23,120,17)];
[rom_data_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMDataSize]]];
setUpTextField(rom_data_size, true);
if([rom_data_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_data_size frame].size.width;
[[my_window contentView] addSubview:rom_data_size];
valueMaxWidth += 5; //padding after the values column
//Resize window to fit content
NSRect temp = [my_window frame];
temp.size.width = 127 + sectionMaxWidth + valueMaxWidth;
[my_window setFrame:temp display:NO];
//Create the window controller and display the window
my_window_controller = [[NSWindowController alloc] initWithWindow:my_window];
if(my_window_controller == nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"ROM Info window controller couldn't be created");
[my_window release];
return;
}
[my_window_controller showWindow:nil];
[my_window release];
}
+ (void)changeDS:(NintendoDS*)DS
{
if(my_window_controller == nil)return;
float valueMaxWidth = 0;
[rom_icon setImage:[DS ROMIcon]];
[rom_file setStringValue:[[DS ROMFile] lastPathComponent]];
[rom_file sizeToFit];
if([rom_file frame].size.width > valueMaxWidth)valueMaxWidth = [rom_file frame].size.width;
[rom_title setStringValue:[DS ROMTitle]];
[rom_title sizeToFit];
if([rom_title frame].size.width > valueMaxWidth)valueMaxWidth = [rom_title frame].size.width;
[rom_maker setStringValue:[NSString stringWithFormat:@"%d", [DS ROMMaker]]];
[rom_maker sizeToFit];
if([rom_maker frame].size.width > valueMaxWidth)valueMaxWidth = [rom_maker frame].size.width;
[rom_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMSize]]];
[rom_size sizeToFit];
if([rom_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_size frame].size.width;
[rom_ARM9_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMARM9Size]]];
[rom_ARM9_size sizeToFit];
if([rom_ARM9_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_ARM9_size frame].size.width;
[rom_ARM7_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMARM7Size]]];
[rom_ARM7_size sizeToFit];
if([rom_ARM7_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_ARM7_size frame].size.width;
[rom_data_size setStringValue:[NSString stringWithFormat:@"%d", [DS ROMDataSize]]];
[rom_data_size sizeToFit];
if([rom_data_size frame].size.width > valueMaxWidth)valueMaxWidth = [rom_data_size frame].size.width;
//Resize window to fit new content
NSRect temp = [my_window frame];
temp.size.width = 127 + sectionMaxWidth + valueMaxWidth;
[my_window setFrame:temp display:NO];
}
+ (void)closeROMInfo
{
if(my_window_controller == nil)return;
[my_window_controller release];
my_window_controller = nil;
[rom_icon release];
[rom_file release];
[rom_title release];
[rom_maker release];
[rom_size release];
[rom_ARM9_size release];
[rom_ARM7_size release];
[rom_data_size release];
}
@end

View File

@ -17,30 +17,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SCREENSHOT_H
#define SCREENSHOT_H
#import <Cocoa/Cocoa.h>
#define OBJ_C
#include "../types.h"
#undef BOOL
@class ScreenState;
@interface Screenshot : NSObject
{
NSWindowController *controller;
NSWindow *window;
NSImage *image;
NSImageView *image_view;
NSButton *save_button;
NSButton *update_button;
NSBitmapImageRep *image_rep;
NSView *format_selection;
NSPopUpButton *format_button;
}
- (id)initWithBuffer:(volatile const u8*)buffer rotation:(u8)rotation saveOnly:(BOOL)save_only;
- (void)dealloc;
@interface Screenshot : NSObject {}
+ (void)saveScreenshotAs:(const ScreenState*)screen;
@end
#endif

View File

@ -17,356 +17,180 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Cocoa/Cocoa.h>
//DeSmuME Cocoa includes
#import "globals.h"
#import "screenshot.h"
#import "main_window.h"
#import "nds_control.h"
//DeSmuME general includes
#define OBJ_C
#include "../MMU.h"
#include "../GPU.h"
#undef BOOL
#define BUTTON_HEIGHT 26.
#define RESIZE_CONTROL_WIDTH 12.
#define NUM_BUTTONS 2.
@interface Screenshot (delegate)
- (void)windowDidResize:(NSNotification*)aNotification;
- (void)saveButtonPressed;
- (void)updateButtonPressed;
- (BOOL)panel:(id)sender isValidFilename:(NSString*)filename;
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
@interface ScreenshotSaveDelegate : NSObject
{
NSSavePanel *my_panel;
}
- (id)init;
- (void)setPanel:(NSSavePanel*)panel;
- (void)dealloc;
- (void)buttonPressed:(id)sender;
@end
@implementation Screenshot (delegate)
- (void)windowDidResize:(NSNotification*)aNotification
@implementation ScreenshotSaveDelegate
- (id)init
{
NSRect content_frame = [[window contentView] frame];
[image_view setFrame:NSMakeRect(0, BUTTON_HEIGHT, content_frame.size.width, content_frame.size.height - BUTTON_HEIGHT)];
self = [super init];
if(self == nil)return self;
float button_width = (content_frame.size.width - RESIZE_CONTROL_WIDTH) / NUM_BUTTONS;
[save_button setFrame:NSMakeRect(0, 0, button_width, BUTTON_HEIGHT)];
[update_button setFrame:NSMakeRect(button_width, 0, button_width, BUTTON_HEIGHT)];
my_panel = nil;
return self;
}
- (void)saveButtonPressed
{//localize
NSSavePanel *panel = [NSSavePanel savePanel];
- (void)setPanel:(NSSavePanel*)panel;
{
[my_panel release];
my_panel = panel;
[my_panel retain];
}
//Create format selection list
NSRect rect;
rect.size.width = 130;
rect.size.height = 26;
rect.origin.x = 230;
rect.origin.y = 200;
- (void)dealloc
{
[my_panel release];
[super dealloc];
}
[panel setTitle:NSLocalizedString(@"Save Screenshot to File", nil)];
//[panel setAllowedFileTypes:[NSArray arrayWithObjects:@"bmp",@"gif",nil]];
if(!format_selection)
- (void)buttonPressed:(id)sender
{
if([sender indexOfSelectedItem] == 0)
{
NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
NSTextView *format_text = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,500,500)];
[format_text setFont:font];
[format_text setEditable:NO];
[format_text setDrawsBackground:NO];
[format_text setMaxSize:NSMakeSize(500,26)];
[format_text setMinSize:NSMakeSize(1,1)];
[format_text setHorizontallyResizable:YES];
[format_text setVerticallyResizable:YES];
[format_text setString:NSLocalizedString(@"Select Image Format: ", nil)];
[format_text sizeToFit];
//center vertically
NSRect temp = [format_text frame];
temp.origin.y = 26.0 / 2.0 - (float)[format_text frame].size.height / 2.0;
[format_text setFrame:temp];
format_button = [[NSPopUpButton alloc] initWithFrame:NSMakeRect([format_text frame].size.width,0,200,26) pullsDown:NO];
[format_button addItemWithTitle:NSLocalizedString(@"Pick by Extension", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"BMP", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"GIF", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"JPG", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"PNG", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"TIFF", nil)];
//[format_button setAction:@selector(??)];
//[format_button setTarget:self];
format_selection = [[NSView alloc] initWithFrame:NSMakeRect(0,0,[format_text frame].size.width + [format_button frame].size.width,26)];
[format_selection addSubview:format_button];
[format_selection addSubview:format_text];
}
[panel setAccessoryView:format_selection];
[panel setDelegate:self];
if(window)
[panel beginSheetForDirectory:@"" file:@"Screenshot.bmp" modalForWindow:window modalDelegate:self
didEndSelector:nil contextInfo:nil];
else
[panel runModal];
}
- (void)updateButtonPressed
{
BOOL was_paused = paused;
[NDS pause];
u8 *bitmap_data = [image_rep bitmapData];
const u16 *buffer_16 = (const u16*)[main_window getBuffer];
int i;
for(i = 0; i < [image_rep size].width * [image_rep size].height; i++)
{ //this loop we go through pixel by pixel and convert from 16bit to 24bit for the NSImage
*(bitmap_data++) = (*buffer_16 & 0x001F) << 3;
*(bitmap_data++) = (*buffer_16 & 0x03E0) >> 5 << 3;
*(bitmap_data++) = (*buffer_16 & 0x7C00) >> 10 << 3;
buffer_16++;
}
//there seems to be issues updating the image when
//it is scaled, probably due to some internal caching of the scaled version.
//resetting the image here to ensure that it updates properly.
[image_view setImage:nil];
[image_view setImage:image];
//tell the image to redraw [soon]
[image_view setNeedsDisplay:YES];
if(!was_paused)[NDS execute];
}
- (BOOL)panel:(id)sender isValidFilename:(NSString*)filename
{
NSBitmapImageFileType type = NSBMPFileType;
if([format_button indexOfSelectedItem] == 0)
[my_panel setAllowsOtherFileTypes:NO];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"bmp", @"gif", @"jpg", @"jpeg", @"png", @"tiff", nil]];
} else if([sender indexOfSelectedItem] == 2)
{
NSString *ext = [filename pathExtension];
if([ext caseInsensitiveCompare:@"gif"] == NSOrderedSame)
type = NSGIFFileType;
else if([ext caseInsensitiveCompare:@"jpg"] == NSOrderedSame)
type = NSJPEGFileType;
else if([ext caseInsensitiveCompare:@"jpeg"] == NSOrderedSame)
type = NSJPEGFileType;
else if([ext caseInsensitiveCompare:@"png"] == NSOrderedSame)
type = NSPNGFileType;
else if([ext caseInsensitiveCompare:@"tiff"] == NSOrderedSame)
type = NSTIFFFileType;
[my_panel setAllowsOtherFileTypes:YES];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"gif", nil]];
} else if([sender indexOfSelectedItem] == 3)
{
[my_panel setAllowsOtherFileTypes:YES];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"jpg", @"jpeg", nil]];
} else if([sender indexOfSelectedItem] == 4)
{
[my_panel setAllowsOtherFileTypes:YES];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"png", nil]];
} else if([sender indexOfSelectedItem] == 5)
{
[my_panel setAllowsOtherFileTypes:YES];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"tiff", nil]];
} else
{
[my_panel setAllowsOtherFileTypes:YES];
[my_panel setAllowedFileTypes:[NSArray arrayWithObjects:@"bmp", nil]];
}
if([format_button indexOfSelectedItem] == 2)
type = NSGIFFileType;
if([format_button indexOfSelectedItem] == 3)
type = NSJPEGFileType;
if([format_button indexOfSelectedItem] == 4)
type = NSPNGFileType;
if([format_button indexOfSelectedItem] == 5)
type = NSTIFFFileType;
[[image_rep representationUsingType:type properties:[NSDictionary dictionary]]
writeToFile:filename atomically:NO];
return YES;
}
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
NSString *ext = [filename pathExtension];
int index = [format_button indexOfSelectedItem];
if((index == 1) || (index == 0))
if([ext caseInsensitiveCompare:@"bmp"] == NSOrderedSame)
return YES;
if((index == 2) || (index == 0))
if([ext caseInsensitiveCompare:@"gif"] == NSOrderedSame)
return YES;
if((index == 3) || (index == 0))
if(([ext caseInsensitiveCompare:@"jpg"] == NSOrderedSame) || ([ext caseInsensitiveCompare:@"jpeg"] == NSOrderedSame))
return YES;
if((index == 4) || (index == 0))
if([ext caseInsensitiveCompare:@"png"] == NSOrderedSame)
return YES;
if((index == 5) || (index == 0))
if([ext caseInsensitiveCompare:@"tiff"] == NSOrderedSame)
return YES;
return NO;
[my_panel validateVisibleColumns];
}
@end
@implementation Screenshot
- (id)initWithBuffer:(volatile const u8*)buffer rotation:(u8)rotation saveOnly:(BOOL)save_only
+ (void)saveScreenshotAs:(const ScreenState*)screen
{
self = [super init];
[screen retain];
//this gets set upon the first save panel
format_selection = nil;
window = nil;
//create a save panel ------------------------------------
NSRect rect;
if(rotation == ROTATION_0 || rotation == ROTATION_180)
ScreenshotSaveDelegate *save_delegate = [[ScreenshotSaveDelegate alloc] init];
NSSavePanel *panel = [NSSavePanel savePanel];
[panel retain];
[panel setTitle:NSLocalizedString(@"Save Screenshot to File...", nil)];
//[panel setCanSelectHiddenExtension:YES];
//create the accessory view ------------------------------
NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
NSTextView *format_text = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,500,500)];
[format_text setFont:font];
[format_text setEditable:NO];
[format_text setDrawsBackground:NO];
[format_text setMaxSize:NSMakeSize(500,26)];
[format_text setMinSize:NSMakeSize(1,1)];
[format_text setHorizontallyResizable:YES];
[format_text setVerticallyResizable:YES];
[format_text setString:NSLocalizedString(@"Select Image Format: ", nil)];
[format_text sizeToFit];
NSRect temp = [format_text frame]; //center
temp.origin.y = 26.0 / 2.0 - (float)[format_text frame].size.height / 2.0;
[format_text setFrame:temp];
NSPopUpButton *format_button = [[NSPopUpButton alloc] initWithFrame:NSMakeRect([format_text frame].size.width,0,200,26) pullsDown:NO];
[format_button addItemWithTitle:NSLocalizedString(@"Pick by Extension", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"BMP", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"GIF", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"JPG", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"PNG", nil)];
[format_button addItemWithTitle:NSLocalizedString(@"TIFF", nil)];
[format_button setAction:@selector(buttonPressed:)];
[format_button setTarget:save_delegate];
NSView *format_selection = [[NSView alloc] initWithFrame:NSMakeRect(0,0,[format_text frame].size.width + [format_button frame].size.width,26)];
[format_selection addSubview:format_text];
[format_text release];
[format_selection addSubview:format_button];
[panel setAccessoryView:format_selection];
[format_selection release];
[save_delegate setPanel:panel];
//run the save panel -------------------------------------
if([panel runModalForDirectory:nil file:nil] == NSFileHandlingPanelOKButton)
{
rect.size.width = DS_SCREEN_WIDTH;
rect.size.height = DS_SCREEN_HEIGHT_COMBINED;
} else
{
rect.size.width = DS_SCREEN_HEIGHT_COMBINED;
rect.size.height = DS_SCREEN_WIDTH;
}
rect.origin.x = 200;
rect.origin.y = 200;
//save the image -------------------------------------
//create the image
image_rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:rect.size.width
pixelsHigh:rect.size.height
bitsPerSample:8
samplesPerPixel:3
hasAlpha:NO
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bytesPerRow:rect.size.width * 3
bitsPerPixel:24];
//get the file type
NSBitmapImageFileType type = NSBMPFileType;
if([format_button indexOfSelectedItem] == 0)
{
NSString *ext = [[panel filename] pathExtension];
if([ext caseInsensitiveCompare:@"gif"] == NSOrderedSame)
type = NSGIFFileType;
else if([ext caseInsensitiveCompare:@"jpg"] == NSOrderedSame)
type = NSJPEGFileType;
else if([ext caseInsensitiveCompare:@"jpeg"] == NSOrderedSame)
type = NSJPEGFileType;
else if([ext caseInsensitiveCompare:@"png"] == NSOrderedSame)
type = NSPNGFileType;
else if([ext caseInsensitiveCompare:@"tiff"] == NSOrderedSame)
type = NSTIFFFileType;
}
if([format_button indexOfSelectedItem] == 2)
type = NSGIFFileType;
if([format_button indexOfSelectedItem] == 3)
type = NSJPEGFileType;
if([format_button indexOfSelectedItem] == 4)
type = NSPNGFileType;
if([format_button indexOfSelectedItem] == 5)
type = NSTIFFFileType;
//tell cocoa save the file
NSBitmapImageRep *image = [screen imageRep];
if(image == nil)
messageDialog(NSLocalizedString(@"Error", nil), "Couldn't create the screenshot image");
else
[[image representationUsingType:type properties:[NSDictionary dictionary]]
writeToFile:[panel filename] atomically:NO];
if(!image_rep)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not create NSBitmapImageRep for screenshot");
return nil;
}
u8 *bitmap_data = [image_rep bitmapData];
u16 *buffer_16 = (u16*)buffer;
int i;
for(i = 0; i < rect.size.width * rect.size.height; i++)
{ //this loop we go through pixel by pixel and convert from 16bit to 24bit for the NSImage
*(bitmap_data++) = (*buffer_16 & 0x001F) << 3;
*(bitmap_data++) = (*buffer_16 & 0x03E0) >> 5 << 3;
*(bitmap_data++) = (*buffer_16 & 0x7C00) >> 10 << 3;
buffer_16++;
}
if(save_only)
{
[self saveButtonPressed];
} else
{
//create the image
image = [[NSImage alloc] initWithSize:NSMakeSize(rect.size.width, rect.size.height)];
if(!image)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not create NSImage for screenshot window");
return nil;
}
[image setBackgroundColor:[NSColor whiteColor]];
[image addRepresentation:image_rep];
//create the image view
image_view = [[NSImageView alloc] initWithFrame:rect];
if(!image_view)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not create NSImageView for screenshot window");
return nil;
}
[image_view setImage:image];
[image_view setImageScaling:NSScaleToFit];
//create the save button
save_button = [[NSButton alloc] initWithFrame:rect];
if(!save_button)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not create save button for screenshot window");
return nil;
}
[save_button setBezelStyle:NSRoundedBezelStyle];
[save_button setTitle:NSLocalizedString(@"Save Screenshot", nil)];
[save_button setAction:@selector(saveButtonPressed)];
[save_button setTarget:self];
//update
update_button = [[NSButton alloc] initWithFrame:rect];
if(!update_button)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not create update button for screenshot window");
return nil;
}
[update_button setBezelStyle:NSRoundedBezelStyle];
[update_button setTitle:NSLocalizedString(@"Update Screenshot", nil)];
[update_button setAction:@selector(updateButtonPressed)];
[update_button setTarget:self];
//create a window
rect.size.height += BUTTON_HEIGHT;
window = [[NSWindow alloc] initWithContentRect:rect styleMask:
NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO screen:nil];
//set the window title
[window setTitle:NSLocalizedString(@"DeSmuME Screenshot", nil)];
//set the window delegate
[window setDelegate:self];
//add the items to the window
[[window contentView] addSubview:image_view];
[[window contentView] addSubview:save_button];
[[window contentView] addSubview:update_button];
//size the stuff (by invoking our resize callback)
[self windowDidResize:nil];
//show the window
controller = [[NSWindowController alloc] initWithWindow:window];
[controller showWindow:nil];
}
return self;
}
- (void)dealloc
{
[image_rep release];
[window release];
[controller release];
/*
NSImage *image;
NSImageView *image_view;
NSButton *save_button;
NSButton *update_button;
NSBitmapImageRep *image_rep;
NSView *format_selection;
NSPopUpButton *format_button;
*/
[super dealloc];
//
[format_button release];
[panel release];
[save_delegate release];
[screen release];
}
@end

View File

@ -17,9 +17,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SNDOSX_H
#define SNDOSX_H
#include "../SPU.h"
#define SNDCORE_OSX 58325 //hopefully this is unique number
@ -34,6 +31,3 @@ bool SNDOSXOpenFile(void *fname); //opens a file for recording (if filename is
void SNDOSXStartRecording(); //begins recording to the currently open file if there is an open file
void SNDOSXStopRecording(); //pauses recording (you can continue recording later)
void SNDOSXCloseFile(); //closes the file, making sure it's saved
#endif

View File

@ -110,7 +110,7 @@ OSStatus soundMixer(
//record to file
if(file_open)
ExtAudioFileWrite(outfile, inNumberFrames, ioData);
;//ExtAudioFileWrite(outfile, inNumberFrames, ioData);
in_mix = false;
return noErr;
@ -252,7 +252,7 @@ void SNDOSXDeInit()
int SNDOSXReset()
{
if(sound_data == NULL)return;
if(sound_data == NULL)return 0;
memset(sound_data, 0, sound_buffer_size);
@ -445,13 +445,15 @@ bool SNDOSXOpenFile(void *fname)
audio_format.mBytesPerFrame = 4;
audio_format.mChannelsPerFrame = 2;
audio_format.mBitsPerChannel = 16;
/*
if(ExtAudioFileCreateNew(&ref, (CFStringRef)[[filename pathComponents] lastObject], kAudioFileWAVEType, &audio_format, NULL, &outfile) != noErr)
return false;
file_open = true;
return true;
*/
return false;
}
void SNDOSXStartRecording()
@ -476,7 +478,7 @@ void SNDOSXCloseFile()
//so we dont close the file while writing to it
while(in_mix);
ExtAudioFileDispose(outfile);
//ExtAudioFileDispose(outfile);
}
}

View File

@ -0,0 +1,42 @@
/* 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 "nds_control.h"
@interface VideoOutputView : NSView
{
enum ScreenRotation rotation;
NSOpenGLContext* context;
NSOpenGLPixelFormat* format;
NintendoDS *DS;
ScreenState *screen_buffer;
}
- (id)initWithFrame:(NSRect)frame withDS:(NintendoDS*)ds;
- (void)dealloc;
- (void)setRotation:(enum ScreenRotation)rotation;
- (enum ScreenRotation)rotation;
- (void)drawRect:(NSRect)bounds;
- (void)setFrame:(NSRect)rect;
- (BOOL)isOpaque;
- (void)clearScreenBlack;
- (void)clearScreenWhite;
- (void)updateScreen:(ScreenState*)screen;
- (const ScreenState*)screenState;
@end

View File

@ -0,0 +1,271 @@
/* 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 "video_output_view.h"
#import "nds_control.h" //for screenstate
#import <OpenGL/gl.h>
@implementation VideoOutputView
- (id)initWithFrame:(NSRect)frame withDS:(NintendoDS*)ds
{
//Initialize the view------------------------------------------------------------------
self = [super initWithFrame:frame];
if(self==nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Could not init frame for OpenGL display");
return nil;
}
//Init the screen buffer -------------------------------------------------------------
screen_buffer = [[ScreenState alloc] init];
if(screen_buffer == nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Couldn't initialize screen view data");
//we dont return in this case because we will hopefully get new screen buffers
//constantly as emulation is going on, so this just means that there will be no display before emulation starts
}
//fill with black
else [screen_buffer fillWithBlack];
//DS Related ------------------------------------------------------------------------------
//currenty we dont actually need access to the DS object
//DS = ds;
//[DS retain];
//Initialize the OpenGL context for displaying the screen -----------------------------------
//Create the pixel format for our video output view
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFAAccelerated,
NSOpenGLPFANoRecovery,
NSOpenGLPFAColorSize, 16,
NSOpenGLPFAAlphaSize, 0,
NSOpenGLPFADepthSize, 0,
NSOpenGLPFAWindow,
0
};
NSOpenGLPixelFormat* pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
if(pixel_format == nil)
{
context = nil;
messageDialog(NSLocalizedString(@"Error", nil), @"Couldn't create OpenGL pixel format for video output");
} else
{
context = [[NSOpenGLContext alloc] initWithFormat:pixel_format shareContext:nil];
if(context == nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Couldn't create OpenGL context for video output");
return self;
}
}
//this will init opengl for drawing
[self setFrame:frame];
return self;
}
- (void)dealloc
{
//[DS release];
[context release];
[format release];
[screen_buffer release];
[super dealloc];
}
- (void)setRotation:(enum ScreenRotation)rot
{
//note that we use an optimization -
//rotation 180 is stored as rotation 0
//and rotation 270 us stored as rotation 90
//and using opengl we flip it (which is hopefully faster than rotating it manually)
if((rot == ROTATION_180) || (rot == ROTATION_0))
[screen_buffer setRotation:ROTATION_0];
else if((rot == ROTATION_270) || (rot == ROTATION_90))
[screen_buffer setRotation:ROTATION_90];
else return; //invalid rotation value passed to this function
rotation = rot;
}
- (enum ScreenRotation)rotation
{
return rotation;
}
- (void)drawRect:(NSRect)bounds
{
if(screen_buffer == nil)return; //simply dont draw anything if we dont have a screen data object allocated
if(context == nil)return; //
[context makeCurrentContext];
if(rotation == ROTATION_0 || rotation == ROTATION_180)
{
//here we send our corrected video buffer off to OpenGL where it gets pretty much
//directly copied to the frame buffer (and converted to the devices color format)
glDrawPixels(DS_SCREEN_WIDTH, DS_SCREEN_HEIGHT*2, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, (const GLvoid*)[screen_buffer colorData]);
} else
{
glDrawPixels(DS_SCREEN_HEIGHT*2, DS_SCREEN_WIDTH, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, (const GLvoid*)[screen_buffer colorData]);
}
glFlush();
}
- (void)setFrame:(NSRect)rect
{
if(context == nil)return;
[super setFrame:rect];
[context update];
[context makeCurrentContext];
//set the viewport (so the raster pos will be correct)
glViewport(0, 0, rect.size.width, rect.size.height);
if(rotation == ROTATION_0)
{
//the raster pos controls where the bitmap where will be placed
glRasterPos2f(-1, 1);
//set the pixel zoom so our bitmap streches to fit our new opengl size
glPixelZoom(((float)rect.size.width) / ((float)DS_SCREEN_WIDTH), -((float)rect.size.height) / ((float)DS_SCREEN_HEIGHT*2));
} else if (rotation == ROTATION_90)
{
//the raster pos controls where the bitmap where will be placed
glRasterPos2f(-1, 1);
//set the pixel zoom so our bitmap streches to fit our new opengl size
glPixelZoom(((float)rect.size.width) / ((float)DS_SCREEN_HEIGHT*2), -((float)rect.size.height) / ((float)DS_SCREEN_WIDTH));
} else if (rotation == ROTATION_180)
{
//the raster pos controls where the bitmap where will be placed
glRasterPos2f(1, -1);
//set the pixel zoom so our bitmap streches to fit our new opengl size
glPixelZoom(-((float)rect.size.width) / ((float)DS_SCREEN_WIDTH), ((float)rect.size.height) / ((float)DS_SCREEN_HEIGHT*2));
} else if (rotation == ROTATION_270)
{
//the raster pos controls where the bitmap where will be placed
glRasterPos2f(1, -1);
//set the pixel zoom so our bitmap streches to fit our new opengl size
glPixelZoom(-((float)rect.size.width) / ((float)DS_SCREEN_HEIGHT*2), ((float)rect.size.height) / ((float)DS_SCREEN_WIDTH));
}
}
- (BOOL)isOpaque
{
if(screen_buffer)
return YES;
//if there is no screen buffer, then we can't draw anything
//so this view is completely transparent
return NO;
}
- (void)updateScreen:(ScreenState*)screen
{
if(screen == nil)
{
messageDialog(NSLocalizedString(@"Error", nil), @"Recieved invalid screen update");
return;
}
[screen_buffer release]; //get rid of old screen data
screen_buffer = screen;
[screen_buffer retain]; //retain the new screendata since we will need it if we have to redraw before we recieve another update
//if the screen needs to be rotated
if(rotation == ROTATION_90 || rotation == ROTATION_270)
[screen_buffer setRotation:ROTATION_90]; //
//then video output view draws from that buffer
[self display];
}
- (void)clearScreenWhite
{
[screen_buffer fillWithWhite];
[self display];
}
- (void)clearScreenBlack
{
[screen_buffer fillWithBlack];
[self display];
}
- (void)viewDidMoveToWindow
{
//the setView message doesnt work if the view
//isn't in a window, which is the case in the init func
//so we use this callback to bind the context to the window
if([self window] != nil)
[context setView:self];
else
[context clearDrawable];
}
- (const ScreenState*)screenState
{
ScreenState *result;
if(rotation == ROTATION_180)
{
result = [[ScreenState alloc] initWithScreenState:screen_buffer];
[result setRotation:ROTATION_180];
} else if(rotation == ROTATION_270)
{
result = [[ScreenState alloc] initWithScreenState:screen_buffer];
[result setRotation:ROTATION_270];
} else result = screen_buffer;
return result;
}
@end

View File

@ -38,6 +38,12 @@
#endif
#endif
#ifdef DESMUME_COCOA
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN
#endif
#endif
#if defined(__LP64__)
typedef unsigned char u8;
typedef unsigned short u16;
@ -130,7 +136,7 @@ typedef int desmume_BOOL;
#define PACKED __attribute__((packed))
#endif
#if WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
# define LOCAL_BE
#else
# define LOCAL_LE