Answered alternative to sleep()

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
338
Points
953
I'm converting this notify to c++ and the sleep() method just freezes the game for 2.5 seconds without actually displaying the message, what is the best way to get around that freezing and have the message display? Thanks
 

Freezee

Moderator
Staff member
Messages
183
Reaction score
244
Points
423
You could always just remove the sleep() method entirely but it would run better with it. You say it freezes the game for 2.5 seconds? You could lower it to 500 or 1000 milliseconds.

Let me know if anything happens.
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
338
Points
953
You could always just remove the sleep() method entirely but it would run better with it. You say it freezes the game for 2.5 seconds? You could lower it to 500 or 1000 milliseconds.

Let me know if anything happens.
the point is i want it to display the message for 2.5 seconds then call the shut off for the message
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
338
Points
953
this is the c# function Release - (C#) BO2 Notification | CabConModding

this is what i have in c++ so far, all i need is the sleep
Code:
void Notify(char *notifTitle, char *notifBody, char *notifShader) {
    unsigned char byte28[1] = { 0x28 };
    unsigned char byte32on[32] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    unsigned char byte20[1] = { 0x20 };
    write_process(0x1C1FE73, &byte28[1], 1);
    sys_dbg_write_string(0x01C1FC65, notifTitle);
    sys_dbg_write_string(0x01C1FE65, notifShader);
    sys_dbg_write_string(0x1C1FD65, notifBody);
    write_process(0x1C1FF66, &byte32on[32], 32);
    write_process(0x0D50025, &byte20[1], 1);
    sleep(2500);
    unsigned char byte32off[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    write_process(0x1C1FF66, &byte32off[32], 32);
    sys_dbg_write_string(0x1C1FD65, "");
}
 

Freezee

Moderator
Staff member
Messages
183
Reaction score
244
Points
423
this is the c# function Release - (C#) BO2 Notification | CabConModding

this is what i have in c++ so far, all i need is the sleep
Code:
void Notify(char *notifTitle, char *notifBody, char *notifShader) {
    unsigned char byte28[1] = { 0x28 };
    unsigned char byte32on[32] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    unsigned char byte20[1] = { 0x20 };
    write_process(0x1C1FE73, &byte28[1], 1);
    sys_dbg_write_string(0x01C1FC65, notifTitle);
    sys_dbg_write_string(0x01C1FE65, notifShader);
    sys_dbg_write_string(0x1C1FD65, notifBody);
    write_process(0x1C1FF66, &byte32on[32], 32);
    write_process(0x0D50025, &byte20[1], 1);
    sleep(2500);
    unsigned char byte32off[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    write_process(0x1C1FF66, &byte32off[32], 32);
    sys_dbg_write_string(0x1C1FD65, "");
}


I'm not very experienced in C++ but, I'll try to help you as best as I can.


You might be able to do this.
Code:
void Notify(char *notifTitle, char *notifBody, char *notifShader) {
    unsigned char byte28[1] = { 0x28 };
    unsigned char byte32on[32] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    unsigned char byte20[1] = { 0x20 };
    write_process(0x1C1FE73, &byte28[1], 1);
    sys_dbg_write_string(0x01C1FC65, notifTitle);
    sys_dbg_write_string(0x01C1FE65, notifShader);
    sys_dbg_write_string(0x1C1FD65, notifBody);
    write_process(0x1C1FF66, &byte32on[32], 32);
    write_process(0x0D50025, &byte20[1], 1);
    unsigned char byte32off[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    write_process(0x1C1FF66, &byte32off[32], 32);
    sleep(2500);
    sys_dbg_write_string(0x1C1FD65, "");
}

Since I see the code and you used sleep() then tried writing a process
so I don't know if that will work or not.
 
Last edited:

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
338
Points
953
I'm not very experienced in C++ but, I'll try to help you as best as I can.


You might be able to do this.
Code:
void Notify(char *notifTitle, char *notifBody, char *notifShader) {
    unsigned char byte28[1] = { 0x28 };
    unsigned char byte32on[32] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    unsigned char byte20[1] = { 0x20 };
    write_process(0x1C1FE73, &byte28[1], 1);
    sys_dbg_write_string(0x01C1FC65, notifTitle);
    sys_dbg_write_string(0x01C1FE65, notifShader);
    sys_dbg_write_string(0x1C1FD65, notifBody);
    write_process(0x1C1FF66, &byte32on[32], 32);
    write_process(0x0D50025, &byte20[1], 1);
    unsigned char byte32off[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    write_process(0x1C1FF66, &byte32off[32], 32);
    sleep(2500);
    sys_dbg_write_string(0x1C1FD65, "");
}

Since I see the code and you used sleep() then tried writing a process
so I don't know if that will work or not.

this is the problem when there is a sleep in the notify
You do not have permission to view link Log in or register now.
 

Freezee

Moderator
Staff member
Messages
183
Reaction score
244
Points
423
Did you remove the sleep() and try the 'Notify" and see if it actually ever worked?
 

Pyrex BLJ

im done :)
Staff member
Messages
607
Reaction score
338
Points
953
Did you remove the sleep() and try the 'Notify" and see if it actually ever worked?
nothing happens because whats before the sleep creates the notification then whats after the sleep deletes the notification

the same code i have in c# works, all i need is either an alternative to sleep its self or how to thread the process in c++
 

Freezee

Moderator
Staff member
Messages
183
Reaction score
244
Points
423
I'm not quite sure since I'm not experienced in C++ but you can look on google for methods, If i remember old versions of C++ didn't have any sort of Sleep() function. Just let me know what happens.

Best regards.
- Freezee.
 

ohhsodead

Veteran
Messages
39
Reaction score
39
Points
568
I'm converting this notify to c++ and the sleep() method just freezes the game for 2.5 seconds without actually displaying the message, what is the best way to get around that freezing and have the message display? Thanks
I don't really know much C++, but maybe create a countdown/timer for your appropriate time span? Just an idea.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,744
Reaction score
2,824
Points
1,053
I'm converting this notify to c++ and the sleep() method just freezes the game for 2.5 seconds without actually displaying the message, what is the best way to get around that freezing and have the message display? Thanks
Maybe check out this question:
You do not have permission to view link Log in or register now.
 
Top