41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
#include <pthread.h>
|
|
#include <unistd.h>
|
|
|
|
#include <sys/socket.h>
|
|
#include <sys/un.h>
|
|
|
|
#include <mgba/flags.h>
|
|
#include <mgba/core/core.h>
|
|
#include <mgba/core/thread.h>
|
|
#include <mgba/core/interface.h>
|
|
#include <mgba-util/vfs.h>
|
|
#ifdef M_CORE_GBA
|
|
#include <mgba/internal/gba/sio/lockstep.h>
|
|
#endif
|
|
#ifdef M_CORE_GB
|
|
#include <mgba/internal/gb/sio/lockstep.h>
|
|
#endif
|
|
|
|
int main() {
|
|
struct mCoreThread *threadContext = malloc(sizeof *threadContext);
|
|
char *file = "/home/sergio/ruby.gba";
|
|
struct mCore *core = mCoreFind(file);
|
|
core->init(core);
|
|
unsigned int width;
|
|
unsigned int height;
|
|
core->desiredVideoDimensions(core, &width, &height);
|
|
color_t *outputBuffer = malloc((sizeof *outputBuffer) * width * height);
|
|
core->setVideoBuffer(core, outputBuffer, 240);
|
|
mCoreInitConfig(core, NULL);
|
|
if (!core) {
|
|
fprintf(stderr, "Unable to load core");
|
|
return 1;
|
|
}
|
|
mCoreLoadFile(core, file);
|
|
threadContext->core = core;
|
|
threadContext->userData = NULL;
|
|
mCoreThreadStart(threadContext);
|
|
mCoreThreadJoin(threadContext);
|
|
free(threadContext);
|
|
}
|