const char* gspatch(int channel, int hbank, int lbank, int prog) { if (hbank < 0) hbank = 0; if (lbank < 0) lbank = 0; if (prog < 0) prog = 0; if (!validparams(channel, hbank, lbank, prog)) return 0; if (channel == 9) // gm drums { for (int i = 0; i < GSDRUMS; i++) if (prog == gsdrumname[i].program) return gsdrumname[i].patchname; } else { const char* name = 0; if (lbank == 0) name = findpatch(gsprogname, GSPROGRAMS, hbank, prog); if (name) return name; } return 0; }
const char* xgpatch(int channel, int hbank, int lbank, int prog) { const char* name; if (hbank < 0) hbank = (channel == 9) ? 0x7f : 0; if (lbank < 0) lbank = 0; if (prog < 0) prog = 0; if (!validparams(channel, hbank, lbank, prog)) return 0; if (channel != 9) { name = findpatch(xgprogname, XGPROGRAMS, lbank, prog); if (name) return name; } name = findpatch(xgdrumname, XGDRUMS, hbank, prog); if (name) return name; return 0; }
// moduleispatched - Checks to see if any of the imports listed in the specified // patch table have been patched into the specified importmodule. // // - importmodule (IN): Handle (base address) of the module to be queried to // determine if it has been patched. // // - patchtable (IN): An array of patchentry_t structures specifying all of the // import patches to search for. // // - tablesize (IN): Size, in entries, of the specified patch table. // // Return Value: // // Returns TRUE if at least one of the patches listed in the patch table is // installed in the importmodule. Otherwise returns FALSE. // BOOL moduleispatched (HMODULE importmodule, patchentry_t patchtable [], UINT tablesize) { patchentry_t *entry; BOOL found = FALSE; UINT index; // Loop through the import patch table, individually checking each patch // entry to see if it is installed in the import module. If any patch entry // is installed in the import module, then the module has been patched. for (index = 0; index < tablesize; index++) { entry = &patchtable[index]; found = findpatch(importmodule, entry->exportmodulename, entry->replacement); if (found == TRUE) { // Found one of the listed patches installed in the import module. return TRUE; } } // No patches listed in the patch table were found in the import module. return FALSE; }