these are changes i accidently made on master

This commit is contained in:
StevenPhang22 2022-12-30 15:56:57 -05:00
parent 655aaaf963
commit 3490e6dcfa
18 changed files with 158 additions and 27 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

8
.idea/fceux.iml Normal file
View File

@ -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>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -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>

8
.idea/modules.xml Normal file
View File

@ -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>

6
.idea/vcs.xml Normal file
View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

View File

@ -1,38 +1,120 @@
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")
local gd = require("gd")
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)
emu.print("Go Gators!")
MAX_PER_PAGE = 6
CART_WIDTH = 30
CART_HEIGHT = 30
DRAWER_OFFSET_X = 10
DRAWER_OFFSET_Y = 10
DRAWER_BUFFER_X = 10
DRAWER_BUFFER_Y = 10
local currPage = 1
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 selectedRom = nil
local wasClicked = false
local FAMICOM_Roms = {}
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 = string.find(rom, "%.")
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)
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
--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
--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 ~= nil) then
emu.loadrom(romDir ..FAMICOM_Roms[currPage][selectedRom].rom)
end
isDrag = false
if(selectedRom ~= nil) then
FAMICOM_Roms[currPage][selectedRom].isSelected = false
selectedRom = nil
end
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")
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 == 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)) and inpt.leftclick) then
selectedRom = rom.slot
rom.isSelected = true
break
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].image:gdStr()
gui.gdoverlay(inpt.xmouse, inpt.ymouse, gdstr)
end
--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")

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,9 @@
local gd = require("gd")
while(true) do
local im = gd.createFromJpeg("superMarioBros.jpg"):gdStr()
gui.gdoverlay(im)
emugator.yieldwithflag()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -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