use as a viewer
This commit is contained in:
parent
2ca7b61c84
commit
4f5319db11
|
@ -189,4 +189,4 @@ wormlet,games
|
||||||
xobox,games
|
xobox,games
|
||||||
xworld,games
|
xworld,games
|
||||||
zxbox,viewers
|
zxbox,viewers
|
||||||
varvara,apps
|
varvara,viewers
|
||||||
|
|
|
@ -10,7 +10,7 @@ copyright notice and this permission notice appear in all copies.
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE.
|
WITH REGARD TO THIS SOFTWARE.
|
||||||
|
|
||||||
TODO proper support for greyscale displays
|
TODO optimise support for greyscale/1-bit displays
|
||||||
TODO rom loading
|
TODO rom loading
|
||||||
TODO other varvara devices
|
TODO other varvara devices
|
||||||
TODO clean up
|
TODO clean up
|
||||||
|
@ -544,18 +544,31 @@ static void run() {
|
||||||
|
|
||||||
enum plugin_status plugin_start(const void* parameter)
|
enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
|
if(!parameter) {
|
||||||
(void)parameter;
|
rb->splash(HZ, "Please open a .rom file using this plugin!");
|
||||||
|
return PLUGIN_ERROR;
|
||||||
DEBUGF("Setting PPU size\n");
|
}
|
||||||
ppu_init(&ppu, LCD_WIDTH, LCD_HEIGHT, framebuffer);
|
|
||||||
DEBUGF("UXN init\n");
|
DEBUGF("zeroing\n");
|
||||||
// Clear RAM and copy rom to VM.
|
|
||||||
DEBUGF("zeroing\n");
|
|
||||||
memzero8(&u, sizeof(Uxn));
|
memzero8(&u, sizeof(Uxn));
|
||||||
DEBUGF("copying ROM\n");
|
|
||||||
memcpy(u.ram.dat + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom));
|
DEBUGF("loading ROM\n");
|
||||||
DEBUGF("registering ports\n");
|
char* filename = (char*) parameter;
|
||||||
|
|
||||||
|
int fd = rb->open(filename, O_RDONLY);
|
||||||
|
if (fd < 0) {
|
||||||
|
rb->splash(HZ, "File Error");
|
||||||
|
return PLUGIN_ERROR;
|
||||||
|
}
|
||||||
|
int numread = rb->read(fd, u.ram.dat + PAGE_PROGRAM, 65536-PAGE_PROGRAM);
|
||||||
|
if (numread==-1) {
|
||||||
|
rb->splash(HZ, "I/O Error");
|
||||||
|
return PLUGIN_ERROR;
|
||||||
|
}
|
||||||
|
rb->close(fd);
|
||||||
|
|
||||||
|
ppu_init(&ppu, LCD_WIDTH, LCD_HEIGHT, framebuffer);
|
||||||
|
|
||||||
// Register ports
|
// Register ports
|
||||||
/* system */ devsystem = uxn_port(&u, 0x0, system_talk);
|
/* system */ devsystem = uxn_port(&u, 0x0, system_talk);
|
||||||
/* console */ devconsole = uxn_port(&u, 0x1, console_talk);
|
/* console */ devconsole = uxn_port(&u, 0x1, console_talk);
|
||||||
|
@ -573,7 +586,6 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
/* empty */ uxn_port(&u, 0xd, nil_talk);
|
/* empty */ uxn_port(&u, 0xd, nil_talk);
|
||||||
/* empty */ uxn_port(&u, 0xe, nil_talk);
|
/* empty */ uxn_port(&u, 0xe, nil_talk);
|
||||||
/* empty */ uxn_port(&u, 0xf, nil_talk);
|
/* empty */ uxn_port(&u, 0xf, nil_talk);
|
||||||
DEBUGF("eval\n");
|
|
||||||
uxn_eval(&u, 0x0100);
|
uxn_eval(&u, 0x0100);
|
||||||
run();
|
run();
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
|
|
|
@ -103,3 +103,4 @@ z7,viewers/frotz,-
|
||||||
z8,viewers/frotz,-
|
z8,viewers/frotz,-
|
||||||
shopper,viewers/shopper,1
|
shopper,viewers/shopper,1
|
||||||
lnk,viewers/windows_lnk,-
|
lnk,viewers/windows_lnk,-
|
||||||
|
rom,viewers/varvara,-
|
||||||
|
|
Loading…
Reference in New Issue