ISqlResult
and every class inheriting from it should have the suffix Result
Then there is ISqlData
and every class inheriting from it should have the suffix Data
if it is data that should be written in an INSERT statement. Or Request
if it is used to perform a read operation and will be used in a SELECT statament.
The convention was mostly established alreay. In this commit the last three classes that broke ...struct Player_Input
{
bool32 up, down, left, right;
};
first time i see bool32
xddint func(const int &ref) {};
more than
int func(int *ref) {};
(personal preference and i dont know why tbh)
i also dislike that i have to dereference a pointer if i want to access the value
e.g std::cout << *ref << std::endl;
(edited)int func(const int &ref) {};
more than
int func(int *ref) {};
(personal preference and i dont know why tbh)
i also dislike that i have to dereference a pointer if i want to access the value
e.g std::cout << *ref << std::endl;
(edited)&
in function calls to know if it's passed by value or notint func(const int &ref) {};
more than
int func(int *ref) {};
(personal preference and i dont know why tbh)
i also dislike that i have to dereference a pointer if i want to access the value
e.g std::cout << *ref << std::endl;
(edited)❯ ./target/release/ddnet-playground
[2024-09-27T13:40:59Z INFO fs] Found config dir in "/home/edgar/.config/ddnet"
[2024-09-27T13:40:59Z INFO fs] Found config dir in "/home/edgar/.config/ddnet"
[2024-09-27T13:40:59Z WARN winit::platform_impl::linux::x11::xdisplay] error setting XSETTINGS; Xft options won't reload automatically
[2024-09-27T13:40:59Z WARN thread_priority] Couldn't set the priority for the thread with Rust Thread ID ThreadId(45) named Some("backend-thread"): OS(13)
[2024-09-27T13:40:59Z INFO winit::platform_impl::linux::x11::window] Guessed window scale factor: 1
[2024-09-27T13:40:59Z INFO graphics_backend::backends::vulkan::phy_device] Vulkan 1.3.280 (driver: 560.35.3.0), NVIDIA
[2024-09-27T13:40:59Z INFO fs-watch] could not watch directory/file: No such file or directory (os error 2)
connect time cl: 6665068186
[2024-09-27T13:41:06Z INFO ddnet_playground::client::game] loading map: linear
[2024-09-27T13:41:07Z INFO fs-watch] could not watch directory/file: No such file or directory (os error 2)
wasm log msg: WARN-sql: failed to prepare setup for sqls: not implemented for the dummy database in twgame:718
wasm log msg: WARN-sql: failed to prepare setup for sqls: not implemented for the dummy database in twgame:718
[2024-09-27T13:41:45Z INFO fs-watch] could not stop watching directory/file: No watch was found. about ["/home/edgar/.config/ddnet/mods/render"]
wasm log msg: WARN-sql: failed to prepare setup for sqls: not implemented for the dummy database in twgame:718
connect time cl: 58687199188
[2024-09-27T13:41:58Z INFO ddnet_playground::client::game] loading map: ctf5
[2024-09-27T13:41:58Z INFO fs-watch] could not watch directory/file: No such file or directory (os error 2)
[2024-09-27T13:44:03Z INFO fs-watch] could not stop watching directory/file: No watch was found. about ["/home/edgar/.config/ddnet/mods/render"]
[2024-09-27T13:44:03Z INFO fs-watch] could not stop watching directory/file: No watch was found. about ["/home/edgar/.config/ddnet/mods/ui"]
[2024-09-27T13:44:03Z INFO sound_backend::backend_thread] sounds backend thread exited: sending on a closed channel disabled backtrace
[2024-09-27T13:44:03Z INFO graphics_backend::backend_thread] graphics backend thread exited: sending on a closed channel
dbg.bench true
-> quit -> start client and show the log of the terminal thencargo +nightly build --release -Z build-std=panic_abort,std --target x86_64-unknown-linux-gnu
./target/x86_64-unknown-linux-gnu/release/ddnet-playground
dbg.bench true
-> quit -> start client and show the log of the terminal then ❯ ldd ddnet-playground
linux-vdso.so.1 (0x00007f65dd7ae000)
libopus.so.0 => /usr/lib64/libopus.so.0 (0x00007f65d7767000)
libwayland-client.so.0 => /usr/lib64/libwayland-client.so.0 (0x00007f65d7757000)
libasound.so.2 => /usr/lib64/libasound.so.2 (0x00007f65d7668000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f65d7642000)
libm.so.6 => /lib64/libm.so.6 (0x00007f65d7593000)
libc.so.6 => /lib64/libc.so.6 (0x00007f65d73d2000)
libffi.so.8 => /usr/lib64/libffi.so.8 (0x00007f65d73c5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f65dd7b0000)
twmap-edit
was probably used here, you can multiply the size of maps by any positive integer factor with it :)objdump -p <EXECUTABLE> | grep NEEDED
NEEDED libopus.so.0
NEEDED libwayland-client.so.0
NEEDED libasound.so.2
NEEDED libgcc_s.so.1
NEEDED libm.so.6
NEEDED libc.so.6
ddnet
NEEDED libfreetype.so.6
NEEDED libGLEW.so.2.2
NEEDED libpng16.so.16
NEEDED libz.so.1
NEEDED libSDL2-2.0.so.0
NEEDED libwavpack.so.1
NEEDED libavformat.so.60
NEEDED libavcodec.so.60
NEEDED libavutil.so.58
NEEDED libswscale.so.7
NEEDED libswresample.so.4
NEEDED libopusfile.so.0
NEEDED libvulkan.so.1
NEEDED libGL.so.1
NEEDED libnotify.so.4
NEEDED libgobject-2.0.so.0
NEEDED libcrypto.so.3
NEEDED libcurl.so.4
NEEDED libsqlite3.so.0
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2
eval(unescape(escape``.replace(/u../g,'')))
eval(unescape(escape``.replace(/u../g,'')))
TEXTURE_ENV_MODE
, I wonder if that can work somehowglEnable(GL_STENCIL_TEST); // by default not enabled
glStencilMask(stencilMask); // allow writing to stencil buffer, by default (0xFF) no mask.
glClearStencil(clearStencilValue); // clear stencil value, by default = 0
glStencilFunc(func, ref, mask); // by default GL_ALWAYS, 0, 0xFF, always pass stencil test
glStencilOp(fail,zfail,zpass); // by default GL_KEEP, GL_KEEP, GL_KEEP, do not change stencil buffer
glClear(GL_STENCIL_BUFFER_BIT); // clear stencil buffer, fill with (clearStencilValue & stencilMask)
TEXTURE_ENV_MODE
MODULATE
working somehow, let me mess around with it a bit twmap-edit
was probably used here, you can multiply the size of maps by any positive integer factor with it :) Failed to save map: Map - In Image87 items of this type is too many, the maximum is 64
8 doesnt work either :(Failed to save map: Map - In Group at index 3 -> In Layer at index 0 -> Images used by tiles layers must have w
idth and height be divisible by 16
(edited)TEXTURE1
?TEXTURE1
? (GL_TEXTURE1);
but apparently that is newer opengl alreadyglActiveTexture(GL_TEXTURE1);
glActiveTexture(GL_TEXTURE1);
then glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE1);
then glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_vTextures[TextOutlineTextureIndex].m_Tex);
GL_TEXTURE_ENV_MODE
GL_REPLACE
like they do on the wiki https://www.khronos.org/opengl/wiki/Texture_CombinersGL_TEXTURE_ENV_MODE
GL_REPLACE
like they do on the wiki https://www.khronos.org/opengl/wiki/Texture_Combiners GL_COMBINE
on TEXTURE1
so I can multiply the final colorGL_COMBINE
on TEXTURE1
so I can multiply the final color Failed to save map: Map - In Image87 items of this type is too many, the maximum is 64
8 doesnt work either :( glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
after u doneglActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
float t[4] = {0.8f, 0.0f, 1.0f, 1.0f};
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
float t[4] = {0.8f, 0.0f, 1.0f, 1.0f};
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
GL_TEXTURE0
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
float t[4] = {0.8f, 0.0f, 1.0f, 1.0f};
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
GL_TEXTURE_ENV_COLOR
, GL_CONSTANT
pulls from that{
float t[4] = {1.0f, 1.0f, 1.0f, 1.0f};
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, t);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
}
Pasted at the end of gl1's setstate before glMatrixMode
(edited)GL_TEXTURE_ENV_MODE
back to GL_MODULATE
and the color back to 0, 0, 0, 0
GL_TEXTURE_ENV_MODE
back to GL_MODULATE
and the color back to 0, 0, 0, 0
Cmd_TextTextures_Create
i simply saved that they are text textures xdd
c++
TextureCreate(pCommand->m_Slot, pCommand->m_Width, pCommand->m_Height, GL_ALPHA, GL_ALPHA, CCommandBuffer::TEXFLAG_NOMIPMAPS, pCommand->m_pTextData);
TextureCreate(pCommand->m_SlotOutline, pCommand->m_Width, pCommand->m_Height, GL_ALPHA, GL_ALPHA, CCommandBuffer::TEXFLAG_NOMIPMAPS, pCommand->m_pTextOutlineData);
m_vTextures[pCommand->m_Slot].m_Text = true;
m_vTextures[pCommand->m_SlotOutline].m_Text = true;
match expr {
ExprBinary {
op: BinOp::Add | BinOp::Sub,
left,
right,
} => {
if let Some(dest) = dest {
let (dest, dest_new) = if let Destination::Memory(_) = &dest {
(self.arch.alloc()?.dest(size), true)
} else {
(dest, false)
};
self.expr(*left, Some(dest.clone()), state)?;
let (src, src_new) = expr_to_source(self, *right, true)?;
match op {} // i need to match on op here
}
}
_ => (),
};
rust pros, is there a way to get op
value in such a case?match expr {
ExprBinary {
op,
left,
right,
} => {
if let (Some(dest), BinOp::Add | BinOp::Sub) = (dest, op) {
let (dest, dest_new) = if let Destination::Memory(_) = &dest {
(self.arch.alloc()?.dest(size), true)
} else {
(dest, false)
};
self.expr(*left, Some(dest.clone()), state)?;
let (src, src_new) = expr_to_source(self, *right, true)?;
match op {} // i need to match on op here
}
}
_ => (),
};
BinOp::Add
and BinOp::Sub
:\ExprBinary
match expr {
ExprBinary {op} if checkopwhatever => {}
}
match expr {
ExprBinary {op} if checkopwhatever => {}
}
match op { SomeCase => {}, SomeOtherCase => {} }
(edited)if matches!(op, BinOp::Add | BinOp::Sub)
should still work in the match guardop
later it wants me to cover every variantif matches!(op, BinOp::Add | BinOp::Sub)
should still work in the match guard unreachable!()
match expr {
ExprBinary {
op: BinOp::Assign,
left,
right,
} => {
let left = left.dest(self)?.ok_or(CodeGenError::Assign(*left))?;
self.expr(*right, Some(left.clone()), state)?;
if let Some(dest) = dest {
self.arch.mov(&left.clone().into(), &dest, signed)?;
}
self.free(left)?;
}
ExprBinary { op, left, right } if matches!(op, BinOp::Add | BinOp::Sub) => {
if let Some(dest) = dest {
let (dest, dest_new) = if let Destination::Memory(_) = &dest {
(self.arch.alloc()?.dest(size), true)
} else {
(dest, false)
};
self.expr(*left, Some(dest.clone()), state)?;
let (src, src_new) = expr_to_source(self, *right, true)?;
match op {
BinOp::Add => (),
BinOp::Sub => (),
_ => unreachable!()
}
}
}
_ => (), // welp, git gut
};
match expr {
ExprBinary {
op: BinOp::Assign,
left,
right,
} => {
let left = left.dest(self)?.ok_or(CodeGenError::Assign(*left))?;
self.expr(*right, Some(left.clone()), state)?;
if let Some(dest) = dest {
self.arch.mov(&left.clone().into(), &dest, signed)?;
}
self.free(left)?;
}
ExprBinary { op, left, right } if matches!(op, BinOp::Add | BinOp::Sub) => {
if let Some(dest) = dest {
let (dest, dest_new) = if let Destination::Memory(_) = &dest {
(self.arch.alloc()?.dest(size), true)
} else {
(dest, false)
};
self.expr(*left, Some(dest.clone()), state)?;
let (src, src_new) = expr_to_source(self, *right, true)?;
match op {
BinOp::Add => (),
BinOp::Sub => (),
_ => unreachable!()
}
}
}
_ => (), // welp, git gut
};
ExprBinary
with a match op
inside insteadmatch expr {
ExprBinary {
op: BinOp::Assign,
left,
right,
} => {
let left = left.dest(self)?.ok_or(CodeGenError::Assign(*left))?;
self.expr(*right, Some(left.clone()), state)?;
if let Some(dest) = dest {
self.arch.mov(&left.clone().into(), &dest, signed)?;
}
self.free(left)?;
}
ExprBinary { op, left, right } if matches!(op, BinOp::Add | BinOp::Sub) => {
if let Some(dest) = dest {
let (dest, dest_new) = if let Destination::Memory(_) = &dest {
(self.arch.alloc()?.dest(size), true)
} else {
(dest, false)
};
self.expr(*left, Some(dest.clone()), state)?;
let (src, src_new) = expr_to_source(self, *right, true)?;
match op {
BinOp::Add => (),
BinOp::Sub => (),
_ => unreachable!()
}
}
}
_ => (), // welp, git gut
};
Overall, this is a well-structured approach to handling binary expressions in a code generator. It covers the main cases and provides a solid foundation for further development.
match expr.op {
op @ (BinOp::Add | BinOp::Sub) => {
}
};
there's even syntax with @
expr.op
itself xdD:\ddnet-master\ddnet\src\game\editor\popups.cpp(1): warning C4828: The file contains a character starting at offset 0x2244 that is illegal in the current source character set (codepage 65001).