Establish new versioning system (beta 1)
This commit is contained in:
parent
30d93d374d
commit
c5fac42ab1
|
@ -3985,6 +3985,7 @@
|
|||
<ClCompile Include="..\src\pc\network\socket\socket.c" />
|
||||
<ClCompile Include="..\src\pc\network\socket\socket_linux.c" />
|
||||
<ClCompile Include="..\src\pc\network\socket\socket_windows.c" />
|
||||
<ClCompile Include="..\src\pc\network\version.c" />
|
||||
<ClCompile Include="..\src\pc\pc_main.c" />
|
||||
<ClCompile Include="..\src\pc\platform.c" />
|
||||
<ClCompile Include="..\src\pc\ultra_reimplementation.c" />
|
||||
|
@ -4342,6 +4343,7 @@
|
|||
<ClInclude Include="..\src\pc\network\socket\socket.h" />
|
||||
<ClInclude Include="..\src\pc\network\socket\socket_linux.h" />
|
||||
<ClInclude Include="..\src\pc\network\socket\socket_windows.h" />
|
||||
<ClInclude Include="..\src\pc\network\version.h" />
|
||||
<ClInclude Include="..\src\pc\utils\string_linked_list.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -15081,6 +15081,9 @@
|
|||
<ClCompile Include="..\src\pc\network\packets\packet_network_players.c">
|
||||
<Filter>Source Files\src\pc\network\packets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\network\version.c">
|
||||
<Filter>Source Files\src\pc\network</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\actors\common0.h">
|
||||
|
@ -16039,5 +16042,8 @@
|
|||
<ClInclude Include="..\src\game\rng_position.h">
|
||||
<Filter>Source Files\src\game</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\network\version.h">
|
||||
<Filter>Header Files\src\pc\network</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -17,6 +17,8 @@
|
|||
#include "behavior_data.h"
|
||||
#include "audio_defines.h"
|
||||
#include "audio/external.h"
|
||||
#include "config.h"
|
||||
#include "pc/network/version.h"
|
||||
|
||||
#define MAIN_MENU_HEADER_TEXT "SM64 COOP"
|
||||
|
||||
|
@ -27,11 +29,14 @@ u8 gOpenConnectMenu = FALSE;
|
|||
s8 sGotoGame = 0;
|
||||
|
||||
static void menu_main_draw_strings(void) {
|
||||
print_generic_ascii_string(98, 150, "Still in early development.");
|
||||
u8 red = (gGlobalTimer % 20 > 10) ? 0 : 222;
|
||||
if (gGlobalTimer > 200) { red = 222; }
|
||||
gDPSetEnvColor(gDisplayListHead++, 222, red, red, gMenuStringAlpha);
|
||||
print_generic_ascii_string(21, 55, "For now, levels after the 50 star door are unsupported.");
|
||||
char* subtitle = "Still in development.";
|
||||
s16 subtitleX = (SCREEN_WIDTH - get_generic_ascii_string_width(subtitle)) / 2;
|
||||
print_generic_ascii_string(subtitleX, 150, subtitle);
|
||||
|
||||
char* versionString = get_version();
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 120);
|
||||
print_generic_ascii_string(25, 25, versionString);
|
||||
|
||||
}
|
||||
|
||||
static void host_menu_draw_strings(void) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "discord_network.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "menu/custom_menu.h"
|
||||
#include "pc/network/version.h"
|
||||
|
||||
#define HASH_LENGTH 8
|
||||
struct DiscordActivity gCurActivity = { 0 };
|
||||
|
@ -63,9 +64,8 @@ void discord_activity_update(bool hosting) {
|
|||
gCurActivity.party.size.max_size = 1;
|
||||
}
|
||||
|
||||
char hash[HASH_LENGTH] = GIT_HASH;
|
||||
strcpy(gCurActivity.details, "version ");
|
||||
strncat(gCurActivity.details, GIT_HASH, 127);
|
||||
char* version = get_version();
|
||||
snprintf(gCurActivity.details, MAX_VERSION_LENGTH, "%s", get_version());
|
||||
|
||||
app.activities->update_activity(app.activities, &gCurActivity, NULL, on_activity_update_callback);
|
||||
LOG_INFO("set activity");
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include "src/menu/custom_menu.h"
|
||||
#include "src/pc/fs/fs.h"
|
||||
#include "PR/os_eeprom.h"
|
||||
#include "pc/network/version.h"
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
#define HASH_LENGTH 8
|
||||
extern u8* gOverrideEeprom;
|
||||
static u8 eeprom[512] = { 0 };
|
||||
|
||||
|
@ -49,11 +49,13 @@ void network_send_join(struct Packet* joinRequestPacket) {
|
|||
return;
|
||||
}
|
||||
|
||||
char hash[HASH_LENGTH] = GIT_HASH;
|
||||
char version[MAX_VERSION_LENGTH] = { 0 };
|
||||
snprintf(version, MAX_VERSION_LENGTH, "%s", get_version());
|
||||
LOG_INFO("sending version: %s", version);
|
||||
|
||||
struct Packet p;
|
||||
packet_init(&p, PACKET_JOIN, true, false);
|
||||
packet_write(&p, &hash, sizeof(u8) * HASH_LENGTH);
|
||||
packet_write(&p, &version, sizeof(u8) * MAX_VERSION_LENGTH);
|
||||
packet_write(&p, &joinRequestPacket->localIndex, sizeof(u8));
|
||||
packet_write(&p, &gCurrSaveFileNum, sizeof(s16));
|
||||
packet_write(&p, &gServerSettings.playerInteractions, sizeof(u8));
|
||||
|
@ -85,8 +87,12 @@ void network_receive_join(struct Packet* p) {
|
|||
LOG_INFO("received join packet");
|
||||
|
||||
gOverrideEeprom = eeprom;
|
||||
char hash[HASH_LENGTH] = GIT_HASH;
|
||||
char remoteHash[HASH_LENGTH] = { 0 };
|
||||
|
||||
char version[MAX_VERSION_LENGTH] = { 0 };
|
||||
snprintf(version, MAX_VERSION_LENGTH, "%s", get_version());
|
||||
LOG_INFO("client has version: %s", version);
|
||||
|
||||
char remoteVersion[MAX_VERSION_LENGTH] = { 0 };
|
||||
u8 myGlobalIndex = UNKNOWN_GLOBAL_INDEX;
|
||||
u8 modCount = 0;
|
||||
|
||||
|
@ -96,8 +102,10 @@ void network_receive_join(struct Packet* p) {
|
|||
}
|
||||
|
||||
// verify version
|
||||
packet_read(p, &remoteHash, sizeof(u8) * HASH_LENGTH);
|
||||
if (memcmp(hash, remoteHash, HASH_LENGTH) != 0) {
|
||||
packet_read(p, &remoteVersion, sizeof(u8) * MAX_VERSION_LENGTH);
|
||||
LOG_INFO("server has version: %s", version);
|
||||
if (memcmp(version, remoteVersion, MAX_VERSION_LENGTH) != 0) {
|
||||
LOG_ERROR("version mismatch");
|
||||
custom_menu_connection_error("Your versions don't match, both should rebuild!");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include "version.h"
|
||||
#include "types.h"
|
||||
|
||||
static u16 sVersionInteger = 1;
|
||||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||
#define VERSION_TEXT "beta "
|
||||
|
||||
char* get_version(void) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s%d", VERSION_TEXT, sVersionInteger);
|
||||
return sVersionString;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define MAX_VERSION_LENGTH 10
|
||||
char* get_version(void);
|
||||
|
||||
#endif
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
#include <emscripten.h>
|
||||
|
@ -40,6 +41,7 @@
|
|||
#ifdef DISCORDRPC
|
||||
#include "pc/discord/discordrpc.h"
|
||||
#endif
|
||||
#include "pc/network/version.h"
|
||||
|
||||
OSMesg D_80339BEC;
|
||||
OSMesgQueue gSIEventMesgQueue;
|
||||
|
@ -242,12 +244,13 @@ void main_func(void) {
|
|||
#error No rendering API!
|
||||
#endif
|
||||
|
||||
char window_title[96] =
|
||||
"Super Mario 64 EX coop (" RAPI_NAME ")"
|
||||
#ifdef GIT_HASH
|
||||
" [" GIT_HASH "]"
|
||||
#endif
|
||||
;
|
||||
char* version = get_version();
|
||||
char window_title[96] = { 0 };
|
||||
#ifdef GIT_HASH
|
||||
snprintf(window_title, 96, "sm64ex-coop: %s [%s]", version, GIT_HASH);
|
||||
#else
|
||||
snprintf(window_title, 96, "sm64ex-coop: %s", version);
|
||||
#endif
|
||||
|
||||
gfx_init(wm_api, rendering_api, window_title);
|
||||
wm_api->set_keyboard_callbacks(keyboard_on_key_down, keyboard_on_key_up, keyboard_on_all_keys_up, keyboard_on_text_input);
|
||||
|
|
Loading…
Reference in New Issue