Skip to content

Commit

Permalink
leftovers, NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
toxieainc committed Nov 25, 2023
1 parent 34c9081 commit 4212892
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions ext/dmddevice/Demo/dmddevice_dll/dmddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DMDDEV void Set_16_Colors_Palette(rgb24 *color)
DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (isOpen) {
for (int i = 0; i < width*height; i++){
for (int i = 0; i < (int)width*height; i++){
switch (currbuffer[i]) {
case 0:
arr[i] = colors[0];
Expand Down Expand Up @@ -111,7 +111,7 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (isOpen) {
for (int i = 0; i < width*height; i++)
for (int i = 0; i < (int)width*height; i++)
arr[i] = colors[currbuffer[i]];
HBITMAP map = CreateBitmap(width, height, 1, 32, (void*)arr);
HDC src = CreateCompatibleDC(hdc);
Expand Down Expand Up @@ -202,7 +202,7 @@ DMDDEV void Render_PM_Alphanumeric_Frame(layout_t layout, const UINT16 *const se
DMDDEV void Render_RGB24(UINT16 width, UINT16 height, rgb24 *currbuffer)
{
if (isOpen) {
for (int i = 0; i < width*height; i++){
for (int i = 0; i < (int)width*height; i++){
arr[i] = ((int)currbuffer[i].red << 16) | ((int)currbuffer[i].green << 8) | ((int)currbuffer[i].blue /*<< 0*/);
}
HBITMAP map = CreateBitmap(width, height, 1, 32, (void*)arr);
Expand Down
16 changes: 8 additions & 8 deletions ext/dmddevice/pinDMDv1/dmddevice_dll/dmddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool slowUSB = false;
void Send_Clear_Screen()
{
memset(OutputPacketBuffer,0x00, 2052);
const UINT8 tmp[4] = {
static const UINT8 tmp[4] = {
0x81, 0xC3, 0xE7, 0x00 //header
};
memcpy(OutputPacketBuffer, tmp, sizeof(tmp));
Expand Down Expand Up @@ -120,10 +120,10 @@ DMDDEV void PM_GameSettings(const char* GameName, UINT64 HardwareGeneration, con

DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
int byteIdx=4;
Expand Down Expand Up @@ -162,7 +162,7 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
tempbuffer[o] = (UINT8)(((int)currbuffer[offs] + (int)currbuffer[offs+256] + (int)currbuffer[offs+1] + (int)currbuffer[offs+257])/4);
}
} else
memcpy(tempbuffer,currbuffer,width*height);
memcpy(tempbuffer,currbuffer,(size_t)width*height);


// dmd height
Expand Down Expand Up @@ -218,10 +218,10 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)

DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
int byteIdx=4;
Expand All @@ -230,7 +230,7 @@ DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
OutputPacketBuffer[0] = 0x81; // frame sync bytes
OutputPacketBuffer[1] = 0xC3;
OutputPacketBuffer[2] = 0xE7;
OutputPacketBuffer[3] = 0x0; // command byte
OutputPacketBuffer[3] = 0x0; // command byte

// 128x16 = display centered vert
// 128x32 = no change
Expand Down Expand Up @@ -260,7 +260,7 @@ DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
tempbuffer[o] = (UINT8)(((int)currbuffer[offs] + (int)currbuffer[offs+256] + (int)currbuffer[offs+1] + (int)currbuffer[offs+257])/4);
}
} else
memcpy(tempbuffer,currbuffer,width*height);
memcpy(tempbuffer,currbuffer,(size_t)width*height);


// dmd height
Expand Down
12 changes: 6 additions & 6 deletions ext/dmddevice/pinDMDv2/dmddevice_dll/dmddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ DMDDEV void PM_GameSettings(const char* GameName, UINT64 HardwareGeneration, con

DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
int byteIdx=4;
Expand Down Expand Up @@ -242,7 +242,7 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
tempbuffer[o] = (UINT8)(((int)currbuffer[offs] + (int)currbuffer[offs+256] + (int)currbuffer[offs+1] + (int)currbuffer[offs+257])/4);
}
} else
memcpy(tempbuffer,currbuffer,width*height);
memcpy(tempbuffer,currbuffer,(size_t)width*height);


// dmd height
Expand Down Expand Up @@ -295,10 +295,10 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)

DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
int byteIdx=4;
Expand Down Expand Up @@ -337,7 +337,7 @@ DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
tempbuffer[o] = (UINT8)(((int)currbuffer[offs] + (int)currbuffer[offs+256] + (int)currbuffer[offs+1] + (int)currbuffer[offs+257])/4);
}
} else
memcpy(tempbuffer,currbuffer,width*height);
memcpy(tempbuffer,currbuffer,(size_t)width*height);


// dmd height
Expand Down
12 changes: 6 additions & 6 deletions ext/dmddevice/pinDMDv3/dmddevice_dll/dmddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ DMDDEV void Set_16_Colors_Palette(rgb24 *color)

DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
renderDMDFrame(0x00000000080, (UINT8) width, (UINT8) height, currbuffer, 0x00);
Expand All @@ -93,10 +93,10 @@ DMDDEV void Render_4_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)

DMDDEV void Render_16_Shades(UINT16 width, UINT16 height, UINT8 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (isOpen) {
render16ShadeFrame(currbuffer);
Expand Down Expand Up @@ -190,10 +190,10 @@ DMDDEV void Render_PM_Alphanumeric_Frame(layout_t layout, const UINT16 *const se

DMDDEV void Render_RGB24(UINT16 width, UINT16 height, rgb24 *currbuffer)
{
if (!memcmp(oldbuffer, currbuffer, width*height)) //check if same frame again
if (!memcmp(oldbuffer, currbuffer, (size_t)width*height)) //check if same frame again
return;

memcpy(oldbuffer, currbuffer, width*height);
memcpy(oldbuffer, currbuffer, (size_t)width*height);

if (!isOpen && !useRGB) {
tPMoptions Options;
Expand Down

0 comments on commit 4212892

Please sign in to comment.