aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-03-10 21:21:37 -0400
committerNebuleon Fumika2013-03-10 21:21:37 -0400
commit936cb38b5e0e67c50cf35d23f81059b4a6493ce8 (patch)
treedcc10e90f203b98dfe41b3c5d91d8c7e277ffaa7 /source
parent47a63742d7aae6578b74929d7957c86ef1e699be (diff)
downloadsnes9x2005-936cb38b5e0e67c50cf35d23f81059b4a6493ce8.tar.gz
snes9x2005-936cb38b5e0e67c50cf35d23f81059b4a6493ce8.tar.bz2
snes9x2005-936cb38b5e0e67c50cf35d23f81059b4a6493ce8.zip
Center text without needing endless spaces; also support \n in centered text.
* Text positioning in message boxes is now controlled by #defines. * The various MSG_PLAY_SLIDE<n> messages are now one, MSG_SCREENSHOT_SLIDESHOW_KEYS, with \n between lines. * Use \n in some more message pairs. * Lengthy scrollers broke. This will be investigated in a later commit.
Diffstat (limited to 'source')
-rw-r--r--source/nds/bdf_font.c19
-rw-r--r--source/nds/draw.c39
-rw-r--r--source/nds/gui.c70
-rw-r--r--source/nds/gui.h6
-rw-r--r--source/nds/message.h7
5 files changed, 71 insertions, 70 deletions
diff --git a/source/nds/bdf_font.c b/source/nds/bdf_font.c
index 92b8923..aff3b94 100644
--- a/source/nds/bdf_font.c
+++ b/source/nds/bdf_font.c
@@ -1022,14 +1022,14 @@ u32 BDF_cut_string(char *string, u32 width, u32 direction)
/*-----------------------------------------------------------------------------
- count UNICODE charactor numbers in width pixels
-- direction 0: count UNICODE charactor numbers in width pixels, from front
-- direction 1: count UNICODE charactor numbers in width pixels, from end
+- direction 0: count UNICODE charactor numbers in width pixels, from end
+- direction 1: count UNICODE charactor numbers in width pixels, from front
- direction 2: conut total pixel width of len UNICODE charachtors, from end
- direction 3: conut total pixel width of len UNICODE charachtors, from front
------------------------------------------------------------------------------*/
u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction)
{
- u32 i, xw, num;
+ u32 i, lastSpace = 0, xw, num;
u16 unicode;
u32 start, end;
struct bdffont *bdf_fontp[2];
@@ -1049,14 +1049,19 @@ u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction)
while(len > 0)
{
unicode= unicodes[i];
+ if (unicode == 0x0A)
+ return num - len;
+ else if (unicode == ' ')
+ lastSpace = len;
+
xw += BDF_width16_ucs(unicode);
- if(xw >= width) break;
+ if(xw > width) return num - lastSpace;
i += direction;
len--;
}
- num -= len;
+ return num - len;
}
else
{
@@ -1073,9 +1078,9 @@ u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction)
}
num= xw;
- }
- return num;
+ return num;
+ }
}
diff --git a/source/nds/draw.c b/source/nds/draw.c
index 96e0217..a0006ac 100644
--- a/source/nds/draw.c
+++ b/source/nds/draw.c
@@ -298,7 +298,7 @@ void draw_message(void* screen_addr, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32
{
// drawbox(screen_addr, sx, sy, ex, ey, COLOR16(12, 12, 12));
// drawboxfill(screen_addr, sx+1, sy+1, ex-1, ey-1, color_fg);
- show_icon(screen_addr, &ICON_MSG, 34, 48);
+ show_icon(screen_addr, &ICON_MSG, (NDS_SCREEN_WIDTH - ICON_MSG.x) / 2, (NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2);
}
else
{
@@ -344,29 +344,27 @@ void draw_string_vcenter(void* screen_addr, u32 sx, u32 sy, u32 width, u32 color
while(*string)
{
string= utf8decode(string, unicode+num);
- if(unicode[num] != 0x0D && unicode[num] != 0x0A) num++;
+ num++;
}
if(num== 0) return;
- i= BDF_cut_unicode(unicode, num, width, 1);
- if(i == num)
- {
- x= BDF_cut_unicode(unicode, num, 0, 3);
- sx += (width - x)/2;
- }
-
screenp = (unsigned short*)screen_addr + sx + sy*SCREEN_WIDTH;
i= 0;
while(i < num)
{
m= BDF_cut_unicode(&unicode[i], num-i, width, 1);
- x= 0;
+ x= (width - BDF_cut_unicode(&unicode[i], m, 0, 3)) / 2;
while(m--)
{
x += BDF_render16_ucs(screenp+x, SCREEN_WIDTH, 0, COLOR_TRANS,
color_fg, unicode[i++]);
}
+ if (i < num && (unicode[i] == 0x0D || unicode[i] == 0x0A))
+ i++;
+ else {
+ while (i < num && (unicode[i] == ' ')) i++;
+ }
screenp += FONTS_HEIGHT * SCREEN_WIDTH;
}
}
@@ -787,13 +785,16 @@ u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no)
else
screen_addr = down_screen_addr;
- i= SCREEN_WIDTH/2 - box_width - 2;
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 49, 128);
- draw_string_vcenter((unsigned short*)screen_addr, 51, 130, 73, COLOR_WHITE, yes);
+ sy = (NDS_SCREEN_HEIGHT + ICON_MSG.y) / 2 - 8 - ICON_BUTTON.y;
- i= SCREEN_WIDTH/2 + 3;
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 136, 128);
- draw_string_vcenter((unsigned short*)screen_addr, 138, 130, 73, COLOR_WHITE, no);
+ u32 left_sx = NDS_SCREEN_WIDTH / 2 - 8 - ICON_BUTTON.x,
+ right_sx = NDS_SCREEN_WIDTH / 2 + 8;
+
+ show_icon((unsigned short*)screen_addr, &ICON_BUTTON, left_sx, sy);
+ draw_string_vcenter((unsigned short*)screen_addr, left_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, yes);
+
+ show_icon((unsigned short*)screen_addr, &ICON_BUTTON, right_sx, sy);
+ draw_string_vcenter((unsigned short*)screen_addr, right_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, no);
ds2_flipScreen(screen, 2);
@@ -806,11 +807,11 @@ u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no)
struct key_buf inputdata;
ds2_getrawInput(&inputdata);
// Turn it into a SELECT (A) or BACK (B) if the button is touched.
- if (inputdata.y >= 128 && inputdata.y < 128 + ICON_BUTTON.y)
+ if (inputdata.y >= sy && inputdata.y < sy + ICON_BUTTON.y)
{
- if (inputdata.x >= 49 && inputdata.x < 49 + ICON_BUTTON.x)
+ if (inputdata.x >= left_sx && inputdata.x < left_sx + ICON_BUTTON.x)
gui_action = CURSOR_SELECT;
- else if (inputdata.x >= 136 && inputdata.x < 136 + ICON_BUTTON.x)
+ else if (inputdata.x >= right_sx && inputdata.x < right_sx + ICON_BUTTON.x)
gui_action = CURSOR_BACK;
}
}
diff --git a/source/nds/gui.c b/source/nds/gui.c
index 6782269..aa27464 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -1282,7 +1282,7 @@ u32 play_screen_snapshot(void)
if(flag < 0 || file_num== 0)
{
draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg);
- draw_string_vcenter(down_screen_addr, 36, 55, 190, COLOR_MSSG, msg[MSG_NO_SLIDE]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_NO_SLIDE]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
if(screenp) free((void*)screenp);
@@ -1304,12 +1304,7 @@ u32 play_screen_snapshot(void)
unsigned int type;
draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg);
- draw_string_vcenter(down_screen_addr, 36, 70, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE1]);
- draw_string_vcenter(down_screen_addr, 36, 85, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE2]);
- draw_string_vcenter(down_screen_addr, 36, 100, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE3]);
- draw_string_vcenter(down_screen_addr, 36, 115, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE4]);
- draw_string_vcenter(down_screen_addr, 36, 130, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE5]);
- draw_string_vcenter(down_screen_addr, 36, 145, 190, COLOR_MSSG, msg[MSG_PLAY_SLIDE6]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SCREENSHOT_SLIDESHOW_KEYS]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
repeat= 1;
@@ -1837,7 +1832,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
}
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 100, 190, COLOR_MSSG, msg[MSG_PROGRESS_LOADING_GAME]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_LOADING_GAME]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
HighFrequencyCPU();
@@ -2072,7 +2067,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
if (SavedStateFileExists (savestate_index))
{
draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, 36, 74, 190, COLOR_MSSG, msg[MSG_SAVESTATE_FULL]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SAVESTATE_FULL]);
if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]) == 0)
return;
@@ -2082,7 +2077,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
get_savestate_filename(savestate_index, tmp_filename);
draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, 36, 100, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, 100, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
HighFrequencyCPU();
@@ -2092,11 +2087,11 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
draw_message(down_screen_addr, NULL, 28, 31, 227, 96, 0);
if(flag < 0)
{
- draw_string_vcenter(down_screen_addr, 36, 74, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
}
else
{
- draw_string_vcenter(down_screen_addr, 36, 100, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED]);
}
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
@@ -2132,7 +2127,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
if(fp == NULL)
{
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 80, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CORRUPTED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CORRUPTED]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
wait_Allkey_release(0);
@@ -2148,7 +2143,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
if(gui_action == CURSOR_SELECT)
{
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(up_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
+ draw_string_vcenter(up_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
HighFrequencyCPU();
int flag = load_state(tmp_filename);
@@ -2157,11 +2152,11 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
{
return_value = 1;
repeat = 0;
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED]);
}
else
{
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
mdelay(500); // let the failure show
}
}
@@ -2175,7 +2170,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
else
{
ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 36, 75, 190, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
+ draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
}
}
@@ -2199,7 +2194,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
u32 i, flag;
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_DIALOG_SAVED_STATE_DELETE_ALL]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_SAVED_STATE_DELETE_ALL]);
flag= 0;
for(i= 0; i < SAVE_STATE_SLOT_NUM; i++)
@@ -2224,7 +2219,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
else
{
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 90, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
mdelay(500);
}
@@ -2236,7 +2231,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
if(SavedStateFileExists(delette_savestate_num))
{
sprintf(line_buffer, msg[FMT_DIALOG_SAVED_STATE_DELETE_ONE], delette_savestate_num + 1);
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, line_buffer);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer);
if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B])) {
wait_Allkey_release(0);
@@ -2245,7 +2240,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
}
else
{
- draw_string_vcenter(down_screen_addr, 36, 90, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
mdelay(500);
}
@@ -2625,18 +2620,18 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
if(!first_load)
{
- draw_string_vcenter(down_screen_addr, 36, 70, 190, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATING]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATING]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
if(save_ss_bmp(screen))
- draw_string_vcenter(down_screen_addr, 36, 90, 190, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED]);
else
- draw_string_vcenter(down_screen_addr, 36, 90, 190, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_FAILED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_FAILED]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
mdelay(500);
}
else
{
- draw_string_vcenter(down_screen_addr, 36, 90, 190, COLOR_MSSG, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
mdelay(500);
}
@@ -2699,13 +2694,13 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
bg_screenp_color = COLOR_BG;
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 70, 190, COLOR_MSSG, msg[MSG_DIALOG_RESET]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_RESET]);
if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]))
{
wait_Allkey_release(0);
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 80, 190, COLOR_MSSG, msg[MSG_PROGRESS_RESETTING]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_RESETTING]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
sprintf(line_buffer, "%s/%s", main_path, EMU_CONFIG_FILENAME);
@@ -2716,7 +2711,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
init_game_config();
ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 80, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
+ draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
ds2_flipScreen(UP_SCREEN, 1);
// mdelay(500); // Delete this delay
@@ -2734,9 +2729,8 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
bg_screenp_color = COLOR_BG;
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 80, 190, COLOR_MSSG, msg[MSG_EMULATOR_NAME]);
- sprintf(line_buffer, "%s %s", msg[MSG_WORD_EMULATOR_VERSION], NDSSFC_VERSION);
- draw_string_vcenter(down_screen_addr, 36, 95, 190, COLOR_MSSG, line_buffer);
+ sprintf(line_buffer, "%s\n%s %s", msg[MSG_EMULATOR_NAME], msg[MSG_WORD_EMULATOR_VERSION], NDSSFC_VERSION);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
wait_Anykey_press(0);
@@ -2753,7 +2747,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
if(first_load)
{
ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 80, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
+ draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
ds2_flipScreen(UP_SCREEN, 1);
}
@@ -3258,7 +3252,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
void obtain_hotkey (u32 *HotkeyBitfield)
{
draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS]);
u32 Keys = draw_hotkey_dialog(DOWN_SCREEN, 115, msg[MSG_HOTKEY_DELETE_WITH_A], msg[MSG_HOTKEY_CANCEL_WITH_B]);
if (Keys == KEY_B)
@@ -3663,7 +3657,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
else
{
ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 80, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
+ draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
ds2_flipScreen(UP_SCREEN, 1);
}
}
@@ -4783,7 +4777,7 @@ void QuickLoadState (void)
ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
HighFrequencyCPU();
@@ -4791,7 +4785,7 @@ void QuickLoadState (void)
GameFrequencyCPU();
if(0 != flag)
{
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
mdelay(500); // let the failure show
}
@@ -4814,7 +4808,7 @@ void QuickSaveState (void)
ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
HighFrequencyCPU();
@@ -4824,7 +4818,7 @@ void QuickSaveState (void)
GameFrequencyCPU();
if(flag < 0)
{
- draw_string_vcenter(down_screen_addr, 36, 75, 190, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
+ draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
mdelay(500); // let the failure show
}
diff --git a/source/nds/gui.h b/source/nds/gui.h
index 49bfc5f..67d67dc 100644
--- a/source/nds/gui.h
+++ b/source/nds/gui.h
@@ -31,6 +31,12 @@
#define OPTION_TEXT_X 10
#define OPTION_TEXT_SX 236
+// For message boxes
+#define MESSAGE_BOX_TEXT_X ((NDS_SCREEN_WIDTH - ICON_MSG.x) / 2 + 3)
+#define MESSAGE_BOX_TEXT_SX (ICON_MSG.x - 6)
+// Y is brought down by the "window title" that's part of ICON_MSG
+#define MESSAGE_BOX_TEXT_Y ((NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2 + 24)
+
// For cheats [ NUM. DESC . . . . . +/- ]
#define CHEAT_NUMBER_X 10
#define CHEAT_DESC_X 34
diff --git a/source/nds/message.h b/source/nds/message.h
index c9e9704..07799ec 100644
--- a/source/nds/message.h
+++ b/source/nds/message.h
@@ -128,12 +128,7 @@ enum MSG
MSG_NO_SLIDE,
MSG_PLAYING_SLIDE,
MSG_PAUSE_SLIDE,
- MSG_PLAY_SLIDE1,
- MSG_PLAY_SLIDE2,
- MSG_PLAY_SLIDE3,
- MSG_PLAY_SLIDE4,
- MSG_PLAY_SLIDE5,
- MSG_PLAY_SLIDE6,
+ MSG_SCREENSHOT_SLIDESHOW_KEYS,
MSG_PROGRESS_LOADING_GAME,