mirror of https://github.com/mgba-emu/mgba.git
OpenEmu: Update implementation (#1910)
* OpenEmu: Update implementation * CMake: Add ARC compile option to OpenEmu build
This commit is contained in:
parent
2702dcfb6f
commit
bf2cdbacb6
|
@ -947,6 +947,7 @@ if(BUILD_OPENEMU)
|
||||||
BUNDLE TRUE
|
BUNDLE TRUE
|
||||||
BUNDLE_EXTENSION oecoreplugin
|
BUNDLE_EXTENSION oecoreplugin
|
||||||
OUTPUT_NAME ${PROJECT_NAME}
|
OUTPUT_NAME ${PROJECT_NAME}
|
||||||
|
COMPILE_OPTIONS "-fobjc-arc"
|
||||||
COMPILE_DEFINITIONS "DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=1")
|
COMPILE_DEFINITIONS "DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=1")
|
||||||
target_link_libraries(${BINARY_NAME}-openemu ${OS_LIB} ${FOUNDATION} ${OPENEMUBASE})
|
target_link_libraries(${BINARY_NAME}-openemu ${OS_LIB} ${FOUNDATION} ${OPENEMUBASE})
|
||||||
install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${OE_LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP)
|
install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${OE_LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<key>openemu.system.gba</key>
|
<key>openemu.system.gba</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>OEGameCoreRewindBufferSeconds</key>
|
<key>OEGameCoreRewindBufferSeconds</key>
|
||||||
<integer>1200</integer>
|
<integer>60</integer>
|
||||||
<key>OEGameCoreRewindInterval</key>
|
<key>OEGameCoreRewindInterval</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
<key>OEGameCoreSupportsRewinding</key>
|
<key>OEGameCoreSupportsRewinding</key>
|
||||||
|
|
|
@ -67,6 +67,10 @@
|
||||||
core->init(core);
|
core->init(core);
|
||||||
outputBuffer = nil;
|
outputBuffer = nil;
|
||||||
|
|
||||||
|
unsigned width, height;
|
||||||
|
core->desiredVideoDimensions(core, &width, &height);
|
||||||
|
outputBuffer = malloc(width * height * BYTES_PER_PIXEL);
|
||||||
|
core->setVideoBuffer(core, outputBuffer, width);
|
||||||
core->setAudioBufferSize(core, SAMPLES);
|
core->setAudioBufferSize(core, SAMPLES);
|
||||||
cheatSets = [[NSMutableDictionary alloc] init];
|
cheatSets = [[NSMutableDictionary alloc] init];
|
||||||
}
|
}
|
||||||
|
@ -78,10 +82,7 @@
|
||||||
{
|
{
|
||||||
mCoreConfigDeinit(&core->config);
|
mCoreConfigDeinit(&core->config);
|
||||||
core->deinit(core);
|
core->deinit(core);
|
||||||
[cheatSets release];
|
|
||||||
free(outputBuffer);
|
free(outputBuffer);
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Execution
|
#pragma mark - Execution
|
||||||
|
@ -96,9 +97,9 @@
|
||||||
if (core->dirs.save) {
|
if (core->dirs.save) {
|
||||||
core->dirs.save->close(core->dirs.save);
|
core->dirs.save->close(core->dirs.save);
|
||||||
}
|
}
|
||||||
core->dirs.save = VDirOpen([batterySavesDirectory UTF8String]);
|
core->dirs.save = VDirOpen([batterySavesDirectory fileSystemRepresentation]);
|
||||||
|
|
||||||
if (!mCoreLoadFile(core, [path UTF8String])) {
|
if (!mCoreLoadFile(core, [path fileSystemRepresentation])) {
|
||||||
*error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadROMError userInfo:nil];
|
*error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadROMError userInfo:nil];
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -106,14 +107,6 @@
|
||||||
|
|
||||||
core->reset(core);
|
core->reset(core);
|
||||||
|
|
||||||
unsigned width, height;
|
|
||||||
core->desiredVideoDimensions(core, &width, &height);
|
|
||||||
if (outputBuffer) {
|
|
||||||
free(outputBuffer);
|
|
||||||
}
|
|
||||||
outputBuffer = malloc(width * height * BYTES_PER_PIXEL);
|
|
||||||
core->setVideoBuffer(core, outputBuffer, width);
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +154,18 @@
|
||||||
return OEIntSizeMake(width, height);
|
return OEIntSizeMake(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (const void *)videoBuffer
|
- (const void *)getVideoBufferWithHint:(void *)hint
|
||||||
{
|
{
|
||||||
return outputBuffer;
|
OEIntSize bufferSize = [self bufferSize];
|
||||||
|
|
||||||
|
if (!hint) {
|
||||||
|
hint = outputBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputBuffer = hint;
|
||||||
|
core->setVideoBuffer(core, hint, bufferSize.width);
|
||||||
|
|
||||||
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GLenum)pixelFormat
|
- (GLenum)pixelFormat
|
||||||
|
@ -176,11 +178,6 @@
|
||||||
return GL_UNSIGNED_INT_8_8_8_8_REV;
|
return GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GLenum)internalPixelFormat
|
|
||||||
{
|
|
||||||
return GL_RGB8;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSTimeInterval)frameInterval
|
- (NSTimeInterval)frameInterval
|
||||||
{
|
{
|
||||||
return core->frequency(core) / (double) core->frameCycles(core);
|
return core->frequency(core) / (double) core->frameCycles(core);
|
||||||
|
@ -230,14 +227,14 @@
|
||||||
|
|
||||||
- (void)saveStateToFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
- (void)saveStateToFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
||||||
{
|
{
|
||||||
struct VFile* vf = VFileOpen([fileName UTF8String], O_CREAT | O_TRUNC | O_RDWR);
|
struct VFile* vf = VFileOpen([fileName fileSystemRepresentation], O_CREAT | O_TRUNC | O_RDWR);
|
||||||
block(mCoreSaveStateNamed(core, vf, 0), nil);
|
block(mCoreSaveStateNamed(core, vf, 0), nil);
|
||||||
vf->close(vf);
|
vf->close(vf);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadStateFromFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
- (void)loadStateFromFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
||||||
{
|
{
|
||||||
struct VFile* vf = VFileOpen([fileName UTF8String], O_RDONLY);
|
struct VFile* vf = VFileOpen([fileName fileSystemRepresentation], O_RDONLY);
|
||||||
block(mCoreLoadStateNamed(core, vf, 0), nil);
|
block(mCoreLoadStateNamed(core, vf, 0), nil);
|
||||||
vf->close(vf);
|
vf->close(vf);
|
||||||
}
|
}
|
||||||
|
@ -284,12 +281,11 @@ const int GBAMap[] = {
|
||||||
}
|
}
|
||||||
struct mCheatDevice* cheats = core->cheatDevice(core);
|
struct mCheatDevice* cheats = core->cheatDevice(core);
|
||||||
cheatSet = cheats->createSet(cheats, [codeId UTF8String]);
|
cheatSet = cheats->createSet(cheats, [codeId UTF8String]);
|
||||||
int codeType = GBA_CHEAT_AUTODETECT;
|
size_t size = mCheatSetsSize(&cheats->cheats);
|
||||||
if ([type isEqual:@"GameShark"]) {
|
if (size) {
|
||||||
codeType = GBA_CHEAT_GAMESHARK;
|
cheatSet->copyProperties(cheatSet, *mCheatSetsGetPointer(&cheats->cheats, size - 1));
|
||||||
} else if ([type isEqual:@"Action Replay"]) {
|
|
||||||
codeType = GBA_CHEAT_PRO_ACTION_REPLAY;
|
|
||||||
}
|
}
|
||||||
|
int codeType = GBA_CHEAT_AUTODETECT;
|
||||||
NSArray *codeSet = [code componentsSeparatedByString:@"+"];
|
NSArray *codeSet = [code componentsSeparatedByString:@"+"];
|
||||||
for (id c in codeSet) {
|
for (id c in codeSet) {
|
||||||
mCheatAddLine(cheatSet, [c UTF8String], codeType);
|
mCheatAddLine(cheatSet, [c UTF8String], codeType);
|
||||||
|
|
Loading…
Reference in New Issue