got 32-bit windows build running
This commit is contained in:
parent
81f89d97cb
commit
37bf8777a4
|
@ -388,7 +388,7 @@ CUSTOM_COMMAND_SIG(clean_all_lines){
|
|||
int32_t line_count = buffer.line_count;
|
||||
int32_t edit_max = line_count;
|
||||
|
||||
if (edit_max*sizeof(Buffer_Edit) < app->memory_size){
|
||||
if (edit_max*(int32_t)sizeof(Buffer_Edit) < app->memory_size){
|
||||
Buffer_Edit *edits = (Buffer_Edit*)app->memory;
|
||||
|
||||
char data[1024];
|
||||
|
|
|
@ -327,7 +327,7 @@ general_memory_reallocate(General_Memory *general, void *old, i32_4tech old_size
|
|||
if (additional_space > 0){
|
||||
Bubble *next = bubble->next;
|
||||
if (!(next->flags & MEM_BUBBLE_USED) &&
|
||||
next->size + sizeof(Bubble) >= additional_space){
|
||||
next->size + (i32_4tech)sizeof(Bubble) >= additional_space){
|
||||
general_memory_do_merge(bubble, next);
|
||||
general_memory_attempt_split(general, bubble, size);
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@ init_shared_vars(){
|
|||
shared_vars.track_node_size = (16 << 10);
|
||||
void *track_nodes = system_get_memory(shared_vars.track_node_size);
|
||||
|
||||
i32 track_result =
|
||||
init_track_system(&shared_vars.track,
|
||||
shared_vars.track_table, shared_vars.track_table_size,
|
||||
track_nodes, shared_vars.track_node_size);
|
||||
i32 track_result = init_track_system(&shared_vars.track, shared_vars.track_table, shared_vars.track_table_size, track_nodes, shared_vars.track_node_size);
|
||||
|
||||
if (track_result != FileTrack_Good){
|
||||
exit(1);
|
||||
|
|
Binary file not shown.
|
@ -10,6 +10,8 @@ SET FirstError=0
|
|||
SET BUILD_MODE=%1
|
||||
if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD")
|
||||
|
||||
REM if "%BUILD_MODE%" == "/DDEV_BUILD_X86" (call "SETUP_CLX86")
|
||||
|
||||
pushd ..\build
|
||||
cl %OPTS% ..\code\meta\build.cpp /Zi /Febuild %BUILD_MODE%
|
||||
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
||||
|
@ -20,4 +22,7 @@ popd
|
|||
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
||||
|
||||
:END
|
||||
|
||||
REM if "%BUILD_MODE%" == "/DDEV_BUILD" (call "SETUP_CLX64")
|
||||
|
||||
call "ctime" -end 4ed_data.ctm %FirstError%
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@echo off
|
||||
|
||||
IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64)
|
||||
IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64)
|
||||
|
||||
SET SRC=%1
|
||||
if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
@echo off
|
||||
|
||||
IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64_x86)
|
||||
|
||||
SET SRC=%1
|
||||
if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp
|
||||
|
||||
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX
|
||||
SET OPTS=%OPTS% /GR- /nologo /FC
|
||||
SET DEBUG=/Zi
|
||||
SET BUILD_DLL=/LD /link /INCREMENTAL:NO /OPT:REF
|
||||
SET EXPORTS=/EXPORT:get_bindings /EXPORT:get_alpha_4coder_version
|
||||
|
||||
REM This stores the path of the buildsuper.bat script
|
||||
REM in CODE_HOME. This way you can always include the
|
||||
REM default files no matter where you store your code.
|
||||
REM And no matter how you call buildsuper.bat.
|
||||
SET CODE_HOME=%~dp0
|
||||
|
||||
cl /I%CODE_HOME% %OPTS% %DEBUG% %SRC% /Fecustom_4coder %BUILD_DLL% %EXPORTS%
|
||||
|
||||
REM file spammation preventation
|
||||
del *.exp
|
||||
del *.obj
|
||||
del *.lib
|
304
meta/build.cpp
304
meta/build.cpp
|
@ -131,9 +131,13 @@ init_build_line(Build_Line *line){
|
|||
|
||||
#define CL_SITE_INCLUDES "/I..\\..\\foreign /I..\\..\\code"
|
||||
|
||||
#define CL_LIBS \
|
||||
#define CL_LIBS_X64 \
|
||||
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
||||
"..\\foreign\\freetype.lib"
|
||||
"..\\foreign_x64\\freetype.lib"
|
||||
|
||||
#define CL_LIBS_X86 \
|
||||
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
||||
"..\\foreign_x86\\freetype.lib"
|
||||
|
||||
#define CL_ICON "..\\res\\icon.res"
|
||||
|
||||
|
@ -142,10 +146,18 @@ init_build_line(Build_Line *line){
|
|||
static void
|
||||
build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
||||
Build_Line line;
|
||||
Build_Line link_line;
|
||||
init_build_line(&line);
|
||||
|
||||
Build_Line link_line;
|
||||
init_build_line(&link_line);
|
||||
|
||||
Build_Line line_prefix;
|
||||
init_build_line(&line_prefix);
|
||||
|
||||
if (flags & X86){
|
||||
build_ap(line_prefix, "SETUP_CLX86 & ");
|
||||
}
|
||||
|
||||
if (flags & OPTS){
|
||||
build_ap(line, CL_OPTS);
|
||||
}
|
||||
|
@ -159,7 +171,12 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_
|
|||
}
|
||||
|
||||
if (flags & LIBS){
|
||||
build_ap(line, CL_LIBS);
|
||||
if (flags & X86){
|
||||
build_ap(line, CL_LIBS_X86);
|
||||
}
|
||||
else{
|
||||
build_ap(line, CL_LIBS_X64);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & ICON){
|
||||
|
@ -210,8 +227,10 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_
|
|||
|
||||
swap_ptr(&line.build_options, &line.build_options_prev);
|
||||
swap_ptr(&link_line.build_options, &link_line.build_options_prev);
|
||||
swap_ptr(&line_prefix.build_options, &line_prefix.build_options_prev);
|
||||
|
||||
Temp_Dir temp = pushdir(out_path);
|
||||
systemf("cl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line.build_options, code_path, code_file, out_file, link_line.build_options);
|
||||
systemf("%scl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, code_path, code_file, out_file, link_line.build_options);
|
||||
popdir(temp);
|
||||
}
|
||||
|
||||
|
@ -307,39 +326,28 @@ build(u32 flags, char *code_path, char *code_file, char *out_path, char *out_fil
|
|||
}
|
||||
|
||||
static void
|
||||
buildsuper(char *code_path, char *out_path, char *filename){
|
||||
buildsuper(char *code_path, char *out_path, char *filename, b32 x86_build){
|
||||
Temp_Dir temp = pushdir(out_path);
|
||||
|
||||
#if defined(IS_CL)
|
||||
systemf("call \"%s\\buildsuper.bat\" %s", code_path, filename);
|
||||
|
||||
{
|
||||
char *prefix = "";
|
||||
char *build_script = "buildsuper.bat";
|
||||
if (x86_build){
|
||||
prefix = "setup_clx86 & ";
|
||||
build_script = "buildsuper_x86.bat";
|
||||
}
|
||||
systemf("%scall \"%s\\%s\" %s", prefix, code_path, build_script, filename);
|
||||
}
|
||||
#elif defined(IS_GCC)
|
||||
|
||||
systemf("\"%s/buildsuper.sh\" %s", code_path, filename);
|
||||
|
||||
{
|
||||
systemf("\"%s/buildsuper.sh\" %s", code_path, filename);
|
||||
}
|
||||
#else
|
||||
#error The build rule for this compiler is not ready
|
||||
#endif
|
||||
|
||||
popdir(temp);
|
||||
}
|
||||
|
||||
#define META_DIR "../meta"
|
||||
#define BUILD_DIR "../build"
|
||||
|
||||
#define SITE_DIR "../site"
|
||||
#define PACK_DIR "../distributions"
|
||||
#define PACK_DATA_DIR "../data/dist_files"
|
||||
#define DATA_DIR "../data/test"
|
||||
|
||||
#define PACK_ALPHA_PAR_DIR "../current_dist"
|
||||
#define PACK_SUPER_PAR_DIR "../current_dist_super"
|
||||
#define PACK_POWER_PAR_DIR "../current_dist_power"
|
||||
|
||||
#define PACK_ALPHA_DIR PACK_ALPHA_PAR_DIR"/4coder"
|
||||
#define PACK_SUPER_DIR PACK_SUPER_PAR_DIR"/4coder"
|
||||
#define PACK_POWER_DIR PACK_POWER_PAR_DIR"/power"
|
||||
|
||||
#if defined(IS_WINDOWS)
|
||||
#define PLAT_LAYER "win32_4ed.cpp"
|
||||
#elif defined(IS_LINUX)
|
||||
|
@ -348,6 +356,9 @@ buildsuper(char *code_path, char *out_path, char *filename){
|
|||
#error No platform layer defined for this OS.
|
||||
#endif
|
||||
|
||||
#define META_DIR "../meta"
|
||||
#define BUILD_DIR "../build"
|
||||
|
||||
static void
|
||||
fsm_generator(char *cdir){
|
||||
{
|
||||
|
@ -395,7 +406,7 @@ enum{
|
|||
};
|
||||
|
||||
static void
|
||||
do_buildsuper(char *cdir, i32 custom_option){
|
||||
do_buildsuper(char *cdir, i32 custom_option, u32 flags){
|
||||
char space[1024];
|
||||
String str = make_fixed_width_string(space);
|
||||
|
||||
|
@ -426,11 +437,15 @@ do_buildsuper(char *cdir, i32 custom_option){
|
|||
copy_sc(&str, "../4vim/4coder_chronal.cpp");
|
||||
}break;
|
||||
}
|
||||
|
||||
terminate_with_null(&str);
|
||||
|
||||
b32 x86_build = false;
|
||||
if (flags & X86){
|
||||
x86_build = true;
|
||||
}
|
||||
|
||||
DECL_STR(dir, BUILD_DIR);
|
||||
buildsuper(cdir, dir, str.str);
|
||||
buildsuper(cdir, dir, str.str, x86_build);
|
||||
|
||||
END_TIME_SECTION("build custom");
|
||||
}
|
||||
|
@ -457,9 +472,9 @@ static void
|
|||
standard_build(char *cdir, u32 flags){
|
||||
fsm_generator(cdir);
|
||||
metagen(cdir);
|
||||
do_buildsuper(cdir, Custom_Experiments);
|
||||
//do_buildsuper(cdir, Custom_Casey);
|
||||
//do_buildsuper(cdir, Custom_ChronalVim);
|
||||
do_buildsuper(cdir, Custom_Experiments, flags);
|
||||
//do_buildsuper(cdir, Custom_Casey, flags);
|
||||
//do_buildsuper(cdir, Custom_ChronalVim, flags);
|
||||
build_main(cdir, flags);
|
||||
}
|
||||
|
||||
|
@ -481,6 +496,8 @@ site_build(char *cdir, u32 flags){
|
|||
}
|
||||
}
|
||||
|
||||
#define PACK_DIR "../distributions"
|
||||
|
||||
static void
|
||||
get_4coder_dist_name(String *zip_file, i32 OS_specific, char *tier, char *ext){
|
||||
zip_file->size = 0;
|
||||
|
@ -526,8 +543,9 @@ package(char *cdir){
|
|||
fsm_generator(cdir);
|
||||
metagen(cdir);
|
||||
|
||||
// NOTE(allen): alpha
|
||||
build_main(cdir, OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO);
|
||||
#define SITE_DIR "../site"
|
||||
#define PACK_DATA_DIR "../data/dist_files"
|
||||
#define DATA_DIR "../data/test"
|
||||
|
||||
DECL_STR(build_dir, BUILD_DIR);
|
||||
DECL_STR(site_dir, SITE_DIR);
|
||||
|
@ -535,88 +553,170 @@ package(char *cdir){
|
|||
DECL_STR(pack_data_dir, PACK_DATA_DIR);
|
||||
DECL_STR(data_dir, DATA_DIR);
|
||||
|
||||
#define PACK_ALPHA_PAR_DIR "../current_dist"
|
||||
#define PACK_ALPHA_DIR PACK_ALPHA_PAR_DIR"/4coder"
|
||||
DECL_STR(pack_alpha_par_dir, PACK_ALPHA_PAR_DIR);
|
||||
DECL_STR(pack_super_par_dir, PACK_SUPER_PAR_DIR);
|
||||
DECL_STR(pack_power_par_dir, PACK_POWER_PAR_DIR);
|
||||
|
||||
DECL_STR(pack_alpha_dir, PACK_ALPHA_DIR);
|
||||
DECL_STR(pack_super_dir, PACK_SUPER_DIR);
|
||||
DECL_STR(pack_power_dir, PACK_POWER_DIR);
|
||||
|
||||
clear_folder(pack_alpha_par_dir);
|
||||
make_folder_if_missing(pack_alpha_dir, "3rdparty");
|
||||
make_folder_if_missing(pack_dir, "alpha");
|
||||
copy_file(build_dir, "4ed"EXE, pack_alpha_dir, 0, 0);
|
||||
//ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, pack_alpha_dir, 0, 0));
|
||||
copy_file(build_dir, "4ed_app"DLL, pack_alpha_dir, 0, 0);
|
||||
//ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, pack_alpha_dir, 0, 0));
|
||||
copy_all (pack_data_dir, "*", pack_alpha_dir);
|
||||
copy_file(0, "README.txt", pack_alpha_dir, 0, 0);
|
||||
copy_file(0, "TODO.txt", pack_alpha_dir, 0, 0);
|
||||
copy_file(data_dir, "release-config.4coder", pack_alpha_dir, 0, "config.4coder");
|
||||
#define PACK_ALPHA_X86_PAR_DIR "../current_dist_x86"
|
||||
#define PACK_ALPHA_X86_DIR PACK_ALPHA_X86_PAR_DIR"/4coder"
|
||||
DECL_STR(pack_alpha_x86_par_dir, PACK_ALPHA_X86_PAR_DIR);
|
||||
DECL_STR(pack_alpha_x86_dir, PACK_ALPHA_X86_DIR);
|
||||
|
||||
get_4coder_dist_name(&str, 1, "alpha", "zip");
|
||||
zip(pack_alpha_par_dir, "4coder", str.str);
|
||||
// NOTE(allen): alpha
|
||||
{
|
||||
char *dest_dirs[] = {
|
||||
pack_alpha_dir,
|
||||
pack_alpha_x86_dir,
|
||||
};
|
||||
|
||||
// NOTE(allen): super
|
||||
build_main(cdir, OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER);
|
||||
do_buildsuper(cdir, Custom_Default);
|
||||
char *dest_par_dirs[] = {
|
||||
pack_alpha_dir,
|
||||
pack_alpha_x86_dir,
|
||||
};
|
||||
|
||||
clear_folder(pack_super_par_dir);
|
||||
make_folder_if_missing(pack_super_dir, "3rdparty");
|
||||
make_folder_if_missing(pack_dir, "super");
|
||||
make_folder_if_missing(pack_dir, "super-docs");
|
||||
char *zip_dirs[] = {
|
||||
"alpha",
|
||||
"alpha_x86",
|
||||
};
|
||||
|
||||
copy_file(build_dir, "4ed"EXE, pack_super_dir, 0, 0);
|
||||
//ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, pack_super_dir, 0, 0));
|
||||
copy_file(build_dir, "4ed_app"DLL, pack_super_dir, 0, 0);
|
||||
//ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, pack_super_dir, 0, 0));
|
||||
copy_file(build_dir, "custom_4coder"DLL, pack_super_dir, 0, 0);
|
||||
Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs));
|
||||
u32 count = ArrayCount(dest_dirs);
|
||||
|
||||
copy_all (pack_data_dir, "*", pack_super_dir);
|
||||
copy_file(0, "README.txt", pack_super_dir, 0, 0);
|
||||
copy_file(0, "TODO.txt", pack_super_dir, 0, 0);
|
||||
copy_file(data_dir, "release-config.4coder", pack_super_dir, 0, "config.4coder");
|
||||
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO;
|
||||
u32 flags[] = {
|
||||
0,
|
||||
X86,
|
||||
};
|
||||
|
||||
copy_all(0, "4coder_*", pack_super_dir);
|
||||
for (u32 i = 0; i < count; ++i){
|
||||
char *dir = dest_dirs[i];
|
||||
char *par_dir = dest_par_dirs[i];
|
||||
char *zip_dir = zip_dirs[i];
|
||||
|
||||
copy_file(0, "buildsuper"BAT, pack_super_dir, 0, 0);
|
||||
build_main(cdir, base_flags | flags[i]);
|
||||
|
||||
DECL_STR(custom_dir, "4coder_API");
|
||||
DECL_STR(custom_helper_dir, "4coder_helper");
|
||||
DECL_STR(custom_lib_dir, "4coder_lib");
|
||||
DECL_STR(fcpp_dir, "4cpp");
|
||||
clear_folder(par_dir);
|
||||
make_folder_if_missing(dir, "3rdparty");
|
||||
make_folder_if_missing(pack_dir, zip_dir);
|
||||
copy_file(build_dir, "4ed"EXE, dir, 0, 0);
|
||||
copy_file(build_dir, "4ed_app"DLL, dir, 0, 0);
|
||||
copy_all (pack_data_dir, "*", dir);
|
||||
copy_file(0, "README.txt", dir, 0, 0);
|
||||
copy_file(0, "TODO.txt", dir, 0, 0);
|
||||
copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder");
|
||||
|
||||
char *dir_array[] = {
|
||||
custom_dir,
|
||||
custom_helper_dir,
|
||||
custom_lib_dir,
|
||||
fcpp_dir,
|
||||
};
|
||||
i32 dir_count = ArrayCount(dir_array);
|
||||
|
||||
for (i32 i = 0; i < dir_count; ++i){
|
||||
char *d = dir_array[i];
|
||||
make_folder_if_missing(pack_super_dir, d);
|
||||
|
||||
char space[256];
|
||||
String str = make_fixed_width_string(space);
|
||||
append_sc(&str, pack_super_dir);
|
||||
append_s_char(&str, platform_correct_slash);
|
||||
append_sc(&str, d);
|
||||
terminate_with_null(&str);
|
||||
|
||||
copy_all(d, "*", str.str);
|
||||
get_4coder_dist_name(&str, 1, zip_dir, "zip");
|
||||
zip(par_dir, "4coder", str.str);
|
||||
}
|
||||
}
|
||||
|
||||
get_4coder_dist_name(&str, 0, "API", "html");
|
||||
str2 = front_of_directory(str);
|
||||
copy_file(site_dir, "custom_docs.html", pack_dir, "super-docs", str2.str);
|
||||
// NOTE(allen): super
|
||||
#define PACK_SUPER_PAR_DIR "../current_dist_super"
|
||||
#define PACK_SUPER_DIR PACK_SUPER_PAR_DIR"/4coder"
|
||||
DECL_STR(pack_super_par_dir, PACK_SUPER_PAR_DIR);
|
||||
DECL_STR(pack_super_dir, PACK_SUPER_DIR);
|
||||
|
||||
get_4coder_dist_name(&str, 1, "super", "zip");
|
||||
zip(pack_super_par_dir, "4coder", str.str);
|
||||
#define PACK_SUPER_X86_PAR_DIR "../current_dist_super_x86"
|
||||
#define PACK_SUPER_X86_DIR PACK_SUPER_X86_PAR_DIR"/4coder"
|
||||
DECL_STR(pack_super_x86_par_dir, PACK_SUPER_X86_PAR_DIR);
|
||||
DECL_STR(pack_super_x86_dir, PACK_SUPER_X86_DIR);
|
||||
|
||||
{
|
||||
char *dest_dirs[] = {
|
||||
pack_super_dir,
|
||||
pack_super_x86_dir,
|
||||
};
|
||||
|
||||
char *dest_par_dirs[] = {
|
||||
pack_super_dir,
|
||||
pack_super_x86_dir,
|
||||
};
|
||||
|
||||
char *zip_dirs[] = {
|
||||
"super",
|
||||
"super_x86",
|
||||
};
|
||||
|
||||
Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs));
|
||||
u32 count = ArrayCount(dest_dirs);
|
||||
|
||||
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER;
|
||||
u32 flags[] = {
|
||||
0,
|
||||
X86,
|
||||
};
|
||||
|
||||
for (u32 i = 0; i < count; ++i){
|
||||
char *dir = dest_dirs[i];
|
||||
char *par_dir = dest_par_dirs[i];
|
||||
char *zip_dir = zip_dirs[i];
|
||||
|
||||
build_main(cdir, base_flags | flags[i]);
|
||||
do_buildsuper(cdir, Custom_Default, flags[i]);
|
||||
|
||||
clear_folder(par_dir);
|
||||
make_folder_if_missing(dir, "3rdparty");
|
||||
make_folder_if_missing(pack_dir, zip_dir);
|
||||
|
||||
copy_file(build_dir, "4ed"EXE, dir, 0, 0);
|
||||
ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, dir, 0, 0));
|
||||
copy_file(build_dir, "4ed_app"DLL, dir, 0, 0);
|
||||
ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, dir, 0, 0));
|
||||
copy_file(build_dir, "custom_4coder"DLL, dir, 0, 0);
|
||||
|
||||
copy_all (pack_data_dir, "*", dir);
|
||||
copy_file(0, "README.txt", dir, 0, 0);
|
||||
copy_file(0, "TODO.txt", dir, 0, 0);
|
||||
copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder");
|
||||
|
||||
copy_all(0, "4coder_*", dir);
|
||||
|
||||
copy_file(0, "buildsuper"BAT, dir, 0, 0);
|
||||
|
||||
DECL_STR(custom_dir, "4coder_API");
|
||||
DECL_STR(custom_helper_dir, "4coder_helper");
|
||||
DECL_STR(custom_lib_dir, "4coder_lib");
|
||||
DECL_STR(fcpp_dir, "4cpp");
|
||||
|
||||
char *dir_array[] = {
|
||||
custom_dir,
|
||||
custom_helper_dir,
|
||||
custom_lib_dir,
|
||||
fcpp_dir,
|
||||
};
|
||||
i32 dir_count = ArrayCount(dir_array);
|
||||
|
||||
for (i32 i = 0; i < dir_count; ++i){
|
||||
char *d = dir_array[i];
|
||||
make_folder_if_missing(dir, d);
|
||||
|
||||
char space[256];
|
||||
String str = make_fixed_width_string(space);
|
||||
append_sc(&str, dir);
|
||||
append_s_char(&str, platform_correct_slash);
|
||||
append_sc(&str, d);
|
||||
terminate_with_null(&str);
|
||||
|
||||
copy_all(d, "*", str.str);
|
||||
}
|
||||
|
||||
get_4coder_dist_name(&str, 1, zip_dir, "zip");
|
||||
zip(par_dir, "4coder", str.str);
|
||||
}
|
||||
|
||||
make_folder_if_missing(pack_dir, "super-docs");
|
||||
get_4coder_dist_name(&str, 0, "API", "html");
|
||||
str2 = front_of_directory(str);
|
||||
copy_file(site_dir, "custom_docs.html", pack_dir, "super-docs", str2.str);
|
||||
}
|
||||
|
||||
// NOTE(allen): power
|
||||
#define PACK_POWER_PAR_DIR "../current_dist_power"
|
||||
#define PACK_POWER_DIR PACK_POWER_PAR_DIR"/power"
|
||||
DECL_STR(pack_power_par_dir, PACK_POWER_PAR_DIR);
|
||||
DECL_STR(pack_power_dir, PACK_POWER_DIR);
|
||||
|
||||
clear_folder(pack_power_par_dir);
|
||||
make_folder_if_missing(pack_power_dir, 0);
|
||||
make_folder_if_missing(pack_dir, "power");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
extensions=".c.cpp.h.hpp.bat.sh";
|
||||
open_recursively=false;
|
||||
|
||||
fkey_command_win[1] = {"build.bat", "*compilation*", true , true };
|
||||
fkey_command_win[2] = {"site\\build.bat", "*compilation*", true , true };
|
||||
fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*", true , true };
|
||||
fkey_command_win[2] = {"site\\build.bat", "*compilation*", true , true };
|
||||
fkey_command_win[3] = {"string\\build.bat", "*compilation*", true , true };
|
||||
fkey_command_win[4] = {"build.bat /DDEV_BUILD_X86", "*compilation*", true , true };
|
||||
fkey_command_win[5] = {"..\\misc\\run.bat", "*run*", false, false};
|
||||
fkey_command_win[12] = {"package.bat", "*package*", false, true };
|
||||
fkey_command_win[4] = {"echo build: x86 & build.bat /DDEV_BUILD_X86", "*compilation*", true , true };
|
||||
fkey_command_win[5] = {"..\\misc\\run.bat", "*run*", false, false };
|
||||
fkey_command_win[12] = {"package.bat", "*package*", false, true };
|
||||
|
||||
fkey_command_linux[1] = {"./build.sh", "*compilation*", true , true };
|
||||
fkey_command_linux[2] = {"site/build.sh", "*compilation*", true , true };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
1
|
||||
0
|
||||
62
|
||||
63
|
||||
|
||||
|
||||
|
|
Binary file not shown.
187
win32_4ed.cpp
187
win32_4ed.cpp
|
@ -9,6 +9,25 @@
|
|||
|
||||
// TOP
|
||||
|
||||
//
|
||||
// Architecture cracking
|
||||
//
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
# define CALL_CONVENTION
|
||||
# define BUILD_X64
|
||||
#elif defined(_M_IX86)
|
||||
# define CALL_CONVENTION __stdcall
|
||||
# define BUILD_X86
|
||||
#else
|
||||
# error architecture not supported yet
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Program setup
|
||||
//
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "4tech_defines.h"
|
||||
|
@ -55,6 +74,7 @@
|
|||
|
||||
#define WM_4coder_ANIMATE (WM_USER + 0)
|
||||
|
||||
|
||||
//
|
||||
// Win32_Vars structs
|
||||
//
|
||||
|
@ -324,7 +344,7 @@ system_signal_cv(i32 crit_id, i32 cv_id){
|
|||
WakeConditionVariable(win32vars.condition_vars + cv_id);
|
||||
}
|
||||
|
||||
internal DWORD
|
||||
internal DWORD CALL_CONVENTION
|
||||
JobThreadProc(LPVOID lpParameter){
|
||||
Thread_Context *thread = (Thread_Context*)lpParameter;
|
||||
Work_Queue *queue = win32vars.queues + thread->group_id;
|
||||
|
@ -647,7 +667,7 @@ Win32FreeCoroutine(Win32_Coroutine *data){
|
|||
win32vars.coroutine_free = data;
|
||||
}
|
||||
|
||||
internal void
|
||||
internal void CALL_CONVENTION
|
||||
Win32CoroutineMain(void *arg_){
|
||||
Win32_Coroutine *c = (Win32_Coroutine*)arg_;
|
||||
c->coroutine.func(&c->coroutine);
|
||||
|
@ -1665,9 +1685,8 @@ win32_load_gl_always(char *name, HMODULE module){
|
|||
return(r);
|
||||
}
|
||||
|
||||
internal void
|
||||
OpenGLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam)
|
||||
{
|
||||
internal void CALL_CONVENTION
|
||||
OpenGLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam){
|
||||
OutputDebugStringA(message);
|
||||
OutputDebugStringA("\n");
|
||||
}
|
||||
|
@ -1677,10 +1696,6 @@ Win32InitGL(){
|
|||
// GL context initialization
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR format;
|
||||
int format_id;
|
||||
BOOL success;
|
||||
HDC dc;
|
||||
|
||||
format.nSize = sizeof(format);
|
||||
format.nVersion = 1;
|
||||
format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
|
||||
|
@ -1708,87 +1723,84 @@ Win32InitGL(){
|
|||
format.dwVisibleMask = 0;
|
||||
format.dwDamageMask = 0;
|
||||
|
||||
dc = GetDC(win32vars.window_handle);
|
||||
HDC dc = GetDC(win32vars.window_handle);
|
||||
Assert(dc);
|
||||
format_id = ChoosePixelFormat(dc, &format);
|
||||
int format_id = ChoosePixelFormat(dc, &format);
|
||||
Assert(format_id != 0);
|
||||
success = SetPixelFormat(dc, format_id, &format);
|
||||
Assert(success == TRUE);
|
||||
BOOL success = SetPixelFormat(dc, format_id, &format);
|
||||
Assert(success == TRUE); AllowLocal(success);
|
||||
|
||||
HGLRC glcontext = wglCreateContext(dc);
|
||||
wglMakeCurrent(dc, glcontext);
|
||||
|
||||
#if 1
|
||||
{
|
||||
HMODULE module = LoadLibraryA("opengl32.dll");
|
||||
HMODULE module = LoadLibraryA("opengl32.dll");
|
||||
AllowLocal(module);
|
||||
|
||||
wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0;
|
||||
wglCreateContextAttribsARB = (wglCreateContextAttribsARB_Function*)
|
||||
win32_load_gl_always("wglCreateContextAttribsARB", module);
|
||||
wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0;
|
||||
wglCreateContextAttribsARB = (wglCreateContextAttribsARB_Function*)
|
||||
win32_load_gl_always("wglCreateContextAttribsARB", module);
|
||||
|
||||
wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0;
|
||||
wglChoosePixelFormatARB = (wglChoosePixelFormatARB_Function*)
|
||||
win32_load_gl_always("wglChoosePixelFormatARB", module);
|
||||
wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0;
|
||||
wglChoosePixelFormatARB = (wglChoosePixelFormatARB_Function*)
|
||||
win32_load_gl_always("wglChoosePixelFormatARB", module);
|
||||
|
||||
if (wglCreateContextAttribsARB != 0 && wglChoosePixelFormatARB != 0){
|
||||
const int choosePixel_attribList[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB, TRUE,
|
||||
WGL_SUPPORT_OPENGL_ARB, TRUE,
|
||||
//WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_COLOR_BITS_ARB, 32,
|
||||
WGL_DEPTH_BITS_ARB, 24,
|
||||
WGL_STENCIL_BITS_ARB, 8,
|
||||
0,
|
||||
if (wglCreateContextAttribsARB != 0 && wglChoosePixelFormatARB != 0){
|
||||
const int choosePixel_attribList[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB, TRUE,
|
||||
WGL_SUPPORT_OPENGL_ARB, TRUE,
|
||||
//WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_COLOR_BITS_ARB, 32,
|
||||
WGL_DEPTH_BITS_ARB, 24,
|
||||
WGL_STENCIL_BITS_ARB, 8,
|
||||
0,
|
||||
};
|
||||
|
||||
i32 extended_format_id = 0;
|
||||
u32 num_formats = 0;
|
||||
BOOL result = wglChoosePixelFormatARB(dc, choosePixel_attribList, 0, 1, &extended_format_id, &num_formats);
|
||||
|
||||
if (result != 0 && num_formats > 0){
|
||||
const int createContext_attribList[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
i32 extended_format_id;
|
||||
UINT num_formats = 0;
|
||||
BOOL result = 0;
|
||||
|
||||
result = wglChoosePixelFormatARB(dc, choosePixel_attribList, 0, 1, &extended_format_id, &num_formats);
|
||||
|
||||
if (result != 0 && num_formats > 0){
|
||||
const int createContext_attribList[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
if (extended_format_id == format_id){
|
||||
HGLRC extended_context = wglCreateContextAttribsARB(dc, 0, createContext_attribList);
|
||||
if (extended_context){
|
||||
wglMakeCurrent(dc, extended_context);
|
||||
wglDeleteContext(glcontext);
|
||||
glcontext = extended_context;
|
||||
}
|
||||
if (extended_format_id == format_id){
|
||||
HGLRC extended_context = wglCreateContextAttribsARB(dc, 0, createContext_attribList);
|
||||
if (extended_context){
|
||||
wglMakeCurrent(dc, extended_context);
|
||||
wglDeleteContext(glcontext);
|
||||
glcontext = extended_context;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(BUILD_X64) && 1) || (defined(BUILD_X86) && 0)
|
||||
#if FRED_INTERNAL
|
||||
// NOTE(casey): This slows down GL but puts error messages to
|
||||
// the debug console immediately whenever you do something wrong
|
||||
glDebugMessageCallback_type *glDebugMessageCallback =
|
||||
(glDebugMessageCallback_type *)win32_load_gl_always("glDebugMessageCallback", module);
|
||||
glDebugMessageControl_type *glDebugMessageControl =
|
||||
(glDebugMessageControl_type *)win32_load_gl_always("glDebugMessageControl", module);
|
||||
if(glDebugMessageCallback != 0 && glDebugMessageControl != 0)
|
||||
{
|
||||
glDebugMessageCallback(OpenGLDebugCallback, 0);
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ReleaseDC(win32vars.window_handle, dc);
|
||||
}
|
||||
|
||||
#if FRED_INTERNAL
|
||||
// NOTE(casey): This slows down GL but puts error messages to
|
||||
// the debug console immediately whenever you do something wrong
|
||||
glDebugMessageCallback_type *glDebugMessageCallback =
|
||||
(glDebugMessageCallback_type *)wglGetProcAddress("glDebugMessageCallback");
|
||||
glDebugMessageControl_type *glDebugMessageControl =
|
||||
(glDebugMessageControl_type *)wglGetProcAddress("glDebugMessageControl");
|
||||
if(glDebugMessageCallback && glDebugMessageControl)
|
||||
{
|
||||
glDebugMessageCallback(OpenGLDebugCallback, 0);
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
#endif
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -2059,7 +2071,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
|
|||
return(result);
|
||||
}
|
||||
|
||||
int
|
||||
int CALL_CONVENTION
|
||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
|
||||
i32 argc = __argc;
|
||||
char **argv = __argv;
|
||||
|
@ -2107,6 +2119,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
memory->id = thread->id;
|
||||
|
||||
thread->queue = &win32vars.queues[BACKGROUND_THREADS];
|
||||
|
||||
thread->handle = CreateThread(0, 0, JobThreadProc, thread, creation_flag, (LPDWORD)&thread->windows_id);
|
||||
}
|
||||
|
||||
|
@ -2124,7 +2137,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
|
||||
LPVOID base;
|
||||
#if FRED_INTERNAL
|
||||
#if defined(BUILD_X64)
|
||||
base = (LPVOID)TB(1);
|
||||
#elif defined(BUILD_X86)
|
||||
base = (LPVOID)MB(96);
|
||||
#endif
|
||||
#else
|
||||
base = (LPVOID)0;
|
||||
#endif
|
||||
|
@ -2133,7 +2150,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
memory_vars.vars_memory = VirtualAlloc(base, memory_vars.vars_memory_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
|
||||
#if FRED_INTERNAL
|
||||
#if defined(BUILD_X64)
|
||||
base = (LPVOID)TB(2);
|
||||
#elif defined(BUILD_X86)
|
||||
base = (LPVOID)MB(98);
|
||||
#endif
|
||||
#else
|
||||
base = (LPVOID)0;
|
||||
#endif
|
||||
|
@ -2144,13 +2165,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
memory_vars.user_memory_size = MB(2);
|
||||
memory_vars.user_memory = VirtualAlloc(base, memory_vars.target_memory_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
|
||||
if (!memory_vars.vars_memory){
|
||||
exit(1);
|
||||
}
|
||||
|
||||
win32vars.target.max = MB(1);
|
||||
win32vars.target.push_buffer = (char*)system_get_memory(win32vars.target.max);
|
||||
|
||||
if (!memory_vars.vars_memory || !memory_vars.target_memory || !memory_vars.user_memory || !win32vars.target.push_buffer){
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// System and Application Layer Linkage
|
||||
|
@ -2241,7 +2262,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
|
||||
WNDCLASS window_class = {};
|
||||
window_class.style = CS_HREDRAW|CS_VREDRAW;
|
||||
window_class.lpfnWndProc = Win32Callback;
|
||||
window_class.lpfnWndProc = (WNDPROC)(Win32Callback);
|
||||
window_class.hInstance = hInstance;
|
||||
window_class.lpszClassName = "4coder-win32-wndclass";
|
||||
window_class.hIcon = LoadIcon(hInstance, "main");
|
||||
|
@ -2345,12 +2366,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
// Main Loop
|
||||
//
|
||||
|
||||
win32vars.app.init(&win32vars.system,
|
||||
&win32vars.target,
|
||||
&memory_vars,
|
||||
win32vars.clipboard_contents,
|
||||
current_directory,
|
||||
win32vars.custom_api);
|
||||
win32vars.app.init(&win32vars.system, &win32vars.target, &memory_vars, win32vars.clipboard_contents, current_directory, win32vars.custom_api);
|
||||
|
||||
system_free_memory(current_directory.str);
|
||||
|
||||
|
@ -2550,12 +2566,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
win32vars.send_exit_signal = 0;
|
||||
}
|
||||
|
||||
win32vars.app.step(&win32vars.system,
|
||||
&win32vars.target,
|
||||
&memory_vars,
|
||||
&input,
|
||||
&result,
|
||||
clparams);
|
||||
win32vars.app.step(&win32vars.system, &win32vars.target, &memory_vars, &input, &result, clparams);
|
||||
|
||||
if (result.perform_kill){
|
||||
keep_playing = 0;
|
||||
|
|
22
win32_gl.h
22
win32_gl.h
|
@ -55,7 +55,6 @@ Created 27.01.2017 (dd.mm.yyyy)
|
|||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
typedef BOOL wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
|
@ -67,14 +66,25 @@ typedef BOOL wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList,
|
|||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
typedef HGLRC wglCreateContextAttribsARB_Function(HDC hDC, HGLRC hshareContext, const int *attribList);
|
||||
|
||||
typedef const char* wglGetExtensionsStringARB_Function(HDC hdc);
|
||||
typedef BOOL CALL_CONVENTION
|
||||
wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
|
||||
typedef HGLRC CALL_CONVENTION
|
||||
wglCreateContextAttribsARB_Function(HDC hDC, HGLRC hshareContext, const int *attribList);
|
||||
|
||||
typedef const char* CALL_CONVENTION
|
||||
wglGetExtensionsStringARB_Function(HDC hdc);
|
||||
|
||||
typedef void CALL_CONVENTION
|
||||
GLDEBUGPROC_TYPE(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char * message, const GLvoid * userParam);
|
||||
|
||||
typedef void GLDEBUGPROC_TYPE(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char * message, const GLvoid * userParam);
|
||||
typedef GLDEBUGPROC_TYPE * GLDEBUGPROC;
|
||||
typedef void glDebugMessageControl_type(GLenum source, GLenum type, GLenum severity, GLsizei count, GLuint * ids, GLboolean enabled);
|
||||
typedef void glDebugMessageCallback_type(GLDEBUGPROC callback, void * userParam);
|
||||
typedef void CALL_CONVENTION
|
||||
glDebugMessageControl_type(GLenum source, GLenum type, GLenum severity, GLsizei count, GLuint * ids, GLboolean enabled);
|
||||
|
||||
typedef void CALL_CONVENTION
|
||||
glDebugMessageCallback_type(GLDEBUGPROC callback, void * userParam);
|
||||
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
|
|
Loading…
Reference in New Issue