FINALLY fixed the bug that caused rendering to suck

This commit is contained in:
Knaapchen 2022-10-09 13:55:39 +02:00
parent a5416d098c
commit afdd6589a7
2 changed files with 33 additions and 6 deletions

View File

@ -288,28 +288,55 @@ WASM_IMPORT_IMPL(env, __emscripten_get_now_is_monotonic) = []() {
/* __gmtime_js */
WASM_IMPORT_IMPL(env, __gmtime_js) = [](u32 a, u32 b) {
// FIXME:
// puts("__gmtime_js is not implemented yet.");
auto& t = fugg::module_ref<const time_t>(a);
const auto& info = gmtime(&t);
auto& result = fugg::module_ref<tm>(b);
result.tm_sec = info->tm_sec;
result.tm_min = info->tm_min;
result.tm_hour = info->tm_hour;
result.tm_mday = info->tm_mday;
result.tm_mon = info->tm_mon;
result.tm_year = info->tm_year;
result.tm_wday = info->tm_wday;
result.tm_yday = info->tm_yday;
};
/* import: 'a' 'Kb' */
/* __localtime_js */
WASM_IMPORT_IMPL(env, __localtime_js) = [](u32 a, u32 b) {
// FIXME:
// puts("__localtime_js is not implemented yet.");
auto& t = fugg::module_ref<const time_t>(a);
const auto& info = gmtime(&t);
auto& result = fugg::module_ref<tm>(b);
result.tm_sec = info->tm_sec;
result.tm_min = info->tm_min;
result.tm_hour = info->tm_hour;
result.tm_mday = info->tm_mday;
result.tm_mon = info->tm_mon;
result.tm_year = info->tm_year;
result.tm_wday = info->tm_wday;
result.tm_yday = info->tm_yday;
result.tm_isdst = info->tm_isdst;
result.tm_gmtoff = info->tm_gmtoff;
};
/* import: 'a' 'Lb' */
/* __mktime_js */
WASM_IMPORT_IMPL(env, __mktime_js) = [](u32 a) {
// FIXME:
// puts("__mktime_js is not implemented yet.");
auto& t = fugg::module_ref<tm>(a);
return static_cast<u32>(0);
auto result = mktime(&t);
return static_cast<u32>(result);
};
/* import: 'a' 'Mb' */
/* __tzset_js */
WASM_IMPORT_IMPL(env, __tzset_js) = [](u32 a, u32 b, u32 c) {
// FIXME:
// puts("__tzset_js is not implemented yet.");
// Not sure if this is correct...
tzset();
};
/* import: 'a' 'Rb' */

View File

@ -233,7 +233,7 @@ WASM_IMPORT_IMPL(env, _glBindFramebuffer) = [](u32 a, u32 b) {
/* import: 'a' 'D' */
/* _glDrawElements */
WASM_IMPORT_IMPL(env, _glDrawElements) = [](u32 a, u32 b, u32 c, u32 d) {
const auto& indices = fugg::ModulePointer<const void*>(d);
const auto& indices = reinterpret_cast<const void*>(d);
#if TRACE_GL_CALLS
std::cout << "_glDrawElements("