Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsxMem broken #39

Open
slicer4ever opened this issue Dec 15, 2010 · 2 comments
Open

rsxMem broken #39

slicer4ever opened this issue Dec 15, 2010 · 2 comments

Comments

@slicer4ever
Copy link

void *rsxMem(s32 size) {
    return rsxMemAlign(size, 0);
}

the parameter's are reversed...(also, alignment needs to be set to 1)

alright, i propose this instead for mm.c:
#include "rsx/reality.h"

s8 initialized = 0;
gcmConfiguration config;
void *heap_pointer;

void rsxMemInit(void){
    gcmGetConfiguration(&config);
    heap_pointer = (void*)(u64)config.localAddress;
    initialized = 1;
    return;
}

// Really dumb allocater, It will do until we start dealing with textures and vertex buffers.
void *rsxMemAlign(s32 alignment, s32 size) {
    if (!initialized) rsxMemInit();
    void *pointer = heap_pointer;
    pointer = (void *)((((u64) pointer) + (alignment-1)) & (-alignment)); // Align
    if ((u64) pointer + size > config.localAddress + config.localSize) return NULL;
    heap_pointer = (void *)((u64) pointer + size);
    return pointer;
}

void *rsxMem(s32 size) {
    if(!initialized) rsxMemInit();
    void *pointer = heap_pointer;
    if((u64)pointer+size > config.localAddress+config.localSize) return NULL;
    heap_pointer = (void*)((u64)pointer+size);
    return pointer;
}

although, that's the best i can do, i'm not certain what you guys wanted to do to fix the allocation

@phire
Copy link

phire commented Dec 19, 2010

Well thats a stupid mistake. I think I will just push on at implement the full malloc based system.

edit: also, how the hell do u properly code tag things?
you need at least four spaces before each line

@ooPo
Copy link
Member

ooPo commented Mar 15, 2011

Any progress on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants