As you can see from the title my problem is rather complex, so I'll try to break it apart and explain it step by step.
My original problem is to find the formula of the volume of a triangular prism (if the hypotenuse is $a$ then the corresponding altitude is $\frac{a}{2}$ and its length is also $a$ (if it was $\frac{a}{\sqrt{2}}$ it'd make it a half cube)) which is cut by a sphere (its diameter is $a$ and its radius is $R$) tangent to its 3 longitudinal edges and the 2 triangle faces of the triangular prism.
I searched for the answer for a while, but I figured it out it's better off finding a similar, but more symmetrical problem, because it's way too unique to find the answer for that, so I came up with the idea of a cube cut by a sphere tangent to all of its edges (the cube's edges is not equal to $a$, instead its face diagonal is $a$), which is similar enough to my problem, but I didn't find the answer for that either.
Finally, the title is the extension of the second, more symmetrical problem, where the cuboid is a lengthened cube which makes it a square prism, which length is $a$ (but the square's edges not equal to $a$) and the half of its volume is equals to what I originally looking for so it's practically identical with my original problem.
For me the whole problem is too complex. I can easily look up the formulas for the volume of a sphere or a triangular prism, but I can't deal with the section of them, although I've had an idea. If we take a square prism which is circumscribed about the half of the sphere from my original problem and its volume is $V_\Box=2R*2R*R=4 R^3$ then the hemisphere's volume is $V_\bigcirc=\frac{\pi}{6}V_\Box$ and the triangular prism's volume is $V_\bigtriangleup=\frac{1}{2}V_\Box$, so my theory is the volume I'm looking for is $\frac{\pi}{12}V_\Box$? But honestly, I don't think this layout would be that symmetrical.
I don't know how clear I was, so just in case I made a sketch about it. In the draw the dashed lines are the square prism circumscribed about the hemisphere and the shaded areas are the body which volume I want to find.