Page 1 of 1

Overlay Image over Emulator

Posted: 10 May 2018, 05:06
by Cauptain
Hello guys,

I'm newbie with scripts and need a help.

Is it possible to run a program (emulator) and put a screen over it (Overlay / Bezel) at the same time?

The image is png transparency

The emulaodr open in fullscreen and the screen on top of it.

Below are the examples of what I say:

Emulator (Fullscreen)
https://i.imgur.com/IbzEiJ1.jpg

Emulator + Overlay
https://i.imgur.com/57rsBYK.jpg

I need any software for it?

Thanks


Claudio

Re: Overlay Image on Emulator

Posted: 10 May 2018, 09:58
by Louis Tully
I know there are bezel overlays in MAME but there's an emulator called MESS that runs just about everything and it's made by the MAME devs and it works just the same. You'll have to make your own overlays, or find some online. A search for MESS Nintendo bezel overlays turns up some good results.

Re: Overlay Image over Emulator

Posted: 13 May 2018, 05:03
by Rangerbot
I don't think AHK is the resource for this however

https://autohotkey.com/board/topic/7751 ... tresource/

Re: Overlay Image over Emulator

Posted: 24 Jul 2018, 13:03
by empardopo
Cauptain wrote:Hello guys,

I'm newbie with scripts and need a help.

Is it possible to run a program (emulator) and put a screen over it (Overlay / Bezel) at the same time?

The image is png transparency

The emulaodr open in fullscreen and the screen on top of it.

Below are the examples of what I say:

Emulator (Fullscreen)
https://i.imgur.com/IbzEiJ1.jpg

Emulator + Overlay
https://i.imgur.com/57rsBYK.jpg

I need any software for it?

Thanks


Claudio
Hi, I'm using this code

Code: Select all

; 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
but it only works fine when you run the emulator in window mode. For example, using the higan emulator works fine but using the ssf emulator (sega saturn) is impossible to me.

Greetings.

Re: Overlay Image over Emulator

Posted: 29 Jul 2018, 10:38
by YoucefHam
try this code


Code: Select all

Picture_File = 1.png
Gui_Index := 1

;~ Gui, Main: -MinimizeBox +AlwaysOnTop
Gui, Main: Add, button, w80 vAdd_Gui gAdd_Gui, Add Overlay
Gui, Main: Add, button, w80 vHide gHide, Remove
Gui, Main: Add, button, w80 vHideAll gHideAll, Hide All
Gui, Main: Add, button, w80 vResize gResize, Resize/Move Off
Gui, Main: Show, w100, Overlay
return

Add_Gui:
if Gui_Index >= 1
{
	Gui, Overlay%Gui_Index%:+LastFound
	Gui, Overlay%Gui_Index%: Margin, 0, 0
	Gui, Overlay%Gui_Index%: Add, Picture, x0 y0 w80 h-1 vPic gMoveGui, % Picture_File
	Gui, Overlay%Gui_Index%: Color, #00FF00
	Gui, Overlay%Gui_Index%:+LastFound
	winset, transcolor, #00FF00
	GuiControlGet, txt, Main:, Resize
	Gui, % "Overlay" Gui_Index ": +AlwaysOnTop -Caption -Border -Sysmenu +ToolWindow " ((txt = "Resize/Move Off") ? "" : "+Resize")
	Gui, Overlay%Gui_Index%: Show,, Overlay%Gui_Index%
	WinSet, ExStyle, % ((txt = "Resize/Move Off") ? "+0x20" : "-0x20"), Overlay%Gui_Index%
	Gui_Index += 1
}
return

HideAll:
GuiControlGet, txt, Main:, HideAll
if Gui_Index >= 2
	Loop, % Gui_Index - 1
	{
		IfInString, txt, Hide
		{
			Loop, % Gui_Index - 1
				Gui, Overlay%A_Index%: Hide
			GuiControl,Main:, HideAll, Show All
		}
		else
		{
			Loop, % Gui_Index - 1
				Gui, Overlay%A_Index%: Show
			GuiControl,Main:, HideAll, Hide All
		}
	}
return

Hide:
if Gui_Index > 0
{
	if Gui_Index > 1
		Gui_Index -= 1
	Gui, Overlay%Gui_Index%: Destroy
}
return

Resize:
GuiControlGet, txt, Main:, Resize
if Gui_Index >= 2
	Loop, % Gui_Index - 1
	{
		IfInString, txt, Off
		{
			Gui, Overlay%a_Index%: +Resize
			WinSet, ExStyle, -0x20, Overlay%A_Index%
			GuiControl,Main:, Resize, Resize/Move ON
			SetTimer, GuiReSize, 500
		}
		else
		{
			Gui, Overlay%a_Index%: -Resize
			WinSet, ExStyle, +0x20, Overlay%A_Index%
			GuiControl,, Resize, Resize/Move Off
			SetTimer, GuiReSize, Off
		}
	}
return

GuiReSize:
WinGetTitle, WinTitle, A
WinGetPos,,, W, H, % WinTitle
IfInString, WinTitle, Overlay
GuiControl, %WinTitle%: MoveDraw, Pic, % "x0 y0 w" W " h" H
return

MoveGui:
PostMessage, 0xA1, 2,,, A
Return

MainGuiClose:
ExitApp
return