Compare commits

..

42 Commits
v1.0 ... master

Author SHA1 Message Date
TheMrIron2 d15ea7c611
Formatting fix 2018-09-09 00:41:02 +01:00
TheMrIron2 963f649ead
Add networking section, footnote 2018-09-08 20:14:57 +01:00
TheMrIron2 f708817cb0
Create gsn 2018-09-08 20:09:50 +01:00
TheMrIron2 dfd3d03b25
WIP sdk guide 2018-09-08 20:03:11 +01:00
TheMrIron2 7f7bdae469
Create hires 2018-09-08 19:49:28 +01:00
TheMrIron2 a1a7422c25
Update version number, add monitor output wrapping 2018-09-08 19:44:16 +01:00
TheMrIron2 5f55be92d7
Create install.lua 2018-09-08 18:35:03 +01:00
TheMrIron2 746bfe3f09
(WIP) GS2 SDK command line 2018-09-08 18:32:12 +01:00
TheMrIron2 4a7d22b9c9
Add multithreading + misc functions 2018-09-08 18:17:10 +01:00
TheMrIron2 db8ec4f643
Add parallel functions, debug
Added parallel functions to make the GS more flexible and multi-functional so it can take load off the EE/VUs
2018-06-21 00:05:46 +01:00
TheMrIron2 dc336061fe
Formatting improvements
Nothing major to see here, just making code less cramped for anyone who wants to modify it or use it
2018-04-03 22:36:34 +01:00
TheMrIron2 553d30f1a1
Prototype network center 2018-02-19 20:00:45 +00:00
TheMrIron2 f82cdfc7b5
Deprecated after latest browser update 2018-02-13 21:05:17 +00:00
TheMrIron2 46cf861694
(Experimental) Mostly mono-friendly browser
Colour-mono wrapper will solve the main browser menu's colours (hopefully). Games and Apps will still likely need a rewrite.
2018-02-13 21:04:36 +00:00
TheMrIron2 30a9017405
Create readme.md 2018-02-13 20:20:06 +00:00
TheMrIron2 a947b41901
Update README.md 2018-02-13 19:53:03 +00:00
TheMrIron2 55e5ba7c0d
Update startup 2018-02-13 19:51:15 +00:00
TheMrIron2 897967c192
More colour - grey + lightGrey 2018-02-13 19:35:46 +00:00
TheMrIron2 ea2d1fdd86
GS bug fixed 2018-02-13 19:28:07 +00:00
TheMrIron2 6a123b3140
Add Ale to credits, clean comments up 2018-02-13 19:21:47 +00:00
TheMrIron2 28ac3d9333
Fix typo, update software version 2018-02-13 19:19:29 +00:00
TheMrIron2 8a3b7b931b
Monochrome startup support
This was coded late at night on a PC with no easily accessible CC setup, don't blame me for using safer but longer code
2018-02-12 23:31:06 +00:00
TheMrIron2 79d50d7a33
Experimental monochrome browser
Code still not perfect, games and apps will likely have to be totally remade.
2018-02-12 23:29:42 +00:00
TheMrIron2 6aa091d447
Updater bug fixed 2018-02-12 22:57:33 +00:00
TheMrIron2 5875e00c3b
Remove EE use 2018-02-12 22:54:07 +00:00
TheMrIron2 ffc6c60920
Monochrome 2018-02-12 22:52:00 +00:00
TheMrIron2 2d9d828d09
Remove bit functions
They're just not going to be used on VU honestly
2018-02-12 22:22:00 +00:00
TheMrIron2 745c812ede
Create server.lua 2018-02-12 22:15:05 +00:00
TheMrIron2 0117e01827
Create utility.lua 2018-02-12 21:59:35 +00:00
TheMrIron2 a6be32275b
Merge pull request #1 from Ale32bit/master
Cleanup (thanks to Ale32bit)
2018-02-12 21:53:53 +00:00
Ale32bit 63e1ec40b6
Update Browser 2018-02-12 22:49:47 +01:00
Ale32bit 72e5cc2360
Update vu 2018-02-12 22:46:38 +01:00
Ale32bit 3c9129b50d
Update CGE 2018-02-12 22:45:40 +01:00
Ale32bit 094fd0b656
Update multinet.lua 2018-02-12 22:45:29 +01:00
Ale32bit 94eb25d370
Update ee 2018-02-12 22:43:37 +01:00
Ale32bit cf3e934708
Update CGE 2018-02-12 22:42:34 +01:00
TheMrIron2 3c8689c3e3
Clean up functions 2018-02-12 21:32:41 +00:00
TheMrIron2 ac9326ea8b
Update ee 2018-02-12 21:25:01 +00:00
TheMrIron2 c9bf6726a8
Cleaned + improved code with API use 2018-02-12 21:23:53 +00:00
TheMrIron2 62590d4212
Fix directory paths for reloading API 2018-02-12 21:05:04 +00:00
TheMrIron2 d47f9fdc64
Added bit, parallel, reload + info functions to VU 2018-02-12 21:04:33 +00:00
TheMrIron2 69b6e03ea9
End comment 2018-01-17 22:02:26 +00:00
19 changed files with 942 additions and 283 deletions

49
DNAS/client/netcenter.lua Normal file
View File

@ -0,0 +1,49 @@
-- 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

108
DNAS/client/utility.lua Normal file
View File

@ -0,0 +1,108 @@
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

11
DNAS/readme.md Normal file
View File

@ -0,0 +1,11 @@
# 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.

48
DNAS/server/server.lua Normal file
View File

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

View File

@ -1,17 +1,21 @@
# GameStation 2
# Real power for real players
## Real power for real players
Features of GS2:
• 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 beautiful high resolution on the GameStation 2 flawlessly^^
• Native monitor support! Enjoy pristine higher resolution graphics on the GameStation 2!
• Enjoy the GS2's rich support from Game Fusion
• Enjoy the GS2's rich and longstanding 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!
@ -20,6 +24,6 @@ GameStation 2 - The ultimate CC console.
^ This is not including Strafe and is referring to GameStation 2 licensed releases
"Classic GS2 releases" is not including Strafe and is referring to GameStation 2 licensed releases only
^^ Not all games support custom resolution or "hi res" - however the system menus are guaranteed to support this
Not all games support custom resolution or "hi-res" mode - however the system menus are dynamically coded to support this

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,132 @@
--[[
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

@ -0,0 +1,40 @@
--[[
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!
--]]

87
sdk/Documentation/sdk Normal file
View File

@ -0,0 +1,87 @@
--[[
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!")

3
sdk/dev Normal file
View File

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

75
sdk/install.lua Normal file
View File

@ -0,0 +1,75 @@
--[[
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)