made it easier to check for compat
This commit is contained in:
0
aux/.gitkeep
Normal file
0
aux/.gitkeep
Normal file
@@ -61,12 +61,11 @@ do
|
|||||||
|
|
||||||
-- backwards compatibility, may remove later
|
-- backwards compatibility, may remove later
|
||||||
local eeprom = component.list("eeprom")()
|
local eeprom = component.list("eeprom")()
|
||||||
local bootAddr = nil
|
|
||||||
computer.getBootAddress = function()
|
computer.getBootAddress = function()
|
||||||
return bootAddr
|
return boot_invoke(eeprom, "getData")
|
||||||
end
|
end
|
||||||
computer.setBootAddress = function(address)
|
computer.setBootAddress = function(address)
|
||||||
bootAddr = address
|
boot_invoke(eeprom, "setData", address)
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
27
src/main.c
27
src/main.c
@@ -381,7 +381,28 @@ int main(int argc, char **argv) {
|
|||||||
nn_setComponentMethods(ocelotCard, sandboxMethods);
|
nn_setComponentMethods(ocelotCard, sandboxMethods);
|
||||||
nn_setComponentHandler(ocelotCard, sandbox_handler);
|
nn_setComponentHandler(ocelotCard, sandbox_handler);
|
||||||
|
|
||||||
nn_Component *eepromCard = ncl_createEEPROM(u, NULL, &nn_defaultEEPROMs[3], minBIOS, strlen(minBIOS), false);
|
char *eepromCode = (char *)minBIOS;
|
||||||
|
size_t eepromSize = strlen(minBIOS);
|
||||||
|
const char *eepromPath = getenv("NN_EEPROM");
|
||||||
|
if(eepromPath != NULL) {
|
||||||
|
FILE *eeprom = fopen(eepromPath, "rb");
|
||||||
|
if(eeprom == NULL) {
|
||||||
|
fprintf(stderr, "no such eeprom: %s\n", eepromPath);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(eeprom, 0, SEEK_END);
|
||||||
|
eepromSize = ftell(eeprom);
|
||||||
|
fseek(eeprom, 0, SEEK_SET);
|
||||||
|
|
||||||
|
eepromCode = malloc(eepromSize);
|
||||||
|
size_t amount = 0;
|
||||||
|
while(amount < eepromSize) {
|
||||||
|
amount += fread(eepromCode + amount, sizeof(char), eepromSize - amount, eeprom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nn_Component *eepromCard = ncl_createEEPROM(u, NULL, &nn_defaultEEPROMs[3], eepromCode, eepromSize, false);
|
||||||
|
|
||||||
nn_Filesystem mainfsconf;
|
nn_Filesystem mainfsconf;
|
||||||
nn_Filesystem fsparts[] = {
|
nn_Filesystem fsparts[] = {
|
||||||
@@ -396,8 +417,7 @@ int main(int argc, char **argv) {
|
|||||||
nn_Component *managedfs = ncl_createFilesystem(u, NULL, mainfspath, &mainfsconf, true);
|
nn_Component *managedfs = ncl_createFilesystem(u, NULL, mainfspath, &mainfsconf, true);
|
||||||
//nn_Component *tmpfs = ncl_createTmpFS(u, NULL, &nn_defaultTmpFS, NCL_FILECOST_DEFAULT, false);
|
//nn_Component *tmpfs = ncl_createTmpFS(u, NULL, &nn_defaultTmpFS, NCL_FILECOST_DEFAULT, false);
|
||||||
nn_Component *tmpfs = ncl_createFilesystem(u, NULL, "/tmp", &mainfsconf, false);
|
nn_Component *tmpfs = ncl_createFilesystem(u, NULL, "/tmp", &mainfsconf, false);
|
||||||
nn_Component *testingfs = ncl_createTmpFS(u, NULL, &nn_defaultFilesystems[3], NCL_FILECOST_DEFAULT, false);
|
nn_Component *testingfs = ncl_createFilesystem(u, NULL, "aux", &nn_defaultFilesystems[3], false);
|
||||||
//nn_Component *testingfs = ncl_createFilesystem(u, NULL, "test", &nn_defaultFilesystems[3], false);
|
|
||||||
|
|
||||||
const char * const testDriveData =
|
const char * const testDriveData =
|
||||||
"local g, s = component.list('gpu')(), component.list('screen')()\n"
|
"local g, s = component.list('gpu')(), component.list('screen')()\n"
|
||||||
@@ -708,6 +728,7 @@ cleanup:;
|
|||||||
// rip the universe
|
// rip the universe
|
||||||
nn_destroyUniverse(u);
|
nn_destroyUniverse(u);
|
||||||
ncl_destroyGlyphCache(gc);
|
ncl_destroyGlyphCache(gc);
|
||||||
|
if(eepromPath != NULL) free(eepromCode);
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
free(sand.buf);
|
free(sand.buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user