Cocoa Port (OpenEmu Plug-in):
- Fix compiling issues. - Fix bug where sound wasn't working. - Add cheat system support. - Implement changeDisplayMode method.
This commit is contained in:
parent
ddf957fcf7
commit
dbcbeedd8a
|
@ -187,6 +187,7 @@
|
|||
AB405694169F5DCC0016AC3E /* x86util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405676169F5DCC0016AC3E /* x86util.cpp */; };
|
||||
AB405695169F5DCC0016AC3E /* x86util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405676169F5DCC0016AC3E /* x86util.cpp */; };
|
||||
AB4676F314AB12D60002FF94 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1914AACA9600E83E91 /* libz.dylib */; };
|
||||
AB4806BC18472EF20085F59B /* cocoa_cheat.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA6574A14511EC90077E5E9 /* cocoa_cheat.mm */; };
|
||||
AB497A9B17D583EE0045B888 /* fsnitro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB497A9A17D583EE0045B888 /* fsnitro.cpp */; };
|
||||
AB497A9C17D583EE0045B888 /* fsnitro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB497A9A17D583EE0045B888 /* fsnitro.cpp */; };
|
||||
AB497A9D17D583EE0045B888 /* fsnitro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB497A9A17D583EE0045B888 /* fsnitro.cpp */; };
|
||||
|
@ -2689,6 +2690,7 @@
|
|||
AB107687182ECB29000D6F67 /* slot2_passme.cpp in Sources */,
|
||||
AB1B702E18313D7700E64141 /* slot2_auto.cpp in Sources */,
|
||||
AB1B703218313D9000E64141 /* slot2.cpp in Sources */,
|
||||
AB4806BC18472EF20085F59B /* cocoa_cheat.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
AB01005F170D07B000D70FBE /* InputProfileController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB01005D170D07B000D70FBE /* InputProfileController.mm */; };
|
||||
AB010060170D07B000D70FBE /* InputProfileController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB01005D170D07B000D70FBE /* InputProfileController.mm */; };
|
||||
AB02475C13886BF300E9F9AB /* KeyNames.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB02475B13886BF300E9F9AB /* KeyNames.plist */; };
|
||||
AB031B5518472F3100541888 /* cocoa_cheat.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA6574A14511EC90077E5E9 /* cocoa_cheat.mm */; };
|
||||
AB0F290214BE6E68009ABC6F /* Icon_Execute_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB0F28FE14BE6E68009ABC6F /* Icon_Execute_420x420.png */; };
|
||||
AB0F290314BE6E68009ABC6F /* Icon_Pause_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB0F28FF14BE6E68009ABC6F /* Icon_Pause_420x420.png */; };
|
||||
AB0F290414BE6E68009ABC6F /* Icon_Speed1x_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB0F290014BE6E68009ABC6F /* Icon_Speed1x_420x420.png */; };
|
||||
|
@ -2581,6 +2582,7 @@
|
|||
ABB3C6961501C04F00E0C22E /* SndOut.cpp in Sources */,
|
||||
ABB3C6971501C04F00E0C22E /* Timestretcher.cpp in Sources */,
|
||||
ABB3C6981501C04F00E0C22E /* crc.cpp in Sources */,
|
||||
AB031B5518472F3100541888 /* cocoa_cheat.mm in Sources */,
|
||||
ABB3C6991501C04F00E0C22E /* decrypt.cpp in Sources */,
|
||||
ABB3C69A1501C04F00E0C22E /* header.cpp in Sources */,
|
||||
AB1773FF182ECA8A009F29DD /* slot2_passme.cpp in Sources */,
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<string>NDSGameCore</string>
|
||||
<key>OEGameCorePlayerCount</key>
|
||||
<string>1</string>
|
||||
<key>OEGameCoreSupportsCheatCode</key>
|
||||
<true/>
|
||||
<key>OEProjectURL</key>
|
||||
<string>http://desmume.org/</string>
|
||||
<key>OESystemIdentifiers</key>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <libkern/OSAtomic.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@class CocoaDSCheatManager;
|
||||
@class CocoaDSController;
|
||||
@class CocoaDSGPU;
|
||||
@class CocoaDSFirmware;
|
||||
|
@ -29,6 +30,7 @@
|
|||
@interface NDSGameCore : OEGameCore
|
||||
{
|
||||
NSPoint touchLocation;
|
||||
CocoaDSCheatManager *cdsCheats;
|
||||
CocoaDSController *cdsController;
|
||||
CocoaDSGPU *cdsGPU;
|
||||
CocoaDSFirmware *cdsFirmware;
|
||||
|
@ -41,6 +43,7 @@
|
|||
pthread_mutex_t mutexCoreExecute;
|
||||
}
|
||||
|
||||
@property (retain) CocoaDSCheatManager *cdsCheats;
|
||||
@property (retain) CocoaDSController *cdsController;
|
||||
@property (retain) CocoaDSGPU *cdsGPU;
|
||||
@property (retain) CocoaDSFirmware *cdsFirmware;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#import "NDSGameCore.h"
|
||||
#import "cocoa_cheat.h"
|
||||
#import "cocoa_globals.h"
|
||||
#import "cocoa_file.h"
|
||||
#import "cocoa_firmware.h"
|
||||
|
@ -36,6 +37,7 @@
|
|||
@synthesize cdsController;
|
||||
@synthesize cdsGPU;
|
||||
@synthesize cdsFirmware;
|
||||
@synthesize cdsCheats;
|
||||
@dynamic displayMode;
|
||||
|
||||
- (id)init
|
||||
|
@ -86,6 +88,10 @@
|
|||
CommonSettings.use_jit = true;
|
||||
[CocoaDSCore startupCore];
|
||||
|
||||
// Set up the cheat system
|
||||
cdsCheats = [[[[CocoaDSCheatManager alloc] init] retain] autorelease];
|
||||
[cdsCheats setMutexCoreExecute:&mutexCoreExecute];
|
||||
|
||||
// Set up the DS firmware using the internal firmware
|
||||
cdsFirmware = [[[[CocoaDSFirmware alloc] init] retain] autorelease];
|
||||
[cdsFirmware update];
|
||||
|
@ -93,6 +99,8 @@
|
|||
// Set up the sound core
|
||||
CommonSettings.spu_advanced = true;
|
||||
CommonSettings.spuInterpolationMode = SPUInterpolation_Cosine;
|
||||
CommonSettings.SPU_sync_mode = SPU_SYNC_MODE_SYNCHRONOUS;
|
||||
CommonSettings.SPU_sync_method = SPU_SYNC_METHOD_P;
|
||||
openEmuSoundInterfaceBuffer = [self ringBufferAtIndex:0];
|
||||
|
||||
NSInteger result = SPU_ChangeSoundCore(SNDCORE_OPENEMU, (int)SPU_BUFFER_BYTES);
|
||||
|
@ -101,11 +109,11 @@
|
|||
SPU_ChangeSoundCore(SNDCORE_DUMMY, 0);
|
||||
}
|
||||
|
||||
SPU_SetSynchMode(SPU_SYNC_MODE_SYNCHRONOUS, SPU_SYNC_METHOD_P);
|
||||
SPU_SetSynchMode(CommonSettings.SPU_sync_mode, CommonSettings.SPU_sync_method);
|
||||
SPU_SetVolume(100);
|
||||
|
||||
// Set up the DS display
|
||||
displayMode = DS_DISPLAY_TYPE_COMBO;
|
||||
displayMode = DS_DISPLAY_TYPE_DUAL;
|
||||
displayRect = OEIntRectMake(0, 0, GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2);
|
||||
displayAspectRatio = OEIntSizeMake(2, 3);
|
||||
|
||||
|
@ -118,6 +126,7 @@
|
|||
NDS_3D_ChangeCore(CORE3DLIST_NULL);
|
||||
[CocoaDSCore shutdownCore];
|
||||
|
||||
[self setCdsCheats:nil];
|
||||
[self setCdsController:nil];
|
||||
[self setCdsGPU:nil];
|
||||
[self setCdsFirmware:nil];
|
||||
|
@ -153,7 +162,7 @@
|
|||
newDisplayAspectRatio = OEIntSizeMake(4, 3);
|
||||
break;
|
||||
|
||||
case DS_DISPLAY_TYPE_COMBO:
|
||||
case DS_DISPLAY_TYPE_DUAL:
|
||||
newDisplayRect = OEIntRectMake(0, 0, GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2);
|
||||
newDisplayAspectRatio = OEIntSizeMake(2, 3);
|
||||
break;
|
||||
|
@ -208,6 +217,7 @@
|
|||
|
||||
- (BOOL)loadFileAtPath:(NSString*)path
|
||||
{
|
||||
BOOL isRomLoaded = NO;
|
||||
NSString *openEmuDataPath = [self batterySavesDirectoryPath];
|
||||
NSURL *openEmuDataURL = [NSURL fileURLWithPath:openEmuDataPath];
|
||||
|
||||
|
@ -228,7 +238,11 @@
|
|||
[fileManager createDirectoryAtPath:openEmuDataPath withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
[fileManager release];
|
||||
|
||||
return [CocoaDSFile loadRom:[NSURL fileURLWithPath:path]];
|
||||
isRomLoaded = [CocoaDSFile loadRom:[NSURL fileURLWithPath:path]];
|
||||
|
||||
[CocoaDSCheatManager setMasterCheatList:cdsCheats];
|
||||
|
||||
return isRomLoaded;
|
||||
}
|
||||
|
||||
#pragma mark Video
|
||||
|
@ -281,6 +295,28 @@
|
|||
return DS_FRAMES_PER_SECOND;
|
||||
}
|
||||
|
||||
- (void)changeDisplayMode
|
||||
{
|
||||
switch (displayMode)
|
||||
{
|
||||
case DS_DISPLAY_TYPE_MAIN:
|
||||
[self setDisplayMode:DS_DISPLAY_TYPE_TOUCH];
|
||||
break;
|
||||
|
||||
case DS_DISPLAY_TYPE_TOUCH:
|
||||
[self setDisplayMode:DS_DISPLAY_TYPE_DUAL];
|
||||
break;
|
||||
|
||||
case DS_DISPLAY_TYPE_DUAL:
|
||||
[self setDisplayMode:DS_DISPLAY_TYPE_MAIN];
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Audio
|
||||
|
||||
- (NSUInteger)audioBufferCount
|
||||
|
@ -298,6 +334,11 @@
|
|||
return SPU_SAMPLE_RATE;
|
||||
}
|
||||
|
||||
- (NSUInteger)audioBitDepth
|
||||
{
|
||||
return SPU_SAMPLE_RESOLUTION;
|
||||
}
|
||||
|
||||
- (NSUInteger)channelCountForBuffer:(NSUInteger)buffer
|
||||
{
|
||||
return [self channelCount];
|
||||
|
@ -340,7 +381,7 @@
|
|||
isTouchPressed = YES;
|
||||
break;
|
||||
|
||||
case DS_DISPLAY_TYPE_COMBO:
|
||||
case DS_DISPLAY_TYPE_DUAL:
|
||||
isTouchPressed = YES;
|
||||
aPoint.y -= GPU_DISPLAY_HEIGHT; // Normalize the y-coordinate to the DS.
|
||||
break;
|
||||
|
@ -401,4 +442,21 @@
|
|||
return [CocoaDSFile loadState:[NSURL fileURLWithPath:fileName]];
|
||||
}
|
||||
|
||||
#pragma mark Miscellaneous
|
||||
|
||||
- (void)setCheat:(NSString *)code setType:(NSString *)type setEnabled:(BOOL)enabled
|
||||
{
|
||||
CocoaDSCheatItem *newCheatItem = [[[CocoaDSCheatItem alloc] init] autorelease];
|
||||
[newCheatItem setEnabled:enabled];
|
||||
[newCheatItem setCheatType:CHEAT_TYPE_ACTION_REPLAY]; // Default to Action Replay for now
|
||||
[newCheatItem setFreezeType:0];
|
||||
[newCheatItem setDescription:@""]; // OpenEmu takes care of this
|
||||
[newCheatItem setCode:code];
|
||||
[newCheatItem setMemAddress:0x00000000]; // UNUSED
|
||||
[newCheatItem setBytes:1]; // UNUSED
|
||||
[newCheatItem setValue:0]; // UNUSED
|
||||
|
||||
[[self cdsCheats] add:newCheatItem];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue