From f2e53fd899354d40bb5365f7484ca58d2b47db45 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 15 Mar 2026 10:47:53 +0100 Subject: [PATCH] base: cleanup --- base/sources/engine.c | 16 +- base/sources/engine.h | 14 +- base/sources/iron_armpack.c | 4 +- base/sources/iron_armpack.h | 2 +- base/sources/iron_array.c | 16 +- base/sources/iron_array.h | 14 +- base/sources/iron_input.c | 300 +++++++++--------- base/sources/iron_input.h | 14 +- base/sources/iron_json.c | 2 +- base/sources/iron_json.h | 2 +- base/sources/iron_map.c | 12 +- base/sources/iron_map.h | 6 +- base/sources/iron_path.c | 158 ++++----- base/sources/iron_path.h | 4 +- base/sources/iron_system.c | 10 +- base/sources/iron_system.h | 2 +- base/sources/iron_ui.c | 6 +- base/sources/iron_ui.h | 8 +- base/sources/iron_ui_nodes.c | 12 +- base/sources/iron_ui_nodes.h | 4 +- base/sources/plugins/plugin_api.c | 2 +- base/tools/pad/main.c | 6 +- paint/plugins/plugins.c | 12 +- paint/sources/base.c | 4 +- paint/sources/box_export.c | 18 +- paint/sources/box_preferences.c | 14 +- paint/sources/brush_nodes/brush_output_node.c | 4 +- paint/sources/config.c | 2 +- paint/sources/console.c | 2 +- paint/sources/export_arm.c | 2 +- paint/sources/export_texture.c | 2 +- paint/sources/import_arm.c | 2 +- paint/sources/make_material.c | 2 +- .../material_nodes/image_texture_node.c | 4 +- paint/sources/node_shader.c | 4 +- paint/sources/parser_logic.c | 2 +- paint/sources/parser_material.c | 2 +- paint/sources/project.c | 6 +- paint/sources/tab_browser.c | 2 +- paint/sources/tab_meshes.c | 2 +- paint/sources/translator.c | 2 +- paint/sources/ui_files.c | 2 +- paint/sources/ui_menubar.c | 2 +- paint/sources/ui_nodes.c | 2 +- paint/sources/ui_view2d.c | 2 +- 45 files changed, 355 insertions(+), 355 deletions(-) diff --git a/base/sources/engine.c b/base/sources/engine.c index cc02da61..5eac33e8 100644 --- a/base/sources/engine.c +++ b/base/sources/engine.c @@ -982,7 +982,7 @@ bool mesh_object_cull_mesh(mesh_object_t *raw, char *context, camera_object_t *c return false; } -void mesh_object_render(mesh_object_t *raw, char *context, char_ptr_array_t *bind_params) { +void mesh_object_render(mesh_object_t *raw, char *context, string_array_t *bind_params) { if (!raw->base->visible) { return; // Skip render if object is hidden } @@ -1249,7 +1249,7 @@ f32 (*uniforms_f32_links)(object_t *o, material_data_t *md, char *s) f32_array_t *(*uniforms_f32_array_links)(object_t *o, material_data_t *md, char *s) = NULL; i32 (*uniforms_i32_links)(object_t *o, material_data_t *md, char *s) = NULL; -void uniforms_set_context_consts(shader_context_t *context, char_ptr_array_t *bind_params) { +void uniforms_set_context_consts(shader_context_t *context, string_array_t *bind_params) { // On shader compile error, _.constants.length will be 0 if (context->constants != NULL && context->constants->length == context->_->constants->length) { for (i32 i = 0; i < context->constants->length; ++i) { @@ -2422,7 +2422,7 @@ void scene_gen_transform(obj_t *object, transform_t *transform) { } } -void scene_load_embedded_data(char_ptr_array_t *datas) { +void scene_load_embedded_data(string_array_t *datas) { if (datas == NULL) { return; } @@ -2462,7 +2462,7 @@ gpu_texture_t *_render_path_current_image = NULL; bool _render_path_paused = false; i32 _render_path_last_w = 0; i32 _render_path_last_h = 0; -char_ptr_array_t *_render_path_bind_params = NULL; +string_array_t *_render_path_bind_params = NULL; f32 _render_path_last_frame_time = 0.0; i32 _render_path_loading = 0; any_map_t *_render_path_cached_shader_contexts = NULL; @@ -2488,7 +2488,7 @@ void render_path_render_frame(void) { _render_path_frame++; } -void render_path_set_target(char *target, char_ptr_array_t *additional, char *depth_buffer, gpu_clear_t flags, i32 color, f32 depth) { +void render_path_set_target(char *target, string_array_t *additional, char *depth_buffer, gpu_clear_t flags, i32 color, f32 depth) { if (_render_path_current_image != NULL) { render_path_end(); } @@ -2557,11 +2557,11 @@ void render_path_draw_skydome(char *handle) { void render_path_bind_target(char *target, char *uniform) { if (_render_path_bind_params != NULL) { - char_ptr_array_push(_render_path_bind_params, target); - char_ptr_array_push(_render_path_bind_params, uniform); + string_array_push(_render_path_bind_params, target); + string_array_push(_render_path_bind_params, uniform); } else { - _render_path_bind_params = char_ptr_array_create(2); + _render_path_bind_params = string_array_create(2); _render_path_bind_params->buffer[0] = target; _render_path_bind_params->buffer[1] = uniform; _render_path_bind_params->length = 2; diff --git a/base/sources/engine.h b/base/sources/engine.h index 2f5bab6e..eecef662 100644 --- a/base/sources/engine.h +++ b/base/sources/engine.h @@ -180,7 +180,7 @@ typedef struct scene { any_array_t *world_datas; // world_data_t[] char *world_ref; any_array_t *speaker_datas; // TODO: deprecated - char_ptr_array_t *embedded_datas; // Preload for this scene, images only for now + string_array_t *embedded_datas; // Preload for this scene, images only for now } scene_t; typedef struct shader_context_runtime { @@ -224,7 +224,7 @@ typedef struct shader_context { u8_array_t *color_writes_green; u8_array_t *color_writes_blue; u8_array_t *color_writes_alpha; - char_ptr_array_t *color_attachments; // RGBA32, RGBA64, R8 + string_array_t *color_attachments; // RGBA32, RGBA64, R8 char *depth_attachment; // D32 vertex_element_t_array_t *vertex_elements; // vertex_element_t[] shader_const_t_array_t *constants; // shader_const_t[] @@ -498,7 +498,7 @@ void mesh_object_set_data(mesh_object_t *raw, mesh_data_t *dat void mesh_object_remove(mesh_object_t *raw); bool mesh_object_cull_material(mesh_object_t *raw, char *context); bool mesh_object_cull_mesh(mesh_object_t *raw, char *context, camera_object_t *camera); -void mesh_object_render(mesh_object_t *raw, char *context, char_ptr_array_t *bind_params); +void mesh_object_render(mesh_object_t *raw, char *context, string_array_t *bind_params); bool mesh_object_valid_context(mesh_object_t *raw, material_data_t *mat, char *context); extern mat4_t _uniforms_mat; @@ -525,7 +525,7 @@ extern i32 (*uniforms_i32_links)(object_t *o, material_data_t *md, char *s); // ╚██████╔╝██║ ╚████║██║██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████║ // ╚═════╝ ╚═╝ ╚═══╝╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ -void uniforms_set_context_consts(shader_context_t *context, char_ptr_array_t *bind_params); +void uniforms_set_context_consts(shader_context_t *context, string_array_t *bind_params); void uniforms_set_obj_consts(shader_context_t *context, object_t *object); void uniforms_bind_render_target(render_target_t *rt, shader_context_t *context, char *sampler_id); bool uniforms_set_context_const(i32 location, shader_const_t *c); @@ -627,7 +627,7 @@ object_t *scene_create_mesh_object(obj_t *o, scene_t *format, object_t *p object_t *scene_return_mesh_object(char *object_file, char *data_ref, material_data_t *material, object_t *parent, obj_t *o); object_t *scene_return_object(object_t *object, obj_t *o); void scene_gen_transform(obj_t *object, transform_t *transform); -void scene_load_embedded_data(char_ptr_array_t *datas); +void scene_load_embedded_data(string_array_t *datas); void scene_embed_data(char *file); // ██████╗ ███████╗███╗ ██╗██████╗ ███████╗██████╗ ██████╗ █████╗ ████████╗██╗ ██╗ @@ -648,14 +648,14 @@ extern gpu_texture_t *_render_path_current_image; extern bool _render_path_paused; extern i32 _render_path_last_w; extern i32 _render_path_last_h; -extern char_ptr_array_t *_render_path_bind_params; +extern string_array_t *_render_path_bind_params; extern f32 _render_path_last_frame_time; extern i32 _render_path_loading; extern any_map_t *_render_path_cached_shader_contexts; bool render_path_ready(void); void render_path_render_frame(void); -void render_path_set_target(char *target, char_ptr_array_t *additional, char *depth_buffer, gpu_clear_t flags, i32 color, f32 depth); +void render_path_set_target(char *target, string_array_t *additional, char *depth_buffer, gpu_clear_t flags, i32 color, f32 depth); void render_path_end(void); void render_path_draw_meshes(char *context); void render_path_submit_draw(char *context); diff --git a/base/sources/iron_armpack.c b/base/sources/iron_armpack.c index 9414b354..a070fe8e 100644 --- a/base/sources/iron_armpack.c +++ b/base/sources/iron_armpack.c @@ -543,7 +543,7 @@ void armpack_encode_array_u8(u8_array_t *u8a) { } } -void armpack_encode_array_string(char_ptr_array_t *strings) { +void armpack_encode_array_string(string_array_t *strings) { if (strings == NULL) { armpack_write_u8(0xc0); // NULL return; @@ -719,7 +719,7 @@ any_map_t *_armpack_decode_to_map() { } else if (element_flag == 0xdb) { // string ei--; - char_ptr_array_t *array = char_ptr_array_create(array_count); + string_array_t *array = string_array_create(array_count); for (uint32_t j = 0; j < array_count; j++) { read_u8(); // flag array->buffer[j] = read_string_alloc(); diff --git a/base/sources/iron_armpack.h b/base/sources/iron_armpack.h index 18eebfc9..f8ba95ff 100644 --- a/base/sources/iron_armpack.h +++ b/base/sources/iron_armpack.h @@ -19,7 +19,7 @@ void armpack_encode_array_f32(f32_array_t *f32a); void armpack_encode_array_i32(i32_array_t *i32a); void armpack_encode_array_i16(i16_array_t *i16a); void armpack_encode_array_u8(u8_array_t *u8a); -void armpack_encode_array_string(char_ptr_array_t *strings); +void armpack_encode_array_string(string_array_t *strings); void armpack_encode_string(char *str); void armpack_encode_i32(int32_t i); void armpack_encode_f32(float f); diff --git a/base/sources/iron_array.c b/base/sources/iron_array.c index c03aa12c..0ac5831b 100644 --- a/base/sources/iron_array.c +++ b/base/sources/iron_array.c @@ -79,7 +79,7 @@ void any_array_push(any_array_t *a, void *e) { a->buffer[a->length++] = e; } -void char_ptr_array_push(char_ptr_array_t *a, void *e) { +void string_array_push(string_array_t *a, void *e) { array_alloc(a, sizeof(uintptr_t)); a->buffer[a->length++] = e; } @@ -131,7 +131,7 @@ void any_array_resize(any_array_t *a, uint32_t size) { a->buffer = gc_realloc(a->buffer, a->capacity * sizeof(void *)); } -void char_ptr_array_resize(char_ptr_array_t *a, uint32_t size) { +void string_array_resize(string_array_t *a, uint32_t size) { a->capacity = size; a->buffer = gc_realloc(a->buffer, a->capacity * sizeof(void *)); } @@ -246,8 +246,8 @@ void array_remove(any_array_t *ar, void *e) { } } -void char_ptr_array_remove(char_ptr_array_t *ar, char *e) { - int32_t i = char_ptr_array_index_of(ar, e); +void string_array_remove(string_array_t *ar, char *e) { + int32_t i = string_array_index_of(ar, e); if (i > -1) { array_splice(ar, i, 1); } @@ -269,7 +269,7 @@ int32_t array_index_of(any_array_t *ar, void *e) { return -1; } -int32_t char_ptr_array_index_of(char_ptr_array_t *ar, char *e) { +int32_t string_array_index_of(string_array_t *ar, char *e) { for (uint32_t i = 0; i < ar->length; ++i) { if (string_equals(ar->buffer[i], e)) { return i; @@ -636,10 +636,10 @@ any_array_t *any_array_create_from_raw(void **raw, uint32_t length) { return a; } -char_ptr_array_t *char_ptr_array_create(uint32_t length) { - char_ptr_array_t *a = gc_alloc(sizeof(char_ptr_array_t)); +string_array_t *string_array_create(uint32_t length) { + string_array_t *a = gc_alloc(sizeof(string_array_t)); if (length > 0) { - char_ptr_array_resize(a, length); + string_array_resize(a, length); a->length = length; } return a; diff --git a/base/sources/iron_array.h b/base/sources/iron_array.h index 4d39dee9..23dd6770 100644 --- a/base/sources/iron_array.h +++ b/base/sources/iron_array.h @@ -50,11 +50,11 @@ typedef struct any_array { uint32_t capacity; } any_array_t; -typedef struct char_ptr_array { +typedef struct string_array { char **buffer; uint32_t length; uint32_t capacity; -} char_ptr_array_t; +} string_array_t; typedef u8_array_t buffer_t; @@ -67,7 +67,7 @@ void i32_array_push(i32_array_t *a, int32_t e); void u32_array_push(u32_array_t *a, uint32_t e); void f32_array_push(f32_array_t *a, float e); void any_array_push(any_array_t *a, void *e); -void char_ptr_array_push(char_ptr_array_t *a, void *e); +void string_array_push(string_array_t *a, void *e); void i8_array_resize(i8_array_t *a, uint32_t size); void u8_array_resize(u8_array_t *a, uint32_t size); @@ -77,7 +77,7 @@ void i32_array_resize(i32_array_t *a, uint32_t size); void u32_array_resize(u32_array_t *a, uint32_t size); void f32_array_resize(f32_array_t *a, uint32_t size); void any_array_resize(any_array_t *a, uint32_t size); -void char_ptr_array_resize(char_ptr_array_t *a, uint32_t size); +void string_array_resize(string_array_t *a, uint32_t size); void buffer_resize(buffer_t *b, uint32_t size); void array_sort(any_array_t *ar, int (*compare)(const void *, const void *)); @@ -91,10 +91,10 @@ any_array_t *array_concat(any_array_t *a, any_array_t *b); any_array_t *array_slice(any_array_t *a, uint32_t begin, uint32_t end); void array_insert(any_array_t *a, uint32_t at, void *e); void array_remove(any_array_t *ar, void *e); -void char_ptr_array_remove(char_ptr_array_t *ar, char *e); +void string_array_remove(string_array_t *ar, char *e); void i32_array_remove(i32_array_t *ar, int e); int32_t array_index_of(any_array_t *ar, void *e); -int32_t char_ptr_array_index_of(char_ptr_array_t *ar, char *e); +int32_t string_array_index_of(string_array_t *ar, char *e); int32_t i32_array_index_of(i32_array_t *ar, int e); void array_reverse(any_array_t *ar); @@ -148,6 +148,6 @@ i8_array_t *i8_array_create(uint32_t length); i8_array_t *i8_array_create_from_raw(int8_t *raw, uint32_t length); any_array_t *any_array_create(uint32_t length); any_array_t *any_array_create_from_raw(void **raw, uint32_t length); -char_ptr_array_t *char_ptr_array_create(uint32_t length); +string_array_t *string_array_create(uint32_t length); uint16_t float_to_half_fast(float value); uint8_t half_to_u8_fast(uint16_t h); diff --git a/base/sources/iron_input.c b/base/sources/iron_input.c index e081f7e2..3c841291 100644 --- a/base/sources/iron_input.c +++ b/base/sources/iron_input.c @@ -17,7 +17,7 @@ bool _input_registered = false; // Mouse -char_ptr_array_t *_mouse_buttons = NULL; +string_array_t *_mouse_buttons = NULL; u8_array_t *_mouse_buttons_down = NULL; u8_array_t *_mouse_buttons_started = NULL; u8_array_t *_mouse_buttons_released = NULL; @@ -38,7 +38,7 @@ f32 mouse_pinch_smooth = 0.0f; // Pen -char_ptr_array_t *pen_buttons = NULL; +string_array_t *pen_buttons = NULL; u8_array_t *pen_buttons_down = NULL; u8_array_t *pen_buttons_started = NULL; u8_array_t *pen_buttons_released = NULL; @@ -55,11 +55,11 @@ f32 pen_last_y = -1.0f; // Keyboard -char_ptr_array_t *keyboard_keys = NULL; +string_array_t *keyboard_keys = NULL; i32_map_t *keyboard_keys_down = NULL; i32_map_t *keyboard_keys_started = NULL; i32_map_t *keyboard_keys_released = NULL; -char_ptr_array_t *keyboard_keys_frame = NULL; +string_array_t *keyboard_keys_frame = NULL; bool keyboard_repeat_key = false; f32 keyboard_repeat_time = 0.0f; @@ -67,9 +67,9 @@ f32 keyboard_repeat_time = 0.0f; // Gamepad -char_ptr_array_t *gamepad_buttons_ps = NULL; -char_ptr_array_t *gamepad_buttons_xbox = NULL; -char_ptr_array_t *gamepad_buttons = NULL; +string_array_t *gamepad_buttons_ps = NULL; +string_array_t *gamepad_buttons_xbox = NULL; +string_array_t *gamepad_buttons = NULL; any_array_t *gamepad_raws = NULL; #endif @@ -104,13 +104,13 @@ void input_register(void) { _input_occupied = false; - _mouse_buttons = char_ptr_array_create(0); + _mouse_buttons = string_array_create(0); gc_root(_mouse_buttons); - char_ptr_array_push(_mouse_buttons, "left"); - char_ptr_array_push(_mouse_buttons, "right"); - char_ptr_array_push(_mouse_buttons, "middle"); - char_ptr_array_push(_mouse_buttons, "side1"); - char_ptr_array_push(_mouse_buttons, "side2"); + string_array_push(_mouse_buttons, "left"); + string_array_push(_mouse_buttons, "right"); + string_array_push(_mouse_buttons, "middle"); + string_array_push(_mouse_buttons, "side1"); + string_array_push(_mouse_buttons, "side2"); _mouse_buttons_down = u8_array_create(0); gc_root(_mouse_buttons_down); @@ -139,9 +139,9 @@ void input_register(void) { mouse_pinch_smooth = 0.0f; #endif - pen_buttons = char_ptr_array_create(0); + pen_buttons = string_array_create(0); gc_root(pen_buttons); - char_ptr_array_push(pen_buttons, "tip"); + string_array_push(pen_buttons, "tip"); pen_buttons_down = u8_array_create(0); gc_root(pen_buttons_down); @@ -164,101 +164,101 @@ void input_register(void) { pen_last_x = -1.0f; pen_last_y = -1.0f; - keyboard_keys = char_ptr_array_create(0); + keyboard_keys = string_array_create(0); gc_root(keyboard_keys); - char_ptr_array_push(keyboard_keys, "a"); - char_ptr_array_push(keyboard_keys, "b"); - char_ptr_array_push(keyboard_keys, "c"); - char_ptr_array_push(keyboard_keys, "d"); - char_ptr_array_push(keyboard_keys, "e"); - char_ptr_array_push(keyboard_keys, "f"); - char_ptr_array_push(keyboard_keys, "g"); - char_ptr_array_push(keyboard_keys, "h"); - char_ptr_array_push(keyboard_keys, "i"); - char_ptr_array_push(keyboard_keys, "j"); - char_ptr_array_push(keyboard_keys, "k"); - char_ptr_array_push(keyboard_keys, "l"); - char_ptr_array_push(keyboard_keys, "m"); - char_ptr_array_push(keyboard_keys, "n"); - char_ptr_array_push(keyboard_keys, "o"); - char_ptr_array_push(keyboard_keys, "p"); - char_ptr_array_push(keyboard_keys, "q"); - char_ptr_array_push(keyboard_keys, "r"); - char_ptr_array_push(keyboard_keys, "s"); - char_ptr_array_push(keyboard_keys, "t"); - char_ptr_array_push(keyboard_keys, "u"); - char_ptr_array_push(keyboard_keys, "v"); - char_ptr_array_push(keyboard_keys, "w"); - char_ptr_array_push(keyboard_keys, "x"); - char_ptr_array_push(keyboard_keys, "y"); - char_ptr_array_push(keyboard_keys, "z"); - char_ptr_array_push(keyboard_keys, "0"); - char_ptr_array_push(keyboard_keys, "1"); - char_ptr_array_push(keyboard_keys, "2"); - char_ptr_array_push(keyboard_keys, "3"); - char_ptr_array_push(keyboard_keys, "4"); - char_ptr_array_push(keyboard_keys, "5"); - char_ptr_array_push(keyboard_keys, "6"); - char_ptr_array_push(keyboard_keys, "7"); - char_ptr_array_push(keyboard_keys, "8"); - char_ptr_array_push(keyboard_keys, "9"); - char_ptr_array_push(keyboard_keys, "space"); - char_ptr_array_push(keyboard_keys, "backspace"); - char_ptr_array_push(keyboard_keys, "tab"); - char_ptr_array_push(keyboard_keys, "enter"); - char_ptr_array_push(keyboard_keys, "shift"); - char_ptr_array_push(keyboard_keys, "control"); - char_ptr_array_push(keyboard_keys, "alt"); - char_ptr_array_push(keyboard_keys, "win"); - char_ptr_array_push(keyboard_keys, "escape"); - char_ptr_array_push(keyboard_keys, "delete"); - char_ptr_array_push(keyboard_keys, "up"); - char_ptr_array_push(keyboard_keys, "down"); - char_ptr_array_push(keyboard_keys, "left"); - char_ptr_array_push(keyboard_keys, "right"); - char_ptr_array_push(keyboard_keys, "back"); - char_ptr_array_push(keyboard_keys, ","); - char_ptr_array_push(keyboard_keys, "."); - char_ptr_array_push(keyboard_keys, ":"); - char_ptr_array_push(keyboard_keys, ";"); - char_ptr_array_push(keyboard_keys, "<"); - char_ptr_array_push(keyboard_keys, "="); - char_ptr_array_push(keyboard_keys, ">"); - char_ptr_array_push(keyboard_keys, "?"); - char_ptr_array_push(keyboard_keys, "!"); - char_ptr_array_push(keyboard_keys, "\""); - char_ptr_array_push(keyboard_keys, "#"); - char_ptr_array_push(keyboard_keys, "$"); - char_ptr_array_push(keyboard_keys, "%"); - char_ptr_array_push(keyboard_keys, "&"); - char_ptr_array_push(keyboard_keys, "_"); - char_ptr_array_push(keyboard_keys, "("); - char_ptr_array_push(keyboard_keys, ")"); - char_ptr_array_push(keyboard_keys, "*"); - char_ptr_array_push(keyboard_keys, "|"); - char_ptr_array_push(keyboard_keys, "{"); - char_ptr_array_push(keyboard_keys, "}"); - char_ptr_array_push(keyboard_keys, "["); - char_ptr_array_push(keyboard_keys, "]"); - char_ptr_array_push(keyboard_keys, "~"); - char_ptr_array_push(keyboard_keys, "`"); - char_ptr_array_push(keyboard_keys, "/"); - char_ptr_array_push(keyboard_keys, "\\"); - char_ptr_array_push(keyboard_keys, "@"); - char_ptr_array_push(keyboard_keys, "+"); - char_ptr_array_push(keyboard_keys, "-"); - char_ptr_array_push(keyboard_keys, "f1"); - char_ptr_array_push(keyboard_keys, "f2"); - char_ptr_array_push(keyboard_keys, "f3"); - char_ptr_array_push(keyboard_keys, "f4"); - char_ptr_array_push(keyboard_keys, "f5"); - char_ptr_array_push(keyboard_keys, "f6"); - char_ptr_array_push(keyboard_keys, "f7"); - char_ptr_array_push(keyboard_keys, "f8"); - char_ptr_array_push(keyboard_keys, "f9"); - char_ptr_array_push(keyboard_keys, "f10"); - char_ptr_array_push(keyboard_keys, "f11"); - char_ptr_array_push(keyboard_keys, "f12"); + string_array_push(keyboard_keys, "a"); + string_array_push(keyboard_keys, "b"); + string_array_push(keyboard_keys, "c"); + string_array_push(keyboard_keys, "d"); + string_array_push(keyboard_keys, "e"); + string_array_push(keyboard_keys, "f"); + string_array_push(keyboard_keys, "g"); + string_array_push(keyboard_keys, "h"); + string_array_push(keyboard_keys, "i"); + string_array_push(keyboard_keys, "j"); + string_array_push(keyboard_keys, "k"); + string_array_push(keyboard_keys, "l"); + string_array_push(keyboard_keys, "m"); + string_array_push(keyboard_keys, "n"); + string_array_push(keyboard_keys, "o"); + string_array_push(keyboard_keys, "p"); + string_array_push(keyboard_keys, "q"); + string_array_push(keyboard_keys, "r"); + string_array_push(keyboard_keys, "s"); + string_array_push(keyboard_keys, "t"); + string_array_push(keyboard_keys, "u"); + string_array_push(keyboard_keys, "v"); + string_array_push(keyboard_keys, "w"); + string_array_push(keyboard_keys, "x"); + string_array_push(keyboard_keys, "y"); + string_array_push(keyboard_keys, "z"); + string_array_push(keyboard_keys, "0"); + string_array_push(keyboard_keys, "1"); + string_array_push(keyboard_keys, "2"); + string_array_push(keyboard_keys, "3"); + string_array_push(keyboard_keys, "4"); + string_array_push(keyboard_keys, "5"); + string_array_push(keyboard_keys, "6"); + string_array_push(keyboard_keys, "7"); + string_array_push(keyboard_keys, "8"); + string_array_push(keyboard_keys, "9"); + string_array_push(keyboard_keys, "space"); + string_array_push(keyboard_keys, "backspace"); + string_array_push(keyboard_keys, "tab"); + string_array_push(keyboard_keys, "enter"); + string_array_push(keyboard_keys, "shift"); + string_array_push(keyboard_keys, "control"); + string_array_push(keyboard_keys, "alt"); + string_array_push(keyboard_keys, "win"); + string_array_push(keyboard_keys, "escape"); + string_array_push(keyboard_keys, "delete"); + string_array_push(keyboard_keys, "up"); + string_array_push(keyboard_keys, "down"); + string_array_push(keyboard_keys, "left"); + string_array_push(keyboard_keys, "right"); + string_array_push(keyboard_keys, "back"); + string_array_push(keyboard_keys, ","); + string_array_push(keyboard_keys, "."); + string_array_push(keyboard_keys, ":"); + string_array_push(keyboard_keys, ";"); + string_array_push(keyboard_keys, "<"); + string_array_push(keyboard_keys, "="); + string_array_push(keyboard_keys, ">"); + string_array_push(keyboard_keys, "?"); + string_array_push(keyboard_keys, "!"); + string_array_push(keyboard_keys, "\""); + string_array_push(keyboard_keys, "#"); + string_array_push(keyboard_keys, "$"); + string_array_push(keyboard_keys, "%"); + string_array_push(keyboard_keys, "&"); + string_array_push(keyboard_keys, "_"); + string_array_push(keyboard_keys, "("); + string_array_push(keyboard_keys, ")"); + string_array_push(keyboard_keys, "*"); + string_array_push(keyboard_keys, "|"); + string_array_push(keyboard_keys, "{"); + string_array_push(keyboard_keys, "}"); + string_array_push(keyboard_keys, "["); + string_array_push(keyboard_keys, "]"); + string_array_push(keyboard_keys, "~"); + string_array_push(keyboard_keys, "`"); + string_array_push(keyboard_keys, "/"); + string_array_push(keyboard_keys, "\\"); + string_array_push(keyboard_keys, "@"); + string_array_push(keyboard_keys, "+"); + string_array_push(keyboard_keys, "-"); + string_array_push(keyboard_keys, "f1"); + string_array_push(keyboard_keys, "f2"); + string_array_push(keyboard_keys, "f3"); + string_array_push(keyboard_keys, "f4"); + string_array_push(keyboard_keys, "f5"); + string_array_push(keyboard_keys, "f6"); + string_array_push(keyboard_keys, "f7"); + string_array_push(keyboard_keys, "f8"); + string_array_push(keyboard_keys, "f9"); + string_array_push(keyboard_keys, "f10"); + string_array_push(keyboard_keys, "f11"); + string_array_push(keyboard_keys, "f12"); keyboard_keys_down = i32_map_create(); gc_root(keyboard_keys_down); @@ -267,54 +267,54 @@ void input_register(void) { keyboard_keys_released = i32_map_create(); gc_root(keyboard_keys_released); - keyboard_keys_frame = char_ptr_array_create(0); + keyboard_keys_frame = string_array_create(0); gc_root(keyboard_keys_frame); keyboard_repeat_key = false; keyboard_repeat_time = 0.0f; #ifdef WITH_GAMEPAD - gamepad_buttons_ps = char_ptr_array_create(0); + gamepad_buttons_ps = string_array_create(0); gc_root(gamepad_buttons_ps); - char_ptr_array_push(gamepad_buttons_ps, "cross"); - char_ptr_array_push(gamepad_buttons_ps, "circle"); - char_ptr_array_push(gamepad_buttons_ps, "square"); - char_ptr_array_push(gamepad_buttons_ps, "triangle"); - char_ptr_array_push(gamepad_buttons_ps, "l1"); - char_ptr_array_push(gamepad_buttons_ps, "r1"); - char_ptr_array_push(gamepad_buttons_ps, "l2"); - char_ptr_array_push(gamepad_buttons_ps, "r2"); - char_ptr_array_push(gamepad_buttons_ps, "share"); - char_ptr_array_push(gamepad_buttons_ps, "options"); - char_ptr_array_push(gamepad_buttons_ps, "l3"); - char_ptr_array_push(gamepad_buttons_ps, "r3"); - char_ptr_array_push(gamepad_buttons_ps, "up"); - char_ptr_array_push(gamepad_buttons_ps, "down"); - char_ptr_array_push(gamepad_buttons_ps, "left"); - char_ptr_array_push(gamepad_buttons_ps, "right"); - char_ptr_array_push(gamepad_buttons_ps, "home"); - char_ptr_array_push(gamepad_buttons_ps, "touchpad"); + string_array_push(gamepad_buttons_ps, "cross"); + string_array_push(gamepad_buttons_ps, "circle"); + string_array_push(gamepad_buttons_ps, "square"); + string_array_push(gamepad_buttons_ps, "triangle"); + string_array_push(gamepad_buttons_ps, "l1"); + string_array_push(gamepad_buttons_ps, "r1"); + string_array_push(gamepad_buttons_ps, "l2"); + string_array_push(gamepad_buttons_ps, "r2"); + string_array_push(gamepad_buttons_ps, "share"); + string_array_push(gamepad_buttons_ps, "options"); + string_array_push(gamepad_buttons_ps, "l3"); + string_array_push(gamepad_buttons_ps, "r3"); + string_array_push(gamepad_buttons_ps, "up"); + string_array_push(gamepad_buttons_ps, "down"); + string_array_push(gamepad_buttons_ps, "left"); + string_array_push(gamepad_buttons_ps, "right"); + string_array_push(gamepad_buttons_ps, "home"); + string_array_push(gamepad_buttons_ps, "touchpad"); - gamepad_buttons_xbox = char_ptr_array_create(0); + gamepad_buttons_xbox = string_array_create(0); gc_root(gamepad_buttons_xbox); - char_ptr_array_push(gamepad_buttons_xbox, "a"); - char_ptr_array_push(gamepad_buttons_xbox, "b"); - char_ptr_array_push(gamepad_buttons_xbox, "x"); - char_ptr_array_push(gamepad_buttons_xbox, "y"); - char_ptr_array_push(gamepad_buttons_xbox, "l1"); - char_ptr_array_push(gamepad_buttons_xbox, "r1"); - char_ptr_array_push(gamepad_buttons_xbox, "l2"); - char_ptr_array_push(gamepad_buttons_xbox, "r2"); - char_ptr_array_push(gamepad_buttons_xbox, "share"); - char_ptr_array_push(gamepad_buttons_xbox, "options"); - char_ptr_array_push(gamepad_buttons_xbox, "l3"); - char_ptr_array_push(gamepad_buttons_xbox, "r3"); - char_ptr_array_push(gamepad_buttons_xbox, "up"); - char_ptr_array_push(gamepad_buttons_xbox, "down"); - char_ptr_array_push(gamepad_buttons_xbox, "left"); - char_ptr_array_push(gamepad_buttons_xbox, "right"); - char_ptr_array_push(gamepad_buttons_xbox, "home"); - char_ptr_array_push(gamepad_buttons_xbox, "touchpad"); + string_array_push(gamepad_buttons_xbox, "a"); + string_array_push(gamepad_buttons_xbox, "b"); + string_array_push(gamepad_buttons_xbox, "x"); + string_array_push(gamepad_buttons_xbox, "y"); + string_array_push(gamepad_buttons_xbox, "l1"); + string_array_push(gamepad_buttons_xbox, "r1"); + string_array_push(gamepad_buttons_xbox, "l2"); + string_array_push(gamepad_buttons_xbox, "r2"); + string_array_push(gamepad_buttons_xbox, "share"); + string_array_push(gamepad_buttons_xbox, "options"); + string_array_push(gamepad_buttons_xbox, "l3"); + string_array_push(gamepad_buttons_xbox, "r3"); + string_array_push(gamepad_buttons_xbox, "up"); + string_array_push(gamepad_buttons_xbox, "down"); + string_array_push(gamepad_buttons_xbox, "left"); + string_array_push(gamepad_buttons_xbox, "right"); + string_array_push(gamepad_buttons_xbox, "home"); + string_array_push(gamepad_buttons_xbox, "touchpad"); gamepad_buttons = gamepad_buttons_ps; @@ -858,7 +858,7 @@ char *keyboard_key_code(i32 key) { void keyboard_down_listener(i32 code) { char *s = keyboard_key_code(code); - char_ptr_array_push(keyboard_keys_frame, s); + string_array_push(keyboard_keys_frame, s); i32_map_set(keyboard_keys_started, s, true); i32_map_set(keyboard_keys_down, s, true); keyboard_repeat_time = sys_time() + 0.4f; @@ -874,7 +874,7 @@ void keyboard_down_listener(i32 code) { void keyboard_up_listener(i32 code) { char *s = keyboard_key_code(code); - char_ptr_array_push(keyboard_keys_frame, s); + string_array_push(keyboard_keys_frame, s); i32_map_set(keyboard_keys_released, s, true); i32_map_set(keyboard_keys_down, s, false); diff --git a/base/sources/iron_input.h b/base/sources/iron_input.h index c8aad63d..08764535 100644 --- a/base/sources/iron_input.h +++ b/base/sources/iron_input.h @@ -17,7 +17,7 @@ void input_register(void); // Mouse -extern char_ptr_array_t *_mouse_buttons; +extern string_array_t *_mouse_buttons; extern u8_array_t *_mouse_buttons_down; extern u8_array_t *_mouse_buttons_started; extern u8_array_t *_mouse_buttons_released; @@ -58,7 +58,7 @@ f32 mouse_view_y(void); // Pen -extern char_ptr_array_t *pen_buttons; +extern string_array_t *pen_buttons; extern u8_array_t *pen_buttons_down; extern u8_array_t *pen_buttons_started; extern u8_array_t *pen_buttons_released; @@ -87,11 +87,11 @@ f32 pen_view_y(void); // Keyboard -extern char_ptr_array_t *keyboard_keys; +extern string_array_t *keyboard_keys; extern i32_map_t *keyboard_keys_down; extern i32_map_t *keyboard_keys_started; extern i32_map_t *keyboard_keys_released; -extern char_ptr_array_t *keyboard_keys_frame; +extern string_array_t *keyboard_keys_frame; extern bool keyboard_repeat_key; extern f32 keyboard_repeat_time; @@ -129,9 +129,9 @@ typedef struct gamepad { gamepad_stick_t *right_stick; } gamepad_t; -extern char_ptr_array_t *gamepad_buttons_ps; -extern char_ptr_array_t *gamepad_buttons_xbox; -extern char_ptr_array_t *gamepad_buttons; +extern string_array_t *gamepad_buttons_ps; +extern string_array_t *gamepad_buttons_xbox; +extern string_array_t *gamepad_buttons; extern any_array_t *gamepad_raws; void gamepad_end_frame(void); diff --git a/base/sources/iron_json.c b/base/sources/iron_json.c index a168fc97..fbeea574 100644 --- a/base/sources/iron_json.c +++ b/base/sources/iron_json.c @@ -345,7 +345,7 @@ void json_encode_string(char *k, char *v) { json_encode_string_value(v); } -void json_encode_string_array(char *k, char_ptr_array_t *a) { +void json_encode_string_array(char *k, string_array_t *a) { json_encode_begin_array(k); for (uint32_t i = 0; i < a->length; ++i) { if (i > 0) { diff --git a/base/sources/iron_json.h b/base/sources/iron_json.h index 54a29626..c9b671da 100644 --- a/base/sources/iron_json.h +++ b/base/sources/iron_json.h @@ -10,7 +10,7 @@ any_map_t *json_parse_to_map(char *s); void json_encode_begin(); char *json_encode_end(); void json_encode_string(char *k, char *v); -void json_encode_string_array(char *k, char_ptr_array_t *a); +void json_encode_string_array(char *k, string_array_t *a); void json_encode_f32(char *k, float f); void json_encode_i32(char *k, int i); void json_encode_null(char *k); diff --git a/base/sources/iron_map.c b/base/sources/iron_map.c index 0172502e..18b3e105 100644 --- a/base/sources/iron_map.c +++ b/base/sources/iron_map.c @@ -31,7 +31,7 @@ static size_t index_set(any_map_t *m, char *k) { return i; } -static size_t index_get(char_ptr_array_t *keys, char *k) { +static size_t index_get(string_array_t *keys, char *k) { if (k == NULL || keys->capacity == 0) { return -1; } @@ -144,11 +144,11 @@ void map_delete(any_map_t *m, char *k) { } any_array_t *map_keys(any_map_t *m) { - char_ptr_array_t *keys = gc_alloc(sizeof(char_ptr_array_t)); - char_ptr_array_resize(keys, m->keys->length); + string_array_t *keys = gc_alloc(sizeof(string_array_t)); + string_array_resize(keys, m->keys->length); for (int i = 0; i < m->keys->capacity; ++i) { if (m->keys->buffer[i] != NULL) { - char_ptr_array_push(keys, m->keys->buffer[i]); + string_array_push(keys, m->keys->buffer[i]); } } return keys; @@ -156,14 +156,14 @@ any_array_t *map_keys(any_map_t *m) { i32_map_t *i32_map_create() { i32_map_t *r = gc_alloc(sizeof(i32_map_t)); - r->keys = gc_alloc(sizeof(char_ptr_array_t)); + r->keys = gc_alloc(sizeof(string_array_t)); r->values = gc_alloc(sizeof(i32_array_t)); return r; } any_map_t *any_map_create() { any_map_t *r = gc_alloc(sizeof(any_map_t)); - r->keys = gc_alloc(sizeof(char_ptr_array_t)); + r->keys = gc_alloc(sizeof(string_array_t)); r->values = gc_alloc(sizeof(any_array_t)); return r; } diff --git a/base/sources/iron_map.h b/base/sources/iron_map.h index 838b9277..963dbe80 100644 --- a/base/sources/iron_map.h +++ b/base/sources/iron_map.h @@ -4,17 +4,17 @@ #include typedef struct i32_map { - char_ptr_array_t *keys; + string_array_t *keys; i32_array_t *values; } i32_map_t; typedef struct f32_map { - char_ptr_array_t *keys; + string_array_t *keys; f32_array_t *values; } f32_map_t; typedef struct any_map { - char_ptr_array_t *keys; + string_array_t *keys; any_array_t *values; } any_map_t; diff --git a/base/sources/iron_path.c b/base/sources/iron_path.c index 26128c12..5d28efe7 100644 --- a/base/sources/iron_path.c +++ b/base/sources/iron_path.c @@ -12,133 +12,133 @@ bool path_is_protected_linux = false; #endif -char_ptr_array_t *_path_mesh_formats = NULL; -char_ptr_array_t *_path_texture_formats = NULL; -static char_ptr_array_t *_path_base_color_ext = NULL; -static char_ptr_array_t *_path_opacity_ext = NULL; -static char_ptr_array_t *_path_normal_map_ext = NULL; -static char_ptr_array_t *_path_occlusion_ext = NULL; -static char_ptr_array_t *_path_roughness_ext = NULL; -static char_ptr_array_t *_path_metallic_ext = NULL; -static char_ptr_array_t *_path_displacement_ext = NULL; +string_array_t *_path_mesh_formats = NULL; +string_array_t *_path_texture_formats = NULL; +static string_array_t *_path_base_color_ext = NULL; +static string_array_t *_path_opacity_ext = NULL; +static string_array_t *_path_normal_map_ext = NULL; +static string_array_t *_path_occlusion_ext = NULL; +static string_array_t *_path_roughness_ext = NULL; +static string_array_t *_path_metallic_ext = NULL; +static string_array_t *_path_displacement_ext = NULL; -char_ptr_array_t *path_mesh_formats(void) { +string_array_t *path_mesh_formats(void) { if (_path_mesh_formats == NULL) { - _path_mesh_formats = char_ptr_array_create(0); + _path_mesh_formats = string_array_create(0); gc_root(_path_mesh_formats); - char_ptr_array_push(_path_mesh_formats, "obj"); - char_ptr_array_push(_path_mesh_formats, "blend"); + string_array_push(_path_mesh_formats, "obj"); + string_array_push(_path_mesh_formats, "blend"); } return _path_mesh_formats; } -char_ptr_array_t *path_texture_formats(void) { +string_array_t *path_texture_formats(void) { if (_path_texture_formats == NULL) { - _path_texture_formats = char_ptr_array_create(0); + _path_texture_formats = string_array_create(0); gc_root(_path_texture_formats); - char_ptr_array_push(_path_texture_formats, "jpg"); - char_ptr_array_push(_path_texture_formats, "jpeg"); - char_ptr_array_push(_path_texture_formats, "png"); - char_ptr_array_push(_path_texture_formats, "tga"); - char_ptr_array_push(_path_texture_formats, "bmp"); - char_ptr_array_push(_path_texture_formats, "psd"); - char_ptr_array_push(_path_texture_formats, "gif"); - char_ptr_array_push(_path_texture_formats, "hdr"); - char_ptr_array_push(_path_texture_formats, "k"); + string_array_push(_path_texture_formats, "jpg"); + string_array_push(_path_texture_formats, "jpeg"); + string_array_push(_path_texture_formats, "png"); + string_array_push(_path_texture_formats, "tga"); + string_array_push(_path_texture_formats, "bmp"); + string_array_push(_path_texture_formats, "psd"); + string_array_push(_path_texture_formats, "gif"); + string_array_push(_path_texture_formats, "hdr"); + string_array_push(_path_texture_formats, "k"); } return _path_texture_formats; } -char_ptr_array_t *path_base_color_ext(void) { +string_array_t *path_base_color_ext(void) { if (_path_base_color_ext == NULL) { - _path_base_color_ext = char_ptr_array_create(0); + _path_base_color_ext = string_array_create(0); gc_root(_path_base_color_ext); - char_ptr_array_push(_path_base_color_ext, "albedo"); - char_ptr_array_push(_path_base_color_ext, "alb"); - char_ptr_array_push(_path_base_color_ext, "basecol"); - char_ptr_array_push(_path_base_color_ext, "basecolor"); - char_ptr_array_push(_path_base_color_ext, "diffuse"); - char_ptr_array_push(_path_base_color_ext, "diff"); - char_ptr_array_push(_path_base_color_ext, "base"); - char_ptr_array_push(_path_base_color_ext, "bc"); - char_ptr_array_push(_path_base_color_ext, "d"); - char_ptr_array_push(_path_base_color_ext, "color"); - char_ptr_array_push(_path_base_color_ext, "col"); + string_array_push(_path_base_color_ext, "albedo"); + string_array_push(_path_base_color_ext, "alb"); + string_array_push(_path_base_color_ext, "basecol"); + string_array_push(_path_base_color_ext, "basecolor"); + string_array_push(_path_base_color_ext, "diffuse"); + string_array_push(_path_base_color_ext, "diff"); + string_array_push(_path_base_color_ext, "base"); + string_array_push(_path_base_color_ext, "bc"); + string_array_push(_path_base_color_ext, "d"); + string_array_push(_path_base_color_ext, "color"); + string_array_push(_path_base_color_ext, "col"); } return _path_base_color_ext; } -char_ptr_array_t *path_opacity_ext(void) { +string_array_t *path_opacity_ext(void) { if (_path_opacity_ext == NULL) { - _path_opacity_ext = char_ptr_array_create(0); + _path_opacity_ext = string_array_create(0); gc_root(_path_opacity_ext); - char_ptr_array_push(_path_opacity_ext, "opac"); - char_ptr_array_push(_path_opacity_ext, "opacity"); - char_ptr_array_push(_path_opacity_ext, "alpha"); + string_array_push(_path_opacity_ext, "opac"); + string_array_push(_path_opacity_ext, "opacity"); + string_array_push(_path_opacity_ext, "alpha"); } return _path_opacity_ext; } -char_ptr_array_t *path_normal_map_ext(void) { +string_array_t *path_normal_map_ext(void) { if (_path_normal_map_ext == NULL) { - _path_normal_map_ext = char_ptr_array_create(0); + _path_normal_map_ext = string_array_create(0); gc_root(_path_normal_map_ext); - char_ptr_array_push(_path_normal_map_ext, "normal"); - char_ptr_array_push(_path_normal_map_ext, "normals"); - char_ptr_array_push(_path_normal_map_ext, "nor"); - char_ptr_array_push(_path_normal_map_ext, "n"); - char_ptr_array_push(_path_normal_map_ext, "nrm"); - char_ptr_array_push(_path_normal_map_ext, "normalgl"); + string_array_push(_path_normal_map_ext, "normal"); + string_array_push(_path_normal_map_ext, "normals"); + string_array_push(_path_normal_map_ext, "nor"); + string_array_push(_path_normal_map_ext, "n"); + string_array_push(_path_normal_map_ext, "nrm"); + string_array_push(_path_normal_map_ext, "normalgl"); } return _path_normal_map_ext; } -char_ptr_array_t *path_occlusion_ext(void) { +string_array_t *path_occlusion_ext(void) { if (_path_occlusion_ext == NULL) { - _path_occlusion_ext = char_ptr_array_create(0); + _path_occlusion_ext = string_array_create(0); gc_root(_path_occlusion_ext); - char_ptr_array_push(_path_occlusion_ext, "ao"); - char_ptr_array_push(_path_occlusion_ext, "occlusion"); - char_ptr_array_push(_path_occlusion_ext, "ambientOcclusion"); - char_ptr_array_push(_path_occlusion_ext, "o"); - char_ptr_array_push(_path_occlusion_ext, "occ"); + string_array_push(_path_occlusion_ext, "ao"); + string_array_push(_path_occlusion_ext, "occlusion"); + string_array_push(_path_occlusion_ext, "ambientOcclusion"); + string_array_push(_path_occlusion_ext, "o"); + string_array_push(_path_occlusion_ext, "occ"); } return _path_occlusion_ext; } -char_ptr_array_t *path_roughness_ext(void) { +string_array_t *path_roughness_ext(void) { if (_path_roughness_ext == NULL) { - _path_roughness_ext = char_ptr_array_create(0); + _path_roughness_ext = string_array_create(0); gc_root(_path_roughness_ext); - char_ptr_array_push(_path_roughness_ext, "roughness"); - char_ptr_array_push(_path_roughness_ext, "rough"); - char_ptr_array_push(_path_roughness_ext, "r"); - char_ptr_array_push(_path_roughness_ext, "rgh"); + string_array_push(_path_roughness_ext, "roughness"); + string_array_push(_path_roughness_ext, "rough"); + string_array_push(_path_roughness_ext, "r"); + string_array_push(_path_roughness_ext, "rgh"); } return _path_roughness_ext; } -char_ptr_array_t *path_metallic_ext(void) { +string_array_t *path_metallic_ext(void) { if (_path_metallic_ext == NULL) { - _path_metallic_ext = char_ptr_array_create(0); + _path_metallic_ext = string_array_create(0); gc_root(_path_metallic_ext); - char_ptr_array_push(_path_metallic_ext, "metallic"); - char_ptr_array_push(_path_metallic_ext, "metal"); - char_ptr_array_push(_path_metallic_ext, "metalness"); - char_ptr_array_push(_path_metallic_ext, "m"); - char_ptr_array_push(_path_metallic_ext, "met"); + string_array_push(_path_metallic_ext, "metallic"); + string_array_push(_path_metallic_ext, "metal"); + string_array_push(_path_metallic_ext, "metalness"); + string_array_push(_path_metallic_ext, "m"); + string_array_push(_path_metallic_ext, "met"); } return _path_metallic_ext; } -char_ptr_array_t *path_displacement_ext(void) { +string_array_t *path_displacement_ext(void) { if (_path_displacement_ext == NULL) { - _path_displacement_ext = char_ptr_array_create(0); + _path_displacement_ext = string_array_create(0); gc_root(_path_displacement_ext); - char_ptr_array_push(_path_displacement_ext, "displacement"); - char_ptr_array_push(_path_displacement_ext, "height"); - char_ptr_array_push(_path_displacement_ext, "h"); - char_ptr_array_push(_path_displacement_ext, "disp"); + string_array_push(_path_displacement_ext, "displacement"); + string_array_push(_path_displacement_ext, "height"); + string_array_push(_path_displacement_ext, "h"); + string_array_push(_path_displacement_ext, "disp"); } return _path_displacement_ext; } @@ -216,7 +216,7 @@ char *path_base_name(char *path) { bool path_is_mesh(char *path) { char *p = to_lower_case(path); - char_ptr_array_t *formats = path_mesh_formats(); + string_array_t *formats = path_mesh_formats(); for (uint32_t i = 0; i < formats->length; ++i) { char *s = formats->buffer[i]; char *ext = string(".%s", s); @@ -229,7 +229,7 @@ bool path_is_mesh(char *path) { bool path_is_texture(char *path) { char *p = to_lower_case(path); - char_ptr_array_t *formats = path_texture_formats(); + string_array_t *formats = path_texture_formats(); for (uint32_t i = 0; i < formats->length; ++i) { char *s = formats->buffer[i]; char *ext = string(".%s", s); @@ -280,7 +280,7 @@ bool path_is_known(char *path) { path_is_gimp_color_palette(path) || path_is_ext_format(path); } -bool path_check_ext(char *p, char_ptr_array_t *exts) { +bool path_check_ext(char *p, string_array_t *exts) { p = string_replace_all(p, "-", "_"); for (uint32_t i = 0; i < exts->length; ++i) { char *ext = exts->buffer[i]; diff --git a/base/sources/iron_path.h b/base/sources/iron_path.h index 7144a30e..65502ace 100644 --- a/base/sources/iron_path.h +++ b/base/sources/iron_path.h @@ -15,8 +15,8 @@ extern bool path_is_protected_linux; #endif -char_ptr_array_t *path_mesh_formats(void); -char_ptr_array_t *path_texture_formats(void); +string_array_t *path_mesh_formats(void); +string_array_t *path_texture_formats(void); char *path_data(void); char *path_to_relative(char *from, char *to); diff --git a/base/sources/iron_system.c b/base/sources/iron_system.c index b7648fb5..42559fea 100644 --- a/base/sources/iron_system.c +++ b/base/sources/iron_system.c @@ -657,14 +657,14 @@ i32 iron_sys_command(char *cmd) { #include -char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { +string_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { nfdpathset_t out_paths; nfdchar_t *out_path; nfdresult_t result = open_multiple ? NFD_OpenDialogMultiple(filter_list, default_path, &out_paths) : NFD_OpenDialog(filter_list, default_path, &out_path); if (result == NFD_OKAY) { int path_count = open_multiple ? (int)NFD_PathSet_GetCount(&out_paths) : 1; - char_ptr_array_t *result = any_array_create(path_count); + string_array_t *result = any_array_create(path_count); if (open_multiple) { for (int i = 0; i < path_count; ++i) { @@ -701,7 +701,7 @@ char *iron_save_dialog(char *filter_list, char *default_path) { extern char temp_string[1024 * 128]; -char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { +string_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { AndroidFileDialogOpen(); return NULL; } @@ -719,7 +719,7 @@ char *iron_save_dialog(char *filter_list, char *default_path) { extern char temp_string[1024 * 128]; -char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { +string_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { // Once finished drop_files callback is called IOSFileDialogOpen(); return NULL; @@ -737,7 +737,7 @@ char *iron_save_dialog(char *filter_list, char *default_path) { __attribute__((import_module("imports"), import_name("js_open_dialog"))) void js_open_dialog(); __attribute__((import_module("imports"), import_name("js_save_dialog"))) char *js_save_dialog(); -char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { +string_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple) { js_open_dialog(); return NULL; } diff --git a/base/sources/iron_system.h b/base/sources/iron_system.h index c1e9b1fb..b5ff2f3d 100644 --- a/base/sources/iron_system.h +++ b/base/sources/iron_system.h @@ -333,5 +333,5 @@ void iron_internal_gamepad_trigger_button(int gamepad, int button, float #endif i32 iron_sys_command(char *cmd); -char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple); +string_array_t *iron_open_dialog(char *filter_list, char *default_path, bool open_multiple); char *iron_save_dialog(char *filter_list, char *default_path); diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index 11b5b362..8f448eba 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -2116,7 +2116,7 @@ bool ui_radio(ui_handle_t *handle, int position, char *text, char *label) { return handle->i == position; } -int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool show_label, int align, bool search_bar) { +int ui_combo(ui_handle_t *handle, string_array_t *texts, char *label, bool show_label, int align, bool search_bar) { if (!ui_is_visible(UI_ELEMENT_H())) { ui_end_element(); return handle->i; @@ -2723,7 +2723,7 @@ float ui_float_input(ui_handle_t *handle, char *label, int align, float precisio return handle->f; } -int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align) { +int ui_inline_radio(ui_handle_t *handle, string_array_t *texts, int align) { ui_t *current = ui_get_current(); if (!ui_is_visible(UI_ELEMENT_H())) { @@ -2925,7 +2925,7 @@ int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color } char *strings[] = {"RGB", "HSV", "Hex"}; - char_ptr_array_t car; + string_array_t car; car.buffer = strings; car.length = 3; int pos = ui_inline_radio(&radio_handle, &car, UI_ALIGN_LEFT); diff --git a/base/sources/iron_ui.h b/base/sources/iron_ui.h index 2ede9cd3..dbfead1e 100644 --- a/base/sources/iron_ui.h +++ b/base/sources/iron_ui.h @@ -118,7 +118,7 @@ typedef struct ui_text_extract { typedef struct ui_coloring { uint32_t color; - char_ptr_array_t *start; + string_array_t *start; char *end; bool separated; } ui_coloring_t; @@ -245,7 +245,7 @@ typedef struct ui { ui_handle_t *combo_selected_handle; ui_handle_t *combo_selected_window; int combo_selected_align; - char_ptr_array_t *combo_selected_texts; + string_array_t *combo_selected_texts; char *combo_selected_label; int combo_selected_x; int combo_selected_y; @@ -298,7 +298,7 @@ int ui_image(gpu_texture_t *image, uint32_t tint, int h); char *ui_text_input(ui_handle_t *handle, char *label, int align, bool editable, bool live_update); bool ui_check(ui_handle_t *handle, char *text, char *label); bool ui_radio(ui_handle_t *handle, int position, char *text, char *label); -int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool show_label, int align, bool search_bar); +int ui_combo(ui_handle_t *handle, string_array_t *texts, char *label, bool show_label, int align, bool search_bar); float ui_slider(ui_handle_t *handle, char *text, float from, float to, bool filled, float precision, bool display_value, int align, bool text_edit); void ui_row(f32_array_t *ratios); void ui_row2(); @@ -389,7 +389,7 @@ extern const char *ui_theme_keys[]; extern int ui_theme_keys_count; float ui_float_input(ui_handle_t *handle, char *label, int align, float precision); -int ui_inline_radio(ui_handle_t *handle, char_ptr_array_t *texts, int align); +int ui_inline_radio(ui_handle_t *handle, string_array_t *texts, int align); int ui_color_wheel(ui_handle_t *handle, bool alpha, float w, float h, bool color_preview, void (*picker)(void *), void *data); char *ui_text_area(ui_handle_t *handle, int align, bool editable, char *label, bool word_wrap); void ui_begin_menu(); diff --git a/base/sources/iron_ui_nodes.c b/base/sources/iron_ui_nodes.c index 78fdb912..e970576e 100644 --- a/base/sources/iron_ui_nodes.c +++ b/base/sources/iron_ui_nodes.c @@ -25,9 +25,9 @@ static int ui_node_id = -1; static ui_node_t *node_resize = NULL; char *ui_clipboard = ""; -char_ptr_array_t *ui_nodes_exclude_remove = NULL; // No removal for listed node types +string_array_t *ui_nodes_exclude_remove = NULL; // No removal for listed node types bool ui_nodes_socket_released = false; -char_ptr_array_t *(*ui_nodes_enum_texts)(char *) = NULL; // Retrieve combo items for buttons of type ENUM +string_array_t *(*ui_nodes_enum_texts)(char *) = NULL; // Retrieve combo items for buttons of type ENUM gpu_texture_t *(*ui_nodes_preview_image)(ui_node_t *) = NULL; // Retrieve preview image void (*ui_nodes_on_custom_button)(int, char *) = NULL; // Call external function ui_canvas_control_t *(*ui_nodes_on_canvas_control)(void) = NULL; @@ -396,12 +396,12 @@ static float ui_nodes_snap(float f) { return roundf(f / w) * w; } -static char_ptr_array_t enum_ar; +static string_array_t enum_ar; static char enum_label[64]; static char enum_texts_data[64][64]; static char *enum_texts[64]; -static char_ptr_array_t temp_ar; +static string_array_t temp_ar; static char temp_label[64]; static char temp_texts_data[64][64]; static char *temp_texts[64]; @@ -537,7 +537,7 @@ void ui_node_draw_body(ui_node_t *node, ui_node_canvas_t *canvas, float nx, floa char *label = combo_select ? temp_label : enum_label; char(*texts_data)[64] = combo_select ? temp_texts_data : enum_texts_data; char **texts = combo_select ? temp_texts : enum_texts; - char_ptr_array_t *ar = combo_select ? &temp_ar : &enum_ar; + string_array_t *ar = combo_select ? &temp_ar : &enum_ar; int texts_count = 0; if (but->data != NULL && but->data->length > 1) { @@ -845,7 +845,7 @@ void ui_node_canvas(ui_nodes_t *nodes, ui_node_canvas_t *canvas) { draw_begin(current, false, 0); } if (ui_nodes_exclude_remove == NULL) { - ui_nodes_exclude_remove = gc_alloc(sizeof(char_ptr_array_t)); + ui_nodes_exclude_remove = gc_alloc(sizeof(string_array_t)); gc_root(ui_nodes_exclude_remove); } diff --git a/base/sources/iron_ui_nodes.h b/base/sources/iron_ui_nodes.h index 8ab1e983..5a26f385 100644 --- a/base/sources/iron_ui_nodes.h +++ b/base/sources/iron_ui_nodes.h @@ -128,9 +128,9 @@ float UI_NODES_SCALE(); float UI_NODES_PAN_X(); float UI_NODES_PAN_Y(); extern char *ui_clipboard; -extern char_ptr_array_t *ui_nodes_exclude_remove; +extern string_array_t *ui_nodes_exclude_remove; extern bool ui_nodes_socket_released; -extern char_ptr_array_t *(*ui_nodes_enum_texts)(char *); +extern string_array_t *(*ui_nodes_enum_texts)(char *); extern gpu_texture_t *(*ui_nodes_preview_image)(ui_node_t *); extern void (*ui_nodes_on_custom_button)(int, char *); extern ui_canvas_control_t *(*ui_nodes_on_canvas_control)(void); diff --git a/base/sources/plugins/plugin_api.c b/base/sources/plugins/plugin_api.c index f1c590e4..e2092bc3 100644 --- a/base/sources/plugins/plugin_api.c +++ b/base/sources/plugins/plugin_api.c @@ -532,7 +532,7 @@ FN(ui_combo) { JSValue val_len = JS_GetPropertyStr(ctx, argv[1], "length"); int len; JS_ToInt32(ctx, &len, val_len); - char_ptr_array_t *texts = any_array_create(len); + string_array_t *texts = any_array_create(len); for (int i = 0; i < len; ++i) { JSValue val = JS_GetPropertyUint32(ctx, argv[1], i); char *s = (char *)JS_ToCString(ctx, val); diff --git a/base/tools/pad/main.c b/base/tools/pad/main.c index a3019f81..77d078f0 100644 --- a/base/tools/pad/main.c +++ b/base/tools/pad/main.c @@ -201,7 +201,7 @@ void list_folder(char *path) { char *f = files->buffer[i]; char *abs = string("%s/%s", path, f); bool is_file = string_index_of(f, ".") >= 0; - bool is_expanded = char_ptr_array_index_of(storage->expanded, abs) >= 0; + bool is_expanded = string_array_index_of(storage->expanded, abs) >= 0; // Active file if (string_equals(abs, storage->file)) { @@ -230,11 +230,11 @@ void list_folder(char *path) { } // Expand folder else { - if (char_ptr_array_index_of(storage->expanded, abs) == -1) { + if (string_array_index_of(storage->expanded, abs) == -1) { any_array_push(storage->expanded, abs); } else { - char_ptr_array_remove(storage->expanded, abs); + string_array_remove(storage->expanded, abs); } } } diff --git a/paint/plugins/plugins.c b/paint/plugins/plugins.c index cb32a6ee..b2bb8422 100644 --- a/paint/plugins/plugins.c +++ b/paint/plugins/plugins.c @@ -215,8 +215,8 @@ FN(util_mesh_unwrappers_delete) { } extern any_map_t *import_mesh_importers; -extern char_ptr_array_t *_path_mesh_formats; -char_ptr_array_t *path_mesh_formats(void); +extern string_array_t *_path_mesh_formats; +string_array_t *path_mesh_formats(void); FN(path_mesh_importers_set) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); JSValue *p = malloc(sizeof(JSValue)); @@ -232,13 +232,13 @@ FN(path_mesh_importers_delete) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); map_delete(import_mesh_importers, format_name); path_mesh_formats(); // Init array - array_splice(_path_mesh_formats, char_ptr_array_index_of(_path_mesh_formats, format_name), 1); + array_splice(_path_mesh_formats, string_array_index_of(_path_mesh_formats, format_name), 1); return JS_UNDEFINED; } extern any_map_t *import_texture_importers; -extern char_ptr_array_t *_path_texture_formats; -char_ptr_array_t *path_texture_formats(void); +extern string_array_t *_path_texture_formats; +string_array_t *path_texture_formats(void); FN(path_texture_importers_set) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); JSValue *p = malloc(sizeof(JSValue)); @@ -254,7 +254,7 @@ FN(path_texture_importers_delete) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); map_delete(import_texture_importers, format_name); path_texture_formats(); // Init array - array_splice(_path_texture_formats, char_ptr_array_index_of(_path_texture_formats, format_name), 1); + array_splice(_path_texture_formats, string_array_index_of(_path_texture_formats, format_name), 1); return JS_UNDEFINED; } diff --git a/paint/sources/base.c b/paint/sources/base.c index 9cc7c7a9..a6f0afa9 100644 --- a/paint/sources/base.c +++ b/paint/sources/base.c @@ -649,7 +649,7 @@ string_t_array_t *base_enum_texts(char *node_type) { } i32 base_get_asset_index(char *file_name) { - i32 i = char_ptr_array_index_of(project_asset_names, file_name); + i32 i = string_array_index_of(project_asset_names, file_name); return i >= 0 ? i : 0; } @@ -901,7 +901,7 @@ void ui_base_menu_draw_viewport_mode() { ui_radio(mode_handle, i, modes->buffer[i], shortcuts->buffer[i]); } - i32 index = char_ptr_array_index_of(shortcuts, keyboard_key_code(ui->key_code)); + i32 index = string_array_index_of(shortcuts, keyboard_key_code(ui->key_code)); if (ui->is_key_pressed && index != -1) { mode_handle->i = index; ui->changed = true; diff --git a/paint/sources/box_export.c b/paint/sources/box_export.c index 9045fa05..8c7850fd 100644 --- a/paint/sources/box_export.c +++ b/paint/sources/box_export.c @@ -4,7 +4,7 @@ void box_export_show_textures_box() { if (box_export_files == NULL) { box_export_fetch_presets(); - box_export_hpreset->i = char_ptr_array_index_of(box_export_files, "generic"); + box_export_hpreset->i = string_array_index_of(box_export_files, "generic"); } if (box_export_preset == NULL) { box_export_parse_preset(); @@ -27,7 +27,7 @@ void box_export_show_textures() { void box_export_show_bake_material_box() { if (box_export_files == NULL) { box_export_fetch_presets(); - box_export_hpreset->i = char_ptr_array_index_of(box_export_files, "generic"); + box_export_hpreset->i = string_array_index_of(box_export_files, "generic"); } if (box_export_preset == NULL) { box_export_parse_preset(); @@ -228,7 +228,7 @@ void box_export_tab_presets_import(char *path) { box_export_fetch_presets(); gc_unroot(box_export_preset); box_export_preset = NULL; - box_export_hpreset->i = char_ptr_array_index_of(box_export_files, substring(filename, 0, string_length(filename) - 5)); // Strip .json + box_export_hpreset->i = string_array_index_of(box_export_files, substring(filename, 0, string_length(filename) - 5)); // Strip .json console_info(string("%s %s", tr("Preset imported:", NULL), filename)); } else { @@ -250,7 +250,7 @@ void box_export_tab_presets_new_box() { box_export_fetch_presets(); gc_unroot(box_export_preset); box_export_preset = NULL; - box_export_hpreset->i = char_ptr_array_index_of(box_export_files, preset_name); + box_export_hpreset->i = string_array_index_of(box_export_files, preset_name); ui_box_hide(); box_export_htab->i = 1; // Presets box_export_show_textures(); @@ -315,13 +315,13 @@ void box_export_tab_presets() { } ui_handle_t *hr = ui_nest(htex, 0); - hr->i = char_ptr_array_index_of(box_export_channels, t->channels->buffer[0]); + hr->i = string_array_index_of(box_export_channels, t->channels->buffer[0]); ui_handle_t *hg = ui_nest(htex, 1); - hg->i = char_ptr_array_index_of(box_export_channels, t->channels->buffer[1]); + hg->i = string_array_index_of(box_export_channels, t->channels->buffer[1]); ui_handle_t *hb = ui_nest(htex, 2); - hb->i = char_ptr_array_index_of(box_export_channels, t->channels->buffer[2]); + hb->i = string_array_index_of(box_export_channels, t->channels->buffer[2]); ui_handle_t *ha = ui_nest(htex, 3); - ha->i = char_ptr_array_index_of(box_export_channels, t->channels->buffer[3]); + ha->i = string_array_index_of(box_export_channels, t->channels->buffer[3]); ui_combo(hr, box_export_channels, tr("R", NULL), false, UI_ALIGN_LEFT, true); if (hr->changed) { @@ -341,7 +341,7 @@ void box_export_tab_presets() { } ui_handle_t *hspace = ui_nest(htex, 4); - hspace->i = char_ptr_array_index_of(box_export_color_spaces, t->color_space); + hspace->i = string_array_index_of(box_export_color_spaces, t->color_space); ui_combo(hspace, box_export_color_spaces, tr("Color Space", NULL), false, UI_ALIGN_LEFT, true); if (hspace->changed) { t->color_space = string_copy(box_export_color_spaces->buffer[hspace->i]); diff --git a/paint/sources/box_preferences.c b/paint/sources/box_preferences.c index 812f3da2..1c570b54 100644 --- a/paint/sources/box_preferences.c +++ b/paint/sources/box_preferences.c @@ -58,7 +58,7 @@ void box_preferences_interface_tab() { } ui_handle_t *h_locale = ui_handle(__ID__); - h_locale->i = char_ptr_array_index_of(box_preferences_locales, config_raw->locale); + h_locale->i = string_array_index_of(box_preferences_locales, config_raw->locale); ui_combo(h_locale, box_preferences_locales, tr("Language", NULL), true, UI_ALIGN_LEFT, true); if (h_locale->changed) { char *locale_code = box_preferences_locales->buffer[h_locale->i]; @@ -853,11 +853,11 @@ void box_preferences_plugins_tab_plugin_menu() { ui_files_show("js", true, false, &box_preferences_plugins_tab_plugin_menu_export); } if (ui_menu_button(tr("Delete", NULL), "", ICON_DELETE)) { - if (char_ptr_array_index_of(config_raw->plugins, _box_preferences_f) >= 0) { - char_ptr_array_remove(config_raw->plugins, _box_preferences_f); + if (string_array_index_of(config_raw->plugins, _box_preferences_f) >= 0) { + string_array_remove(config_raw->plugins, _box_preferences_f); plugin_stop(_box_preferences_f); } - char_ptr_array_remove(box_preferences_files_plugin, _box_preferences_f); + string_array_remove(box_preferences_files_plugin, _box_preferences_f); iron_delete_file(path); } } @@ -931,7 +931,7 @@ void box_preferences_plugins_tab() { if (!is_js) { continue; } - bool enabled = char_ptr_array_index_of(config_raw->plugins, f) >= 0; + bool enabled = string_array_index_of(config_raw->plugins, f) >= 0; h->b = enabled; char *tag = is_js ? string_split(f, ".")->buffer[0] : f; ui_check(h, tag, ""); @@ -1021,11 +1021,11 @@ void box_preferences_fetch_plugins() { } i32 box_preferences_get_theme_index() { - return char_ptr_array_index_of(box_preferences_themes, substring(config_raw->theme, 0, string_length(config_raw->theme) - 5)); // Strip .json + return string_array_index_of(box_preferences_themes, substring(config_raw->theme, 0, string_length(config_raw->theme) - 5)); // Strip .json } i32 box_preferences_get_preset_index() { - return char_ptr_array_index_of(box_preferences_files_keymap, substring(config_raw->keymap, 0, string_length(config_raw->keymap) - 5)); // Strip .json + return string_array_index_of(box_preferences_files_keymap, substring(config_raw->keymap, 0, string_length(config_raw->keymap) - 5)); // Strip .json } void box_preferences_set_scale() { diff --git a/paint/sources/brush_nodes/brush_output_node.c b/paint/sources/brush_nodes/brush_output_node.c index ece36a39..f58591bf 100644 --- a/paint/sources/brush_nodes/brush_output_node.c +++ b/paint/sources/brush_nodes/brush_output_node.c @@ -37,7 +37,7 @@ void brush_output_node_parse_inputs(brush_output_node_t *self) { context_raw->brush_mask_image_is_alpha = ends_with(opac->_str, ".a"); opac->_str = string_copy(substring(opac->_str, 0, string_last_index_of(opac->_str, "."))); context_raw->brush_nodes_opacity = 1.0; - i32 index = char_ptr_array_index_of(project_asset_names, opac->_str); + i32 index = string_array_index_of(project_asset_names, opac->_str); if (index != -1) { asset_t *asset = project_assets->buffer[index]; context_raw->brush_mask_image = project_get_image(asset); @@ -57,7 +57,7 @@ void brush_output_node_parse_inputs(brush_output_node_t *self) { if (stencil->_str != NULL) { // string context_raw->brush_stencil_image_is_alpha = ends_with(stencil->_str, ".a"); stencil->_str = string_copy(substring(stencil->_str, 0, string_last_index_of(stencil->_str, "."))); - i32 index = char_ptr_array_index_of(project_asset_names, stencil->_str); + i32 index = string_array_index_of(project_asset_names, stencil->_str); if (index != -1) { asset_t *asset = project_assets->buffer[index]; context_raw->brush_stencil_image = project_get_image(asset); diff --git a/paint/sources/config.c b/paint/sources/config.c index 5a2b884d..259cb5bd 100644 --- a/paint/sources/config.c +++ b/paint/sources/config.c @@ -487,7 +487,7 @@ void config_enable_plugin(char *f) { } void config_disable_plugin(char *f) { - char_ptr_array_remove(config_raw->plugins, f); + string_array_remove(config_raw->plugins, f); plugin_stop(f); } diff --git a/paint/sources/console.c b/paint/sources/console.c index 8fdb1794..2966cd5b 100644 --- a/paint/sources/console.c +++ b/paint/sources/console.c @@ -81,7 +81,7 @@ void console_log(char *s) { void console_trace(char *s) { iron_log(s); base_redraw_console(); - char_ptr_array_push(console_last_traces, string_copy(s)); + string_array_push(console_last_traces, string_copy(s)); if (console_last_traces->length > 100) { array_shift(console_last_traces); } diff --git a/paint/sources/export_arm.c b/paint/sources/export_arm.c index 35d008fc..efc9b958 100644 --- a/paint/sources/export_arm.c +++ b/paint/sources/export_arm.c @@ -184,7 +184,7 @@ void export_arm_run_project() { recent_path = string_copy(string_replace_all(recent_path, "\\", "/")); #endif string_t_array_t *recent = config_raw->recent_projects; - char_ptr_array_remove(recent, recent_path); + string_array_remove(recent, recent_path); array_insert(recent, 0, recent_path); config_save(); diff --git a/paint/sources/export_texture.c b/paint/sources/export_texture.c index 6eb45d8f..41d4bc04 100644 --- a/paint/sources/export_texture.c +++ b/paint/sources/export_texture.c @@ -33,7 +33,7 @@ void export_texture_run(char *path, bool bake_material) { slot_layer_t *l = project_layers->buffer[i]; if (slot_layer_get_object_mask(l) > 0) { char *name = project_paint_objects->buffer[slot_layer_get_object_mask(l) - 1]->base->name; - if (char_ptr_array_index_of(object_names, name) == -1) { + if (string_array_index_of(object_names, name) == -1) { any_array_push(object_names, name); } } diff --git a/paint/sources/import_arm.c b/paint/sources/import_arm.c index 5eb9a075..cc987ab5 100644 --- a/paint/sources/import_arm.c +++ b/paint/sources/import_arm.c @@ -77,7 +77,7 @@ void import_arm_run_project(char *path) { recent_path = string_copy(string_replace_all(recent_path, "\\", "/")); #endif string_t_array_t *recent = config_raw->recent_projects; - char_ptr_array_remove(recent, recent_path); + string_array_remove(recent, recent_path); array_insert(recent, 0, recent_path); config_save(); diff --git a/paint/sources/make_material.c b/paint/sources/make_material.c index c43ffa63..1189c447 100644 --- a/paint/sources/make_material.c +++ b/paint/sources/make_material.c @@ -199,7 +199,7 @@ void make_material_bake_node_previews() { string_t_array_t *keys = map_keys(context_raw->node_previews); for (i32 i = 0; i < keys->length; ++i) { char *key = keys->buffer[i]; - if (char_ptr_array_index_of(context_raw->node_previews_used, key) == -1) { + if (string_array_index_of(context_raw->node_previews_used, key) == -1) { gpu_texture_t *image = any_map_get(context_raw->node_previews, key); gpu_delete_texture(image); map_delete(context_raw->node_previews, key); diff --git a/paint/sources/material_nodes/image_texture_node.c b/paint/sources/material_nodes/image_texture_node.c index 3595dcac..22939ce3 100644 --- a/paint/sources/material_nodes/image_texture_node.c +++ b/paint/sources/material_nodes/image_texture_node.c @@ -84,7 +84,7 @@ bind_tex_t *parser_material_make_texture(ui_node_t *image_node, char *tex_name) char *image_texture_node_vector(ui_node_t *node, ui_node_socket_t *socket) { // Already fetched - if (char_ptr_array_index_of(parser_material_parsed, parser_material_res_var_name(node, node->outputs->buffer[1])) >= 0) { // TODO: node.outputs[0] + if (string_array_index_of(parser_material_parsed, parser_material_res_var_name(node, node->outputs->buffer[1])) >= 0) { // TODO: node.outputs[0] char *varname = parser_material_store_var_name(node); return string("%s.rgb", varname); } @@ -104,7 +104,7 @@ char *image_texture_node_vector(ui_node_t *node, ui_node_socket_t *socket) { char *image_texture_node_value(ui_node_t *node, ui_node_socket_t *socket) { // Already fetched - if (char_ptr_array_index_of(parser_material_parsed, parser_material_res_var_name(node, node->outputs->buffer[0])) >= 0) { // TODO: node.outputs[1] + if (string_array_index_of(parser_material_parsed, parser_material_res_var_name(node, node->outputs->buffer[0])) >= 0) { // TODO: node.outputs[1] char *varname = parser_material_store_var_name(node); return string("%s.a", varname); } diff --git a/paint/sources/node_shader.c b/paint/sources/node_shader.c index fbe08d16..ac28232e 100644 --- a/paint/sources/node_shader.c +++ b/paint/sources/node_shader.c @@ -36,7 +36,7 @@ void node_shader_add_out(node_shader_t *raw, char *s) { void node_shader_add_constant(node_shader_t *raw, char *s, char *link) { // inp: float4 - if (char_ptr_array_index_of(raw->consts, s) == -1) { + if (string_array_index_of(raw->consts, s) == -1) { string_t_array_t *ar = string_split(s, ": "); char *uname = ar->buffer[0]; char *utype = ar->buffer[1]; @@ -60,7 +60,7 @@ void node_shader_add_constant(node_shader_t *raw, char *s, char *link) { } void node_shader_add_texture(node_shader_t *raw, char *name, char *link) { - if (char_ptr_array_index_of(raw->textures, name) == -1) { + if (string_array_index_of(raw->textures, name) == -1) { any_array_push(raw->textures, name); node_shader_context_add_texture_unit(raw->context, name, link); } diff --git a/paint/sources/parser_logic.c b/paint/sources/parser_logic.c index 4d2241af..e3289445 100644 --- a/paint/sources/parser_logic.c +++ b/paint/sources/parser_logic.c @@ -98,7 +98,7 @@ char *parser_logic_build_node(ui_node_t *node) { char *name = parser_logic_node_name(node); // Check if node already exists - if (char_ptr_array_index_of(parser_logic_parsed_nodes, name) != -1) { + if (string_array_index_of(parser_logic_parsed_nodes, name) != -1) { return name; } diff --git a/paint/sources/parser_material.c b/paint/sources/parser_material.c index e67081d4..66a08ad5 100644 --- a/paint/sources/parser_material.c +++ b/paint/sources/parser_material.c @@ -477,7 +477,7 @@ char *parser_material_write_result(ui_node_link_t *l) { ui_node_socket_t *from_socket = from_node->outputs->buffer[l->from_socket]; char *res_var = parser_material_res_var_name(from_node, from_socket); char *st = from_socket->type; - if (char_ptr_array_index_of(parser_material_parsed, res_var) < 0) { + if (string_array_index_of(parser_material_parsed, res_var) < 0) { any_array_push(parser_material_parsed, res_var); if (string_equals(st, "RGB") || string_equals(st, "RGBA") || string_equals(st, "VECTOR")) { char *res = parser_material_parse_vector(from_node, from_socket); diff --git a/paint/sources/project.c b/paint/sources/project.c index 988299f7..2d142da2 100644 --- a/paint/sources/project.c +++ b/paint/sources/project.c @@ -573,7 +573,7 @@ void project_unwrap_mesh(raw_mesh_t *mesh, void (*done)(raw_mesh_t *)) { } else { char *f = unwrap_plugins->buffer[_project_unwrap_by]; - if (char_ptr_array_index_of(config_raw->plugins, f) == -1) { + if (string_array_index_of(config_raw->plugins, f) == -1) { config_enable_plugin(f); console_info(string("%s %s", f, tr("plugin enabled", NULL))); } @@ -692,7 +692,7 @@ bool project_is_atlas_object(mesh_object_t *p) { return false; } char *atlas_name = project_get_used_atlases()->buffer[context_raw->layer_filter - project_paint_objects->length - 1]; - i32 atlas_i = char_ptr_array_index_of(project_atlas_names, atlas_name); + i32 atlas_i = string_array_index_of(project_atlas_names, atlas_name); return atlas_i == project_atlas_objects->buffer[array_index_of(project_paint_objects, p)]; } @@ -703,7 +703,7 @@ mesh_object_t_array_t *project_get_atlas_objects(i32 object_mask) { return project_paint_objects; } char *atlas_name = atlases->buffer[i]; - i32 atlas_i = char_ptr_array_index_of(project_atlas_names, atlas_name); + i32 atlas_i = string_array_index_of(project_atlas_names, atlas_name); mesh_object_t_array_t *visibles = any_array_create_from_raw((void *[]){}, 0); for (i32 i = 0; i < project_paint_objects->length; ++i) { if (project_atlas_objects->buffer[i] == atlas_i) { diff --git a/paint/sources/tab_browser.c b/paint/sources/tab_browser.c index 5b5319d3..765817bf 100644 --- a/paint/sources/tab_browser.c +++ b/paint/sources/tab_browser.c @@ -10,7 +10,7 @@ void tab_browser_show_directory(char *directory) { void tab_browser_draw_bookmark_menu() { if (ui_menu_button(tr("Delete", NULL), "", ICON_DELETE)) { - char_ptr_array_remove(config_raw->bookmarks, _tab_browser_draw_b); + string_array_remove(config_raw->bookmarks, _tab_browser_draw_b); config_save(); } } diff --git a/paint/sources/tab_meshes.c b/paint/sources/tab_meshes.c index 1b76cf4a..6c257382 100644 --- a/paint/sources/tab_meshes.c +++ b/paint/sources/tab_meshes.c @@ -86,7 +86,7 @@ void tab_meshes_draw_edit() { if (ui_menu_button(tr("UV Unwrap", NULL), "", ICON_NONE)) { char *f = "uv_unwrap.js"; - if (char_ptr_array_index_of(config_raw->plugins, f) == -1) { + if (string_array_index_of(config_raw->plugins, f) == -1) { config_enable_plugin(f); } plugin_uv_unwrap_button(); diff --git a/paint/sources/translator.c b/paint/sources/translator.c index 1064f262..7b2c291a 100644 --- a/paint/sources/translator.c +++ b/paint/sources/translator.c @@ -71,7 +71,7 @@ void translator_load_translations(char *new_locale) { } // Check whether the requested or detected locale is available - if (!string_equals(config_raw->locale, "en") && char_ptr_array_index_of(translator_get_supported_locales(), config_raw->locale) == -1) { + if (!string_equals(config_raw->locale, "en") && string_array_index_of(translator_get_supported_locales(), config_raw->locale) == -1) { // Fall back to English config_raw->locale = "en"; } diff --git a/paint/sources/ui_files.c b/paint/sources/ui_files.c index 2ed35469..8e6bed31 100644 --- a/paint/sources/ui_files.c +++ b/paint/sources/ui_files.c @@ -243,7 +243,7 @@ char *ui_files_file_browser(ui_handle_t *handle, bool drag_files, char *search, if (dot > -1) { string_t_array_t *files_all = file_read_directory(handle->text); char *icon_file = string("%s_icon.jpg", substring(f, 0, dot)); - if (char_ptr_array_index_of(files_all, icon_file) >= 0) { + if (string_array_index_of(files_all, icon_file) >= 0) { any_map_set(ui_files_icon_map, string("%s%s%s", handle->text, PATH_SEP, f), icons); gc_unroot(_ui_files_file_browser_handle); diff --git a/paint/sources/ui_menubar.c b/paint/sources/ui_menubar.c index 6e72ad83..443375b5 100644 --- a/paint/sources/ui_menubar.c +++ b/paint/sources/ui_menubar.c @@ -637,7 +637,7 @@ void ui_menubar_draw_category_items() { array_splice(shortcuts, 4, 1); array_splice(shortcuts, 3, 1); array_splice(shortcuts, 2, 1); - mode_handle->i = char_ptr_array_index_of(modes, ui_menubar_viewport_mode_to_string(mode_handle->i)); + mode_handle->i = string_array_index_of(modes, ui_menubar_viewport_mode_to_string(mode_handle->i)); } for (i32 i = 0; i < modes->length; ++i) { diff --git a/paint/sources/ui_nodes.c b/paint/sources/ui_nodes.c index 00887045..ccac1d6e 100644 --- a/paint/sources/ui_nodes.c +++ b/paint/sources/ui_nodes.c @@ -968,7 +968,7 @@ void ui_nodes_render(void *_) { i32 i = 0; while (i++ < c->nodes->length) { ui_node_t *canvas_node = c->nodes->buffer[i - 1]; - if (char_ptr_array_index_of(ui_nodes_exclude_remove, canvas_node->type) >= 0) { + if (string_array_index_of(ui_nodes_exclude_remove, canvas_node->type) >= 0) { continue; } bool found = false; diff --git a/paint/sources/ui_view2d.c b/paint/sources/ui_view2d.c index 5ae8e866..cf6fb31e 100644 --- a/paint/sources/ui_view2d.c +++ b/paint/sources/ui_view2d.c @@ -277,7 +277,7 @@ void ui_view2d_render(void *_) { asset_t *asset = context_raw->texture; if (asset != NULL) { string_t_array_t *asset_names = project_asset_names; - i32 i = char_ptr_array_index_of(asset_names, asset->name); + i32 i = string_array_index_of(asset_names, asset->name); h->text = string_copy(asset->name); asset->name = string_copy(ui_text_input(h, "", UI_ALIGN_LEFT, true, false)); asset_names->buffer[i] = asset->name;