Files
Main_MiSTer/game_docs.cpp
José Manuel Barroso Galindo 4af4a814ce docs: Add per-game manual lookup and Manual menu entry.
Add shared game asset resolution for cheats and game docs, preserving the existing cheat-compatible lookup order while allowing asset-specific validation. Use it to find PDF manuals under docs/<core>/Manuals and keep cheat loading aligned with the same matching rules.

Show a synthetic Manual row above Cheats in the generic menu when a matching manual is available, and open it through the existing document viewer. Update manual state when games/images are loaded.
2026-04-23 01:20:28 +02:00

48 lines
1.1 KiB
C++

#include <stdio.h>
#include <string.h>
#include "game_docs.h"
#include "file_io.h"
#include "user_io.h"
#include "support.h"
static char manual_path[1024] = {};
void game_docs_init(const char *rom_path, uint32_t romcrc)
{
manual_path[0] = 0;
char manuals_dir[1024];
snprintf(manuals_dir, sizeof(manuals_dir), "%s", user_io_get_core_name2());
findDocsDir(manuals_dir, sizeof(manuals_dir));
strcat(manuals_dir, "/Manuals");
const char *pcecd_dir = NULL;
char pcecd_manuals_dir[1024];
if (pcecd_using_cd())
{
snprintf(pcecd_manuals_dir, sizeof(pcecd_manuals_dir), "%sCD", user_io_get_core_name2());
findDocsDir(pcecd_manuals_dir, sizeof(pcecd_manuals_dir));
strcat(pcecd_manuals_dir, "/Manuals");
pcecd_dir = pcecd_manuals_dir;
}
if (findGameAsset(manual_path, sizeof(manual_path), rom_path, romcrc, ".pdf", manuals_dir, pcecd_dir, NULL))
{
printf("Using manual file: %s\n", manual_path);
} else {
manual_path[0] = 0;
printf("No manual file found.\n");
}
}
int game_docs_manual_available()
{
return manual_path[0] != 0;
}
const char *game_docs_get_manual()
{
return manual_path;
}