Comments (18)
Regarding your other comment in the code about why alignment doesn't work without the static keyword, it's because alignment on the stack (as a local variable) is impossible to guarantee.
from ps2sdk.
Yes. We may always have done that over the many years, so POSIX'fication of the PS2SDK just made this problem more visible. libmc in this project is an EE library.
The original documentation from Sony did not specify the standard flags, but it became the standard flags in the homebrew SDK.
from ps2sdk.
What file are you trying to read?
from ps2sdk.
I was basically traversing the tree and trying to read anything that wasn't a directory, didn't really matter which file I tried reading. Don't have the code anymore tho.
from ps2sdk.
sceMcResDeniedPermit is defined in the Sony documentation, as an error which sceMcSync() returns. Its definition seems to defer, depending on what function you called.
For example:
- If sceMcRead() was called: file was not opened with read privileges or a PS memory card is inserted.
- If sceMcDelete() was called: the file is in use or is read-only, or a PS memory card is inserted.
- If sceMcOpen() was called: the file was already opened with write priviledges and cannot be opened with write priviledges, the file has neither read nor write permissions, or a PS memory card is inserted.
from ps2sdk.
I hadn't opened the file before unless walking the directory or getting memory card info inadvertently opens the file or something weird like that. When I opened it I definitely opened it with read perms using O_RDONLY
and it was a PS2 memory card.
Also I just realised that I actually still have the project, here's the zip: https://files.catbox.moe/rn47bc.zip
from ps2sdk.
Was this built with Newlib? What's the value of O_RDONLY? Is it still 1?
If it's no longer 1, then that may be why.
from ps2sdk.
@sp193 I don't really understand what Newlib is tbh, I just built it with the standard toolchain
from ps2sdk.
@sp193 I don't really understand what Newlib is tbh, I just built it with the standard toolchain
Newlib was introduced in toolchain version 1.1, version 1.0 is the latest before that changes, however, I am not quite sure how newlib invention can affect that problem.
from ps2sdk.
He passes O_RDONLY to sceMcOpen(). If this is not equal to 1 (it was equal to 1, with the classic libc), then this operation may not work.
from ps2sdk.
He passes O_RDONLY to sceMcOpen(). If this is not equal to 1 (it was equal to 1, with the classic libc), then this operation may not work.
Yeah you're right, I just tried printing the O_RDONLY and it gives me 0
from ps2sdk.
Hello guys,
Sorry for the late reply.
@faissaloo I think that you're mixing things.
As you know we fully integrated newlib
in the past, making our toolchain more portable and standard.
Here watching your code I see you're mixing concepts, for instance:
mcOpen(0,0, currently_copying->fullpath, O_RDONLY);
You're using mcOpen
which is a NON POSIX
function, and using here the O_RDONLY
flag.
If you want to use these specific mcOpen, mcRead
functions you need to use the IOP
specific flags for it.
However the main reason why we implemented newlib
was to make the developer life easier, now you can use normal, open
, read
functions using the standard POSIX flags as O_RDONLY
.
int main()
{
int filedesc = open("mc0:/testfile.txt", O_WRONLY);
if(filedesc < 0)
return 1;
return 0;
}
You can take a look to this file, to understand how it works.
https://github.com/ps2dev/ps2sdk/blob/master/ee/libc/src/ps2sdkapi.c
Thanks
from ps2sdk.
Was this built with Newlib? What's the value of O_RDONLY? Is it still 1?
If it's no longer 1, then that may be why.
Hello @sp193,
If you take a look to my previous response, I think that he was mixing internal ps2 functions for open/read/close file with POSIX flags from newlib.
Thanks
from ps2sdk.
@fjtrujy For this program I'd like to avoid using the POSIX functions since they're blocking and EE threads can't seem to use IO. What should I be #include
ing to use those IOP_
values in my program? Or do I have to just copy them into my program manually?
from ps2sdk.
@fjtrujy For this program I'd like to avoid using the POSIX functions since they're blocking and EE threads can't seem to use IO. Thanks I'll take a look at the ps2sdkapi file you linked.
As I said before here you can the conversion done (IOP_O_RDONLY
):
https://github.com/ps2dev/ps2sdk/blob/master/ee/libc/src/ps2sdkapi.c#L218-L225
Thanks
from ps2sdk.
Perhaps we need to expose these in a header?
ps2sdk/ee/libc/src/ps2sdkapi.c
Lines 98 to 107 in f5fc572
So functions like mcOpen can be used with IOP flags.
Or we make it dummy proof, and convert the flags in mcOpen, just like we do in open? Then we don't have 2 sets of flags, and no confusion.
ps2sdk/ee/libc/src/ps2sdkapi.c
Lines 217 to 225 in f5fc572
I wasn't aware of other functions using these flags. Are there more functions like this on the EE that use IOP flags?
from ps2sdk.
The only RPC libraries that use these flags are:
- fileio (fileXio and fileio in the homebrew SDK).
- libmc
Given that they were originally prefixed with "sce" and Sony never described them to be POSIX-compliant, I think giving them separate definitions from the standard POSIX flag bits is also a suitable approach.
Conversion is a possibility, but we may end up mixing the POSIX flags with non-standard Sony flags. For example, sceOpen() was designed to allow SCE_CdSTREAM to be passed, to open a file for streaming. It's a part of the original design, even if it's not used in the homebrew world.
from ps2sdk.
This doesn't seem to be an issue anymore. Reopen if this is not the case
from ps2sdk.
Related Issues (20)
- How do I use ps2adpcm tool HOT 1
- MIPTBP1 and 2 incorrect bitmask HOT 2
- Why not add support for GB2312 encoding HOT 2
- cdrom filepaths broken by new changes to libcglue's __path_absolute() function HOT 1
- VU1 sample syncronization problem HOT 3
- The ps2dev sdk ships an incomplete opusfile install HOT 4
- [PROPOSAL]: dispatch IRX modules built by debug PS2SDK into the release section HOT 2
- Issue with `sleep` function HOT 7
- shortcomings in audsrv and upsampling HOT 4
- [DISCUSSION]: PPC toolchain on PS2SDK. Do we want it? HOT 4
- [MCMAN] different return value compared to sce modules. why? HOT 2
- ps2sdk now only works on latest pcsx2 HOT 5
- ELF loader broken HOT 1
- [FR] Replace non-working BIN2S and BIN2O with scripts HOT 1
- sceCdRM freezes when ELF was loaded by certain applications HOT 5
- Timer is not accurate enough.
- USB driver not working well with unaligned content HOT 5
- [System 2x6] default behaviour of `_libcglue_init()` causes system 2x6 to freeze before reaching `main()` HOT 6
- What tool for generating/editing textures?
- Issues compiling the ps2 port of SM64 and the new releases of OPL with the latest release of PS2DEV HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ps2sdk.