Arcadespain

Software => Otros programas => Mensaje iniciado por: machiminax en Julio 23, 2018, 02:37:22 pm

Título: Lanzador de bezels ahk
Publicado por: machiminax en Julio 23, 2018, 02:37:22 pm
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

Código: [Seleccionar]
; 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:

Código: [Seleccionar]
; 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

Título: Re:Lanzador de bezels ahk
Publicado por: empardopo en Julio 23, 2018, 04:09:13 pm
Me voy a descargar el emulador higan que me has pasado con el jueguecillo; voy a probar que funciona.
Luego voy a integrarlo con AM tal y como pusiste en el otro post, ok? Y cuando más o menos me funcione empiezo con el código que has puesto y ya me vas explicando paso a paso más o menos lo que necesitamos para hacerlo funcionar con otros emuladores.

Muchas veces se ocurren ideas para solucionar un problema que pudieran ser más complicadas que otras, jeje.

El programa que queremos hacer, qué necesita exactamente para funcionar?
Título: Re:Lanzador de bezels ahk
Publicado por: empardopo en Julio 23, 2018, 05:17:27 pm
Por cierto, otro emulador que necesitase de bezels? Please, si me pasas otro con una rom y el bezel correspondiente hago pruebas ...

Thanks
Título: Re:Lanzador de bezels ahk
Publicado por: machiminax en Julio 23, 2018, 07:58:14 pm
Estuve probando el ssf pero se me queda por encima del bezel.
Título: Re:Lanzador de bezels ahk
Publicado por: empardopo en Julio 24, 2018, 05:48:18 pm
Estuve probando el ssf pero se me queda por encima del bezel.


Uff, a mi igual. De momento no tengo narices de que funcione el SSF. El higan sí que he conseguido que me funcione ...

Con el RocketLauncher funciona entonces bien el tema del bezel?