[SOLVED] Nestopia with bezel support

Status
Not open for further replies.

nosh

New member
RL Member
I was able to get bezel support working for nestopia. It removes everything from the window except a 2-3px border which can be hidden by adjusting the bezel. Here is my module for testing:

Code:
MEmu = NestopiaMEmuV =  v1.42
MURL = http://www.emucr.com/2011/09/nestopia-unofficial-v1420.html
MAuthor = djvj
MVersion = 2.0.1
MCRC = 472F9F52
iCRC = 7BA5F4F9
MID = 635038268908287546
MSystem = "Nintendo Entertainment System","Nintendo Famicom","Nintendo Famicom Disk System"
;----------------------------------------------------------------------------
; Notes:
; If using this for Nintendo Famicom Disk System, make sure you place an FDS bios in your bios subfolder for your emu. You will have to select it on first launch of any FDS game.
; Set your fullscreen key to Alt+Enter if it is not already for HyperPause support
;----------------------------------------------------------------------------
StartModule()
BezelGUI()
FadeInStart()


settingsFile := modulePath . "\" . moduleName . ".ini"
Fullscreen := IniReadCheck(settingsFile, "settings", "Fullscreen","true",,1)
ExitKey := IniReadCheck(settingsFile, "settings", "ExitKey","Esc",,1)
ToggleMenuKey := IniReadCheck(settingsFile, "settings", "ToggleMenuKey","Alt+M",,1)
force4players := IniReadCheck(settingsFile, romName, "force4players","False",,1)


BezelStart()


emuSettingsFile := emuPath . "\" . "nestopia.xml"
FileRead, nesXML, %emuSettingsFile%


IfInString, nesXML, % "<confirm-exit>yes</confirm-exit>"	; find if this setting is not the desired value
	StringReplace, nesXML, nesXML, % "<confirm-exit>yes</confirm-exit>", % "<confirm-exit>no</confirm-exit>"	; turning off confirmation on exit
IfNotInString, nesXML, % "<exit>" . ExitKey . "</exit>"	; find if this setting is not the desired value
{	currentExitKey := StrX(nesXML,"<exit>" ,0,0,"</exit>",0,0)	; trim confirm-exit to what it's current setting is
	StringReplace, nesXML, nesXML, % currentExitKey, % "<exit>" . ExitKey . "</exit>"	; replacing the current exit key to the desired one from above
}
IfNotInString, nesXML, % "<toggle-menu>" . ToggleMenuKey . "</toggle-menu>"	; find if this setting is not the desired value
{	currentMenuKey := StrX(nesXML,"<toggle-menu>" ,0,0,"</toggle-menu>",0,0)	; trim toggle-menu to what it's current setting is
	StringReplace, nesXML, nesXML, % currentMenuKey, % "<toggle-menu>" . ToggleMenuKey . "</toggle-menu>"	; replacing the current toggle-menu key to the desired one from above
}


If force4players = true
{	IfInString, nesXML, % "<auto-select-controllers>yes</auto-select-controllers>"	; find if this setting is not the desired value
		StringReplace, nesXML, nesXML, % "<auto-select-controllers>yes</auto-select-controllers>", % "<auto-select-controllers>no</auto-select-controllers>"	; replacing the current toggle-menu key to the desired one from above
	StringReplace, nesXML, nesXML, % "<port-3>unconnected</port-3>", % "<port-3>pad3</port-3>"
	StringReplace, nesXML, nesXML, % "<port-4>unconnected</port-4", % "<port-4>pad4</port-4>"
} Else
	IfInString, nesXML, % "<auto-select-controllers>no</auto-select-controllers>"	; find if this setting is not the desired value
		StringReplace, nesXML, nesXML, % "<auto-select-controllers>no</auto-select-controllers>", % "<auto-select-controllers>yes</auto-select-controllers>"	; replacing the current toggle-menu key to the desired one from above


; Enable Fullscreen
currentFS := StrX(nesXML,"<start-fullscreen>" ,0,0,"</start-fullscreen>",0,0)	; trim start-fullscreen to what it's current setting is
StringReplace, nesXML, nesXML, % currentFS, % "<start-fullscreen>" . ((If Fullscreen = "true")?"yes":"no") . "</start-fullscreen>"	; setting start-fullscreen to the desired setting from above


SaveFile()


7z(romPath, romName, romExtension, 7zExtractPath)


Run(executable . " """ . romPath . "\" . romName . romExtension . """", emuPath)


WinActivate, romName - Nestopia
WinWaitActive(romName . " - Nestopia")


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




SaveFile() {
	Global emuSettingsFile
	Global nesXML
	FileDelete, %emuSettingsFile%
	FileAppend, %nesXML%, %emuSettingsFile%, UTF-8
}


HaltEmu:
	; Send, !{Enter}
	Sleep, 200
Return
RestoreEmu:
	WinActivate, ahk_id  %emulatorID%
	; Send, !{Enter}
Return


CloseProcess:
	FadeOutStart()
	WinClose("ahk_class Nestopia")
Return
 
Last edited by a moderator:

djvj

Administrator
Staff member
Developer
Thanks nosh, you had one error, BezelStart() needs to be after the module reads the fullscreen setting, but before it does anything with it. I fixed your module above and it works good now.
 

bleasby

RocketLauncher Developer
Developer
I was able to get bezel support working for nestopia. It removes everything from the window except a 2-3px border which can be hidden by adjusting the bezel. Here is my module for testing:

One more thing, if the 2-3 px border always happens, the correct way to fixing it is to set a bezelOffset value to hide it, and not by editing the bezel image coordinates.

welcome back nosh!

Edit: Djvj, the daphne, daphne singe, winvice and winuae modules bezel support are most probably done by the changes that rfancella tested on the HyperSpin forum. I have no way to make a final test on them on the next few days, but if you can you could take a look at them and add the support for the official modules.
 
Last edited:

djvj

Administrator
Staff member
Developer
I had no border issue when I tested nestopia FYI.

Thanks bleasby, I'd rather them post it over here though like you already told them to do.
 

bleasby

RocketLauncher Developer
Developer
I had no border issue when I tested nestopia FYI.

Ok. By the post of nosh I understood that it always happened. Did you tested it with a default bezel, no? Just to make sure that it is not the bezel coordinate that is hiding anything, because if people starts to get used to this kind of small hack, things could get complicated in the future in order to tackle the correct defined bezel from the others. If the bezel offset is used instead, any bezel from any system could be instantaneously adapted for other systems.

Thanks bleasby, I'd rather them post it over here though like you already told them to do.

Yeah, I believe it is better to wait for the proper post. I just wanted to give the heads up for the case that you missed the discussion over there. But it seams that you never misses anything around here.
 

djvj

Administrator
Staff member
Developer
Most my free time away from the PC is spent on tapatalk skimming through unread posts on the forums :cool:

I tested with 3 different default bezels and all of them never showed me any part of the emu window.
 

rfancella

Super Moderator
Supporter
RL Member
Thanks bleasby, I'd rather them post it over here though like you already told them to do.

My bad. I will post changes to both forums from now on.

[EDIT]
Is there a particular thread you want them posted to, or create a new one for each?
[/EDIT]

Thanks,
Ron
 

djvj

Administrator
Staff member
Developer
Thanks rfancella, just remember that I am closing the HL forum over there very soon.

Nosh I'm on win8.1 with aero.

Sent from my SCH-I535 using Tapatalk
 

rfancella

Super Moderator
Supporter
RL Member
Thanks rfancella, just remember that I am closing the HL forum over there very soon.

Nosh I'm on win8.1 with aero.

Sent from my SCH-I535 using Tapatalk

No problem. So, I just create a new thread then? In the Module Forum?

Thanks,
Ron
 

nosh

New member
RL Member
I think adding bezel offset to the isd and module will cover all the bases. ill have to steal that from another module as i havent implemented that before.
 

rfancella

Super Moderator
Supporter
RL Member
I think adding bezel offset to the isd and module will cover all the bases. ill have to steal that from another module as i havent implemented that before.

Nosh,
If you add these lines to your ahk right before BezelStart()
Code:
bezelTopOffset := IniReadCheck(settingsFile, "Settings", "bezelTopOffset",16,,1)
bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "bezelBottomOffset",26,,1)
bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "bezelLeftOffset",7,,1)
bezelRightOffset := IniReadCheck(settingsFile, "Settings", "bezelRightOffset",7,,1)

Then add these lines to the isd file right above the </KEYS> tag
Code:
						<KEY name="bezelTopOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the top of your playing screen increase this value. If your playing screen is hidden at the top decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelBottomOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the bottom of your playing screen increase this value. If your playing screen is hidden at the bottom decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelLeftOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the left of your playing screen increase this value. If your playing screen is hidden at the left decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelRightOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the right of your playing screen increase this value. If your playing screen is hidden at the right decrease it.</DESCRIPTION>
						</KEY>

It should work fine.

Thanks,
Ron
 

Knewlife

Member
RL Member
I have used bezel with nestopia for a long time, the borders always show up for me, in w7 64bits. Just yesterday I added the bezel offset but the idea of make it editable is great.
 

nosh

New member
RL Member
Nosh,
If you add these lines to your ahk right before BezelStart()
Code:
bezelTopOffset := IniReadCheck(settingsFile, "Settings", "bezelTopOffset",16,,1)
bezelBottomOffset := IniReadCheck(settingsFile, "Settings", "bezelBottomOffset",26,,1)
bezelLeftOffset := IniReadCheck(settingsFile, "Settings", "bezelLeftOffset",7,,1)
bezelRightOffset := IniReadCheck(settingsFile, "Settings", "bezelRightOffset",7,,1)

Then add these lines to the isd file right above the </KEYS> tag
Code:
						<KEY name="bezelTopOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the top of your playing screen increase this value. If your playing screen is hidden at the top decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelBottomOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the bottom of your playing screen increase this value. If your playing screen is hidden at the bottom decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelLeftOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the left of your playing screen increase this value. If your playing screen is hidden at the left decrease it.</DESCRIPTION>
						</KEY>
						<KEY name="bezelRightOffset" required="false" nullable="false">
							<KEYTYPE>Integer</KEYTYPE>
							<DESCRIPTION>If you see part of the emulator window at the right of your playing screen increase this value. If your playing screen is hidden at the right decrease it.</DESCRIPTION>
						</KEY>

It should work fine.

Thanks,
Ron

Sweet thats easy
 
Status
Not open for further replies.
Top