Skip to content

Commit

Permalink
Disable buffering on samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptogenic committed Jun 17, 2020
1 parent 37f719d commit 04c6cea
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 10 deletions.
2 changes: 0 additions & 2 deletions samples/font/font/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ int main()
// Draw the sample text
const char *textLarge = "OpenOrbis Sample\nHello, World!";
const char *textSmall = "Built with the OpenOrbis toolchain...";
const char *textWrapContent = "text wrapping example, it breaks line based on width of container";

drawText((char *)textLarge, fontLarge, 150, 400, bgColor, fgColor);
drawText((char *)textSmall, fontSmall, 150, 750, bgColor, fgColor);
drawTextContainer((char *)textWrapContent, fontSmall, 0, 0, 500, 300, bgColor, fgColor);

// Submit the frame buffer
sceVideoOutSubmitFlip(video, ActiveFrameBufferIdx, ORBIS_VIDEO_OUT_FLIP_VSYNC, frameID);
Expand Down
3 changes: 3 additions & 0 deletions samples/input/input/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ int main(void)
unsigned int prevButtons = 0;
OrbisPadData padData;

// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

// Initialize the Pad library
if (scePadInit() != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/library_example/library_example/lib.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdio.h>

#include "libexample.h"
#include "libExample.h"

int testLibraryFunction()
{
Expand Down
9 changes: 6 additions & 3 deletions samples/networking/networking/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ int main(void)
const char *msg = "ping";
struct sockaddr_in addr;

// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

(void)memset(&addr, 0, sizeof(struct sockaddr_in));

int sock = socket(AF_INET, SOCK_STREAM, 0);
Expand All @@ -23,19 +26,19 @@ int main(void)
if (inet_pton(AF_INET, IP, &addr.sin_addr) <= 0)
{
printf("[DEBUG] [ERROR] IP Address not supported.\n");
return -1;
for (;;);
}

if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
{
printf("[DEBUG] [ERROR] Failed to connect to %s:%d.\n", IP, PORT);
return -1;
for (;;);
}

printf("[DEBUG] Sending message to %s:%d.\n", IP, PORT);
send(sock, msg, strlen(msg), 0);
printf("[DEBUG] Message sent. Closing and infinitely looping.\n");

close(sock);
for (;;) {}
for (;;);
}
3 changes: 3 additions & 0 deletions samples/pngdec/pngdec/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ int main()
int curFrame = 0;
void *surfaceBuff = 0;

// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

// Set colors
bgColor = { 0, 0, 0 };

Expand Down
8 changes: 4 additions & 4 deletions samples/pthread/pthread/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ void threadedFunction()

int main()
{
// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

printf("Pthread example\n-\n");

scePthreadCreate(&myThread, NULL, (void *)threadedFunction, NULL, "example_pthread");
Expand All @@ -24,8 +27,5 @@ int main()
sceKernelUsleep(2 * 100000);
}

sceKernelUsleep(3 * 1000000);
scePthreadCancel(myThread);

return 0;
for (;;);
}
3 changes: 3 additions & 0 deletions samples/system/system/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ int main(void)
int userID;
char username[32];

// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

// Get the user ID
OrbisUserServiceInitializeParams param;
param.priority = ORBIS_KERNEL_PRIO_FIFO_LOWEST;
Expand Down
3 changes: 3 additions & 0 deletions samples/using_library/using_library/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ int main()
{
int rv;

// No buffering
setvbuf(stdout, NULL, _IONBF, 0);

// Open the library and resolve symbols
exampleLib = sceKernelLoadStartModule("/app0/libExample.prx", 0, NULL, 0, 0, 0);
rv = sceKernelDlsym(exampleLib, "_Z19testLibraryFunctionv", (void**)&testLibraryFunction);
Expand Down

0 comments on commit 04c6cea

Please sign in to comment.