Compare commits

..

No commits in common. "master" and "v1.0" have entirely different histories.
master ... v1.0

19 changed files with 283 additions and 942 deletions

View File

@ -1,49 +0,0 @@
-- Add center in case there's no existing center function
local function center(y,str)
local w,h = term.getSize()
local x = (w/2)-(#str/2)
term.setCursorPos(x,y)
print(str)
end
local modem = peripheral.find("modem")
local openModem = false
for k,v in pairs({"right", "left", "top", "bottom", "front", "back"}) do
if peripheral.getType(v) == "modem" then
rednet.open(v)
local openModem = true
end
local function renderNetCentre()
term.setBackgroundColour(colours.green)
term.setTextColour(colours.white)
center(8, " Network Centre ")
term.setBackgroundColour(colours.white)
term.setTextColour(colours.green)
center(9, " Profile ")
center(10, " Power Off ")
center(11, " Disconnect ")
end
while true do
renderNetCentre()
local evt, button, x, y = os.pullEvent("mouse_click")
if y == 9 then
shell.run("/dnas/profile")
elseif y == 10 then
term.clear()
center(8,"Shutting Down...")
sleep(1)
os.shutdown()
elseif y == 11 then
modem.open(30000)
modem.transmit(30000, 30000, {sType = "disconnect"})
error("Disconnected")
end
end
end

View File

@ -1,108 +0,0 @@
os.loadAPI("/GS2/APIs/gs")
-- It is assumed this is running on a GS2 or GS2 devkit
local function topmenu()
gs.clrBg("blue")
gs.setBg("white")
gs.setTxt("blue")
gs.clrLine(2)
gs.clrLine(3)
gs.clrLine(4)
gs.center(3,"DNAS Utility")
end
topmenu()
-- Welcome section
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.clrLine(10)
gs.clrLine(11)
gs.center(8,"Welcome to the DNAS Utility!")
gs.center(9,"Here, we will test your connection and attempt")
gs.center(10,"to connect to the DNAS servers.")
ee.sleep(1.75)
-- Modem check
if not peripheral.find("modem") then
topmenu()
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.center(8,"There is no modem attached!")
gs.center(9,"Please attach a modem, then retry.")
ee.sleep(2)
error("No modem attached")
elseif peripheral.find("modem") then
-- work as normal
topmenu()
gs.line(7)
gs.line(8)
gs.line(9)
gs.line(10)
gs.center(8,"Attempting Connection...")
ee.sleep(1)
local modem = peripheral.find("modem")
modem.open(661)
modem.transmit(661, 661, {sType = "status"})
local t = ee.startTimer(3)
while true do
local e = {os.pullEvent()}
if e[1] == "modem_message" then
if e[3] == 661 then
if type(e[5]) == "table" then
if e[5].sType then
if e[5].sType == "status" then
if e[5].sContents == "Offline" then
topmenu()
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.clrLine(10)
gs.center(8,"Connection Failed:")
gs.center(9,"The DNAS servers are currently offline.")
ee.sleep(3)
--ee.shRun("/GS2/Browser")
elseif e[5].sContents == "Shutdown" then
topmenu()
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.clrLine(10)
gs.center(8,"Connection Failed:")
gs.center(9,"DNAS has been terminated.")
ee.sleep(3)
--ee.shRun("/GS2/Browser")
elseif e[5].sContents == "Online" then
topmenu()
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.clrLine(10)
gs.center(8,"Connection Successful!")
gs.center(9,"DNAS systems online.")
ee.sleep(3)
--ee.shRun("/GS2/Browser")
end
end
end
end
end
elseif e[1] == "timer" then topmenu()
gs.clrLine(7)
gs.clrLine(8)
gs.clrLine(9)
gs.clrLine(10)
gs.center(8,"Connection Failed:")
gs.center(9,"The DNAS servers did not respond.")
ee.sleep(2)
--ee.shRun("/GS2/Browser")
end
end
end

View File

@ -1,11 +0,0 @@
# DNAS Servers
DNAS (Dynamic Network Access System) is the networking service used by the GameStation 2. If the developer so wishes, they can use these servers for many uses, including:
- Authenticating valid or pirated copies of a game.
- Connectivity between different games (eg. linking two games together with one DNAS server so statistics or usernames can be shared).
- Easy control of the current status of their games - universal online, offline and shutdown messages that work across any games using DNAS.
The client code can be run on a real GS2 to connect to a computer with the sample server code running. Developers are encouraged to expand upon this code and make their own custom DNAS servers for their games.

View File

@ -1,48 +0,0 @@
--[[
DNAS master server
Credits:
Mr_Iron2: Concept, client utility
Gonow32: Modem code
Note: since this is a server program, it is NOT
reliant on the GS2 APIs and is NOT designed to be
run on a real GS2. It will work on any computer.
--]]
term.clear()
term.setCursorPos(1,1)
print("DNAS Server")
local online = true
if online == true then
print("Current Status: Online")
elseif online == false then
print("Current Status: Unavailable")
else
print("Current Status: Shut Down")
end
local modem = peripheral.find("modem")
modem.open(6)
while true do
local e = {os.pullEvent()}
if e[1] == "modem_message" then
if e[3] == 661 then
if type(e[5]) == "table" then
if e[5].sType then
if e[5].sType == "status" then
if online == true then
modem.transmit(661, 661, {sType = "status", sContents = "Online"})
elseif online == false then
modem.transmit(661, 661, {sType = "status", sContents = "Shutdown"})
else
modem.transmit(661, 661, {sType = "status", sContents = "Offline"})
end
end
end
end
end
end

View File

@ -1,6 +1,9 @@
# Licensed Games #GameStation 2
#Officially Licensed Games
These are all officially licensed and approved games currently available on the GameStation 2. These are all officially licensed/approved games currently available on the GameStation 2.
#Note:
This does NOT include the big library of games available on Strafe, just commercially available [on physical media] games.
Games: Games:
@ -14,7 +17,4 @@ Games:
- CCSand - CCSand
^ Multiplayer-ready with DNAS ^Supports NetPlay
### Note:
This does NOT include the big library of games available on Strafe, just commercially available [on physical media] games.

View File

@ -1,21 +1,17 @@
# GameStation 2 # GameStation 2
## Real power for real players # Real power for real players
Features of GS2: Features of GS2:
• Play online through the DNAS network! • Play online through the DNAS network!
• Download an abundance of games via the Strafe store! • Download an abundance of games via the Strafe store
• Dig into the classic GS2 releases library - enjoy timeless classics that paved the way forward for the industry, such as TRON and Skyfall - and they were played first on GameStation 2! • Dig into the classic GS2 releases library^ - enjoy timeless classics that paved the way forward for the industry, such as TRON and Skyfall - and they were played first on GameStation 2!
• Native monitor support! Enjoy pristine higher resolution graphics on the GameStation 2! • Native monitor support! Enjoy beautiful high resolution on the GameStation 2 flawlessly^^
• Enjoy the GS2's rich and longstanding support from Game Fusion • Enjoy the GS2's rich support from Game Fusion
• Support for monochrome computers has arrived at last! Enjoy GS2 games on non-advanced PCs thanks to Gonow32's colour to monochrome graphics wrapper!
• A developer's dream; custom APIs for graphics and other tasks along with documentation and servers hosted by GF!
And more! And more!
@ -24,6 +20,6 @@ GameStation 2 - The ultimate CC console.
"Classic GS2 releases" is not including Strafe and is referring to GameStation 2 licensed releases only ^ This is not including Strafe and is referring to GameStation 2 licensed releases
Not all games support custom resolution or "hi-res" mode - however the system menus are dynamically coded to support this ^^ Not all games support custom resolution or "hi res" - however the system menus are guaranteed to support this

View File

@ -4,26 +4,41 @@ local gravity = {}
--CREDIT TO marumaru --CREDIT TO marumaru
function getColor ( mctag ) function getColor ( mctag )
local tags = { if mctag == "&0" then
["0"] = colors.black, return 32768
["1"] = colors.blue, elseif mctag == "&f" then
["2"] = colors.green, return 1
["3"] = colors.cyan, elseif mctag == "&e" then
["4"] = colors.red, return 16
["5"] = colors.purple, elseif mctag == "&a" then
["6"] = colors.orange, return colors.lime
["7"] = colors.lightGray, elseif mctag == "&b" then
["8"] = colors.gray, return colors.lightBlue
["9"] = colors.cyan, elseif mctag == "&c" then
a = colors.lime, return colors.red
b = colors.lightBlue, elseif mctag == "&d" then
c = colors.red, return colors.pink
d = colors.pink, elseif mctag == "&1" then
e = colors.yellow, return colors.blue
f = colors.white elseif mctag == "&2" then
} return colors.green
mgtag = mgtag:gsub("&","") elseif mctag == "&3" then
return tags[mgtag] or colors.white return colors.cyan
elseif mctag == "&4" then
return colors.red
elseif mctag == "&5" then
return colors.purple
elseif mctag == "&6" then
return colors.orange
elseif mctag == "&7" then
return colors.lightGray
elseif mctag == "&8" then
return colors.gray
elseif mctag == "&9" then
return colors.cyan
else
return 1
end
end end
-- CREIDT TO marumaru -- CREIDT TO marumaru
@ -42,33 +57,44 @@ function getLines(dir)
local cur = 1 local cur = 1
local file = fs.open(dir, "r") local file = fs.open(dir, "r")
local line = file.readLine() local line = file.readLine()
repeat while line ~= nil do
lines[cur] = line lines[cur] = line
line = file.readLine() line = file.readLine()
until not line end
file.close() file.close()
return lines return lines
else
return nil
end end
return nil
end end
function split(str, sep) function split(str, pat)
local out = {} local t = {} -- NOTE: use {n = 0} in Lua-5.0
if sep == nil then if str ~= nil then
sep = "%s" local fpat = "(.-)" .. pat
end local last_end = 1
i=1 local s, e, cap = str:find(fpat, 1)
for st in string.gmatch(str, "([^"..sep.."]+)") do while s do
out[i] = st if s ~= 1 or cap ~= "" then
i = i + 1 table.insert(t,cap)
end end
return out last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
else
print("##CGE ERROR failed to split ["..str.."] by:"..pat)
end
return t
end end
function getTableSize(table) function getTableSize(table)
local cur = 0 local cur = 0
for _ in pairs(table) do for i,v in ipairs(table) do
cur = cur+1 cur = i
end end
return cur return cur
end end

View File

@ -2,8 +2,10 @@
-- Powerful CPU API for GS2 -- Powerful CPU API for GS2
-- Based on C64 CPU v1.1 -- Based on C64 CPU v1.1
local version = 1.1 local version = v1.1
local debug = false -- Enable debug for extra info eg. telling you when EE reloads local debug = false
-- Enable debug for extra info eg. telling you when EE reloads
-- Basic math functionality -- Basic math functionality
@ -87,20 +89,21 @@ pullEvtRaw = os.pullEventRaw
queueEvt = os.queueEvent queueEvt = os.queueEvent
function reload() function reload()
os.loadAPI("/GS2/APIs/ee") os.unloadAPI("/APIs/ee")
if debug then os.loadAPI("/APIs/ee")
print("EE reloaded!") if debug = true then
end print("EE reloaded!")
else end
end end
function info() function info()
print("Emotion Engine CPU API") print("Emotion Engine CPU API")
print("API version: v"...version..." ") print("API version: "...version..." ")
if debug then if debug = true then
print("Debug mode: Enabled") print("Debug mode: Enabled")
else else
print("Debug mode: Disabled") print("Debug mode: Disabled")
end end
end end
startTimer = os.startTimer startTimer = os.startTimer

View File

@ -3,22 +3,10 @@ Graphics Synthesizer API
Based on Commander 64 GPU API Based on Commander 64 GPU API
with some additions and changes. with some additions and changes.
By TheMrIron2
By TheMrIron2 (Mr_Iron2)
--]] --]]
local version = 1.2 local version = 1.0
local debug = false
-- disabled by default
local function reload()
os.loadAPI("/GS2/APIs/gs")
if debug then
print("GS reloaded!")
end
end
-- Term functions -- Term functions
@ -114,11 +102,6 @@ function monTxtScale(size)
end end
end end
function wrap(side)
local mon = peripheral.wrap(side)
-- use command like mon.write("hi")
end
-- Paintutils derived commands -- Paintutils derived commands
loadImg = paintutils.loadImage loadImg = paintutils.loadImage
@ -146,9 +129,3 @@ end
slowWrite = textutils.slowWrite slowWrite = textutils.slowWrite
slowPrint = textutils.slowPrint slowPrint = textutils.slowPrint
-- Parallel functions
waitForAny = parallel.waitForAny
waitForAll = parallel.waitForAll

View File

@ -1,14 +1,24 @@
function split(str, sep) function split(str, pat)
local out = {} local t = {} -- NOTE: use {n = 0} in Lua-5.0
if sep == nil then if str ~= nil then
sep = "%s" local fpat = "(.-)" .. pat
end local last_end = 1
i=1 local s, e, cap = str:find(fpat, 1)
for st in string.gmatch(str, "([^"..sep.."]+)") do while s do
out[i] = st if s ~= 1 or cap ~= "" then
i = i + 1 table.insert(t,cap)
end end
return out last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
else
print("##ERROR failed to split ["..str.."] by:"..pat)
end
return t
end end
local function getTableSize(table) local function getTableSize(table)
@ -24,7 +34,7 @@ function unformatTable(string, join)
end end
function formatTable(table, join, start) function formatTable(table, join, start)
if type(start) == "nil" then start = 1 end if start == nil then start = 1 end
local str = "" local str = ""
for i=start,#table do for i=start,#table do
if i == start then str = table[i] else str = str..join..table[i] end if i == start then str = table[i] else str = str..join..table[i] end

View File

@ -5,66 +5,8 @@
-- Special thanks to Advanced Vector API for most of this vector code -- Special thanks to Advanced Vector API for most of this vector code
-- http://www.computercraft.info/forums2/index.php?/topic/3752-advanced-vector-api-v11/ -- http://www.computercraft.info/forums2/index.php?/topic/3752-advanced-vector-api-v11/
local version = 1.0
-- debug currently does nothing useful: devs could use it though local version = v1.0
local debug = false
local function reload()
os.loadAPI("/GS2/APIs/vu")
if debug then
print("VUs reloaded!")
end
end
local function info()
print("Vector Unit coprocessor API")
print("API version: v"...version..." ")
if debug then
print("Debug mode: Enabled")
else
print("Debug mode: Disabled")
end
end
-- Multishell support for multithreading/multishell
-- Multishell commands begin with t to indicate threading/multishell + to avoid conflicts
if multishell then
tGetTitle = multishell.getTitle
tGetCount = multishell.getCount
tLaunch = multishell.launch
tSetFocus = multishell.setFocus
tSetTitle = multishell.setTitle
tGetFocus = multishell.getFocus
else
tGetTitle = function()
return ""
end
tGetCount = function()
return 1
end
tLaunch = function()
return false
end
tSetFocus = function()
return true
end
tSetTItle = function()
return false
end
tGetFocus = function()
return 1
end
end
-- Vector functions
new = vector.new new = vector.new
@ -471,23 +413,3 @@ end
isVector = function(v) isVector = function(v)
return getmetatable(v) == vmetatable return getmetatable(v) == vmetatable
end end
-- Parallel functions
waitForAny = parallel.waitForAny
waitForAll = parallel.waitForAll
-- Other functions
run = shell.run -- No os.run equivalent to avoid confusion, as shell.run is sufficient most of the time and EE has os.run
sleep = os.sleep
serialize = textutils.serialize
unserialize = textutils.unserialize
serializeJSON = textutils.serializeJSON
urlEncode = textutils.urlEncode

View File

@ -1,55 +1,49 @@
--[[ ---------------------------------------------------
-- GameStation 2 Browser - Credits:
GameStation 2 Browser -- Strafe: CrazedProgrammer
-- Everything Else: Mr_Iron2
Credits: ---------------------------------------------------
Strafe: CrazedProgrammer
Browser and Apps: Mr_Iron2
Code cleanup + fixes: Ale32bit
--]]
local version = 2.0
os.loadAPI("/GS2/APIs/gs")
local function powerOff() local function powerOff()
gs.setTxt("white") term.setBackgroundColour(colours.grey)
gs.clrBg("grey") term.setTextColour(colours.white)
gs.cursPos(1,8) term.clear()
gs.center(8,"Shutting Down...") term.setCursorPos(1,8)
center(8,"Shutting Down...")
sleep(1) sleep(1)
gs.clrBg("lightGrey") term.setBackgroundColour(colours.lightGrey)
term.clear()
sleep(0.2) sleep(0.2)
gs.clrBg("white") term.setBackgroundColour(colours.white)
term.clear()
sleep(0.1) sleep(0.1)
os.shutdown() os.shutdown()
end end
local function gamesApps() local function gamesApps()
gs.clrBg("blue") term.setBackgroundColour(colours.blue)
gs.cursPos(1,1) term.clear()
gs.setTxt("white") term.setCursorPos(1,1)
term.setTextColour(colours.white)
while true do while true do
programs = fs.list("/GS2/GamesApps") programs = fs.list("/GS2/GamesApps")
gs.cursPos(1,1) term.setCursorPos(1,1)
gs.clr() term.clear()
for i=1,#programs do for i=1,#programs do
gs.setTxt("white") term.setTextColour(colours.white)
gs.cursPos(1,i-scroll) term.setCursorPos(1,i-scroll)
print(programs[i]) print(programs[i])
end end
if #programs == 0 then if #programs == 0 then
gs.setTxt("white") term.setTextColour(colours.white)
gs.cursPos(1,1) term.setCursorPos(1,1)
print("You have no games.") print("You have no games.")
end end
gs.cursPos(1,19) term.setCursorPos(1,19)
gs.setTxt("white") term.setTextColour(colours.white)
write("Click a program to run it. Space to exit.") write("Click a program to run it. Space to exit.")
os.startTimer(0.3) os.startTimer(0.3)
@ -70,9 +64,9 @@ end
if c <= #programs then if c <= #programs then
c = c - scroll c = c - scroll
print(programs[c]) print(programs[c])
gs.setTxt("white") term.setTextColour(colours.white)
gs.clr() term.clear()
gs.cursPos(1,1) term.setCursorPos(1,1)
shell.run("/GS2/GamesApps/"..programs[c]) shell.run("/GS2/GamesApps/"..programs[c])
end end
end end
@ -80,91 +74,102 @@ end
end end
local function systemInfo() local function systemInfo()
gs.clrBg("grey") term.setBackgroundColour(colours.red)
gs.setTxt("white") term.setTextColour(colours.white)
gs.center(2,"Information") term.clear()
gs.center(4,"GS2 Model: GS2 SCPH-50000") center(2,"Information")
gs.center(5,"Software version: v2.0") center(4,"GS2 Model: GS2 SCPH-30000")
gs.center(7,"Credits:") center(5,"Software version: v1.5")
gs.center(9,"Programming: TheMrIron2") center(7,"Credits:")
gs.center(10,"Programming: Funey") center(9,"Programming: TheMrIron2")
gs.center(11,"Strafe: CrazedProgrammer") center(10,"Programming: Funey")
gs.center(14,"Thank you for using your GS2!") center(11,"Strafe: CrazedProgrammer")
gs.center(16,"Press space to go back") center(14,"Thank you for using your GS2!")
center(16,"Click here to go back")
while true do while true do
local evt, button, key = os.pullEventRaw() local evt, button, x, y = os.pullEvent("mouse_click")
if key == keys.space then if y == 16 then menu()
menu() else -- otherwise, just wait
end end
end
end end
local function installDisk() local function installDisk()
gs.clrBg("white") term.setBackgroundColour(colours.red)
gs.setTxt("black") term.setTextColour(colours.white)
term.clear()
while true do while true do if fs.exists("/disk/") then center(8,"Installing...")
if fs.exists("/disk/") then shell.run("cp disk/* GS2/GamesApps/")
gs.center(8,"Installing...") center(10,"Installed!")
shell.run("cp disk/* GS2/GamesApps/") else center(8,"No disk found!")
gs.center(10,"Installed!") sleep(3)
else menu()
gs.center(8,"No disk found!") end
sleep(3)
menu()
end
end end
local function settings() local function settings()
gs.setTxt("white") term.setBackgroundColour(colours.green)
gs.clrBg("grey") term.setTextColour(colours.white)
gs.center(2,"System Settings") term.clear()
gs.setBg("lightGrey") center(2,"System Settings")
gs.center(4,"1. Modify Files ") term.setBackgroundColour(colours.red)
gs.center(14,"Press space to Quit") center(4," Modify Files ")
term.setBackgroundColour(colours.green)
center(14,"Click here to Quit")
while true do while true do local evt, button, x, y = os.pullEvent()
local evt, button, key = os.pullEventRaw() if evt == "mouse_click" then
if key == keys.one then if y == 4 then
gs.clr() term.clear()
gs.cursPos(1,1) term.setCursorPos(1,1)
shell.run("/rom/programs/shell") shell.run("/rom/programs/shell")
elseif key == keys.space then elseif y == 14 then
menu() menu()
end else
end end
end
end
end end
local function updater() local function updater()
local w,h = gs.getSize() local w,h = term.getSize()
gs.clrBg("grey") term.setBackgroundColour(colours.red)
gs.setBg("white") term.clear()
gs.cursPos(1,1) term.setBackgroundColour(colours.white)
gs.clrLine() term.setCursorPos(1,1)
gs.setTxt("grey") term.clearLine()
gs.center(1,"GameStation 2 Updater v1") term.setTextColour(colours.blue)
gs.setBg("grey") center(1,"GameStation 2 Updater v1")
gs.setTxt("white") term.setBackgroundColour(colours.red)
gs.cursPos(1,3) term.setTextColour(colours.white)
print(" 1. Install") term.setCursorPos(1,3)
print(" 2. Exit") print(" Install")
gs.center(7,"To update, get an official GS2 update") print(" Exit")
gs.center(8,"disk and press 1.") center(7,"To update, get an official GS2 update disk.")
center(8,"disk and press 'Install'.")
while true do local evt, button, y = os.pullEvent("mouse_click") while true do local evt, button, x, y = os.pullEvent("mouse_click")
if y == 3 then if y == 3 then
if not fs.exists("/disk/.flashUpdate/") then -- Used for disk updates or other purposes to install code if not fs.exists("/disk/.flashUpdate/") then -- Used for disk updates or other purposes to install code
gs.center(8,"Invalid Disk!") center(8,"Invalid Disk!")
menu() menu()
elseif fs.exists("disk/boot.elf") then elseif fs.exists("disk/boot.elf") then shell.run("disk/boot.elf") -- Run a game
shell.run("disk/boot.elf") elseif fs.exists("/disk/.flashUpdate/") and fs.isDir("/disk/.flashUpdate") then
for i,v in pairs(fs.list("/")) do
elseif fs.exists("/disk/.flashUpdate/") then if v == "rom" then
shell.run("/disk/.flashUpdate/boot.elf") elseif v == "disk" then
gs.clr() elseif v == "moarp" then
gs.centerSlow(8,"Installed!") else
sleep(1) fs.delete("/"..v)
menu() end
end
shell.run("cp /disk/.flashUpdate/* /")
end
term.clear()
centerSlow(8,"Installed!")
sleep(0.9)
menu()
elseif y == 4 then menu() elseif y == 4 then menu()
else end else end
end end
@ -173,60 +178,34 @@ while true do local evt, button, y = os.pullEvent("mouse_click")
end end
local function menu() local function menu()
gs.clrBg("red") term.setBackgroundColour(colours.red)
gs.setCursorPos(1,1) term.clear()
gs.setBg("white") term.setCursorPos(1,1)
gs.clrLine() term.setBackgroundColour(colours.white)
gs.setTxt("red") term.clearLine()
gs.center(1,"GameStation 2 Browser") term.setTextColour(colours.red)
gs.setBg("red") center(1,"GameStation 2 Browser")
gs.cursPos(1,3) term.setBackgroundColour(colours.red)
gs.setTxt("blue") term.setCursorPos(1,3)
gs.setBg("white") term.setTextColour(colours.blue)
gs.center(3,"1. Games and Apps ") term.setBackgroundColour(colours.white)
gs.center(5,"2. Install ") center(3," Games and Apps ")
gs.center(7,"3. Strafe ") center(5," Install ")
gs.center(9,"4. Shutdown ") center(7," Strafe ")
gs.center(11,"5. Information ") center(9," Shutdown ")
gs.center(13,"6. Settings ") center(11," Information ")
gs.center(15,"7. Software Update ") center(13," Settings ")
center(15," Software Update ")
while true do while true do local evt, button, x, y = os.pullEvent("mouse_click")
local evt, key, y = os.pullEventRaw() if y == 3 then gamesApps()
if evt == "mouse_click" then elseif y == 5 then installDisk()
if y == 3 then elseif y == 7 then shell.run("pastebin run bj3qj1Pj")
gamesApps() elseif y == 9 then powerOff()
elseif y == 5 then elseif y == 11 then systemInfo()
installDisk() elseif y == 13 then settings()
elseif y == 7 then elseif y == 15 then updater()
shell.run("pastebin run bj3qj1Pj") end
elseif y == 9 then
powerOff()
elseif y == 11 then
systemInfo()
elseif y == 13 then
settings()
elseif y == 15 then
updater()
end
elseif evt == "key" then
if key == keys.one then
gamesApps()
elseif key == keys.two then
installDisk()
elseif key == keys.three then
shell.run("pastebin run bj3qj1Pj")
elseif key == keys.four then
powerOff()
elseif key == keys.five then
systemInfo()
elseif key == keys.six then
settings()
elseif key == keys.seven then
updater()
end
end
end end
menu() menu()

View File

@ -140,4 +140,3 @@ Tries to retrieve the location.
On success, returns the location of the modem. On success, returns the location of the modem.
On failure (if no responses are received after timeout, by default 2), returns nil. On failure (if no responses are received after timeout, by default 2), returns nil.
If debug is true, debug messages are printed. If debug is true, debug messages are printed.
--]]

View File

@ -1,63 +1,45 @@
os.loadAPI("/GS2/APIs/gs") function center(y,string)
os.loadAPI("/GS2/APIs/ee") local w,h = term.getSize()
local x = (w/2)-(#string/2)
term.setCursorPos(x,y)
print(string)
end
if peripheral.find("monitor") then function centerSlow(y,string)
shell.run("monitor right startup") local w,h = term.getSize()
local x = (w/2)-(#string/2)
term.setCursorPos(x,y)
textutils.slowPrint(string)
end
if peripheral.find("monitor") then shell.run("monitor right startup")
shell.run("monitor left startup") shell.run("monitor left startup")
shell.run("monitor top startup") shell.run("monitor top startup")
shell.run("monitor bottom startup") shell.run("monitor bottom startup")
shell.run("monitor front startup") shell.run("monitor front startup")
shell.run("monitor back startup") shell.run("monitor back startup")
elseif not term.isColour then elseif not term.isColour then
term.setBackgroundColour(colours.white)
-- Colour-monochrome wrapper by Gonow32 term.setTextColour(colours.black)
term.clear()
local current = term.current() centerSlow(8,"Whoops!")
term.redirect(window.create(current,1,1,current.getSize())) centerSlow(10,"Please use GameStation 2 on an advanced computer!")
sleep(3)
if not term.isColour() then term.setBackgroundColour(colours.black)
local oldback = term.setBackgroundColour term.clear()
function term.setBackgroundColor(colour) term.setCursorPos(1,1)
if colour == 1 then error("Monochrome not supported (yet)")
oldback(colour)
else
oldback(colours.black)
end
end
term.setBackgroundColour = term.setBackgroundColor
local oldtext = term.setTextColour
function term.setTextColor(colour)
if colour == 32768 then
oldtext(colour)
else
oldtext(colours.white)
end
end
end
gs.setTxt("white")
gs.clrBg("red")
gs.centerSlow(6,"Game Fusion Presents...")
sleep(1.5)
gs.clr()
gs.centerSlow(6,"GameStation 2.")
sleep(1)
gs.center(7,"The ultimate CC console.")
sleep(2)
shell.run("/GS2/Browser")
else else
gs.setTxt("white") term.setTextColour(colours.white)
gs.clrBg("red") term.setBackgroundColour(colours.red)
gs.centerSlow(6,"Game Fusion Presents...") term.clear()
centerSlow(6,"Game Fusion Presents...")
sleep(1.5) sleep(1.5)
gs.clr() term.clear()
gs.centerSlow(6,"GameStation 2.") centerSlow(6,"GameStation 2.")
sleep(1) sleep(1)
gs.center(7,"The ultimate CC console.") center(7,"The Ultimate CC Console.")
sleep(2) sleep(2.25)
shell.run("/GS2/Browser") shell.run("/GS2/Browser")
end end

View File

@ -1,132 +0,0 @@
--[[
Basic documentation for high resolution
graphics on GS2, utilising the GS
API functions at developers'
disposal to not only make life easier,
but to demonstrate practical use cases
of the GS and to give developers an
idea of how to set up their programs
to be as graphically flexible as
possible.
Written by Mr_Iron2, (C) 2018
-----
The key to the best possible graphical
experience is to make things dynamic
wherever possible. To start, instead of
setting predefined resolution variables
(designed around a typical 51x19 CC
computer screen) we should instead get
the size of the current window.
To do this with GS, simply call:
local w,h = gs.winSize()
This command gets the size of the current
window, and assigns the resolutions to the
"w" and "h" variables. For example, on a
51x19 display, this would mean w = 51 and
h = 19. This is far more efficient than
hard-coding resolution values.
Now you can design your program around
these variables. For example, the GS
"center" code averages the center point
of the screen based on the length of the
text and the width of the screen. Here's
the source code:
function center(y, string)
local x = (w/2)-(#string/2)
term.setCursorPos(x,y)
print(string)
end
What this function is doing is taking the
"W" and "H" parameters we got earlier from
gs.winSize() and using them in a practical
situation. To get X, the horizontal point
the cursor is set to, it divides the horizontal
resolution (W ie. width) by two, and subtracts
the length of the text. It then takes a value
for Y from the user, as you can see below,
and sets the cursor accordingly to print the
text.
gs.center(8, "Hello world!")
That's not so difficult, is it? This center
code is a great example of how the program
can be adapted to adjust itself dynamically
based on the window/screen resolution. It
will always find the horizontal center because
it uses a dynamic width value given to us by
gs.winSize(), so this allows us to use this code
at any resolution we like!
-----
Adjusting resolution for monitors
By default, monitors have a text scale of 1.
Using the default text scale, a single monitor
has a resolution of 7 pixels horizontally by 5
pixels vertically (7x5). With the default text
scale, monitor borders take up two pixels on the
left and right sides, and one pixel on the top
and bottom sides. Using the default text
scale, the largest possible monitor cluster - 8
blocks wide and 6 blocks tall - has a resolution
of 70x40. However, this isn't the highest we can go.
The text scale of monitor.setTextScale can be increased
or decreased in increments of 0.5, and the highest
resolution setting is achieved when the text scale is set
to 0.5. Under this setting, a single monitor has a
resolution of 15x10. At this scale, monitor borders take
up three pixels on the left and right sides, and two
pixels on the top and bottom sides.
Using the 0.5 text scale for maximum resolution, the
largest possible monitor cluster has a total resolution
of 162 pixels horizontally by 80 pixels vertically.
That's a lot of hi-res potential! So using the
techniques mentioned before, we can do a lot of cool
stuff. To set the scale of the text on a monitor, use
the following GS command:
gs.monTxtScale(size)
Simple enough, right? This encapsulates a few lines of
code and handles what the current display is before calling
the generic setTextScale command. So by setting this to 0.5
we can get the highest possible resolution out of our
GS2. By using this with our above command, we can get the best
experience with a dynamic way of handling the resolution and
getting the most pixels out of a ComputerCraft monitor.
What's important to note is that this command doesn't simply
change the size of text; it also changes the size of pixels
drawn by paintutils, so this is a really powerful command and
it's strongly recommended when using a monitor! To wrap the
GS2 to a monitor, use the following code:
local monitor = peripheral.wrap( "top" )
(NOTE: As of v1.2, GS has the "gs.wrap(side)" command as well.
However, this is a new version of GS, and as such it is advised
that if you use this command instead, you should ensure the GS2's
GS API is v1.2 or later; local version should return the version.)
This wraps any code with "monitor" before it to the wrapped display.
For example, monitor.write("Hello!")
(NOTE: for gs.wrap(), the syntax is mon.write() instead)
So by combining these functions, you can get a great high res
experience from ComputerCraft! The rest is up to you; the above
will give you a framework to build some high-res code around.
Happy programming!
--]]
print("Edit me instead to read!")

View File

@ -1,40 +0,0 @@
--[[
Guide to networking on the GS2
written by Mr_Iron2.
-----
The GS2 is known for, among other things,
its ambitious forays into servers and
networking at launch. It tried everything
from a game distribution platform to a game
streaming service (which is now used in
Revolution's Shield device) and even the
famous DNAS system, an optional authentication
server which games can pass through.
---
DNAS
DNAS (Dynamic Network Authentication Service)
is a GS2 service which games can pass through
to get information about the GS2 and/or to
authenticate games connecting to servers or P2P.
To send a request to the DNAS servers, simply
do the following:
local modem = peripheral.find("modem")
modem.open(661)
modem.transmit(661, 661, {sType = "status"})
This sends a status request to the DNAS servers
to check whether DNAS is still online, temporarily
down or permanently terminated. Simple, right?
DNAS also has a utility, which can be found on
the GS2 GitHub page, as well as a Network Center
program so you can configure and test your
connection to DNAS. Handy!
--]]

View File

@ -1,87 +0,0 @@
--[[
Guide to GS2SDK written by Mr_Iron2.
-----
Welcome to the GameStation 2 Software
Development Kit (GS2SDK)! This guide will
help you get to grips with what is possible
and will hopefully give you some ideas.
-----
APIs:
The GS2 has many flexible and powerful APIs
to ensure you can write concise code which is
readable, easy and efficient. These include a few
standard, third party APIs - which you can read into
by yourself from their official documentation - but
this also includes a selection of tailored APIs
exclusively for GS2!
EE: The GS2's "Emotion Engine" API allows you to
perform CPU functions in a concise form. The EE has
functionality for maths, bit-shifting, parallelisation,
timers and much more! It's a very robust API for general
processing. Things that can be done with it include
making a calculator, a GPS program, a URLencoder, a JSON
serializer, a clock and much more! You can read into it
yourself by editing /GS2/APIs/ee and seeing all the functions
for yourself; they are very straightforward and easy to
understand, like GS.
GS: The GS2's "Graphics Synthesizer" API is an API
designed for processing graphics and rendering tasks.
These range from simple nice-to-haves such as one-line
functions for clearing the screen to a given background,
to more complex functions like wrapping to a monitor, a ton
of paintutils commands that can be called on-the-fly and
setting up windows/displays! Some things you could make
with GS include a paint program, a psuedo-3D game, a
platformer, a high-resolution rendering demo and lots of other
things! It is a full replacement for term and paintutils while
including commands of its own and other miscellaneous
functions.
VU: The most complex API of them all, the "Vector Unit" API
is for only the most advanced CC programs. The VU allows for
parallelising programs and an array of vector-based processes.
Vectors act a lot like tables, storing coordinate data with
labels "x", "y" and "z". However, it can be worthwhile to use
vectors instead of tables in certain situations. Among other
things, vectors can be useful to aid in creating navigation
programs using GPS coordinates. By making good use of vectors,
code can be cleaner and easier to follow.
---
Networking:
The GS2 has a special DNAS service designed to allow
developers to authenticate or otherwise pass through an
official server. This gives a layer of security and assurance
but is also completely optional. Read the sdk documentation's
piece on networking and you can see how easy it is to
send some requests to DNAS, and it also has utility programs
available on the GitHub!
---
Footnote
The GS2 is a flexible machine with APIs and services that will
allow you to do anything you can imagine doing in CC with ease.
Its APIs allow for concise code and anyone can have immediate
access to the GS2 SDK, and not only that - anyone has permission
to modify it and redistribute a "homebrew" version of the GS2SDK
as well as publishing their own homebrew games, with official
licensing available upon request! The only difference is that
your game will be added to the list of licensed GS2 games.
The GS2 is a console that allows you to make anything, so with
that in mind, we've done our best to help you with your
programming work with our documentation; we hope you enjoy
working with the GS2!
--]]
print("Edit me to read!")

View File

@ -1,3 +0,0 @@
-- Set dev path
shell.setPath(shell.path()..":/.gs2/sdk/bin")

View File

@ -1,75 +0,0 @@
--[[
Official GameStation 2 (GS2) software development
kit (SDK) installer
By Mr_Iron2/TheMrIron2
(C) 2018 Game Fusion
GameStation 2 is (C) 2015-2018 Game Fusion.
NOTE: The GS2 SDK does NOT include the GS2 operating system.
It is recommended that the SDK is installed on top of an existing GS2,
however this is not required. The SDK can also function as an
independent development environment, with no GS2 files necessary.
This SDK is free to be used by anyone.
It is open source and is permissive of modification.
You may modify this as you wish and/or redistribute your modified GS2SDK,
as long as credit is provided.
--]]
local function center(y, string)
local w, h = term.getSize()
local x = (w / 2)-(#string / 2)
term.setCursorPos(x, y)
print(string)
end
term.setBackgroundColour(colours.blue)
term.setTextColour(colours.white)
term.clear()
center(3, "Welcome to the GameStation 2 (GS2)")
center(4, "Software Development Kit (SDK) installer.")
sleep(2)
center(6, "This will now install the GS2 SDK.")
center(7, "If you do not want the program to continue,")
center(8, "please terminate now (CTRL + T). Otherwise, wait 10 seconds.")
sleep(10)
term.clear()
-- Removing GS2 components to download new ones
if fs.exists("/GS2/APIs/") then
fs.delete("/GS2/APIs")
else
center(1, "GS2 SDK")
term.setCursorPos(1,2)
term.setBackgroundColour(colours.white)
term.clearLine()
term.setBackgroundColour(colours.blue)
-- Downloading everything
center(4, "Installing necessary APIs... ")
shell.run("pastebin get p7p3R4ze /GS2/APIs/ee")
shell.run("pastebin get WXCnYffd /GS2/APIs/gs")
shell.run("pastebin get gCkEYHDh /GS2/APIs/vu")
write("done!")
sleep()
center(5, "Installing GS2SDK commandline... ")
shell.run("pastebin get yA9ez1Z8")
write("done!")
sleep()
center(6, "Installing Lua pre-processor... ")
shell.run("pastebin get V9x3Sctv /.gs2/sdk/bin/lua-preproc")
write("done!")
sleep(1) -- ensure user sees everything has been completed
-- Finalising
term.clear()
center(7, "GS2SDK installed!")
center(8, "Run "/.gs2/sdk/dev" to enter the GS2SDK commandline.")
sleep(5)
term.setBackgroundColour(colours.black)
term.clear()
term.setCursorPos(1, 1)