* Read a custom pallete from a file and load it into the core. */
| 374 | * Read a custom pallete from a file and load it into the core. |
| 375 | */ |
| 376 | int |
| 377 | LoadCPalette(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 |
no test coverage detected