tidy
This commit is contained in:
parent
00d5893373
commit
501aa77d14
6 changed files with 33 additions and 46 deletions
|
|
@ -25,7 +25,6 @@ keymon.elf & # &> /mnt/sdcard/keymon.txt &
|
||||||
export EXEC_PATH=/tmp/minui_exec
|
export EXEC_PATH=/tmp/minui_exec
|
||||||
touch "$EXEC_PATH" && sync
|
touch "$EXEC_PATH" && sync
|
||||||
|
|
||||||
echo ondemand > "$CPU_PATH"
|
|
||||||
while [ -f "$EXEC_PATH" ]; do
|
while [ -f "$EXEC_PATH" ]; do
|
||||||
echo ondemand > "$CPU_PATH"
|
echo ondemand > "$CPU_PATH"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,8 +301,10 @@ int main(int argc , char* argv[]) {
|
||||||
|
|
||||||
SDL_FreeSurface(digits);
|
SDL_FreeSurface(digits);
|
||||||
|
|
||||||
|
QuitSettings();
|
||||||
GFX_quit();
|
GFX_quit();
|
||||||
|
|
||||||
|
|
||||||
// TODO: if (seconds_selected==tm.tm_sec) refresh tm and update seconds_selected
|
// TODO: if (seconds_selected==tm.tm_sec) refresh tm and update seconds_selected
|
||||||
|
|
||||||
if (save_changes) {
|
if (save_changes) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL/SDL_image.h>
|
#include <SDL/SDL_image.h>
|
||||||
|
|
@ -248,9 +247,12 @@ void GFX_quit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFX_clear(SDL_Surface* screen) {
|
void GFX_clear(SDL_Surface* screen) {
|
||||||
memset(screen->pixels, 0, gfx.buffer_size);
|
memset(screen->pixels, 0, gfx.buffer_size); // this buffer is offscreen when cleared
|
||||||
}
|
}
|
||||||
void GFX_clearAll(void) {
|
void GFX_clearAll(void) {
|
||||||
|
// TODO: one of the buffers is onscreen when cleared producing tearing
|
||||||
|
// so clear our working buffer immediately (screen->pixels)
|
||||||
|
// then set a flag and clear the other two after vsync?
|
||||||
memset(gfx.map, 0, gfx.map_size);
|
memset(gfx.map, 0, gfx.map_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -442,9 +444,7 @@ void GFX_blitButton(char* hint, char*button, SDL_Surface* dst, SDL_Rect* dst_rec
|
||||||
SDL_FreeSurface(text);
|
SDL_FreeSurface(text);
|
||||||
}
|
}
|
||||||
void GFX_blitMessage(char* msg, SDL_Surface* dst, SDL_Rect* dst_rect) {
|
void GFX_blitMessage(char* msg, SDL_Surface* dst, SDL_Rect* dst_rect) {
|
||||||
if (dst_rect==NULL) {
|
if (dst_rect==NULL) dst_rect = &(SDL_Rect){0,0,SCREEN_WIDTH,SCREEN_HEIGHT};
|
||||||
dst_rect = &(SDL_Rect){0,0,SCREEN_WIDTH,SCREEN_HEIGHT};
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* text;
|
SDL_Surface* text;
|
||||||
#define TEXT_BOX_MAX_ROWS 16
|
#define TEXT_BOX_MAX_ROWS 16
|
||||||
|
|
@ -951,6 +951,7 @@ static char governor[128];
|
||||||
static void POW_enterSleep(void) {
|
static void POW_enterSleep(void) {
|
||||||
SetRawVolume(0);
|
SetRawVolume(0);
|
||||||
putInt(BACKLIGHT_PATH, FB_BLANK_POWERDOWN);
|
putInt(BACKLIGHT_PATH, FB_BLANK_POWERDOWN);
|
||||||
|
|
||||||
// save current governor (either ondemand or performance)
|
// save current governor (either ondemand or performance)
|
||||||
getFile(GOVERNOR_PATH, governor, 128);
|
getFile(GOVERNOR_PATH, governor, 128);
|
||||||
trimTrailingNewlines(governor);
|
trimTrailingNewlines(governor);
|
||||||
|
|
@ -961,8 +962,10 @@ static void POW_enterSleep(void) {
|
||||||
static void POW_exitSleep(void) {
|
static void POW_exitSleep(void) {
|
||||||
putInt(BACKLIGHT_PATH, FB_BLANK_UNBLANK);
|
putInt(BACKLIGHT_PATH, FB_BLANK_UNBLANK);
|
||||||
SetVolume(GetVolume());
|
SetVolume(GetVolume());
|
||||||
|
|
||||||
// restore previous governor
|
// restore previous governor
|
||||||
putFile(GOVERNOR_PATH, governor);
|
putFile(GOVERNOR_PATH, governor);
|
||||||
|
sync();
|
||||||
}
|
}
|
||||||
static void POW_waitForWake(void) {
|
static void POW_waitForWake(void) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,8 @@
|
||||||
// all before scale
|
// all before scale
|
||||||
#define PILL_SIZE 30
|
#define PILL_SIZE 30
|
||||||
#define BUTTON_SIZE 20
|
#define BUTTON_SIZE 20
|
||||||
#define BUTTON_MARGIN ((PILL_SIZE - BUTTON_SIZE) / 2)
|
#define BUTTON_MARGIN 5 // ((PILL_SIZE - BUTTON_SIZE) / 2)
|
||||||
|
#define BUTTON_PADDING 12
|
||||||
#define SETTINGS_SIZE 4
|
#define SETTINGS_SIZE 4
|
||||||
#define SETTINGS_WIDTH 80
|
#define SETTINGS_WIDTH 80
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -551,16 +551,16 @@ static InputOverride input_overrides[] = {
|
||||||
|
|
||||||
static const char* core_button_names[RETRO_BUTTON_COUNT]; // core-provided
|
static const char* core_button_names[RETRO_BUTTON_COUNT]; // core-provided
|
||||||
static const char* device_button_names[RETRO_BUTTON_COUNT] = {
|
static const char* device_button_names[RETRO_BUTTON_COUNT] = {
|
||||||
[RETRO_DEVICE_ID_JOYPAD_B] = "B",
|
|
||||||
[RETRO_DEVICE_ID_JOYPAD_Y] = "Y",
|
|
||||||
[RETRO_DEVICE_ID_JOYPAD_SELECT] = "SELECT",
|
|
||||||
[RETRO_DEVICE_ID_JOYPAD_START] = "START",
|
|
||||||
[RETRO_DEVICE_ID_JOYPAD_UP] = "UP",
|
[RETRO_DEVICE_ID_JOYPAD_UP] = "UP",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_DOWN] = "DOWN",
|
[RETRO_DEVICE_ID_JOYPAD_DOWN] = "DOWN",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_LEFT] = "LEFT",
|
[RETRO_DEVICE_ID_JOYPAD_LEFT] = "LEFT",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_RIGHT] = "RIGHT",
|
[RETRO_DEVICE_ID_JOYPAD_RIGHT] = "RIGHT",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_A] = "A",
|
[RETRO_DEVICE_ID_JOYPAD_SELECT] = "SELECT",
|
||||||
|
[RETRO_DEVICE_ID_JOYPAD_START] = "START",
|
||||||
|
[RETRO_DEVICE_ID_JOYPAD_Y] = "Y",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_X] = "X",
|
[RETRO_DEVICE_ID_JOYPAD_X] = "X",
|
||||||
|
[RETRO_DEVICE_ID_JOYPAD_B] = "B",
|
||||||
|
[RETRO_DEVICE_ID_JOYPAD_A] = "A",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_L] = "L1",
|
[RETRO_DEVICE_ID_JOYPAD_L] = "L1",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_R] = "R1",
|
[RETRO_DEVICE_ID_JOYPAD_R] = "R1",
|
||||||
[RETRO_DEVICE_ID_JOYPAD_L2] = "L2",
|
[RETRO_DEVICE_ID_JOYPAD_L2] = "L2",
|
||||||
|
|
@ -671,6 +671,10 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
|
||||||
}
|
}
|
||||||
case RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS: { /* 11 */
|
case RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS: { /* 11 */
|
||||||
// puts("RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS");
|
// puts("RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS");
|
||||||
|
// TODO: this is useless
|
||||||
|
// (some? all?) cores don't sort these in any logical way
|
||||||
|
// which explains why picoarch didn't implement this...
|
||||||
|
|
||||||
|
|
||||||
// TODO: move all this to an Input_init()?
|
// TODO: move all this to an Input_init()?
|
||||||
|
|
||||||
|
|
@ -1648,9 +1652,7 @@ void Core_getName(char* in_name, char* out_name) {
|
||||||
tmp[0] = '\0';
|
tmp[0] = '\0';
|
||||||
}
|
}
|
||||||
void Core_open(const char* core_path, const char* tag_name) {
|
void Core_open(const char* core_path, const char* tag_name) {
|
||||||
LOG_info("inside Core_open\n");
|
|
||||||
core.handle = dlopen(core_path, RTLD_LAZY);
|
core.handle = dlopen(core_path, RTLD_LAZY);
|
||||||
LOG_info("after dlopen\n");
|
|
||||||
|
|
||||||
if (!core.handle) LOG_error("%s\n", dlerror());
|
if (!core.handle) LOG_error("%s\n", dlerror());
|
||||||
|
|
||||||
|
|
@ -1692,6 +1694,8 @@ void Core_open(const char* core_path, const char* tag_name) {
|
||||||
sprintf((char*)core.version, "%s (%s)", info.library_name, info.library_version);
|
sprintf((char*)core.version, "%s (%s)", info.library_name, info.library_version);
|
||||||
strcpy((char*)core.tag, tag_name);
|
strcpy((char*)core.tag, tag_name);
|
||||||
|
|
||||||
|
LOG_info("% %s (%s)\n", core.name, core.version, core.tag);
|
||||||
|
|
||||||
sprintf((char*)core.config_dir, SDCARD_PATH "/.userdata/" PLATFORM "/%s-%s", core.tag, core.name);
|
sprintf((char*)core.config_dir, SDCARD_PATH "/.userdata/" PLATFORM "/%s-%s", core.tag, core.name);
|
||||||
sprintf((char*)core.saves_dir, SDCARD_PATH "/Saves/%s", core.tag);
|
sprintf((char*)core.saves_dir, SDCARD_PATH "/Saves/%s", core.tag);
|
||||||
sprintf((char*)core.bios_dir, SDCARD_PATH "/Bios/%s", core.tag);
|
sprintf((char*)core.bios_dir, SDCARD_PATH "/Bios/%s", core.tag);
|
||||||
|
|
@ -1711,30 +1715,18 @@ void Core_init(void) {
|
||||||
core.initialized = 1;
|
core.initialized = 1;
|
||||||
}
|
}
|
||||||
void Core_load(void) {
|
void Core_load(void) {
|
||||||
// LOG_info("inside Core_load\n");
|
|
||||||
|
|
||||||
struct retro_game_info game_info;
|
struct retro_game_info game_info;
|
||||||
game_info.path = game.path;
|
game_info.path = game.path;
|
||||||
game_info.data = game.data;
|
game_info.data = game.data;
|
||||||
game_info.size = game.size;
|
game_info.size = game.size;
|
||||||
|
|
||||||
core.load_game(&game_info);
|
core.load_game(&game_info);
|
||||||
// LOG_info("after core.load_game\n");
|
|
||||||
|
|
||||||
SRAM_read();
|
SRAM_read();
|
||||||
// LOG_info("after SRAM_read\n");
|
|
||||||
|
|
||||||
// NOTE: must be called after core.load_game!
|
// NOTE: must be called after core.load_game!
|
||||||
struct retro_system_av_info av_info = {};
|
struct retro_system_av_info av_info = {};
|
||||||
core.get_system_av_info(&av_info);
|
core.get_system_av_info(&av_info);
|
||||||
// LOG_info("after core.get_system_av_info\n");
|
|
||||||
|
|
||||||
// double a = av_info.geometry.aspect_ratio;
|
|
||||||
// int w = av_info.geometry.base_width;
|
|
||||||
// int h = av_info.geometry.base_height;
|
|
||||||
// char r[8];
|
|
||||||
// getRatio(a, r);
|
|
||||||
// LOG_info("after getRatio\n");
|
|
||||||
|
|
||||||
core.fps = av_info.timing.fps;
|
core.fps = av_info.timing.fps;
|
||||||
core.sample_rate = av_info.timing.sample_rate;
|
core.sample_rate = av_info.timing.sample_rate;
|
||||||
|
|
@ -1742,12 +1734,7 @@ void Core_load(void) {
|
||||||
if (a<=0) a = (double)av_info.geometry.base_width / av_info.geometry.base_height;
|
if (a<=0) a = (double)av_info.geometry.base_width / av_info.geometry.base_height;
|
||||||
core.aspect_ratio = a;
|
core.aspect_ratio = a;
|
||||||
|
|
||||||
printf("aspect_ratio: %f\n", a);
|
LOG_info("aspect_ratio: %f\n", a);
|
||||||
|
|
||||||
// printf("%s\n%s\n", core.tag, core.version);
|
|
||||||
// printf("%dx%d (%s)\n", w,h,r);
|
|
||||||
// printf("%f\n%f\n", core.fps, core.sample_rate);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
void Core_reset(void) {
|
void Core_reset(void) {
|
||||||
core.reset();
|
core.reset();
|
||||||
|
|
@ -2255,10 +2242,6 @@ int main(int argc , char* argv[]) {
|
||||||
strcpy(rom_path, argv[2]);
|
strcpy(rom_path, argv[2]);
|
||||||
getEmuName(rom_path, tag_name);
|
getEmuName(rom_path, tag_name);
|
||||||
|
|
||||||
// LOG_info("core_path: %s\n", core_path);
|
|
||||||
// LOG_info("rom_path: %s\n", rom_path);
|
|
||||||
// LOG_info("tag_name: %s\n", tag_name);
|
|
||||||
|
|
||||||
screen = GFX_init(MODE_MENU);
|
screen = GFX_init(MODE_MENU);
|
||||||
|
|
||||||
// doesn't even help that much with Star Fox after overclocking
|
// doesn't even help that much with Star Fox after overclocking
|
||||||
|
|
@ -2267,16 +2250,15 @@ int main(int argc , char* argv[]) {
|
||||||
MSG_init();
|
MSG_init();
|
||||||
InitSettings();
|
InitSettings();
|
||||||
|
|
||||||
Core_open(core_path, tag_name); // LOG_info("after Core_open\n");
|
Core_open(core_path, tag_name);
|
||||||
Core_init(); // LOG_info("after Core_init\n");
|
Core_init();
|
||||||
Game_open(rom_path); // LOG_info("after Game_open\n");
|
Game_open(rom_path);
|
||||||
Core_load(); // LOG_info("after Core_load\n");
|
Core_load();
|
||||||
SND_init(core.sample_rate, core.fps); // LOG_info("after SND_init\n");
|
SND_init(core.sample_rate, core.fps);
|
||||||
|
|
||||||
Menu_init();
|
Menu_init();
|
||||||
|
|
||||||
State_resume();
|
State_resume();
|
||||||
// State_read(); LOG_info("after State_read\n");
|
|
||||||
|
|
||||||
POW_disableAutosleep();
|
POW_disableAutosleep();
|
||||||
sec_start = SDL_GetTicks();
|
sec_start = SDL_GetTicks();
|
||||||
|
|
@ -2315,7 +2297,7 @@ int main(int argc , char* argv[]) {
|
||||||
Core_unload();
|
Core_unload();
|
||||||
|
|
||||||
Core_quit();
|
Core_quit();
|
||||||
Core_close(); // LOG_info("after Core_close\n");
|
Core_close();
|
||||||
|
|
||||||
SDL_FreeSurface(screen);
|
SDL_FreeSurface(screen);
|
||||||
MSG_quit();
|
MSG_quit();
|
||||||
|
|
|
||||||
|
|
@ -1399,10 +1399,10 @@ int main (int argc, char *argv[]) {
|
||||||
SDL_BlitSurface(text, &(SDL_Rect){
|
SDL_BlitSurface(text, &(SDL_Rect){
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
max_width-SCALE1(12*2),
|
max_width-SCALE1(BUTTON_PADDING*2),
|
||||||
text->h
|
text->h
|
||||||
}, screen, &(SDL_Rect){
|
}, screen, &(SDL_Rect){
|
||||||
SCALE1(PADDING+12),
|
SCALE1(PADDING+BUTTON_PADDING),
|
||||||
SCALE1(PADDING+(j*PILL_SIZE)+4)
|
SCALE1(PADDING+(j*PILL_SIZE)+4)
|
||||||
});
|
});
|
||||||
SDL_FreeSurface(text);
|
SDL_FreeSurface(text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue