From 08aaa1021c065cf7a310e7ec3b1538a428f6b7e0 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 8 Jan 2012 01:32:45 +0100 Subject: [PATCH] More aestethically pleasing effect. --- console/sgui.c | 10 ++++++++-- wii/main.c | 20 +++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/console/sgui.c b/console/sgui.c index fbd2f5ec38..4c96c26e54 100644 --- a/console/sgui.c +++ b/console/sgui.c @@ -116,13 +116,19 @@ void sgui_free(sgui_handle_t *sgui) static uint16_t gray_filler(unsigned x, unsigned y) { - uint16_t col = ((x + y) & 1) + 2; + x >>= 1; + y >>= 1; + uint16_t col = ((x + y) & 1) + 1; + col <<= 1; return (col << 0) | (col << 5) | (col << 10); } static uint16_t green_filler(unsigned x, unsigned y) { - uint16_t col = ((x + y) & 1) + 2; + x >>= 1; + y >>= 1; + uint16_t col = ((x + y) & 1) + 1; + col <<= 1; return (col << 0) | (col << 6) | (col << 10); } diff --git a/wii/main.c b/wii/main.c index 9c4a896f33..9d37ced773 100644 --- a/wii/main.c +++ b/wii/main.c @@ -44,12 +44,6 @@ static bool folder_cb(const char *directory, sgui_file_enum_cb_t file_cb, { (void)userdata; - //if (!*directory) - //{ - // file_cb(ctx, "sd:/", SGUI_FILE_DIRECTORY); - // return true; - //} - DIR *dir = opendir(directory); if (!dir) return false; @@ -78,6 +72,7 @@ static bool folder_cb(const char *directory, sgui_file_enum_cb_t file_cb, static const char *get_rom_path(sgui_handle_t *sgui) { uint16_t old_input_state = 0; + bool can_quit = false; sgui_iterate(sgui, SGUI_ACTION_REFRESH); @@ -87,7 +82,12 @@ static const char *get_rom_path(sgui_handle_t *sgui) input_wii.poll(NULL); if (input_wii.key_pressed(NULL, SSNES_QUIT_KEY)) - return NULL; + { + if (can_quit) + return NULL; + } + else + can_quit = true; for (unsigned i = 0; i < SSNES_FIRST_META_KEY; i++) { @@ -135,10 +135,9 @@ int main(void) menu_framebuf, SGUI_WIDTH * sizeof(uint16_t), _binary_console_font_bmp_start, folder_cb, NULL); - const char *rom_path = get_rom_path(sgui); - + const char *rom_path; int ret = 0; - if (rom_path) + while ((rom_path = get_rom_path(sgui)) && ret == 0) { char *argv[] = { strdup("ssnes"), strdup(rom_path), NULL }; ret = ssnes_main(sizeof(argv) / sizeof(argv[0]) - 1, argv); @@ -150,7 +149,6 @@ int main(void) wii_video_deinit(); sgui_free(sgui); - return ret; }