Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / modules / iopcore / imgdrv / imgdrv.c
blobd78132cd0e4c98c3ef0129e4961a41dcd00e6e1b
1 //we don't need most of this... just standard headers
2 #include <types.h>
3 #include <stdio.h>
4 #include <sysclib.h>
5 #include <thbase.h>
6 #include <thsemap.h>
7 #include <intrman.h>
8 #include <sysmem.h>
9 #include <sifman.h>
10 #include <sifcmd.h>
11 #include <sifrpc.h>
12 #include <loadcore.h>
13 #include <sys/stat.h>
14 #include <sys/fcntl.h>
15 #include <ioman.h>
16 #include <kerr.h>
18 /*#define MODNAME "imgdrv"
19 IRX_ID(MODNAME, 0x01, 0x00);*/
21 unsigned int ioprpimg = 0xDEC1DEC1;
22 int ioprpsiz = 0xDEC2DEC2;
24 int dummy_fs()
26 return 0;
29 int lseek_fs(iop_file_t* fd, unsigned long offset, int whence)
31 if (whence == SEEK_END)
33 return ioprpsiz;
34 } else
36 return 0;
40 int read_fs(iop_file_t* fd, void * buffer, int size )
42 memcpy(buffer, (void*)ioprpimg, size);
43 return size;
46 typedef struct _iop_device_tm {
47 const char *name;
48 unsigned int type;
49 unsigned int version; /* Not so sure about this one. */
50 const char *desc;
51 struct _iop_device_ops_tm *ops;
52 } iop_device_tm_t;
54 typedef struct _iop_device_ops_tm {
55 int (*init)(iop_device_t *);
56 int (*deinit)(iop_device_t *);
57 int (*format)(iop_file_t *);
58 int (*open)(iop_file_t *, const char *, int);
59 int (*close)(iop_file_t *);
60 int (*read)(iop_file_t *, void *, int);
61 int (*write)(iop_file_t *, void *, int);
62 int (*lseek)(iop_file_t *, unsigned long, int);
63 } iop_device_ops_tm_t;
65 iop_device_ops_t my_device_ops =
67 dummy_fs,//init
68 dummy_fs,//deinit
69 NULL,//dummy_fs,//format
70 dummy_fs,//open_fs,//open
71 dummy_fs,//close_fs,//close
72 read_fs,//read
73 NULL,//dummy_fs,//write
74 lseek_fs,//lseek
75 /*dummy_fs,//ioctl
76 dummy_fs,//remove
77 dummy_fs,//mkdir
78 dummy_fs,//rmdir
79 dummy_fs,//dopen
80 dummy_fs,//dclose
81 dummy_fs,//dread
82 dummy_fs,//getstat
83 dummy_fs,//chstat*/
86 const u8 name[] = "img";
87 iop_device_t my_device = {
88 name,
89 IOP_DT_FS,
91 name,
92 &my_device_ops
95 int _start( int argc, char **argv)
97 //DelDrv("img");
98 AddDrv((iop_device_t*)&my_device);
100 return MODULE_RESIDENT_END;