PCread//PCseek/PCopen ok
This commit is contained in:
parent
59c50e4356
commit
e0e23bee34
45
ovl-upload.c
45
ovl-upload.c
|
@ -129,7 +129,7 @@ uint32_t checkSum = 0;
|
|||
|
||||
volatile u_char inBuffer[BUFFER_LEN] = {0};
|
||||
|
||||
volatile u_char dataBuffer[64] = "ALLEZONYVALESENFANTS";
|
||||
volatile u_char dataBuffer[64] = "";
|
||||
|
||||
// Prototypes
|
||||
|
||||
|
@ -212,7 +212,9 @@ void LoadTexture(u_long * tim, TIM_IMAGE * tparam){ // This part is from Lam
|
|||
|
||||
}
|
||||
|
||||
int returnVal = 0;
|
||||
int fileDesc = 0;
|
||||
int fileRead = 0;
|
||||
int filePos = 0;
|
||||
|
||||
int fileCreated = 0;
|
||||
|
||||
|
@ -279,16 +281,35 @@ int main() {
|
|||
|
||||
while (1) {
|
||||
|
||||
FntPrint("%08d - ", returnVal);
|
||||
FntPrint("%02d - %04d", fileDesc, filePos );
|
||||
|
||||
//~ if ( returnVal > 0 ){
|
||||
|
||||
//~ returnVal = PCopen("HELO.WLD", O_RDWR, inBuffer);
|
||||
// If filedescriptor is not null and not -1, try to open the file
|
||||
|
||||
if ( fileDesc > 0 ){
|
||||
|
||||
//~ fileCreated = returnVal;
|
||||
|
||||
//~ returnVal = 0;
|
||||
//~ }
|
||||
switch (fileRead){
|
||||
|
||||
case 0: PCread(fileDesc, filePos, 7, dataBuffer, inBuffer);
|
||||
|
||||
fileRead = 1;
|
||||
|
||||
case 1: PCseek( fileDesc, 7, 3, 1, inBuffer);
|
||||
|
||||
fileRead = 2;
|
||||
|
||||
case 2: PCread(fileDesc, 10, 7, dataBuffer + 7, inBuffer);
|
||||
|
||||
fileRead = 3;
|
||||
|
||||
default: PCclose(fileDesc, inBuffer);
|
||||
|
||||
fileDesc = 0;
|
||||
|
||||
fileRead = 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Overlay switch
|
||||
|
||||
|
@ -326,13 +347,13 @@ int main() {
|
|||
|
||||
#ifndef USECD
|
||||
|
||||
//~ returnVal = PCopen("HELO.WLD", O_RDWR, inBuffer);
|
||||
fileDesc = PCopen("HELO.WLD", O_RDWR, inBuffer);
|
||||
//~ returnVal = PCcreate("HELO.WLD", O_RDWR, inBuffer);
|
||||
//~ returnVal = PCseek(1, 0, 369, 1, inBuffer);
|
||||
//~ returnVal = PCread(88, 369, 16, dataBuffer, inBuffer);
|
||||
returnVal = PCwrite(88, 10, 5, dataBuffer, inBuffer);
|
||||
//~ returnVal = PCwrite(88, 10, 5, dataBuffer, inBuffer);
|
||||
|
||||
if ( returnVal ){
|
||||
if ( fileDesc ){
|
||||
|
||||
loadFileIDwas = overlayFileID;
|
||||
|
||||
|
|
|
@ -547,9 +547,9 @@ def resetListener():
|
|||
|
||||
Listen = 1
|
||||
|
||||
ser.reset_input_buffer()
|
||||
# ~ ser.reset_input_buffer()
|
||||
|
||||
ser.reset_output_buffer()
|
||||
# ~ ser.reset_output_buffer()
|
||||
|
||||
def main(args):
|
||||
|
||||
|
@ -963,9 +963,9 @@ def main(args):
|
|||
|
||||
# mode can be 0 (rel to start), 1(rel to cur pos), 2 (rel to end)
|
||||
|
||||
# ~ fd = int( paramBuffer['fileDesc'] )
|
||||
fd = int( paramBuffer['fileDesc'] )
|
||||
|
||||
fd = files.open("work/" + 'HELO.WLD', os.O_RDWR)
|
||||
# ~ fd = files.open("work/" + 'HELO.WLD', os.O_RDWR)
|
||||
|
||||
mode = int( paramBuffer['accessMode'] )
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ def main(args):
|
|||
|
||||
try:
|
||||
|
||||
# TODO : replace os.lseek() with file.lseek
|
||||
# TODO : replace os.lseek() with file.lseek ?
|
||||
|
||||
curPos = os.lseek( fd, pos, mode )
|
||||
|
||||
|
@ -1061,9 +1061,9 @@ def main(args):
|
|||
|
||||
print("Received READ.")
|
||||
|
||||
# ~ fd = int( paramBuffer['fileDesc'] )
|
||||
fd = int( paramBuffer['fileDesc'] )
|
||||
|
||||
fd = files.open("work/" + 'HELO.WLD', os.O_RDWR)
|
||||
# ~ fd = files.open("work/" + 'HELO.WLD', os.O_RDWR)
|
||||
|
||||
length = int( paramBuffer['length'] )
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ def main(args):
|
|||
|
||||
try:
|
||||
|
||||
# TODO : replace os.pread() with file.pread
|
||||
# TODO : replace os.pread() with file.pread ?
|
||||
|
||||
readBytes = os.pread( fd, length, pos )
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ def main(args):
|
|||
|
||||
try:
|
||||
|
||||
# TODO : replace os.pread() with file.pread
|
||||
# TODO : replace os.pwrite() with file.pwrite ?
|
||||
|
||||
writeBytes = os.pwrite( fd, bytes( data, 'ascii' ), pos )
|
||||
|
||||
|
|
Loading…
Reference in New Issue