First in a series of updates to remove the use of the global Machine from as many places as possible

This commit is contained in:
Zsolt Vasvari 2008-01-24 09:12:03 +00:00
parent c1af761bef
commit f7c5c67e2e
52 changed files with 370 additions and 369 deletions

View File

@ -780,21 +780,21 @@ static char * CreateStringCopy(char * buf);
static INT32 UserSelectValueMenu(int selection, CheatEntry * entry); static INT32 UserSelectValueMenu(int selection, CheatEntry * entry);
/********** CHEAT MENU **********/ /********** CHEAT MENU **********/
static int EnableDisableCheatMenu(int selection, int firstTime); static int EnableDisableCheatMenu(running_machine *machine, int selection, int firstTime);
static int AddEditCheatMenu(int selection); static int AddEditCheatMenu(running_machine *machine, int selection);
static int EditCheatMenu(CheatEntry * entry, int index, int selection); static int EditCheatMenu(running_machine *machine, CheatEntry * entry, int index, int selection);
static int DoSearchMenuMinimum(int selection); // minimum mode static int DoSearchMenuMinimum(running_machine *machine, int selection); // minimum mode
static int DoSearchMenuClassic(int selection); // classic mode static int DoSearchMenuClassic(running_machine *machine, int selection); // classic mode
static int DoSearchMenu(int selection); // advanced mode static int DoSearchMenu(running_machine *machine, int selection); // advanced mode
static int SelectSearchRegions(int selection, SearchInfo * search); static int SelectSearchRegions(running_machine *machine, int selection, SearchInfo * search);
static int ViewSearchResults(int selection, int firstTime); static int ViewSearchResults(int selection, int firstTime);
static int ChooseWatch(int selection); static int ChooseWatch(running_machine *machine, int selection);
static int EditWatch(WatchInfo * entry, int selection); static int EditWatch(running_machine *machine, WatchInfo * entry, int selection);
static int SelectOptions(int selection); static int SelectOptions(running_machine *machine, int selection);
static int SelectSearch(int selection); static int SelectSearch(running_machine *machine, int selection);
/********** ENTRY LIST **********/ /********** ENTRY LIST **********/
static void ResizeCheatList(UINT32 newLength); static void ResizeCheatList(UINT32 newLength);
@ -849,20 +849,20 @@ static void BackupRegion(SearchRegion * region);
static void RestoreRegionBackup(SearchRegion * region); static void RestoreRegionBackup(SearchRegion * region);
static void SetSearchRegionDefaultName(SearchRegion * region); static void SetSearchRegionDefaultName(SearchRegion * region);
static void AllocateSearchRegions(SearchInfo * info); static void AllocateSearchRegions(SearchInfo * info);
static void BuildSearchRegions(SearchInfo * info); static void BuildSearchRegions(running_machine *machine, SearchInfo * info);
/********** CODE LOADER **********/ /********** CODE LOADER **********/
static int ConvertOldCode(int code, int cpu, int * data, int * extendData); static int ConvertOldCode(int code, int cpu, int * data, int * extendData);
static void HandleLocalCommandCheat(UINT32 type, UINT32 address, UINT32 data, UINT32 extendData, char * name, char * description); static void HandleLocalCommandCheat(running_machine *machine, UINT32 type, UINT32 address, UINT32 data, UINT32 extendData, char * name, char * description);
static void LoadCheatFile(char * fileName); static void LoadCheatFile(running_machine *machine, char * fileName);
static void LoadCheatDatabase(void); static void LoadCheatDatabase(running_machine *machine);
static void DisposeCheatDatabase(void); static void DisposeCheatDatabase(void);
static void ReloadCheatDatabase(void); static void ReloadCheatDatabase(running_machine *machine);
static void SaveCheat(CheatEntry * entry, int selection, int saveCode); static void SaveCheat(running_machine *machine, CheatEntry * entry, int selection, int saveCode);
static void DoAutoSaveCheats(void); static void DoAutoSaveCheats(running_machine *machine);
/********** CODE ADDITION **********/ /********** CODE ADDITION **********/
static void AddCheatFromResult(SearchInfo * search, SearchRegion * region, UINT32 address); static void AddCheatFromResult(SearchInfo * search, SearchRegion * region, UINT32 address);
@ -920,15 +920,15 @@ static void DeactivateCheat(CheatEntry * entry);
static void TempDeactivateCheat(CheatEntry * entry); static void TempDeactivateCheat(CheatEntry * entry);
static void cheat_periodicOperation(CheatAction * action); static void cheat_periodicOperation(CheatAction * action);
static void cheat_periodicAction(CheatAction * action); static void cheat_periodicAction(running_machine *machine, CheatAction * action);
static void cheat_periodicEntry(CheatEntry * entry); static void cheat_periodicEntry(running_machine *machine, CheatEntry * entry);
static void UpdateAllCheatInfo(void); static void UpdateAllCheatInfo(void);
static void UpdateCheatInfo(CheatEntry * entry, UINT8 isLoadTime); static void UpdateCheatInfo(CheatEntry * entry, UINT8 isLoadTime);
static int IsAddressInRange(CheatAction * action, UINT32 length); static int IsAddressInRange(CheatAction * action, UINT32 length);
static void BuildCPUInfoList(void); static void BuildCPUInfoList(running_machine *machine);
/*-------------------------------------------------------------- /*--------------------------------------------------------------
special key handler - check pressing shift, ctrl or alt key special key handler - check pressing shift, ctrl or alt key
@ -1484,23 +1484,23 @@ void cheat_init(running_machine *machine)
fullMenuPageHeight = floor(1.0f / ui_get_line_height()) - 1; fullMenuPageHeight = floor(1.0f / ui_get_line_height()) - 1;
/* ----- initialize CPU info for cheat system ----- */ /* ----- initialize CPU info for cheat system ----- */
BuildCPUInfoList(); BuildCPUInfoList(machine);
/* ----- load cheat database ----- */ /* ----- load cheat database ----- */
LoadCheatDatabase(); LoadCheatDatabase(machine);
ResizeSearchList(1); ResizeSearchList(1);
ResizeWatchList(20); ResizeWatchList(20);
/* ----- initialize search regions ----- */ /* ----- initialize search regions ----- */
BuildSearchRegions(GetCurrentSearch()); BuildSearchRegions(machine, GetCurrentSearch());
AllocateSearchRegions(GetCurrentSearch()); AllocateSearchRegions(GetCurrentSearch());
/* ----- initialize string table ----- */ /* ----- initialize string table ----- */
InitStringTable(); InitStringTable();
periodic_timer = timer_alloc(cheat_periodic, NULL); periodic_timer = timer_alloc(cheat_periodic, NULL);
timer_adjust(periodic_timer, attotime_make(0, Machine->screen[0].refresh), 0, attotime_make(0, Machine->screen[0].refresh)); timer_adjust(periodic_timer, attotime_make(0, machine->screen[0].refresh), 0, attotime_make(0, machine->screen[0].refresh));
add_exit_callback(machine, cheat_exit); add_exit_callback(machine, cheat_exit);
} }
@ -1515,7 +1515,7 @@ static void cheat_exit(running_machine *machine)
/* ----- save all cheats automatically if needed ----- */ /* ----- save all cheats automatically if needed ----- */
if(TEST_FIELD(cheatOptions, AutoSaveEnabled)) if(TEST_FIELD(cheatOptions, AutoSaveEnabled))
DoAutoSaveCheats(); DoAutoSaveCheats(machine);
/* ----- free database ----- */ /* ----- free database ----- */
DisposeCheatDatabase(); DisposeCheatDatabase();
@ -1570,7 +1570,7 @@ static void cheat_exit(running_machine *machine)
cheat_menu - management for the cheat general menu cheat_menu - management for the cheat general menu
-----------------------------------------------------*/ -----------------------------------------------------*/
int cheat_menu(int selection) int cheat_menu(running_machine *machine, int selection)
{ {
enum enum
{ {
@ -1607,36 +1607,36 @@ int cheat_menu(int selection)
switch(sel) switch(sel)
{ {
case kMenu_EnableDisable: case kMenu_EnableDisable:
submenu_choice = EnableDisableCheatMenu(submenu_choice, firstEntry); submenu_choice = EnableDisableCheatMenu(machine, submenu_choice, firstEntry);
break; break;
case kMenu_AddEdit: case kMenu_AddEdit:
submenu_choice = AddEditCheatMenu(submenu_choice); submenu_choice = AddEditCheatMenu(machine, submenu_choice);
break; break;
case kMenu_Search: case kMenu_Search:
switch(EXTRACT_FIELD(cheatOptions, SearchBox)) switch(EXTRACT_FIELD(cheatOptions, SearchBox))
{ {
case kSearchBox_Minimum: case kSearchBox_Minimum:
submenu_choice = DoSearchMenuMinimum(submenu_choice); submenu_choice = DoSearchMenuMinimum(machine, submenu_choice);
break; break;
case kSearchBox_Classic: case kSearchBox_Classic:
submenu_choice = DoSearchMenuClassic(submenu_choice); submenu_choice = DoSearchMenuClassic(machine, submenu_choice);
break; break;
case kSearchBox_Advanced: case kSearchBox_Advanced:
submenu_choice = DoSearchMenu(submenu_choice); submenu_choice = DoSearchMenu(machine, submenu_choice);
break; break;
} }
break; break;
case kMenu_ChooseWatch: case kMenu_ChooseWatch:
submenu_choice = ChooseWatch(submenu_choice); submenu_choice = ChooseWatch(machine, submenu_choice);
break; break;
case kMenu_Options: case kMenu_Options:
submenu_choice = SelectOptions(submenu_choice); submenu_choice = SelectOptions(machine, submenu_choice);
break; break;
} }
@ -1740,7 +1740,7 @@ int cheat_menu(int selection)
break; break;
case kMenu_ReloadDatabase: case kMenu_ReloadDatabase:
ReloadCheatDatabase(); ReloadCheatDatabase(machine);
break; break;
default: default:
@ -1751,7 +1751,7 @@ int cheat_menu(int selection)
} }
if(input_ui_pressed(IPT_UI_RELOAD_CHEAT)) if(input_ui_pressed(IPT_UI_RELOAD_CHEAT))
ReloadCheatDatabase(); ReloadCheatDatabase(machine);
if(input_ui_pressed(IPT_UI_CANCEL)) if(input_ui_pressed(IPT_UI_CANCEL))
{ {
@ -2194,7 +2194,7 @@ static INT32 CommentMenu(int selection, CheatEntry * entry)
EnableDisableCheatMenu - management for Enable/Disable menu EnableDisableCheatMenu - management for Enable/Disable menu
--------------------------------------------------------------*/ --------------------------------------------------------------*/
static int EnableDisableCheatMenu(int selection, int firstTime) static int EnableDisableCheatMenu(running_machine *machine, int selection, int firstTime)
{ {
INT32 sel; INT32 sel;
static INT32 submenu_choice = 0; static INT32 submenu_choice = 0;
@ -2229,7 +2229,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
break; break;
case 3: case 3:
submenu_choice = EditCheatMenu(&cheatList[sel], sel, submenu_choice); submenu_choice = EditCheatMenu(machine, &cheatList[sel], sel, submenu_choice);
break; break;
default: default:
@ -2582,7 +2582,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
if(input_ui_pressed(IPT_UI_SAVE_CHEAT)) // shift + save = save all codes if(input_ui_pressed(IPT_UI_SAVE_CHEAT)) // shift + save = save all codes
{ {
for(i = 0; i < cheatListLength; i++) for(i = 0; i < cheatListLength; i++)
SaveCheat(&cheatList[i], 0, 0); SaveCheat(machine, &cheatList[i], 0, 0);
ui_popup_time(1, "%d cheats saved", cheatListLength); ui_popup_time(1, "%d cheats saved", cheatListLength);
} }
@ -2601,7 +2601,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
{ {
if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2)) if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2))
{ {
SaveCheat(entry, sel, 1); SaveCheat(machine, entry, sel, 1);
ui_popup_time(1, "activation key saved"); ui_popup_time(1, "activation key saved");
} }
@ -2612,7 +2612,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
else else
{ {
if(input_ui_pressed(IPT_UI_SAVE_CHEAT)) if(input_ui_pressed(IPT_UI_SAVE_CHEAT))
SaveCheat(entry, 0, 0); // save current entry SaveCheat(machine, entry, 0, 0); // save current entry
} }
} }
@ -2623,7 +2623,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
} }
if(input_ui_pressed(IPT_UI_RELOAD_CHEAT)) if(input_ui_pressed(IPT_UI_RELOAD_CHEAT))
ReloadCheatDatabase(); ReloadCheatDatabase(machine);
if(UIPressedRepeatThrottle(IPT_UI_ZOOM_IN, kVerticalKeyRepeatRate)) if(UIPressedRepeatThrottle(IPT_UI_ZOOM_IN, kVerticalKeyRepeatRate))
/* ----- quick menu switch : enable/disable -> add/edit ----- */ /* ----- quick menu switch : enable/disable -> add/edit ----- */
@ -2643,7 +2643,7 @@ static int EnableDisableCheatMenu(int selection, int firstTime)
AddEditCheatMenu - management for Add/Edit cheat menu AddEditCheatMenu - management for Add/Edit cheat menu
--------------------------------------------------------*/ --------------------------------------------------------*/
static int AddEditCheatMenu(int selection) static int AddEditCheatMenu(running_machine *machine, int selection)
{ {
INT32 sel; INT32 sel;
static INT32 submenuChoice = 0; static INT32 submenuChoice = 0;
@ -2662,7 +2662,7 @@ static int AddEditCheatMenu(int selection)
/********** SUB MENU **********/ /********** SUB MENU **********/
if(submenuChoice) if(submenuChoice)
{ {
submenuChoice = EditCheatMenu(&cheatList[submenuCheat], submenuCheat, submenuChoice); submenuChoice = EditCheatMenu(machine, &cheatList[submenuCheat], submenuCheat, submenuChoice);
/* ----- meaningless ? because no longer return with sel = -1 (pressed UI_CONFIG in submenu) ----- */ /* ----- meaningless ? because no longer return with sel = -1 (pressed UI_CONFIG in submenu) ----- */
// if(submenuChoice == -1) // if(submenuChoice == -1)
@ -2741,7 +2741,7 @@ static int AddEditCheatMenu(int selection)
if(ShiftKeyPressed()) if(ShiftKeyPressed())
{ {
for(i = 0; i < cheatListLength; i++) // shift + save = save all codes for(i = 0; i < cheatListLength; i++) // shift + save = save all codes
SaveCheat(&cheatList[i], 0, 0); SaveCheat(machine, &cheatList[i], 0, 0);
ui_popup_time(1, "%d cheats saved", cheatListLength); ui_popup_time(1, "%d cheats saved", cheatListLength);
} }
@ -2751,7 +2751,7 @@ static int AddEditCheatMenu(int selection)
{ {
if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2)) if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2))
{ {
SaveCheat(entry, sel, 1); // ctrl + save = save activation key SaveCheat(machine, entry, sel, 1); // ctrl + save = save activation key
ui_popup_time(1, "activation key saved"); ui_popup_time(1, "activation key saved");
} }
@ -2759,7 +2759,7 @@ static int AddEditCheatMenu(int selection)
ui_popup_time(1, "no activation key"); ui_popup_time(1, "no activation key");
} }
else else
SaveCheat(entry, 0, 0); // save current entry SaveCheat(machine, entry, 0, 0); // save current entry
} }
} }
@ -2799,7 +2799,7 @@ static int AddEditCheatMenu(int selection)
} }
if(input_ui_pressed(IPT_UI_RELOAD_CHEAT)) if(input_ui_pressed(IPT_UI_RELOAD_CHEAT))
ReloadCheatDatabase(); ReloadCheatDatabase(machine);
if(UIPressedRepeatThrottle(IPT_UI_ZOOM_IN, kVerticalKeyRepeatRate)) if(UIPressedRepeatThrottle(IPT_UI_ZOOM_IN, kVerticalKeyRepeatRate))
/* ----- quick menu switch : add/edit -> search ----- */ /* ----- quick menu switch : add/edit -> search ----- */
@ -2819,7 +2819,7 @@ static int AddEditCheatMenu(int selection)
EditCheatMenu - management for edit code menu EditCheatMenu - management for edit code menu
------------------------------------------------*/ ------------------------------------------------*/
static int EditCheatMenu(CheatEntry * entry, int index, int selection) static int EditCheatMenu(running_machine *machine, CheatEntry * entry, int index, int selection)
{ {
static const char *const kTypeNames[] = static const char *const kTypeNames[] =
{ {
@ -4624,14 +4624,14 @@ static int EditCheatMenu(CheatEntry * entry, int index, int selection)
if(ControlKeyPressed()) if(ControlKeyPressed())
if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2)) if((entry->flags & kCheatFlag_HasActivationKey1) || (entry->flags & kCheatFlag_HasActivationKey2))
{ {
SaveCheat(entry, index, 1); // save activation key SaveCheat(machine, entry, index, 1); // save activation key
ui_popup_time(1, "activation key saved"); ui_popup_time(1, "activation key saved");
} }
else else
ui_popup_time(1, "no activation key"); ui_popup_time(1, "no activation key");
else else
SaveCheat(entry, 0, 0); // save current entry SaveCheat(machine, entry, 0, 0); // save current entry
} }
if(input_ui_pressed(IPT_UI_WATCH_VALUE)) if(input_ui_pressed(IPT_UI_WATCH_VALUE))
@ -4683,7 +4683,7 @@ static int EditCheatMenu(CheatEntry * entry, int index, int selection)
DoSearchMenuMinimum - management for minimum search menu DoSearchMenuMinimum - management for minimum search menu
-----------------------------------------------------------*/ -----------------------------------------------------------*/
static int DoSearchMenuMinimum(int selection) static int DoSearchMenuMinimum(running_machine *machine, int selection)
{ {
/* main */ /* main */
enum enum
@ -4741,7 +4741,7 @@ static int DoSearchMenuMinimum(int selection)
switch(sel) switch(sel)
{ {
case kMenu_CPU: case kMenu_CPU:
submenuChoice = SelectSearchRegions(submenuChoice, GetCurrentSearch()); submenuChoice = SelectSearchRegions(machine, submenuChoice, GetCurrentSearch());
break; break;
case kMenu_ViewResult: case kMenu_ViewResult:
@ -4980,7 +4980,7 @@ static int DoSearchMenuMinimum(int selection)
{ {
search->targetIdx--; search->targetIdx--;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneSaveMemory = 0; doneSaveMemory = 0;
@ -5024,7 +5024,7 @@ static int DoSearchMenuMinimum(int selection)
{ {
search->targetIdx++; search->targetIdx++;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneSaveMemory = 0; doneSaveMemory = 0;
@ -5262,7 +5262,7 @@ static int DoSearchMenuMinimum(int selection)
DoSearchMenuClassic - management for classic search menu DoSearchMenuClassic - management for classic search menu
-----------------------------------------------------------*/ -----------------------------------------------------------*/
static int DoSearchMenuClassic(int selection) static int DoSearchMenuClassic(running_machine *machine, int selection)
{ {
static const char *const energyStrings[] = static const char *const energyStrings[] =
{ {
@ -5362,7 +5362,7 @@ static int DoSearchMenuClassic(int selection)
switch(sel) switch(sel)
{ {
case kMenu_CPU: case kMenu_CPU:
submenuChoice = SelectSearchRegions(submenuChoice, GetCurrentSearch()); submenuChoice = SelectSearchRegions(machine, submenuChoice, GetCurrentSearch());
break; break;
case kMenu_ViewResult: case kMenu_ViewResult:
@ -5530,7 +5530,7 @@ static int DoSearchMenuClassic(int selection)
{ {
search->targetIdx--; search->targetIdx--;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneSaveMemory = 0; doneSaveMemory = 0;
@ -5584,7 +5584,7 @@ static int DoSearchMenuClassic(int selection)
{ {
search->targetIdx++; search->targetIdx++;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneSaveMemory = 0; doneSaveMemory = 0;
@ -5791,7 +5791,7 @@ static int DoSearchMenuClassic(int selection)
DoSearchMenu - management for advanced search menu DoSearchMenu - management for advanced search menu
-----------------------------------------------------*/ -----------------------------------------------------*/
static int DoSearchMenu(int selection) static int DoSearchMenu(running_machine *machine, int selection)
{ {
/* menu stirngs */ /* menu stirngs */
static const char *const kOperandNameTable[] = static const char *const kOperandNameTable[] =
@ -5880,7 +5880,7 @@ static int DoSearchMenu(int selection)
switch(sel) switch(sel)
{ {
case kMenu_CPU: case kMenu_CPU:
submenuChoice = SelectSearchRegions(submenuChoice, GetCurrentSearch()); submenuChoice = SelectSearchRegions(machine, submenuChoice, GetCurrentSearch());
break; break;
case kMenu_ViewResult: case kMenu_ViewResult:
@ -6097,7 +6097,7 @@ static int DoSearchMenu(int selection)
{ {
search->targetIdx--; search->targetIdx--;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneMemorySave = 0; doneMemorySave = 0;
@ -6157,7 +6157,7 @@ static int DoSearchMenu(int selection)
{ {
search->targetIdx++; search->targetIdx++;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
doneMemorySave = 0; doneMemorySave = 0;
@ -6281,7 +6281,7 @@ static int DoSearchMenu(int selection)
SelectSearchRegions - management for search regions selection menu SelectSearchRegions - management for search regions selection menu
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
static int SelectSearchRegions(int selection, SearchInfo * search) static int SelectSearchRegions(running_machine *machine, int selection, SearchInfo * search)
{ {
static const char *const kSearchSpeedList[] = static const char *const kSearchSpeedList[] =
{ {
@ -6390,7 +6390,7 @@ static int SelectSearchRegions(int selection, SearchInfo * search)
else else
search->searchSpeed = kSearchSpeed_Max; search->searchSpeed = kSearchSpeed_Max;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
} }
} }
@ -6411,7 +6411,7 @@ static int SelectSearchRegions(int selection, SearchInfo * search)
else else
search->searchSpeed = kSearchSpeed_Fast; search->searchSpeed = kSearchSpeed_Fast;
BuildSearchRegions(search); BuildSearchRegions(machine, search);
AllocateSearchRegions(search); AllocateSearchRegions(search);
} }
} }
@ -6817,7 +6817,7 @@ static int ViewSearchResults(int selection, int firstTime)
ChooseWatch - management for watchpoint list menu ChooseWatch - management for watchpoint list menu
----------------------------------------------------*/ ----------------------------------------------------*/
static int ChooseWatch(int selection) static int ChooseWatch(running_machine *machine, int selection)
{ {
const char ** menuItem; const char ** menuItem;
char ** buf; char ** buf;
@ -6840,7 +6840,7 @@ static int ChooseWatch(int selection)
/********** SUB MENU **********/ /********** SUB MENU **********/
if(submenuChoice) if(submenuChoice)
{ {
submenuChoice = EditWatch(&watchList[submenuWatch], submenuChoice); submenuChoice = EditWatch(machine, &watchList[submenuWatch], submenuChoice);
/* ----- meaningless ? because no longer return with sel = -1 (pressed UI_CONFIG in submenu) ----- */ /* ----- meaningless ? because no longer return with sel = -1 (pressed UI_CONFIG in submenu) ----- */
// if(submenuChoice == -1) // if(submenuChoice == -1)
@ -6933,7 +6933,7 @@ static int ChooseWatch(int selection)
memset(&entry, 0, sizeof(CheatEntry)); memset(&entry, 0, sizeof(CheatEntry));
SetupCheatFromWatchAsWatch(&entry, watch); SetupCheatFromWatchAsWatch(&entry, watch);
SaveCheat(&entry, 0, 0); SaveCheat(machine, &entry, 0, 0);
DisposeCheat(&entry); DisposeCheat(&entry);
} }
} }
@ -7037,7 +7037,7 @@ static int ChooseWatch(int selection)
EditWatch - management for watchpoint edit menu EditWatch - management for watchpoint edit menu
--------------------------------------------------*/ --------------------------------------------------*/
static int EditWatch(WatchInfo * entry, int selection) static int EditWatch(running_machine *machine, WatchInfo * entry, int selection)
{ {
enum enum
{ {
@ -7525,7 +7525,7 @@ static int EditWatch(WatchInfo * entry, int selection)
memset(&tempEntry, 0, sizeof(CheatEntry)); memset(&tempEntry, 0, sizeof(CheatEntry));
SetupCheatFromWatchAsWatch(&tempEntry, entry); SetupCheatFromWatchAsWatch(&tempEntry, entry);
SaveCheat(&tempEntry, 0, 0); SaveCheat(machine, &tempEntry, 0, 0);
DisposeCheat(&tempEntry); DisposeCheat(&tempEntry);
} }
} }
@ -7540,7 +7540,7 @@ static int EditWatch(WatchInfo * entry, int selection)
SelectOptions - management for options menu SelectOptions - management for options menu
----------------------------------------------*/ ----------------------------------------------*/
static int SelectOptions(int selection) static int SelectOptions(running_machine *machine, int selection)
{ {
enum enum
{ {
@ -7570,7 +7570,7 @@ static int SelectOptions(int selection)
switch(sel) switch(sel)
{ {
case kMenu_SelectSearch: case kMenu_SelectSearch:
submenuChoice = SelectSearch(submenuChoice); submenuChoice = SelectSearch(machine, submenuChoice);
break; break;
default: default:
@ -7737,13 +7737,13 @@ static int SelectOptions(int selection)
if(input_ui_pressed(IPT_UI_SAVE_CHEAT)) if(input_ui_pressed(IPT_UI_SAVE_CHEAT))
{ {
SaveCheat(NULL, 0, 2); SaveCheat(machine, NULL, 0, 2);
ui_popup_time(1, "command code saved"); ui_popup_time(1, "command code saved");
} }
if(input_ui_pressed(IPT_UI_RELOAD_CHEAT)) if(input_ui_pressed(IPT_UI_RELOAD_CHEAT))
ReloadCheatDatabase(); ReloadCheatDatabase(machine);
if(input_ui_pressed(IPT_UI_CANCEL)) if(input_ui_pressed(IPT_UI_CANCEL))
sel = -1; sel = -1;
@ -7755,7 +7755,7 @@ static int SelectOptions(int selection)
SelectSearch - management for search selection menu SelectSearch - management for search selection menu
------------------------------------------------------*/ ------------------------------------------------------*/
static int SelectSearch(int selection) static int SelectSearch(running_machine *machine, int selection)
{ {
INT32 sel; INT32 sel;
const char ** menuItem; const char ** menuItem;
@ -7844,7 +7844,7 @@ static int SelectSearch(int selection)
{ {
AddSearchBefore(sel); AddSearchBefore(sel);
BuildSearchRegions(&searchList[sel]); BuildSearchRegions(machine, &searchList[sel]);
AllocateSearchRegions(&searchList[sel]); AllocateSearchRegions(&searchList[sel]);
} }
@ -7910,7 +7910,7 @@ static TIMER_CALLBACK( cheat_periodic )
return; return;
for(i = 0; i < cheatListLength; i++) for(i = 0; i < cheatListLength; i++)
cheat_periodicEntry(&cheatList[i]); cheat_periodicEntry(machine, &cheatList[i]);
} }
/*-------------- /*--------------
@ -8921,7 +8921,7 @@ static void RestoreRegionBackup(SearchRegion * region)
DefaultEnableRegion - get default regions you can search DefaultEnableRegion - get default regions you can search
-----------------------------------------------------------*/ -----------------------------------------------------------*/
static UINT8 DefaultEnableRegion(SearchRegion * region, SearchInfo * info) static UINT8 DefaultEnableRegion(running_machine *machine, SearchRegion * region, SearchInfo * info)
{ {
write8_handler handler = region->writeHandler->write.handler8; write8_handler handler = region->writeHandler->write.handler8;
FPTR handlerAddress = (FPTR)handler; FPTR handlerAddress = (FPTR)handler;
@ -8931,7 +8931,7 @@ static UINT8 DefaultEnableRegion(SearchRegion * region, SearchInfo * info)
case kSearchSpeed_Fast: case kSearchSpeed_Fast:
#if HAS_SH2 #if HAS_SH2
if(Machine->drv->cpu[0].type == CPU_SH2) if(machine->drv->cpu[0].type == CPU_SH2)
{ {
if( (info->targetType == kRegionType_CPU) && (info->targetIdx == 0) && (region->address == 0x06000000)) if( (info->targetType == kRegionType_CPU) && (info->targetIdx == 0) && (region->address == 0x06000000))
return 1; return 1;
@ -8947,7 +8947,7 @@ static UINT8 DefaultEnableRegion(SearchRegion * region, SearchInfo * info)
{ {
/* ----- for neogeo, search bank one ----- */ /* ----- for neogeo, search bank one ----- */
if( (!strcmp(Machine->gamedrv->parent, "neogeo")) && (info->targetType == kRegionType_CPU) && if( (!strcmp(machine->gamedrv->parent, "neogeo")) && (info->targetType == kRegionType_CPU) &&
(info->targetIdx == 0) && (handler == MWA8_BANK1)) (info->targetIdx == 0) && (handler == MWA8_BANK1))
return 1; return 1;
} }
@ -8957,12 +8957,12 @@ static UINT8 DefaultEnableRegion(SearchRegion * region, SearchInfo * info)
#if HAS_TMS34010 #if HAS_TMS34010
/* ----- for exterminator, search bank one ----- */ /* ----- for exterminator, search bank one ----- */
if( (Machine->drv->cpu[1].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) && if( (machine->drv->cpu[1].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
(info->targetIdx == 1) && (handler == MWA8_BANK1)) (info->targetIdx == 1) && (handler == MWA8_BANK1))
return 1; return 1;
/* ----- for smashtv, search bank two ----- */ /* ----- for smashtv, search bank two ----- */
if( (Machine->drv->cpu[0].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) && if( (machine->drv->cpu[0].type == CPU_TMS34010) && (info->targetType == kRegionType_CPU) &&
(info->targetIdx == 0) && (handler == MWA8_BANK2)) (info->targetIdx == 0) && (handler == MWA8_BANK2))
return 1; return 1;
@ -9114,7 +9114,7 @@ static void AllocateSearchRegions(SearchInfo * info)
BuildSearchRegions BuildSearchRegions
---------------------*/ ---------------------*/
static void BuildSearchRegions(SearchInfo * info) static void BuildSearchRegions(running_machine *machine, SearchInfo * info)
{ {
info->comparison = kSearchComparison_EqualTo; info->comparison = kSearchComparison_EqualTo;
@ -9195,7 +9195,7 @@ static void BuildSearchRegions(SearchInfo * info)
traverse->backupLast = NULL; traverse->backupLast = NULL;
traverse->backupStatus = NULL; traverse->backupStatus = NULL;
traverse->flags = DefaultEnableRegion(traverse, info) ? kRegionFlag_Enabled : 0; traverse->flags = DefaultEnableRegion(machine, traverse, info) ? kRegionFlag_Enabled : 0;
SetSearchRegionDefaultName(traverse); SetSearchRegionDefaultName(traverse);
@ -9364,7 +9364,7 @@ static int ConvertOldCode(int code, int cpu, int * data, int * extendData)
HandleLocalCommandCheat - get special code which is not added into cheat list HandleLocalCommandCheat - get special code which is not added into cheat list
--------------------------------------------------------------------------------*/ --------------------------------------------------------------------------------*/
static void HandleLocalCommandCheat(UINT32 type, UINT32 address, UINT32 data, UINT32 extendData, char * name, char * description) static void HandleLocalCommandCheat(running_machine *machine, UINT32 type, UINT32 address, UINT32 data, UINT32 extendData, char * name, char * description)
{ {
switch(EXTRACT_FIELD(type, LocationType)) switch(EXTRACT_FIELD(type, LocationType))
{ {
@ -9415,7 +9415,7 @@ static void HandleLocalCommandCheat(UINT32 type, UINT32 address, UINT32 data, UI
overclock /= 65536.0; overclock /= 65536.0;
cpunum_set_clockscale(address, overclock); cpunum_set_clockscale(machine, address, overclock);
} }
} }
break; break;
@ -9423,7 +9423,7 @@ static void HandleLocalCommandCheat(UINT32 type, UINT32 address, UINT32 data, UI
/* ----- refresh rate ----- */ /* ----- refresh rate ----- */
case kCustomLocation_RefreshRate: case kCustomLocation_RefreshRate:
{ {
screen_state *state = &Machine->screen[0]; screen_state *state = &machine->screen[0];
double refresh = data; double refresh = data;
refresh /= 65536.0; refresh /= 65536.0;
@ -9440,7 +9440,7 @@ static void HandleLocalCommandCheat(UINT32 type, UINT32 address, UINT32 data, UI
LoadCheatFile - load cheat code from database LoadCheatFile - load cheat code from database
------------------------------------------------*/ ------------------------------------------------*/
static void LoadCheatFile(char * fileName) static void LoadCheatFile(running_machine *machine, char * fileName)
{ {
mame_file * theFile; mame_file * theFile;
file_error filerr; file_error filerr;
@ -9459,11 +9459,11 @@ static void LoadCheatFile(char * fileName)
/* ----- make the format strings ----- */ /* ----- make the format strings ----- */
#ifdef MESS #ifdef MESS
sprintf(formatString, ":%s:%s", Machine->gamedrv->name, "%x:%x:%x:%x:%x:%[^:\n\r]:%[^:\n\r]"); sprintf(formatString, ":%s:%s", machine->gamedrv->name, "%x:%x:%x:%x:%x:%[^:\n\r]:%[^:\n\r]");
sprintf(oldFormatString, "%s:%s", Machine->gamedrv->name, "%x:%d:%x:%x:%d:%[^:\n\r]:%[^:\n\r]"); sprintf(oldFormatString, "%s:%s", machine->gamedrv->name, "%x:%d:%x:%x:%d:%[^:\n\r]:%[^:\n\r]");
#else #else
sprintf(formatString, ":%s:%s", Machine->gamedrv->name, "%x:%x:%x:%x:%[^:\n\r]:%[^:\n\r]"); sprintf(formatString, ":%s:%s", machine->gamedrv->name, "%x:%x:%x:%x:%[^:\n\r]:%[^:\n\r]");
sprintf(oldFormatString, "%s:%s", Machine->gamedrv->name, "%d:%x:%x:%d:%[^:\n\r]:%[^:\n\r]"); sprintf(oldFormatString, "%s:%s", machine->gamedrv->name, "%d:%x:%x:%d:%[^:\n\r]:%[^:\n\r]");
#endif #endif
/* ----- get a line from database ----- */ /* ----- get a line from database ----- */
@ -9552,7 +9552,7 @@ static void LoadCheatFile(char * fileName)
{ {
//logerror("cheat: cheat line removed\n", buf); //logerror("cheat: cheat line removed\n", buf);
HandleLocalCommandCheat(type, address, data, extendData, name, description); HandleLocalCommandCheat(machine, type, address, data, extendData, name, description);
} }
else else
{ {
@ -9634,7 +9634,7 @@ static void LoadCheatFile(char * fileName)
LoadCheatDatabase - get the database name then load it LoadCheatDatabase - get the database name then load it
---------------------------------------------------------*/ ---------------------------------------------------------*/
static void LoadCheatDatabase(void) static void LoadCheatDatabase(running_machine *machine)
{ {
char buf[4096]; char buf[4096];
const char * inTraverse; const char * inTraverse;
@ -9671,7 +9671,7 @@ static void LoadCheatDatabase(void)
if(buf[0]) if(buf[0])
{ {
/* ----- load database based on the name we gotten ----- */ /* ----- load database based on the name we gotten ----- */
LoadCheatFile(buf); LoadCheatFile(machine, buf);
outTraverse =buf; outTraverse =buf;
buf[0] = 0; buf[0] = 0;
@ -9722,10 +9722,10 @@ static void DisposeCheatDatabase(void)
ReloadCheatDatabase - reload cheat database directly on the cheat menu ReloadCheatDatabase - reload cheat database directly on the cheat menu
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
static void ReloadCheatDatabase(void) static void ReloadCheatDatabase(running_machine *machine)
{ {
DisposeCheatDatabase(); DisposeCheatDatabase();
LoadCheatDatabase(); LoadCheatDatabase(machine);
ui_popup_time(1, "Cheat Database reloaded"); ui_popup_time(1, "Cheat Database reloaded");
} }
@ -9734,7 +9734,7 @@ static void ReloadCheatDatabase(void)
SaveCheat - save a code (normal code, activation key, option) SaveCheat - save a code (normal code, activation key, option)
---------------------------------------------------------------*/ ---------------------------------------------------------------*/
static void SaveCheat(CheatEntry * entry, int selection, int saveCode) static void SaveCheat(running_machine *machine, CheatEntry * entry, int selection, int saveCode)
{ {
enum{ enum{
normalCode = 0, normalCode = 0,
@ -9817,9 +9817,9 @@ static void SaveCheat(CheatEntry * entry, int selection, int saveCode)
break; break;
} }
#ifdef MESS #ifdef MESS
bufTraverse += sprintf(bufTraverse, ":%s:%.8X:%.8X:%.*X:%.8X:%.8X", Machine->gamedrv->name, thisGameCRC, type, addressLength, action->address, action->originalDataField, action->extendData); bufTraverse += sprintf(bufTraverse, ":%s:%.8X:%.8X:%.*X:%.8X:%.8X", machine->gamedrv->name, thisGameCRC, type, addressLength, action->address, action->originalDataField, action->extendData);
#else #else
bufTraverse += sprintf(bufTraverse, ":%s:%.8X:%.*X:%.8X:%.8X", Machine->gamedrv->name, type, addressLength, action->address, action->originalDataField, action->extendData); bufTraverse += sprintf(bufTraverse, ":%s:%.8X:%.*X:%.8X:%.8X", machine->gamedrv->name, type, addressLength, action->address, action->originalDataField, action->extendData);
#endif #endif
/* ----- set description and comment ----- */ /* ----- set description and comment ----- */
if(name) if(name)
@ -9863,14 +9863,14 @@ static void SaveCheat(CheatEntry * entry, int selection, int saveCode)
addressLength = cpuInfoList[EXTRACT_FIELD(entry->actionList[1].type, LocationParameter)].addressCharsNeeded; addressLength = cpuInfoList[EXTRACT_FIELD(entry->actionList[1].type, LocationParameter)].addressCharsNeeded;
#ifdef MESS #ifdef MESS
if(!i) if(!i)
bufTraverse += sprintf(bufTraverse, ":%s:%.8X:63004000:%.*X:%.8X:00000000", Machine->gamedrv->name, thisGameCRC, addressLength, selection, entry->activationKey1); bufTraverse += sprintf(bufTraverse, ":%s:%.8X:63004000:%.*X:%.8X:00000000", machine->gamedrv->name, thisGameCRC, addressLength, selection, entry->activationKey1);
else else
bufTraverse += sprintf(bufTraverse, ":%s:%.8X:63004001:%.*X:%.8X:00000000", Machine->gamedrv->name, thisGameCRC, addressLength, selection, entry->activationKey2); bufTraverse += sprintf(bufTraverse, ":%s:%.8X:63004001:%.*X:%.8X:00000000", machine->gamedrv->name, thisGameCRC, addressLength, selection, entry->activationKey2);
#else #else
if(!i) if(!i)
bufTraverse += sprintf(bufTraverse, ":%s:63004000:%.*X:%.8X:00000000", Machine->gamedrv->name, addressLength, selection, entry->activationKey1); bufTraverse += sprintf(bufTraverse, ":%s:63004000:%.*X:%.8X:00000000", machine->gamedrv->name, addressLength, selection, entry->activationKey1);
else else
bufTraverse += sprintf(bufTraverse, ":%s:63004001:%.*X:%.8X:00000000", Machine->gamedrv->name, addressLength, selection, entry->activationKey2); bufTraverse += sprintf(bufTraverse, ":%s:63004001:%.*X:%.8X:00000000", machine->gamedrv->name, addressLength, selection, entry->activationKey2);
#endif #endif
/* ----- set description and button index ----- */ /* ----- set description and button index ----- */
if(!i) if(!i)
@ -9922,7 +9922,7 @@ static void SaveCheat(CheatEntry * entry, int selection, int saveCode)
DoAutoSaveCheat - save normal code automatically when exit cheat system DoAutoSaveCheat - save normal code automatically when exit cheat system
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static void DoAutoSaveCheats(void) static void DoAutoSaveCheats(running_machine *machine)
{ {
int i; int i;
@ -9931,7 +9931,7 @@ static void DoAutoSaveCheats(void)
CheatEntry * entry = &cheatList[i]; CheatEntry * entry = &cheatList[i];
if(entry->flags & kCheatFlag_Dirty) if(entry->flags & kCheatFlag_Dirty)
SaveCheat(entry, 0, 0); SaveCheat(machine, entry, 0, 0);
} }
} }
@ -11359,7 +11359,7 @@ static void cheat_periodicOperation(CheatAction * action)
cheat_periodicAction - management for cheat actions cheat_periodicAction - management for cheat actions
------------------------------------------------------*/ ------------------------------------------------------*/
static void cheat_periodicAction(CheatAction * action) static void cheat_periodicAction(running_machine *machine, CheatAction * action)
{ {
UINT8 parameter = EXTRACT_FIELD(action->type, TypeParameter); UINT8 parameter = EXTRACT_FIELD(action->type, TypeParameter);
@ -11400,7 +11400,7 @@ static void cheat_periodicAction(CheatAction * action)
/* ----- keep if one shot + restore prevous value + delay !=0 ----- */ /* ----- keep if one shot + restore prevous value + delay !=0 ----- */
cheat_periodicOperation(action); cheat_periodicOperation(action);
if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh))) if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(machine->screen[0].refresh)))
{ {
action->frameTimer = 0; action->frameTimer = 0;
@ -11412,7 +11412,7 @@ static void cheat_periodicAction(CheatAction * action)
else else
{ {
/* ----- otherwise, delay ----- */ /* ----- otherwise, delay ----- */
if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh))) if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(machine->screen[0].refresh)))
{ {
action->frameTimer = 0; action->frameTimer = 0;
@ -11451,7 +11451,7 @@ static void cheat_periodicAction(CheatAction * action)
if(currentValue != action->lastValue) if(currentValue != action->lastValue)
{ {
action->frameTimer = parameter * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); action->frameTimer = parameter * ATTOSECONDS_TO_HZ(machine->screen[0].refresh);
action->flags |= kActionFlag_WasModified; action->flags |= kActionFlag_WasModified;
} }
@ -11487,7 +11487,7 @@ static void cheat_periodicAction(CheatAction * action)
cheat_periodicEntry - management for cheat entries cheat_periodicEntry - management for cheat entries
-----------------------------------------------------*/ -----------------------------------------------------*/
static void cheat_periodicEntry(CheatEntry * entry) static void cheat_periodicEntry(running_machine *machine, CheatEntry * entry)
{ {
int i; int i;
@ -11596,7 +11596,7 @@ static void cheat_periodicEntry(CheatEntry * entry)
do{ do{
if(!(entry->flags & kCheatFlag_OneShot) || (entry->flags & kCheatFlag_DoOneShot)) if(!(entry->flags & kCheatFlag_OneShot) || (entry->flags & kCheatFlag_DoOneShot))
cheat_periodicAction(&entry->actionList[i]); cheat_periodicAction(machine, &entry->actionList[i]);
i++; i++;
@ -11659,7 +11659,7 @@ static void cheat_periodicEntry(CheatEntry * entry)
/* ----- update all actions ----- */ /* ----- update all actions ----- */
for(i = 0; i < entry->actionListLength; i++) for(i = 0; i < entry->actionListLength; i++)
cheat_periodicAction(&entry->actionList[i]); cheat_periodicAction(machine, &entry->actionList[i]);
/* ----- if all actions are done, deactivate the cheat if oneshot entry ----- */ /* ----- if all actions are done, deactivate the cheat if oneshot entry ----- */
{ {
@ -11778,13 +11778,13 @@ static int IsAddressInRange(CheatAction * action, UINT32 length)
BuildCPUInfoList - get CPU info when initialize cheat system BuildCPUInfoList - get CPU info when initialize cheat system
---------------------------------------------------------------*/ ---------------------------------------------------------------*/
static void BuildCPUInfoList(void) static void BuildCPUInfoList(running_machine *machine)
{ {
int i; int i;
/* ----- do regions ----- */ /* ----- do regions ----- */
{ {
const rom_entry * traverse = rom_first_region(Machine->gamedrv); const rom_entry * traverse = rom_first_region(machine->gamedrv);
memset(regionInfoList, 0, sizeof(CPUInfo) * kRegionListLength); memset(regionInfoList, 0, sizeof(CPUInfo) * kRegionListLength);
@ -11846,7 +11846,7 @@ static void BuildCPUInfoList(void)
CPUInfo * info = &cpuInfoList[i]; CPUInfo * info = &cpuInfoList[i];
CPUInfo * regionInfo = &regionInfoList[REGION_CPU1 + i - REGION_INVALID]; CPUInfo * regionInfo = &regionInfoList[REGION_CPU1 + i - REGION_INVALID];
cpu_type type = Machine->drv->cpu[i].type; cpu_type type = machine->drv->cpu[i].type;
info->type = type; info->type = type;
info->dataBits = cputype_databus_width(type, ADDRESS_SPACE_PROGRAM); info->dataBits = cputype_databus_width(type, ADDRESS_SPACE_PROGRAM);

View File

@ -18,7 +18,7 @@
void cheat_init(running_machine *machine); void cheat_init(running_machine *machine);
int cheat_menu(int selection); int cheat_menu(running_machine *machine, int selection);
void cheat_display_watches(void); void cheat_display_watches(void);

View File

@ -53,8 +53,8 @@ static config_type *typelist;
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
static int config_load_xml(mame_file *file, int type); static int config_load_xml(running_machine *machine, mame_file *file, int type);
static int config_save_xml(mame_file *file, int type); static int config_save_xml(running_machine *machine, mame_file *file, int type);
@ -111,7 +111,7 @@ void config_register(const char *nodename, config_callback load, config_callback
* *
*************************************/ *************************************/
int config_load_settings(void) int config_load_settings(running_machine *machine)
{ {
const char *controller = options_get_string(mame_options(), OPTION_CTRLR); const char *controller = options_get_string(mame_options(), OPTION_CTRLR);
file_error filerr; file_error filerr;
@ -136,7 +136,7 @@ int config_load_settings(void)
fatalerror("Could not load controller file %s.cfg", controller); fatalerror("Could not load controller file %s.cfg", controller);
/* load the XML */ /* load the XML */
if (!config_load_xml(file, CONFIG_TYPE_CONTROLLER)) if (!config_load_xml(machine, file, CONFIG_TYPE_CONTROLLER))
fatalerror("Could not load controller file %s.cfg", controller); fatalerror("Could not load controller file %s.cfg", controller);
mame_fclose(file); mame_fclose(file);
} }
@ -145,18 +145,18 @@ int config_load_settings(void)
filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_READ, &file); filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_READ, &file);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
config_load_xml(file, CONFIG_TYPE_DEFAULT); config_load_xml(machine, file, CONFIG_TYPE_DEFAULT);
mame_fclose(file); mame_fclose(file);
} }
/* finally, load the game-specific file */ /* finally, load the game-specific file */
fname = astring_assemble_2(astring_alloc(), Machine->basename, ".cfg"); fname = astring_assemble_2(astring_alloc(), machine->basename, ".cfg");
filerr = mame_fopen(SEARCHPATH_CONFIG, astring_c(fname), OPEN_FLAG_READ, &file); filerr = mame_fopen(SEARCHPATH_CONFIG, astring_c(fname), OPEN_FLAG_READ, &file);
astring_free(fname); astring_free(fname);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
loaded = config_load_xml(file, CONFIG_TYPE_GAME); loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME);
mame_fclose(file); mame_fclose(file);
} }
@ -170,7 +170,7 @@ int config_load_settings(void)
} }
void config_save_settings(void) void config_save_settings(running_machine *machine)
{ {
file_error filerr; file_error filerr;
config_type *type; config_type *type;
@ -185,18 +185,18 @@ void config_save_settings(void)
filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
config_save_xml(file, CONFIG_TYPE_DEFAULT); config_save_xml(machine, file, CONFIG_TYPE_DEFAULT);
mame_fclose(file); mame_fclose(file);
} }
/* finally, save the game-specific file */ /* finally, save the game-specific file */
fname = astring_assemble_2(astring_alloc(), Machine->basename, ".cfg"); fname = astring_assemble_2(astring_alloc(), machine->basename, ".cfg");
filerr = mame_fopen(SEARCHPATH_CONFIG, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file); filerr = mame_fopen(SEARCHPATH_CONFIG, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
astring_free(fname); astring_free(fname);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
{ {
config_save_xml(file, CONFIG_TYPE_GAME); config_save_xml(machine, file, CONFIG_TYPE_GAME);
mame_fclose(file); mame_fclose(file);
} }
@ -213,7 +213,7 @@ void config_save_settings(void)
* *
*************************************/ *************************************/
static int config_load_xml(mame_file *file, int which_type) static int config_load_xml(running_machine *machine, mame_file *file, int which_type)
{ {
xml_data_node *root, *confignode, *systemnode; xml_data_node *root, *confignode, *systemnode;
config_type *type; config_type *type;
@ -236,13 +236,13 @@ static int config_load_xml(mame_file *file, int which_type)
goto error; goto error;
/* strip off all the path crap from the source filename */ /* strip off all the path crap from the source filename */
srcfile = strrchr(Machine->gamedrv->source_file, '/'); srcfile = strrchr(machine->gamedrv->source_file, '/');
if (!srcfile) if (!srcfile)
srcfile = strrchr(Machine->gamedrv->source_file, '\\'); srcfile = strrchr(machine->gamedrv->source_file, '\\');
if (!srcfile) if (!srcfile)
srcfile = strrchr(Machine->gamedrv->source_file, ':'); srcfile = strrchr(machine->gamedrv->source_file, ':');
if (!srcfile) if (!srcfile)
srcfile = Machine->gamedrv->source_file; srcfile = machine->gamedrv->source_file;
else else
srcfile++; srcfile++;
@ -258,7 +258,7 @@ static int config_load_xml(mame_file *file, int which_type)
{ {
case CONFIG_TYPE_GAME: case CONFIG_TYPE_GAME:
/* only match on the specific game name */ /* only match on the specific game name */
if (strcmp(name, Machine->gamedrv->name) != 0) if (strcmp(name, machine->gamedrv->name) != 0)
continue; continue;
break; break;
@ -273,9 +273,9 @@ static int config_load_xml(mame_file *file, int which_type)
const game_driver *clone_of; const game_driver *clone_of;
/* match on: default, game name, source file name, parent name, grandparent name */ /* match on: default, game name, source file name, parent name, grandparent name */
if (strcmp(name, "default") != 0 && if (strcmp(name, "default") != 0 &&
strcmp(name, Machine->gamedrv->name) != 0 && strcmp(name, machine->gamedrv->name) != 0 &&
strcmp(name, srcfile) != 0 && strcmp(name, srcfile) != 0 &&
((clone_of = driver_get_clone(Machine->gamedrv)) == NULL || strcmp(name, clone_of->name) != 0) && ((clone_of = driver_get_clone(machine->gamedrv)) == NULL || strcmp(name, clone_of->name) != 0) &&
(clone_of == NULL || ((clone_of = driver_get_clone(clone_of)) == NULL) || strcmp(name, clone_of->name) != 0)) (clone_of == NULL || ((clone_of = driver_get_clone(clone_of)) == NULL) || strcmp(name, clone_of->name) != 0))
continue; continue;
break; break;
@ -314,7 +314,7 @@ error:
* *
*************************************/ *************************************/
static int config_save_xml(mame_file *file, int which_type) static int config_save_xml(running_machine *machine, mame_file *file, int which_type)
{ {
xml_data_node *root = xml_file_create(); xml_data_node *root = xml_file_create();
xml_data_node *confignode, *systemnode; xml_data_node *confignode, *systemnode;
@ -334,7 +334,7 @@ static int config_save_xml(mame_file *file, int which_type)
systemnode = xml_add_child(confignode, "system", NULL); systemnode = xml_add_child(confignode, "system", NULL);
if (!systemnode) if (!systemnode)
goto error; goto error;
xml_set_attribute(systemnode, "name", (which_type == CONFIG_TYPE_DEFAULT) ? "default" : Machine->gamedrv->name); xml_set_attribute(systemnode, "name", (which_type == CONFIG_TYPE_DEFAULT) ? "default" : machine->gamedrv->name);
/* create the input node and write it out */ /* create the input node and write it out */
/* loop over all registrants and call their save function */ /* loop over all registrants and call their save function */

View File

@ -55,7 +55,7 @@ typedef void (*config_callback)(int config_type, xml_data_node *parentnode);
void config_init(running_machine *machine); void config_init(running_machine *machine);
void config_register(const char *nodename, config_callback load, config_callback save); void config_register(const char *nodename, config_callback load, config_callback save);
int config_load_settings(void); int config_load_settings(running_machine *machine);
void config_save_settings(void); void config_save_settings(running_machine *machine);
#endif /* __CONFIG_H__ */ #endif /* __CONFIG_H__ */

View File

@ -569,7 +569,7 @@ static int ccpu_execute(int cycles)
/* CST */ /* CST */
case 0xf7: case 0xf7:
watchdog_reset(); watchdog_reset(Machine);
/* ADDP */ /* ADDP */
case 0xe7: case 0xe7:
tempval = RDMEM(ccpu.I); tempval = RDMEM(ccpu.I);

View File

@ -276,7 +276,7 @@ static TIMER_CALLBACK( m37710_timer_a0_cb)
m37710i_cpu.m37710_regs[m37710_irq_levels[12]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[12]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERA0, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERA0, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -289,7 +289,7 @@ static TIMER_CALLBACK( m37710_timer_a1_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[11]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[11]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERA1, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERA1, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -302,7 +302,7 @@ static TIMER_CALLBACK( m37710_timer_a2_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[10]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[10]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERA2, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERA2, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -315,7 +315,7 @@ static TIMER_CALLBACK( m37710_timer_a3_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[9]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[9]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERA3, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERA3, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -328,7 +328,7 @@ static TIMER_CALLBACK( m37710_timer_a4_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[8]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[8]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERA4, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERA4, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -341,7 +341,7 @@ static TIMER_CALLBACK( m37710_timer_b0_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[7]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[7]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERB0, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERB0, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -354,7 +354,7 @@ static TIMER_CALLBACK( m37710_timer_b1_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[6]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[6]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERB1, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERB1, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }
@ -367,7 +367,7 @@ static TIMER_CALLBACK( m37710_timer_b2_cb )
m37710i_cpu.m37710_regs[m37710_irq_levels[5]] |= 0x04; m37710i_cpu.m37710_regs[m37710_irq_levels[5]] |= 0x04;
m37710_set_irq_line(M37710_LINE_TIMERB2, PULSE_LINE); m37710_set_irq_line(M37710_LINE_TIMERB2, PULSE_LINE);
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
cpuintrf_pop_context(); cpuintrf_pop_context();
} }

View File

@ -804,7 +804,7 @@ static TIMER_CALLBACK( internal_interrupt_callback )
cpuintrf_pop_context(); cpuintrf_pop_context();
/* generate triggers so that spin loops can key off them */ /* generate triggers so that spin loops can key off them */
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
} }

View File

@ -155,12 +155,12 @@ static emu_timer *watchdog_timer;
static void cpuexec_exit(running_machine *machine); static void cpuexec_exit(running_machine *machine);
static void cpuexec_reset(running_machine *machine); static void cpuexec_reset(running_machine *machine);
static void cpu_inittimers(running_machine *machine); static void cpu_inittimers(running_machine *machine);
static void cpu_vblankreset(void); static void cpu_vblankreset(running_machine *machine);
static TIMER_CALLBACK( cpu_vblankcallback ); static TIMER_CALLBACK( cpu_vblankcallback );
static TIMER_CALLBACK( cpu_updatecallback ); static TIMER_CALLBACK( cpu_updatecallback );
static TIMER_CALLBACK( end_interleave_boost ); static TIMER_CALLBACK( end_interleave_boost );
static void compute_perfect_interleave(void); static void compute_perfect_interleave(running_machine *machine);
static void watchdog_setup(int alloc_new); static void watchdog_setup(running_machine *machine, int alloc_new);
@ -200,7 +200,7 @@ void cpuexec_init(running_machine *machine)
/* allocate vblank and refresh timers, and compute the initial timing */ /* allocate vblank and refresh timers, and compute the initial timing */
vblank_timer = timer_alloc(cpu_vblankcallback, NULL); vblank_timer = timer_alloc(cpu_vblankcallback, NULL);
refresh_timer = timer_alloc(NULL, NULL); refresh_timer = timer_alloc(NULL, NULL);
cpu_compute_vblank_timing(); cpu_compute_vblank_timing(machine);
/* loop over all our CPUs */ /* loop over all our CPUs */
for (cpunum = 0; cpunum < MAX_CPU; cpunum++) for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
@ -260,7 +260,7 @@ void cpuexec_init(running_machine *machine)
add_exit_callback(machine, cpuexec_exit); add_exit_callback(machine, cpuexec_exit);
/* compute the perfect interleave factor */ /* compute the perfect interleave factor */
compute_perfect_interleave(); compute_perfect_interleave(machine);
/* save some stuff in the default tag */ /* save some stuff in the default tag */
state_save_push_tag(0); state_save_push_tag(0);
@ -286,7 +286,7 @@ static void cpuexec_reset(running_machine *machine)
/* initialize the various timers (suspends all CPUs at startup) */ /* initialize the various timers (suspends all CPUs at startup) */
cpu_inittimers(machine); cpu_inittimers(machine);
watchdog_counter = WATCHDOG_IS_INVALID; watchdog_counter = WATCHDOG_IS_INVALID;
watchdog_setup(TRUE); watchdog_setup(machine, TRUE);
/* first pass over CPUs */ /* first pass over CPUs */
for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
@ -305,7 +305,7 @@ static void cpuexec_reset(running_machine *machine)
} }
/* reset the globals */ /* reset the globals */
cpu_vblankreset(); cpu_vblankreset(machine);
vblank = 0; vblank = 0;
current_frame = 0; current_frame = 0;
} }
@ -355,21 +355,21 @@ static TIMER_CALLBACK( watchdog_callback )
* *
*************************************/ *************************************/
static void watchdog_setup(int alloc_new) static void watchdog_setup(running_machine *machine, int alloc_new)
{ {
if (watchdog_counter != WATCHDOG_IS_DISABLED) if (watchdog_counter != WATCHDOG_IS_DISABLED)
{ {
if (Machine->drv->watchdog_vblank_count) if (machine->drv->watchdog_vblank_count)
{ {
/* Start a vblank based watchdog. */ /* Start a vblank based watchdog. */
watchdog_counter = Machine->drv->watchdog_vblank_count; watchdog_counter = machine->drv->watchdog_vblank_count;
} }
else if (attotime_compare(Machine->drv->watchdog_time, attotime_zero) != 0) else if (attotime_compare(machine->drv->watchdog_time, attotime_zero) != 0)
{ {
/* Start a time based watchdog. */ /* Start a time based watchdog. */
if (alloc_new) if (alloc_new)
watchdog_timer = timer_alloc(watchdog_callback, NULL); watchdog_timer = timer_alloc(watchdog_callback, NULL);
timer_adjust(watchdog_timer, Machine->drv->watchdog_time, 0, attotime_zero); timer_adjust(watchdog_timer, machine->drv->watchdog_time, 0, attotime_zero);
watchdog_counter = WATCHDOG_IS_TIMER_BASED; watchdog_counter = WATCHDOG_IS_TIMER_BASED;
} }
else if (watchdog_counter == WATCHDOG_IS_INVALID) else if (watchdog_counter == WATCHDOG_IS_INVALID)
@ -390,7 +390,7 @@ static void watchdog_setup(int alloc_new)
* The 3 seconds delay is targeted at qzshowby, which otherwise * The 3 seconds delay is targeted at qzshowby, which otherwise
* would reset at the start of a game. * would reset at the start of a game.
*/ */
watchdog_counter = 3 * ATTOSECONDS_TO_HZ(Machine->screen[0].refresh); watchdog_counter = 3 * ATTOSECONDS_TO_HZ(machine->screen[0].refresh);
} }
} }
} }
@ -403,11 +403,11 @@ static void watchdog_setup(int alloc_new)
* *
*************************************/ *************************************/
void watchdog_reset(void) void watchdog_reset(running_machine *machine)
{ {
if (watchdog_counter == WATCHDOG_IS_TIMER_BASED) if (watchdog_counter == WATCHDOG_IS_TIMER_BASED)
{ {
timer_reset(watchdog_timer, Machine->drv->watchdog_time); timer_reset(watchdog_timer, machine->drv->watchdog_time);
} }
else else
{ {
@ -417,7 +417,7 @@ void watchdog_reset(void)
logerror("(vblank) watchdog armed by reset\n"); logerror("(vblank) watchdog armed by reset\n");
} }
watchdog_setup(FALSE); watchdog_setup(machine, FALSE);
} }
} }
@ -429,7 +429,7 @@ void watchdog_reset(void)
* *
*************************************/ *************************************/
void watchdog_enable(int enable) void watchdog_enable(running_machine *machine, int enable)
{ {
if (!enable) if (!enable)
{ {
@ -442,7 +442,7 @@ void watchdog_enable(int enable)
if (watchdog_counter == WATCHDOG_IS_DISABLED) if (watchdog_counter == WATCHDOG_IS_DISABLED)
{ {
watchdog_counter = WATCHDOG_IS_BEING_STARTED; watchdog_counter = WATCHDOG_IS_BEING_STARTED;
watchdog_setup(FALSE); watchdog_setup(machine, FALSE);
} }
} }
@ -460,7 +460,7 @@ void watchdog_enable(int enable)
* *
*************************************/ *************************************/
void cpuexec_timeslice(void) void cpuexec_timeslice(running_machine *machine)
{ {
attotime target = timer_next_fire_time(); attotime target = timer_next_fire_time();
attotime base = timer_get_time(); attotime base = timer_get_time();
@ -470,7 +470,7 @@ void cpuexec_timeslice(void)
LOG(("cpu_timeslice: target = %s\n", attotime_string(target, 9))); LOG(("cpu_timeslice: target = %s\n", attotime_string(target, 9)));
/* process any pending suspends */ /* process any pending suspends */
for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) for (cpunum = 0; machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{ {
if (cpu[cpunum].suspend != cpu[cpunum].nextsuspend) if (cpu[cpunum].suspend != cpu[cpunum].nextsuspend)
LOG(("--> updated CPU%d suspend from %X to %X\n", cpunum, cpu[cpunum].suspend, cpu[cpunum].nextsuspend)); LOG(("--> updated CPU%d suspend from %X to %X\n", cpunum, cpu[cpunum].suspend, cpu[cpunum].nextsuspend));
@ -479,7 +479,7 @@ void cpuexec_timeslice(void)
} }
/* loop over CPUs */ /* loop over CPUs */
for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) for (cpunum = 0; machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{ {
/* only process if we're not suspended */ /* only process if we're not suspended */
if (!cpu[cpunum].suspend) if (!cpu[cpunum].suspend)
@ -525,7 +525,7 @@ void cpuexec_timeslice(void)
} }
/* update the local times of all CPUs */ /* update the local times of all CPUs */
for (cpunum = 0; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) for (cpunum = 0; machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{ {
/* if we're suspended and counting, process */ /* if we're suspended and counting, process */
if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && attotime_compare(cpu[cpunum].localtime, target) < 0) if (cpu[cpunum].suspend && cpu[cpunum].eatcycles && attotime_compare(cpu[cpunum].localtime, target) < 0)
@ -677,7 +677,7 @@ int cpunum_get_clock(int cpunum)
* *
*************************************/ *************************************/
void cpunum_set_clock(int cpunum, int clock) void cpunum_set_clock(running_machine *machine, int cpunum, int clock)
{ {
VERIFY_CPUNUM(cpunum_set_clock); VERIFY_CPUNUM(cpunum_set_clock);
@ -686,12 +686,12 @@ void cpunum_set_clock(int cpunum, int clock)
attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)clock * cpu[cpunum].clockscale); attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)clock * cpu[cpunum].clockscale);
/* re-compute the perfect interleave factor */ /* re-compute the perfect interleave factor */
compute_perfect_interleave(); compute_perfect_interleave(machine);
} }
void cpunum_set_clock_period(int cpunum, attoseconds_t clock_period) void cpunum_set_clock_period(running_machine *machine, int cpunum, attoseconds_t clock_period)
{ {
VERIFY_CPUNUM(cpunum_set_clock); VERIFY_CPUNUM(cpunum_set_clock);
@ -700,7 +700,7 @@ void cpunum_set_clock_period(int cpunum, attoseconds_t clock_period)
attoseconds_per_cycle[cpunum] = clock_period; attoseconds_per_cycle[cpunum] = clock_period;
/* re-compute the perfect interleave factor */ /* re-compute the perfect interleave factor */
compute_perfect_interleave(); compute_perfect_interleave(machine);
} }
@ -727,7 +727,7 @@ double cpunum_get_clockscale(int cpunum)
* *
*************************************/ *************************************/
void cpunum_set_clockscale(int cpunum, double clockscale) void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale)
{ {
VERIFY_CPUNUM(cpunum_set_clockscale); VERIFY_CPUNUM(cpunum_set_clockscale);
@ -736,7 +736,7 @@ void cpunum_set_clockscale(int cpunum, double clockscale)
attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)cpu[cpunum].clock * clockscale); attoseconds_per_cycle[cpunum] = ATTOSECONDS_PER_SECOND / ((double)cpu[cpunum].clock * clockscale);
/* re-compute the perfect interleave factor */ /* re-compute the perfect interleave factor */
compute_perfect_interleave(); compute_perfect_interleave(machine);
} }
@ -898,12 +898,12 @@ int cpu_scalebyfcount(int value)
* *
*************************************/ *************************************/
void cpu_compute_vblank_timing(void) void cpu_compute_vblank_timing(running_machine *machine)
{ {
refresh_period = attotime_make(0, Machine->screen[0].refresh); refresh_period = attotime_make(0, machine->screen[0].refresh);
/* recompute the vblank period */ /* recompute the vblank period */
vblank_period = attotime_make(0, Machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); vblank_period = attotime_make(0, machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1));
if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE)) if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE))
{ {
attotime remaining = timer_timeleft(vblank_timer); attotime remaining = timer_timeleft(vblank_timer);
@ -954,7 +954,7 @@ int cpu_getcurrentframe(void)
* *
*************************************/ *************************************/
void cpu_trigger(int trigger) void cpu_trigger(running_machine *machine, int trigger)
{ {
int cpunum; int cpunum;
@ -966,7 +966,7 @@ void cpu_trigger(int trigger)
for (cpunum = 0; cpunum < MAX_CPU; cpunum++) for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
{ {
/* if this is a dummy, stop looking */ /* if this is a dummy, stop looking */
if (Machine->drv->cpu[cpunum].type == CPU_DUMMY) if (machine->drv->cpu[cpunum].type == CPU_DUMMY)
break; break;
/* see if this is a matching trigger */ /* see if this is a matching trigger */
@ -988,7 +988,7 @@ void cpu_trigger(int trigger)
static TIMER_CALLBACK( cpu_triggertime_callback ) static TIMER_CALLBACK( cpu_triggertime_callback )
{ {
cpu_trigger(param); cpu_trigger(machine, param);
} }
@ -1005,9 +1005,9 @@ void cpu_triggertime(attotime duration, int trigger)
* *
*************************************/ *************************************/
void cpu_triggerint(int cpunum) void cpu_triggerint(running_machine *machine, int cpunum)
{ {
cpu_trigger(TRIGGER_INT + cpunum); cpu_trigger(machine, TRIGGER_INT + cpunum);
} }
@ -1143,12 +1143,12 @@ int cpu_getiloops(void)
* *
*************************************/ *************************************/
static void cpu_vblankreset(void) static void cpu_vblankreset(running_machine *machine)
{ {
int cpunum; int cpunum;
/* notify the video system of a VBLANK start */ /* notify the video system of a VBLANK start */
video_vblank_start(Machine); video_vblank_start(machine);
/* read keyboard & update the status of the input ports */ /* read keyboard & update the status of the input ports */
input_port_vblank_start(); input_port_vblank_start();
@ -1159,7 +1159,7 @@ static void cpu_vblankreset(void)
if (--watchdog_counter == 0) if (--watchdog_counter == 0)
{ {
logerror("reset caused by the (vblank) watchdog\n"); logerror("reset caused by the (vblank) watchdog\n");
mame_schedule_soft_reset(Machine); mame_schedule_soft_reset(machine);
} }
} }
@ -1167,7 +1167,7 @@ static void cpu_vblankreset(void)
for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
{ {
if (!(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE)) if (!(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE))
cpu[cpunum].iloops = Machine->drv->cpu[cpunum].vblank_interrupts_per_frame - 1; cpu[cpunum].iloops = machine->drv->cpu[cpunum].vblank_interrupts_per_frame - 1;
else else
cpu[cpunum].iloops = -1; cpu[cpunum].iloops = -1;
} }
@ -1245,13 +1245,13 @@ static TIMER_CALLBACK( cpu_vblankcallback )
{ {
/* do we update the screen now? */ /* do we update the screen now? */
if (!(machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) if (!(machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
video_frame_update(FALSE); video_frame_update(machine, FALSE);
/* Set the timer to update the screen */ /* Set the timer to update the screen */
timer_adjust(update_timer, attotime_make(0, machine->screen[0].vblank), 0, attotime_zero); timer_adjust(update_timer, attotime_make(0, machine->screen[0].vblank), 0, attotime_zero);
/* reset the globals */ /* reset the globals */
cpu_vblankreset(); cpu_vblankreset(machine);
/* reset the counter */ /* reset the counter */
vblank_countdown = vblank_multiplier; vblank_countdown = vblank_multiplier;
@ -1275,7 +1275,7 @@ static TIMER_CALLBACK( cpu_updatecallback )
{ {
/* update the screen if we didn't before */ /* update the screen if we didn't before */
if (machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) if (machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)
video_frame_update(FALSE); video_frame_update(machine, FALSE);
vblank = 0; vblank = 0;
/* update IPT_VBLANK input ports */ /* update IPT_VBLANK input ports */
@ -1318,7 +1318,7 @@ static TIMER_CALLBACK( cpu_timedintcallback )
static TIMER_CALLBACK( cpu_timeslicecallback ) static TIMER_CALLBACK( cpu_timeslicecallback )
{ {
cpu_trigger(TRIGGER_TIMESLICE); cpu_trigger(machine, TRIGGER_TIMESLICE);
} }
@ -1345,7 +1345,7 @@ static TIMER_CALLBACK( end_interleave_boost )
* *
*************************************/ *************************************/
static void compute_perfect_interleave(void) static void compute_perfect_interleave(running_machine *machine)
{ {
attoseconds_t smallest = attoseconds_per_cycle[0]; attoseconds_t smallest = attoseconds_per_cycle[0];
int cpunum; int cpunum;
@ -1353,7 +1353,7 @@ static void compute_perfect_interleave(void)
/* start with a huge time factor and find the 2nd smallest cycle time */ /* start with a huge time factor and find the 2nd smallest cycle time */
perfect_interleave = attotime_zero; perfect_interleave = attotime_zero;
perfect_interleave.attoseconds = ATTOSECONDS_PER_SECOND - 1; perfect_interleave.attoseconds = ATTOSECONDS_PER_SECOND - 1;
for (cpunum = 1; Machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++) for (cpunum = 1; machine->drv->cpu[cpunum].type != CPU_DUMMY; cpunum++)
{ {
/* find the 2nd smallest cycle interval */ /* find the 2nd smallest cycle interval */
if (attoseconds_per_cycle[cpunum] < smallest) if (attoseconds_per_cycle[cpunum] < smallest)

View File

@ -263,7 +263,7 @@ enum
void cpuexec_init(running_machine *machine); void cpuexec_init(running_machine *machine);
/* Execute for a single timeslice */ /* Execute for a single timeslice */
void cpuexec_timeslice(void); void cpuexec_timeslice(running_machine *machine);
@ -274,11 +274,11 @@ void cpuexec_timeslice(void);
*************************************/ *************************************/
/* bang on the watchdog */ /* bang on the watchdog */
void watchdog_reset(void); void watchdog_reset(running_machine *machine);
/* watchdog enabled when TRUE */ /* watchdog enabled when TRUE */
/* timer is set to reset state when going from disable to enable */ /* timer is set to reset state when going from disable to enable */
void watchdog_enable(int enable); void watchdog_enable(running_machine *machine, int enable);
@ -320,14 +320,14 @@ attotime cpunum_get_localtime(int cpunum);
int cpunum_get_clock(int cpunum); int cpunum_get_clock(int cpunum);
/* Sets the current CPU's clock speed and then adjusts for scaling */ /* Sets the current CPU's clock speed and then adjusts for scaling */
void cpunum_set_clock(int cpunum, int clock); void cpunum_set_clock(running_machine *machine, int cpunum, int clock);
void cpunum_set_clock_period(int cpunum, attoseconds_t clock_period); void cpunum_set_clock_period(running_machine *machine, int cpunum, attoseconds_t clock_period);
/* Returns the current scaling factor for a CPU's clock speed */ /* Returns the current scaling factor for a CPU's clock speed */
double cpunum_get_clockscale(int cpunum); double cpunum_get_clockscale(int cpunum);
/* Sets the current scaling factor for a CPU's clock speed */ /* Sets the current scaling factor for a CPU's clock speed */
void cpunum_set_clockscale(int cpunum, double clockscale); void cpunum_set_clockscale(running_machine *machine, int cpunum, double clockscale);
/* Temporarily boosts the interleave factor */ /* Temporarily boosts the interleave factor */
void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration); void cpu_boost_interleave(attotime timeslice_time, attotime boost_duration);
@ -371,7 +371,7 @@ int cpu_scalebyfcount(int value);
/***** These functions may eventually go away. */ /***** These functions may eventually go away. */
/* Recomputes the VBLANK timing after, e.g., a visible area change */ /* Recomputes the VBLANK timing after, e.g., a visible area change */
void cpu_compute_vblank_timing(void); void cpu_compute_vblank_timing(running_machine *machine);
/* Returns the number of the video frame we are currently playing */ /* Returns the number of the video frame we are currently playing */
int cpu_getcurrentframe(void); int cpu_getcurrentframe(void);
@ -385,13 +385,13 @@ int cpu_getcurrentframe(void);
*************************************/ *************************************/
/* generate a trigger now */ /* generate a trigger now */
void cpu_trigger(int trigger); void cpu_trigger(running_machine *machine, int trigger);
/* generate a trigger after a specific period of time */ /* generate a trigger after a specific period of time */
void cpu_triggertime(attotime duration, int trigger); void cpu_triggertime(attotime duration, int trigger);
/* generate a trigger corresponding to an interrupt on the given CPU */ /* generate a trigger corresponding to an interrupt on the given CPU */
void cpu_triggerint(int cpunum); void cpu_triggerint(running_machine *machine, int cpunum);
/* burn CPU cycles until a timer trigger */ /* burn CPU cycles until a timer trigger */
void cpu_spinuntil_trigger(int trigger); void cpu_spinuntil_trigger(int trigger);

View File

@ -250,7 +250,7 @@ static TIMER_CALLBACK( cpunum_empty_event_queue )
/* generate a trigger to unsuspend any CPUs waiting on the interrupt */ /* generate a trigger to unsuspend any CPUs waiting on the interrupt */
if (state != CLEAR_LINE) if (state != CLEAR_LINE)
cpu_triggerint(cpunum); cpu_triggerint(machine, cpunum);
} }
} }

View File

@ -528,7 +528,7 @@ void debug_halt_on_next_instruction(void)
void debug_refresh_display(void) void debug_refresh_display(void)
{ {
video_frame_update(TRUE); video_frame_update(Machine, TRUE);
} }

View File

@ -685,24 +685,24 @@ INTERRUPT_GEN( irq7_line_assert ) { irqn_line_set(cpunum, 7, ASSERT_LINE); }
8-bit reset read/write handlers 8-bit reset read/write handlers
-------------------------------------------------*/ -------------------------------------------------*/
WRITE8_HANDLER( watchdog_reset_w ) { watchdog_reset(); } WRITE8_HANDLER( watchdog_reset_w ) { watchdog_reset(Machine); }
READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(); return 0xff; } READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(Machine); return 0xff; }
/*------------------------------------------------- /*-------------------------------------------------
16-bit reset read/write handlers 16-bit reset read/write handlers
-------------------------------------------------*/ -------------------------------------------------*/
WRITE16_HANDLER( watchdog_reset16_w ) { watchdog_reset(); } WRITE16_HANDLER( watchdog_reset16_w ) { watchdog_reset(Machine); }
READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(); return 0xffff; } READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(Machine); return 0xffff; }
/*------------------------------------------------- /*-------------------------------------------------
32-bit reset read/write handlers 32-bit reset read/write handlers
-------------------------------------------------*/ -------------------------------------------------*/
WRITE32_HANDLER( watchdog_reset32_w ) { watchdog_reset(); } WRITE32_HANDLER( watchdog_reset32_w ) { watchdog_reset(Machine); }
READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(); return 0xffffffff; } READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(Machine); return 0xffffffff; }

View File

@ -365,11 +365,11 @@ int mame_execute(core_options *options)
init_machine(machine); init_machine(machine);
/* load the configuration settings and NVRAM */ /* load the configuration settings and NVRAM */
settingsloaded = config_load_settings(); settingsloaded = config_load_settings(machine);
nvram_load(); nvram_load();
/* display the startup screens */ /* display the startup screens */
ui_display_startup_screens(firstrun, !settingsloaded); ui_display_startup_screens(machine, firstrun, !settingsloaded);
firstrun = FALSE; firstrun = FALSE;
/* start resource tracking; note that soft_reset assumes it can */ /* start resource tracking; note that soft_reset assumes it can */
@ -388,11 +388,11 @@ int mame_execute(core_options *options)
/* execute CPUs if not paused */ /* execute CPUs if not paused */
if (!mame->paused) if (!mame->paused)
cpuexec_timeslice(); cpuexec_timeslice(machine);
/* otherwise, just pump video updates through */ /* otherwise, just pump video updates through */
else else
video_frame_update(FALSE); video_frame_update(machine, FALSE);
/* handle save/load */ /* handle save/load */
if (mame->saveload_schedule_callback) if (mame->saveload_schedule_callback)
@ -409,7 +409,7 @@ int mame_execute(core_options *options)
/* save the NVRAM and configuration */ /* save the NVRAM and configuration */
nvram_save(); nvram_save();
config_save_settings(); config_save_settings(machine);
} }
mame->fatal_error_jmpbuf_valid = FALSE; mame->fatal_error_jmpbuf_valid = FALSE;
@ -1552,7 +1552,7 @@ static void init_machine(running_machine *machine)
/* call the game driver's init function */ /* call the game driver's init function */
/* this is where decryption is done and memory maps are altered */ /* this is where decryption is done and memory maps are altered */
/* so this location in the init order is important */ /* so this location in the init order is important */
ui_set_startup_text("Initializing...", TRUE); ui_set_startup_text(machine, "Initializing...", TRUE);
if (machine->gamedrv->driver_init != NULL) if (machine->gamedrv->driver_init != NULL)
(*machine->gamedrv->driver_init)(machine); (*machine->gamedrv->driver_init)(machine);

View File

@ -397,7 +397,7 @@ static void display_loading_rom_message(const char *name, rom_load_data *romdata
else else
sprintf(buffer, "Loading Complete"); sprintf(buffer, "Loading Complete");
ui_set_startup_text(buffer, FALSE); ui_set_startup_text(Machine, buffer, FALSE);
} }

View File

@ -73,7 +73,7 @@ struct _slider_state
INT32 defval; /* default value */ INT32 defval; /* default value */
INT32 maxval; /* maximum value */ INT32 maxval; /* maximum value */
INT32 incval; /* increment value */ INT32 incval; /* increment value */
INT32 (*update)(INT32 newval, char *buffer, int arg); /* callback */ INT32 (*update)(running_machine *machine, INT32 newval, char *buffer, int arg); /* callback */
int arg; /* argument */ int arg; /* argument */
}; };
@ -87,7 +87,7 @@ struct _slider_state
static render_font *ui_font; static render_font *ui_font;
/* current UI handler */ /* current UI handler */
static UINT32 (*ui_handler_callback)(UINT32); static UINT32 (*ui_handler_callback)(running_machine *, UINT32);
static UINT32 ui_handler_param; static UINT32 ui_handler_param;
/* flag to track single stepping */ /* flag to track single stepping */
@ -129,35 +129,35 @@ static int sprintf_disclaimer(char *buffer);
static int sprintf_warnings(char *buffer); static int sprintf_warnings(char *buffer);
/* UI handlers */ /* UI handlers */
static UINT32 handler_messagebox(UINT32 state); static UINT32 handler_messagebox(running_machine *machine, UINT32 state);
static UINT32 handler_messagebox_ok(UINT32 state); static UINT32 handler_messagebox_ok(running_machine *machine, UINT32 state);
static UINT32 handler_messagebox_anykey(UINT32 state); static UINT32 handler_messagebox_anykey(running_machine *machine, UINT32 state);
static UINT32 handler_ingame(UINT32 state); static UINT32 handler_ingame(running_machine *machine, UINT32 state);
static UINT32 handler_slider(UINT32 state); static UINT32 handler_slider(running_machine *machine, UINT32 state);
static UINT32 handler_load_save(UINT32 state); static UINT32 handler_load_save(running_machine *machine, UINT32 state);
/* slider controls */ /* slider controls */
static void slider_init(void); static void slider_init(void);
static void slider_display(const char *text, int minval, int maxval, int defval, int curval); static void slider_display(const char *text, int minval, int maxval, int defval, int curval);
static void slider_draw_bar(float leftx, float topy, float width, float height, float percentage, float default_percentage); static void slider_draw_bar(float leftx, float topy, float width, float height, float percentage, float default_percentage);
static INT32 slider_volume(INT32 newval, char *buffer, int arg); static INT32 slider_volume(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_mixervol(INT32 newval, char *buffer, int arg); static INT32 slider_mixervol(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_adjuster(INT32 newval, char *buffer, int arg); static INT32 slider_adjuster(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_overclock(INT32 newval, char *buffer, int arg); static INT32 slider_overclock(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_refresh(INT32 newval, char *buffer, int arg); static INT32 slider_refresh(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_brightness(INT32 newval, char *buffer, int arg); static INT32 slider_brightness(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_contrast(INT32 newval, char *buffer, int arg); static INT32 slider_contrast(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_gamma(INT32 newval, char *buffer, int arg); static INT32 slider_gamma(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_xscale(INT32 newval, char *buffer, int arg); static INT32 slider_xscale(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_yscale(INT32 newval, char *buffer, int arg); static INT32 slider_yscale(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_xoffset(INT32 newval, char *buffer, int arg); static INT32 slider_xoffset(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_yoffset(INT32 newval, char *buffer, int arg); static INT32 slider_yoffset(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_flicker(INT32 newval, char *buffer, int arg); static INT32 slider_flicker(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_beam(INT32 newval, char *buffer, int arg); static INT32 slider_beam(running_machine *machine, INT32 newval, char *buffer, int arg);
static char *slider_get_screen_desc(int arg); static char *slider_get_screen_desc(int arg);
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
static INT32 slider_crossscale(INT32 newval, char *buffer, int arg); static INT32 slider_crossscale(running_machine *machine, INT32 newval, char *buffer, int arg);
static INT32 slider_crossoffset(INT32 newval, char *buffer, int arg); static INT32 slider_crossoffset(running_machine *machine, INT32 newval, char *buffer, int arg);
#endif #endif
@ -170,7 +170,7 @@ static INT32 slider_crossoffset(INT32 newval, char *buffer, int arg);
pair for the current UI handler pair for the current UI handler
-------------------------------------------------*/ -------------------------------------------------*/
INLINE UINT32 ui_set_handler(UINT32 (*callback)(UINT32), UINT32 param) INLINE UINT32 ui_set_handler(UINT32 (*callback)(running_machine *, UINT32), UINT32 param)
{ {
ui_handler_callback = callback; ui_handler_callback = callback;
ui_handler_param = param; ui_handler_param = param;
@ -182,7 +182,8 @@ INLINE UINT32 ui_set_handler(UINT32 (*callback)(UINT32), UINT32 param)
slider_config - configure a slider entry slider_config - configure a slider entry
-------------------------------------------------*/ -------------------------------------------------*/
INLINE void slider_config(slider_state *state, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, INT32 (*update)(INT32, char *, int), int arg) INLINE void slider_config(slider_state *state, INT32 minval, INT32 defval, INT32 maxval, INT32 incval,
INT32 (*update)(running_machine *, INT32, char *, int), int arg)
{ {
state->minval = minval; state->minval = minval;
state->defval = defval; state->defval = defval;
@ -304,7 +305,7 @@ static int rescale_notifier(running_machine *machine, int width, int height)
various startup screens various startup screens
-------------------------------------------------*/ -------------------------------------------------*/
int ui_display_startup_screens(int first_time, int show_disclaimer) int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer)
{ {
#ifdef MESS #ifdef MESS
const int maxstate = 4; const int maxstate = 4;
@ -363,11 +364,11 @@ int ui_display_startup_screens(int first_time, int show_disclaimer)
/* loop while we have a handler */ /* loop while we have a handler */
while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(Machine) && !ui_menu_is_force_game_select()) while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(Machine) && !ui_menu_is_force_game_select())
video_frame_update(FALSE); video_frame_update(machine, FALSE);
/* clear the handler and force an update */ /* clear the handler and force an update */
ui_set_handler(handler_ingame, 0); ui_set_handler(handler_ingame, 0);
video_frame_update(FALSE); video_frame_update(machine, FALSE);
} }
/* if we're the empty driver, force the menus on */ /* if we're the empty driver, force the menus on */
@ -383,7 +384,7 @@ int ui_display_startup_screens(int first_time, int show_disclaimer)
at startup at startup
-------------------------------------------------*/ -------------------------------------------------*/
void ui_set_startup_text(const char *text, int force) void ui_set_startup_text(running_machine *machine, const char *text, int force)
{ {
static osd_ticks_t lastupdatetime = 0; static osd_ticks_t lastupdatetime = 0;
osd_ticks_t curtime = osd_ticks(); osd_ticks_t curtime = osd_ticks();
@ -396,7 +397,7 @@ void ui_set_startup_text(const char *text, int force)
if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
{ {
lastupdatetime = curtime; lastupdatetime = curtime;
video_frame_update(FALSE); video_frame_update(machine, FALSE);
} }
} }
@ -406,7 +407,7 @@ void ui_set_startup_text(const char *text, int force)
render it; called by video.c render it; called by video.c
-------------------------------------------------*/ -------------------------------------------------*/
void ui_update_and_render(void) void ui_update_and_render(running_machine *machine)
{ {
/* always start clean */ /* always start clean */
render_container_empty(render_container_get_ui()); render_container_empty(render_container_get_ui());
@ -425,7 +426,7 @@ void ui_update_and_render(void)
/* call the current UI handler */ /* call the current UI handler */
assert(ui_handler_callback != NULL); assert(ui_handler_callback != NULL);
ui_handler_param = (*ui_handler_callback)(ui_handler_param); ui_handler_param = (*ui_handler_callback)(machine, ui_handler_param);
/* cancel takes us back to the ingame handler */ /* cancel takes us back to the ingame handler */
if (ui_handler_param == UI_HANDLER_CANCEL) if (ui_handler_param == UI_HANDLER_CANCEL)
@ -1131,7 +1132,7 @@ int sprintf_game_info(char *buffer)
messagebox_text string but handles no input messagebox_text string but handles no input
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_messagebox(UINT32 state) static UINT32 handler_messagebox(running_machine *machine, UINT32 state)
{ {
ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
return 0; return 0;
@ -1143,7 +1144,7 @@ static UINT32 handler_messagebox(UINT32 state)
messagebox_text string and waits for an OK messagebox_text string and waits for an OK
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_messagebox_ok(UINT32 state) static UINT32 handler_messagebox_ok(running_machine *machine, UINT32 state)
{ {
/* draw a standard message window */ /* draw a standard message window */
ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
@ -1173,7 +1174,7 @@ static UINT32 handler_messagebox_ok(UINT32 state)
any keypress any keypress
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_messagebox_anykey(UINT32 state) static UINT32 handler_messagebox_anykey(running_machine *machine, UINT32 state)
{ {
/* draw a standard message window */ /* draw a standard message window */
ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
@ -1198,7 +1199,7 @@ static UINT32 handler_messagebox_anykey(UINT32 state)
of the standard keypresses of the standard keypresses
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_ingame(UINT32 state) static UINT32 handler_ingame(running_machine *machine, UINT32 state)
{ {
int is_paused = mame_is_paused(Machine); int is_paused = mame_is_paused(Machine);
@ -1372,7 +1373,7 @@ static UINT32 handler_ingame(UINT32 state)
and calls the slider handler and calls the slider handler
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_slider(UINT32 state) static UINT32 handler_slider(running_machine *machine, UINT32 state)
{ {
slider_state *cur = &slider_list[slider_current]; slider_state *cur = &slider_list[slider_current];
INT32 increment = 0, newval; INT32 increment = 0, newval;
@ -1396,7 +1397,7 @@ static UINT32 handler_slider(UINT32 state)
} }
/* determine the new value */ /* determine the new value */
newval = (*cur->update)(0, NULL, cur->arg) + increment; newval = (*cur->update)(machine, 0, NULL, cur->arg) + increment;
/* select resets to the default value */ /* select resets to the default value */
if (input_ui_pressed(IPT_UI_SELECT)) if (input_ui_pressed(IPT_UI_SELECT))
@ -1409,7 +1410,7 @@ static UINT32 handler_slider(UINT32 state)
newval = cur->maxval; newval = cur->maxval;
/* update the new data and get the text */ /* update the new data and get the text */
(*cur->update)(newval, textbuf, cur->arg); (*cur->update)(machine, newval, textbuf, cur->arg);
/* display the UI */ /* display the UI */
slider_display(textbuf, cur->minval, cur->maxval, cur->defval, newval); slider_display(textbuf, cur->minval, cur->maxval, cur->defval, newval);
@ -1437,7 +1438,7 @@ static UINT32 handler_slider(UINT32 state)
specifying a game to save or load specifying a game to save or load
-------------------------------------------------*/ -------------------------------------------------*/
static UINT32 handler_load_save(UINT32 state) static UINT32 handler_load_save(running_machine *machine, UINT32 state)
{ {
char filename[20]; char filename[20];
input_code code; input_code code;
@ -1651,7 +1652,7 @@ static void slider_draw_bar(float leftx, float topy, float width, float height,
slider_volume - global volume slider callback slider_volume - global volume slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_volume(INT32 newval, char *buffer, int arg) static INT32 slider_volume(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
if (buffer != NULL) if (buffer != NULL)
{ {
@ -1667,7 +1668,7 @@ static INT32 slider_volume(INT32 newval, char *buffer, int arg)
slider callback slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_mixervol(INT32 newval, char *buffer, int arg) static INT32 slider_mixervol(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
if (buffer != NULL) if (buffer != NULL)
{ {
@ -1683,7 +1684,7 @@ static INT32 slider_mixervol(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_adjuster(INT32 newval, char *buffer, int arg) static INT32 slider_adjuster(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
input_port_entry *in = &Machine->input_ports[arg]; input_port_entry *in = &Machine->input_ports[arg];
if (buffer != NULL) if (buffer != NULL)
@ -1700,11 +1701,11 @@ static INT32 slider_adjuster(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_overclock(INT32 newval, char *buffer, int arg) static INT32 slider_overclock(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
if (buffer != NULL) if (buffer != NULL)
{ {
cpunum_set_clockscale(arg, (float)newval * 0.001f); cpunum_set_clockscale(machine, arg, (float)newval * 0.001f);
sprintf(buffer, "Overclock CPU %d %3.0f%%", arg, floor(cpunum_get_clockscale(arg) * 100.0f + 0.5f)); sprintf(buffer, "Overclock CPU %d %3.0f%%", arg, floor(cpunum_get_clockscale(arg) * 100.0f + 0.5f));
} }
return floor(cpunum_get_clockscale(arg) * 1000.0f + 0.5f); return floor(cpunum_get_clockscale(arg) * 1000.0f + 0.5f);
@ -1715,7 +1716,7 @@ static INT32 slider_overclock(INT32 newval, char *buffer, int arg)
slider_refresh - refresh rate slider callback slider_refresh - refresh rate slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_refresh(INT32 newval, char *buffer, int arg) static INT32 slider_refresh(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
double defrefresh = ATTOSECONDS_TO_HZ(Machine->drv->screen[arg].defstate.refresh); double defrefresh = ATTOSECONDS_TO_HZ(Machine->drv->screen[arg].defstate.refresh);
double refresh; double refresh;
@ -1736,7 +1737,7 @@ static INT32 slider_refresh(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_brightness(INT32 newval, char *buffer, int arg) static INT32 slider_brightness(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1753,7 +1754,7 @@ static INT32 slider_brightness(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_contrast(INT32 newval, char *buffer, int arg) static INT32 slider_contrast(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1769,7 +1770,7 @@ static INT32 slider_contrast(INT32 newval, char *buffer, int arg)
slider_gamma - screen gamma slider callback slider_gamma - screen gamma slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_gamma(INT32 newval, char *buffer, int arg) static INT32 slider_gamma(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1786,7 +1787,7 @@ static INT32 slider_gamma(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_xscale(INT32 newval, char *buffer, int arg) static INT32 slider_xscale(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1803,7 +1804,7 @@ static INT32 slider_xscale(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_yscale(INT32 newval, char *buffer, int arg) static INT32 slider_yscale(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1820,7 +1821,7 @@ static INT32 slider_yscale(INT32 newval, char *buffer, int arg)
slider callback slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_xoffset(INT32 newval, char *buffer, int arg) static INT32 slider_xoffset(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1837,7 +1838,7 @@ static INT32 slider_xoffset(INT32 newval, char *buffer, int arg)
slider callback slider callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_yoffset(INT32 newval, char *buffer, int arg) static INT32 slider_yoffset(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
render_container *container = render_container_get_screen(arg); render_container *container = render_container_get_screen(arg);
if (buffer != NULL) if (buffer != NULL)
@ -1854,7 +1855,7 @@ static INT32 slider_yoffset(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_flicker(INT32 newval, char *buffer, int arg) static INT32 slider_flicker(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
if (buffer != NULL) if (buffer != NULL)
{ {
@ -1870,7 +1871,7 @@ static INT32 slider_flicker(INT32 newval, char *buffer, int arg)
callback callback
-------------------------------------------------*/ -------------------------------------------------*/
static INT32 slider_beam(INT32 newval, char *buffer, int arg) static INT32 slider_beam(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
if (buffer != NULL) if (buffer != NULL)
{ {
@ -1911,7 +1912,7 @@ static char *slider_get_screen_desc(int arg)
-------------------------------------------------*/ -------------------------------------------------*/
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
static INT32 slider_crossscale(INT32 newval, char *buffer, int arg) static INT32 slider_crossscale(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
input_port_entry *in; input_port_entry *in;
@ -1939,7 +1940,7 @@ static INT32 slider_crossscale(INT32 newval, char *buffer, int arg)
-------------------------------------------------*/ -------------------------------------------------*/
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
static INT32 slider_crossoffset(INT32 newval, char *buffer, int arg) static INT32 slider_crossoffset(running_machine *machine, INT32 newval, char *buffer, int arg)
{ {
input_port_entry *in; input_port_entry *in;

View File

@ -86,13 +86,13 @@ enum
int ui_init(running_machine *machine); int ui_init(running_machine *machine);
/* display the startup screens */ /* display the startup screens */
int ui_display_startup_screens(int first_time, int show_disclaimer); int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer);
/* set the current text to display at startup */ /* set the current text to display at startup */
void ui_set_startup_text(const char *text, int force); void ui_set_startup_text(running_machine *machine, const char *text, int force);
/* once-per-frame update and render */ /* once-per-frame update and render */
void ui_update_and_render(void); void ui_update_and_render(running_machine *machine);
/* returns the current UI font */ /* returns the current UI font */
render_font *ui_get_font(void); render_font *ui_get_font(void);

View File

@ -149,7 +149,7 @@ static void ui_gfx_exit(running_machine *machine)
ui_gfx_ui_handler - primary UI handler ui_gfx_ui_handler - primary UI handler
-------------------------------------------------*/ -------------------------------------------------*/
UINT32 ui_gfx_ui_handler(UINT32 uistate) UINT32 ui_gfx_ui_handler(running_machine *machine, UINT32 uistate)
{ {
ui_gfx_state *state = &ui_gfx; ui_gfx_state *state = &ui_gfx;

View File

@ -25,7 +25,7 @@
void ui_gfx_init(running_machine *machine); void ui_gfx_init(running_machine *machine);
/* master handler */ /* master handler */
UINT32 ui_gfx_ui_handler(UINT32 state); UINT32 ui_gfx_ui_handler(running_machine *machine, UINT32 state);
#endif /* __UIGFX_H__ */ #endif /* __UIGFX_H__ */

View File

@ -684,7 +684,7 @@ UINT32 ui_menu_stack_pop(void)
and calls the menu handler and calls the menu handler
-------------------------------------------------*/ -------------------------------------------------*/
UINT32 ui_menu_ui_handler(UINT32 state) UINT32 ui_menu_ui_handler(running_machine *machine, UINT32 state)
{ {
UINT32 newstate; UINT32 newstate;
@ -1264,7 +1264,7 @@ static UINT32 menu_game_info(UINT32 state)
static UINT32 menu_cheat(UINT32 state) static UINT32 menu_cheat(UINT32 state)
{ {
int result = cheat_menu(state); int result = cheat_menu(Machine, state);
if (result == 0) if (result == 0)
return ui_menu_stack_pop(); return ui_menu_stack_pop();
return result; return result;

View File

@ -66,7 +66,7 @@ void ui_menu_init(running_machine *machine);
int ui_menu_draw(const ui_menu_item *items, int numitems, int selected, const menu_extra *extra); int ui_menu_draw(const ui_menu_item *items, int numitems, int selected, const menu_extra *extra);
/* master handler */ /* master handler */
UINT32 ui_menu_ui_handler(UINT32 state); UINT32 ui_menu_ui_handler(running_machine *machine, UINT32 state);
/* menu keyboard handling */ /* menu keyboard handling */
int ui_menu_generic_keys(UINT32 *selected, int num_items, int visible_items); int ui_menu_generic_keys(UINT32 *selected, int num_items, int visible_items);

View File

@ -643,7 +643,7 @@ static void decode_graphics(running_machine *machine, const gfx_decode_entry *gf
/* display some startup text */ /* display some startup text */
sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx); sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx);
ui_set_startup_text(buffer, FALSE); ui_set_startup_text(machine, buffer, FALSE);
} }
} }
@ -755,7 +755,7 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle *
} }
/* recompute the VBLANK timing */ /* recompute the VBLANK timing */
cpu_compute_vblank_timing(); cpu_compute_vblank_timing(Machine);
/* if we are on scanline 0 already, reset the update timer immediately */ /* if we are on scanline 0 already, reset the update timer immediately */
/* otherwise, defer until the next scanline 0 */ /* otherwise, defer until the next scanline 0 */
@ -1034,7 +1034,7 @@ static TIMER_CALLBACK( scanline0_callback )
operations operations
-------------------------------------------------*/ -------------------------------------------------*/
void video_frame_update(int debug) void video_frame_update(running_machine *machine, int debug)
{ {
attotime current_time = timer_get_time(); attotime current_time = timer_get_time();
int skipped_it = global.skipping_this_frame; int skipped_it = global.skipping_this_frame;
@ -1055,7 +1055,7 @@ void video_frame_update(int debug)
} }
/* draw the user interface */ /* draw the user interface */
ui_update_and_render(); ui_update_and_render(machine);
/* if we're throttling, synchronize before rendering */ /* if we're throttling, synchronize before rendering */
if (!debug && !skipped_it && effective_throttle()) if (!debug && !skipped_it && effective_throttle())

View File

@ -117,7 +117,7 @@ int video_screen_exists(int scrnum);
/* ----- global rendering ----- */ /* ----- global rendering ----- */
/* update the screen, handling frame skipping and rendering */ /* update the screen, handling frame skipping and rendering */
void video_frame_update(int debug); void video_frame_update(running_machine *machine, int debug);
/* ----- throttling/frameskipping/performance ----- */ /* ----- throttling/frameskipping/performance ----- */

View File

@ -197,7 +197,7 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem);
static void init_tmu_shared(tmu_shared_state *s); static void init_tmu_shared(tmu_shared_state *s);
static void init_tmu(voodoo_state *v, tmu_state *t, int type, voodoo_reg *reg, void *memory, int tmem); static void init_tmu(voodoo_state *v, tmu_state *t, int type, voodoo_reg *reg, void *memory, int tmem);
static void soft_reset(voodoo_state *v); static void soft_reset(voodoo_state *v);
static void check_stalled_cpu(voodoo_state *v, attotime current_time); static void check_stalled_cpu(running_machine *machine, voodoo_state *v, attotime current_time);
static void flush_fifos(voodoo_state *v, attotime current_time); static void flush_fifos(voodoo_state *v, attotime current_time);
static TIMER_CALLBACK( stall_cpu_callback ); static TIMER_CALLBACK( stall_cpu_callback );
static void stall_cpu(voodoo_state *v, int state, attotime current_time); static void stall_cpu(voodoo_state *v, int state, attotime current_time);
@ -1019,7 +1019,7 @@ static void swap_buffers(voodoo_state *v)
/* we may be able to unstall now */ /* we may be able to unstall now */
if (v->pci.stall_state != NOT_STALLED) if (v->pci.stall_state != NOT_STALLED)
check_stalled_cpu(v, timer_get_time()); check_stalled_cpu(Machine, v, timer_get_time());
/* periodically log rasterizer info */ /* periodically log rasterizer info */
v->stats.swaps++; v->stats.swaps++;
@ -2141,11 +2141,11 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da
static TIMER_CALLBACK( stall_cpu_callback ) static TIMER_CALLBACK( stall_cpu_callback )
{ {
check_stalled_cpu(ptr, timer_get_time()); check_stalled_cpu(machine, ptr, timer_get_time());
} }
static void check_stalled_cpu(voodoo_state *v, attotime current_time) static void check_stalled_cpu(running_machine *machine, voodoo_state *v, attotime current_time)
{ {
int resume = FALSE; int resume = FALSE;
@ -2188,7 +2188,7 @@ static void check_stalled_cpu(voodoo_state *v, attotime current_time)
if (v->pci.stall_callback) if (v->pci.stall_callback)
(*v->pci.stall_callback)(FALSE); (*v->pci.stall_callback)(FALSE);
else else
cpu_trigger(v->trigger); cpu_trigger(machine, v->trigger);
} }
/* if not, set a timer for the next one */ /* if not, set a timer for the next one */

View File

@ -690,7 +690,7 @@ static DRIVER_INIT( backfire )
deco56_decrypt(REGION_GFX1); /* 141 */ deco56_decrypt(REGION_GFX1); /* 141 */
deco56_decrypt(REGION_GFX2); /* 141 */ deco56_decrypt(REGION_GFX2); /* 141 */
decrypt156(); decrypt156();
cpunum_set_clockscale(0, 4.0f); /* core timings aren't accurate */ cpunum_set_clockscale(machine, 0, 4.0f); /* core timings aren't accurate */
descramble_sound(); descramble_sound();
memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x0170018, 0x017001b, 0, 0, backfire_speedup_r ); memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x0170018, 0x017001b, 0, 0, backfire_speedup_r );
} }

View File

@ -67,7 +67,7 @@ static TIMER_CALLBACK( delayed_sound_w )
{ {
main_to_sound_data = param; main_to_sound_data = param;
main_to_sound_ready = 1; main_to_sound_ready = 1;
cpu_triggerint(1); cpu_triggerint(machine, 1);
/* use a timer to make long transfers faster */ /* use a timer to make long transfers faster */
timer_set(ATTOTIME_IN_USEC(50), NULL, 0, 0); timer_set(ATTOTIME_IN_USEC(50), NULL, 0, 0);

View File

@ -731,7 +731,7 @@ static DRIVER_INIT( mlc )
/* The timing in the ARM core isn't as accurate as it should be, so bump up the /* The timing in the ARM core isn't as accurate as it should be, so bump up the
effective clock rate here to compensate otherwise we have slowdowns in effective clock rate here to compensate otherwise we have slowdowns in
Skull Fung where there probably shouldn't be. */ Skull Fung where there probably shouldn't be. */
cpunum_set_clockscale(0, 2.0f); cpunum_set_clockscale(machine, 0, 2.0f);
mainCpuIsArm=1; mainCpuIsArm=1;
decrypt156(); decrypt156();
descramble_sound(); descramble_sound();

View File

@ -30,7 +30,7 @@ static TIMER_CALLBACK( dragrace_frame_callback )
} }
/* watchdog is disabled during service mode */ /* watchdog is disabled during service mode */
watchdog_enable(readinputport(0) & 0x20); watchdog_enable(machine, readinputport(0) & 0x20);
} }

View File

@ -86,7 +86,7 @@ INTERRUPT_GEN( eolith_speedup )
if (eolith_scanline==eolith_speedup_resume_scanline) if (eolith_scanline==eolith_speedup_resume_scanline)
{ {
cpu_trigger(1000); cpu_trigger(machine, 1000);
} }
if (eolith_scanline==240) if (eolith_scanline==240)

View File

@ -39,13 +39,13 @@ static DRIVER_INIT( montecar )
} }
static void set_firetrk_service(int enable) static void set_firetrk_service(running_machine *machine, int enable)
{ {
/* watchdog is disabled during service mode */ /* watchdog is disabled during service mode */
watchdog_enable(!enable); watchdog_enable(machine, !enable);
/* change CPU clock speed according to service switch change */ /* change CPU clock speed according to service switch change */
cpunum_set_clock(0, enable ? FIRETRK_CPU_CLOCK_750KZ : FIRETRK_CPU_CLOCK_1MHZ); cpunum_set_clock(machine, 0, enable ? FIRETRK_CPU_CLOCK_750KZ : FIRETRK_CPU_CLOCK_1MHZ);
} }
@ -58,7 +58,7 @@ static INTERRUPT_GEN( firetrk_interrupt )
firetrk_service = readinputport(4) & 0x80; firetrk_service = readinputport(4) & 0x80;
if (firetrk_service != last_service) if (firetrk_service != last_service)
{ {
set_firetrk_service(firetrk_service); set_firetrk_service(machine, firetrk_service);
last_service = firetrk_service; last_service = firetrk_service;
} }
@ -71,7 +71,7 @@ static INTERRUPT_GEN( firetrk_interrupt )
firetrk_service = readinputport(6) & 0x04; firetrk_service = readinputport(6) & 0x04;
if (firetrk_service != last_service) if (firetrk_service != last_service)
{ {
set_firetrk_service(firetrk_service); set_firetrk_service(machine, firetrk_service);
last_service = firetrk_service; last_service = firetrk_service;
} }
@ -232,13 +232,13 @@ static MACHINE_RESET( firetrk )
{ {
write_output(0); write_output(0);
last_service = readinputport(6) & 0x04; last_service = readinputport(6) & 0x04;
set_firetrk_service(last_service); set_firetrk_service(machine, last_service);
} }
else else
if (GAME_IS_FIRETRUCK) if (GAME_IS_FIRETRUCK)
{ {
last_service = readinputport(4) & 0x80; last_service = readinputport(4) & 0x80;
set_firetrk_service(last_service); set_firetrk_service(machine, last_service);
} }
timer_call_after_resynch(NULL, 0, periodic_callback); timer_call_after_resynch(NULL, 0, periodic_callback);

View File

@ -185,7 +185,7 @@ static WRITE8_HANDLER( cpu0_outputs_w )
break; break;
case 0x0d: /* OUT13 */ case 0x0d: /* OUT13 */
watchdog_reset(); watchdog_reset(Machine);
break; break;
case 0x0e: /* OUT14 */ case 0x0e: /* OUT14 */

View File

@ -253,8 +253,8 @@ static UINT32 *tms1_ram, *tms2_ram;
static UINT32 *tms1_boot; static UINT32 *tms1_boot;
static UINT8 tms_spinning[2]; static UINT8 tms_spinning[2];
#define START_TMS_SPINNING(n) do { cpu_spinuntil_trigger(7351 + n); tms_spinning[n] = 1; } while (0) #define START_TMS_SPINNING(n) do { cpu_spinuntil_trigger(7351 + n); tms_spinning[n] = 1; } while (0)
#define STOP_TMS_SPINNING(n) do { cpu_trigger(7351 + n); tms_spinning[n] = 0; } while (0) #define STOP_TMS_SPINNING(machine, n) do { cpu_trigger(machine, 7351 + n); tms_spinning[n] = 0; } while (0)
@ -339,8 +339,8 @@ static MACHINE_RESET( drivedge )
cpunum_set_input_line(2, INPUT_LINE_RESET, ASSERT_LINE); cpunum_set_input_line(2, INPUT_LINE_RESET, ASSERT_LINE);
cpunum_set_input_line(3, INPUT_LINE_RESET, ASSERT_LINE); cpunum_set_input_line(3, INPUT_LINE_RESET, ASSERT_LINE);
STOP_TMS_SPINNING(0); STOP_TMS_SPINNING(machine, 0);
STOP_TMS_SPINNING(1); STOP_TMS_SPINNING(machine, 1);
} }
@ -692,12 +692,12 @@ static WRITE32_HANDLER( tms_reset_clear_w )
if ((tms1_ram[0] & 0xff000000) == 0) if ((tms1_ram[0] & 0xff000000) == 0)
{ {
cpunum_set_input_line(2, INPUT_LINE_RESET, CLEAR_LINE); cpunum_set_input_line(2, INPUT_LINE_RESET, CLEAR_LINE);
STOP_TMS_SPINNING(0); STOP_TMS_SPINNING(Machine, 0);
} }
if ((tms2_ram[0] & 0xff000000) == 0) if ((tms2_ram[0] & 0xff000000) == 0)
{ {
cpunum_set_input_line(3, INPUT_LINE_RESET, CLEAR_LINE); cpunum_set_input_line(3, INPUT_LINE_RESET, CLEAR_LINE);
STOP_TMS_SPINNING(1); STOP_TMS_SPINNING(Machine, 1);
} }
} }
@ -706,7 +706,7 @@ static WRITE32_HANDLER( tms1_68k_ram_w )
{ {
COMBINE_DATA(&tms1_ram[offset]); COMBINE_DATA(&tms1_ram[offset]);
if (offset == 0) COMBINE_DATA(tms1_boot); if (offset == 0) COMBINE_DATA(tms1_boot);
if (offset == 0x382 && tms_spinning[0]) STOP_TMS_SPINNING(0); if (offset == 0x382 && tms_spinning[0]) STOP_TMS_SPINNING(Machine, 0);
if (!tms_spinning[0]) if (!tms_spinning[0])
cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20)); cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
} }
@ -715,7 +715,7 @@ static WRITE32_HANDLER( tms1_68k_ram_w )
static WRITE32_HANDLER( tms2_68k_ram_w ) static WRITE32_HANDLER( tms2_68k_ram_w )
{ {
COMBINE_DATA(&tms2_ram[offset]); COMBINE_DATA(&tms2_ram[offset]);
if (offset == 0x382 && tms_spinning[1]) STOP_TMS_SPINNING(1); if (offset == 0x382 && tms_spinning[1]) STOP_TMS_SPINNING(Machine, 1);
if (!tms_spinning[1]) if (!tms_spinning[1])
cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20)); cpu_boost_interleave(ATTOTIME_IN_HZ(CPU020_CLOCK/256), ATTOTIME_IN_USEC(20));
} }

View File

@ -379,7 +379,7 @@ static WRITE32_HANDLER( kinst_control_w )
static TIMER_CALLBACK( end_spin ) static TIMER_CALLBACK( end_spin )
{ {
cpu_triggerint(0); cpu_triggerint(machine, 0);
} }

View File

@ -653,7 +653,7 @@ static WRITE32_HANDLER( ccu_w )
static TIMER_CALLBACK( dmaend_callback ) static TIMER_CALLBACK( dmaend_callback )
{ {
// foul-proof (CPU0 could be deactivated while we wait) // foul-proof (CPU0 could be deactivated while we wait)
if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(resume_trigger); } if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(machine, resume_trigger); }
// DMA busy flag must be cleared before triggering IRQ 3 // DMA busy flag must be cleared before triggering IRQ 3
gx_rdport1_3 &= ~2; gx_rdport1_3 &= ~2;
@ -689,7 +689,7 @@ static void dmastart_callback(int data)
static INTERRUPT_GEN(konamigx_vbinterrupt) static INTERRUPT_GEN(konamigx_vbinterrupt)
{ {
// lift idle suspension // lift idle suspension
if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(resume_trigger); } if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(machine, resume_trigger); }
// IRQ 1 is the main 60hz vblank interrupt // IRQ 1 is the main 60hz vblank interrupt
if (gx_syncen & 0x20) if (gx_syncen & 0x20)
@ -709,7 +709,7 @@ static INTERRUPT_GEN(konamigx_vbinterrupt)
static INTERRUPT_GEN(konamigx_vbinterrupt_type4) static INTERRUPT_GEN(konamigx_vbinterrupt_type4)
{ {
// lift idle suspension // lift idle suspension
if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(resume_trigger); } if (resume_trigger && suspension_active) { suspension_active = 0; cpu_trigger(machine, resume_trigger); }
// IRQ 1 is the main 60hz vblank interrupt // IRQ 1 is the main 60hz vblank interrupt
// the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board // the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board

View File

@ -4417,8 +4417,8 @@ MACHINE_RESET( megadriv )
timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero); timer_adjust(scanline_timer, attotime_zero, 0, attotime_zero);
// set_refresh_rate(megadriv_framerate); // set_refresh_rate(megadriv_framerate);
cpunum_set_clockscale(0, 0.9950f); /* Fatal Rewind is very fussy... */ cpunum_set_clockscale(machine, 0, 0.9950f); /* Fatal Rewind is very fussy... */
// cpunum_set_clockscale(0, 0.3800f); /* Fatal Rewind is very fussy... */ // cpunum_set_clockscale(machine, 0, 0.3800f); /* Fatal Rewind is very fussy... */
memset(megadrive_ram,0x00,0x10000); memset(megadrive_ram,0x00,0x10000);

View File

@ -345,9 +345,9 @@ static TIMER_CALLBACK( adjust_cpu_speed )
/* starting at scanline 224, the CPU runs at half speed */ /* starting at scanline 224, the CPU runs at half speed */
if (curv == 224) if (curv == 224)
cpunum_set_clock(0, MASTER_CLOCK/16); cpunum_set_clock(machine, 0, MASTER_CLOCK/16);
else else
cpunum_set_clock(0, MASTER_CLOCK/8); cpunum_set_clock(machine, 0, MASTER_CLOCK/8);
/* scanline for the next run */ /* scanline for the next run */
curv ^= 224; curv ^= 224;
@ -610,7 +610,7 @@ static WRITE8_HANDLER( missile_w )
/* watchdog */ /* watchdog */
else if (offset >= 0x4c00 && offset < 0x4d00) else if (offset >= 0x4c00 && offset < 0x4d00)
watchdog_reset(); watchdog_reset(Machine);
/* interrupt ack */ /* interrupt ack */
else if (offset >= 0x4d00 && offset < 0x4e00) else if (offset >= 0x4d00 && offset < 0x4e00)

View File

@ -344,7 +344,7 @@ static WRITE32_HANDLER( arm7_latch_arm_w )
#ifdef PGMARM7SPEEDHACK #ifdef PGMARM7SPEEDHACK
// cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100)); // cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
if (data!=0xaa) cpu_spinuntil_trigger(1000); if (data!=0xaa) cpu_spinuntil_trigger(1000);
cpu_trigger(1002); cpu_trigger(Machine, 1002);
#else #else
cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100)); cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(100));
cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0)); cpu_spinuntil_time(ATTOTIME_IN_CYCLES(100, 0));
@ -375,7 +375,7 @@ static WRITE16_HANDLER( arm7_latch_68k_w )
COMBINE_DATA(&arm7_latch); COMBINE_DATA(&arm7_latch);
#ifdef PGMARM7SPEEDHACK #ifdef PGMARM7SPEEDHACK
cpu_trigger(1000); cpu_trigger(Machine, 1000);
timer_set(ATTOTIME_IN_USEC(50), NULL, 0, arm_irq); // i don't know how long.. timer_set(ATTOTIME_IN_USEC(50), NULL, 0, arm_irq); // i don't know how long..
cpu_spinuntil_trigger(1002); cpu_spinuntil_trigger(1002);
#else #else

View File

@ -1376,7 +1376,7 @@ static void voodoo_stall(int stall)
/* resume CPU execution */ /* resume CPU execution */
if (LOG_DMA) logerror("Resuming CPU on voodoo\n"); if (LOG_DMA) logerror("Resuming CPU on voodoo\n");
cpu_trigger(45678); cpu_trigger(Machine, 45678);
} }
} }
} }

View File

@ -109,7 +109,7 @@ static INTERRUPT_GEN( sprint2 )
/* interrupts and watchdog are disabled during service mode */ /* interrupts and watchdog are disabled during service mode */
watchdog_enable(!service_mode()); watchdog_enable(machine, !service_mode());
if (!service_mode()) if (!service_mode())
{ {

View File

@ -115,7 +115,7 @@ static TIMER_CALLBACK( nmi_callback )
/* NMI and watchdog are disabled during service mode */ /* NMI and watchdog are disabled during service mode */
watchdog_enable(readinputport(0) & 0x40); watchdog_enable(machine, readinputport(0) & 0x40);
if (readinputport(0) & 0x40) if (readinputport(0) & 0x40)
{ {

View File

@ -533,7 +533,7 @@ static UINT8 stv_SMPC_r8 (int offset)
return return_data; return return_data;
} }
static void stv_SMPC_w8 (int offset, UINT8 data) static void stv_SMPC_w8 (running_machine *machine, int offset, UINT8 data)
{ {
mame_system_time systime; mame_system_time systime;
@ -629,7 +629,7 @@ static void stv_SMPC_w8 (int offset, UINT8 data)
if(LOG_SMPC) logerror ("SMPC: Slave OFF\n"); if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
smpc_ram[0x5f]=0x03; smpc_ram[0x5f]=0x03;
stv_enable_slave_sh2 = 0; stv_enable_slave_sh2 = 0;
cpu_trigger(1000); cpu_trigger(Machine, 1000);
cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE); cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
break; break;
case 0x06: case 0x06:
@ -654,17 +654,17 @@ static void stv_SMPC_w8 (int offset, UINT8 data)
case 0x0e: case 0x0e:
if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n"); if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n");
smpc_ram[0x5f]=0x0e; smpc_ram[0x5f]=0x0e;
cpunum_set_clock(0, MASTER_CLOCK_352/2); cpunum_set_clock(machine, 0, MASTER_CLOCK_352/2);
cpunum_set_clock(1, MASTER_CLOCK_352/2); cpunum_set_clock(machine, 1, MASTER_CLOCK_352/2);
cpunum_set_clock(2, MASTER_CLOCK_352/5); cpunum_set_clock(machine, 2, MASTER_CLOCK_352/5);
cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
break; break;
case 0x0f: case 0x0f:
if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n"); if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n");
smpc_ram[0x5f]=0x0f; smpc_ram[0x5f]=0x0f;
cpunum_set_clock(0, MASTER_CLOCK_320/2); cpunum_set_clock(machine, 0, MASTER_CLOCK_320/2);
cpunum_set_clock(1, MASTER_CLOCK_320/2); cpunum_set_clock(machine, 1, MASTER_CLOCK_320/2);
cpunum_set_clock(2, MASTER_CLOCK_320/5); cpunum_set_clock(machine, 2, MASTER_CLOCK_320/5);
cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
break; break;
/*"Interrupt Back"*/ /*"Interrupt Back"*/
@ -793,7 +793,7 @@ static WRITE32_HANDLER ( stv_SMPC_w32 )
offset += byte; offset += byte;
stv_SMPC_w8(offset,writedata); stv_SMPC_w8(Machine, offset,writedata);
} }
@ -2051,7 +2051,7 @@ static WRITE32_HANDLER( minit_w )
{ {
logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data);
cpu_boost_interleave(minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost)); cpu_boost_interleave(minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
cpu_trigger(1000); cpu_trigger(Machine, 1000);
cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
} }
@ -2722,9 +2722,9 @@ static MACHINE_RESET( stv )
NMI_reset = 1; NMI_reset = 1;
smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6); smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
cpunum_set_clock(0, MASTER_CLOCK_320/2); cpunum_set_clock(machine, 0, MASTER_CLOCK_320/2);
cpunum_set_clock(1, MASTER_CLOCK_320/2); cpunum_set_clock(machine, 1, MASTER_CLOCK_320/2);
cpunum_set_clock(2, MASTER_CLOCK_320/5); cpunum_set_clock(machine, 2, MASTER_CLOCK_320/5);
stvcd_reset(); stvcd_reset();
} }

View File

@ -463,7 +463,7 @@ static WRITE32_HANDLER(dnmtdeka_cmd_write)
if ( data != 0 ) dnmtdeka_pending_commands++; if ( data != 0 ) dnmtdeka_pending_commands++;
//logerror( "CMD: Written by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, dnmtdeka_pending_commands ); //logerror( "CMD: Written by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, dnmtdeka_pending_commands );
cpu_trigger(1000); cpu_trigger(Machine, 1000);
} }
static READ32_HANDLER(dnmtdeka_cmd_read) static READ32_HANDLER(dnmtdeka_cmd_read)
@ -513,7 +513,7 @@ static WRITE32_HANDLER(diehard_cmd_write)
if ( data != 0 ) diehard_pending_commands++; if ( data != 0 ) diehard_pending_commands++;
//logerror( "CMD: Written by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, diehard_pending_commands ); //logerror( "CMD: Written by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, diehard_pending_commands );
cpu_trigger(1000); cpu_trigger(Machine, 1000);
} }
static READ32_HANDLER(diehard_cmd_read) static READ32_HANDLER(diehard_cmd_read)
@ -537,7 +537,7 @@ static READ32_HANDLER(diehard_cmd_ack_read)
if ( (stv_workram_h[0x000e0dd8/4] & 0xff000000) == 0 && if ( (stv_workram_h[0x000e0dd8/4] & 0xff000000) == 0 &&
diehard_pending_commands == 0 ) diehard_pending_commands == 0 )
{ {
cpu_trigger(1000); cpu_trigger(Machine, 1000);
} }
return stv_workram_h[0x000e0dd8/4]; return stv_workram_h[0x000e0dd8/4];
} }
@ -556,7 +556,7 @@ static WRITE32_HANDLER(diehard_cmd_ack_write_cpu0)
{ {
//logerror( "CMDACK: Write by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, diehard_pending_commands ); //logerror( "CMDACK: Write by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, data, diehard_pending_commands );
COMBINE_DATA(&stv_workram_h[0x000e0dd8/4]); COMBINE_DATA(&stv_workram_h[0x000e0dd8/4]);
cpu_trigger(1000); cpu_trigger(Machine, 1000);
} }
DRIVER_INIT(diehard) DRIVER_INIT(diehard)

View File

@ -304,7 +304,7 @@ static UINT8 tempest_player_select;
static WRITE8_HANDLER( wdclr_w ) static WRITE8_HANDLER( wdclr_w )
{ {
cpunum_set_input_line(0, 0, CLEAR_LINE); cpunum_set_input_line(0, 0, CLEAR_LINE);
watchdog_reset(); watchdog_reset(Machine);
} }
/************************************* /*************************************

View File

@ -54,7 +54,7 @@ static TIMER_CALLBACK( nmi_callback )
/* NMI and watchdog are disabled during service mode */ /* NMI and watchdog are disabled during service mode */
watchdog_enable(readinputport(0) & 0x40); watchdog_enable(machine, readinputport(0) & 0x40);
if (readinputport(0) & 0x40) if (readinputport(0) & 0x40)
{ {

View File

@ -304,7 +304,7 @@ static TIMER_CALLBACK( dmaend_callback )
if (cur_control2 & 0x0040) if (cur_control2 & 0x0040)
{ {
// foul-proof (CPU0 could be deactivated while we wait) // foul-proof (CPU0 could be deactivated while we wait)
if (suspension_active) { suspension_active = 0; cpu_trigger(resume_trigger); } if (suspension_active) { suspension_active = 0; cpu_trigger(machine, resume_trigger); }
// IRQ 5 is the "object DMA end interrupt" and shouldn't be triggered // IRQ 5 is the "object DMA end interrupt" and shouldn't be triggered
// if object data isn't ready for DMA within the frame. // if object data isn't ready for DMA within the frame.
@ -314,7 +314,7 @@ static TIMER_CALLBACK( dmaend_callback )
static INTERRUPT_GEN( xexex_interrupt ) static INTERRUPT_GEN( xexex_interrupt )
{ {
if (suspension_active) { suspension_active = 0; cpu_trigger(resume_trigger); } if (suspension_active) { suspension_active = 0; cpu_trigger(machine, resume_trigger); }
switch (cpu_getiloops()) switch (cpu_getiloops())
{ {

View File

@ -673,7 +673,7 @@ static void cps2_decrypt(const UINT32 *master_key, UINT32 upper_limit)
{ {
char loadingMessage[256]; // for displaying with UI char loadingMessage[256]; // for displaying with UI
sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000); sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000);
ui_set_startup_text(loadingMessage,FALSE); ui_set_startup_text(Machine, loadingMessage,FALSE);
} }

View File

@ -56,7 +56,7 @@ WRITE8_HANDLER( docastle_shared0_w )
if (offset == 8) if (offset == 8)
/* awake the master CPU */ /* awake the master CPU */
cpu_trigger(500); cpu_trigger(Machine, 500);
} }

View File

@ -772,7 +772,7 @@ static TIMER_CALLBACK( stmsp_sync_update )
offs_t offset = (param >> 16) & 0xfff; offs_t offset = (param >> 16) & 0xfff;
UINT16 data = param; UINT16 data = param;
stmsp_sync[which][offset] = data; stmsp_sync[which][offset] = data;
cpu_triggerint(hdcpu_msp); cpu_triggerint(machine, hdcpu_msp);
} }
@ -872,7 +872,7 @@ WRITE16_HANDLER( hd68k_adsp_data_w )
{ {
logerror("%06X:ADSP sync address written (%04X)\n", activecpu_get_previouspc(), data); logerror("%06X:ADSP sync address written (%04X)\n", activecpu_get_previouspc(), data);
timer_call_after_resynch(NULL, 0, 0); timer_call_after_resynch(NULL, 0, 0);
cpu_triggerint(hdcpu_adsp); cpu_triggerint(Machine, hdcpu_adsp);
} }
else else
logerror("%06X:ADSP W@%04X (%04X)\n", activecpu_get_previouspc(), offset, data); logerror("%06X:ADSP W@%04X (%04X)\n", activecpu_get_previouspc(), offset, data);
@ -1264,7 +1264,7 @@ WRITE16_HANDLER( hd68k_ds3_gdata_w )
COMBINE_DATA(&ds3_g68data); COMBINE_DATA(&ds3_g68data);
ds3_g68flag = 1; ds3_g68flag = 1;
ds3_gcmd = offset & 1; ds3_gcmd = offset & 1;
cpu_triggerint(hdcpu_adsp); cpu_triggerint(Machine, hdcpu_adsp);
update_ds3_irq(); update_ds3_irq();
} }
@ -1342,7 +1342,7 @@ WRITE16_HANDLER( hdds3_special_w )
update_ds3_irq(); update_ds3_irq();
/* once we've written data, trigger the main CPU to wake up again */ /* once we've written data, trigger the main CPU to wake up again */
cpu_trigger(DS3_TRIGGER); cpu_trigger(Machine, DS3_TRIGGER);
break; break;
case 1: case 1:
@ -1797,7 +1797,7 @@ WRITE16_HANDLER( hdgsp_speedup1_w )
/* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */ /* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */
if (hdgsp_speedup_addr[0][offset] == 0xffff) if (hdgsp_speedup_addr[0][offset] == 0xffff)
cpu_triggerint(hdcpu_gsp); cpu_triggerint(Machine, hdcpu_gsp);
} }
@ -1807,7 +1807,7 @@ WRITE16_HANDLER( hdgsp_speedup2_w )
/* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */ /* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */
if (hdgsp_speedup_addr[1][offset] == 0xffff) if (hdgsp_speedup_addr[1][offset] == 0xffff)
cpu_triggerint(hdcpu_gsp); cpu_triggerint(Machine, hdcpu_gsp);
} }
@ -1840,7 +1840,7 @@ WRITE16_HANDLER( rdgsp_speedup1_w )
{ {
COMBINE_DATA(&hdgsp_speedup_addr[0][offset]); COMBINE_DATA(&hdgsp_speedup_addr[0][offset]);
if (cpu_getactivecpu() != hdcpu_gsp) if (cpu_getactivecpu() != hdcpu_gsp)
cpu_triggerint(hdcpu_gsp); cpu_triggerint(Machine, hdcpu_gsp);
} }
@ -1874,7 +1874,7 @@ WRITE16_HANDLER( hdmsp_speedup_w )
{ {
COMBINE_DATA(&hdmsp_speedup_addr[offset]); COMBINE_DATA(&hdmsp_speedup_addr[offset]);
if (offset == 0 && hdmsp_speedup_addr[offset] != 0) if (offset == 0 && hdmsp_speedup_addr[offset] != 0)
cpu_triggerint(hdcpu_msp); cpu_triggerint(Machine, hdcpu_msp);
} }

View File

@ -196,7 +196,7 @@ WRITE32_HANDLER( cgboard_dsp_shared_w_ppc )
{ {
if (cgboard_id < MAX_CG_BOARDS) if (cgboard_id < MAX_CG_BOARDS)
{ {
cpu_trigger(10000); // Remove the timeout (a part of the GTI Club FIFO test workaround) cpu_trigger(Machine, 10000); // Remove the timeout (a part of the GTI Club FIFO test workaround)
COMBINE_DATA(dsp_shared_ram[cgboard_id] + (offset + (dsp_shared_ram_bank[cgboard_id] * DSP_BANK_SIZE_WORD))); COMBINE_DATA(dsp_shared_ram[cgboard_id] + (offset + (dsp_shared_ram_bank[cgboard_id] * DSP_BANK_SIZE_WORD)));
} }
} }

View File

@ -214,7 +214,7 @@ static void sp_set_status(UINT32 status)
{ {
if (status & 0x1) if (status & 0x1)
{ {
//cpu_trigger(6789); //cpu_trigger(Machine, 6789);
cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE); cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
cpunum_set_info_int(1, CPUINFO_INT_REGISTER + RSP_SR, cpunum_get_info_int(1, CPUINFO_INT_REGISTER + RSP_SR) | RSP_STATUS_HALT); cpunum_set_info_int(1, CPUINFO_INT_REGISTER + RSP_SR, cpunum_get_info_int(1, CPUINFO_INT_REGISTER + RSP_SR) | RSP_STATUS_HALT);

View File

@ -1452,7 +1452,7 @@ WRITE8_HANDLER( snes_w_io )
case MEMSEL: /* Access cycle designation in memory (2) area */ case MEMSEL: /* Access cycle designation in memory (2) area */
/* FIXME: Need to adjust the speed only during access of banks 0x80+ /* FIXME: Need to adjust the speed only during access of banks 0x80+
* Currently we are just increasing it no matter what */ * Currently we are just increasing it no matter what */
// cpunum_set_clockscale( 0, (data & 0x1) ? 1.335820896 : 1.0 ); // cpunum_set_clockscale(Machine, 0, (data & 0x1) ? 1.335820896 : 1.0 );
#ifdef SNES_DBG_REG_W #ifdef SNES_DBG_REG_W
if( (data & 0x1) != (snes_ram[MEMSEL] & 0x1) ) if( (data & 0x1) != (snes_ram[MEMSEL] & 0x1) )
mame_printf_debug( "CPU speed: %f Mhz\n", (data & 0x1) ? 3.58 : 2.68 ); mame_printf_debug( "CPU speed: %f Mhz\n", (data & 0x1) ? 3.58 : 2.68 );

View File

@ -1142,13 +1142,13 @@ static TIMER_CALLBACK( antic_line_done )
{ {
LOG((" @cycle #%3d release WSYNC\n", cycle())); LOG((" @cycle #%3d release WSYNC\n", cycle()));
/* release the CPU if it was actually waiting for HSYNC */ /* release the CPU if it was actually waiting for HSYNC */
cpu_trigger(TRIGGER_HSYNC); cpu_trigger(machine, TRIGGER_HSYNC);
/* and turn off the 'wait for hsync' flag */ /* and turn off the 'wait for hsync' flag */
antic.w.wsync = 0; antic.w.wsync = 0;
} }
LOG((" @cycle #%3d release CPU\n", cycle())); LOG((" @cycle #%3d release CPU\n", cycle()));
/* release the CPU (held for emulating cycles stolen by ANTIC DMA) */ /* release the CPU (held for emulating cycles stolen by ANTIC DMA) */
cpu_trigger(TRIGGER_STEAL); cpu_trigger(machine, TRIGGER_STEAL);
/* refresh the display (translate color clocks to pixels) */ /* refresh the display (translate color clocks to pixels) */
antic_linerefresh(); antic_linerefresh();

View File

@ -91,7 +91,7 @@ VIDEO_UPDATE( canyon )
draw_bombs(bitmap, cliprect); draw_bombs(bitmap, cliprect);
/* watchdog is disabled during service mode */ /* watchdog is disabled during service mode */
watchdog_enable(!(readinputport(2) & 0x10)); watchdog_enable(machine, !(readinputport(2) & 0x10));
return 0; return 0;
} }