mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-14 11:15:05 -05:00
parent
73262ae207
commit
52126feb40
5 changed files with 1363 additions and 0 deletions
File diff suppressed because it is too large
Load diff
|
@ -5,4 +5,6 @@ class EmbeddedData
|
|||
{
|
||||
public:
|
||||
static const char PB_MSGFT_bin_compressed_data_base85[5380 + 1];
|
||||
static const unsigned int SDL_GameControllerDB_compressed_data[63392 / 4];
|
||||
static const unsigned int SDL_GameControllerDB_compressed_size;
|
||||
};
|
||||
|
|
|
@ -2884,6 +2884,7 @@ struct ImFontAtlas
|
|||
//typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+
|
||||
// Compressed base85 is useful for more than embedded TTF
|
||||
static char* DecompressCompressedBase85Data(const char* compressed_data_base85); // 'compressed_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
|
||||
static char* DecompressCompressedStbData(const unsigned int* compressed_data_stb, unsigned int compressed_data_size, unsigned int& decompressed_size);
|
||||
};
|
||||
|
||||
// Font runtime data and rendering
|
||||
|
|
|
@ -4180,4 +4180,12 @@ char* ImFontAtlas::DecompressCompressedBase85Data(const char* compressed_data_ba
|
|||
return (char*)buf_decompressed_data;
|
||||
}
|
||||
|
||||
char* ImFontAtlas::DecompressCompressedStbData(const unsigned int* compressed_data_stb, unsigned int compressed_data_size, unsigned int& decompressed_size)
|
||||
{
|
||||
decompressed_size = stb_decompress_length((const unsigned char*)compressed_data_stb);
|
||||
unsigned char* buf_decompressed_data = (unsigned char*)IM_ALLOC(decompressed_size);
|
||||
stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_data_stb, (unsigned int)compressed_data_size);
|
||||
return (char*)buf_decompressed_data;
|
||||
}
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "winmain.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "EmbeddedData.h"
|
||||
#include "fullscrn.h"
|
||||
#include "midi.h"
|
||||
#include "options.h"
|
||||
|
@ -131,6 +132,23 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||
mixOpened = true;
|
||||
}
|
||||
|
||||
{
|
||||
// Load SDL Game Controller definitions from DB
|
||||
unsigned decompressedSize{};
|
||||
const auto controllerDb = ImFontAtlas::DecompressCompressedStbData(
|
||||
EmbeddedData::SDL_GameControllerDB_compressed_data,
|
||||
EmbeddedData::SDL_GameControllerDB_compressed_size,
|
||||
decompressedSize);
|
||||
auto rw = SDL_RWFromMem(controllerDb, decompressedSize);
|
||||
const auto added = SDL_GameControllerAddMappingsFromRW(rw, 1);
|
||||
IM_FREE(controllerDb);
|
||||
if (added < 0)
|
||||
{
|
||||
printf("Could not load game controller DB.\nSDL Error: %s\n", SDL_GetError());
|
||||
SDL_ClearError();
|
||||
}
|
||||
}
|
||||
|
||||
auto resetAllOptions = strstr(lpCmdLine, "-reset") != nullptr;
|
||||
do
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue