compile error fixes

This commit is contained in:
d1str4ught
2025-08-19 01:08:41 +02:00
parent ea712bec83
commit 97a82baa4a
16 changed files with 2063 additions and 2062 deletions

View File

@@ -5,11 +5,6 @@ project(m2dev-client-src)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
add_compile_options("/Zc:__cplusplus")
add_compile_options("/Zc:preprocessor")
endif()
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/buildtool"
@@ -34,6 +29,7 @@ add_compile_options(
)
add_definitions(-DNOMINMAX)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DWINDOWS_IGNORE_PACKING_MISMATCH)

File diff suppressed because it is too large Load Diff

View File

@@ -6,14 +6,13 @@
extern "C" {
int WebBrowser_Startup(HINSTANCE hInstance);
void WebBrowser_Cleanup();
void WebBrowser_Destroy();
int WebBrowser_Show(HWND parent, const char* addr, const RECT* rcWebBrowser);
void WebBrowser_Hide();
void WebBrowser_Move(const RECT* rcWebBrowser);
int WebBrowser_IsVisible();
const RECT& WebBrowser_GetRect();
inline int WebBrowser_Startup(HINSTANCE hInstance) { return 0; }
inline void WebBrowser_Cleanup() {}
inline void WebBrowser_Destroy() {}
inline int WebBrowser_Show(HWND parent, const char* addr, const RECT* rcWebBrowser) { return 0; }
inline void WebBrowser_Hide() {}
inline void WebBrowser_Move(const RECT* rcWebBrowser) {}
inline int WebBrowser_IsVisible() { return 0; }
inline const RECT& WebBrowser_GetRect() { static RECT dummy; return dummy; }
}

View File

@@ -1,312 +1,312 @@
#include "StdAfx.h"
#include "JpegFile.h"
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <libjpeg-9a/jpeglib.h>
#include <libjpeg-9a/jpegLibLink.h>
#define OUTBUFFER_SIZE 0x8000
static FILE*fi;
static JOCTET * buffer;
static unsigned char*dest;
static int len;
static int destlen;
static unsigned char*data_d;
static int pos;
static int size_d;
static void file_init_destination(j_compress_ptr cinfo)
{
struct jpeg_destination_mgr*dmgr =
(struct jpeg_destination_mgr*)(cinfo->dest);
buffer = (JOCTET*)malloc(OUTBUFFER_SIZE);
if(!buffer) {
perror("malloc");
printf("Out of memory!\n");
exit(1);
}
dmgr->next_output_byte = buffer;
dmgr->free_in_buffer = OUTBUFFER_SIZE;
}
static unsigned char file_empty_output_buffer(j_compress_ptr cinfo)
{
struct jpeg_destination_mgr*dmgr =
(struct jpeg_destination_mgr*)(cinfo->dest);
if(fi)
fwrite(buffer, OUTBUFFER_SIZE, 1, fi);
dmgr->next_output_byte = buffer;
dmgr->free_in_buffer = OUTBUFFER_SIZE;
return 1;
}
static void file_term_destination(j_compress_ptr cinfo)
{ struct jpeg_destination_mgr*dmgr =
(struct jpeg_destination_mgr*)(cinfo->dest);
if(fi)
fwrite(buffer, OUTBUFFER_SIZE-dmgr->free_in_buffer, 1, fi);
free(buffer);
buffer = 0;
dmgr->free_in_buffer = 0;
}
static void mem_init_destination(j_compress_ptr cinfo)
{
struct jpeg_destination_mgr*dmgr =
(struct jpeg_destination_mgr*)(cinfo->dest);
dmgr->next_output_byte = dest;
dmgr->free_in_buffer = destlen;
}
static unsigned char mem_empty_output_buffer(j_compress_ptr cinfo)
{
printf("jpeg mem overflow!\n");
exit(1);
}
static void mem_term_destination(j_compress_ptr cinfo)
{
struct jpeg_destination_mgr*dmgr =
(struct jpeg_destination_mgr*)(cinfo->dest);
len = destlen - dmgr->free_in_buffer;
dmgr->free_in_buffer = 0;
}
int jpeg_save(unsigned char*data_d, int width, int height, int quality, const char*filename)
{
struct jpeg_destination_mgr mgr;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
int t;
if(filename) {
fi = fopen(filename, "wb");
if(fi == NULL)
return 0;
} else
fi = NULL;
memset(&cinfo, 0, sizeof(cinfo));
memset(&jerr, 0, sizeof(jerr));
memset(&mgr, 0, sizeof(mgr));
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
mgr.init_destination = file_init_destination;
mgr.empty_output_buffer = file_empty_output_buffer;
mgr.term_destination = file_term_destination;
cinfo.dest = &mgr;
// init compression
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo,quality,TRUE);
//jpeg_write_tables(&cinfo);
//jpeg_suppress_tables(&cinfo, TRUE);
jpeg_start_compress(&cinfo, FALSE);
for(t=0;t<height;t++) {
unsigned char*data2 = &data_d[width*3*t];
jpeg_write_scanlines(&cinfo, &data2, 1);
}
jpeg_finish_compress(&cinfo);
if(fi)
fclose(fi);
jpeg_destroy_compress(&cinfo);
return 1;
}
int jpeg_save_to_file(unsigned char*data_d, int width, int height, int quality, FILE*_fi)
{
struct jpeg_destination_mgr mgr;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
int t;
fi = _fi;
memset(&cinfo, 0, sizeof(cinfo));
memset(&jerr, 0, sizeof(jerr));
memset(&mgr, 0, sizeof(mgr));
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
mgr.init_destination = file_init_destination;
mgr.empty_output_buffer = file_empty_output_buffer;
mgr.term_destination = file_term_destination;
cinfo.dest = &mgr;
// init compression
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
cinfo.dct_method = JDCT_IFAST;
jpeg_set_quality(&cinfo,quality,TRUE);
//jpeg_write_tables(&cinfo);
//jpeg_suppress_tables(&cinfo, TRUE);
jpeg_start_compress(&cinfo, FALSE);
for(t=0;t<height;t++) {
unsigned char*data2 = &data_d[width*3*t];
jpeg_write_scanlines(&cinfo, &data2, 1);
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
return 1;
}
int jpeg_save_to_mem(unsigned char*data_d, int width, int height, int quality, unsigned char*_dest, int _destlen)
{
struct jpeg_destination_mgr mgr;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
int t;
memset(&cinfo, 0, sizeof(cinfo));
memset(&jerr, 0, sizeof(jerr));
memset(&mgr, 0, sizeof(mgr));
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
dest = _dest;
len = 0;
destlen = _destlen;
mgr.init_destination = mem_init_destination;
mgr.empty_output_buffer = mem_empty_output_buffer;
mgr.term_destination = mem_term_destination;
cinfo.dest = &mgr;
// init compression
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
cinfo.dct_method = JDCT_IFAST;
jpeg_set_quality(&cinfo,quality,TRUE);
jpeg_start_compress(&cinfo, FALSE);
for(t=0;t<height;t++) {
unsigned char*data2 = &data_d[width*3*t];
jpeg_write_scanlines(&cinfo, &data2, 1);
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
return len;
}
void mem_init_source (j_decompress_ptr cinfo)
{
struct jpeg_source_mgr* mgr = cinfo->src;
mgr->next_input_byte = data_d;
mgr->bytes_in_buffer = size_d;
//printf("init %d\n", size - mgr->bytes_in_buffer);
}
unsigned char mem_fill_input_buffer (j_decompress_ptr cinfo)
{
struct jpeg_source_mgr* mgr = cinfo->src;
printf("fill %d\n", size_d - mgr->bytes_in_buffer);
return 0;
}
void mem_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr* mgr = cinfo->src;
printf("skip %d +%d\n", size_d - mgr->bytes_in_buffer, num_bytes);
if(num_bytes<=0)
return;
mgr->next_input_byte += num_bytes;
mgr->bytes_in_buffer -= num_bytes;
}
unsigned char mem_resync_to_restart (j_decompress_ptr cinfo, int desired)
{
struct jpeg_source_mgr* mgr = cinfo->src;
printf("resync %d\n", size_d - mgr->bytes_in_buffer);
mgr->next_input_byte = data_d;
mgr->bytes_in_buffer = size_d;
return 1;
}
void mem_term_source (j_decompress_ptr cinfo)
{
struct jpeg_source_mgr* mgr = cinfo->src;
//printf("term %d\n", size - mgr->bytes_in_buffer);
}
int jpeg_load_from_mem(unsigned char*_data, int _size, unsigned char*dest, int width, int height)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
struct jpeg_source_mgr mgr;
int y;
//int x;
data_d = _data;
size_d = _size;
jpeg_create_decompress(&cinfo);
mgr.next_input_byte = data_d;
mgr.bytes_in_buffer = size_d;
mgr.init_source =mem_init_source ;
mgr.fill_input_buffer =mem_fill_input_buffer ;
mgr.skip_input_data =mem_skip_input_data ;
mgr.resync_to_restart =mem_resync_to_restart ;
mgr.term_source =mem_term_source ;
cinfo.err = jpeg_std_error(&jerr);
cinfo.src = &mgr;
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
for(y=0;y<height;y++) {
unsigned char*j = &dest[width*y*3];
jpeg_read_scanlines(&cinfo,&j,1);
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return 1;
}
typedef struct _RGBA {
unsigned char a,r,g,b;
} RGBA;
typedef unsigned char U8;
int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
//struct jpeg_source_mgr mgr;
FILE*fi = fopen(filename, "rb");
if(!fi) {
fprintf(stderr, "Couldn't open file %s\n", filename);
return 0;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, fi);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
U8*scanline = (U8 *)malloc(4 * cinfo.output_width);
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
*dest = (unsigned char*)malloc(width*height*4);
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
RGBA*line = &((RGBA*)(*dest))[y*width];
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {
for (x = 0; x < width; x++) {
line[x].a = 255;
line[x].r = line[x].g = line[x].b = js[x];
}
} else if (cinfo.out_color_space == JCS_RGB) {
for (x = width - 1; x >= 0; x--) {
line[x].a = 255;
line[x].r = js[x*3+0];
line[x].g = js[x*3+1];
line[x].b = js[x*3+2];
}
} else if (cinfo.out_color_space == JCS_YCCK) {
fprintf(stderr, "Error: Can't convert YCCK to RGB.\n");
return 0;
} else if (cinfo.out_color_space == JCS_YCbCr) {
for (x = 0; x < width; x++) {
int y = js[x * 3 + 0];
int u = js[x * 3 + 1];
int v = js[x * 3 + 1];
line[x].a = 255;
line[x].r = y + ((360 * (v - 128)) >> 8);
line[x].g = y - ((88 * (u - 128) + 183 * (v - 128)) >> 8);
line[x].b = y + ((455 * (u - 128)) >> 8);
}
} else if (cinfo.out_color_space == JCS_CMYK) {
for (x = 0; x < width; x++) {
int white = 255 - js[x * 4 + 3];
line[x].a = 255;
line[x].r = white - ((js[x * 4] * white) >> 8);
line[x].g = white - ((js[x * 4 + 1] * white) >> 8);
line[x].b = white - ((js[x * 4 + 2] * white) >> 8);
}
}
}
free(scanline);
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(fi);
return 1;
}
//#include <stdio.h>
//#include <stdlib.h>
//#include <memory.h>
////#include <libjpeg-9a/jpeglib.h>
////#include <libjpeg-9a/jpegLibLink.h>
//#define OUTBUFFER_SIZE 0x8000
//static FILE*fi;
//static JOCTET * buffer;
//static unsigned char*dest;
//static int len;
//static int destlen;
//static unsigned char*data_d;
//static int pos;
//static int size_d;
//static void file_init_destination(j_compress_ptr cinfo)
//{
// struct jpeg_destination_mgr*dmgr =
// (struct jpeg_destination_mgr*)(cinfo->dest);
// buffer = (JOCTET*)malloc(OUTBUFFER_SIZE);
// if(!buffer) {
// perror("malloc");
// printf("Out of memory!\n");
// exit(1);
// }
// dmgr->next_output_byte = buffer;
// dmgr->free_in_buffer = OUTBUFFER_SIZE;
//}
//static unsigned char file_empty_output_buffer(j_compress_ptr cinfo)
//{
// struct jpeg_destination_mgr*dmgr =
// (struct jpeg_destination_mgr*)(cinfo->dest);
// if(fi)
// fwrite(buffer, OUTBUFFER_SIZE, 1, fi);
// dmgr->next_output_byte = buffer;
// dmgr->free_in_buffer = OUTBUFFER_SIZE;
// return 1;
//}
//static void file_term_destination(j_compress_ptr cinfo)
//{ struct jpeg_destination_mgr*dmgr =
// (struct jpeg_destination_mgr*)(cinfo->dest);
// if(fi)
// fwrite(buffer, OUTBUFFER_SIZE-dmgr->free_in_buffer, 1, fi);
// free(buffer);
// buffer = 0;
// dmgr->free_in_buffer = 0;
//}
//static void mem_init_destination(j_compress_ptr cinfo)
//{
// struct jpeg_destination_mgr*dmgr =
// (struct jpeg_destination_mgr*)(cinfo->dest);
// dmgr->next_output_byte = dest;
// dmgr->free_in_buffer = destlen;
//}
//static unsigned char mem_empty_output_buffer(j_compress_ptr cinfo)
//{
// printf("jpeg mem overflow!\n");
// exit(1);
//}
//static void mem_term_destination(j_compress_ptr cinfo)
//{
// struct jpeg_destination_mgr*dmgr =
// (struct jpeg_destination_mgr*)(cinfo->dest);
// len = destlen - dmgr->free_in_buffer;
// dmgr->free_in_buffer = 0;
//}
//int jpeg_save(unsigned char*data_d, int width, int height, int quality, const char*filename)
//{
// struct jpeg_destination_mgr mgr;
// struct jpeg_compress_struct cinfo;
// struct jpeg_error_mgr jerr;
// int t;
// if(filename) {
// fi = fopen(filename, "wb");
// if(fi == NULL)
// return 0;
// } else
// fi = NULL;
// memset(&cinfo, 0, sizeof(cinfo));
// memset(&jerr, 0, sizeof(jerr));
// memset(&mgr, 0, sizeof(mgr));
// cinfo.err = jpeg_std_error(&jerr);
// jpeg_create_compress(&cinfo);
// mgr.init_destination = file_init_destination;
// mgr.empty_output_buffer = file_empty_output_buffer;
// mgr.term_destination = file_term_destination;
// cinfo.dest = &mgr;
// // init compression
// cinfo.image_width = width;
// cinfo.image_height = height;
// cinfo.input_components = 3;
// cinfo.in_color_space = JCS_RGB;
// jpeg_set_defaults(&cinfo);
// jpeg_set_quality(&cinfo,quality,TRUE);
// //jpeg_write_tables(&cinfo);
// //jpeg_suppress_tables(&cinfo, TRUE);
// jpeg_start_compress(&cinfo, FALSE);
// for(t=0;t<height;t++) {
// unsigned char*data2 = &data_d[width*3*t];
// jpeg_write_scanlines(&cinfo, &data2, 1);
// }
// jpeg_finish_compress(&cinfo);
// if(fi)
// fclose(fi);
// jpeg_destroy_compress(&cinfo);
// return 1;
//}
//int jpeg_save_to_file(unsigned char*data_d, int width, int height, int quality, FILE*_fi)
//{
// struct jpeg_destination_mgr mgr;
// struct jpeg_compress_struct cinfo;
// struct jpeg_error_mgr jerr;
// int t;
// fi = _fi;
// memset(&cinfo, 0, sizeof(cinfo));
// memset(&jerr, 0, sizeof(jerr));
// memset(&mgr, 0, sizeof(mgr));
// cinfo.err = jpeg_std_error(&jerr);
// jpeg_create_compress(&cinfo);
// mgr.init_destination = file_init_destination;
// mgr.empty_output_buffer = file_empty_output_buffer;
// mgr.term_destination = file_term_destination;
// cinfo.dest = &mgr;
// // init compression
// cinfo.image_width = width;
// cinfo.image_height = height;
// cinfo.input_components = 3;
// cinfo.in_color_space = JCS_RGB;
// jpeg_set_defaults(&cinfo);
// cinfo.dct_method = JDCT_IFAST;
// jpeg_set_quality(&cinfo,quality,TRUE);
// //jpeg_write_tables(&cinfo);
// //jpeg_suppress_tables(&cinfo, TRUE);
// jpeg_start_compress(&cinfo, FALSE);
// for(t=0;t<height;t++) {
// unsigned char*data2 = &data_d[width*3*t];
// jpeg_write_scanlines(&cinfo, &data2, 1);
// }
// jpeg_finish_compress(&cinfo);
// jpeg_destroy_compress(&cinfo);
// return 1;
//}
//int jpeg_save_to_mem(unsigned char*data_d, int width, int height, int quality, unsigned char*_dest, int _destlen)
//{
// struct jpeg_destination_mgr mgr;
// struct jpeg_compress_struct cinfo;
// struct jpeg_error_mgr jerr;
// int t;
// memset(&cinfo, 0, sizeof(cinfo));
// memset(&jerr, 0, sizeof(jerr));
// memset(&mgr, 0, sizeof(mgr));
// cinfo.err = jpeg_std_error(&jerr);
// jpeg_create_compress(&cinfo);
// dest = _dest;
// len = 0;
// destlen = _destlen;
// mgr.init_destination = mem_init_destination;
// mgr.empty_output_buffer = mem_empty_output_buffer;
// mgr.term_destination = mem_term_destination;
// cinfo.dest = &mgr;
// // init compression
// cinfo.image_width = width;
// cinfo.image_height = height;
// cinfo.input_components = 3;
// cinfo.in_color_space = JCS_RGB;
// jpeg_set_defaults(&cinfo);
// cinfo.dct_method = JDCT_IFAST;
// jpeg_set_quality(&cinfo,quality,TRUE);
// jpeg_start_compress(&cinfo, FALSE);
// for(t=0;t<height;t++) {
// unsigned char*data2 = &data_d[width*3*t];
// jpeg_write_scanlines(&cinfo, &data2, 1);
// }
// jpeg_finish_compress(&cinfo);
// jpeg_destroy_compress(&cinfo);
// return len;
//}
//void mem_init_source (j_decompress_ptr cinfo)
//{
// struct jpeg_source_mgr* mgr = cinfo->src;
// mgr->next_input_byte = data_d;
// mgr->bytes_in_buffer = size_d;
// //printf("init %d\n", size - mgr->bytes_in_buffer);
//}
//unsigned char mem_fill_input_buffer (j_decompress_ptr cinfo)
//{
// struct jpeg_source_mgr* mgr = cinfo->src;
// printf("fill %d\n", size_d - mgr->bytes_in_buffer);
// return 0;
//}
//void mem_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
//{
// struct jpeg_source_mgr* mgr = cinfo->src;
// printf("skip %d +%d\n", size_d - mgr->bytes_in_buffer, num_bytes);
// if(num_bytes<=0)
// return;
// mgr->next_input_byte += num_bytes;
// mgr->bytes_in_buffer -= num_bytes;
//}
//unsigned char mem_resync_to_restart (j_decompress_ptr cinfo, int desired)
//{
// struct jpeg_source_mgr* mgr = cinfo->src;
// printf("resync %d\n", size_d - mgr->bytes_in_buffer);
// mgr->next_input_byte = data_d;
// mgr->bytes_in_buffer = size_d;
// return 1;
//}
//void mem_term_source (j_decompress_ptr cinfo)
//{
// struct jpeg_source_mgr* mgr = cinfo->src;
// //printf("term %d\n", size - mgr->bytes_in_buffer);
//}
//int jpeg_load_from_mem(unsigned char*_data, int _size, unsigned char*dest, int width, int height)
//{
// struct jpeg_decompress_struct cinfo;
// struct jpeg_error_mgr jerr;
// struct jpeg_source_mgr mgr;
// int y;
// //int x;
// data_d = _data;
// size_d = _size;
// jpeg_create_decompress(&cinfo);
// mgr.next_input_byte = data_d;
// mgr.bytes_in_buffer = size_d;
// mgr.init_source =mem_init_source ;
// mgr.fill_input_buffer =mem_fill_input_buffer ;
// mgr.skip_input_data =mem_skip_input_data ;
// mgr.resync_to_restart =mem_resync_to_restart ;
// mgr.term_source =mem_term_source ;
// cinfo.err = jpeg_std_error(&jerr);
// cinfo.src = &mgr;
// jpeg_read_header(&cinfo, TRUE);
// jpeg_start_decompress(&cinfo);
// for(y=0;y<height;y++) {
// unsigned char*j = &dest[width*y*3];
// jpeg_read_scanlines(&cinfo,&j,1);
// }
// jpeg_finish_decompress(&cinfo);
// jpeg_destroy_decompress(&cinfo);
// return 1;
//}
//typedef struct _RGBA {
// unsigned char a,r,g,b;
//} RGBA;
//typedef unsigned char U8;
//int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
//{
// struct jpeg_decompress_struct cinfo;
// struct jpeg_error_mgr jerr;
// //struct jpeg_source_mgr mgr;
// FILE*fi = fopen(filename, "rb");
// if(!fi) {
// fprintf(stderr, "Couldn't open file %s\n", filename);
// return 0;
// }
// cinfo.err = jpeg_std_error(&jerr);
// jpeg_create_decompress(&cinfo);
// jpeg_stdio_src(&cinfo, fi);
// jpeg_read_header(&cinfo, TRUE);
// jpeg_start_decompress(&cinfo);
// U8*scanline = (U8 *)malloc(4 * cinfo.output_width);
// int width = *_width = cinfo.output_width;
// int height = *_height = cinfo.output_height;
// *dest = (unsigned char*)malloc(width*height*4);
// int y;
// for (y=0;y<height;y++) {
// int x;
// U8 *js = scanline;
// RGBA*line = &((RGBA*)(*dest))[y*width];
// jpeg_read_scanlines(&cinfo, &js, 1);
// if (cinfo.out_color_space == JCS_GRAYSCALE) {
// for (x = 0; x < width; x++) {
// line[x].a = 255;
// line[x].r = line[x].g = line[x].b = js[x];
// }
// } else if (cinfo.out_color_space == JCS_RGB) {
// for (x = width - 1; x >= 0; x--) {
// line[x].a = 255;
// line[x].r = js[x*3+0];
// line[x].g = js[x*3+1];
// line[x].b = js[x*3+2];
// }
// } else if (cinfo.out_color_space == JCS_YCCK) {
// fprintf(stderr, "Error: Can't convert YCCK to RGB.\n");
// return 0;
// } else if (cinfo.out_color_space == JCS_YCbCr) {
// for (x = 0; x < width; x++) {
// int y = js[x * 3 + 0];
// int u = js[x * 3 + 1];
// int v = js[x * 3 + 1];
// line[x].a = 255;
// line[x].r = y + ((360 * (v - 128)) >> 8);
// line[x].g = y - ((88 * (u - 128) + 183 * (v - 128)) >> 8);
// line[x].b = y + ((455 * (u - 128)) >> 8);
// }
// } else if (cinfo.out_color_space == JCS_CMYK) {
// for (x = 0; x < width; x++) {
// int white = 255 - js[x * 4 + 3];
// line[x].a = 255;
// line[x].r = white - ((js[x * 4] * white) >> 8);
// line[x].g = white - ((js[x * 4 + 1] * white) >> 8);
// line[x].b = white - ((js[x * 4 + 2] * white) >> 8);
// }
// }
// }
// free(scanline);
// jpeg_finish_decompress(&cinfo);
// jpeg_destroy_decompress(&cinfo);
// fclose(fi);
// return 1;
//}

View File

@@ -2,8 +2,8 @@
#include <stdio.h>
int jpeg_save(unsigned char*data_d, int width, int height, int quality, const char*filename);
int jpeg_save_to_file(unsigned char*data_d, int width, int height, int quality, FILE*fi);
int jpeg_save_to_mem(unsigned char*data_d, int width, int height, int quality, unsigned char*dest, int destsize);
int jpeg_load(const char*filename, unsigned char**dest, int*width, int*height);
int jpeg_load_from_mem(unsigned char*_data, int size_d, unsigned char*dest, int width, int height);
inline int jpeg_save(unsigned char* data_d, int width, int height, int quality, const char* filename) { return 0; }
inline int jpeg_save_to_file(unsigned char* data_d, int width, int height, int quality, FILE* fi) { return 0; }
inline int jpeg_save_to_mem(unsigned char* data_d, int width, int height, int quality, unsigned char* dest, int destsize) { return 0; }
inline int jpeg_load(const char* filename, unsigned char** dest, int* width, int* height) { return 0; }
inline int jpeg_load_from_mem(unsigned char* _data, int size_d, unsigned char* dest, int width, int height) { return 0; }

View File

@@ -8,7 +8,7 @@ HINSTANCE CMSWindow::ms_hInstance = NULL;
LRESULT CALLBACK MSWindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
CMSWindow * pWnd = (CMSWindow *) GetWindowLong(hWnd, GWL_USERDATA);
CMSWindow * pWnd = (CMSWindow *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (pWnd)
return pWnd->WindowProcedure(hWnd, uiMsg, wParam, lParam);
@@ -79,7 +79,7 @@ bool CMSWindow::Create(const char* c_szName, int brush, DWORD cs, DWORD ws, HICO
if (!m_hWnd)
return false;
SetWindowLong(m_hWnd, GWL_USERDATA, (DWORD) this);
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (DWORD) this);
//DestroyWindow(ImmGetDefaultIMEWnd(m_hWnd));
return true;

View File

@@ -362,7 +362,7 @@ bool CFlyingInstance::Update()
m_v3Velocity.z+=m_pData->m_fGravity * CTimer::Instance().GetElapsedSecond();
D3DXVECTOR3 v3Movement = m_v3Velocity * CTimer::Instance().GetElapsedSecond();
float _fMoveDistance = D3DXVec3Length(&v3Movement);
float fCollisionSphereRadius = max(_fMoveDistance*2, m_pData->m_fCollisionSphereRadius);
float fCollisionSphereRadius = std::max(_fMoveDistance*2, m_pData->m_fCollisionSphereRadius);
m_fRemainRange -= _fMoveDistance;
m_v3Position += v3Movement;

View File

@@ -1,5 +1,9 @@
#include "StdAfx.h"
#include <python/frameobject.h>
#ifdef BYTE
#undef BYTE
#endif
#include "eterPack/EterPackManager.h"
#include "PythonLauncher.h"

View File

@@ -1,5 +1,8 @@
#pragma once
#include <python/frameobject.h>
#ifdef BYTE
#undef BYTE
#endif
#include "eterBase/Singleton.h"

View File

@@ -5,6 +5,9 @@
#include "Stdafx.h"
#include <python/longintrepr.h>
#ifdef BYTE
#undef BYTE
#endif
/* High water mark to determine when the marshalled object is dangerously deep
* and risks coring the interpreter. When the object stack gets this deep,

View File

@@ -20,6 +20,10 @@
#include <python/eval.h>
#include <python/marshal.h>
#ifdef BYTE
#undef BYTE
#endif
#include "PythonUtils.h"
#include "PythonLauncher.h"
#include "PythonMarshal.h"

View File

@@ -896,7 +896,7 @@ PyObject * playerSetItemCount(PyObject* poSelf, PyObject* poArgs)
if (!PyTuple_GetInteger(poArgs, 0, &iSlotIndex))
return Py_BuildException();
BYTE bCount;
uint8_t bCount;
if (!PyTuple_GetInteger(poArgs, 1, &bCount))
return Py_BuildException();
@@ -915,7 +915,7 @@ PyObject * playerSetItemCount(PyObject* poSelf, PyObject* poArgs)
if (!PyTuple_GetInteger(poArgs, 1, &Cell.cell))
return Py_BuildException();
BYTE bCount;
uint8_t bCount;
if (!PyTuple_GetInteger(poArgs, 2, &bCount))
return Py_BuildException();
@@ -1290,7 +1290,7 @@ PyObject * playerIsEquipmentSlot(PyObject* poSelf, PyObject* poArgs)
PyObject * playerIsDSEquipmentSlot(PyObject* poSelf, PyObject* poArgs)
{
BYTE bWindowType;
uint8_t bWindowType;
if (!PyTuple_GetInteger(poArgs, 0, &bWindowType))
return Py_BuildException();
int iSlotIndex;
@@ -2124,7 +2124,7 @@ PyObject * playerIsAvailableBeltInventoryCell(PyObject* poSelf, PyObject* poArgs
// 용혼석 강화
PyObject* playerSendDragonSoulRefine(PyObject* poSelf, PyObject* poArgs)
{
BYTE bSubHeader;
uint8_t bSubHeader;
PyObject* pDic;
TItemPos RefineItemPoses[DS_REFINE_WINDOW_MAX_NUM];
if (!PyTuple_GetByte(poArgs, 0, &bSubHeader))
@@ -2139,7 +2139,7 @@ PyObject* playerSendDragonSoulRefine(PyObject* poSelf, PyObject* poArgs)
{
if (!PyTuple_GetObject(poArgs, 1, &pDic))
return Py_BuildException();
int pos = 0;
Py_ssize_t pos = 0;
PyObject* key, *value;
int size = PyDict_Size(pDic);

View File

@@ -39,7 +39,7 @@ PyObject * sndPlayMusic(PyObject * poSelf, PyObject * poArgs)
return Py_BuildException();
CSoundManager& rkSndMgr=CSoundManager::Instance();
rkSndMgr.PlayMusic(szFileName);
rkSndMgr.PlaySound2D(szFileName);
return Py_BuildNone();
}
@@ -112,7 +112,7 @@ PyObject * sndSetSoundVolumef(PyObject * poSelf, PyObject * poArgs)
return Py_BuildException();
CSoundManager& rkSndMgr=CSoundManager::Instance();
rkSndMgr.SetSoundVolumeRatio(fVolume);
rkSndMgr.SetSoundVolume(fVolume);
return Py_BuildNone();
}
@@ -124,7 +124,7 @@ PyObject * sndSetSoundVolume(PyObject * poSelf, PyObject * poArgs)
return Py_BuildException();
CSoundManager& rkSndMgr=CSoundManager::Instance();
rkSndMgr.SetSoundVolumeGrade(iVolume);
rkSndMgr.SetSoundVolume(iVolume);
return Py_BuildNone();
}

View File

@@ -649,7 +649,7 @@ void CPythonSystem::ChangeSystem()
else
fVoiceVolume = (float)pow(10.0f, (-1.0f + (float)m_Config.voice_volume / 5.0f));
*/
rkSndMgr.SetSoundVolumeGrade(m_Config.voice_volume);
rkSndMgr.SetSoundVolume(m_Config.voice_volume);
}
void CPythonSystem::Clear()

View File

@@ -45,7 +45,6 @@ extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
#pragma comment( lib, "dmoguids.lib" )
//#pragma comment( lib, "wsock32.lib" )
#include <stdlib.h>
#include <cryptopp/cryptoppLibLink.h>
bool __IS_TEST_SERVER_MODE__=false;
extern bool SetDefaultCodePage(DWORD codePage);
@@ -218,8 +217,6 @@ bool PackInitialize(const char * c_pszFolder)
CEterPackManager::Instance().SetCacheMode();
CEterPackManager::Instance().SetSearchMode(bPackFirst);
CSoundData::SetPackMode(); // Miles 파일 콜백을 셋팅
std::string strPackName, strTexCachePackName;
for (DWORD i = 1; i < TextLoader.GetLineCount() - 1; i += 2)
{
@@ -385,9 +382,7 @@ bool Main(HINSTANCE hInstance, LPSTR lpCmdLine)
system("patchupdater.exe");
return false;
}
#ifndef __VTUNE__
ilInit();
#endif
if (!Setup(lpCmdLine))
return false;

View File

@@ -1,6 +1,4 @@
add_subdirectory(cryptopp)
add_subdirectory(lzo-2.10)
if (WIN32)