2016-02-11 17:17:52 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 09.02.2016
|
|
|
|
*
|
|
|
|
* Shared system functions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2017-03-12 23:24:53 +00:00
|
|
|
#if !defined(FCODER_SYSTEM_SHARED_CPP)
|
|
|
|
#define FCODER_SYSTEM_SHARED_CPP
|
|
|
|
|
2016-08-29 13:57:05 +00:00
|
|
|
//
|
2017-03-11 18:35:12 +00:00
|
|
|
// Standard implementation of file system stuff based on the file track layer.
|
2016-08-29 13:57:05 +00:00
|
|
|
//
|
|
|
|
|
2017-06-30 22:54:06 +00:00
|
|
|
internal i32
|
|
|
|
system_get_binary_path_string(String *out){
|
|
|
|
out->size = system_get_4ed_path(out->str, out->memory_size);
|
|
|
|
return(out->size);
|
|
|
|
}
|
|
|
|
|
2016-08-29 13:57:05 +00:00
|
|
|
internal void
|
|
|
|
init_shared_vars(){
|
2019-06-01 23:58:28 +00:00
|
|
|
shared_vars.scratch = make_arena_system(&sysfunc);
|
|
|
|
shared_vars.font_scratch = make_arena_system(&sysfunc);
|
|
|
|
shared_vars.pixel_scratch = make_arena_system(&sysfunc);
|
2016-08-29 13:57:05 +00:00
|
|
|
}
|
|
|
|
|
2016-08-29 02:14:02 +00:00
|
|
|
//
|
|
|
|
// General shared pieces
|
|
|
|
//
|
|
|
|
|
2016-02-11 17:17:52 +00:00
|
|
|
internal void
|
2016-02-20 18:23:46 +00:00
|
|
|
sysshared_filter_real_files(char **files, i32 *file_count){
|
2017-03-23 22:45:32 +00:00
|
|
|
i32 end = *file_count;
|
|
|
|
i32 i = 0, j = 0;
|
|
|
|
for (; i < end; ++i){
|
|
|
|
if (system_file_can_be_made((u8*)files[i])){
|
2016-02-11 17:17:52 +00:00
|
|
|
files[j] = files[i];
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*file_count = j;
|
|
|
|
}
|
|
|
|
|
2016-05-27 17:11:38 +00:00
|
|
|
internal b32
|
|
|
|
sysshared_to_binary_path(String *out_filename, char *filename){
|
|
|
|
b32 translate_success = 0;
|
|
|
|
i32 max = out_filename->memory_size;
|
2017-07-18 21:19:28 +00:00
|
|
|
i32 size = out_filename->size = system_get_4ed_path(out_filename->str, out_filename->memory_size);
|
2016-05-27 17:11:38 +00:00
|
|
|
if (size > 0 && size < max-1){
|
|
|
|
out_filename->size = size;
|
2016-08-28 04:31:06 +00:00
|
|
|
if (append_sc(out_filename, filename) && terminate_with_null(out_filename)){
|
2016-05-27 17:11:38 +00:00
|
|
|
translate_success = 1;
|
|
|
|
}
|
2016-02-20 18:23:46 +00:00
|
|
|
}
|
2017-03-10 20:44:42 +00:00
|
|
|
return(translate_success);
|
2016-02-20 18:23:46 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 23:24:53 +00:00
|
|
|
#endif
|
|
|
|
|
2016-02-11 17:17:52 +00:00
|
|
|
// BOTTOM
|
|
|
|
|