getting setup on raspberry pi, implementing lumenarium_linux_memory.h and a bit of lumenarium_linux_file.h
This commit is contained in:
parent
1e04ec5bae
commit
823a3dd229
|
@ -146,6 +146,7 @@ CompilerFlags_wasm+=" -Wl,--export-all" #
|
|||
CompilerFlags_linux=""
|
||||
|
||||
CompilerFlags_raspi="--target=arm-linux-gnueabihf" #target
|
||||
CompilerFlags_raspi+=""
|
||||
|
||||
|
||||
CompilerFlags_DEBUG_win32=""
|
||||
|
|
Binary file not shown.
|
@ -8,6 +8,51 @@
|
|||
|
||||
void os_gl_no_error();
|
||||
|
||||
// type mocking
|
||||
// so far, this is only for platforms that won't be using the editor
|
||||
// but which still need to compile it.
|
||||
#ifndef __gl_glext_h_
|
||||
typedef u32 GLsizei;
|
||||
typedef u32 GLuint;
|
||||
typedef u32 GLenum;
|
||||
typedef s32 GLint;
|
||||
typedef float GLfloat;
|
||||
typedef u8 GLchar;
|
||||
typedef bool GLboolean;
|
||||
|
||||
#define GL_ARRAY_BUFFER 0
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0
|
||||
#define GL_VERTEX_SHADER 0
|
||||
#define GL_COMPILE_STATUS 0
|
||||
#define GL_FRAGMENT_SHADER 0
|
||||
#define GL_LINK_STATUS 0
|
||||
#define GL_TRUE true
|
||||
#define GL_FALSE false
|
||||
#define GL_UNSIGNED_INT 0
|
||||
#define GL_FLOAT 0
|
||||
#define GL_NEAREST 0
|
||||
#define GL_LINEAR 0
|
||||
#define GL_RGBA 0
|
||||
#define GL_TEXTURE_2D 0
|
||||
#define GL_TEXTURE_WRAP_S 0
|
||||
#define GL_TEXTURE_WRAP_T 0
|
||||
#define GL_TEXTURE_MIN_FILTER 0
|
||||
#define GL_TEXTURE_MAG_FILTER 0
|
||||
#define GL_UNSIGNED_BYTE 0
|
||||
#define GL_SRC_ALPHA 0
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0
|
||||
#define GL_CULL_FACE 0
|
||||
#define GL_DEPTH_TEST 0
|
||||
#define GL_LESS 0
|
||||
#define GL_COLOR_BUFFER_BIT 0
|
||||
#define GL_DEPTH_BUFFER_BIT 0
|
||||
#define GL_STATIC_DRAW 0
|
||||
#define GL_TRIANGLES 0
|
||||
#define GL_REPEAT 0
|
||||
#define GL_BLEND 0
|
||||
|
||||
#endif
|
||||
|
||||
// OpenGL 3.3+ Context Creation
|
||||
#if defined(PLATFORM_win32)
|
||||
typedef const char *WINAPI proc_wglGetExtensionsStringARB(HDC hdc);
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
#ifndef LUMENARIUM_EDITOR_H
|
||||
#define LUMENARIUM_EDITOR_H
|
||||
|
||||
typedef struct Editor_Desc Editor_Desc;
|
||||
struct Editor_Desc
|
||||
{
|
||||
v2 content_scale;
|
||||
v2 init_window_dim;
|
||||
};
|
||||
|
||||
typedef struct Editor Editor;
|
||||
struct Editor
|
||||
{
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
#include "lumenarium_first.h"
|
||||
#include "user_space/user_space_incenter.cpp"
|
||||
|
||||
void
|
||||
sculpture_updated()
|
||||
{
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
ed_sculpture_updated();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal App_State*
|
||||
lumenarium_init(Editor_Desc* ed_desc)
|
||||
{
|
||||
|
@ -50,7 +58,9 @@ lumenarium_init(Editor_Desc* ed_desc)
|
|||
|
||||
|
||||
en_init(state, desc);
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
if (has_flag(state->flags, AppState_RunEditor)) ed_init(state, ed_desc);
|
||||
#endif
|
||||
if (has_flag(state->flags, AppState_RunUserSpace)) incenter_init(state);
|
||||
scratch_release(scratch);
|
||||
return state;
|
||||
|
@ -64,7 +74,9 @@ lumenarium_frame_prepare(App_State* state)
|
|||
input_state_swap_frames(state->input_state);
|
||||
|
||||
en_frame_prepare(state);
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
if (has_flag(state->flags, AppState_RunEditor)) ed_frame_prepare(state);
|
||||
#endif
|
||||
if (has_flag(state->flags, AppState_RunUserSpace)) incenter_frame_prepare(state);
|
||||
|
||||
file_async_jobs_do_work(&state->file_async_job_system, 4, (u8*)state);
|
||||
|
@ -74,7 +86,9 @@ internal void
|
|||
lumenarium_frame(App_State* state)
|
||||
{
|
||||
en_frame(state);
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
if (has_flag(state->flags, AppState_RunEditor)) ed_frame(state);
|
||||
#endif
|
||||
if (has_flag(state->flags, AppState_RunUserSpace)) incenter_frame(state);
|
||||
}
|
||||
|
||||
|
@ -127,5 +141,7 @@ lumenarium_cleanup(App_State* state)
|
|||
{
|
||||
if (has_flag(state->flags, AppState_RunUserSpace)) incenter_cleanup(state);
|
||||
en_cleanup(state);
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
if (has_flag(state->flags, AppState_RunEditor)) ed_cleanup(state);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -26,11 +26,13 @@ typedef struct Assembly_Pixel_Buffer Assembly_Pixel_Buffer;
|
|||
#include "engine/output/lumenarium_output_sacn.h"
|
||||
|
||||
// Editor
|
||||
#include "editor/graphics/lumenarium_editor_opengl.h"
|
||||
#include "editor/graphics/lumenarium_editor_graphics.h"
|
||||
#include "editor/lumenarium_editor_ui.h"
|
||||
#include "editor/lumenarium_editor_renderer.h"
|
||||
#include "editor/lumenarium_editor.h"
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
# include "editor/graphics/lumenarium_editor_opengl.h"
|
||||
# include "editor/graphics/lumenarium_editor_graphics.h"
|
||||
# include "editor/lumenarium_editor_ui.h"
|
||||
# include "editor/lumenarium_editor_renderer.h"
|
||||
# include "editor/lumenarium_editor.h"
|
||||
#endif // PLATFORM_SUPPORTS_EDITOR
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Lumenarium Runtime Environment
|
||||
|
@ -86,9 +88,19 @@ struct App_State
|
|||
Assembly_Array assemblies;
|
||||
Output output;
|
||||
|
||||
Editor* editor;
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
Editor* editor;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct Editor_Desc Editor_Desc;
|
||||
struct Editor_Desc
|
||||
{
|
||||
v2 content_scale;
|
||||
v2 init_window_dim;
|
||||
};
|
||||
|
||||
void sculpture_updated();
|
||||
|
||||
#include "engine/lumenarium_engine_assembly.c"
|
||||
#include "engine/lumenarium_engine.c"
|
||||
|
@ -96,9 +108,11 @@ struct App_State
|
|||
#include "engine/output/lumenarium_output_uart.c"
|
||||
#include "engine/output/lumenarium_output_sacn.c"
|
||||
|
||||
#include "editor/lumenarium_editor_ui.c"
|
||||
#include "editor/lumenarium_editor_renderer.c"
|
||||
#include "editor/lumenarium_editor_sculpture_visualizer.c"
|
||||
#include "editor/lumenarium_editor.c"
|
||||
#if defined(PLATFORM_SUPPORTS_EDITOR)
|
||||
# include "editor/lumenarium_editor_ui.c"
|
||||
# include "editor/lumenarium_editor_renderer.c"
|
||||
# include "editor/lumenarium_editor_sculpture_visualizer.c"
|
||||
# include "editor/lumenarium_editor.c"
|
||||
#endif
|
||||
|
||||
#endif //LUMENARIUM_FIRST_H
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
Thread_Result
|
||||
thread_proc(Thread_Data* td)
|
||||
{
|
||||
|
@ -11,15 +10,15 @@ memory_allocator_tests(Allocator* a, bool run_free_tests)
|
|||
{
|
||||
// TestGroup("Allocator Push")
|
||||
{
|
||||
for (u32 i = 0; i < 3; i++)
|
||||
for (uint32_t i = 0; i < 3; i++)
|
||||
{
|
||||
u8* buf0 = allocator_alloc(a, 256);
|
||||
uint8_t* buf0 = allocator_alloc(a, 256);
|
||||
buf0[0] = 200;
|
||||
buf0[255] = 199;
|
||||
assert(buf0[0] == 200);
|
||||
assert(buf0[255] == 199);
|
||||
|
||||
u8* buf1 = allocator_alloc(a, 256);
|
||||
uint8_t* buf1 = allocator_alloc(a, 256);
|
||||
buf1[0] = 201;
|
||||
buf1[255] = 202;
|
||||
assert(buf1 >= (buf0 + 256));
|
||||
|
@ -35,13 +34,13 @@ memory_allocator_tests(Allocator* a, bool run_free_tests)
|
|||
// TestGroup("Allocator Free")
|
||||
if (run_free_tests)
|
||||
{
|
||||
for (u32 i = 0; i < 3; i++)
|
||||
for (uint32_t i = 0; i < 3; i++)
|
||||
{
|
||||
u8* buf0 = allocator_alloc(a, KB(4));
|
||||
u8* buf1 = allocator_alloc(a, KB(4));
|
||||
u8* buf2 = allocator_alloc(a, KB(4));
|
||||
u8* buf3 = allocator_alloc(a, KB(4));
|
||||
u8* buf4 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf0 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf1 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf2 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf3 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf4 = allocator_alloc(a, KB(4));
|
||||
assert((buf1 - buf0) >= KB(4));
|
||||
assert((buf2 - buf0) >= KB(8));
|
||||
assert((buf3 - buf0) >= KB(12));
|
||||
|
@ -49,7 +48,7 @@ memory_allocator_tests(Allocator* a, bool run_free_tests)
|
|||
|
||||
allocator_free(a, buf1, KB(4));
|
||||
allocator_free(a, buf2, KB(4));
|
||||
u8* buf5 = allocator_alloc(a, KB(7));
|
||||
uint8_t* buf5 = allocator_alloc(a, KB(7));
|
||||
// buf5 should get put in the place of buf1 since buf1 and 2 get
|
||||
// merged
|
||||
assert(buf5 == buf1);
|
||||
|
@ -57,7 +56,7 @@ memory_allocator_tests(Allocator* a, bool run_free_tests)
|
|||
allocator_free(a, buf4, KB(4));
|
||||
allocator_free(a, buf3, KB(4));
|
||||
allocator_free(a, buf0, KB(4));
|
||||
u8* buf6 = allocator_alloc(a, KB(4));
|
||||
uint8_t* buf6 = allocator_alloc(a, KB(4));
|
||||
assert(buf0 == buf6);
|
||||
|
||||
allocator_clear(a);
|
||||
|
@ -73,9 +72,11 @@ memory_tests()
|
|||
u64 size = GB(32);
|
||||
#if defined(PLATFORM_wasm)
|
||||
size = KB(4);
|
||||
#elif defined(PLATFORM_raspi)
|
||||
size = KB(32);
|
||||
#endif
|
||||
|
||||
u8* base = os_mem_reserve(size);
|
||||
uint8_t* base = os_mem_reserve(size);
|
||||
os_mem_commit(base, KB(4));
|
||||
base[4095] = 200;
|
||||
assert(base[4095] == 200);
|
||||
|
@ -83,7 +84,7 @@ memory_tests()
|
|||
base[5000] = 200;
|
||||
assert(base[5000] == 200);
|
||||
os_mem_decommit(base, KB(8));
|
||||
os_mem_release(base, GB(32));
|
||||
os_mem_release(base, size);
|
||||
}
|
||||
|
||||
Allocator* bump = bump_allocator_create_reserve(KB(32));
|
||||
|
@ -104,14 +105,14 @@ enum test_flags
|
|||
Test4 = 8,
|
||||
};
|
||||
|
||||
internal void
|
||||
static void
|
||||
run_tests()
|
||||
{
|
||||
scratch_get(scratch);
|
||||
|
||||
// basic
|
||||
|
||||
u8 b = TestNone;
|
||||
uint8_t b = TestNone;
|
||||
assert(!has_flag(b, TestNone));
|
||||
assert(!has_flag(b, Test1));
|
||||
add_flag(b, Test1);
|
||||
|
@ -135,20 +136,28 @@ run_tests()
|
|||
assert(!has_flag(b, Test3));
|
||||
|
||||
// memory tests
|
||||
uint8_t* r0 = os_mem_reserve(1024);
|
||||
uint8_t* r1 = os_mem_commit(r0, 512);
|
||||
for (uint32_t i = 0; i < 512; i++) r1[i] = i;
|
||||
os_mem_decommit(r1, 512);
|
||||
os_mem_release(r0, 1024);
|
||||
// r0[256] = 100; // this should break if you uncomment
|
||||
|
||||
u8* a0 = allocator_alloc_array(scratch.a, u8, 32);
|
||||
u8* a1 = allocator_alloc_array(scratch.a, u8, 32);
|
||||
uint8_t* a0 = allocator_alloc_array(scratch.a, uint8_t, 32);
|
||||
uint8_t* a1 = allocator_alloc_array(scratch.a, uint8_t, 32);
|
||||
assert(a0 != a1);
|
||||
assert((a0 + 32) <= a1);
|
||||
|
||||
for (u32 i = 0; i < 32; i++)
|
||||
a1[0] = 25;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++)
|
||||
{
|
||||
a0[i] = (u8)i;
|
||||
a1[i] = (u8)(100 + i);
|
||||
a0[i] = (uint8_t)i;
|
||||
a1[i] = (uint8_t)(100 + i);
|
||||
}
|
||||
|
||||
|
||||
for (u32 i = 0; i < 32; i++)
|
||||
for (uint32_t i = 0; i < 32; i++)
|
||||
{
|
||||
assert(a0[i] == i);
|
||||
assert(a1[i] == (100 + i));
|
||||
|
@ -161,6 +170,7 @@ run_tests()
|
|||
assert(round_up_to_pow2_u32(32) == 32);
|
||||
assert(round_up_to_pow2_u32(120) == 128);
|
||||
|
||||
|
||||
memory_tests();
|
||||
bsp_tests();
|
||||
|
||||
|
@ -201,12 +211,12 @@ run_tests()
|
|||
|
||||
// testing threads
|
||||
Platform_Thread_Handle threads[8];
|
||||
for (u32 j = 0; j < 8; j++)
|
||||
for (uint32_t j = 0; j < 8; j++)
|
||||
{
|
||||
threads[j] = platform_thread_begin(thread_proc, 0);
|
||||
}
|
||||
|
||||
for (u32 j = 0; j < 8; j++)
|
||||
for (uint32_t j = 0; j < 8; j++)
|
||||
{
|
||||
platform_thread_end(threads[j]);
|
||||
}
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
File_Async_Job_System
|
||||
os_file_jobs_init()
|
||||
{
|
||||
|
||||
return (File_Async_Job_System){};
|
||||
}
|
||||
|
||||
File_Handle
|
||||
os_file_open(String path, File_Access_Flags flags_access, File_Create_Flags flags_create)
|
||||
{
|
||||
invalid_code_path;
|
||||
return (File_Handle){};
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -23,31 +24,58 @@ File_Info
|
|||
os_file_get_info(File_Handle file_handle, Allocator* allocator)
|
||||
{
|
||||
invalid_code_path;
|
||||
return (File_Info){};
|
||||
}
|
||||
|
||||
Data
|
||||
os_file_read_all(File_Handle file_handle, Allocator* allocator)
|
||||
{
|
||||
invalid_code_path;
|
||||
return (Data){};
|
||||
}
|
||||
|
||||
bool
|
||||
os_file_write_all(File_Handle file_handle, Data file_data)
|
||||
{
|
||||
invalid_code_path;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
os_file_write(File_Handle file_handle, Data file_data)
|
||||
{
|
||||
invalid_code_path;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
String
|
||||
os_get_exe_path(Allocator* allocator)
|
||||
{
|
||||
invalid_code_path;
|
||||
String result = {};
|
||||
char buf[PATH_MAX + 1];
|
||||
s32 r = readlink("/proc/self/exe", buf, PATH_MAX);
|
||||
if (r != -1)
|
||||
{
|
||||
u64 needed = c_str_len(buf);
|
||||
result = allocator_alloc_string(allocator, needed + 1);
|
||||
memory_copy((u8*)buf, result.str, needed);
|
||||
result.len = needed;
|
||||
result.str[result.len] = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
os_pwd_set(String path)
|
||||
{
|
||||
invalid_code_path;
|
||||
s32 result = chdir((char*)path.str);
|
||||
if (result == -1)
|
||||
{
|
||||
linux_err_print("chdir");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +83,7 @@ File_Info_List
|
|||
os_dir_enum(String path, Platform_Enum_Dir_Flags flags, Allocator* allocator)
|
||||
{
|
||||
invalid_code_path;
|
||||
return (File_Info_List){};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,54 +1,68 @@
|
|||
#ifndef LUMENARIUM_LINUX_MEMORY_H
|
||||
#define LUMENARIUM_LINUX_MEMORY_H 1
|
||||
|
||||
global u64 linux_page_size_cache_ = 0;
|
||||
static uint64_t linux_page_size_cache_ = 0;
|
||||
|
||||
// https://stackoverflow.com/questions/3351940/detecting-the-memory-page-size
|
||||
u64
|
||||
uint64_t
|
||||
os_page_size()
|
||||
{
|
||||
if (linux_page_size_cache_ == 0)
|
||||
{
|
||||
long page_size = sysconf(_SC_PAGE_SIZE);
|
||||
linux_page_size_cache_ = (u64)page_size;
|
||||
linux_page_size_cache_ = (uint64_t)page_size;
|
||||
}
|
||||
return linux_page_size_cache_;
|
||||
}
|
||||
|
||||
#define OS_MEM_PAGE_SIZE os_page_size()
|
||||
|
||||
#ifdef DEBUG
|
||||
# define linux_memory_assert_always (*((volatile int*)0) = 0xFFFF)
|
||||
# define linux_memory_assert(c) do { \
|
||||
if (!(c)) { \
|
||||
linux_memory_assert_always;\
|
||||
}} while(false)
|
||||
#endif // DEBUG
|
||||
|
||||
#define SIZE_T_MAX_U64 (uint64_t)((size_t)0 - 1)
|
||||
|
||||
size_t
|
||||
linux_round_to_page_size(uint64_t size)
|
||||
{
|
||||
uint64_t rem = size % linux_page_size_cache_;
|
||||
if (rem != 0 || size < linux_page_size_cache_)
|
||||
uint64_t m = SIZE_T_MAX_U64;
|
||||
linux_memory_assert(size < SIZE_T_MAX_U64);
|
||||
uint64_t rem = size % os_page_size();
|
||||
if (rem != 0 || size < os_page_size())
|
||||
{
|
||||
uint64_t grow = linux_page_size_cache_ - rem;
|
||||
uint64_t grow = os_page_size() - rem;
|
||||
size += grow;
|
||||
}
|
||||
return (size_t)size;
|
||||
}
|
||||
|
||||
u8*
|
||||
os_mem_reserve(u64 size)
|
||||
uint8_t*
|
||||
os_mem_reserve(uint64_t size)
|
||||
{
|
||||
size_t size_cvt = linux_round_to_page_size(size);
|
||||
uint8_t* result = (uint8_t*)malloc(size_cvt);
|
||||
return result;
|
||||
}
|
||||
|
||||
u8*
|
||||
os_mem_commit(u8* base, u64 size)
|
||||
uint8_t*
|
||||
os_mem_commit(uint8_t* base, uint64_t size)
|
||||
{
|
||||
return base;
|
||||
}
|
||||
|
||||
bool
|
||||
os_mem_decommit(u8* base, u64 size)
|
||||
os_mem_decommit(uint8_t* base, uint64_t size)
|
||||
{
|
||||
return 1; // true
|
||||
}
|
||||
|
||||
bool
|
||||
os_mem_release(u8* base, u64 size)
|
||||
os_mem_release(uint8_t* base, uint64_t size)
|
||||
{
|
||||
free(base);
|
||||
return 1; // true
|
||||
|
|
|
@ -5,7 +5,7 @@ Socket_Handle
|
|||
os_socket_create(s32 domain, s32 type, s32 protocol)
|
||||
{
|
||||
invalid_code_path;
|
||||
return Socket_Handle{0};
|
||||
return (Socket_Handle){0};
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -33,7 +33,7 @@ Data
|
|||
os_socket_recv()
|
||||
{
|
||||
invalid_code_path;
|
||||
return Data{};
|
||||
return (Data){};
|
||||
}
|
||||
|
||||
s32
|
||||
|
@ -64,10 +64,4 @@ os_socket_set_opt(Socket_Handle handle, int level, int option_name, u8* option_v
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
open_sockets_init()
|
||||
{
|
||||
invalid_code_path;
|
||||
}
|
||||
|
||||
#endif // LUMENARIUM_LINUX_NETWORK_H
|
|
@ -5,12 +5,14 @@ Ticks
|
|||
os_get_ticks()
|
||||
{
|
||||
invalid_code_path;
|
||||
return (Ticks){};
|
||||
}
|
||||
|
||||
r64
|
||||
os_get_ticks_per_second()
|
||||
{
|
||||
invalid_code_path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // LUMENARIUM_LINUX_TIME_H
|
|
@ -18,6 +18,7 @@ void os_file_close(File_Handle file_handle);
|
|||
File_Info os_file_get_info(File_Handle file_handle, Allocator* allocator);
|
||||
Data os_file_read_all(File_Handle file_handle, Allocator* allocator);
|
||||
bool os_file_write_all(File_Handle file_handle, Data file_data);
|
||||
bool os_file_write(File_Handle file_handle, Data file_data);
|
||||
|
||||
String os_get_exe_path(Allocator* allocator);
|
||||
bool os_pwd_set(String path);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "lumenarium_osx_memory.h"
|
||||
#include "../../core/lumenarium_core.h"
|
||||
#include "../lumenarium_os.h"
|
||||
|
||||
#define PLATFORM_SUPPORTS_EDITOR 1
|
||||
#include "../../lumenarium_first.c"
|
||||
|
||||
#undef internal
|
||||
|
|
|
@ -152,12 +152,8 @@ os_file_read_all(File_Handle file_handle, Allocator* allocator)
|
|||
}
|
||||
|
||||
bool
|
||||
os_file_write_all(File_Handle file_handle, Data file_data)
|
||||
os_file_write_(s32 os_handle, Data file_data)
|
||||
{
|
||||
s32 os_handle = open_files_get_handle(file_handle);
|
||||
if (os_handle == -1) return false;
|
||||
|
||||
lseek(os_handle, 0, SEEK_SET);
|
||||
s32 size_written = write(os_handle, file_data.base, file_data.size);
|
||||
if (size_written > 0 && size_written != file_data.size)
|
||||
{
|
||||
|
@ -173,6 +169,25 @@ os_file_write_all(File_Handle file_handle, Data file_data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
os_file_write_all(File_Handle file_handle, Data file_data)
|
||||
{
|
||||
s32 os_handle = open_files_get_handle(file_handle);
|
||||
if (os_handle == -1) return false;
|
||||
|
||||
lseek(os_handle, 0, SEEK_SET);
|
||||
return os_file_write_(os_handle, file_data);
|
||||
}
|
||||
|
||||
bool
|
||||
os_file_write(File_Handle file_handle, Data file_data)
|
||||
{
|
||||
s32 os_handle = open_files_get_handle(file_handle);
|
||||
if (os_handle == -1) return false;
|
||||
|
||||
return os_file_write_(os_handle, file_data);
|
||||
}
|
||||
|
||||
String
|
||||
os_get_exe_path(Allocator* allocator)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,48 @@
|
|||
#if 0
|
||||
# include "../linux/lumenarium_linux_memory.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "../linux/lumenarium_linux_memory.h"
|
||||
#include "../../core/lumenarium_core.h"
|
||||
#include "../lumenarium_os.h"
|
||||
#include "../../lumenarium_first.c"
|
||||
|
||||
#undef internal
|
||||
#undef external
|
||||
|
||||
#include <errno.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#define linux_err_print(sub_proc) linux_err_print_((char*)__FUNCTION__, (char*)(sub_proc), errno)
|
||||
void
|
||||
linux_err_print_(char* proc, char* sub_proc, s32 errsv)
|
||||
{
|
||||
printf("Error: %s:%s - %d\n\t%s\n\n", proc, sub_proc, errsv, strerror(errsv));
|
||||
}
|
||||
|
||||
#define OS_FILE_HANDLE_TYPE s32
|
||||
#define OS_FILE_MAX_PATH PATH_MAX
|
||||
#define OS_FILE_INVALID_HANDLE -1
|
||||
#define OS_SOCKET_TYPE s32
|
||||
#define OS_SOCKET_INVALID_HANDLE -1
|
||||
#include "../shared/lumenarium_shared_file_tracker.h"
|
||||
#include "../shared/lumenarium_shared_file_async_work_on_job.h"
|
||||
#include "../shared/lumenarium_shared_network.h"
|
||||
#include "../linux/lumenarium_linux_file.h"
|
||||
#include "../linux/lumenarium_linux_time.h"
|
||||
#include "../linux/lumenarium_linux_network.h"
|
||||
|
||||
int main (int arg_count, char** args)
|
||||
{
|
||||
printf("Hi there\n");
|
||||
// temp
|
||||
global_scratch_ = bump_allocator_create_reserve(MB(256));
|
||||
run_tests();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
void
|
||||
lumenarium_raspi_tests()
|
||||
{
|
||||
printf("Hi there\n");
|
||||
}
|
|
@ -66,7 +66,7 @@ incenter_init(App_State* state)
|
|||
}
|
||||
|
||||
r32 rad = 0.05f;
|
||||
ed_sculpture_updated(state, 5, rad);
|
||||
sculpture_updated(state, 5, rad);
|
||||
scratch_release(scratch);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue