dsda: fix palette not changing

note on using PALETTE_SIZE as offset. normally it's `256 colors * 3 bytes per color = 768`, but in our headless mode it's 256. upstream does `SDL_SetPaletteColors(screen->format->palette, playpal_data->colours + 256 * pal, 0, 256);` when palette is updated, so clearly it means offsetting by 256 colors=bytes. but PALETTE_SIZE I used as my offset is not for stuff upstream uses it for. just something better than a magic number.
This commit is contained in:
feos 2025-05-29 14:33:42 +03:00
parent 8c9e49cd1d
commit 0a01e0dc64
5 changed files with 4 additions and 11 deletions

Binary file not shown.

View File

@ -1,14 +1,6 @@
{
"editor.tabSize": 2,
"files.associations": {
"f_wipe.h": "c",
"bizhawkinterface.h": "c",
"emulibc.h": "c",
"d_main.h": "c",
"m_fixed.h": "c",
"d_event.h": "c",
"doomtype.h": "c",
"g_game.h": "c",
"d_player.h": "c"
"*.*": "c"
}
}

View File

@ -151,7 +151,7 @@ ECL_EXPORT void dsda_get_video(int *w, int *h, int *pitch, uint8_t **buffer, int
*pitch = headlessGetVideoPitch();
*paletteSize = PALETTE_SIZE;
uint32_t *palette = headlessGetPallette();
uint32_t *palette = headlessGetPallette() + PALETTE_SIZE * currentPaletteIndex;
for (size_t i = 0; i < PALETTE_SIZE; i++)
{
uint8_t *srcColor = (uint8_t *)&palette[i];

View File

@ -37,6 +37,7 @@ extern int headlessGetVideoHeight();
extern void headlessEnableVideoRendering();
extern void headlessDisableVideoRendering();
extern uint32_t* headlessGetPallette();
extern int currentPaletteIndex;
// Audio
extern void headlessUpdateSounds();

@ -1 +1 @@
Subproject commit 44fcb8a3cb7025ec54b80217ca6e6d71607ab914
Subproject commit a7a3e7de03fd96e79ef340995cf12b04216f3382