void CreateOrientationFolders(int parent_index) { int jj; int nGames = GetNumGames(); LPTREEFOLDER lpFolder = treeFolders[parent_index]; // create our two subfolders LPTREEFOLDER lpVert, lpHorz; lpVert = NewFolder("Vertical", next_folder_id++, parent_index, IDI_FOLDER, GetFolderFlags(numFolders)); AddFolder(lpVert); lpHorz = NewFolder("Horizontal", next_folder_id++, parent_index, IDI_FOLDER, GetFolderFlags(numFolders)); AddFolder(lpHorz); // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (jj = 0; jj < nGames; jj++) { if (drivers[jj]->flags & ORIENTATION_SWAP_XY) { AddGame(lpVert,jj); } else { AddGame(lpHorz,jj); } } }
void CreateSoundFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int nFolder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; LPTREEFOLDER map[SOUND_COUNT]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (i=1;i<SOUND_COUNT;i++) { // Defined in sndintrf.c struct snd_interface { unsigned sound_num; /* ID */ const char *name; /* description */ int (*chips_num)(const struct MachineSound *msound); /* returns number of chips if applicable */ int (*chips_clock)(const struct MachineSound *msound); /* returns chips clock if applicable */ int (*start)(const struct MachineSound *msound); /* starts sound emulation */ void (*stop)(void); /* stops sound emulation */ void (*update)(void); /* updates emulation once per frame if necessary */ void (*reset)(void); /* resets sound emulation */ }; extern struct snd_interface sndintf[]; LPTREEFOLDER lpTemp; for (jj = 1; jj < i; jj++) if (!strcmp(soundtype_name(i), soundtype_name(jj))) break; if (i != jj) { map[i] = map[jj]; continue; } lpTemp = NewFolder(sndintf[i].name, next_folder_id++, parent_index, IDI_CPU, GetFolderFlags(numFolders)); AddFolder(lpTemp); map[i] = treeFolders[nFolder++]; } for (jj = 0; jj < nGames; jj++) { int n; struct InternalMachineDriver drv; expand_machine_driver(drivers[jj]->drv,&drv); for (n = 0; n < MAX_SOUND; n++) if (drv.sound[n].sound_type != SOUND_DUMMY) { // sound type #'s are one-based AddGame(map[drv.sound[n].sound_type],jj); } } }
BitArray_Z::BitArray_Z(S32 _Size,Bool bAllBitsOn) { Size = 0; SetSize(_Size); if(bAllBitsOn) SetAllBits(); else ClearAllBits(); }
void CreateCPUFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int nFolder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; LPTREEFOLDER map[CPU_COUNT]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (i=1;i<CPU_COUNT;i++) { LPTREEFOLDER lpTemp; for (jj = 1; jj < i; jj++) if (!strcmp(cputype_name(i), cputype_name(jj))) break; if (i != jj) { map[i] = map[jj]; continue; } lpTemp = NewFolder(cputype_name(i), next_folder_id++, parent_index, IDI_CPU, GetFolderFlags(numFolders)); AddFolder(lpTemp); map[i] = treeFolders[nFolder++]; } for (jj = 0; jj < nGames; jj++) { int n; struct InternalMachineDriver drv; expand_machine_driver(drivers[jj]->drv,&drv); for (n = 0; n < MAX_CPU; n++) if (drv.cpu[n].cpu_type != CPU_DUMMY) { // cpu type #'s are one-based AddGame(map[drv.cpu[n].cpu_type],jj); } } }
void CreateManufacturerFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int start_folder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; // not sure why this is added separately // should find out at some point. LPTREEFOLDER lpTemp; lpTemp = NewFolder("Romstar", next_folder_id++, parent_index, IDI_MANUFACTURER, GetFolderFlags(numFolders)); AddFolder(lpTemp); // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (jj = 0; jj < nGames; jj++) { const char *s = FixString(drivers[jj]->manufacturer); const char *s2 = LicenseManufacturer(drivers[jj]->manufacturer); if (s == NULL || s[0] == '\0') continue; // look for an extant manufacturer treefolder for this game for (i=numFolders-1;i>=start_folder;i--) { if (strncmp(treeFolders[i]->m_lpTitle,s,20) == 0 || (s2 != NULL && strncmp(treeFolders[i]->m_lpTitle,s2,20) == 0)) { AddGame(treeFolders[i],jj); break; } } if (i == start_folder-1) { // nope, it's a manufacturer we haven't seen before, make it. lpTemp = NewFolder(s, next_folder_id++, parent_index, IDI_MANUFACTURER, GetFolderFlags(numFolders)); AddFolder(lpTemp); AddGame(lpTemp,jj); } } }
void CreateYearFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int start_folder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (jj = 0; jj < nGames; jj++) { char s[100]; strcpy(s,drivers[jj]->year); if (s[0] == '\0') continue; if (s[4] == '?') s[4] = '\0'; // look for an extant year treefolder for this game // (likely to be the previous one, so start at the end) for (i=numFolders-1;i>=start_folder;i--) { if (strncmp(treeFolders[i]->m_lpTitle,s,4) == 0) { AddGame(treeFolders[i],jj); break; } } if (i == start_folder-1) { // nope, it's a year we haven't seen before, make it. LPTREEFOLDER lpTemp; lpTemp = NewFolder(s, next_folder_id++, parent_index, IDI_YEAR, GetFolderFlags(numFolders)); AddFolder(lpTemp); AddGame(lpTemp,jj); } } }
void CreateSourceFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int start_folder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (jj = 0; jj < nGames; jj++) { const char *s = GetDriverFilename(jj); if (s == NULL || s[0] == '\0') continue; // look for an extant source treefolder for this game // (likely to be the previous one, so start at the end) for (i=numFolders-1;i>=start_folder;i--) { if (strcmp(treeFolders[i]->m_lpTitle,s) == 0) { AddGame(treeFolders[i],jj); break; } } if (i == start_folder-1) { // nope, it's a source file we haven't seen before, make it. LPTREEFOLDER lpTemp; lpTemp = NewFolder(s, next_folder_id++, parent_index, IDI_SOURCE, GetFolderFlags(numFolders)); AddFolder(lpTemp); AddGame(lpTemp,jj); } } }
// Called to re-associate games with folders void ResetWhichGamesInFolders(void) { UINT i, jj, k; BOOL b; int nGames = GetNumGames(); for (i = 0; i < numFolders; i++) { LPTREEFOLDER lpFolder = treeFolders[i]; // setup the games in our built-in folders for (k = 0; g_lpFolderData[k].m_lpTitle; k++) { if (lpFolder->m_nFolderId == g_lpFolderData[k].m_nFolderId) { if (g_lpFolderData[k].m_pfnQuery || g_lpFolderData[k].m_bExpectedResult) { SetAllBits(lpFolder->m_lpGameBits, FALSE); for (jj = 0; jj < nGames; jj++) { // invoke the query function b = g_lpFolderData[k].m_pfnQuery ? g_lpFolderData[k].m_pfnQuery(jj) : TRUE; // if we expect FALSE, flip the result if (!g_lpFolderData[k].m_bExpectedResult) b = !b; // if we like what we hear, add the game if (b) AddGame(lpFolder, jj); } } break; } } } }