isle-portable/ISLE/emscripten/config.cpp
Christian Semmler 5b56db3c33
Add room management, relay capacity, and rejection handling
- Remove hardcoded multiplayer config from emscripten config.cpp
- Add relay HTTP endpoints for room preview (GET) and creation (POST)
  with capacity check, CORS headers, and configurable max players
- Add WebSocket rejection detection (room full/503) via onclose flag
- Add CheckRejected extension call in IsleApp::Tick for clean shutdown
  through SDL_APP_SUCCESS path instead of calling exit()
- Set Module._exitCode in JS for sessionStorage-based toast after reload
2026-03-01 14:37:08 -08:00

28 lines
952 B
C++

#include "config.h"
#include "filesystem.h"
#include "window.h"
#include <SDL3/SDL_log.h>
#include <emscripten.h>
#include <iniparser.h>
void Emscripten_SetupDefaultConfigOverrides(dictionary* p_dictionary)
{
SDL_Log("Overriding default config for Emscripten");
iniparser_set(p_dictionary, "isle:diskpath", Emscripten_bundledPath);
iniparser_set(p_dictionary, "isle:cdpath", Emscripten_streamPath);
iniparser_set(p_dictionary, "isle:savepath", Emscripten_savePath);
iniparser_set(p_dictionary, "isle:Full Screen", "false");
iniparser_set(p_dictionary, "isle:Flip Surfaces", "true");
// Emscripten-only for now
Emscripten_SetScaleAspect(iniparser_getboolean(p_dictionary, "isle:Original Aspect Ratio", true));
Emscripten_SetOriginalResolution(iniparser_getboolean(p_dictionary, "isle:Original Resolution", true));
// clang-format off
MAIN_THREAD_EM_ASM({JSEvents.fullscreenEnabled = function() { return false; }});
// clang-format on
}