Cocoa OpenEmu Plug-in:

- Update to SDK v1.0.4.
- Change the SPU sync method to N-method.
- Fix bug where the enable state of cheats could not be toggled.
This commit is contained in:
rogerman 2015-02-25 05:50:15 +00:00
parent 7d87434a21
commit 64ea7591ab
4 changed files with 55 additions and 19 deletions

View File

@ -23,15 +23,21 @@
<key>CSResourcesFileMapped</key>
<string>yes</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012-2013 DeSmuME Team. All rights reserved.</string>
<string>Copyright © 2012-2015 DeSmuME Team. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
<string>NDSGameCore</string>
<key>OEGameCorePlayerCount</key>
<string>1</string>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
<key>OEGameCoreOptions</key>
<dict>
<key>openemu.system.nds</key>
<dict>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
</dict>
</dict>
<key>OEProjectURL</key>
<string>http://desmume.org/</string>
<key>OESystemIdentifiers</key>
@ -39,7 +45,7 @@
<string>openemu.system.nds</string>
</array>
<key>SUFeedURL</key>
<string>http://openemu.org/updater/desmume_appcast.xml</string>
<string>https://raw.github.com/OpenEmu/OpenEmu-Update/master/desmume_appcast.xml</string>
<key>SUEnableAutomaticChecks</key>
<string>1</string>
</dict>

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2012-2014 DeSmuME team
Copyright (C) 2012-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@
@interface NDSGameCore : OEGameCore
{
NSPoint touchLocation;
NSMutableDictionary *addedCheatsDict;
CocoaDSCheatManager *cdsCheats;
CocoaDSController *cdsController;
CocoaDSGPU *cdsGPU;

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2012-2014 DeSmuME team
Copyright (C) 2012-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -92,6 +92,7 @@ volatile bool execute = true;
// Set up the cheat system
cdsCheats = [[[[CocoaDSCheatManager alloc] init] retain] autorelease];
[cdsCheats setRwlockCoreExecute:&rwlockCoreExecute];
addedCheatsDict = [[NSMutableDictionary alloc] initWithCapacity:128];
// Set up the DS firmware using the internal firmware
cdsFirmware = [[[[CocoaDSFirmware alloc] init] retain] autorelease];
@ -101,7 +102,7 @@ volatile bool execute = true;
CommonSettings.spu_advanced = true;
CommonSettings.spuInterpolationMode = SPUInterpolation_Cosine;
CommonSettings.SPU_sync_mode = SPU_SYNC_MODE_SYNCHRONOUS;
CommonSettings.SPU_sync_method = SPU_SYNC_METHOD_P;
CommonSettings.SPU_sync_method = SPU_SYNC_METHOD_N;
openEmuSoundInterfaceBuffer = [self ringBufferAtIndex:0];
NSInteger result = SPU_ChangeSoundCore(SNDCORE_OPENEMU, (int)SPU_BUFFER_BYTES);
@ -126,6 +127,7 @@ volatile bool execute = true;
SPU_ChangeSoundCore(SNDCORE_DUMMY, 0);
NDS_DeInit();
[addedCheatsDict release];
[self setCdsCheats:nil];
[self setCdsController:nil];
[self setCdsGPU:nil];
@ -247,6 +249,11 @@ volatile bool execute = true;
#pragma mark Video
- (BOOL)rendersToOpenGL
{
return NO;
}
- (OEIntRect)screenRect
{
OSSpinLockLock(&spinlockDisplayMode);
@ -446,17 +453,39 @@ volatile bool execute = true;
- (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
// This method can be used for both adding a new cheat or setting the enable
// state on an existing cheat, so be sure to account for both cases.
[[self cdsCheats] add:newCheatItem];
// First check if the cheat exists.
CocoaDSCheatItem *cheatItem = (CocoaDSCheatItem *)[addedCheatsDict objectForKey:code];
if (cheatItem == nil)
{
// If the cheat doesn't already exist, then create a new one and add it.
cheatItem = [[[CocoaDSCheatItem alloc] init] autorelease];
[cheatItem setCheatType:CHEAT_TYPE_ACTION_REPLAY]; // Default to Action Replay for now
[cheatItem setFreezeType:0];
[cheatItem setDescription:@""]; // OpenEmu takes care of this
[cheatItem setCode:code];
[cheatItem setMemAddress:0x00000000]; // UNUSED
[cheatItem setBytes:1]; // UNUSED
[cheatItem setValue:0]; // UNUSED
[cheatItem setEnabled:enabled];
[[self cdsCheats] add:cheatItem];
// OpenEmu doesn't currently save cheats per game, so assume that the
// cheat list is short and that code strings are unique. This allows
// us to get away with simply saving the cheat code string and hashing
// for it later.
[addedCheatsDict setObject:cheatItem forKey:code];
}
else
{
// If the cheat does exist, then just set its enable state.
[cheatItem setEnabled:enabled];
[[self cdsCheats] update:cheatItem];
}
}
@end

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2012-2014 DeSmuME team
Copyright (C) 2012-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -49,7 +49,7 @@ SoundInterface_struct *SNDCoreList[] = {
int SNDOpenEmuInit(int buffer_size)
{
[openEmuSoundInterfaceBuffer setLength:buffer_size];
[openEmuSoundInterfaceBuffer setLength:buffer_size * 4 / SPU_SAMPLE_SIZE];
if (mutexAudioSampleReadWrite == NULL)
{