diff --git a/emugator/ROM_Carts/B-Wings (Japan).jpg b/emugator/ROM_Carts/B-Wings (Japan).jpg new file mode 100644 index 00000000..e9fde7d7 Binary files /dev/null and b/emugator/ROM_Carts/B-Wings (Japan).jpg differ diff --git a/emugator/ROM_Carts/Balloon Fight (Japan).jpg b/emugator/ROM_Carts/Balloon Fight (Japan).jpg new file mode 100644 index 00000000..b3a3d5b3 Binary files /dev/null and b/emugator/ROM_Carts/Balloon Fight (Japan).jpg differ diff --git a/emugator/ROM_Carts/Crisis Force (Japan).jpg b/emugator/ROM_Carts/Crisis Force (Japan).jpg new file mode 100644 index 00000000..aa59c096 Binary files /dev/null and b/emugator/ROM_Carts/Crisis Force (Japan).jpg differ diff --git a/emugator/ROM_Carts/Dig Dug (Japan).jpg b/emugator/ROM_Carts/Dig Dug (Japan).jpg new file mode 100644 index 00000000..d9034629 Binary files /dev/null and b/emugator/ROM_Carts/Dig Dug (Japan).jpg differ diff --git a/emugator/ROM_Carts/Dr. Mario (Japan, USA).jpg b/emugator/ROM_Carts/Dr. Mario (Japan, USA).jpg new file mode 100644 index 00000000..7f06870f Binary files /dev/null and b/emugator/ROM_Carts/Dr. Mario (Japan, USA).jpg differ diff --git a/emugator/ROM_Carts/Final Fantasy III (Japan).jpg b/emugator/ROM_Carts/Final Fantasy III (Japan).jpg new file mode 100644 index 00000000..f5252dc7 Binary files /dev/null and b/emugator/ROM_Carts/Final Fantasy III (Japan).jpg differ diff --git a/emugator/ROM_Carts/Gradius (Japan).jpg b/emugator/ROM_Carts/Gradius (Japan).jpg new file mode 100644 index 00000000..a1f066ec Binary files /dev/null and b/emugator/ROM_Carts/Gradius (Japan).jpg differ diff --git a/emugator/ROM_Carts/Gradius II (Japan).jpg b/emugator/ROM_Carts/Gradius II (Japan).jpg new file mode 100644 index 00000000..d891fbc9 Binary files /dev/null and b/emugator/ROM_Carts/Gradius II (Japan).jpg differ diff --git a/emugator/ROM_Carts/Ice Climber (Japan).jpg b/emugator/ROM_Carts/Ice Climber (Japan).jpg new file mode 100644 index 00000000..2cf7bdee Binary files /dev/null and b/emugator/ROM_Carts/Ice Climber (Japan).jpg differ diff --git a/emugator/ROM_Carts/Pac-Man (Japan).jpg b/emugator/ROM_Carts/Pac-Man (Japan).jpg new file mode 100644 index 00000000..babf1a75 Binary files /dev/null and b/emugator/ROM_Carts/Pac-Man (Japan).jpg differ diff --git a/emugator/ROM_Carts/Super Mario Bros. 3 (Japan).jpg b/emugator/ROM_Carts/Super Mario Bros. 3 (Japan).jpg new file mode 100644 index 00000000..e5fcd3fc Binary files /dev/null and b/emugator/ROM_Carts/Super Mario Bros. 3 (Japan).jpg differ diff --git a/emugator/ROMs/B-Wings (Japan).nes b/emugator/ROMs/B-Wings (Japan).nes new file mode 100644 index 00000000..b9f40751 Binary files /dev/null and b/emugator/ROMs/B-Wings (Japan).nes differ diff --git a/emugator/ROMs/Balloon Fight (Japan).nes b/emugator/ROMs/Balloon Fight (Japan).nes new file mode 100644 index 00000000..7ccdd4b9 Binary files /dev/null and b/emugator/ROMs/Balloon Fight (Japan).nes differ diff --git a/emugator/ROMs/Crisis Force (Japan).nes b/emugator/ROMs/Crisis Force (Japan).nes new file mode 100644 index 00000000..dcced7fd Binary files /dev/null and b/emugator/ROMs/Crisis Force (Japan).nes differ diff --git a/emugator/ROMs/Dig Dug (Japan).nes b/emugator/ROMs/Dig Dug (Japan).nes new file mode 100644 index 00000000..543a404b Binary files /dev/null and b/emugator/ROMs/Dig Dug (Japan).nes differ diff --git a/emugator/ROMs/Dr. Mario (Japan, USA).nes b/emugator/ROMs/Dr. Mario (Japan, USA).nes new file mode 100644 index 00000000..f0cf8a24 Binary files /dev/null and b/emugator/ROMs/Dr. Mario (Japan, USA).nes differ diff --git a/emugator/ROMs/Final Fantasy III (Japan).nes b/emugator/ROMs/Final Fantasy III (Japan).nes new file mode 100644 index 00000000..dae28bfc Binary files /dev/null and b/emugator/ROMs/Final Fantasy III (Japan).nes differ diff --git a/emugator/ROMs/Gradius (Japan).nes b/emugator/ROMs/Gradius (Japan).nes new file mode 100644 index 00000000..a28f2f24 Binary files /dev/null and b/emugator/ROMs/Gradius (Japan).nes differ diff --git a/emugator/ROMs/Gradius II (Japan).nes b/emugator/ROMs/Gradius II (Japan).nes new file mode 100644 index 00000000..b130b4aa Binary files /dev/null and b/emugator/ROMs/Gradius II (Japan).nes differ diff --git a/emugator/ROMs/Ice Climber (Japan).nes b/emugator/ROMs/Ice Climber (Japan).nes new file mode 100644 index 00000000..9461040e Binary files /dev/null and b/emugator/ROMs/Ice Climber (Japan).nes differ diff --git a/emugator/ROMs/Pac-Man (Japan).nes b/emugator/ROMs/Pac-Man (Japan).nes new file mode 100644 index 00000000..3f783065 Binary files /dev/null and b/emugator/ROMs/Pac-Man (Japan).nes differ diff --git a/emugator/ROMs/Super Mario Bros. 3 (Japan).nes b/emugator/ROMs/Super Mario Bros. 3 (Japan).nes new file mode 100644 index 00000000..c1f26eb7 Binary files /dev/null and b/emugator/ROMs/Super Mario Bros. 3 (Japan).nes differ diff --git a/emugator/ROMs/Super Mario Brothers 2 (Japan) (Alt 1).fds b/emugator/ROMs/Super Mario Brothers 2 (Japan) (Alt 1).fds new file mode 100644 index 00000000..b848da7e Binary files /dev/null and b/emugator/ROMs/Super Mario Brothers 2 (Japan) (Alt 1).fds differ diff --git a/output/luaScripts/emugator/PNG_transparency_demonstration_1.png b/output/luaScripts/emugator/PNG_transparency_demonstration_1.png deleted file mode 100644 index 80fb9729..00000000 Binary files a/output/luaScripts/emugator/PNG_transparency_demonstration_1.png and /dev/null differ diff --git a/output/luaScripts/emugator/emugators_demo.lua b/output/luaScripts/emugator/emugators_demo.lua index 3c9291c0..663e47d4 100644 --- a/output/luaScripts/emugator/emugators_demo.lua +++ b/output/luaScripts/emugator/emugators_demo.lua @@ -1,24 +1,35 @@ +--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!! + 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 = 10 -DRAWER_OFFSET_Y = 10 +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=150, y1=50, x2=200, y2=100} +local console = {x1=150, y1=75, x2=200, y2=125} 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 = nil local wasClicked = false +local lmbWasPressed = false local FAMICOM_Roms = {} +FAMICOM_Roms[1] = {} local romDir = [[../../../emugator/ROMs/]] local romCartDir = [[../../../emugator/ROM_Carts/]] @@ -28,7 +39,13 @@ local pageNumber = 1 local pageSlot = 1 for rom in io.popen([[dir "]] ..romDir.. [[" /b]]):lines() do - local dot = string.find(rom, "%.") + 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) @@ -55,7 +72,7 @@ for rom in io.popen([[dir "]] ..romDir.. [[" /b]]):lines() do end if(srcImg == nil) then - dstImg:filledRectangle(0, 0, CART_WIDTH-1, CART_HEIGHT-1) + 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 @@ -70,6 +87,10 @@ for rom in io.popen([[dir "]] ..romDir.. [[" /b]]):lines() do end end +if(pageSlot == 1) then + pageNumber = pageNumber - 1 +end + --Main Loop while(true) do local inpt = input.read() @@ -77,17 +98,39 @@ while(true) do 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/DrjMicroMusuem.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()) + --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 selectedRom ~= nil) then emu.loadrom(romDir ..FAMICOM_Roms[currPage][selectedRom].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 == 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 == nil and lmbWasPressed) then + if(currPage < pageNumber) then + currPage = currPage + 1 + end end if(selectedRom ~= nil) then FAMICOM_Roms[currPage][selectedRom].isSelected = false selectedRom = nil end - end --Draw Cartridges @@ -118,6 +161,8 @@ while(true) do gui.rect(console.x1, console.y1, console.x2, console.y2, "blue", "white") gui.text(console.x1 + 9, console.y1 + 16, "Famicom\n/NES") + lmbWasPressed = inpt.leftclick ~= nil + emugator.yieldwithflag() -- call this if you want the script to run without emulation (game running) else gui.rect(unloadButton.x1, unloadButton.y1, unloadButton.x2, unloadButton.y2, "blue", "white") diff --git a/output/luaScripts/emugator/geometry2Dshapes.png b/output/luaScripts/emugator/geometry2Dshapes.png deleted file mode 100644 index 836e6914..00000000 Binary files a/output/luaScripts/emugator/geometry2Dshapes.png and /dev/null differ diff --git a/output/luaScripts/emugator/gui/DrjMicroMusuem.png b/output/luaScripts/emugator/gui/DrjMicroMusuem.png new file mode 100644 index 00000000..13e61324 Binary files /dev/null and b/output/luaScripts/emugator/gui/DrjMicroMusuem.png differ diff --git a/output/luaScripts/emugator/gui/arrow.png b/output/luaScripts/emugator/gui/arrow.png new file mode 100644 index 00000000..e65cbf29 Binary files /dev/null and b/output/luaScripts/emugator/gui/arrow.png differ diff --git a/output/luaScripts/emugator/gui/famicom.jpg b/output/luaScripts/emugator/gui/famicom.jpg new file mode 100644 index 00000000..af3d97f7 Binary files /dev/null and b/output/luaScripts/emugator/gui/famicom.jpg differ diff --git a/output/luaScripts/emugator/gui/famicom.png b/output/luaScripts/emugator/gui/famicom.png new file mode 100644 index 00000000..b372ef5d Binary files /dev/null and b/output/luaScripts/emugator/gui/famicom.png differ diff --git a/output/luaScripts/emugator/nesRomGeneric.png b/output/luaScripts/emugator/nesRomGeneric.png deleted file mode 100644 index 04076efd..00000000 Binary files a/output/luaScripts/emugator/nesRomGeneric.png and /dev/null differ diff --git a/output/luaScripts/emugator/out.png b/output/luaScripts/emugator/out.png new file mode 100644 index 00000000..427adc0e Binary files /dev/null and b/output/luaScripts/emugator/out.png differ diff --git a/output/luaScripts/emugator/scratch.lua b/output/luaScripts/emugator/scratch.lua index e29cbbe5..ffc2d552 100644 --- a/output/luaScripts/emugator/scratch.lua +++ b/output/luaScripts/emugator/scratch.lua @@ -2,8 +2,8 @@ local gd = require("gd") while(true) do - local im = gd.createFromJpeg("superMarioBros.jpg"):gdStr() - gui.gdoverlay(im) - + local im = gd.createFromJpeg("gui/famicom.jpg") + --gui.gdoverlay(0, 3, im:gdStr()) + gui.rect(20, 20, 256-20, 60 , "white") emugator.yieldwithflag() end \ No newline at end of file diff --git a/output/luaScripts/emugator/superMario.nes b/output/luaScripts/emugator/superMario.nes deleted file mode 100644 index 878ef21b..00000000 Binary files a/output/luaScripts/emugator/superMario.nes and /dev/null differ diff --git a/output/luaScripts/emugator/superMarioBros.jpg b/output/luaScripts/emugator/superMarioBros.jpg deleted file mode 100644 index 64786fd8..00000000 Binary files a/output/luaScripts/emugator/superMarioBros.jpg and /dev/null differ