mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Update lib to rzx specifications v13
This commit is contained in:
parent
9dd5812a8b
commit
393db594ba
@ -5,6 +5,8 @@
|
|||||||
=================================================================
|
=================================================================
|
||||||
Library version: 0.12 - last updated: 04 August 2002
|
Library version: 0.12 - last updated: 04 August 2002
|
||||||
Created by Ramsoft ZX Spectrum demogroup
|
Created by Ramsoft ZX Spectrum demogroup
|
||||||
|
Library version: 0.13 - last updated: 23 February 2015
|
||||||
|
Upadate by Fabio Olimpieri
|
||||||
|
|
||||||
This is free software. Permission to use it in non-commercial and
|
This is free software. Permission to use it in non-commercial and
|
||||||
commercial products is hereby granted at the terms of the present
|
commercial products is hereby granted at the terms of the present
|
||||||
@ -41,8 +43,10 @@ extern "C" {
|
|||||||
#define RZXBLK_SESSION 0x11
|
#define RZXBLK_SESSION 0x11
|
||||||
#define RZXBLK_COMMENT 0x12
|
#define RZXBLK_COMMENT 0x12
|
||||||
#define RZXBLK_SECURITY 0x20
|
#define RZXBLK_SECURITY 0x20
|
||||||
|
#define RZXBLK_SEC_SIG 0x21
|
||||||
#define RZXBLK_SNAP 0x30
|
#define RZXBLK_SNAP 0x30
|
||||||
#define RZXBLK_DATA 0x80
|
#define RZXBLK_DATA 0x80
|
||||||
|
#define RZXBLK_UNKNOWN 0x00
|
||||||
|
|
||||||
/* RZX internal status codes */
|
/* RZX internal status codes */
|
||||||
#define RZX_INIT 0x0001
|
#define RZX_INIT 0x0001
|
||||||
@ -226,10 +230,18 @@ int rzx_scan()
|
|||||||
/* signal that the RZX contains at least one encrypted block */
|
/* signal that the RZX contains at least one encrypted block */
|
||||||
rzx.options|=RZX_PROTECTED;
|
rzx.options|=RZX_PROTECTED;
|
||||||
rzx.options|=RZX_SEALED;
|
rzx.options|=RZX_SEALED;
|
||||||
|
emul_handler(RZXMSG_SECURITY,NULL);
|
||||||
break;
|
break;
|
||||||
case RZXBLK_DATA:
|
case RZXBLK_DATA:
|
||||||
fread(block.buff,13,1,rzxfile);
|
fread(block.buff,13,1,rzxfile);
|
||||||
|
break;
|
||||||
|
case RZXBLK_SEC_SIG:
|
||||||
|
emul_handler(RZXMSG_SEC_SIG,NULL);
|
||||||
|
break;
|
||||||
|
case RZXBLK_SNAP:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
emul_handler(RZXMSG_UNKNOWN,NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fpos+=block.length;
|
fpos+=block.length;
|
||||||
@ -318,7 +330,7 @@ int rzx_seek_irb()
|
|||||||
/* if you can't, skip to next block */
|
/* if you can't, skip to next block */
|
||||||
if(snapfile==NULL) break;
|
if(snapfile==NULL) break;
|
||||||
/* ok */
|
/* ok */
|
||||||
rzx_snap.options|=RZX_EXTERNAL|RZX_REMOVE;
|
rzx_snap.options|=RZX_REMOVE;
|
||||||
fpos=rzx_snap.length;
|
fpos=rzx_snap.length;
|
||||||
while(fpos>0)
|
while(fpos>0)
|
||||||
{
|
{
|
||||||
@ -346,7 +358,7 @@ int rzx_seek_irb()
|
|||||||
rzx_snap.options|=RZX_EXTERNAL;
|
rzx_snap.options|=RZX_EXTERNAL;
|
||||||
}
|
}
|
||||||
/* tell the host emulator to load the snapshot */
|
/* tell the host emulator to load the snapshot */
|
||||||
emul_handler(RZXMSG_LOADSNAP,&rzx_snap);
|
if (emul_handler(RZXMSG_LOADSNAP,&rzx_snap)) return RZX_INVALID;
|
||||||
if(rzx_snap.options&RZX_REMOVE) remove(rzx_snap.filename);
|
if(rzx_snap.options&RZX_REMOVE) remove(rzx_snap.filename);
|
||||||
break;
|
break;
|
||||||
case RZXBLK_DATA:
|
case RZXBLK_DATA:
|
||||||
@ -384,6 +396,10 @@ int rzx_seek_irb()
|
|||||||
case RZXBLK_SECURITY:
|
case RZXBLK_SECURITY:
|
||||||
/* set the new security parameters */
|
/* set the new security parameters */
|
||||||
break;
|
break;
|
||||||
|
case RZXBLK_SEC_SIG:
|
||||||
|
break;
|
||||||
|
case RZXBLK_CREATOR:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -458,6 +474,7 @@ int rzx_playback(const char *filename)
|
|||||||
return RZX_FINISHED;
|
return RZX_FINISHED;
|
||||||
}
|
}
|
||||||
INcount=0;
|
INcount=0;
|
||||||
|
INmax=0;
|
||||||
INold=0xFFFF;
|
INold=0xFFFF;
|
||||||
return RZX_OK;
|
return RZX_OK;
|
||||||
}
|
}
|
||||||
@ -574,7 +591,7 @@ int rzx_update(rzx_u16 *icount)
|
|||||||
return RZX_FINISHED;
|
return RZX_FINISHED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (INmax!=INcount) {printf("Too few inputs read %d\n", INmax -INcount); return RZX_SYNCLOST;}
|
||||||
/* fetch the instruction and IN counters */
|
/* fetch the instruction and IN counters */
|
||||||
INold=INmax;
|
INold=INmax;
|
||||||
#ifdef RZX_USE_COMPRESSION
|
#ifdef RZX_USE_COMPRESSION
|
||||||
@ -593,14 +610,14 @@ int rzx_update(rzx_u16 *icount)
|
|||||||
|
|
||||||
/* update the input array */
|
/* update the input array */
|
||||||
#ifdef RZX_USE_COMPRESSION
|
#ifdef RZX_USE_COMPRESSION
|
||||||
if(INmax&&(INmax!=0xFFFF))
|
if(INmax!=0xFFFF)
|
||||||
{
|
{
|
||||||
if(rzx_status&RZX_PACK) rzx_pread(inputbuffer,INmax);
|
if(rzx_status&RZX_PACK) rzx_pread(inputbuffer,INmax);
|
||||||
else fread(inputbuffer,INmax,1,rzxfile);
|
else fread(inputbuffer,INmax,1,rzxfile);
|
||||||
}
|
}
|
||||||
else INmax=INold;
|
else INmax=INold;
|
||||||
#else
|
#else
|
||||||
if(INmax&&(INmax!=0xFFFF)) fread(inputbuffer,INmax,1,rzxfile);
|
if(INmax!=0xFFFF) fread(inputbuffer,INmax,1,rzxfile);
|
||||||
else INmax=INold;
|
else INmax=INold;
|
||||||
#endif
|
#endif
|
||||||
INcount=0;
|
INcount=0;
|
||||||
@ -667,7 +684,7 @@ int rzx_update(rzx_u16 *icount)
|
|||||||
#ifdef RZX_USE_COMPRESSION
|
#ifdef RZX_USE_COMPRESSION
|
||||||
if(rzx_status&RZX_PACK) rzx_pwrite(block.buff,4);
|
if(rzx_status&RZX_PACK) rzx_pwrite(block.buff,4);
|
||||||
else fwrite(block.buff,4,1,rzxfile);
|
else fwrite(block.buff,4,1,rzxfile);
|
||||||
if(INcount&&(INcount!=0xFFFF))
|
if(INcount!=0xFFFF)
|
||||||
{
|
{
|
||||||
if(rzx_status&RZX_PACK) rzx_pwrite(inputbuffer,INcount);
|
if(rzx_status&RZX_PACK) rzx_pwrite(inputbuffer,INcount);
|
||||||
else fwrite(inputbuffer,INcount,1,rzxfile);
|
else fwrite(inputbuffer,INcount,1,rzxfile);
|
||||||
@ -678,7 +695,7 @@ int rzx_update(rzx_u16 *icount)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fwrite(block.buff,4,1,rzxfile);
|
fwrite(block.buff,4,1,rzxfile);
|
||||||
if(INcount&&(INcount!=0xFFFF))
|
if(INcount!=0xFFFF)
|
||||||
{
|
{
|
||||||
fwrite(inputbuffer,INcount,1,rzxfile);
|
fwrite(inputbuffer,INcount,1,rzxfile);
|
||||||
xchgp=inputbuffer;
|
xchgp=inputbuffer;
|
||||||
@ -705,7 +722,7 @@ void rzx_store_input(rzx_u8 value)
|
|||||||
|
|
||||||
rzx_u8 rzx_get_input(void)
|
rzx_u8 rzx_get_input(void)
|
||||||
{
|
{
|
||||||
if(INcount>=INmax) return RZX_SYNCLOST;
|
if(INcount>=INmax) {printf("Too many inputs read\n"); return RZX_SYNCLOST;};
|
||||||
return inputbuffer[INcount++];
|
return inputbuffer[INcount++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
Input Recording Library for ZX Spectrum emulators
|
Input Recording Library for ZX Spectrum emulators
|
||||||
=================================================================
|
=================================================================
|
||||||
Library version: 0.12 - last updated: 4 August 2002
|
Library version: 0.12 - last updated: 4 August 2002
|
||||||
|
Created by Ramsoft ZX Spectrum demogroup
|
||||||
|
Library version: 0.13 - last updated: 23 February 2015
|
||||||
|
Upadate by Fabio Olimpieri
|
||||||
|
|
||||||
<license goes here>
|
This is free software. Permission to use it in non-commercial and
|
||||||
|
commercial products is hereby granted at the terms of the present
|
||||||
|
licence:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -16,8 +21,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define RZX_LIBRARY_VERSION 0x000C
|
#define RZX_LIBRARY_VERSION 0x000D
|
||||||
#define RZX_LIBRARY_BUILD 31
|
#define RZX_LIBRARY_BUILD 1
|
||||||
|
|
||||||
|
|
||||||
/* ******************** Configuration options ******************** */
|
/* ******************** Configuration options ******************** */
|
||||||
@ -58,6 +63,9 @@ typedef unsigned long int rzx_u32; /* must be unsigned 32-bit */
|
|||||||
#define RZXMSG_CREATOR 1
|
#define RZXMSG_CREATOR 1
|
||||||
#define RZXMSG_LOADSNAP 2
|
#define RZXMSG_LOADSNAP 2
|
||||||
#define RZXMSG_IRBNOTIFY 3
|
#define RZXMSG_IRBNOTIFY 3
|
||||||
|
#define RZXMSG_SECURITY 4
|
||||||
|
#define RZXMSG_SEC_SIG 5
|
||||||
|
#define RZXMSG_UNKNOWN 6
|
||||||
|
|
||||||
|
|
||||||
/* RZX global flags */
|
/* RZX global flags */
|
||||||
|
Loading…
Reference in New Issue
Block a user