Help with 3DO Phoenix 2.8

manifestx

New member
RL Member
Good evening,

I'm working on a module, and IT IS working... just the code seems lengthy and I'm sure I'm doing things the wrong way!
Anyways, I decided to pick up the latest Phoenix (v2.8: http://www.arts-union.ru/node/23) because all the games ran smoothly and without a/v sync problems.

From how I understand the emulator works, is the "phoenix.config.xml" gets updated with any games that have been dumped that goes in the collection (the xml includes path, size, fast-md5, and md5 for each title added). To get a game to load, you must change the xml to the parent dump tag (CD-ROM), and include the whole rom path in the attach attribute (and this is optional=just the romPath in the last-path attribute.

Extensions supported: .iso, .img, .cdi, .bin, .nrg, .binar

I have also attached the "phoenix.config.xml" file and the "translation.xml" in English that I made with Google, and then just made it make sense, which changes the language for the emulator. The "phoenix.config.xml" file has about 200+ games pre-done, just have to global replace the starting directory; I have the game files unzipped.

Here is my module if anyone can give tips etc. on cleaning up the code and overall making it work better:

Code:
MEmu := "Phoenix"
MEmuV := "v2.8"
MURL := ["http://www.arts-union.ru/node/23"]
MAuthor := ["djvj"]
MVersion := "2.0.4"
MCRC := "51C61D0E"
iCRC := "109E182B"
MID := "635038268914342592"
MSystem := ["Panasonic 3DO"]
;----------------------------------------------------------------------------
; Notes:
; This emu only supports iso images
; Set SelectGameMode if you have any problems with the emu opening the game
; If your bios file is called fz10_rom.bin, rename it to fz10.rom, it should be placed in the same dir as the emu exe.
; On first launch, Phoenix will ask you to point it to the fz10.rom. After you do that, exit the emu and select a game in your Front End and it should work.
; If you do not have an English windows, set the language you use for the MLanguage setting in RocketLauncherUI. Currently only Spanish/Portuguese is supported.
;
; Phoenix stores its config in the registry @ HKEY_CURRENT_USER\Software\FreeDO\FreeDO Emulator
;----------------------------------------------------------------------------
StartModule()
BezelGUI()
FadeInStart()

settingsFile := modulePath . "\" . moduleName . ".ini"
Fullscreen := moduleIni.Read("Settings", "Fullscreen","true",,1)
ControlDelay := IniReadCheck(settingsFile, "Settings", "ControlDelay","20",,1) ; raise this if the module is getting stuck somewhere
KeyDelay := IniReadCheck(settingsFile, "Settings", "KeyDelay","-1",,1) ; raise this if the module is getting stuck using SelectGameMode 2

dialogOpen := i18n("dialog.open")	; Looking up local translation

ExitKey := moduleIni.Read("Settings", "ExitKey","Esc",,1)

If bezelEnabled
	BezelStart(If Fullscreen = "true" ? "" : "fixResMode")

;hideEmuObj := Object(dialogOpen . " ahk_class #32770",0,"Phoenix ahk_class Qt5QWindowIcon",1)	; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
7z(romPath, romName, romExtension, 7zExtractPath)

SetControlDelay, %ControlDelay%
SetKeyDelay(KeyDelay)

If romExtension in .7z,.rar,.zip
	ScriptError("Pheonix does not support archived or cue files. Only ""iso"", ""img"", and ""bin"" files can be loaded. Either enable 7z support, or extract your games first.")

HideEmuStart()	; This fully ensures windows are completely hidden even faster than winwait

; Your XML file to be altered in a variable
FileRead, xml, %emuPath%\phoenix.config.xml
romPath2 = %romPath%/%romName%%romExtension%
romPath3 = %romPath%
StringReplace, romPath2, romPath2, \, /, UseErrorLevel
StringReplace, romPath3, romPath3, \, /, UseErrorLevel

; The regex to search for. 1 to 100 digits followed by a period and 1 to 100 more digits
ToReplace = 
(
<CD-ROM expanded="true" attach="(.*?)" last-path="(.*?)">
)

; What to replace those digits with which would be your number that was given.
Replacement = 
(
<CD-ROM expanded="true" attach="%romPath2%" last-path="%romPath3%">
)

; Make it possible to parse through by replacing the string we are looking for with an unusual character. In this case ®
StringReplace, NewDelimiter, xml, <Platform-3DO>, ®<Platform-3DO>

Loop, Parse, NewDelimiter, ®
{
	If (A_Index = 2)				;Determine which variable we are working with and give it the contents for that piece
	{
		xSens = %A_LoopField%
	}
}

Loop, Parse, xSens, `n, `r ; Replace the X variable
{
NewLine := RegExReplace(A_LoopField, ToReplace, Replacement)
	If (A_Index = 1)
	{
		NewxSens = %NewLine%
	}
	else
	{
		NewxSens = %NewxSens%`n%NewLine%
	}
}

xml =
(
<?xml version="1.0" encoding="utf-8"?>
<root Platform="3DO">
    <Settings current="0">
        <Global>
%NewxSens%'
)

FileDelete, %emuPath%\phoenix.config.xml
FileAppend, %xml%, %emuPath%\phoenix.config.xml

Run(executable, emuPath)
DetectHiddenWindows, on

WinWait("ahk_class Qt5QWindowIcon")
WinWaitActive("ahk_class Qt5QWindowIcon")
;WinMenuSelectItem, ahk_class Qt5QWindowPopupDropShadow,, 2&, 1&

Send, {Alt}{Right}{Enter}{Enter} ; power on roms

If Fullscreen = true
	Send, {F11} ; fullscreen

Sleep, 1000

BezelDraw()
HideEmuEnd()
FadeInExit()
Process("WaitClose", executable)
7zCleanUp()
BezelExit()
FadeOutExit()
ExitModule()

Esc:: Send, !{F4}

RestoreEmu:
	Send, !{Enter}
Return

CloseProcess:
	FadeOutStart()
	WinClose("ahk_class Qt5QWindowIcon")	; Removing Phoenix from the title because the emulator shows statistics in the title while a game is playing
Return


Regards,

and thank you!
 

Attachments

  • phoenix.config.zip
    21.1 KB · Views: 1,249
  • translation.zip
    7.1 KB · Views: 1,936

brolly

Administrator
Developer
Looks like a good start, but I think all that regex code can be greatly simplified, see if this works:
Code:
MEmu := "Phoenix"
MEmuV := "v2.8"
MURL := ["http://www.arts-union.ru/node/23"]
MAuthor := ["djvj"," manifestx"]
MVersion := "2.0.4"
MCRC := "51C61D0E"
iCRC := "109E182B"
MID := "635038268914342592"
MSystem := ["Panasonic 3DO"]
;----------------------------------------------------------------------------
; Notes:
; This emu only supports iso images
; Set SelectGameMode if you have any problems with the emu opening the game
; If your bios file is called fz10_rom.bin, rename it to fz10.rom, it should be placed in the same dir as the emu exe.
; On first launch, Phoenix will ask you to point it to the fz10.rom. After you do that, exit the emu and select a game in your Front End and it should work.
; If you do not have an English windows, set the language you use for the MLanguage setting in RocketLauncherUI. Currently only Spanish/Portuguese is supported.
;
; Phoenix stores its config in the registry @ HKEY_CURRENT_USER\Software\FreeDO\FreeDO Emulator
;----------------------------------------------------------------------------
StartModule()
BezelGUI()
FadeInStart()

Fullscreen := moduleIni.Read("Settings", "Fullscreen","true",,1)
ControlDelay := moduleIni.Read("Settings", "ControlDelay","20",,1) ; raise this if the module is getting stuck somewhere
KeyDelay := moduleIni.Read("Settings", "KeyDelay","-1",,1) ; raise this if the module is getting stuck

dialogOpen := i18n("dialog.open")	; Looking up local translation

If bezelEnabled
	BezelStart(If Fullscreen = "true" ? "" : "fixResMode")

;hideEmuObj := Object(dialogOpen . " ahk_class #32770",0,"Phoenix ahk_class Qt5QWindowIcon",1)	; Hide_Emu will hide these windows. 0 = will never unhide, 1 = will unhide later
7z(romPath, romName, romExtension, 7zExtractPath)

SetControlDelay, %ControlDelay%
SetKeyDelay(KeyDelay)

If romExtension in .7z,.rar,.zip
	ScriptError("Pheonix does not support archived or cue files. Only ""iso"", ""img"", and ""bin"" files can be loaded. Either enable 7z support, or extract your games first.")

HideEmuStart()	; This fully ensures windows are completely hidden even faster than winwait

; Your XML file to be altered in a variable
FileRead, xml, %emuPath%\phoenix.config.xml
romPath2 = %romPath%/%romName%%romExtension%
romPath3 = %romPath%
StringReplace, romPath2, romPath2, \, /, UseErrorLevel
StringReplace, romPath3, romPath3, \, /, UseErrorLevel

If (!StringUtils.Contains(xml,"</CD-ROM>")) {
	ScriptError("You don't have any games stored in phoenix.config.xml")
}

; Use regex to setup the game to load
ToReplace = 
(
<CD-ROM [^>]*
)
Replacement = 
(
<CD-ROM expanded="true" attach="%romPath2%" last-path="%romPath3%"
)
xml := StringUtils.RegExReplace(xml,ToReplace,Replacement)

FileDelete, %emuPath%\phoenix.config.xml
FileAppend, %xml%, %emuPath%\phoenix.config.xml

Run(executable, emuPath)
DetectHiddenWindows, on

WinWait("ahk_class Qt5QWindowIcon")
WinWaitActive("ahk_class Qt5QWindowIcon")
;WinMenuSelectItem, ahk_class Qt5QWindowPopupDropShadow,, 2&, 1&

Send, {Alt}{Right}{Enter}{Enter} ; power on roms

If Fullscreen = true
	Send, {F11} ; fullscreen

Sleep, 1000

BezelDraw()
HideEmuEnd()
FadeInExit()
Process("WaitClose", executable)
7zCleanUp()
BezelExit()
FadeOutExit()
ExitModule()

CloseProcess:
	FadeOutStart()
	WinClose("ahk_class Qt5QWindowIcon")	; Removing Phoenix from the title because the emulator shows statistics in the title while a game is playing
Return

Code will needs some cleanup and to be modernized to the new standards, but seems ok otherwise.
I also removed some code like the RestoreEmu label and the Esc remapping that I think are leftovers from the old module you used as a base, didn't really have time to look into much detail though.
 

manifestx

New member
RL Member
Thanks brolly! That is much simpler and works like a charm!

I am trying to tackle a workaround from calling Alt, Right, Right, then Enter to run the roms.

I've tried doing the following:

Code:
WinMenuSelectItem, ahk_class Qt5QWindowIcon,, 2&, 1&
and
Code:
WinMenuSelectItem, ahk_class Qt5QWindowPopupDropShadowSaveBits,, 2&, 1&

However, I don't think Phoenix has a "menu", and so that's throwing me off.

Is there another way to do it? I've tried searching the net for hours and haven't found any.
 

brolly

Administrator
Developer
Yes that part bothers me a bit as well since it's prone to cause issues, don't know why the emulator doesn't provide a hotkey for the boot command and yet offers it for several others that are less important.

WinMenuSelectItem will only work on standard menu bars which doesn't seem to be the case with Phoenix it also doesn't make use of PostCommands (which would be the best solution) so that's probably the only way to get it done. A hotkey would be cleaner, but we can only use the tools we have at our disposal. Anyway I sent the developer a message to see if he could at least add a hotkey for this.
 

manifestx

New member
RL Member
I also sent a message regarding a hotkey also earlier in the day also.

Let's just hope it will get done.
 

manifestx

New member
RL Member
He just emailed me saying that in the next release, the developer will add a hotkey for the power on for roms.

I'll release a new version of my module once he releases it so it's up-to-date.
 

brolly

Administrator
Developer
Yeah he emailed me as well, hopefully the next version will be around the corner. Won't be a perfect solution, but will surely work better than the current one.
 
Top