mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
Ease 68K/ARM communication
svn-id: r19042
This commit is contained in:
parent
89e27f5edc
commit
625520882c
@ -1,9 +1,19 @@
|
||||
#include <PalmOS.h>
|
||||
#include "palmdefs.h"
|
||||
#include "args.h"
|
||||
#include "pace.h"
|
||||
|
||||
Char **ArgsInit() {
|
||||
MemHandle argvH = MemHandleNew(MAX_ARG * sizeof(Char *));
|
||||
Char **argvP = (Char **)MemHandleLock(argvH);
|
||||
// first 4 bytes keep the real address of the chunk
|
||||
MemHandle argvH = MemHandleNew(sizeof(Char *) + (MAX_ARG * sizeof(Char **) + 2));
|
||||
// real addr
|
||||
Char *lockP = (Char *)MemHandleLock(argvH);
|
||||
// 4byte aligned
|
||||
Char **argvP = (Char **)ALIGN_4BYTE(lockP);
|
||||
// save real addr
|
||||
argvP[0] = lockP;
|
||||
// initial position
|
||||
argvP++;
|
||||
|
||||
for(UInt8 count = 0; count < MAX_ARG; count++)
|
||||
argvP[count] = NULL;
|
||||
@ -45,7 +55,8 @@ void ArgsFree(Char **argvP) {
|
||||
MemHandleFree(oldH);
|
||||
}
|
||||
|
||||
oldH = MemPtrRecoverHandle(argvP);
|
||||
argvP--;
|
||||
oldH = MemPtrRecoverHandle(argvP[0]);
|
||||
MemHandleUnlock(oldH);
|
||||
MemHandleFree(oldH);
|
||||
}
|
||||
@ -60,10 +71,35 @@ void ArgsSetOwner(Char **argvP, UInt16 owner) {
|
||||
if (argvP[count]) {
|
||||
oldH = MemPtrRecoverHandle(argvP[count]);
|
||||
MemHandleSetOwner(oldH, owner);
|
||||
// MemPtrSetOwner(argvP[count], 0);
|
||||
}
|
||||
|
||||
oldH = MemPtrRecoverHandle(argvP);
|
||||
argvP--;
|
||||
oldH = MemPtrRecoverHandle(argvP[0]);
|
||||
MemHandleSetOwner(oldH, owner);
|
||||
// MemPtrSetOwner(argvP, 0);
|
||||
}
|
||||
|
||||
void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm) {
|
||||
if (arm) {
|
||||
for(UInt8 count = 0; count < MAX_ARG; count++)
|
||||
if (argvP[count])
|
||||
argvP[count] = (Char *)ByteSwap32(argvP[count]);
|
||||
}
|
||||
|
||||
FtrSet(appFileCreator, ftrArgsData , (UInt32)argvP);
|
||||
FtrSet(appFileCreator, ftrArgsCount, (UInt32)countArg);
|
||||
}
|
||||
|
||||
void ArgsExportRelease(Boolean arm) {
|
||||
if (arm) {
|
||||
Char **argvP;
|
||||
Err e = FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP);
|
||||
|
||||
if (argvP)
|
||||
for(UInt8 count = 0; count < MAX_ARG; count++)
|
||||
if (argvP[count])
|
||||
argvP[count] = (Char *)ByteSwap32(argvP[count]);
|
||||
}
|
||||
|
||||
FtrUnregister(appFileCreator, ftrArgsCount);
|
||||
FtrUnregister(appFileCreator, ftrArgsData);
|
||||
}
|
||||
|
@ -3,9 +3,16 @@
|
||||
|
||||
#define MAX_ARG 25
|
||||
|
||||
#define ftrArgsData 1300
|
||||
#define ftrArgsCount 1301
|
||||
#define ftrVars 1302
|
||||
|
||||
Char **ArgsInit();
|
||||
void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP);
|
||||
void ArgsFree(Char **argvP);
|
||||
void ArgsSetOwner(Char **argvP, UInt16 owner);
|
||||
|
||||
#endif
|
||||
void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm);
|
||||
void ArgsExportRelease(Boolean arm);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user