MCPcopy Create free account
hub / github.com/TASEmulators/fceux / LoadCPalette

Function LoadCPalette

src/drivers/Qt/config.cpp:376–400  ·  view source on GitHub ↗

* Read a custom pallete from a file and load it into the core. */

Source from the content-addressed store, hash-verified

374 * Read a custom pallete from a file and load it into the core.
375 */
376int
377LoadCPalette(const std::string &file)
378{
379 uint8 tmpp[192];
380 FILE *fp;
381
382 if(!(fp = FCEUD_UTF8fopen(file.c_str(), "rb"))) {
383 char errorMsg[256];
384 strcpy(errorMsg, "Error loading custom palette from file: ");
385 strcat(errorMsg, file.c_str());
386 FCEUD_PrintError(errorMsg);
387 return 0;
388 }
389 size_t result = fread(tmpp, 1, 192, fp);
390 if(result != 192) {
391 char errorMsg[256];
392 strcpy(errorMsg, "Error loading custom palette from file: ");
393 strcat(errorMsg, file.c_str());
394 FCEUD_PrintError(errorMsg);
395 return 0;
396 }
397 FCEUI_SetUserPalette(tmpp, result/3);
398 fclose(fp);
399 return 1;
400}
401
402/**
403 * Creates the subdirectories used for saving snapshots, movies, game

Callers 3

UpdateEMUCoreFunction · 0.70
use_Custom_ChangedMethod · 0.70
openPaletteFileMethod · 0.70

Calls 3

FCEUI_SetUserPaletteFunction · 0.85
FCEUD_UTF8fopenFunction · 0.70
FCEUD_PrintErrorFunction · 0.70

Tested by

no test coverage detected