Change version to beta 2, prepare unstable branch
This commit is contained in:
parent
17a140a5e2
commit
73900c978b
|
@ -17,15 +17,17 @@
|
||||||
#include "gfx_dimensions.h"
|
#include "gfx_dimensions.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define MAX_ERROR_MESSAGE_LENGTH 128
|
|
||||||
|
|
||||||
static struct CustomMenu* sHead = NULL;
|
static struct CustomMenu* sHead = NULL;
|
||||||
static struct CustomMenu* sCurrentMenu = NULL;
|
static struct CustomMenu* sCurrentMenu = NULL;
|
||||||
static struct CustomMenu* sLastMenu = NULL;
|
static struct CustomMenu* sLastMenu = NULL;
|
||||||
|
|
||||||
u8 gMenuStringAlpha = 255;
|
u8 gMenuStringAlpha = 255;
|
||||||
static u8 sErrorDialog[MAX_ERROR_MESSAGE_LENGTH] = { 0 };
|
|
||||||
static u8 sErrorDialogShow = FALSE;
|
struct ErrorDialog {
|
||||||
|
u8* dialog;
|
||||||
|
struct ErrorDialog* next;
|
||||||
|
};
|
||||||
|
static struct ErrorDialog* sErrorDialog = NULL;
|
||||||
|
|
||||||
struct CustomMenuButton* custom_menu_create_button(struct CustomMenu* parent, char* label, u16 x, u16 y, s32 clickSound, void (*on_click)(void)) {
|
struct CustomMenuButton* custom_menu_create_button(struct CustomMenu* parent, char* label, u16 x, u16 y, s32 clickSound, void (*on_click)(void)) {
|
||||||
struct CustomMenuButton* button = calloc(1, sizeof(struct CustomMenuButton));
|
struct CustomMenuButton* button = calloc(1, sizeof(struct CustomMenuButton));
|
||||||
|
@ -67,7 +69,6 @@ struct CustomMenu* custom_menu_create(struct CustomMenu* parent, char* label, u1
|
||||||
}
|
}
|
||||||
|
|
||||||
void custom_menu_system_init(void) {
|
void custom_menu_system_init(void) {
|
||||||
|
|
||||||
// allocate the main menu and set it to current
|
// allocate the main menu and set it to current
|
||||||
sHead = calloc(1, sizeof(struct CustomMenu));
|
sHead = calloc(1, sizeof(struct CustomMenu));
|
||||||
sHead->me = calloc(1, sizeof(struct CustomMenuButton));
|
sHead->me = calloc(1, sizeof(struct CustomMenuButton));
|
||||||
|
@ -203,9 +204,15 @@ void custom_menu_cursor_click(f32 cursorX, f32 cursorY) {
|
||||||
if (!(gPlayer3Controller->buttonPressed & cursorClickButtons)) { return; }
|
if (!(gPlayer3Controller->buttonPressed & cursorClickButtons)) { return; }
|
||||||
if (sCurrentMenu->me->object->oMenuButtonState != MENU_BUTTON_STATE_FULLSCREEN) { return; }
|
if (sCurrentMenu->me->object->oMenuButtonState != MENU_BUTTON_STATE_FULLSCREEN) { return; }
|
||||||
|
|
||||||
if (sErrorDialogShow) {
|
if (sErrorDialog != NULL) {
|
||||||
sErrorDialogShow = FALSE;
|
struct ErrorDialog* current = sErrorDialog;
|
||||||
|
sErrorDialog = sErrorDialog->next;
|
||||||
|
free(current->dialog);
|
||||||
|
free(current);
|
||||||
play_sound(SOUND_ACTION_BONK, gDefaultSoundArgs);
|
play_sound(SOUND_ACTION_BONK, gDefaultSoundArgs);
|
||||||
|
if (sErrorDialog != NULL) {
|
||||||
|
play_sound(SOUND_MARIO_OOOF2, gDefaultSoundArgs);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +294,7 @@ void custom_menu_print_strings(void) {
|
||||||
|
|
||||||
void custom_menu_render_top(void) {
|
void custom_menu_render_top(void) {
|
||||||
// print error message
|
// print error message
|
||||||
if (sErrorDialogShow) {
|
if (sErrorDialog != NULL) {
|
||||||
// black screen
|
// black screen
|
||||||
create_dl_translation_matrix(MENU_MTX_PUSH, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 240.0f, 0);
|
create_dl_translation_matrix(MENU_MTX_PUSH, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 240.0f, 0);
|
||||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_HEIGHT / 130.0f, 3.0f, 1.0f);
|
create_dl_scale_matrix(MENU_MTX_NOPUSH, GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_HEIGHT / 130.0f, 3.0f, 1.0f);
|
||||||
|
@ -297,17 +304,17 @@ void custom_menu_render_top(void) {
|
||||||
|
|
||||||
// print text
|
// print text
|
||||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||||
f32 textWidth = get_generic_dialog_width(sErrorDialog);
|
f32 textWidth = get_generic_dialog_width(sErrorDialog->dialog);
|
||||||
f32 textHeight = get_generic_dialog_height(sErrorDialog);
|
f32 textHeight = get_generic_dialog_height(sErrorDialog->dialog);
|
||||||
|
|
||||||
f32 xPos = (SCREEN_WIDTH - textWidth) / 2.0f;
|
f32 xPos = (SCREEN_WIDTH - textWidth) / 2.0f;
|
||||||
f32 yPos = (SCREEN_HEIGHT + textHeight) / 2.0f;
|
f32 yPos = (SCREEN_HEIGHT + textHeight) / 2.0f;
|
||||||
|
|
||||||
gDPSetEnvColor(gDisplayListHead++, 30, 30, 30, 255);
|
gDPSetEnvColor(gDisplayListHead++, 30, 30, 30, 255);
|
||||||
print_generic_string(xPos, yPos, sErrorDialog);
|
print_generic_string(xPos, yPos, sErrorDialog->dialog);
|
||||||
|
|
||||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||||
print_generic_string((xPos - 1), (yPos + 1), sErrorDialog);
|
print_generic_string((xPos - 1), (yPos + 1), sErrorDialog->dialog);
|
||||||
|
|
||||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||||
}
|
}
|
||||||
|
@ -373,7 +380,22 @@ void bhv_menu_button_shrinking_to_custom(struct Object* button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void custom_menu_error(char* message) {
|
void custom_menu_error(char* message) {
|
||||||
str_ascii_to_dialog(message, sErrorDialog, MIN(strlen(message), MAX_ERROR_MESSAGE_LENGTH - 1));
|
struct ErrorDialog* errorDialog = malloc(sizeof(struct ErrorDialog));
|
||||||
if (!sErrorDialogShow) { play_sound(SOUND_MARIO_OOOF2, gDefaultSoundArgs); }
|
memset(errorDialog, 0, sizeof(struct ErrorDialog));
|
||||||
sErrorDialogShow = TRUE;
|
errorDialog->dialog = malloc(sizeof(u8) * (strlen(message) + 1));
|
||||||
|
str_ascii_to_dialog(message, errorDialog->dialog, strlen(message));
|
||||||
|
|
||||||
|
if (sErrorDialog == NULL) {
|
||||||
|
sErrorDialog = errorDialog;
|
||||||
|
play_sound(SOUND_MARIO_OOOF2, gDefaultSoundArgs);
|
||||||
|
} else {
|
||||||
|
struct ErrorDialog* item = sErrorDialog;
|
||||||
|
while (item != NULL) {
|
||||||
|
if (item->next == NULL) {
|
||||||
|
item->next = errorDialog;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item = item->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -142,6 +142,10 @@ static bool ns_discord_initialize(enum NetworkType networkType) {
|
||||||
int rc = DiscordCreate(DISCORD_VERSION, ¶ms, &app.core);
|
int rc = DiscordCreate(DISCORD_VERSION, ¶ms, &app.core);
|
||||||
gDiscordFailed = false;
|
gDiscordFailed = false;
|
||||||
if (networkType != NT_NONE) {
|
if (networkType != NT_NONE) {
|
||||||
|
#ifdef UNSTABLE_BRANCH
|
||||||
|
// refuse to host on discord for unstable branch
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
DISCORD_REQUIRE(rc);
|
DISCORD_REQUIRE(rc);
|
||||||
} else if (rc) {
|
} else if (rc) {
|
||||||
LOG_ERROR("DiscordCreate failed: %d", rc);
|
LOG_ERROR("DiscordCreate failed: %d", rc);
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
static u16 sVersionInteger = 1;
|
|
||||||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||||
|
#ifdef UNSTABLE_BRANCH
|
||||||
|
#define VERSION_TEXT "unst "
|
||||||
|
#else
|
||||||
#define VERSION_TEXT "beta "
|
#define VERSION_TEXT "beta "
|
||||||
|
#endif
|
||||||
|
|
||||||
char* get_version(void) {
|
char* get_version(void) {
|
||||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, sVersionInteger);
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, VERSION_NUMBER);
|
||||||
return sVersionString;
|
return sVersionString;
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
|
#define UNSTABLE_BRANCH
|
||||||
|
#define VERSION_NUMBER 2
|
||||||
|
|
||||||
#define MAX_VERSION_LENGTH 10
|
#define MAX_VERSION_LENGTH 10
|
||||||
char* get_version(void);
|
char* get_version(void);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "pc/discord/discordrpc.h"
|
#include "pc/discord/discordrpc.h"
|
||||||
#endif
|
#endif
|
||||||
#include "pc/network/version.h"
|
#include "pc/network/version.h"
|
||||||
|
#include "menu/custom_menu_system.h"
|
||||||
|
|
||||||
OSMesg D_80339BEC;
|
OSMesg D_80339BEC;
|
||||||
OSMesgQueue gSIEventMesgQueue;
|
OSMesgQueue gSIEventMesgQueue;
|
||||||
|
@ -277,6 +278,10 @@ void main_func(void) {
|
||||||
network_init(NT_NONE);
|
network_init(NT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNSTABLE_BRANCH
|
||||||
|
custom_menu_error("This is an unstable branch build.\n\nPlease do not use this to play online with others.\n\nUse a regular build.");
|
||||||
|
#endif
|
||||||
|
|
||||||
audio_init();
|
audio_init();
|
||||||
sound_init();
|
sound_init();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue