First of all, I'm not sure about asking this question here. I guess the answer is in the literature, but for the moment I'm a bit confused... a pointer to a specific source would be very helpful! Thanks in advance.

Let $\mathcal S$ be a small category with the trivial topology (such that every presheaf is a sheaf) and $O$ a presheaf of $\mathbb{R}$-algebras on it. Then $(\mathcal S, O)$ is a ringed site and $\mathrm{Mod}(\mathcal O)$, the category of $O$-modules, has enough injectives.

I am interested in the derived functors $\mathrm{Ext}^n(\mathbb{R}_{\mathcal S},-)$ of $\mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(\mathbb{R}_{\mathcal S}, -)$, where $\mathbb{R}$ is the presheaf $X\mapsto \mathbb{R}$ with trivial $O$-action. (This corresponds to topos cohomology, no?) Such functors are defined in terms of injective resolutions.

Some hypotheses on $\mathcal S$ (not ad-hoc, they come from the nature of the problem) allow me to build a projective resolution $P^\bullet \to \mathbb{R}_{\mathcal S}$; in fact, it is the usual bar resolution on each object of $\mathcal S$.

I define now \begin{align} \underline{\mathrm{Ext}}^0(\mathbb{R}_{\mathcal S},B) &= \ker(\mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_0,B) \to \mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_1,B)), \\ \underline{\mathrm{Ext}}^i(\mathbb{R}_{\mathcal S},B) &= \frac{\ker(\mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_i,B) \to \mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_{i+1},B))}{\mathrm{im}(\mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_{i-1},B) \to \mathrm{Hom}_{\mathrm{Mod}(\mathcal O)}(P_{i},B))}, \quad \text{for } i\geq 1. \label{Ext_n} \end{align}

Is it true that $\mathrm{Ext}^n(\mathbb{R}_{\mathcal S},B) \simeq \underline{\mathrm{Ext}}^n(\mathbb{R}_{\mathcal S},B)$?

This is true when the category has enough injectives and projectives, https://webusers.imj-prg.fr/~pierre.schapira/lectnotes/AlTo.pdf p. 80.

I guess another possible strategy would use the identification with the Yoneda extensions (cf. Universality of Ext functor using Yoneda extensions) or other techniques in derived categories.