Console.cpp 752 B

123456789101112131415161718192021222324252627
  1. #include "os/c-api/il2cpp-config-platforms.h"
  2. #include "os/Console.h"
  3. #include "os/File.h"
  4. #include "utils/StringUtils.h"
  5. extern "C"
  6. {
  7. #if IL2CPP_TINY
  8. void STDCALL UnityPalConsoleWrite(const char* message, bool newline)
  9. {
  10. il2cpp::os::FileHandle* fileHandle = il2cpp::os::File::GetStdOutput();
  11. int unused;
  12. if (message == NULL)
  13. {
  14. il2cpp::os::File::Write(fileHandle, "", 0, &unused);
  15. }
  16. else
  17. {
  18. std::string formattedMessage = il2cpp::utils::StringUtils::Printf("%s%s", message, newline ? il2cpp::os::Console::NewLine() : "");
  19. il2cpp::os::File::Write(fileHandle, formattedMessage.c_str(), (int)formattedMessage.size(), &unused);
  20. }
  21. }
  22. #endif
  23. }