Skip to content

Commit 43d1695

Browse files
author
ge69dal
committed
fixed linux bug
1 parent 889fc57 commit 43d1695

File tree

4 files changed

+58
-41
lines changed

4 files changed

+58
-41
lines changed

Linux/share/sasm/NASM/macro.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void update(char* data){
5656
for(int j = 0; j < needed_bytes; j+=8184){
5757
for(int i = 0; i < min(8184, needed_bytes-j); i++)
5858
message.mesg_text[i] = data[i+j];
59-
msgsnd(msgid_snd, &message, sizeof(message), 0);
59+
//msgsnd(msgid_snd, &message, sizeof(message), 0);
6060
}
6161
}
6262

Linux/share/sasm/include/io.inc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,49 @@ CEXTERN fflush
4343
CEXTERN get_stdin
4444
CEXTERN get_stdout
4545

46+
CEXTERN update
47+
%macro updateDisplay 1.nolist
48+
sasmMacroFunc
49+
push eax
50+
push ecx
51+
push edx
52+
push esi
53+
push edi
54+
ALIGN_STACK 4
55+
push %1
56+
call update
57+
UNALIGN_STACK
58+
pop edi
59+
pop esi
60+
pop edx
61+
pop ecx
62+
pop eax
63+
sasmMacroFuncE
64+
%endmacro
65+
66+
CEXTERN setup
67+
%macro setupDisplay 4.nolist
68+
sasmMacroFunc
69+
push eax
70+
push ecx
71+
push edx
72+
push esi
73+
push edi
74+
ALIGN_STACK 16
75+
push %4
76+
push %3
77+
push %2
78+
push %1
79+
call setup
80+
UNALIGN_STACK
81+
pop edi
82+
pop esi
83+
pop edx
84+
pop ecx
85+
pop eax
86+
sasmMacroFuncE
87+
%endmacro
88+
4689
; Make stack be 16 bytes aligned after pushing %1 bytes
4790
%macro ALIGN_STACK 1.nolist
4891
enter 0, 0

Windows/include/io.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ CEXTERN update
6565
push ecx
6666
push edx
6767
ALIGN_STACK 4
68-
push %1
68+
push %1
6969
call update
7070
UNALIGN_STACK
7171
pop edx
@@ -81,10 +81,10 @@ CEXTERN setup
8181
push ecx
8282
push edx
8383
ALIGN_STACK 16
84-
push %4
85-
push %3
86-
push %2
87-
push %1
84+
push %4
85+
push %3
86+
push %2
87+
push %1
8888
call setup
8989
UNALIGN_STACK
9090
pop edx

displayWindow.cpp

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ void DisplayWindow::changeDisplay(int msgid){
150150
#else
151151
while(1){
152152
// msgrcv to receive message
153-
msgrcv(msgid, &message, sizeof(message), 0, 0);
153+
size_t t = msgrcv(msgid, &message, sizeof(message), 0, 0);
154+
emit printLog("t: "+QString::number(t)+" type: "+QString::number(message.mesg_type)+"\n");
154155

155156
if (message.mesg_type == 2){ // type = 1 (default) -> normal message | -> 2 finish | -> 3 setup
156157
break;
@@ -169,9 +170,10 @@ void DisplayWindow::changeDisplay(int msgid){
169170
else
170171
buffer.resize(res_x*res_y);
171172
displayPicture = new QImage(res_x, res_y, QImage::Format_RGB32);
172-
displayPicture->fill(qRgb(0, 0, 0));
173+
displayPicture->fill(qRgb(255, 255, 255));
174+
scrollAreaWidgetContents->setFixedSize(res_x*zoom+26, res_y*zoom+26);
175+
this->setFixedSize(QSize(res_x+60, res_y+92));
173176
displayImageLabel->setPixmap(QPixmap::fromImage(displayPicture->scaled(res_x*zoom,res_y*zoom)));
174-
this->setFixedSize(QSize(res_x+60, res_y+92));
175177
continue;
176178
}
177179
// display the message and print on display
@@ -182,7 +184,7 @@ void DisplayWindow::changeDisplay(int msgid){
182184
memcpy(buffer.data()+i, &message.mesg_text[0], std::min(8184, needed_bytes-i));
183185
}
184186
updateDisplay();
185-
qint64 elapsed_time = programExecutionTime.elapsed();
187+
qint64 elapsed_time = programExecutionTime.elapsed();
186188
if(elapsed_time < 1000/fps)
187189
usleep(1000/fps - elapsed_time);
188190
displayImageLabel->setPixmap(QPixmap::fromImage(displayPicture->scaled(res_x*zoom,res_y*zoom)));
@@ -194,35 +196,8 @@ void DisplayWindow::changeDisplay(int msgid){
194196
}
195197

196198
void DisplayWindow::finish(int msgid){
197-
this->msgid = msgid;
199+
this->msgid = msgid;
198200
#ifdef Q_OS_WIN32
199-
/*char c[8184];
200-
c[0] = 2;
201-
HANDLE hFile = CreateFileW(
202-
L"\\\\.\\pipe\\SASMPIPE",
203-
GENERIC_WRITE,
204-
FILE_SHARE_READ | FILE_SHARE_WRITE,
205-
NULL,
206-
OPEN_EXISTING,
207-
0,
208-
NULL);
209-
if(hFile == INVALID_HANDLE_VALUE){
210-
emit printLog(QString("Could not create file object (")+QString::number(GetLastError())+")\n", Qt::red);
211-
return;
212-
}
213-
DWORD dwNoBytesWrote = 0;
214-
BOOL writeSuccess = WriteFile(
215-
hFile,
216-
c,
217-
sizeof(c),
218-
&dwNoBytesWrote,
219-
NULL);
220-
if(!writeSuccess){
221-
emit printLog(QString("Could not write to file (")+QString::number(GetLastError())+")\n", Qt::red);
222-
}
223-
if(!FlushFileBuffers(hFile)){
224-
emit printLog(QString("Could not flush the file (")+QString::number(GetLastError())+")\n", Qt::red);
225-
}*/
226201
#else
227202
mesg_buffer end;
228203
end.mesg_type = 2;
@@ -233,9 +208,8 @@ void DisplayWindow::finish(int msgid){
233208

234209
void DisplayWindow::zoomSettingsChanged(int value){
235210
zoom = std::pow(2, value);
236-
updateDisplay();
237-
scrollAreaWidgetContents->setFixedSize(res_x*zoom+26, res_y*zoom+26);
238-
this->setFixedSize(QSize(res_x+60, res_y+92));
211+
scrollAreaWidgetContents->setFixedSize(res_x*zoom+26, res_y*zoom+26);
212+
this->setFixedSize(QSize(res_x+60, res_y+92));
239213
displayImageLabel->setPixmap(QPixmap::fromImage(displayPicture->scaled(res_x*zoom, res_y*zoom)));
240214
}
241215

0 commit comments

Comments
 (0)