Skip to content

Allow choosing between "news:u" and "news:s" #493

@pabmoflo

Description

@pabmoflo

The current news init code defaults to using "news:u" to use the news service. If both services are available, and according to 3dbrew, there is no way to use the "news:s" service calls.

The following code would allow using both services:

Result newsInit(bool useNewsSService) {
	Result res;
	if (AtomicPostIncrement(&newsRefCount)) return 0;
	useNewsS = useNewsSService;
	const char* services = {"news:u", "news:s"};
	res = srvGetServiceHandle(&newsHandle, services[(int)useNewsS]);
	if (R_FAILED(res)) AtomicDecrement(&newsRefCount);
	return res;
}

Or if compatibility is needed:

static bool forceNewsS = false;

void newsForceNewsSInit(bool forceNewsSInit) {
	forceNewsS = forceNewsSInit;
}

Result newsInit(void) {
	Result res = 0;
	if (AtomicPostIncrement(&newsRefCount)) return 0;
	if (!forceNewsS)
		res = srvGetServiceHandle(&newsHandle, "news:u");
	useNewsS = R_FAILED(res) || forceNewsS ;
	if (useNewsS) res = srvGetServiceHandle(&newsHandle, "news:s");
	if (R_FAILED(res)) AtomicDecrement(&newsRefCount);
	return res;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions