Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport VSS to PC version #650

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

caiiiycuk
Copy link
Contributor

@caiiiycuk caiiiycuk commented Dec 2, 2024

Probably github don't ignore line spacing by default, please use this option to see actual diff:

изображение

int pitch;
SDL_LockTexture(sdlTexture, NULL, &pixels, &pitch);
blitRgba((uint32_t*)pixels, get_default_render_buffer(), get_2d_rgba_render_buffer(), get_2d_render_buffer());
sys_frameQuant(pixels, xgrScreenSizeX, xgrScreenSizeY, 4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понятно, может ли JS писать в буфер в этом случае. Для PC версии выглядит странным и избыточно.

{
const char* ininame = sys_fileOpenQuant(_ininame, /*XS::IN*/ 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Внутри делается duk_pop(ctx); что приводит к тому что итоговый указатель на строку может уже не существовать. Скорее всего надо копировать.

{

const char* name = sys_fileOpenQuant(_name, f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potential undefined behavior

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

папка /src/vss должна быть в /lib

Copy link
Contributor

@stalkerg stalkerg Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кроме того .clang-format должен быть консистентным с глобальным. Или просто быть убран.

@@ -17,6 +17,8 @@
#include <ctype.h>
#include "iniparser.h"

extern const char* sys_fileOpenQuant(const char* file, unsigned flags);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо избегать использовать позднего связывания и extern.

id = xtInitApplication();

if (!sys_readyQuant()) {
xtDoneApplication();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это штатный выход или нет? Не кажется что тут может быть штатный выход.


void xtClearMessageQueue(void)
{
sys_tickQuant();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему оно тут а не основном цикле? xtClearMessageQueue вызывается так же во время разных анимаций в меню и эскейве.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот файл разве не должен быть в data? А тут может быть example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

разве не должен быть этот файл в некой папке example?

.prop("rudder", rudder)
.prop("tractionIncrement", traction_increment)
.prop("tractionDecrement", traction_decrement)
.prop("tractionMax", 255)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется тут мы должны некую переменную передавать либо иметь константу уже в самом vss.

@@ -2,6 +2,7 @@ include_directories(
"${PROJECT_SOURCE_DIR}/lib/xtool"
"${PROJECT_SOURCE_DIR}/lib/xgraph"
"${PROJECT_SOURCE_DIR}/lib/xsound"
"${PROJECT_SOURCE_DIR}/src/vss/duktape-2.7.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот движок должен подключаться как зависимость и не быть частью проекта.

@@ -71,14 +72,24 @@ SET(vangers_SRCS
${WINDOWS_RES}
actint/layout.h)

SET(vss_SRCS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо отдельно сделать CMakeFile для vss и собирать отдельную .a библиотеку.

int x,y,offs = 0;
for(y = 0; y < SizeY; y ++){
for(x = 0; x < SizeX; x ++){
if(!(p -> flags & INV_ITEM_NO_ACTIV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не верный отступ пробелами тут

int x,y,offs = 0;
for(y = 0; y < SizeY; y ++){
for(x = 0; x < SizeX; x ++){
if(!(p -> flags & INV_ITEM_NO_ACTIV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишний пробел

int x,y,offs = 0;
for(y = 0; y < SizeY; y ++){
for(x = 0; x < SizeX; x ++){
if(!(p -> flags & INV_ITEM_NO_ACTIV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем мы отправляем указатель в js и как мы с ним там работаем?

@@ -1343,6 +1344,17 @@ void iScreenElement::redraw(int x,int y,int sc,int sm,int hide_mode)
if(flags & EL_NO_SCALE && scale != 256)
return;

auto result = vss::sys()
.quant(vss::REDRAW_QUANT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем нужуен этот квант? Тем более это просто redraw функция а не квант.

.prop("elementType", type)
.send();

if (result.isPreventDefault()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется не безопасно блокировать перерисовку из JS для элементов UI, какой был кейс?

if(x >= 0 && y >= 0 && x <= SizeX && y <= SizeY)
if(x >= 0 && y >= 0 && x <= SizeX && y <= SizeY) {
auto result = vss::sys()
.quant(vss::CHECK_XY_QUANT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем это?

@@ -1878,6 +1900,16 @@ void iScreenObject::init(void)

void iScreenObject::redraw(int mode)
{
auto result = vss::sys()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

похожий вопросс.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duktape не должен быть в репозитории.

#define VANGERS_QUANT_NAMES_H

namespace vss {
constexpr const char* READY_QUANT = "ready";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем constexpr тут?

return 1;
},
1},
{"getLineT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем это тут?

return 1;
},
1},
{"renderLine",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это зачем?

return 0;
},
1},
{"getRgbaData",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

аналогично.

return 0;
},
7},
{"toBase64",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

разве в js мы нет уже готовой функции для этого?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мы где то разве используем base64?

if (duk_get_prop_string(ctx, -1, name)) {
value = duk_to_string(ctx, -1);
}
duk_pop(ctx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потенциальная проблемма

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants