mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-12 23:54:04 +09:00
encoding shenanigans
This commit is contained in:
@@ -109,6 +109,11 @@ for (let i = 0; i < sectionTable.length - 1; i++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_G.shell.execute(PATH_MOUNT + "run.com")
|
let errorlevel = _G.shell.execute(PATH_MOUNT + "run.com")
|
||||||
|
|
||||||
// TODO delete PATH_MOUNT
|
try {
|
||||||
|
files.open(PATH_MOUNT).remove()
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
|
return errorlevel
|
||||||
|
|||||||
@@ -762,7 +762,16 @@ _TVDOS.DRV.FS.DEVTMP.mkFile = (fd) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
_TVDOS.DRV.FS.DEVTMP.remove = (fd) => {
|
_TVDOS.DRV.FS.DEVTMP.remove = (fd) => {
|
||||||
|
let path = _TVDOS.TMPFS[fd.path]
|
||||||
delete _TVDOS.TMPFS[fd.path]
|
delete _TVDOS.TMPFS[fd.path]
|
||||||
|
|
||||||
|
// delete all the keys starting with _TVDOS.TMPFS[fd.path]
|
||||||
|
if (_TVDOS.DRV.FS.DEVTMP.isDirectory(fd)) {
|
||||||
|
Object.keys(_TVDOS.TMPFS).filter(it=>it.startsWith(path)).forEach(childs=>{
|
||||||
|
delete _TVDOS.TMPFS[childs]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
_TVDOS.DRV.FS.DEVTMP.exists = (fd) => (_TVDOS.TMPFS[fd.path] !== undefined)
|
_TVDOS.DRV.FS.DEVTMP.exists = (fd) => (_TVDOS.TMPFS[fd.path] !== undefined)
|
||||||
|
|||||||
16
assets/disk0/tvdos/bin/gzip.js
Normal file
16
assets/disk0/tvdos/bin/gzip.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
function printUsage() {
|
||||||
|
println(`Usage: gzip [/d /c] file
|
||||||
|
To compress a file, replacing it with a gzipped compressed version:
|
||||||
|
gzip file.ext
|
||||||
|
To decompress a file, replacing it with the original uncompressed version:
|
||||||
|
gzip /d file.ext.gz
|
||||||
|
To compress a file specifying the output filename:
|
||||||
|
gzip /c file.ext > compressed_file.ext.gz
|
||||||
|
To decompress a gzipped file specifying the output filename:
|
||||||
|
gzip /c /d file.ext.gz > uncompressed_file.ext`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exec_args[1] === undefined) {
|
||||||
|
printUsage()
|
||||||
|
return 0
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import net.torvald.tsvm.peripheral.PeriBase
|
|||||||
import net.torvald.tsvm.peripheral.VMProgramRom
|
import net.torvald.tsvm.peripheral.VMProgramRom
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
import java.nio.charset.Charset
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
@@ -156,7 +157,7 @@ class VM(
|
|||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val CHARSET = Charsets.ISO_8859_1
|
val CHARSET = Charset.forName("iso-8859-1") // no cp437 because i dunno
|
||||||
|
|
||||||
val MMIO_SIZE = 128.kB()
|
val MMIO_SIZE = 128.kB()
|
||||||
val HW_RESERVE_SIZE = 1024.kB()
|
val HW_RESERVE_SIZE = 1024.kB()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -2,6 +2,7 @@ package net.torvald.terrarum.utils
|
|||||||
|
|
||||||
import com.badlogic.gdx.utils.JsonReader
|
import com.badlogic.gdx.utils.JsonReader
|
||||||
import com.badlogic.gdx.utils.JsonValue
|
import com.badlogic.gdx.utils.JsonValue
|
||||||
|
import java.lang.NullPointerException
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2016-02-15.
|
* Created by minjaesong on 2016-02-15.
|
||||||
@@ -36,7 +37,13 @@ object JsonFetcher {
|
|||||||
throw Error("[JsonFetcher] jsonString is null!")
|
throw Error("[JsonFetcher] jsonString is null!")
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonReader().parse(jsonString.toString())
|
try {
|
||||||
|
return JsonReader().parse(jsonString.toString())
|
||||||
|
}
|
||||||
|
catch (e: NullPointerException) {
|
||||||
|
System.err.println("[JsonFetcher] NullPointerException while processing ${jsonFile.path}")
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(java.io.IOException::class)
|
@Throws(java.io.IOException::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user