misc cleanup
This commit is contained in:
parent
a9fd90ad6a
commit
a39620bc99
4 changed files with 63 additions and 40 deletions
BIN
git/minui-menu-sgb.png
Normal file
BIN
git/minui-menu-sgb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
|
|
@ -168,11 +168,23 @@ SDL_Surface* GFX_init(int mode) {
|
||||||
gfx.vinfo.yres_virtual = VIRTUAL_HEIGHT;
|
gfx.vinfo.yres_virtual = VIRTUAL_HEIGHT;
|
||||||
gfx.vinfo.xoffset = 0;
|
gfx.vinfo.xoffset = 0;
|
||||||
gfx.vinfo.yoffset = 0;
|
gfx.vinfo.yoffset = 0;
|
||||||
ioctl(gfx.fb0_fd, FBIOPUT_VSCREENINFO, &gfx.vinfo);
|
if (ioctl(gfx.fb0_fd, FBIOPUT_VSCREENINFO, &gfx.vinfo)) LOG_info("FBIOPUT_VSCREENINFO failed %s\n", strerror(errno));
|
||||||
|
|
||||||
|
// printf("bits_per_pixel: %i\n", gfx.vinfo.bits_per_pixel);
|
||||||
|
// printf("xres: %i\n", gfx.vinfo.xres);
|
||||||
|
// printf("yres: %i\n", gfx.vinfo.yres);
|
||||||
|
// printf("xres_virtual: %i\n", gfx.vinfo.xres_virtual);
|
||||||
|
// printf("yres_virtual: %i\n", gfx.vinfo.yres_virtual);
|
||||||
|
// printf("xoffset: %i\n", gfx.vinfo.xoffset);
|
||||||
|
// printf("yoffset: %i\n", gfx.vinfo.yoffset);
|
||||||
|
// printf("activate: %i\n", gfx.vinfo.activate);
|
||||||
|
// printf("vmode: %i\n", gfx.vinfo.vmode);
|
||||||
|
// printf("sync: %i\n", gfx.vinfo.sync);
|
||||||
|
// fflush(stdout);
|
||||||
|
|
||||||
struct owlfb_sync_info sinfo;
|
struct owlfb_sync_info sinfo;
|
||||||
sinfo.enabled = 1;
|
sinfo.enabled = 1;
|
||||||
ioctl(gfx.fb0_fd, OWLFB_VSYNC_EVENT_EN, &sinfo);
|
if (ioctl(gfx.fb0_fd, OWLFB_VSYNC_EVENT_EN, &sinfo)) LOG_info("OWLFB_VSYNC_EVENT_EN failed %s\n", strerror(errno));
|
||||||
|
|
||||||
gfx.page = 1; // start on the backbuffer
|
gfx.page = 1; // start on the backbuffer
|
||||||
gfx.fb0_buffer = mmap(0, VIRTUAL_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, gfx.fb0_fd, 0);
|
gfx.fb0_buffer = mmap(0, VIRTUAL_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, gfx.fb0_fd, 0);
|
||||||
|
|
@ -229,6 +241,17 @@ void GFX_quit(void) {
|
||||||
|
|
||||||
GFX_clearAll();
|
GFX_clearAll();
|
||||||
munmap(gfx.fb0_buffer, VIRTUAL_SIZE);
|
munmap(gfx.fb0_buffer, VIRTUAL_SIZE);
|
||||||
|
|
||||||
|
// restore for other binaries
|
||||||
|
gfx.vinfo.bits_per_pixel = FIXED_DEPTH;
|
||||||
|
gfx.vinfo.xres = FIXED_WIDTH;
|
||||||
|
gfx.vinfo.yres = FIXED_HEIGHT;
|
||||||
|
gfx.vinfo.xres_virtual = FIXED_WIDTH;
|
||||||
|
gfx.vinfo.yres_virtual = FIXED_HEIGHT;
|
||||||
|
gfx.vinfo.xoffset = 0;
|
||||||
|
gfx.vinfo.yoffset = 0;
|
||||||
|
if (ioctl(gfx.fb0_fd, FBIOPUT_VSCREENINFO, &gfx.vinfo)) LOG_info("FBIOPUT_VSCREENINFO failed %s\n", strerror(errno));
|
||||||
|
|
||||||
close(gfx.fb0_fd);
|
close(gfx.fb0_fd);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
@ -279,13 +302,13 @@ SDL_Surface* GFX_resize(int w, int h, int pitch) {
|
||||||
void GFX_flip(SDL_Surface* screen) {
|
void GFX_flip(SDL_Surface* screen) {
|
||||||
// point framebuffer at the first line of the backbuffer
|
// point framebuffer at the first line of the backbuffer
|
||||||
gfx.vinfo.yoffset = gfx.page * PAGE_HEIGHT;
|
gfx.vinfo.yoffset = gfx.page * PAGE_HEIGHT;
|
||||||
ioctl(gfx.fb0_fd, gfx.resized ? FBIOPUT_VSCREENINFO : FBIOPAN_DISPLAY, &gfx.vinfo);
|
if (ioctl(gfx.fb0_fd, gfx.resized ? FBIOPUT_VSCREENINFO : FBIOPAN_DISPLAY, &gfx.vinfo)) LOG_info("FBIOPUT_VSCREENINFO failed %s\n", strerror(errno));
|
||||||
gfx.resized = 0;
|
gfx.resized = 0;
|
||||||
|
|
||||||
if (gfx.vsync!=VSYNC_OFF) {
|
if (gfx.vsync!=VSYNC_OFF) {
|
||||||
// this limiting condition helps SuperFX chip games
|
// this limiting condition helps SuperFX chip games
|
||||||
if (gfx.vsync==VSYNC_STRICT || frame_start==0 || SDL_GetTicks()-frame_start<FRAME_BUDGET) { // only wait if we're under frame budget
|
if (gfx.vsync==VSYNC_STRICT || frame_start==0 || SDL_GetTicks()-frame_start<FRAME_BUDGET) { // only wait if we're under frame budget
|
||||||
ioctl(gfx.fb0_fd, OWLFB_WAITFORVSYNC, &_);
|
if (ioctl(gfx.fb0_fd, OWLFB_WAITFORVSYNC, &_)) LOG_info("OWLFB_WAITFORVSYNC failed %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,7 +322,7 @@ void GFX_sync(void) {
|
||||||
if (gfx.vsync!=VSYNC_OFF) {
|
if (gfx.vsync!=VSYNC_OFF) {
|
||||||
// this limiting condition helps SuperFX chip games
|
// this limiting condition helps SuperFX chip games
|
||||||
if (gfx.vsync==VSYNC_STRICT || frame_start==0 || SDL_GetTicks()-frame_start<FRAME_BUDGET) { // only wait if we're under frame budget
|
if (gfx.vsync==VSYNC_STRICT || frame_start==0 || SDL_GetTicks()-frame_start<FRAME_BUDGET) { // only wait if we're under frame budget
|
||||||
ioctl(gfx.fb0_fd, OWLFB_WAITFORVSYNC, &_);
|
if (ioctl(gfx.fb0_fd, OWLFB_WAITFORVSYNC, &_)) LOG_info("OWLFB_WAITFORVSYNC failed %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,8 @@ static struct Core {
|
||||||
unsigned (*get_region)(void);
|
unsigned (*get_region)(void);
|
||||||
void *(*get_memory_data)(unsigned id);
|
void *(*get_memory_data)(unsigned id);
|
||||||
size_t (*get_memory_size)(unsigned id);
|
size_t (*get_memory_size)(unsigned id);
|
||||||
|
|
||||||
|
// retro_audio_buffer_status_callback_t audio_buffer_status;
|
||||||
} core;
|
} core;
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
@ -1225,8 +1227,6 @@ static bool set_rumble_state(unsigned port, enum retro_rumble_effect effect, uin
|
||||||
VIB_setStrength(strength);
|
VIB_setStrength(strength);
|
||||||
}
|
}
|
||||||
static bool environment_callback(unsigned cmd, void *data) { // copied from picoarch initially
|
static bool environment_callback(unsigned cmd, void *data) { // copied from picoarch initially
|
||||||
// printf("environment_callback: %i\n", cmd); fflush(stdout);
|
|
||||||
|
|
||||||
// LOG_info("environment_callback: %i\n", cmd);
|
// LOG_info("environment_callback: %i\n", cmd);
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
|
|
@ -1342,7 +1342,7 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// RETRO_ENVIRONMENT_GET_LANGUAGE 39
|
// RETRO_ENVIRONMENT_GET_LANGUAGE 39
|
||||||
case RETRO_ENVIRONMENT_GET_INPUT_BITMASKS: { /* 52 */
|
case RETRO_ENVIRONMENT_GET_INPUT_BITMASKS: { /* 51 */
|
||||||
bool *out = (bool *)data;
|
bool *out = (bool *)data;
|
||||||
if (out)
|
if (out)
|
||||||
*out = true;
|
*out = true;
|
||||||
|
|
@ -1393,38 +1393,35 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// TODO: RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION 59
|
// TODO: RETRO_ENVIRONMENT_GET_MESSAGE_INTERFACE_VERSION 59
|
||||||
// TODO: I'm not sure what uses this...not gambatte, not snes9x, not pcsx
|
// TODO: used by mgba, (but only during frameskip?)
|
||||||
case RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK: { /* 62 */
|
// case RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK: { /* 62 */
|
||||||
// puts("RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK");
|
// LOG_info("RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK\n");
|
||||||
// const struct retro_audio_buffer_status_callback *cb =
|
// const struct retro_audio_buffer_status_callback *cb = (const struct retro_audio_buffer_status_callback *)data;
|
||||||
// (const struct retro_audio_buffer_status_callback *)data;
|
// if (cb) {
|
||||||
// if (cb) {
|
// LOG_info("has audo_buffer_status callback\n");
|
||||||
// puts("has audo_buffer_status callback");
|
// core.audio_buffer_status = cb->callback;
|
||||||
// core.audio_buffer_status = cb->callback;
|
// } else {
|
||||||
// } else {
|
// LOG_info("no audo_buffer_status callback\n");
|
||||||
// puts("missing audo_buffer_status callback");
|
// core.audio_buffer_status = NULL;
|
||||||
// core.audio_buffer_status = NULL;
|
// }
|
||||||
// }
|
// break;
|
||||||
// fflush(stdout);
|
// }
|
||||||
break;
|
// TODO: used by mgba, (but only during frameskip?)
|
||||||
}
|
// case RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY: { /* 63 */
|
||||||
// TODO: not used by gambatte
|
// LOG_info("RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY\n");
|
||||||
case RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY: { /* 63 */
|
//
|
||||||
// TODO: unused?
|
// const unsigned *latency_ms = (const unsigned *)data;
|
||||||
// puts("RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY");
|
// if (latency_ms) {
|
||||||
//
|
// unsigned frames = *latency_ms * core.fps / 1000;
|
||||||
// const unsigned *latency_ms = (const unsigned *)data;
|
// if (frames < 30)
|
||||||
// if (latency_ms) {
|
// // audio_buffer_size_override = frames;
|
||||||
// unsigned frames = *latency_ms * core.fps / 1000;
|
// LOG_info("audio_buffer_size_override = %i (unused?)\n", frames);
|
||||||
// if (frames < 30)
|
// else
|
||||||
// audio_buffer_size_override = frames;
|
// LOG_info("Audio buffer change out of range (%d), ignored\n", frames);
|
||||||
// printf("audio_buffer_size_override = %i (unused?)\n", frames);
|
// }
|
||||||
// else
|
// break;
|
||||||
// PA_WARN("Audio buffer change out of range (%d), ignored\n", frames);
|
// }
|
||||||
// }
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE 64
|
// TODO: RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE 64
|
||||||
case RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE: { /* 65 */
|
case RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE: { /* 65 */
|
||||||
// const struct retro_system_content_info_override* info = (const struct retro_system_content_info_override* )data;
|
// const struct retro_system_content_info_override* info = (const struct retro_system_content_info_override* )data;
|
||||||
|
|
@ -3917,6 +3914,7 @@ int main(int argc , char* argv[]) {
|
||||||
while (!quit) {
|
while (!quit) {
|
||||||
GFX_startFrame();
|
GFX_startFrame();
|
||||||
|
|
||||||
|
// if (core.audio_buffer_status) core.audio_buffer_status(true, 100, false);
|
||||||
core.run();
|
core.run();
|
||||||
limitFF();
|
limitFF();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ CC = $(CROSS_COMPILE)gcc
|
||||||
CFLAGS = -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer
|
CFLAGS = -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer
|
||||||
CFLAGS += -I. -I../common -DPLATFORM=\"$(UNION_PLATFORM)\"
|
CFLAGS += -I. -I../common -DPLATFORM=\"$(UNION_PLATFORM)\"
|
||||||
LDFLAGS = -ldl -lSDL -lSDL_image -lSDL_ttf -lmsettings -lpthread
|
LDFLAGS = -ldl -lSDL -lSDL_image -lSDL_ttf -lmsettings -lpthread
|
||||||
|
# CFLAGS += -fsanitize=address -fno-common
|
||||||
|
# LDFLAGS += -lasan
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(CC) main.c ../common/utils.c ../common/api.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
|
$(CC) main.c ../common/utils.c ../common/api.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue