A ver si con la ayuda de Empardopo creamos algo mas completo que la beta que hice para el higan.
Dejo aqui el codigo del ahk para el higan - gameboy
; Display bezel program. Taken from gdi+ ahk tutorial 3 written by tic (Tariq Porter)
; Requires Gdip.ahk either in your Lib folder as standard library or using #Include
; ahkscript.org/boards/viewtopic.php?t=6517
#SingleInstance, Force
#NoEnv
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines, -1
pname = higan v106
SetTimer, tick, 200
SplitPath, A_ScriptDir, outdir
StringLower, loutdir, outdir
fname := "GB.png" ; Change vectrex.png to whatever your file is named
#Include Gdip.ahk
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
OnExit, Exit
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
Gui, 1: Hide
hwnd1 := WinExist()
pBitmap := Gdip_CreateBitmapFromFile(fname)
If !pBitmap
{
MsgBox, 48, File loading error!, Could not load '%fname%'
ExitApp
}
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_DrawImage(G, pBitmap, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Width, Height)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, A_ScreenWidth, A_ScreenHeight)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Return
tick:
{
IfWinActive, %pname%
{
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
}
}
return
Exit:
Gdip_Shutdown(pToken)
SetTimer, tick, Off
ExitApp
Return
La idea seria adaptarlo para que nos buscase en una ubicaion determinada el ".png" diferenciando basado por ejemplo en el nombre del sistema que estemos lanzando.
Por ejemplo si lanzamos el Atari 2600 que busque en una carpeta "Atari 2600" un png llamando "bezel.png"
El codigo original que modifique esta aqui:
https://forums.launchbox-app.com/files/file/659-mame_vectrex_overlay_ahk7z/Lo pego tambien por si sirve de algo , tuve que eliminar unas cuantas lineas:
; Display bezel program. Taken from gdi+ ahk tutorial 3 written by tic (Tariq Porter)
; Requires Gdip.ahk either in your Lib folder as standard library or using #Include
; ahkscript.org/boards/viewtopic.php?t=6517
#SingleInstance, Force
#NoEnv
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines, -1
pname = MAME: Vectrex
sname = temp
SetTimer, tick, 200
SplitPath, A_ScriptDir, outdir
StringLower, loutdir, outdir
IfEqual, loutdir, %sname%
{
fname := "..\..\Overlays\Vectrex\vectrex.png" ; Change vectrex.png to whatever your file is named
}
else
{
fname := "..\Vectrex\vectrex.png" ; Change vectrex.png to whatever your file is named
}
#Include %A_ScriptDir%\..\..\Overlays\Code\Gdip.ahk
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
OnExit, Exit
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
Gui, 1: Hide
hwnd1 := WinExist()
pBitmap := Gdip_CreateBitmapFromFile(fname)
If !pBitmap
{
MsgBox, 48, File loading error!, Could not load '%fname%'
ExitApp
}
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_DrawImage(G, pBitmap, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, Width, Height)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, A_ScreenWidth, A_ScreenHeight)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Return
tick:
{
IfWinActive, %pname%
{
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
}
else
{
Gui, 1: Hide
}
}
return
Exit:
Gdip_Shutdown(pToken)
SetTimer, tick, Off
ExitApp
Return