pnpbios
May 19th, 2005, 23:54
Hello everybody! I've started developing for the dreamcast a little while ago. So far I have just been making stupid patterns by writing directly to the frame buffer with KOS.
I am looking at doing something a bit more powerfull now. I want to access resources in my base directory over my serial cable connection, with the eventual hope of using them in my game.
fs_open seems to be the right function for this, but it always returns NULL for some reason.
Is there something I have to do with DC-Tool in order to get the directory setup? Or is my path just goofy? If anybody has some ideas, that would be great, cause I am stumped.
Here is the source code for my little demo project.
#include <kos.h>
#include <stdio.h>
#define _RGB(r, g, b) ((r << 12)|(g << 5)|(b << 0))
void drawPix(int x, int y, int color);
int main(int argc, char **argv) {
int x, y;
int color;
file_t fptr;
fptr = fs_open("/pc/dummy.txt", O_RDONLY);
color = _RGB(255,255,255);
if(fptr != 0)
{
fs_close(fptr);
color = _RGB(0,0,255);
}
/* Bother us with output only if something died */
dbglog_set_level(DBG_DEAD);
/* Set the video mode */
vid_set_mode(DM_640x480, PM_RGB565);
for (y=0; y<480; y++)
for (x=0; x<640; x++) {
drawPix(x,y, color);
}
/* Pause to see the results */
usleep(5*1000*1000);
return 0;
}
void drawPix(int x, int y, int color)
{
vram_s[y*640+x] = color;
return;
}
And yes, I know that the default is to read from the root directory. I put the file 'dummy/txt' in the root directory and in the base directory, so I am thinking that the problem lies with dc-tool somewhere.
I am looking at doing something a bit more powerfull now. I want to access resources in my base directory over my serial cable connection, with the eventual hope of using them in my game.
fs_open seems to be the right function for this, but it always returns NULL for some reason.
Is there something I have to do with DC-Tool in order to get the directory setup? Or is my path just goofy? If anybody has some ideas, that would be great, cause I am stumped.
Here is the source code for my little demo project.
#include <kos.h>
#include <stdio.h>
#define _RGB(r, g, b) ((r << 12)|(g << 5)|(b << 0))
void drawPix(int x, int y, int color);
int main(int argc, char **argv) {
int x, y;
int color;
file_t fptr;
fptr = fs_open("/pc/dummy.txt", O_RDONLY);
color = _RGB(255,255,255);
if(fptr != 0)
{
fs_close(fptr);
color = _RGB(0,0,255);
}
/* Bother us with output only if something died */
dbglog_set_level(DBG_DEAD);
/* Set the video mode */
vid_set_mode(DM_640x480, PM_RGB565);
for (y=0; y<480; y++)
for (x=0; x<640; x++) {
drawPix(x,y, color);
}
/* Pause to see the results */
usleep(5*1000*1000);
return 0;
}
void drawPix(int x, int y, int color)
{
vram_s[y*640+x] = color;
return;
}
And yes, I know that the default is to read from the root directory. I put the file 'dummy/txt' in the root directory and in the base directory, so I am thinking that the problem lies with dc-tool somewhere.