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

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

Open
pabmoflo opened this issue Mar 17, 2022 · 0 comments
Open

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

pabmoflo opened this issue Mar 17, 2022 · 0 comments

Comments

@pabmoflo
Copy link

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;
}
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

1 participant