Skip to content

Commit c52e8eb

Browse files
authored
Merge pull request #447 from uyjulian/mcman_improvements
mcman improvements
2 parents 297f7b7 + 4a3b937 commit c52e8eb

File tree

13 files changed

+1094
-339
lines changed

13 files changed

+1094
-339
lines changed

iop/memorycard/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SUBDIRS = \
1111
mcman-old \
1212
mcserv \
1313
mcserv-old \
14+
vmcman \
1415
xfromman
1516

1617
include $(PS2SDKSRC)/Defs.make

iop/memorycard/mcman/Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,25 @@
1010

1111
IOP_INCS += -I$(PS2SDKSRC)/iop/system/sio2man/include
1212

13-
IOP_OBJS = main.o mcdev.o mcsio2.o ps2mc_fio.o ps1mc_fio.o imports.o exports.o
13+
IOP_OBJS = \
14+
main.o \
15+
mcdev.o \
16+
mciomanx_backing.o \
17+
mcsio2.o \
18+
ps2mc_fio.o \
19+
ps1mc_fio.o \
20+
imports.o \
21+
exports.o
1422

1523
# Build the newer version of the memory card module?
1624
MCMAN_BUILDING_XMCMAN ?= 1
1725

1826
# Read from the dev9 external flash ROM instead of the memory card?
1927
MCMAN_BUILDING_XFROMMAN ?= 0
2028

29+
# Read from a file on the filesystem insead of the memory card?
30+
MCMAN_BUILDING_VMCMAN ?= 0
31+
2132
ifneq (x$(MCMAN_BUILDING_XMCMAN),x0)
2233
IOP_CFLAGS += -DBUILDING_XMCMAN
2334
endif
@@ -27,6 +38,12 @@ IOP_CFLAGS += -DBUILDING_XFROMMAN
2738
IOP_INCS += -I$(PS2SDKSRC)/iop/dev9/extflash/include
2839
endif
2940

41+
ifneq (x$(MCMAN_BUILDING_VMCMAN),x0)
42+
IOP_CFLAGS += -DBUILDING_VMCMAN
43+
IOP_CFLAGS += -DIOMANX_OLD_NAME_COMPATIBILITY=0
44+
IOP_CFLAGS += -DIOMANX_OLD_NAME_ADDDELDRV=0
45+
endif
46+
3047
include $(PS2SDKSRC)/Defs.make
3148
include $(PS2SDKSRC)/iop/Rules.bin.make
3249
include $(PS2SDKSRC)/iop/Rules.make

iop/memorycard/mcman/include/mcman.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ typedef struct _sceMcTblGetDir { // size = 64
2929
u16 Reserve1; // 22
3030
u32 Reserve2; // 24
3131
u32 PdaAplNo; // 28
32-
unsigned char EntryName[32]; // 32
32+
char EntryName[32]; // 32
3333
} sceMcTblGetDir;
3434

3535
int McDetectCard(int port, int slot);
36-
int McOpen(int port, int slot, char *filename, int flags);
36+
int McOpen(int port, int slot, const char *filename, int flags);
3737
int McClose(int fd);
3838
int McRead(int fd, void *buf, int length);
3939
int McWrite(int fd, void *buf, int length);
4040
int McSeek(int fd, int offset, int origin);
4141
int McFormat(int port, int slot);
42-
int McGetDir(int port, int slot, char *dirname, int flags, int maxent, sceMcTblGetDir *info);
43-
int McDelete(int port, int slot, char *filename, int flags);
42+
int McGetDir(int port, int slot, const char *dirname, int flags, int maxent, sceMcTblGetDir *info);
43+
int McDelete(int port, int slot, const char *filename, int flags);
4444
int McFlush(int fd);
45-
int McChDir(int port, int slot, char *newdir, char *currentdir);
46-
int McSetFileInfo(int port, int slot, char *filename, sceMcTblGetDir *info, int flags);
45+
int McChDir(int port, int slot, const char *newdir, char *currentdir);
46+
int McSetFileInfo(int port, int slot, const char *filename, sceMcTblGetDir *info, int flags);
4747
int McEraseBlock(int port, int block, void **pagebuf, void *eccbuf); //MCMAN v1.1 does not have a slot argument
4848
int McReadPage(int port, int slot, int page, void *buf);
4949
int McWritePage(int port, int slot, int page, void *pagebuf, void *eccbuf);
@@ -60,10 +60,12 @@ void McSetPS1CardFlag(int flag);
6060
int McEraseBlock2(int port, int slot, int block, void **pagebuf, void *eccbuf);
6161
int McDetectCard2(int port, int slot);
6262
int McGetFormat(int port, int slot);
63-
int McGetEntSpace(int port, int slot, char *dirname);
63+
int McGetEntSpace(int port, int slot, const char *dirname);
6464
int McReplaceBadBlock(void);
6565
int McCloseAll(void);
66+
#ifdef _IOP
6667
struct irx_id *McGetModuleInfo(void);
68+
#endif
6769
int McGetCardSpec(int port, int slot, s16 *pagesize, u16 *blocksize, int *cardsize, u8 *flags);
6870
int McGetFATentry(int port, int slot, int fat_index, int *fat_entry);
6971
int McCheckBlock(int port, int slot, int block);

iop/memorycard/mcman/src/imports.lst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ I_sio_printf
1010
sior_IMPORTS_end
1111
#endif
1212

13+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
1314
#ifndef BUILDING_XFROMMAN
1415
#ifdef BUILDING_XMCMAN
1516
#ifndef SIO2MAN_V2
@@ -33,6 +34,7 @@ I_sio2_transfer
3334
sio2man_IMPORTS_end
3435
#endif
3536
#endif
37+
#endif
3638

3739
loadcore_IMPORTS_start
3840
I_RegisterLibraryEntries
@@ -65,23 +67,39 @@ I_SignalSema
6567
I_WaitSema
6668
thsemap_IMPORTS_end
6769

70+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
6871
timrman_IMPORTS_start
6972
I_AllocHardTimer
7073
I_ReferHardTimer
7174
I_SetTimerMode
7275
I_GetTimerCounter
7376
timrman_IMPORTS_end
77+
#endif
7478

79+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
7580
modload_IMPORTS_start
7681
I_SetCheckKelfPathCallback
7782
modload_IMPORTS_end
83+
#endif
7884

85+
#if defined(BUILDING_VMCMAN)
86+
iomanX_IMPORTS_start
87+
I_iomanX_AddDrv
88+
I_iomanX_DelDrv
89+
I_iomanX_open
90+
I_iomanX_close
91+
I_iomanX_lseek
92+
I_iomanX_read
93+
I_iomanX_write
94+
iomanX_IMPORTS_end
95+
#else
7996
ioman_IMPORTS_start
8097
I_AddDrv
8198
I_DelDrv
8299
ioman_IMPORTS_end
100+
#endif
83101

84-
#ifndef BUILDING_XFROMMAN
102+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
85103
secrman_IMPORTS_start
86104
I_SecrSetMcCommandHandler
87105
I_SecrSetMcDevIDHandler

iop/memorycard/mcman/src/irx_imports.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
#include <fls.h>
2323
#endif
2424
#include <intrman.h>
25+
#ifdef BUILDING_VMCMAN
26+
#include <iomanX.h>
27+
#else
2528
#include <ioman.h>
29+
#endif
2630
#include <loadcore.h>
31+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
2732
#include <modload.h>
2833
#include <secrman.h>
29-
#ifndef BUILDING_XFROMMAN
3034
#ifdef BUILDING_XMCMAN
3135
#ifndef SIO2MAN_V2
3236
#include <xsio2man.h>
@@ -42,7 +46,9 @@
4246
#endif
4347
#include <stdio.h>
4448
#include <sysclib.h>
49+
#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN)
4550
#include <timrman.h>
51+
#endif
4652
#include <thbase.h>
4753
#include <thsemap.h>
4854

0 commit comments

Comments
 (0)