|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/fceux.iml" filepath="$PROJECT_DIR$/.idea/fceux.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 125 KiB |
|
@ -1,40 +1,179 @@
|
|||
emu.print("Go Gators!")
|
||||
local cart = {x1=50, y1=50, x2=100, y2=100}
|
||||
local console = {x1=150, y1=50, x2=200, y2=100}
|
||||
local unloadButton = {x1 = 220, y1 = 220, x2 = 250, y2 = 230}
|
||||
local ejectInsertButton = {x1 = 5, y1 = 220, x2 = 64, y2 = 230}
|
||||
local switchButton = {x1 = 180, y1 = 220, x2 = 210, y2 = 230}
|
||||
local isDrag = false
|
||||
local wasClicked = false
|
||||
--local gd = require("gd")
|
||||
--TODO: Fix color pallet issue... the color pallet should be set to a known (maybe default) value for the GUI every time so it does not change depending on the previously
|
||||
--loaded game. i.e. fix the cream not white issue observed with loz2/smb setup!!
|
||||
|
||||
while(true) do
|
||||
--need gd for this
|
||||
--local gdstr = gd.createFromPng("C:\Users\Super\Emugators\fceux\output\luaScripts\emugator\nesRomGeneric.png"):gdStr()
|
||||
--gui.gdoverlay(gdstr)
|
||||
local gd = require("gd")
|
||||
|
||||
emu.print("Go Gators!")
|
||||
MAX_SCREEN_WIDTH = 256
|
||||
MAX_SCREEN_HEIGHT = 240
|
||||
MAX_PER_PAGE = 6
|
||||
CART_WIDTH = 30
|
||||
CART_HEIGHT = 30
|
||||
DRAWER_OFFSET_X = 20
|
||||
DRAWER_OFFSET_Y = 75
|
||||
DRAWER_BUFFER_X = 10
|
||||
DRAWER_BUFFER_Y = 10
|
||||
DRAWER_WIDTH = 3*DRAWER_BUFFER_X + 2*CART_WIDTH
|
||||
DRAWER_HEIGHT = 4*DRAWER_BUFFER_Y + 3*CART_HEIGHT
|
||||
PAGE_LEFT = {x = DRAWER_OFFSET_X + CART_WIDTH + DRAWER_BUFFER_X - 10, y = DRAWER_OFFSET_Y + DRAWER_HEIGHT - 4}
|
||||
PAGE_RIGHT = {x = DRAWER_OFFSET_X + CART_WIDTH + DRAWER_BUFFER_X + 16, y = DRAWER_OFFSET_Y + DRAWER_HEIGHT - 4}
|
||||
|
||||
local currPage = 1
|
||||
local cart = {x1=50, y1=50, x2=100, y2=100}
|
||||
local console = {x1=DRAWER_WIDTH + 2*DRAWER_OFFSET_X, y1=DRAWER_OFFSET_Y, x2=MAX_SCREEN_WIDTH - DRAWER_OFFSET_X, y2=DRAWER_OFFSET_Y + DRAWER_HEIGHT/2}
|
||||
local unloadButton = {x1 = 220, y1 = 220, x2 = 250, y2 = 230}
|
||||
local ejectInsertButton = {x1 = 5, y1 = 220, x2 = 64, y2 = 230}
|
||||
local switchButton = {x1 = 180, y1 = 220, x2 = 210, y2 = 230}
|
||||
local selectedRom = {selected = nil, x = 0, y = 0}
|
||||
local wasClicked = false
|
||||
local lmbWasPressed = false
|
||||
|
||||
local FAMICOM_Roms = {}
|
||||
FAMICOM_Roms[1] = {}
|
||||
local romDir = [[../../../emugator/ROMs/]]
|
||||
local romCartDir = [[../../../emugator/ROM_Carts/]]
|
||||
|
||||
--Find ROMS
|
||||
local totalRoms = 0
|
||||
local pageNumber = 1
|
||||
local pageSlot = 1
|
||||
|
||||
for rom in io.popen([[dir "]] ..romDir.. [[" /b]]):lines() do
|
||||
local dot = nil
|
||||
local dotPos = 0
|
||||
while(true) do
|
||||
dotPos = string.find(rom, "%.", dotPos + 1)
|
||||
if(dotPos == nil) then break end
|
||||
dot = dotPos
|
||||
end
|
||||
ext = nil
|
||||
if(dot ~= nil) then
|
||||
ext = string.sub(rom, dot, -1)
|
||||
end
|
||||
|
||||
if(ext == ".nes" or ext == ".fds") then
|
||||
print("found: " ..rom)
|
||||
if(FAMICOM_Roms[pageNumber] == nil) then
|
||||
FAMICOM_Roms[pageNumber] = {}
|
||||
end
|
||||
|
||||
local xpos = DRAWER_OFFSET_X + DRAWER_BUFFER_X*(math.floor(((pageSlot-1)%2)) + 1) + math.floor(((pageSlot-1)%2))*CART_WIDTH
|
||||
local ypos = DRAWER_OFFSET_Y + DRAWER_BUFFER_Y*(math.floor(((pageSlot-1)/2)) + 1) + math.floor(((pageSlot-1)/2))*CART_HEIGHT
|
||||
local name = string.sub(rom, 1, dot-1)
|
||||
local dstImg = gd.create(CART_WIDTH, CART_HEIGHT)
|
||||
local srcImg = gd.createFromJpeg(romCartDir ..name.. [[.jpg]])
|
||||
|
||||
if(srcImg == nil) then
|
||||
srcImg = gd.createFromJpeg(romCartDir ..name.. [[.jpeg]])
|
||||
end
|
||||
|
||||
if(srcImg == nil) then
|
||||
srcImg = gd.createFromPng(romCartDir ..name.. [[.png]])
|
||||
end
|
||||
|
||||
if(srcImg == nil) then
|
||||
dstImg:filledRectangle(0, 0, CART_WIDTH-1, CART_HEIGHT-1, 255)
|
||||
else
|
||||
dstImg:copyResized(srcImg, 0, 0, 0, 0, CART_WIDTH, CART_HEIGHT, srcImg:sizeX(), srcImg:sizeY())
|
||||
end
|
||||
|
||||
FAMICOM_Roms[pageNumber][pageSlot] = {rom = rom, image = dstImg, name = name, x = xpos, y = ypos, slot = pageSlot, isSelected = false}
|
||||
pageSlot = pageSlot + 1
|
||||
if(pageSlot > MAX_PER_PAGE) then
|
||||
pageSlot = 1
|
||||
pageNumber = pageNumber + 1
|
||||
end
|
||||
totalRoms = totalRoms + 1
|
||||
end
|
||||
end
|
||||
|
||||
if(pageSlot == 1) then
|
||||
pageNumber = pageNumber - 1
|
||||
end
|
||||
|
||||
--Main Loop
|
||||
while(true) do
|
||||
local inpt = input.read()
|
||||
|
||||
if(emu.emulating() == false) then
|
||||
if(emu.emulating() == false) then --should be changed to allow gui to be swaped to while emulating. maybe check if paused?
|
||||
wasClicked = false
|
||||
|
||||
--draw gui background
|
||||
gui.rect(0, 0, MAX_SCREEN_WIDTH-1, MAX_SCREEN_HEIGHT-1,"grey")
|
||||
local srcImg = gd.createFromPng("gui/DrJMicroMuseum.png"):gdStr()
|
||||
gui.gdoverlay(20, 20, srcImg)
|
||||
|
||||
gui.rect(DRAWER_OFFSET_X, DRAWER_OFFSET_Y, DRAWER_OFFSET_X + DRAWER_WIDTH, DRAWER_OFFSET_Y + DRAWER_HEIGHT + 5,"blue", "white")
|
||||
gui.text(DRAWER_OFFSET_X + CART_WIDTH + DRAWER_BUFFER_X - 3, DRAWER_OFFSET_Y + DRAWER_HEIGHT - 5, currPage.. "/" ..pageNumber, "white", "blue")
|
||||
|
||||
local leftArrow = gd.createFromPng("gui/arrow.png")
|
||||
local rightArrow = gd.create(leftArrow:sizeX(), leftArrow:sizeY())
|
||||
|
||||
rightArrow:copyRotated(leftArrow, rightArrow:sizeX()/2, rightArrow:sizeY()/2, 0, 0, leftArrow:sizeX(), leftArrow:sizeY(), 180)
|
||||
gui.gdoverlay(PAGE_RIGHT.x, PAGE_RIGHT.y, rightArrow:gdStr())
|
||||
gui.gdoverlay(PAGE_LEFT.x, PAGE_LEFT.y, leftArrow:gdStr())
|
||||
|
||||
--Draw console
|
||||
--gui.rect(console.x1, console.y1, console.x2, console.y2, "blue", "white")
|
||||
--gui.text(console.x1 + 9, console.y1 + 16, "Famicom\n/NES")
|
||||
local im = gd.createFromPng("gui/famicom.png")
|
||||
gui.rect(console.x1 + 10, console.y1 + 30, console.x1 + 10 + im:sizeX(), console.y1 + 30 + im:sizeY(), "grey", "white")
|
||||
gui.gdoverlay(console.x1 + 10, console.y1 + 30, im:gdStr()) --doesnt actually line up quite right with hitbox, needs to be adjusted when image is finalized
|
||||
|
||||
--Load Cartridge if dropped on Console
|
||||
if (inpt.leftclick == nil) then
|
||||
if ((inpt.xmouse > console.x1) and (inpt.xmouse < console.x2) and (inpt.ymouse > console.y1) and (inpt.ymouse < console.y2) and isDrag) then
|
||||
emu.loadrom("LegendOfZelda2_JP.fds")
|
||||
if((inpt.xmouse > console.x1) and (inpt.xmouse < console.x2) and (inpt.ymouse > console.y1) and (inpt.ymouse < console.y2) and selectedRom.selected ~= nil) then
|
||||
emu.loadrom(romDir ..FAMICOM_Roms[currPage][selectedRom.selected].rom)
|
||||
elseif((inpt.xmouse > PAGE_LEFT.x) and (inpt.xmouse < PAGE_LEFT.x + leftArrow:sizeX()) and (inpt.ymouse > PAGE_LEFT.y) and (inpt.ymouse < PAGE_LEFT.y + leftArrow:sizeY()) and selectedRom.selected == nil and lmbWasPressed) then
|
||||
if(currPage > 1) then
|
||||
currPage = currPage - 1
|
||||
end
|
||||
elseif((inpt.xmouse > PAGE_RIGHT.x) and (inpt.xmouse < PAGE_RIGHT.x + rightArrow:sizeX()) and (inpt.ymouse > PAGE_RIGHT.y) and (inpt.ymouse < PAGE_RIGHT.y + rightArrow:sizeY()) and selectedRom.selected == nil and lmbWasPressed) then
|
||||
if(currPage < pageNumber) then
|
||||
currPage = currPage + 1
|
||||
end
|
||||
end
|
||||
|
||||
if(selectedRom.selected ~= nil) then
|
||||
FAMICOM_Roms[currPage][selectedRom.selected].isSelected = false
|
||||
selectedRom.selected = nil
|
||||
end
|
||||
isDrag = false
|
||||
end
|
||||
|
||||
if isDrag then
|
||||
gui.rect(inpt.xmouse, inpt.ymouse, inpt.xmouse+50, inpt.ymouse+50, "red", "white")
|
||||
gui.text(inpt.xmouse + 12, inpt.ymouse+12, "Legend\nOf\nZelda\n2")
|
||||
elseif ((inpt.xmouse > cart.x1) and (inpt.xmouse < cart.x2) and (inpt.ymouse > cart.y1) and (inpt.ymouse < cart.y2) and inpt.leftclick) then
|
||||
isDrag = true
|
||||
--Draw Cartridges
|
||||
for _, rom in pairs(FAMICOM_Roms[currPage]) do
|
||||
if(rom.isSelected == false) then
|
||||
local gdstr = rom.image:gdStr()
|
||||
gui.gdoverlay(rom.x, rom.y, gdstr)
|
||||
end
|
||||
end
|
||||
|
||||
if (selectedRom.selected == nil) then
|
||||
local index = 0
|
||||
for _, rom in pairs(FAMICOM_Roms[currPage]) do
|
||||
if ((inpt.xmouse > rom.x) and (inpt.xmouse < (rom.x+CART_WIDTH)) and (inpt.ymouse > rom.y) and (inpt.ymouse < (rom.y+CART_HEIGHT))) then
|
||||
gui.text(inpt.xmouse, inpt.ymouse, rom.name)
|
||||
if(inpt.leftclick and lmbWasPressed == false) then
|
||||
selectedRom.selected = rom.slot
|
||||
selectedRom.x = inpt.xmouse
|
||||
selectedRom.y = inpt.ymouse
|
||||
rom.isSelected = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
gui.rect(cart.x1, cart.y1, cart.x2, cart.y2, "gray", "white")
|
||||
gui.text(cart.x1 + 12, cart.y1 + 12, "Legend\nof\nZelda\n2")
|
||||
--gui.rect(inpt.xmouse, inpt.ymouse, inpt.xmouse+50, inpt.ymouse+50, "red", "white")
|
||||
--gui.text(inpt.xmouse + 12, inpt.ymouse+12, "Legend\nOf\nZelda\nII")
|
||||
local gdstr = FAMICOM_Roms[currPage][selectedRom.selected].image:gdStr()
|
||||
gui.gdoverlay(inpt.xmouse + (FAMICOM_Roms[currPage][selectedRom.selected].x - selectedRom.x), inpt.ymouse + (FAMICOM_Roms[currPage][selectedRom.selected].y - selectedRom.y), gdstr)
|
||||
end
|
||||
|
||||
gui.rect(console.x1, console.y1, console.x2, console.y2, "blue", "white")
|
||||
gui.text(console.x1 + 9, console.y1 + 16, "Famicom\n/NES")
|
||||
if(selectedRom.selected ~= nil) then
|
||||
gui.text(inpt.xmouse, inpt.ymouse, FAMICOM_Roms[currPage][selectedRom.selected].name)
|
||||
end
|
||||
|
||||
lmbWasPressed = inpt.leftclick ~= nil
|
||||
|
||||
emugator.yieldwithflag() -- call this if you want the script to run without emulation (game running)
|
||||
else
|
||||
|
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 94 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 256 B |
|
@ -0,0 +1,8 @@
|
|||
local gd = require("gd")
|
||||
|
||||
while(true) do
|
||||
|
||||
local im = gd.createFromPng("gui/famicom.png")
|
||||
gui.gdoverlay(0, 3, im:gdStr())
|
||||
emugator.yieldwithflag()
|
||||
end
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32825.248
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fceux", "vc14_fceux.vcxproj", "{6893EF44-FEA3-46DF-B236-C4C200F54294}"
|
||||
EndProject
|
||||
Global
|
||||
|
@ -15,8 +17,8 @@ Global
|
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|x64.Build.0 = Debug|x64
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.Debug|x64.Build.0 = Debug|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.PublicRelease|Win32.ActiveCfg = PublicRelease|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.PublicRelease|Win32.Build.0 = PublicRelease|Win32
|
||||
{6893EF44-FEA3-46DF-B236-C4C200F54294}.PublicRelease|x64.ActiveCfg = PublicRelease|x64
|
||||
|
@ -29,4 +31,7 @@ Global
|
|||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {88B51FA7-225E-47B0-AE28-52E983BCFC27}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|