mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-03 08:51:22 +00:00
commit
2e309e8445
|
@ -1,46 +1,46 @@
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
#include "src\\EasyBMP.cpp"
|
#include "src\\EasyBMP.cpp"
|
||||||
#else
|
#else
|
||||||
#include "src/EasyBMP.cpp"
|
#include "src/EasyBMP.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8 *image_decode_bmp(uint8 *content,int32 bytes,int32 *result,int32 *x,int32 *y){
|
uint8 *image_decode_bmp(uint8 *content,int32 bytes,int32 *result,int32 *x,int32 *y){
|
||||||
//Result:bit 1=Success,bit 2=32bit[BGRA]
|
//Result:bit 1=Success,bit 2=32bit[BGRA]
|
||||||
*result=0;
|
*result=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BMP bm;
|
BMP bm;
|
||||||
|
|
||||||
if(!bm.ReadFromMemory((char*)content, bytes)){
|
if(!bm.ReadFromMemory((char*)content, bytes)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int32 h,w;
|
int32 h,w;
|
||||||
h=bm.TellHeight();
|
h=bm.TellHeight();
|
||||||
w=bm.TellWidth();
|
w=bm.TellWidth();
|
||||||
|
|
||||||
uint8 *out;
|
uint8 *out;
|
||||||
out=(uint8*)malloc(h*w*4);
|
out=(uint8*)malloc(h*w*4);
|
||||||
|
|
||||||
uint8* o;
|
uint8* o;
|
||||||
int32 x2,y2;
|
int32 x2,y2;
|
||||||
o=out;
|
o=out;
|
||||||
for (y2=0;y2<h;y2++){
|
for (y2=0;y2<h;y2++){
|
||||||
for (x2=0;x2<w;x2++){
|
for (x2=0;x2<w;x2++){
|
||||||
*o=bm(x2,y2)->Blue; o++;
|
*o=bm(x2,y2)->Blue; o++;
|
||||||
*o=bm(x2,y2)->Green; o++;
|
*o=bm(x2,y2)->Green; o++;
|
||||||
*o=bm(x2,y2)->Red; o++;
|
*o=bm(x2,y2)->Red; o++;
|
||||||
*o=255; o++;
|
*o=255; o++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*result=1+2;
|
*result=1+2;
|
||||||
*x=w;
|
*x=w;
|
||||||
*y=h;
|
*y=h;
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,110 +1,110 @@
|
||||||
extern uint32 matchcol(int32 r,int32 g,int32 b);
|
extern uint32 matchcol(int32 r,int32 g,int32 b);
|
||||||
|
|
||||||
#ifndef DEPENDENCY_IMAGE_CODEC
|
#ifndef DEPENDENCY_IMAGE_CODEC
|
||||||
//Stub(s):
|
//Stub(s):
|
||||||
int32 func__loadimage(qbs *f,int32 bpp,int32 passed);
|
int32 func__loadimage(qbs *f,int32 bpp,int32 passed);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
#include "decode\\jpg\\src.c"
|
#include "decode\\jpg\\src.c"
|
||||||
#include "decode\\png\\src.c"
|
#include "decode\\png\\src.c"
|
||||||
#include "decode\\bmp\\src.c"
|
#include "decode\\bmp\\src.c"
|
||||||
#include "decode\\other\\src.c" //PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM(PPM/PGM)
|
#include "decode\\other\\src.c" //PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM(PPM/PGM)
|
||||||
#else
|
#else
|
||||||
#include "decode/jpg/src.c"
|
#include "decode/jpg/src.c"
|
||||||
#include "decode/png/src.c"
|
#include "decode/png/src.c"
|
||||||
#include "decode/bmp/src.c"
|
#include "decode/bmp/src.c"
|
||||||
#include "decode/other/src.c" //PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM(PPM/PGM)
|
#include "decode/other/src.c" //PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM(PPM/PGM)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32 func__loadimage(qbs *f,int32 bpp,int32 passed){
|
int32 func__loadimage(qbs *f,int32 bpp,int32 passed){
|
||||||
if (new_error) return 0;
|
if (new_error) return 0;
|
||||||
|
|
||||||
static int32 isHardware;
|
static int32 isHardware;
|
||||||
isHardware=0; if (bpp==33){bpp=32; isHardware=1;}
|
isHardware=0; if (bpp==33){bpp=32; isHardware=1;}
|
||||||
|
|
||||||
//validate bpp
|
//validate bpp
|
||||||
if (passed){
|
if (passed){
|
||||||
if ((bpp!=32)&&(bpp!=256)){error(5); return 0;}
|
if ((bpp!=32)&&(bpp!=256)){error(5); return 0;}
|
||||||
}else{
|
}else{
|
||||||
if (write_page->text){error(5); return 0;}
|
if (write_page->text){error(5); return 0;}
|
||||||
bpp=-1;
|
bpp=-1;
|
||||||
}
|
}
|
||||||
if (!f->len) return -1; //return invalid handle if null length string
|
if (!f->len) return -1; //return invalid handle if null length string
|
||||||
if (bpp==256) return -1; //return invalid handle if 256-color mode requested (not valid in this version)
|
if (bpp==256) return -1; //return invalid handle if 256-color mode requested (not valid in this version)
|
||||||
|
|
||||||
//load the file
|
//load the file
|
||||||
int32 fh,result = 0;
|
int32 fh,result = 0;
|
||||||
int64 lof;
|
int64 lof;
|
||||||
fh=gfs_open(f,1,0,0);
|
fh=gfs_open(f,1,0,0);
|
||||||
if (fh<0) return -1;
|
if (fh<0) return -1;
|
||||||
lof=gfs_lof(fh);
|
lof=gfs_lof(fh);
|
||||||
static uint8* content;
|
static uint8* content;
|
||||||
content=(uint8*)malloc(lof); if (!content){gfs_close(fh); return -1;}
|
content=(uint8*)malloc(lof); if (!content){gfs_close(fh); return -1;}
|
||||||
result=gfs_read(fh,-1,content,lof);
|
result=gfs_read(fh,-1,content,lof);
|
||||||
gfs_close(fh);
|
gfs_close(fh);
|
||||||
if (result<0){free(content); return -1;}
|
if (result<0){free(content); return -1;}
|
||||||
|
|
||||||
//Identify format:
|
//Identify format:
|
||||||
static int32 format;
|
static int32 format;
|
||||||
format=0;
|
format=0;
|
||||||
|
|
||||||
//'.png'
|
//'.png'
|
||||||
if (lof>=8){
|
if (lof>=8){
|
||||||
if ((content[0]==0x89)&&(content[1]==0x50)&&(content[2]==0x4E)&&(content[3]==0x47)&&
|
if ((content[0]==0x89)&&(content[1]==0x50)&&(content[2]==0x4E)&&(content[3]==0x47)&&
|
||||||
(content[4]==0x0D)&&(content[5]==0x0A)&&(content[6]==0x1A)&&(content[7]==0x0A))
|
(content[4]==0x0D)&&(content[5]==0x0A)&&(content[6]==0x1A)&&(content[7]==0x0A))
|
||||||
{format=2; goto got_format;}//PNG
|
{format=2; goto got_format;}//PNG
|
||||||
}//8
|
}//8
|
||||||
|
|
||||||
//'.bmp'
|
//'.bmp'
|
||||||
if (lof>=6){
|
if (lof>=6){
|
||||||
if ((content[0]==0x42)&&(content[1]==0x4D)){
|
if ((content[0]==0x42)&&(content[1]==0x4D)){
|
||||||
if ( (*((int32*)(&content[2]))) == lof ){//length of file
|
if ( (*((int32*)(&content[2]))) == lof ){//length of file
|
||||||
format=3; goto got_format;
|
format=3; goto got_format;
|
||||||
}
|
}
|
||||||
}//BMP
|
}//BMP
|
||||||
}//6
|
}//6
|
||||||
|
|
||||||
//'.jpg' The first two bytes of every JPEG stream are the Start Of Image (SOI) marker values FFh D8h
|
//'.jpg' The first two bytes of every JPEG stream are the Start Of Image (SOI) marker values FFh D8h
|
||||||
if (lof>=2){
|
if (lof>=2){
|
||||||
if ((content[0]==0xFF)&&(content[1]==0xD8)){format=1; goto got_format;}//JP[E]G
|
if ((content[0]==0xFF)&&(content[1]==0xD8)){format=1; goto got_format;}//JP[E]G
|
||||||
}//2
|
}//2
|
||||||
|
|
||||||
got_format:
|
got_format:
|
||||||
|
|
||||||
static uint8 *pixels;
|
static uint8 *pixels;
|
||||||
static int32 x,y;
|
static int32 x,y;
|
||||||
|
|
||||||
if (format==1) pixels=image_decode_jpg(content,lof,&result,&x,&y);
|
if (format==1) pixels=image_decode_jpg(content,lof,&result,&x,&y);
|
||||||
if (format==2) pixels=image_decode_png(content,lof,&result,&x,&y);
|
if (format==2) pixels=image_decode_png(content,lof,&result,&x,&y);
|
||||||
if (format==3) pixels=image_decode_bmp(content,lof,&result,&x,&y);
|
if (format==3) pixels=image_decode_bmp(content,lof,&result,&x,&y);
|
||||||
if (!(result & 1)) {
|
if (!(result & 1)) {
|
||||||
pixels=image_decode_other(content,lof,&result,&x,&y);
|
pixels=image_decode_other(content,lof,&result,&x,&y);
|
||||||
}
|
}
|
||||||
free(content);
|
free(content);
|
||||||
if (!(result&1)) return -1;
|
if (!(result&1)) return -1;
|
||||||
|
|
||||||
//...
|
//...
|
||||||
|
|
||||||
static int32 i;
|
static int32 i;
|
||||||
static int32 prevDest;
|
static int32 prevDest;
|
||||||
static uint16 scanX, scanY;
|
static uint16 scanX, scanY;
|
||||||
static uint8 red, green, blue;
|
static uint8 red, green, blue;
|
||||||
|
|
||||||
i=func__newimage(x,y,32,1);
|
i=func__newimage(x,y,32,1);
|
||||||
if (i==-1){free(pixels); return -1;}
|
if (i==-1){free(pixels); return -1;}
|
||||||
memcpy(img[-i].offset,pixels,x*y*4);
|
memcpy(img[-i].offset,pixels,x*y*4);
|
||||||
|
|
||||||
free(pixels);
|
free(pixels);
|
||||||
|
|
||||||
if (isHardware){
|
if (isHardware){
|
||||||
static int32 iHardware;
|
static int32 iHardware;
|
||||||
iHardware=func__copyimage(i,33,1);
|
iHardware=func__copyimage(i,33,1);
|
||||||
sub__freeimage(i,1);
|
sub__freeimage(i,1);
|
||||||
i=iHardware;
|
i=iHardware;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,27 +29,19 @@ IF LoadedIDESettings = 0 THEN
|
||||||
|
|
||||||
GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one
|
GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one
|
||||||
|
|
||||||
IF INSTR(_OS$, "WIN") THEN
|
result = ReadConfigSetting("AllowIndependentSettings", value$)
|
||||||
|
IF result THEN
|
||||||
result = ReadConfigSetting("AllowIndependentSettings", value$)
|
IF value$ = "TRUE" OR ABS(VAL(value$)) = 1 THEN 'We default to false and only use one set of IDE settings, no matter how many windows we open up
|
||||||
IF result THEN
|
IDE_Index$ = "(" + LTRIM$(RTRIM$(STR$(tempfolderindex))) + ")"
|
||||||
IF value$ = "TRUE" OR ABS(VAL(value$)) = 1 THEN 'We default to false and only use one set of IDE settings, no matter how many windows we open up
|
ConfigFile$ = "internal/config" + IDE_Index$ + ".txt"
|
||||||
IDE_Index$ = "(" + LTRIM$(RTRIM$(STR$(tempfolderindex))) + ")"
|
ConfigBak$ = "internal/config" + IDE_Index$ + ".bak"
|
||||||
ConfigFile$ = "internal/config" + IDE_Index$ + ".txt"
|
GOSUB CheckConfigFileExists
|
||||||
ConfigBak$ = "internal/config" + IDE_Index$ + ".bak"
|
|
||||||
GOSUB CheckConfigFileExists
|
|
||||||
ELSE
|
|
||||||
WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE"
|
|
||||||
IDE_Index$ = ""
|
|
||||||
END IF
|
|
||||||
ELSE
|
ELSE
|
||||||
WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE"
|
WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE"
|
||||||
IDE_Index$ = ""
|
IDE_Index$ = ""
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
'Linux doesn't offer multiple temp folders and thus can not work properly with independent settings
|
WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE"
|
||||||
'This option is not included on Linux, and if manually inserted will simply be ignored.
|
|
||||||
IDE_Index$ = ""
|
IDE_Index$ = ""
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,6 @@ DIM SHARED ideroot AS STRING
|
||||||
DIM SHARED idetxt(1000) AS STRING
|
DIM SHARED idetxt(1000) AS STRING
|
||||||
DIM SHARED idetxtlast AS INTEGER
|
DIM SHARED idetxtlast AS INTEGER
|
||||||
DIM SHARED idehl
|
DIM SHARED idehl
|
||||||
DIM SHARED idealtcode(255) AS INTEGER
|
|
||||||
DIM SHARED ideprogname AS STRING
|
DIM SHARED ideprogname AS STRING
|
||||||
DIM SHARED idepath AS STRING
|
DIM SHARED idepath AS STRING
|
||||||
DIM SHARED idefindtext AS STRING
|
DIM SHARED idefindtext AS STRING
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1048,16 +1048,6 @@ IF C = 9 THEN 'run
|
||||||
GOTO sendcommand
|
GOTO sendcommand
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'hack! (a new message should be sent to the IDE stating C++ compilation was successful)
|
|
||||||
COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window
|
|
||||||
IF idemode THEN
|
|
||||||
'Darken fg/bg colors
|
|
||||||
dummy = DarkenFGBG(1)
|
|
||||||
COLOR 15
|
|
||||||
END IF
|
|
||||||
LOCATE idewy - 3, 2: PRINT "Starting program...";
|
|
||||||
PCOPY 3, 0
|
|
||||||
|
|
||||||
'execute program
|
'execute program
|
||||||
|
|
||||||
IF iderunmode = 1 THEN
|
IF iderunmode = 1 THEN
|
||||||
|
|
Loading…
Reference in a new issue