Some changes

This commit is contained in:
Kirill Zhumarin 2026-09-11 20:58:30 +00:00
parent d6d91b973a
commit a6df8ef303
9 changed files with 36 additions and 14 deletions

View file

@ -174,6 +174,7 @@ Elf32_Lib *loader_lib_open(const char *name, Elf32_Exec *_ex) {
Elf32_Ehdr ehdr;
Elf32_Exec *ex;
char __mem[256];
uint32_t err;
// Поищем среди уже загруженых
Global_Queue *ready_libs = lib_top;
@ -224,7 +225,6 @@ Elf32_Lib *loader_lib_open(const char *name, Elf32_Exec *_ex) {
try_again:
/* Открываем */
uint32_t err;
if (((fp = sys_open(ld_path, A_ReadOnly | A_BIN, P_READ, &err)) < 0)) {
strcpy(dlerr, NO_FILEORDIR);
return 0;

View file

@ -11,11 +11,11 @@ extern "C" void loader_swi_stub(int swi) {
}
extern "C" void loader_subproc_impl(void *func, void *p1) {
SUBPROC(func, (int) p1);
SUBPROC(func, reinterpret_cast<int>(p1));
}
extern "C" int *loader_library_impl() {
return (int *) SWILIB;
return reinterpret_cast<int*>(SWILIB);
}
extern "C" void loader_log_error(const char *format, ...) {

View file

@ -29,7 +29,6 @@
#include "src/utils/fs.h"
#include "src/utils/string.h"
static volatile sig_atomic_t sigalrm_called = 0;
static std::string buildLibraryPathEnv(const std::vector<std::string> &library_path);
/*

View file

@ -3,6 +3,7 @@
#include "src/Resources.h"
#include "src/swi/gui.h"
#include "src/swi/image.h"
#include <spdlog/spdlog.h>
TextRender::TextRender(Painter *painter, RECT *rect, uint16_t *str, int length) {
m_rect = rect;
@ -43,6 +44,7 @@ void TextRender::parseWord(int start, int end) {
}
int TextRender::drawWord(Word *word, int x, int y) {
spdlog::debug("drawWord {} {}", x, y);
auto *res = Resources::instance();
int width = 0;
for (int j = word->start; j <= word->end; j++) {
@ -56,6 +58,7 @@ int TextRender::drawWord(Word *word, int x, int y) {
}
void TextRender::renderLine() {
spdlog::debug("renderLine {}", m_words.size());
if (m_words.size() == 0)
return;
@ -147,7 +150,8 @@ void TextRender::renderInline(int x_offset) {
int ctrl_chars = handleModifiers(&m_style, m_str, m_length);
for (int i = ctrl_chars; i < m_length; i++) {
auto *img = res->getFontChar(m_style.font, m_str[i], false);
if (virtual_x >= (x_offset - 1)) {
spdlog::debug("renderInline {}>={}", virtual_x, (x_offset - 1));
if ((virtual_x + img->w) >= (x_offset - 1)) {
m_painter->drawBitmap(x, 0, img->w, img->h, img->bitmap, IMG_GetBitmapType(img->bpnum), 0, 0, m_style.brush, m_style.pen);
if ((m_style.flags & (TEXT_INVERT | TEXT_INVERT2)))

View file

@ -281,7 +281,7 @@ int PushDRWOBJOnLAYER(DRWOBJ *drwobj, LCDLAYER *layer) {
// TODO: merge DRWOBJ rect + LCDLAYER rect?
RECT *rect = &drw->rect;
// spdlog::debug("DRAW [ {}, {}, {}, {} ]", rect->x, rect->y, rect->x2, rect->y2);
spdlog::debug("DRW [ {}, {}, {}, {} ]", rect->x, rect->y, rect->x2, rect->y2);
painter.setBuffer(reinterpret_cast<uint8_t *>(layer->buffer), layer->w, layer->h, LCDLAYER_GetBitmapType(layer));
painter.setWindow(rect->x, rect->y, rect->x2, rect->y2);

View file

@ -4,13 +4,28 @@
#include <cstdlib>
#include <cstring>
#include <csetjmp>
#include <vector>
#include <unordered_map>
#include <mutex>
#include <swilib/libc.h>
#include <swilib/system.h>
#include "src/elfloader/loader.h"
#include <csetjmp>
#include <unordered_map>
#include <mutex>
#include <csetjmp>
#include <unordered_map>
#include <mutex>
#include <memory>
void _longjmp(jmp_buf env, int val) {
spdlog::debug("{}: not implemented!", __func__);
abort();
jmp_buf buf;
extern "C" int SWI_setjmp(int env[11]) {
return setjmp(buf);
}
extern "C" void SWI_longjmp(int env[11], int val) {
longjmp(buf, val);
}
int _dlopen(const char *name) {

View file

@ -30,7 +30,7 @@ static const char *SET_TO_PATH[] = {
"1:\\Default\\orangehomescreen.pd",
};
static constexpr int MAX_SETTINGS_ID = (sizeof(SET_TO_PATH) / sizeof(SET_TO_PATH[0])) - 1;
// static constexpr int MAX_SETTINGS_ID = (sizeof(SET_TO_PATH) / sizeof(SET_TO_PATH[0])) - 1;
static std::string SettingsAE_GetPath(int id) {
assert(id >= 0 && id <= MAX_SETTINGS_ID);

View file

@ -10,6 +10,9 @@
#include <stdlib.h>
#include <string.h>
int SWI_setjmp(int *env);
void SWI_longjmp(int *env, int val);
static void __swi_0000() {
loader_swi_stub(0x0000);
}
@ -12470,7 +12473,7 @@ void loader_init_swilib() {
SWILIB[0x015F] = (void *) png_get_rowbytes;
SWILIB[0x0160] = (void *) png_read_row;
SWILIB[0x0161] = (void *) png_init_io;
SWILIB[0x0162] = (void *) _setjmp;
SWILIB[0x0162] = (void *) SWI_setjmp;
SWILIB[0x0163] = (void *) AllocEQueue;
SWILIB[0x0164] = (void *) PrepareEditControl;
SWILIB[0x0165] = (void *) ConstructEditControl;
@ -12669,7 +12672,7 @@ void loader_init_swilib() {
SWILIB[0x0226] = (void *) PlayMelody_StopPlayback;
SWILIB[0x0227] = (void *) PlayMelody_PausePlayback;
SWILIB[0x0228] = (void *) PlayMelody_ResumePlayBack;
SWILIB[0x0229] = (void *) _longjmp;
SWILIB[0x0229] = (void *) SWI_longjmp;
SWILIB[0x022A] = (void *) FreeGSMTXTpkt;
SWILIB[0x022B] = (void *) CreateRadioButtonList;
SWILIB[0x022C] = (void *) pdcache_getval;
@ -13092,9 +13095,9 @@ void loader_init_swilib() {
SWILIB[0x03CD] = (void *) __swi_03cd;
SWILIB[0x03CE] = (void *) __swi_03ce;
SWILIB[0x03CF] = (void *) __swi_03cf;
SWILIB[0x03D0] = (void *) ShowScreenSaverCodeProtection;
// SWILIB[0x03D0] = (void *) ShowScreenSaverCodeProtection;
SWILIB[0x03D1] = (void *) MediaProc_LaunchLastPlayback;
SWILIB[0x03D2] = (void *) GetScreenSaverType;
// SWILIB[0x03D2] = (void *) GetScreenSaverType;
SWILIB[0x03D3] = (void *) IllumFilterSet;
SWILIB[0x03D4] = (void *) DrawCroppedIMGHDR;
SWILIB[0x03D5] = (void *) BuildPath;

View file

@ -6,6 +6,7 @@ set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
set(CMAKE_LINKER_TYPE BFD)
find_program(ARM_C_COMPILER arm-linux-gnueabihf-gcc${CMAKE_EXECUTABLE_SUFFIX} NO_CACHE REQUIRED)
find_program(ARM_CXX_COMPILER arm-linux-gnueabihf-g++${CMAKE_EXECUTABLE_SUFFIX} NO_CACHE REQUIRED)