| 891 | } |
| 892 | |
| 893 | int write_HLE() |
| 894 | { |
| 895 | s32 fd = a0; |
| 896 | u32 data = a1; |
| 897 | u32 count = a2; |
| 898 | |
| 899 | if (fd == 1) // stdout |
| 900 | { |
| 901 | const std::string s = Ra1; |
| 902 | iopConLog(ShiftJIS_ConvertString(s.data(), a2)); |
| 903 | pc = ra; |
| 904 | v0 = a2; |
| 905 | return 1; |
| 906 | } |
| 907 | else if (IOManFile* file = getfd<IOManFile>(fd)) |
| 908 | { |
| 909 | auto buf = std::make_unique<char[]>(count); |
| 910 | |
| 911 | [[unlikely]] |
| 912 | if (!iopMemSafeReadBytes(data, buf.get(), count)) |
| 913 | { |
| 914 | for (u32 i = 0; i < count; i++) |
| 915 | buf[i] = iopMemRead8(data + i); |
| 916 | } |
| 917 | |
| 918 | v0 = file->write(buf.get(), count); |
| 919 | |
| 920 | pc = ra; |
| 921 | return 1; |
| 922 | } |
| 923 | |
| 924 | return 0; |
| 925 | } |
| 926 | } // namespace ioman |
| 927 | |
| 928 | namespace sysmem |
nothing calls this directly
no test coverage detected