Huge rewrite of the file loading/saving system. Normally safer in case of problem. Added incremental safety backups at regular intervals in the 'application data' directory (Windows) or $HOME/.grafx2 (unix). Keeps 8 files, saves every 30-60s and/or every 10-30 clicks.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1245 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
@@ -10,7 +10,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "const.h"
|
||||
#include "global.h"
|
||||
#include "struct.h"
|
||||
#include "loadsave.h"
|
||||
|
||||
unsigned short addrCalc(unsigned char vcc, unsigned char rcc, unsigned char hcc, unsigned char cclk, unsigned char r1, unsigned char r12, unsigned char r13)
|
||||
{
|
||||
@@ -26,35 +29,35 @@ unsigned short addrCalc(unsigned char vcc, unsigned char rcc, unsigned char hcc,
|
||||
return addr;
|
||||
}
|
||||
|
||||
unsigned char mode0interlace(unsigned char x, unsigned char y)
|
||||
unsigned char mode0interlace(T_IO_Context * context, unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned char mode0pixel[] = {0, 64, 4, 68, 16, 80, 20, 84, 1, 65, 5, 69, 17, 81, 21, 85};
|
||||
return mode0pixel[Read_pixel_function(x,y)] << 1 | mode0pixel[Read_pixel_function(x+1,y)];
|
||||
return mode0pixel[Get_pixel(context,x,y)] << 1 | mode0pixel[Get_pixel(context,x+1,y)];
|
||||
}
|
||||
|
||||
unsigned char mode1interlace(unsigned char x, unsigned char y)
|
||||
unsigned char mode1interlace(T_IO_Context * context, unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned char mode1pixel[] = {0, 16, 1, 17};
|
||||
return mode1pixel[Read_pixel_function(x,y)] << 3 | mode1pixel[Read_pixel_function(x+1,y)] << 2 | mode1pixel[Read_pixel_function(x+2,y)] << 1 | mode1pixel[Read_pixel_function(x+3,y)];
|
||||
return mode1pixel[Get_pixel(context,x,y)] << 3 | mode1pixel[Get_pixel(context,x+1,y)] << 2 | mode1pixel[Get_pixel(context,x+2,y)] << 1 | mode1pixel[Get_pixel(context,x+3,y)];
|
||||
}
|
||||
|
||||
unsigned char mode2interlace(unsigned char x, unsigned char y)
|
||||
unsigned char mode2interlace(T_IO_Context * context, unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned char out = 0;
|
||||
int i;
|
||||
for(i = 0; i < 8; i++) out += ((Read_pixel_function(x+7-i,y)&1) << i);
|
||||
for(i = 0; i < 8; i++) out += ((Get_pixel(context,x+7-i,y)&1) << i);
|
||||
return out;
|
||||
}
|
||||
|
||||
unsigned char mode3interlace(unsigned char x, unsigned char y)
|
||||
unsigned char mode3interlace(T_IO_Context * context, unsigned char x, unsigned char y)
|
||||
{
|
||||
unsigned char mode3pixel[] = {0, 16, 1, 17};
|
||||
return mode3pixel[Read_pixel_function(x,y)] << 3 | mode3pixel[Read_pixel_function(x+1,y)] << 2;
|
||||
return mode3pixel[Get_pixel(context, x,y)] << 3 | mode3pixel[Get_pixel(context,x+1,y)] << 2;
|
||||
}
|
||||
|
||||
unsigned char (*ptrMode)(unsigned char x, unsigned char y);
|
||||
unsigned char (*ptrMode)(T_IO_Context * context, unsigned char x, unsigned char y);
|
||||
|
||||
unsigned char *raw2crtc(unsigned short width, unsigned short height, unsigned char mode, unsigned char r9, unsigned long *outSize, unsigned char *r1, unsigned char r12, unsigned char r13)
|
||||
unsigned char *raw2crtc(T_IO_Context *context, unsigned short width, unsigned short height, unsigned char mode, unsigned char r9, unsigned long *outSize, unsigned char *r1, unsigned char r12, unsigned char r13)
|
||||
{
|
||||
unsigned char *outBuffer;
|
||||
unsigned char *tmpBuffer;
|
||||
@@ -137,7 +140,7 @@ unsigned char *raw2crtc(unsigned short width, unsigned short height, unsigned ch
|
||||
{
|
||||
x = (hcc << 1 | cclk);
|
||||
y = vcc*(r9+1) + rcc;
|
||||
*(tmpBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) = (*ptrMode)(x,y);
|
||||
*(tmpBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) = (*ptrMode)(context,x,y);
|
||||
*(allocationBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user